03-05-2013 05:20 AM
03-07-2013 08:11 AM
03-07-2013 09:49 AM
03-08-2013 05:09 AM
03-08-2013 06:17 AM
03-08-2013 08:21 AM
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<!– Registration of new models –>
<bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/extension/fgempModel.xml</value>
</list>
</property>
<property name="labels">
<list>
<value>alfresco/extension/fgempModelRepo</value>
</list>
</property>
</bean>
<bean id="onDischargeManagementRef"
class="org.alfresco.repo.policy.registration.ClassPolicyRegistration"
parent="policyRegistration">
<property name="policyName">
<value>{http://www.alfresco.org}onAddAspect</value>
</property>
<property name="className">
<value>{http://www.farthestgate.co.uk/emp/model/1.0}discharged</value>
</property>
<property name="behaviour">
<bean class="org.alfresco.repo.jscript.ScriptBehaviour"
parent="scriptBehaviour">
<property name="notificationFrequency" value="FIRST_EVENT"/>
<property name="location">
<bean class="org.alfresco.repo.jscript.ClasspathScriptLocation">
<constructor-arg>
<value>alfresco/extension/scripts/onAddDischargedAspect.js</value>
</constructor-arg>
</bean>
</property>
</bean>
</property>
</bean>
</beans>
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;
}
if (behaviour.name == null && behaviour.name != "onAddAspect") {
logger.log("The behaviour name has not been set correctly.");
scriptFailed = true;
} else {
logger.log("Behaviour name: " + behaviour.name);
}
// Check the arguments
if (behaviour.args == null) {
logger.log("The args have not been set.");
scriptFailed = true;
} else {
// We should have nodeType in [0] and a list of aspects in [1]
if (behaviour.args.length == 2) {
var docNode = behaviour.args[0];
try {
docNode.properties["{http://www.farthestgate.co.uk/emp/model/1.0}whoDischarged"] = person.properties.userName;
} catch (e) {
logger.log("Set whoDischarged failed " + e.message);
}
try {
docNode.properties["{http://www.farthestgate.co.uk/emp/model/1.0}whenDischarged"] = new Date();
} catch (e2) {
logger.log("Set whenDischarged failed " + e2.message);
}
docNode.save();
} else {
logger.log("The number of arguments is incorrect.it is " + behaviour.args.length + " They are " + behaviour.args[0] + " and " + behaviour.args[1]);
scriptFailed = true;
}
}
docNode.properties["{http://www.farthestgate.co.uk/emp/model/1.0}whoDischarged"] = person.properties.userName;
03-11-2013 02:32 AM
03-11-2013 06:52 AM
try {
if(person != null) {
logger.log("person != null");
docNode.properties["{http://www.farthestgate.co.uk/emp/model/1.0}whoDischarged"] = person.properties.name;
} else {
logger.log("person == null");
}
} catch (e) {
logger.log("Set whoDischarged failed person check null, use person.properties.name" + e.message);
}
10:31:25,372 DEBUG [org.alfresco.repo.jscript.ScriptLogger] Behaviour name: onAddAspect
10:31:25,379 DEBUG [org.alfresco.repo.jscript.ScriptLogger] Set whoDischarged failed person check null, use person.properties.name"person" is not defined.
try {
if(person.properties.name != null) {
logger.log("person.properties.name != null");
docNode.properties["{http://www.farthestgate.co.uk/emp/model/1.0}whoDischarged"] = person.properties.name;
} else {
logger.log("person.properties.name == null");
}
} catch (e) {
logger.log("Set whoDischarged, use person.properties.name" + e.message);
}
10:50:17,759 DEBUG [org.alfresco.repo.jscript.ScriptLogger] Behaviour name: onAddAspect
10:50:17,766 DEBUG [org.alfresco.repo.jscript.ScriptLogger] Set whoDischarged, use person.properties.name"person" is not defined.
03-18-2013 05:08 AM
03-21-2013 08:46 PM
var sras = ServiceRegistry.AuthenticationService.getCurrentUserName();
var sras = serviceRegistry.AuthenticationService.getCurrentUserName();
var sras = servicesegistry.AuthenticationService.getCurrentUserName();
var sras = Serviceregistry.AuthenticationService.getCurrentUserName();
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.