cancel
Showing results for 
Search instead for 
Did you mean: 

Web Client Customisation on a workflow

blackout
Champ in-the-making
Champ in-the-making
Hi everyone,

first let me tell that is almost one month I'm studying Alfresco and part of his components (like JBPM and Lucene) for an university stage, so my questions could seem stupid to an expert eye, but I'll ask anyway Smiley Very Happy.

I am trying to build a simple workflow to learn more about the task model and the task dialogs in order to have a more dynamic workflow.

For what I understood about this piece of code
<config evaluator="node-type" condition="wf:submitAdhocTask" replace="true">
   <property-sheet>
      <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
      <show-property name="bpm:workflowDescription" component-generator="TextAreaGenerator" />
      <show-property name="bpm:workflowPriority" />
      <show-property name="bpm:workflowDueDate" />
      <show-property name="wf:notifyMe" />
      <separator name="sep2" display-label-id="users_and_roles" component-generator="HeaderSeparatorGenerator" />
      <show-association name="bpm:assignee" />
   </property-sheet>
</config>
an evaluator object intercepts the task (wf:submitAdhocTask in this case) and publishes a page to the web client formatted in a particular way. Did I understand well?
Where should this piece of code go in the alfresco folder tree? I read that all custom configs should be placed in alfresco\WEB-INF\classes\alfresco\extension\web-client-config-custom.xml is that correct?
Where can I find the custom dialogs for the review & approve example (the you see when starting an advanced workflow on a content item already present in a space)?

Any kind of help is welcome, I'm pretty stuck trying to figure out how this works.

Thanks in advance.
7 REPLIES 7

red15
Champ in-the-making
Champ in-the-making
You can find the integrated workflow dialogs definition in the source.

root\projects\web-client\config\alfresco\web-client-config-workflow.xml

blackout
Champ in-the-making
Champ in-the-making
Yes, eventually I managed to find all the xml files I needed to understand the configuration, I just have few more doubts on the naming of the fileds in the web page.

I mean, I'm getting things like $$wf_reviewers$$ and I don't know where to configure it, but that's not the main problem at the moment.

What I need now is exactly how to script the creation of a tree of spaces and the creation of a content (a simple document like .doc) with specific name (I forgot where I read those informations lol).

davidc
Star Contributor
Star Contributor

blackout
Champ in-the-making
Champ in-the-making
Hi again,

I have more questions for you men Smiley Very Happy.

First, let's clear the environment: I have a workflow that is started on a document (SQB) by a certain person (user sales). When the workflow starts, a mail is sent to another person (user reception) who updates a versioned  document (pipeline).

The questions are: How does a document is "attached" to a workflow? How do I refer to it in the process definition?

thanks in advance

davidc
Star Contributor
Star Contributor
Documents attached to a workflow are held in a workflow package (a container, basically).  There's a workflow package for each "in-flight" workflow.

You can access the contents of the workflow package like so:

<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
   <script>
      for (var i = 0; i < bpm_package.children.length; i++)
     {
        … = bpm_package.children.name;
        …
     }
   </script>
</action>

blackout
Champ in-the-making
Champ in-the-making
I tried my first deploy and got this problem logged:

10:01:02,688 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/alfresco]] Exception sending context initialized event to listener instance of class org.alfresco.web.app.ContextListener
org.alfresco.error.AlfrescoRuntimeException: Workflow deployment failed
   at org.alfresco.repo.workflow.WorkflowDeployer.deploy(WorkflowDeployer.java:216)
   at org.alfresco.repo.workflow.WorkflowDeployer.onBootstrap(WorkflowDeployer.java:227)
   at org.alfresco.util.AbstractLifecycleBean.onApplicationEvent(AbstractLifecycleBean.java:54)
   at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:45)
   at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:225)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:323)
   at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:134)
   at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3729)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4187)
   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
   at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:809)
   at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:698)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
   at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
   at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
   at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
   at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
   at org.apache.catalina.core.StandardService.start(StandardService.java:450)
   at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
   at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
   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.startup.Bootstrap.start(Bootstrap.java:294)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
