cancel
Showing results for 
Search instead for 
Did you mean: 

How do I register a bean with Alfresco?

piousbox
Champ in-the-making
Champ in-the-making
hello all;

I'm following this tutorial: http://wiki.alfresco.com/wiki/WorkflowAdministration

I'm stuck at "Deploying the Tast Model". This bean:
<bean id="myworkflows.workflowBootstrap" parent="workflowDeployer">
  <property name="workflowDefinitions">
     …
  </property>
  <property name="models">
    <list>
      <!– Task Model associated with above process definition –>
      <value>alfresco/workflow/adhocModel.xml</value>
    </list>
  </property>
</bean>

I assume I can just put it in randomly named .xml file, but how do I register this bean with Alfresco? The tutorial is unclear on that. Any help would be appreciated.
4 REPLIES 4

jottley
Confirmed Champ
Confirmed Champ
The bean definitions should be added to -context.xml file and placed on the classpath (ex. tomcat/shared/classes/alfresco/extension) with the processdefinition and the model.

For example a file named some_name-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="myworkflows.workflowBootstrap" parent="workflowDeployer">
<property name="workflowDefinitions">

</property>
<property name="models">
<list>
<!– Task Model associated with above process definition –>
<value>alfresco/extension/workflow/adhocModel.xml</value>
</list>
</property>
</bean>

</beans>

(The above example is not complete code.  I've also adjusted the path a bit.  It is best not to muck about in the exploded WAR file)

Jared

piousbox
Champ in-the-making
Champ in-the-making
Thanks, that helped somewhat. However now I get a different error when starting the workflow:

Please correct the errors below then click Finish.
    * A system error happened during the operation: 07170002 Mandatory task properties have not been provided!

extension/20100816_vp.book-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="myworkflows.wf_book-review" parent="workflowDeployer">
    <property name="workflowDefinitions">
      <list>
         <props>
            <prop key="engineId">jbpm</prop>
            <prop key="location">alfresco/workflow/20100816_vp.book_process_definition.xml</prop>
            <prop key="mimetype">text/xml</prop>
            <prop key="redeploy">true</prop>
         </props>
      </list>
    </property>

    <property name="models">
      <list><value>alfresco/workflow/20100816_vp.book_task_model.xml</value></list>
    </property>

    <property name="labels">
      <list><value>alfresco/messages/20100816vpbook</value></list>
    </property>
  </bean>
</beans>

20100816_vp.book_process_definition.xml

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

<process-definition name="wf:book-review" xmlns="urn:jbpm.org:jpdl-3.1">

  <swimlane name="initiator" />

  <start-state name="start">
    <task name="wf:submit">
      <assignment actor-id="victor" />
    </task>
    <transition to="n0" name="t0" />
  </start-state>

  <task-node name="n0">
    <task name="wf:review">
      <assignment actor-id="victor" />
    </task>
    <transition to="end" name="t1" />
  </task-node>

  <end-state name="end" />

</process-definition>

20100816_vp.book_task_model.xml

<?xml version="1.0" encoding="UTF-8"?>
<model name="wf:bookModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
  <description>Book Model Descr</description>
  <author>ae1</author>
  <version>1.0</version>

  <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>

  <types>
    <type name="wf:submit">
      <parent>bpm:startTask</parent>
<!–
      <properties>
        <property name="wf:notifyMe">
          <type>d:boolean</type>
          <default>false</default>
        </property>
      </properties>
–>
      <mandatory-aspects>
         <aspect>bpm:assignee</aspect>
      </mandatory-aspects>
    </type>

    <type name="wf:review">
      <parent>bpm:workflowTask</parent>
      <mandatory-aspects>
         <aspect>bpm:assignee</aspect>
      </mandatory-aspects>
    </type>

  </types>

</model>

messages/20100816vpbook.properties

#
# workflow
#
wf_book-review.workflow.title = 20100816 bookModel
wf_book-review.workflow.description = 20100816 my descr

wf_book-review.node.start.title = start
wf_book-review.node.start.description = start

wf_book-review.node.n0.title = n0
wf_book-review.node.n0.description = n0

wf_book-review.node.end.title = end
wf_book-review.node.end.description = end

wf_book-review.task.wf_submit.title = submit
wf_book-review.task.wf_submit.description = submit

wf_book-review.task.wf_review.title = review
wf_book-review.task.wf_review.description = review

wf_book-review.node.start.transition.t0.title = t0 title
wf_book-review.node.start.transition.t0.description = t0 descr

wf_book-review.node.start.transition.t1.title = t1 title
wf_book-review.node.start.transition.t1.description = t1 descr


#
# model
#
wf_bookModel.title = title
wf_bookModel.description = Book Model Descr

wf_bookModel.type.wf_submit.title = title
wf_bookModel.type.wf_submit.description = descr
wf_bookModel.type.wf_review.title = title
wf_bookModel.type.wf_review.description = descr


Thanks in advance.

jottley
Confirmed Champ
Confirmed Champ
It is looking for mandatory properties to be passed from the UI to the workflow….In this case it is looking for who to assign the workflow to.

Beyond the tutorial that you are reading on the wiki.  Also checkout the tutorial written by Jeff Potts http://ecmarchitect.com/archives/2007/11/19/785


Jared

piousbox
Champ in-the-making
Champ in-the-making
I'm facing the same problem again. How do I pass the required properties from the UI to the workflow?