Problema creando mis propios workflow

cancel
Showing results for 
Search instead for 
Did you mean: 
cjimenez
Member II

Problema creando mis propios workflow

Saludos,
Tengo la necesidad de crear workflows personalizados y he estado leyendo la documentación que está en la web y he tratado de llevar a cabo los procedimientos pero por más que reviso no encuentro lo que pueda estar haciendo mal, así que vengo a ver si ustedes me puedan ayudar…

Como sabemos los archivos que se deben crear y que son cuatro deben ir en la siguiente carpeta <TOMCAT_HOME>/shared/classes/alfresco/extension y los archivos son:
    De context : revisionDocumento-wf-1-context.xml
    De proceso: revisionDocumentos.bpmn20.xml
    De modelo: revision-wf-model.xml
    De mensajes: revision-wf-messages.properties
revisionDocumento-wf-1-context.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
    <bean id="revisarDocumento.workflowBootstrap" parent="workflowDeployer">
      <property name="workflowDefinitions">
         <list>
            <props>
               <prop key="engineId">activiti</prop>
               <prop key="location">alfresco/extension/revision/revisionDocumentos.bpmn20.xml</prop>
               <prop key="mimetype">text/xml</prop>
               <prop key="redeploy">true</prop>
            </props>
         </list>
      </property>
   <property name="models">
      <list>
        <value>alfresco/extension/revision/revision-wf-model.xml</value>
      </list>
    </property>
   <property name="labels">
      <list>
         <value>alfresco/extension/revision/revision-wf-messages</value>
      </list>
   </property>
   </bean>
</beans>

revisionDocumentos.bpmn20.xml

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://activiti.org/bpmn20">
  <process id="RevisionDocumentos" name="RevisionDocumentos">
    <extensionElements>
      <activiti:executionListener event="start" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
        <activiti:field name="script">
          <activiti:string>execution.setVariable('ak_approveCount', 0);
execution.setVariable('ak_actualPercent', 0);
execution.setVariable('ak_reviewerCount', bpm_assignees.size());
execution.setVariable('ak_requiredPercent', ak_requiredApprovePercent);</activiti:string>
        </activiti:field>
      </activiti:executionListener>
    </extensionElements>
    <startEvent id="startevent1" name="Start" activiti:formKey="ak:submitParallelReviewTask"></startEvent>
    <userTask id="usertask1" name="Review Task" activiti:assignee="${reviewAssignee.properties.userName}" activiti:formKey="ak:activitiReviewTask">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;</activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>if(task.getVariableLocal('ak_reviewOutcome') == 'Approve') {
var newApprovedCount = ak_approveCount + 1;
var newApprovedPercentage = (newApprovedCount / ak_reviewerCount) * 100;

execution.setVariable('ak_approveCount', newApprovedCount);
execution.setVariable('ak_actualPercent', newApprovedPercentage);
}</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
      <multiInstanceLoopCharacteristics isSequential="false">
        <loopDataInputRef>bpm_assignees</loopDataInputRef>
        <inputDataItem name="reviewAssignee"></inputDataItem>
        <completionCondition>${ak_actualPercent &gt;= ak_requiredApprovePercent}</completionCondition>
      </multiInstanceLoopCharacteristics>
    </userTask>
    <exclusiveGateway id="exclusivegateway1" name="Review Decision"></exclusiveGateway>
    <userTask id="usertask2" name="Document Approved" activiti:assignee="${initiator.properties.userName}" activiti:formKey="ak:approvedParallelTask">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;

// Set parallel review params on task, to be kept in history
task.setVariableLocal('ak_reviewerCount', ak_reviewerCount);
task.setVariableLocal('ak_requiredPercent', ak_requiredPercent);
task.setVariableLocal('ak_actualPercent', ak_actualPercent);
task.setVariableLocal('ak_approveCount', ak_approveCount);</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <userTask id="usertask3" name="Document Rejected" activiti:assignee="${initiator.properties.userName}" activiti:formKey="ak:rejectedParallelTask">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;

