AnsweredAssumed Answered

Extract swimlane from metadata

Question asked by pobe on Sep 3, 2007
Latest reply on Oct 3, 2007 by rob562435
Im trying to directly assign users to swimlanes by creating spaces with users as metadata using this code:

#{bpm_package.children[0].parent.properties["sgu:Projektledare"]

Unfortunately I cant get i to work. Does anyone have a suggestion what i should do?


processdefenition

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

<process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="ponbeprocess">

   <swimlane name="initiator" />

   <swimlane name="reviewer">
      <assignment
         class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{bpm_package.children[0].parent.properties["sgu:Projektledare"]}</actor>
         <!– actor>#{people.getPerson(CoordinatorUser).properties["cm:userName"]}</actor–>
      </assignment>
   </swimlane>
   
   <event type="process-start">
         
     <script>
      <expression>
        CoordinatorUser = "admin";
      </expression>  
      <variable name="CoordinatorUser" access="write" />
     </script>
   </event>    

   <start-state name="start">
      <task name="wf:submitReviewTask" swimlane="initiator" />
   <transition name="" to="review">
   </transition>
   </start-state>

   <task-node name="review">
      <task name="wf:reviewTask" swimlane="reviewer">
         <event type="task-create">
            <script>
               if (bpm_workflowDueDate != void)
               taskInstance.dueDate = bpm_workflowDueDate; if
               (bpm_workflowPriority != void) taskInstance.priority
               = bpm_workflowPriority;
            </script>
         </event>
      </task>

      <transition name="reject" to="rejected"></transition>
      <transition name="approve" to="approved" />
   </task-node>

   <task-node name="rejected">
      <task name="wf:rejectedTask" swimlane="initiator" />
      <transition name="" to="end" />
   </task-node>

   <task-node name="approved">
      <task name="wf:approvedTask" swimlane="initiator" />
      <transition name="" to="end" />
   </task-node>

   <end-state name="end" />

</process-definition>

custom space



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

<!– Custom Model –>

<!– Note: This model is pre-configured to load at startup of the Repository.  So, all custom –>
<!–       types and aspects added here will automatically be registered –>

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

   <!– Optional meta-data about the model –>
   <description>Custom Model</description>
   <author></author>
   <version>1.0</version>

   <imports>
          <!– Import Alfresco Dictionary Definitions –>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <!– Import Alfresco Content Domain Model Definitions –>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>

   <!– Introduction of new namespaces defined by this model –>
   <!– NOTE: The following namespace custom.model should be changed to reflect your own namespace –>
   <namespaces>
      <namespace uri="custom.model" prefix="custom"/>
      <namespace uri="sgu.model" prefix="sgu"/>^M
  </namespaces>

    <types>
     <!– Definition of new Content Type: ProjektSpace –>
    <type name="sgu:projectSpace">
      <title>Projektutrymme</title>
      <parent>cm:folder</parent>
      <properties>
        <property name="sgu:Status">
          <type>d:text</type>
          <constraints>
            <constraint type="LIST">
              <parameter name="allowedValues">
                <list>
                  <value>Pagaende</value>
                  <value>Planerat</value>
                  <value>Avslutat</value>
                </list>
              </parameter>
              <parameter name="caseSensitive">
                <value>true</value>
              </parameter>
            </constraint>
          </constraints>
        </property>
        <property name="sgu:StartDatum">
          <title>Startdatum</title>
          <type>d:date</type>
        </property>
        <property name="sgu:SlutDatum">
          <title>SlutDatum</title>
          <type>d:date</type>
        </property>
      </properties>
      <associations>
        <association name="sgu:Projektledare">
          <target>
            <class>cm:person</class>
            <mandatory>false</mandatory>
            <many>false</many>
          </target>
        </association>
        <association name="sgu:Bestallare">
          <target>
            <class>cm:person</class>
            <mandatory>false</mandatory>
            <many>false</many>
          </target>
        </association>
        <association name="sgu:Verksamhetschef">
          <target>
            <class>cm:person</class>
            <mandatory>false</mandatory>
            <many>false</many>
          </target>
        </association>
      </associations>
    </type>
    </types>

</model>

Outcomes