CreateRuleWizard createRuleWizard = (CreateRuleWizard)variableResolver.resolveVariable(facesContext, "CreateRuleWizard");
createRuleWizard.init(null);
createRuleWizard.setTitle("toto");
createRuleWizard.setDescription("aze");
createRuleWizard.setApplyToSubSpaces(true);
createRuleWizard.setRunInBackground(true);
createRuleWizard.setRuleDisabled(false);
createRuleWizard.setAction("mail");
Map<String,Serializable> actionMap = createRuleWizard.getActionProperties();
for(Entry<String,Serializable> entry : action.getParameterValues().entrySet()){
actionMap.put(entry.getKey(), entry.getValue());
}
createRuleWizard.addAction();
createRuleWizard.finish();
l'erreur lors de l'editionjava.lang.IllegalArgumentException: Name must not be null
at org.springframework.util.Assert.notNull(Assert.java:90)
at org.springframework.beans.factory.BeanFactoryUtils.transformedBeanName(BeanFactoryUtils.java:57)
at org.springframework.beans.factory.support.AbstractBeanFactory.transformedBeanName(AbstractBeanFactory.java:582)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:176)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:555)
at org.alfresco.repo.action.ActionServiceImpl.getActionDefinition(ActionServiceImpl.java:234)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:335)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:116)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:40)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.alfresco.repo.audit.AuditComponentImpl.auditImpl(AuditComponentImpl.java:219)
at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:165)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
at $Proxy16.getActionDefinition(Unknown Source)
at org.alfresco.web.bean.rules.EditRuleWizard.init(EditRuleWizard.java:141)
at org.alfresco.web.bean.wizard.WizardManager.setCurrentWizard(WizardManager.java:117)
at org.alfresco.web.app.AlfrescoNavigationHandler.handleWizardOpen(AlfrescoNavigationHandler.java:575)
at org.alfresco.web.app.AlfrescoNavigationHandler.handleNavigation(AlfrescoNavigationHandler.java:115)
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:84)
at javax.faces.component.UICommand.broadcast(UICommand.java:106)
at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:316)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:105)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:245)
at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFilterChain.java:177)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:81)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:217)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:197)
at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFilterChain.java:177)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
je me demande si il ne faut pas indiquer quelque chose pour les conditions, car j'essaie de mettre no-condition, cela ne marche pas … que fairecreateRuleWizard.setCondition("no-condition");
createRuleWizard.addCondition();
et/ou peut-être qu'il faut ajouter des appels à promptForConditionValues() et/ou promptForActionValues() createRuleWizard.setTitle(ruleType.getValue());
createRuleWizard.setDescription("");
createRuleWizard.setApplyToSubSpaces(true);
createRuleWizard.setRunInBackground(true);
createRuleWizard.setRuleDisabled(false);
createRuleWizard.setAction("mail");
createRuleWizard.addAction();
createRuleWizard.finish();
for(Rule rule : ruleService.getRules(nodeRef, false, null)){
if(rule.getTitle().equals(ruleType.getValue())){
CompositeAction compositeAction = (CompositeAction)rule.getAction();
compositeAction.removeAllActions();
Action rootAction = getRootAction(ruleType);
Map<String,Serializable> actionMap = new HashMap<String, Serializable>();
actionMap.put(MailActionExecuter.PARAM_FROM, rootAction.getParameterValue(MailActionExecuter.PARAM_FROM));
actionMap.put(MailActionExecuter.PARAM_TEXT, rootAction.getParameterValue(MailActionExecuter.PARAM_TEXT));
actionMap.put(MailActionExecuter.PARAM_SUBJECT, rootAction.getParameterValue(MailActionExecuter.PARAM_SUBJECT));
NodeRef templateNodeRef = (NodeRef)rootAction.getParameterValue(MailHandler.PROP_TEMPLATE);
if(templateNodeRef!=null)
actionMap.put(MailActionExecuter.PARAM_TEMPLATE, new NodeRef(templateNodeRef.getStoreRef(),templateNodeRef.getId()));
actionMap.put(MailActionExecuter.PARAM_TO_MANY, new ArrayList<String>());
compositeAction.addAction(actionService.createAction("mail",actionMap));
compositeAction.addActionCondition(actionService.createActionCondition("no-condition"));
ruleService.saveRule(nodeRef, rule);
}
}
voila se que je fait pour le moment.pourtant il me semble que lors d'une création de regle par l'interface web le CreateRuleWizard est utilisé.plutôt oui, puisque c'est sa seule raison d'être !!! (d'ailleurs, la classe est dans un sub-package de org.alfresco.web, dans le JAR web-client).
Rule rule = new Rule();
rule.setRuleType("inbound");
// setup the rule and add it to the space
rule.setTitle(ruleType.getValue());
rule.setDescription("");
rule.applyToChildren(true);
rule.setExecuteAsynchronously(true);
rule.setRuleDisabled(false);
CompositeAction compositeAction = actionService.createCompositeAction();
rule.setAction(compositeAction);
Action rootAction = getRootAction(ruleType);
Map<String,Serializable> actionMap = new HashMap<String, Serializable>();
actionMap.put(MailActionExecuter.PARAM_FROM, rootAction.getParameterValue(MailActionExecuter.PARAM_FROM));
actionMap.put(MailActionExecuter.PARAM_TEXT, rootAction.getParameterValue(MailActionExecuter.PARAM_TEXT));
actionMap.put(MailActionExecuter.PARAM_SUBJECT, rootAction.getParameterValue(MailActionExecuter.PARAM_SUBJECT));
NodeRef templateNodeRef = (NodeRef)rootAction.getParameterValue(MailHandler.PROP_TEMPLATE);
if(templateNodeRef!=null)
actionMap.put(MailActionExecuter.PARAM_TEMPLATE, new NodeRef(templateNodeRef.getStoreRef(),templateNodeRef.getId()));
actionMap.put(MailActionExecuter.PARAM_TO_MANY, new ArrayList<String>());
compositeAction.addAction(actionService.createAction("mail",actionMap));
compositeAction.addActionCondition(actionService.createActionCondition("no-condition"));
ruleService.saveRule(nodeRef, rule);
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.