cancel
Showing results for 
Search instead for 
Did you mean: 

set association of custom type in custom action

ccc_chen
Champ in-the-making
Champ in-the-making
Hi! I am trying to write custom action which like the move-replacing action by ecmarchitect.
I get one problem that i can not solve.

First, I have create two custom type which is derived from the cm:folder, call test:model and test:version. The test:model has an association test:lastVersion which has the test:version type.

I want to implement an custom action, which set the test:lastVersion (association) to the given version.
The executeImpl funktion is showed as follow:

protected void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef)
{
    NodeRef version = (NodeRef)ruleAction.getParameterValue("test-version");
    NodeRef model = (NodeRef)ruleAction.getParameterValue("test-model");

    nodeService.setProperty(model,
        QName.createQName(NAMESPACE_TEST_CONTENT_MODEL, "lastVersion"), version);
}
In this code the version and model are the parameters of the action. I can modify all other properties of both nodes exclusive the association (in this case test:lastVersion). Perhaps the type of the version is wrong. I need help, any ideas.
1 REPLY 1

ccc_chen
Champ in-the-making
Champ in-the-making
I found the solution.
In this case, createAssociation is used to create an association, setProperties is used to modify the properties.
Thanks.