As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
Hi ….i woud like to know if exists samples for creating a rule for a giving space..Thanks in advance!!!
private void addRootRules() throws RemoteException { String rootSpaceName = "Test Space"; Reference rootReference = new Reference(AppConstants.SPACES_STORE, null, "/app:company_home/cm:" + ISO9075.encode(rootSpaceName)); NamedValue[] parameters = new NamedValue[]{new NamedValue("aspect-name", false, "SR Aspect", null)}; Action newAction = new Action(); newAction.setActionName("add-features"); newAction.setParameters(parameters); Condition condition = new Condition(); condition.setId("1"); condition.setConditionName("no-condition"); condition.setInvertCondition(false); condition.setParameters(new NamedValue[]{new NamedValue("type", false, Constants.TYPE_CONTENT, null)}); Rule newRule = new Rule(); newRule.setRuleTypes(new String[]{"Inbound"}); newRule.setTitle("This rule adds the "SR Aspect" aspect"); newRule.setDescription("Add "SR Aspect""); newRule.setAction(newAction); Rule[] savedRule = WebServiceFactory.getActionService().saveRules(rootReference, new Rule[]{newRule}); Reference reference = new Reference(AppConstants.SPACES_STORE, savedRule[0].getRuleReference().getUuid(), null); Predicate predicate = new Predicate(new Reference[]{reference}, AppConstants.SPACES_STORE, null); Node[] ruleReferenceWithProperties = WebServiceFactory.getRepositoryService().get(predicate); // NamedValue[] properties = new NamedValue[] { Utils.createNamedValue(Constants.PROP_NAME, "applyToChildren") }; //NamedValue[] properties = new NamedValue[] { Utils.createNamedValue("applyToChildren", "True") }; NamedValue properties = Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/rule/1.0", "applyToChildren"), "true"); CMLUpdate update = new CMLUpdate(new NamedValue[] {properties}, predicate, null); CML cml = new CML(); cml.setUpdate(new CMLUpdate[] { update }); UpdateResult[] results = WebServiceFactory.getRepositoryService().update(cml); }