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.
<!–***************************–> <!–* Preparateur de document *–> <!–***************************–> <bean id="lpr-prepare-document" class="lpr.alfresco.repo.PrepareDocument" parent="action-executer" > <property name="nodeService"> <ref bean="nodeService" /> </property> <property name="permissionService"> <ref bean="permissionService" /> </property> <!–property name="fileFolderService"> <ref bean="FileFolderService" /> </property–> <!–property name="contentService"> <ref bean="contentService" /> </property–> </bean>
Rule rule = new Rule(); rule.setRuleType("inbound"); // setup the rule and add it to the space rule.setTitle("Document Preparator (In)"); rule.setDescription("Prepare new document imported in repository"); rule.applyToChildren(true); rule.setExecuteAsynchronously(true); rule.setRuleDisabled(false); CompositeAction compositeAction = actionService.createCompositeAction(); rule.setAction(compositeAction); compositeAction.addAction(actionService.createAction("lpr-prepare-document")); compositeAction.addActionCondition(actionService.createActionCondition("no-condition")); ruleService.saveRule(nodeRef, rule);
compositeAction.addActionCondition(actionService.createActionCondition("no-condition"));
compositeAction.addActionCondition(actionService.createActionCondition("is-subtype"));
Il faut utiliser la seconde méthode createActionCondition, celle qui permet de passer une map de paramètres pour construire la condition. Tu peux alors spécifier le type qui t'intéresse (param "type", voir classe IsSubTypeEvaluator).
Rule rule = new Rule(); rule.setRuleType("inbound"); // setup the rule and add it to the space rule.setTitle("Processus Space Creator (In)"); rule.setDescription("Make Processus Space"); rule.applyToChildren(false); rule.setExecuteAsynchronously(false); rule.setRuleDisabled(false); CompositeAction compositeAction = actionService.createCompositeAction(); rule.setAction(compositeAction); compositeAction.addAction(actionService.createAction("lpr-make-processus-space")); //compositeAction.addActionCondition(actionService.createActionCondition("no-condition")); Map<String,Serializable> actionMap = new HashMap<String, Serializable>(); actionMap.put("type", ContentModel.TYPE_FOLDER); compositeAction.addActionCondition(actionService.createActionCondition("is-subtype",actionMap)); ruleService.saveRule(nodeRef, rule);
<!–*********************************–> <!–* Createur d'arborescence *–> <!–*********************************–> <bean id="lpr-make-processus-space" class="lpr.alfresco.repo.MakeProcessusSpace" parent="action-executer" > <property name="nodeService"> <ref bean="nodeService" /> </property> <property name="fileFolderService"> <ref bean="FileFolderService" /> </property> <property name="ruleService"> <ref bean="RuleService" /> </property> <property name="actionService"> <ref bean="ActionService" /> </property> </bean> <bean id="lpr-make-processus-space-action-messages" class="org.alfresco.i18n.ResourceBundleBootstrapComponent"> <property name="resourceBundles"> <list> <value>alfresco/messages/action-executer/lpr-make-processus-space-action-messages</value> </list> </property> </bean>