12-27-2006 10:06 AM
12-27-2006 11:58 AM
// 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});
It looks simple, but I didn't manage to find a file where all the constants enum (like ActionName, RuleType etc…) are repertoried. It looks like it's hard written in the code on each class 😞12-28-2006 10:01 AM
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 | action
Definición(1): script | action
Definición(2): copy | action
Definición(3): add-features | action
Definición(4): link-category | action
Definición(5): simple-workflow | action
Definición(6): mail | action
Definición(7): import | action
Definición(8): extract-metadata | action
Definición(9): check-out | action
Definición(10): remove-features | action
Definición(11): check-in | action
Definición(12): specialise-type | action
Definición(13): transform-image | action
Definición(14): move | action
Existen 6 definiciones de condiciones.
Definición(0): compare-property-value | condition
Definición(1): in-category | condition
Definición(2): no-condition | condition
Definición(3): has-aspect | condition
Definición(4): compare-mime-type | condition
Definición(5): is-subtype | condition
Existen 3 tipos de reglas:
Regla(0): update | Update
Regla(1): outbound | Outbound
Regla(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>";
01-03-2007 01:14 PM
//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});
01-09-2007 07:49 AM
01-09-2007 01:02 PM
//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});
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.