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.
String userName = "admin"; String password = "admin"; AuthenticationUtils.startSession(userName,password); try{ //creation of the actionservice with alfresco classes ActionServiceLocator actionservicelocator = new ActionServiceLocator(AuthenticationUtils.getEngineConfiguration()); actionservicelocator.setEndpointAddress("ActionService","http://172.23.113.110:8080/alfresco/api/ActionService"); serviceStub = actionservicelocator.getActionService(); //enter the path of the repository to put the rule String path = "/app:company_home/app:user_homes/sys:matt_burel/"; LoggerConnector.getInstance().debugmessage(path); String uuid = "3652e730-cbc5-11db-86c6-a37dd63d582f"; LoggerConnector.getInstance().debugmessage(uuid); //creation of a reference which contains the path of the space Reference reference = new Reference(); // reference.setPath(path); reference.setStore(STORE); reference.setUuid(uuid); LoggerConnector.getInstance().debugmessage("the reference was created"); //set the parameters of the new condition NamedValue conditionmime = new NamedValue(); String name = "value"; conditionmime.setName(name); conditionmime.setValue("application/acp"); conditionmime.setIsMultiValue(false); LoggerConnector.getInstance().debugmessage("the condition mime was created"); NamedValue[] parameters = new NamedValue[]{conditionmime}; Condition conditiontemp = new Condition(); conditiontemp.setConditionName("compare-mime-type"); conditiontemp.setInvertCondition(false); conditiontemp.setParameters(parameters); conditiontemp.setId("2"); condition = new Condition[]{conditiontemp}; //creation of a new action using the condition defined above LoggerConnector.getInstance().debugmessage("the condition array was created"); action.setId("1"); action.setActionName("import"); action.setConditions(condition); action.setDescription("import an .acp in the repository"); action.setActionReference(reference); action.setTitle("connectorImport"); // rule.setRuleTypes(new String[]{"inbound"}); rule.setAction(action); rule.setTitle("deployment"); rule.setDescription("this rule makes all .acp inbound deploy in the folder"); rule.setExecuteAsynchronously(false); rule.setRuleReference(reference); rule.setOwningReference(reference); Rule[] saveRules = new Rule[]{rule}; try { serviceStub.saveRules(reference,saveRules ); } catch (RemoteException e) { LoggerConnector.getInstance().exception("ConnectorWebService", "setRulesOnSpace" ,e); throw e; }