AnsweredAssumed Answered

global rule for adding versionable aspect to contents

Question asked by msj4u on Mar 19, 2014
Latest reply on Mar 20, 2014 by msj4u
hi,

i am using following code to create a rule in /app:company_home folder and on children spaces.

rule is created but is not executed as expected.

further more when i try to edit that rule from UI explorer it gives
org.alfresco.error.AlfrescoRuntimeException: 02190269 Rules with non-composite actions are not currently supported by the UI



public boolean createVersionableRule() {
      boolean status = true;
      try {
         Action action = new Action();
         action.setActionName("add-features");
         Condition[] conditions = new Condition[1];
         Condition condition = new Condition();
         condition.setConditionName("no-condition");
         conditions[0] = condition;
         action.setConditions(conditions);
         NamedValue namedValue = new NamedValue();
         namedValue.setName("aspect-name");
         namedValue.setValue(Constants.ASPECT_VERSIONABLE);
         NamedValue[] namedValues = new NamedValue[1];
         namedValues[0] = namedValue;
         action.setParameters(namedValues);
         Rule[] rules = new Rule[1];
         Rule rule = new Rule();
         rule.setAction(action);
         rule.setTitle("Add versionable aspect");
         rule.setDescription("Add the versionable aspect to all the items inthe space");
         rule.setExecuteAsynchronously(false);
         rule.setRuleTypes(new String[]{"inbound"});
         rules[0] = rule;
         Reference reference = new Reference(CMSUtil.SPACE_STORE, CMSUtil.getCompanyHomeUUID(), CMSUtil.DEFAULT_COMPANY_HOME_NAME);
         Rule[] resultList = WebServiceFactory.getActionService().saveRules(reference, rules);
         if(resultList!=null && resultList.length>0) {
            Reference owningReference = resultList[0].getOwningReference();
            Reference ruleReference = resultList[0].getRuleReference();
            log.debug("owningReference " + owningReference.getUuid());
            log.debug("ruleReference " + ruleReference.getUuid());
         }
      } catch(Exception e) {
         status = false;
         log.error("problem in creating versionable rule", e);
      }
      return status;
   }


can somebody help here ?

Outcomes