cancel
Showing results for 
Search instead for 
Did you mean: 

How to map a namespace URI?

joe_182
Champ in-the-making
Champ in-the-making
Hi guys

I'm developing an advanced workflow, and I'm stuck with the model. Specifically with the namespace URI mapped with my workflow.

These are my files:


adhoc4-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="workflowBootstrap" parent="workflowDeployer">       
      <property name="workflowDefinitions">
            <list>
                <props>
                    <prop key="engineId">jbpm</prop>
                    <prop key="location">alfresco/extension/adhoc4_processdefinition.xml</prop>
                    <prop key="mimetype">text/xml</prop>
                    <prop key="redeploy">true</prop>
                </props>
         </list>
        </property>
      
        <property name="models">
            <list>
               <value>alfresco/extension/adhoc4Model.xml</value>
            </list>
        </property>
       
      <property name="labels">
            <list>
               <value>alfresco/extension/adhoc4-messages</value>
            </list>
        </property>   
   </bean>
</beans>


adhoc4_processdefinition.xml:

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

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="ad4:adhoc4">

   <swimlane name="initiator"/>

   <start-state name="start">
      <task name="ad4:submitAdhoc4Task" swimlane="initiator"/>
      <transition name="" to="adhoc"/>
   </start-state>

   <swimlane name="assignee">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{bpm_assignee}</actor>
      </assignment>
   </swimlane>
  
   <task-node name="adhoc4">
      <task name="ad4:adhoc4Task" swimlane="assignee">
         <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="" to="completed">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
           <script>
              if (ad4_notifyMe4)
              {
                 var mail = actions.create("mail");
                 mail.parameters.to = initiator.properties.email;
                 mail.parameters.subject = "Adhoc Task " + bpm_workflowDescription;
                 mail.parameters.from = bpm_assignee.properties.email;
                 mail.parameters.text = "It's done";
                 mail.parameters.ignore_send_failure = true;
                 mail.execute(bpm_package);
              }
           </script>
         </action>
      </transition>
   </task-node>
  
   <task-node name="completed">
      <task name="ad4:completedAdhoc4Task" swimlane="initiator"/>
      <transition name="" to="end"/>
   </task-node>
     
   <end-state name="end"/>
  
</process-definition>


adhoc4Model.xml:

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

<model name="ad4:adhoc4model" 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="adhoc4model" prefix="ad4"/>
   </namespaces>
     
   <types>  
  
      <type name="ad4:submitAdhoc4Task">
         <parent>bpm:startTask</parent>
         <properties>
            <property name="ad4:notifyMe4">
               <type>d:boolean</type>
               <default>false</default>
            </property>
         </properties>
         <mandatory-aspects>
            <aspect>bpm:assignee</aspect>
         </mandatory-aspects>
      </type>

      <type name="ad4:adhoc4Task">
         <parent>bpm:workflowTask</parent>
         <overrides>
            <property name="bpm:packageActionGroup">
               <default>add_package_item_actions</default>
            </property>
            <property name="bpm:packageItemActionGroup">
               <default>edit_package_item_actions</default>
            </property>
         </overrides>
      </type>

      <type name="ad4:completedAdhoc4Task">
         <parent>bpm:workflowTask</parent>
         <mandatory-aspects>
            <aspect>bpm:assignee</aspect>
         </mandatory-aspects>
      </type>   
    
   </types>
  
</model>


adhoc4-messages.properties:

# Adhoc4 Task Workflow

ad4_adhoc4.workflow.title=Adhoc4 Workflow (JBPM)
ad4_adhoc4.workflow.description=Assign arbitrary task to colleague using JBPM workflow engine

# Adhoc4 Task Definitions

ad4_adhoc4model.type.ad4_submitAdhoc4Task.title=Start Adhoc4 Task
ad4_adhoc4model.type.ad4_submitAdhoc4Task.description=Allocate task to colleague
ad4_adhoc4model.property.ad4_notifyMe4.title=Notify Me
ad4_adhoc4model.property.ad4_notifyMe4.description=Notify me when task is complete
ad4_adhoc4model.type.ad4_adhoc4Task.title=Adhoc4 Task
ad4_adhoc4model.type.ad4_adhoc4Task.description=Adhoc4 Task allocated by colleague
ad4_adhoc4model.type.ad4_completedAdhoc4Task.title=Adhoc4 Task Completed
ad4_adhoc4model.type.ad4_completedAdhoc4Task.description=Adhoc4 Task Completed


As you could imagine, I've changed the default adhocModel (keeping the original) because I wanted to start with some easy (or made). But it doesn't work. Catalina.out doesn't throws me something useful, and Alfresco starts normally. But when I want to start an advanced workflow with some file, in Alfresco's Wizard appears this:

javax.faces.FacesException: org.apache.jasper.JasperException: javax.faces.el.EvaluationException: Cannot get value for expression '#{WizardManager.bean.hasStartableWorkflows == false}'
caused by:
org.apache.jasper.JasperException: org.apache.jasper.JasperException: javax.faces.el.EvaluationException: Cannot get value for expression '#{WizardManager.bean.hasStartableWorkflows == false}'
caused by:
org.apache.jasper.JasperException: javax.faces.el.EvaluationException: Cannot get value for expression '#{WizardManager.bean.hasStartableWorkflows == false}'
caused by:
javax.faces.el.EvaluationException: Cannot get value for expression '#{WizardManager.bean.hasStartableWorkflows == false}'
caused by:
javax.faces.el.EvaluationException: Exception getting value of property hasStartableWorkflows of base of type : org.alfresco.web.bean.workflow.StartWorkflowWizard
caused by:
javax.faces.el.EvaluationException: Bean: org.alfresco.web.bean.workflow.StartWorkflowWizard, property: hasStartableWorkflows
caused by:
java.lang.reflect.InvocationTargetException
caused by:
org.alfresco.service.namespace.NamespaceException: Namespace prefix wf is not mapped to a namespace URI


Is there someone who knows why it is happening?

Thanks a lot!
7 REPLIES 7

jpotts
World-Class Innovator
World-Class Innovator
Just taking a wild guess, I'm wondering if your problem is that you are completely overriding the out-of-the-box "workflowBootstrap" bean and then not telling Alfresco about the OOTB models which is where the "wf" namespace is defined.

Instead, try naming your workflowBootstrap bean something like "ad4.workflowBootstrap". The name doesn't really matter as long as it is unique.

Jeff

joe_182
Champ in-the-making
Champ in-the-making
Hi jpotts, I changed what you told me (ad4.workflowBootstrap), in Catalina.out it's everything OK, but when I make click on start advanced workflow it doesn't appears. Only the defaults workflows of alfresco with activiti engine.

I'm putting the 4 files in "/tomcat/shared/classes/alfresco/extension", right?  Do you know if I have to do some other change?

Thanks a lot!

jpotts
World-Class Innovator
World-Class Innovator
Excellent, glad that worked.

If you go to the workflow console (http://localhost:8080/alfresco/faces/jsp/admin/workflow-console.jsp) and type "show workflows all" and click Submit, do you see your custom workflow in the list? If not, you have not yet deployed it.

You've got redeploy set to true in your Spring config so my guess is that your workflows are deployed unless there was a problem.

If they were not deployed, try deploying them manually from the workflow console (type "help" to see the syntax). If there is an error you should see it in the log.

If the workflows are deployed but aren't showing up in Share, you may have neglected to set share-config-custom.xml correctly. You didn't include that in your original post, so I can't know for sure. If you didn't know you needed to do anything with share-config-custom.xml to make your workflow work in Share, see this tutorial for an example.

Jeff

joe_182
Champ in-the-making
Champ in-the-making
I'm deploying my workflow in this way:
deploy jbpm alfresco/extension/adhoc4_processdefinition.xml

And this appears in the log of the workflow console:
org.alfresco.service.cmr.workflow.WorkflowException: 05280574 Workflow Component for engine id 'jbpm' is not registered

I'm not using share, but alfresco (http://localhost:8080/alfresco). That's why I think that it's not necessary to configure share-config-custom.xml, right?
If not, this is my share-config-custom.xml:

<alfresco-config>
  
   <!– Repository Library config section –>
   <config evaluator="string-compare" condition="RepositoryLibrary" replace="true">
      <!–
         Whether the link to the Repository Library appears in the header component or not.
      –>
      <visible>true</visible>
   </config>

   <config evaluator="string-compare" condition="Remote">
      <remote>
         <endpoint>
            <id>alfresco-noauth</id>
            <name>Alfresco - unauthenticated access</name>
            <description>Access to Alfresco Repository WebScripts that do not require authentication</description>
            <connector-id>alfresco</connector-id>
            <endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
            <identity>none</identity>
         </endpoint>

         <endpoint>
            <id>alfresco</id>
            <name>Alfresco - user access</name>
            <description>Access to Alfresco Repository WebScripts that require user authentication</description>
            <connector-id>alfresco</connector-id>
            <endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
            <identity>user</identity>
         </endpoint>

         <endpoint>
            <id>alfresco-feed</id>
            <name>Alfresco Feed</name>
            <description>Alfresco Feed - supports basic HTTP authentication via the EndPointProxyServlet</description>
            <connector-id>http</connector-id>
            <endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
            <basic-auth>true</basic-auth>
            <identity>user</identity>
         </endpoint>
        
         <endpoint>
            <id>activiti-admin</id>
            <name>Activiti Admin UI - user access</name>
            <description>Access to Activiti Admin UI, that requires user authentication</description>
            <connector-id>activiti-admin-connector</connector-id>
            <endpoint-url>http://localhost:8080/alfresco/activiti-admin</endpoint-url>
            <identity>user</identity>
         </endpoint>
      </remote>
   </config>

</alfresco-config>


In alfresco-global.properties I have the following:

system.workflow.engine.jbpm.enabled=false
system.workflow.engine.jbpm.definitions.visible=true
system.workflow.engine.activiti.enabled=true
system.workflow.engine.activiti.definitions.visible=true

Do I have to put system.workflow.engine.jbpm.enabled=true ??

Thanks!

jpotts
World-Class Innovator
World-Class Innovator
Yes, if you are running jBPM based workflows you'll definitely need to set that to true.

And if you are using Explorer (/alfresco) instead of Share (/share) you'll need to configure your workflow using web-client-config-custom.xml.

Jeff

joe_182
Champ in-the-making
Champ in-the-making
Thanks for the answer, Jeff. I don't understand/know which part of the web-client-config-custom.xml I have to change.

I looked the alfresco wiki's Web Client Configuration Guide (http://wiki.alfresco.com/wiki/Web_Client_Customisation_FAQ), but there's nothing about adding advanced workflow's info.

Joel

jpotts
World-Class Innovator
World-Class Innovator
Go look at that tutorial I pointed you to. It explains how to do it. Basically, your workflow tasks match up to types. Types are configured in web-client-config-custom.xml so that the Explorer interface knows how to produce a form to capture the metadata defined by the types. So configuring forms for your advanced workflow is no different than configuring the web client for any other "normal" type.

Page 25 is what you want.

Jeff