Caused by: java.lang.NullPointerException
   at org.alfresco.service.cmr.workflow.WorkflowDefinition.toString(WorkflowDefinition.java:51)
   at java.lang.String.valueOf(String.java:2577)
   at java.lang.StringBuilder.append(StringBuilder.java:116)
   at org.alfresco.service.cmr.workflow.WorkflowDeployment.toString(WorkflowDeployment.java:38)
   at org.alfresco.repo.audit.AuditComponentImpl.postInvocation(AuditComponentImpl.java:276)
   at org.alfresco.repo.audit.AuditComponentImpl.auditImpl(AuditComponentImpl.java:211)
   at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:156)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:61)
   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 $Proxy24.deployDefinition(Unknown Source)
   at org.alfresco.repo.workflow.WorkflowDeployer.deploy(WorkflowDeployer.java:202)
   … 33 more

I used the following processdefinition:

<?xml version="1.0" encoding="UTF-8"?>

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wf:goprocessdefinition">
   
   <swimlane name="sales">
      <assignment actor-id="sales" />
   </swimlane>
   
   <swimlane name="reception">
      <assignment actor-id="reception" />
   </swimlane>
   
   <swimlane name="planner">
      <assignment actor-id="planner" />
   </swimlane>
   
   <start-state name="start">
      <transition name="" to="aggiornaPipeline">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
               var mail = actions.create("mail");
               mail.parameters.to = "reception@domain.com";
               mail.parameters.subject = "New SQB";
               mail.parameters.from = "someone@domain.com";
               mail.parameters.text = "gogo aggiornare pipeline";
               mail.execute(bpm_package);
            </script>
           </action>
        </transition>
   </start-state>
   
   <task-node name="updatePipeline">
      <task name="wf:updatePipelineTask" swimlane="reception"/>
      <transition name="" to="handleable" />
   </task-node>
   
   <decision name="handleable">
      <event type="node-enter">
         <script>
            wf_handleable = false;
         </script>
      </event>
      <transition name="yesItIs" to="selTeamLeader">
         <condition>#{wf_handleable}</condition>
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
               var mail = actions.create("mail");
               mail.parameters.to = "planner@domain.com";
               mail.parameters.subject = "New SQB";
               mail.parameters.from = "someone@domain.com";
               mail.parameters.text = "gogo selezionare teamleader";
               mail.execute(bpm_package);
               var testFolder = companyhome.childByNamePath("Test Space");
               var prjFolder = testFolder.createFolder(code + " " + description);
               prjFolder = prjFolder.childByNamePath(code + " " + description);
               prjFolder.createFolder("Documenti di gara");
               prjFolder.createfolder("Offerta tecnico economica");
            </script>
           </action>
      </transition>
      <transition name="noIsNot" to="end" />
   </decision>
   
   <task-node name="selTeamLeader">
      <task name="wf:selTeamLeaderTask" swimlane="planner" />
   </task-node>
   
   <end-state name="end" />
   
</process-definition>

and the following model:

<?xml version="1.0" encoding="UTF-8"?>

<model name="wf:gomodel" 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"/>
      <import uri="http://www.alfresco.org/model/workflow/1.0" prefix="wf"/>
   </imports>
   
</model>

This is an almost dummy implementation of what it should be in the nearest future.

Can anyone help me finding the bug? I'm sure is my mistake, beacuse when I deploy the Parallel Review and Approve on my downloaded boundle it works fine (exept when it calls the ForEachFork, but that's not a problem). Is it possible that the missing start-task is the error?

Few more questions about Alfresco:
  • is it correct to put this code:
    <bean id="myworkflows.workflowBootstrap" parent="workflowDeployer">
       <property name="workflowDefinitions">
          <list>
             <props>
                <prop key="engineId">jbpm</prop>
                <prop key="location">alfresco/workflow/adhoc_processdefinition.xml</prop>
                <prop key="mimetype">text/xml</prop>
             </props>
          </list>
       </property>
    </bean>
    in the bootstrap-context.xml file, or there's a more elegant solution for an automatic deploy?

  • is there a way to have Alfresco starting only once and not three times? It takes a lot more time and spams the same errors on the log.
That's all for now, but I'm quite sure that I'll bother you all again before friday Smiley Very Happy

Thanks in advance

blackout
Champ in-the-making
Champ in-the-making
Yes…the problem is the start task :roll: