Files
.externalToolBuilders
config
source
cpp
java
org
alfresco
example
filesys
jcr
model
repo
action
admin
attributes
audit
avm
cache
clt
coci
configuration
content
copy
deploy
descriptor
dictionary
domain
exporter
forum
importer
jscript
AVM.java
AVMNode.java
Actions.java
AlfrescoRhinoScriptDebugger.java
Association.java
BaseScopableProcessorExtension.java
Behaviour.java
CategoryNode.java
CategoryTemplateNode.java
ChildAssociation.java
Classification.java
ClasspathScriptLocation.java
CrossRepositoryCopy.java
ExecuteScriptJob.java
Node.java
People.java
RhinoScriptProcessor.java
RhinoScriptTest.java
Scopeable.java
ScriptAction.java
ScriptBehaviour.java
ScriptBehaviourTest.java
ScriptLogger.java
ScriptUtils.java
ScriptableHashMap.java
ScriptableQNameMap.java
Search.java
Session.java
ValueConverter.java
test-context.xml
test_onAddAspect_cmCountable.js
test_onCreateChildAssociation.js
test_onCreateNode_cmContent.js
test_script1.js
test_script2.js
test_script3.js
lock
model
module
node
ownable
policy
processor
remote
rule
search
security
service
template
transaction
version
workflow
sandbox
service
tools
util
apache
queryRegister.dtd
meta-inf
test-resources
web
.classpath
.project
build.xml
alfresco-community-repo/source/java/org/alfresco/repo/jscript/test_onCreateChildAssociation.js
Derek Hulley 72bb79696d Merged 1.4 to HEAD
svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4252 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V1.4@4294 .
   svn revert root\common\common.xml
   svn resolved root\projects\repository\config\alfresco\script-services-context.xml


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4634 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2006-12-18 13:45:11 +00:00

52 lines
1.3 KiB
JavaScript

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
if (behaviour.name == null && behaviour.name != "onCreateChildAssociation")
{
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
{
if (behaviour.args.length == 1)
{
var childAssoc = behaviour.args[0];
logger.log("Assoc type: " + childAssoc.type);
logger.log("Assoc name: " + childAssoc.name);
logger.log("Parent node: " + childAssoc.parent.id);
logger.log("Child node: " + childAssoc.child.id);
logger.log("Is primary: " + childAssoc.isPrimary());
logger.log("Nth sibling: " + childAssoc.nthSibling);
}
else
{
logger.log("The number of arguments is incorrect.")
scriptFailed = true;
}
}
if (scriptFailed == false)
{
childAssoc.child.addAspect("cm:versionable");
childAssoc.child.save();
}