10-15-2007 05:21 PM
10-23-2007 06:11 AM
11-05-2007 10:48 AM
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);
}
11-07-2007 10:24 AM
03-12-2008 07:46 AM
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.