AnsweredAssumed Answered

Validation de transition de Workflow [Résolu]

Question asked by huberd on Nov 14, 2007
Latest reply on Apr 24, 2008 by huberd
Bonjour,

Lorsque l'on rentre dans le noeud qualityapproval, je souhaite rendre obligatoire l'appropriation de la tâche. L'acteur ne doit pas pouvoir continuer le workflow s'il ne s'est pas attribuer la tâche.

Une fois la tâche attribuée, celle-ci devra pouvoir déclencher une action de traitement en utilisant le nom de la personne qui s'est attribué la tâche.

A ce jour le code du noeud du worflow est le suivant :

   <!–**************************–> 
   <!–**     <Task Node>      **–>
   <!–**   qualityapproval    **–>
   <!–**************************–>    
   <task-node name="qualityapproval">
      <task name="lwf_QualityTask" swimlane="qualityassignees">
         <!– assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <pooledactors>A_QUALITY_APPROBATORS</pooledactors>
         </assignment–>
         <event type="task-end">
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                  <expression>
                     if (taskInstance.actorId == null)
                        taskInstance.actorId = person.properties.userName;
                  </expression>
               </script>
            </action>
          </event>
      </task>
      <event type="node-enter">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
               logger.log("");
               logger.log("-**************************-");
               logger.log("-**      Task Node       **-");
               logger.log("-**   qualityapproval    **-");
               logger.log("-**************************-");
               logger.log("");
            </script>
         </action>       
      </event>
      <transition name="reject" to="rejectedQuality" />
      <transition name="approve" to="approvedQuality" />
</task-node>
A ce jour l'attribution de la tâche se fait en sortie de la tâche

          <event type="task-end">
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                  <expression>
                     if (taskInstance.actorId == null)
                        taskInstance.actorId = person.properties.userName;
                  </expression>
               </script>
            </action>
          </event>
Je souhaite supprimer l'auto attribution et rajouter une condition d'attribution pour pouvoir continuer à l'étape suivant en rajoutant une condition d'affectation sur la transition approve.

   <!–**************************–> 
   <!–**     <Task Node>      **–>
   <!–**   qualityapproval    **–>
   <!–**************************–>    
   <task-node name="qualityapproval">
      <task name="lwf_QualityTask" swimlane="qualityassignees">
         <!– assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <pooledactors>A_QUALITY_APPROBATORS</pooledactors>
         </assignment–>
         <event type="task-end">
            <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
               <script>
                  <expression>
                     if (taskInstance.actorId == null)
                        taskInstance.actorId = person.properties.userName;
                  </expression>
               </script>
            </action>
          </event>
      </task>
      <event type="node-enter">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
               logger.log("");
               logger.log("-**************************-");
               logger.log("-**      Task Node       **-");
               logger.log("-**   qualityapproval    **-");
               logger.log("-**************************-");
               logger.log("");
            </script>
         </action>       
      </event>
      <transition name="reject" to="rejectedQuality" />
      <transition name="approve" to="approvedQuality" >
         <condition>#{taskInstance.actorId != null}</condition>
      </transition>
</task-node>
Il semblerait que la syntaxte <condition>#{taskInstance.actorId != null}</condition> ne fonctionne pas, impossible de déployer le workflow.

14:05:30,933 ERROR [[localhost].[/alfresco].[JBPMDeployProcessServlet]] "Servlet.service()" pour la servlet JBPMDeployProcessServlet a généré une exception
org.alfresco.service.cmr.workflow.WorkflowException: Failed to deploy workflow definition
   at org.alfresco.repo.workflow.jbpm.JBPMEngine.deployDefinition(JBPMEngine.java:287)
   at org.alfresco.repo.workflow.WorkflowServiceImpl.deployDefinition(WorkflowServiceImpl.java:107)
   at sun.reflect.GeneratedMethodAccessor1441.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
   at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:40)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   at org.alfresco.repo.audit.AuditComponentImpl.auditImpl(AuditComponentImpl.java:256)
   at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:191)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
   at $Proxy43.deployDefinition(Unknown Source)
   at org.alfresco.web.app.servlet.JBPMDeployProcessServlet.deployArchive(JBPMDeployProcessServlet.java:131)
   at org.alfresco.web.app.servlet.JBPMDeployProcessServlet.service(JBPMDeployProcessServlet.java:70)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
   at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:834)
   at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:640)
   at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1286)
   at java.lang.Thread.run(Unknown Source)
Caused by: org.jbpm.JbpmException: Failed to parse process definition from jBPM zip archive stream
   at org.alfresco.repo.workflow.jbpm.JBPMEngine.compileProcessDefinition(JBPMEngine.java:1618)
   at org.alfresco.repo.workflow.jbpm.JBPMEngine$1.doInJbpm(JBPMEngine.java:274)
   at org.springmodules.workflow.jbpm31.JbpmTemplate$1.doInHibernate(JbpmTemplate.java:87)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:333)
   at org.springmodules.workflow.jbpm31.JbpmTemplate.execute(JbpmTemplate.java:80)
   at org.alfresco.repo.workflow.jbpm.JBPMEngine.deployDefinition(JBPMEngine.java:269)
   … 34 more
Caused by: org.jbpm.jpdl.JpdlException: [[ERROR] line 592: cvc-complex-type.2.4.a: Invalid content was found starting with element 'condition'. One of '{"urn:jbpm.org:jpdl-3.1":action, "urn:jbpm.org:jpdl-3.1":script, "urn:jbpm.org:jpdl-3.1":create-timer, "urn:jbpm.org:jpdl-3.1":cancel-timer, "urn:jbpm.org:jpdl-3.1":exception-handler}' is expected., [WARNING] swimlane 'initiator' does not have an assignment]
   at org.jbpm.jpdl.xml.JpdlXmlReader.readProcessDefinition(JpdlXmlReader.java:173)
   at org.alfresco.repo.workflow.jbpm.JBPMJpdlArchiveParser.readFromArchive(JBPMJpdlArchiveParser.java:72)
   at org.jbpm.jpdl.par.ProcessArchive.parseProcessDefinition(ProcessArchive.java:81)
   at org.alfresco.repo.workflow.jbpm.JBPMEngine.compileProcessDefinition(JBPMEngine.java:1613)
   … 40 more
Comment faire pour réaliser cette condition ?

Outcomes