 
					
				
		
06-09-2011 07:01 AM
<aspect name="gs:publishable">
         <title>Metadati sulle informazioni di pubblicazione</title>
         <properties>
            <property name="gs:ToBePublished">
               <type>d:boolean</type>
               <mandatory>true</mandatory>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>true</stored>
                  <tokenised>false</tokenised>
               </index>
            </property>
            <property name="gs:PublishDate">
               <type>d:date</type>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>false</stored>
                  <tokenised>both</tokenised>
               </index>
            </property>
            <property name="gs:UnpublishDate">
               <type>d:date</type>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>false</stored>
                  <tokenised>both</tokenised>
               </index>
            </property>
         </properties>
      </aspect>06-09-2011 10:56 AM
 ublishable aspect (you can use server-side JavaScript based behaviors but they are less common). When properties are updated, the behavior can check to see if the flag is true, and if it is, set the publish date.
ublishable aspect (you can use server-side JavaScript based behaviors but they are less common). When properties are updated, the behavior can check to see if the flag is true, and if it is, set the publish date. 
					
				
		
06-10-2011 05:47 AM
<bean id="onChangePublishDate" 
       class="org.alfresco.repo.policy.registration.ClassPolicyRegistration"
       parent="policyRegistration">
       <property name="policyName">
              <value>{http://www.alfresco.org}onUpdateProperties</value> <!– this is the method that triggers my behaviour… is it correct? –>
       </property>
       <property name="className">
             <value>????????</value>  <!– What should I put here? –>
       </property>
       <property name="behaviour">
              <bean class="org.alfresco.repo.jscript.ScriptBehaviour"
                    parent="scriptBehaviour">
                   <property name="location">
                          <bean class="org.alfresco.repo.jscript.ClasspathScriptLocation">
                               <constructorarg>
                                        <value>alfresco/extension/scripts/myscript.js</value>
                               </constructorarg>
                          </bean>
                   </property>
              </bean>
      </property>
</bean>
<import resource="classpath:alfresco/extension/scripts/myUpgradeScriptFields.js">
var scriptFailed = false;
// Have a look at the behaviour object that should have been passed
if (behaviour == null) {
    logger.log("The behaviour object has not been set.");
    scriptFailed = true;
}
// Check the name of the behaviour…. in my case is onUpdateProperties???
if (behaviour.name == null && behaviour.name != "onUpdateProperties") {
    logger.log("The behaviour name has not been set correctly.");
scriptFailed = true;
} else {
    logger.log("Behaviour name: " + behaviour.name);
}
// in my case I need to check the arguments??
if (behaviour.args == null) {
   logger.log("The args have not been set.");
   scriptFailed = true;
} else {
     logger.log("Calling update fields");
     updateFields(myArg); //method implemented in the myUpgradeScriptFields.js
} else {
     logger.log("The number of arguments is incorrect.");
     scriptFailed = true;
}
}
06-10-2011 12:48 PM
<bean id="onUpdateHrDoc" class="org.alfresco.repo.policy.registration.ClassPolicyRegistration" parent="policyRegistration">
        <property name="policyName">
            <value>{http://www.alfresco.org}onUpdateNode</value>
        </property>
        <property name="className">
            <value>{http://www.someco.com/model/content/1.0}hrDoc</value>
        </property>
        <property name="behaviour">
           <bean class="org.alfresco.repo.jscript.ScriptBehaviour" parent="scriptBehaviour">
                        <property name="location">
                                <bean class="org.alfresco.repo.jscript.ClasspathScriptLocation">
                                <constructor-arg>
                                   <value>alfresco/extension/scripts/onUpdateNode.js</value>
                        </constructor-arg>
                               </bean>
                        </property>
           </bean>
        </property>
    </bean> 
					
				
		
06-13-2011 10:46 AM
Regarding your JavaScript, it looks like the right approach, although syntactically it may need some help. I think I see a problem with your final if-else block–are there two else's there?
16:36:24,453 DEBUG [org.alfresco.repo.jscript.ScriptLogger] json form submission for item:
16:36:24,453 DEBUG [org.alfresco.repo.jscript.ScriptLogger]    kind = node
16:36:24,453 DEBUG [org.alfresco.repo.jscript.ScriptLogger]    id = workspace/SpacesStore/b2725bbb-98c4-4bc2-a1b5-bcd247eae99f
16:36:24,484 DEBUG [org.alfresco.repo.jscript.ScriptLogger] org.alfresco.scripts.ScriptException: 05130132 Failed to execute script 'alfresco/extension/scripts/onChangePublishDate.js': null
16:36:24,484 DEBUG [org.alfresco.repo.jscript.ScriptLogger] Returning 500 status code<bean id="onChangePublishDateNode"
           class="org.alfresco.repo.policy.registration.ClassPolicyRegistration"
           parent="policyRegistration">
           <property name="policyName">
                  <value>{http://www.alfresco.org}onUpdateProperties</value>
           </property>
           <property name="className">
                 <value>{http://giunti.noze.it/model/content/1.0}properties</value>
           </property>
           <property name="behaviour">
                  <bean class="org.alfresco.repo.jscript.ScriptBehaviour"
                        parent="scriptBehaviour">
                       <property name="location">
                              <bean class="org.alfresco.repo.jscript.ClasspathScriptLocation">
                                   <constructor-arg>
                                            <value>alfresco/extension/scripts/onChangePublishDate.js</value>
                                   </constructor-arg>
                              </bean>
                       </property>
                  </bean>
          </property>
    </bean> 
					
				
		
06-13-2011 11:43 AM
<import resource="classpath:alfresco/extension/script/changeDate.js">06-13-2011 11:52 AM
 
					
				
		
06-13-2011 12:26 PM
06-13-2011 12:29 PM
<property name="className">
                 <value>{http://giunti.noze.it/model/content/1.0}properties</value>
           </property> 
					
				
		
06-14-2011 03:46 AM
From looking at your spring config, it looks like you've specified your class name as:
<property name="className">
<value>{http://giunti.noze.it/model/content/1.0}properties</value>
</property>
I was expecting that to be a type or an aspect. Do you have a type or an aspect named "{http://giunti.noze.it/model/content/1.0}properties"?
Jeff
<bean id="giuntiDictionaryModelBootstrap.dictionaryBootstrap"
      parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
      <property name="models">
         <list>
            <value>alfresco/extension/giunti-model.xml</value>
         </list>
      </property>
   </bean>
<namespaces>
      <namespace uri="http://giunti.noze.it/model/content/1.0" prefix="gs" />
   </namespaces>
<aspect name="gs:properties">
<title>…. </title>
<properties>…
…
</properties>
 
					
				
				
			
		
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.