// Set parallel review params on task, to be kept in history
task.setVariableLocal('ak_reviewerCount', ak_reviewerCount);
task.setVariableLocal('ak_requiredPercent', ak_requiredPercent);
task.setVariableLocal('ak_actualPercent', ak_actualPercent);
task.setVariableLocal('ak_approveCount', ak_approveCount);</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow1" name="" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
    <sequenceFlow id="flow2" name="" sourceRef="usertask1" targetRef="exclusivegateway1"></sequenceFlow>
    <sequenceFlow id="flow3" name="" sourceRef="exclusivegateway1" targetRef="usertask2">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${ak_actualPercent >= ak_requiredApprovePercent}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow4" name="" sourceRef="exclusivegateway1" targetRef="usertask3"></sequenceFlow>
    <serviceTask id="alfrescoMailtask1" name="Alfresco Mail Task" activiti:class="org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate">
      <extensionElements>
        <activiti:field name="script">
          <activiti:string>var mail = actions.create("mail");
mail.parameters.to = ${initiator.properties.mail};
mail.parameters.from = ${reviewAssignee.properties.mail};
mail.parameters.text = your document has been ${ak_status}.

Thanks;
mail.execute(bpm_package);
</activiti:string>
        </activiti:field>
      </extensionElements>
    </serviceTask>
    <sequenceFlow id="flow5" name="" sourceRef="usertask2" targetRef="alfrescoMailtask1"></sequenceFlow>
    <sequenceFlow id="flow6" name="" sourceRef="usertask3" targetRef="alfrescoMailtask1"></sequenceFlow>
    <sequenceFlow id="flow7" name="" sourceRef="alfrescoMailtask1" targetRef="endevent1"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_RevisionDocumentos">
    <bpmndi:BPMNPlane bpmnElement="RevisionDocumentos" id="BPMNPlane_RevisionDocumentos">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35" width="35" x="30" y="200"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
        <omgdc:Bounds height="55" width="105" x="140" y="190"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
        <omgdc:Bounds height="40" width="40" x="290" y="197"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask2" id="BPMNShape_usertask2">
        <omgdc:Bounds height="55" width="105" x="390" y="97"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask3" id="BPMNShape_usertask3">
        <omgdc:Bounds height="55" width="105" x="390" y="297"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35" width="35" x="730" y="97"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="alfrescoMailtask1" id="BPMNShape_alfrescoMailtask1">
        <omgdc:Bounds height="55" width="105" x="557" y="200"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="65" y="217"></omgdi:waypoint>
        <omgdi:waypoint x="140" y="217"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="245" y="217"></omgdi:waypoint>
        <omgdi:waypoint x="290" y="217"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
        <omgdi:waypoint x="310" y="197"></omgdi:waypoint>
        <omgdi:waypoint x="310" y="124"></omgdi:waypoint>
        <omgdi:waypoint x="390" y="124"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
        <omgdi:waypoint x="310" y="237"></omgdi:waypoint>
        <omgdi:waypoint x="310" y="324"></omgdi:waypoint>
        <omgdi:waypoint x="390" y="324"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
        <omgdi:waypoint x="495" y="124"></omgdi:waypoint>
        <omgdi:waypoint x="557" y="227"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
        <omgdi:waypoint x="495" y="324"></omgdi:waypoint>
        <omgdi:waypoint x="557" y="227"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
        <omgdi:waypoint x="662" y="227"></omgdi:waypoint>
        <omgdi:waypoint x="730" y="114"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

revision-wf-model.xml
<?xml version="1.0" encoding="UTF-8"?>

