AnsweredAssumed Answered

Problem while creating new rule

Question asked by vinkk on Aug 20, 2009
Hi
iam trying to create a new Rule(org.alfresco.service.cmr.rule.Rule)

this is my script

NamedValue[] parameters = new NamedValue[]{new NamedValue("aspect-name", false, "SR Aspect", null)};
            Action action = actionservice.createAction("new");
            action.setDescription("add-features");
            action.setParameterValue("test", parameters);

           org.alfresco.service.cmr.rule.Rule newRule = new org.alfresco.service.cmr.rule.Rule();
            newRule.setNodeRef(nodeRef);
            newRule.setTitle("This rule adds the aspect");
            newRule.setDescription("Add ");
            newRule.setRuleType("inbound");
            newRule.setAction(action);
             ruleService.saveRule(nodeRef, newRule);


but i get following errors



          <tr><td><b>Message:</b></td><td>Found 1 integrity violations:
The association source type is incorrect:
   Source Node: workspace://SpacesStore/43580422-0a34-4592-a5e2-7ef643519045
   Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/rule/1.0}rule], name={http://www.alfresco.org/model/rule/1.0}action, target class={http://www.alfresco.org/model/action/1.0}action, source role=null, target role=null]
   Required Source Type: {http://www.alfresco.org/model/rule/1.0}rule
   Actual Source Type: {http://www.alfresco.org/model/content/1.0}folder</td></tr>
            <tr><td></td><td> </td></tr>
   <tr><td><b>Exception:</b></td><td>org.alfresco.repo.node.integrity.IntegrityException - Found 1 integrity violations:
The association source type is incorrect:
   Source Node: workspace://SpacesStore/43580422-0a34-4592-a5e2-7ef643519045
   Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/rule/1.0}rule], name={http://www.alfresco.org/model/rule/1.0}action, target class={http://www.alfresco.org/model/action/1.0}action, source role=null, target role=null]
   Required Source Type: {http://www.alfresco.org/model/rule/1.0}rule
   Actual Source Type: {http://www.alfresco.org/model/content/1.0}folder</td></tr>
   <tr><td></td><td> </td></tr>


can any one please help me

thanks
vinkk

Outcomes