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.
// Create the action NamedValue[] parameters = new NamedValue[]{new NamedValue("aspect-name", false, Constants.ASPECT_CLASSIFIABLE, null)}; Action newAction = new Action(); newAction.setActionName("add-features"); newAction.setParameters(parameters); // Create the rule Rule newRule = new Rule(); newRule.setRuleTypes(new String[]{"incomming"}); newRule.setTitle("This rule adds the classificable aspect"); newRule.setAction(newAction); // Save the rule Rule[] saveResults1 = this.actionService.saveRules(BaseWebServiceSystemTest.contentReference, new Rule[]{newRule});
ActionItemDefinition[] actions = WebServiceFactory.getActionService().getActionDefinitions(); trace += "Existen "+ actions.length + " definiciones de acciones.<BR>"; for (int j=0; j<=(actions.length-1); j++){ trace += "Definición("+j+"): "+actions[j].getName() + " | " + actions[j].getType().toString()+"<BR>"; }
ActionItemDefinition[] conditions = WebServiceFactory.getActionService().getConditionDefinitions(); trace += "Existen "+ conditions.length + " definiciones de condiciones.<BR>"; for (int j=0; j<=(conditions.length-1); j++){ trace += "Definición("+j+"): "+conditions[j].getName() + " | " + conditions[j].getType().toString() + "<BR>"; }
RuleType[] array = WebServiceFactory.getActionService().getRuleTypes(); trace += "Existen "+ array.length + " tipos de reglas:<BR>"; for (int j=0; j<=(array.length-1); j++){ trace += "Regla("+j+"): "+array[j].getName() + " | " + array[j].getDisplayLabel()+"<BR>"; }
Existen 15 definiciones de acciones.Definición(0): transform | actionDefinición(1): script | actionDefinición(2): copy | actionDefinición(3): add-features | actionDefinición(4): link-category | actionDefinición(5): simple-workflow | actionDefinición(6): mail | actionDefinición(7): import | actionDefinición(8): extract-metadata | actionDefinición(9): check-out | actionDefinición(10): remove-features | actionDefinición(11): check-in | actionDefinición(12): specialise-type | actionDefinición(13): transform-image | actionDefinición(14): move | action
Existen 6 definiciones de condiciones.Definición(0): compare-property-value | conditionDefinición(1): in-category | conditionDefinición(2): no-condition | conditionDefinición(3): has-aspect | conditionDefinición(4): compare-mime-type | conditionDefinición(5): is-subtype | condition
Existen 3 tipos de reglas:Regla(0): update | UpdateRegla(1): outbound | OutboundRegla(2): inbound | Inbound
//Condition trace += "Trying to create the condition…"; Condition condition = new Condition(); condition.setId("1"); condition.setConditionName("is-subtype"); condition.setInvertCondition(false); condition.setParameters(new NamedValue[]{new NamedValue("is-subtype", false, Constants.TYPE_CONTENT, null)}); trace += "Done!<BR>"; //Action trace += "Trying to create the action…"; NamedValue[] parameters = new NamedValue[]{new NamedValue("aspect-name", false, Constants.ASPECT_VERSIONABLE, null)}; Action cvs_action = new Action(); cvs_action.setId("1"); cvs_action.setActionName("add-features"); cvs_action.setActionReference(folder_ref); cvs_action.setParameters(parameters); cvs_action.setConditions(new Condition[]{condition}); trace += "Done!<BR>"; //Rule trace += "Trying to create the rule…"; Rule cvs_rule = new Rule(); cvs_rule.setRuleTypes(new String[]{"Inbound"}); cvs_rule.setTitle("Versioning"); cvs_rule.setDescription("All content in this folder has \"Version History\""); cvs_rule.setRuleReference(folder_ref); cvs_rule.setAction(cvs_action); trace += "Done!<BR>"; //Saving rule trace += "Trying to save the rule…"; WebServiceFactory.getActionService().saveRules(folder_ref, new Rule[]{cvs_rule}); trace += "Done!<BR>";
//Condition Condition condition = new Condition(); condition.setId("1"); condition.setConditionName("is-subtype"); condition.setInvertCondition(false); condition.setParameters(new NamedValue[]{new NamedValue("is-subtype", false, Constants.TYPE_CONTENT, null)}); //Action NamedValue[] parameters = new NamedValue[]{new NamedValue("aspect-name", false, Constants.ASPECT_VERSIONABLE, null)}; Action cvs_action = new Action(); cvs_action.setId("1"); cvs_action.setActionName("add-features"); cvs_action.setTitle("Add version to content"); cvs_action.setDescription("This action will add versionable aspect to every content in the folder, so every file will have version history"); cvs_action.setExecuteAsynchronously(false); cvs_action.setReference(published_folder); cvs_action.setParameters(parameters); //Rule Rule cvs_rule = new Rule(); cvs_rule.setRuleType("inbound"); cvs_rule.setTitle("Versioning"); cvs_rule.setDescription("All content in this folder has \"Version History\""); cvs_rule.setReference(published_folder); cvs_rule.setConditions(new Condition[]{condition}); cvs_rule.setActions(new Action[]{cvs_action}); //Saving rule WebServiceFactory.getActionService().saveRules(published_folder, new Rule[]{cvs_rule});
//UUID objects UUID condition_id = UUID.randomUUID(); UUID action_id = UUID.randomUUID(); //Condition Condition condition = new Condition(); condition.setId(condition_id.toString()); condition.setConditionName("is-subtype"); condition.setInvertCondition(false); condition.setParameters(new NamedValue[]{new NamedValue("type", false, Constants.TYPE_CONTENT, null)}); //Action NamedValue[] parameters = new NamedValue[]{new NamedValue("aspect-name", false, Constants.ASPECT_VERSIONABLE, null)}; Action cvs_action = new Action(); cvs_action.setId(action_id.toString()); cvs_action.setActionName("add-features"); cvs_action.setTitle("Add version to content"); cvs_action.setDescription("This action will add versionable aspect to every content in the folder, so every file will have version history"); cvs_action.setExecuteAsynchronously(false); cvs_action.setReference(published_folder); cvs_action.setParameters(parameters); //Rule Rule cvs_rule = new Rule(); cvs_rule.setRuleType("inbound"); cvs_rule.setTitle("Versioning"); cvs_rule.setDescription("All content in this folder has \"Version History\""); cvs_rule.setReference(published_folder); cvs_rule.setConditions(new Condition[]{condition}); cvs_rule.setActions(new Action[]{cvs_action}); //Saving rule WebServiceFactory.getActionService().saveRules(published_folder, new Rule[]{cvs_rule});