<model name="ak:RevisionDocumentos" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <imports>
      <import uri="http://www.alfresco.org/model/dictionary/1.0"
         prefix="d" />
      <import uri="http://www.alfresco.org/model/bpm/1.0"
         prefix="bpm" />
   </imports>

   <namespaces>
      <namespace uri="http://www.alkaid.cr/model/workflow/1.1" prefix="ak"/>
   </namespaces>
     
   <types>
      <!–                               –>
      <!–  Adhoc Tasks –>              
      <!–                               –>
     
      <type name="ak:submitParallelReviewTask">
   <title>Paralelo</title>
   <parent>bpm:startTask</parent>
         <properties>
            <property name="ak:notifyMe">
               <type>d:boolean</type>
               <default>false</default>
            </property>
            <property name="ak:checked">
               <type>d:boolean</type>
               <default>true</default>
            </property>
         </properties>
         <mandatory-aspects>
            <aspect>bpm:assignee</aspect>
         </mandatory-aspects>
      </type>

    <!–  <type name="ak:adhocTarea">
      </type> –>

      <type name="ak:approvedParallelTask">
         <parent>bpm:workflowTask</parent>
         <mandatory-aspects>
            <aspect>bpm:assignees</aspect>
         </mandatory-aspects>
      </type>

      <type name="ak:rejectedParallelTask">
         <parent>bpm:workflowTask</parent>
         <mandatory-aspects>
            <aspect>bpm:assignees</aspect>
         </mandatory-aspects>
      </type>
       
   </types>
  
</model>

revision-wf-messages.properties
RevisionDocumentos.workflow.title=wf revisar documentos y envio de mail
RevisionDocumentos.workflow.description=wf Revsiar Documentos
wf_RevisionDocumentos.property.wf_notifyMe.title=Notificarme
wf_RevisionDocumentos.property.wf_notifyMe.description=Notificarme cuando la tarea esté completa
wf_RevisionDocumentos.property.wf_checked.title=Revisado
wf_RevisionDocumentos.property.wf_checked.description=La tarea está revisada

Tomcat Log
GRAVE: Error while closing command context
org.alfresco.scripts.ScriptException: 06040003 Failed to execute supplied script: 06040002 ReferenceError: "bpm_assignees" is not defined. (AlfrescoJS#3)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.executeString(RhinoScriptProcessor.java:270)
   at org.alfresco.repo.processor.ScriptServiceImpl.executeScriptString(ScriptServiceImpl.java:322)
   at org.alfresco.repo.processor.ScriptServiceImpl.executeScriptString(ScriptServiceImpl.java:300)
   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:597)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
   at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:34)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:44)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.audit.AuditMethodInterceptor.proceed(AuditMethodInterceptor.java:160)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:137)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at $Proxy242.executeScriptString(Unknown Source)
   at org.alfresco.repo.workflow.activiti.script.ActivitiScriptBase.executeScript(ActivitiScriptBase.java:103)
   at org.alfresco.repo.workflow.activiti.script.ActivitiScriptBase.executeScript(ActivitiScriptBase.java:62)
   at org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener.notify(ScriptExecutionListener.java:71)
   at org.activiti.engine.impl.bpmn.helper.ClassDelegate.notify(ClassDelegate.java:63)
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:38)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:64)
   at org.activiti.engine.impl.runtime.ExecutionEntity.performOperation(ExecutionEntity.java:505)
   at org.activiti.engine.impl.runtime.ExecutionEntity.start(ExecutionEntity.java:298)
   at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:66)
   at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:29)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
   at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
   at org.activiti.engine.impl.RuntimeServiceImpl.startProcessInstanceById(RuntimeServiceImpl.java:65)
   at org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine.startWorkflow(ActivitiWorkflowEngine.java:964)
   at org.alfresco.repo.workflow.WorkflowServiceImpl.startWorkflow(WorkflowServiceImpl.java:357)
   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:597)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
   at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:34)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:44)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.audit.AuditMethodInterceptor.proceedWithAudit(AuditMethodInterceptor.java:217)
   at org.alfresco.repo.audit.AuditMethodInterceptor.proceed(AuditMethodInterceptor.java:184)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:137)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at $Proxy71.startWorkflow(Unknown Source)
   at org.alfresco.repo.workflow.WorkflowBuilder.build(WorkflowBuilder.java:91)
   at org.alfresco.repo.forms.processor.workflow.WorkflowFormPersister.persist(WorkflowFormPersister.java:75)
   at org.alfresco.repo.forms.processor.workflow.WorkflowFormPersister.persist(WorkflowFormPersister.java:43)
   at org.alfresco.repo.forms.processor.workflow.AbstractWorkflowFormProcessor.internalPersist(AbstractWorkflowFormProcessor.java:74)
   at org.alfresco.repo.forms.processor.FilteredFormProcessor.persist(FilteredFormProcessor.java:131)
   at org.alfresco.repo.forms.FormServiceImpl.saveForm(FormServiceImpl.java:138)
   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:597)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
   at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:34)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:44)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.audit.AuditMethodInterceptor.proceed(AuditMethodInterceptor.java:167)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:137)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at $Proxy117.saveForm(Unknown Source)
   at org.alfresco.repo.forms.script.ScriptFormService.saveForm(ScriptFormService.java:152)
   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:597)
   at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
   at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
   at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86)
   at org.mozilla.javascript.gen.c8._c1(file:/opt/alfresco-3.4.e/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/repository/forms/form.post.json.js:57)
   at org.mozilla.javascript.gen.c8.call(file:/opt/alfresco-3.4.e/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/repository/forms/form.post.json.js)
   at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:108)
   at org.mozilla.javascript.gen.c8._c0(file:/opt/alfresco-3.4.e/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/repository/forms/form.post.json.js:90)
   at org.mozilla.javascript.gen.c8.call(file:/opt/alfresco-3.4.e/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/repository/forms/form.post.json.js)
   at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
   at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
   at org.mozilla.javascript.gen.c8.call(file:/opt/alfresco-3.4.e/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/repository/forms/form.post.json.js)
   at org.mozilla.javascript.gen.c8.exec(file:/opt/alfresco-3.4.e/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/repository/forms/form.post.json.js)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:472)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:190)
   at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:282)
   at org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:102)
   at org.springframework.extensions.webscripts.AbstractWebScript.executeScript(AbstractWebScript.java:981)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:86)
   at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:383)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:381)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:436)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:466)
   at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:304)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:333)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189)
   at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
   at java.lang.Thread.run(Thread.java:662)
Caused by: org.alfresco.error.AlfrescoRuntimeException: 06040002 ReferenceError: "bpm_assignees" is not defined. (AlfrescoJS#3)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:488)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.executeString(RhinoScriptProcessor.java:266)
   … 129 more
Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "bpm_assignees" is not defined. (AlfrescoJS#3)
   at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3350)
   at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3340)
   at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3413)
   at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1612)
   at org.mozilla.javascript.gen.c9._c0(AlfrescoJS:3)
   at org.mozilla.javascript.gen.c9.call(AlfrescoJS)
   at org.mozilla.javascript.gen.c9.exec(AlfrescoJS)
   at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:472)
   … 130 more

El problema consiste en que al parecer no me está reconociendo la variable bpm_assignees ni tampoco está modificanfo la interfaz del formulario del workflow
Gracias por cualquier ayuda que me podáis dar…
1 Reply
rosa_martin
Member II

Re: Problema creando mis propios workflow

Hola
Veo que tu estás usando Activiti y yo sólo he probado con jBPM, pero creo que la definición de partida debería ser la misma.

1- Si en el fichero de contexto has puesto "alfresco/extension/revision", debes copiar todos esos ficheros en un directorio que crees en "<TOMCAT_HOME>/shared/classes/alfresco/extension/revision".
2- En el fichero "<TOMCAT_HOME>\webapps\alfresco\WEB-INF\classes\alfresco\application-context.xml" debes añadir una línea que importe los ficheros de contexto de tu directorio. Sería:
    <import resource="classpath*:alfresco/extension/revision/revisionDocumento-wf-1-context.xml"/>
   También puedes usar "*":
    <import resource="classpath*:alfresco/extension/revision/*-context.xml"/>
3- Te faltaría crear un fichero de tipo web-client-config-custom.xml, por ejemplo llamado "revision-web-client-config-custom.xml"
4- En el fichero "<TOMCAT_HOME>\webapps\alfresco\WEB-INF\classes\alfresco\web-client-application-context.xml" debes añadir una línea para tu fichero web_client. Sería:
            <value>classpath:alfresco/extension/revision/revision-web-client-config-custom.xml</value>

El fichero de definición de proceso yo siempre lo he usado con sufijo "_processdefinition.xml", o sea "revisionDocumentos_processdefinition.xml", pero no creo que eso sea relevante.

Espero que te sea de ayuda.
Saludos