Element "zpro > process > ProcessDef"

Top  Previous  Next

ProcessDef element is the base element for the Process Definition elements.

To create your own Process Definition element follow these steps:

1.Locate the "mor > zpro > process > ProcessDef" element in the library
2.Drag & Drop the element onto a page (Without pressing the SHIFT key)
3.Change the "CT Definitions" property of the element. Just enter some extra spaces at the right side of a line. This will cause that the property value is copied to the page and no longer inherited from the ProcessDef element, which is what we want.
4.Right click to the element and select context menu command "Library | Add Element To Library".
5.Select a folder in the Library and name the new Process Definition element

 

After the element is created in the library, open it with MoreMotion XML Editor and modify it as required.

 

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

  <?mmf version="1.1"?>

  <dummy name="MyProcessDef" basedon="\cpn\zpro\process\ProcessForm\ProcessDef.mmel">

 

    <!-- Icon File -->

    <iconfile rules="hid">icons\MyProcess.bmp</iconfile>

 

    <!-- Hep File -->

    <helpfile rules="hid" helpbm="MyProcess">MyComponent.chm</helpfile>

 

    <!-- Process Properties -->

    <prop name="myprop" type="string" caption="My Property"/> 

 

    <!-- Deployment descriptions of required server items -->

    <reqitems>

      <item name="res" target-prefix="\WEB-INF\MM-INF\res\">myunit.res</item>

      <item name="jar" target-prefix="\WEB-INF\lib\">mycomponent.jar</item>

    </reqitems> 

    <ctdef>

 

  // VALIDATING COMPULSORY PROPERTIES 

  %check-required-props('myprop,other-prop')

 

  %vof(standard_process_definitions)  // DO NOT TOUCH THIS LINE

 

  %config(std.config)

    </ctdef>

    <prop name="config" type="xmldata"><![CDATA[<process name="%vof(_fname + '.' + name)">

  <class>mypack.MyProcess</class>

  <unitname>myunit</unitname>

  <myprop>%vof(myprop)</myprop>

  <otherProp>%vof(other-prop)</otherProp>

</process>]]>

  </dummy>

 

The necessary modifications on the Process Definition Element

Process Parameters

If you need to pass parameters to your process class then you should define it with <prop> element. The following code defines a custom property named "myprop" that excepts A string type value.

 <prop name="myprop" type="string" caption="My Property"/> 

 

See Property Types.

Note that %config() function is used in order to transfer the values entered into the process parameters to the configuration files under "/WEB-INF/MM-INF/config" directory. The parameter of the %config() function is the name of a hidden property. During build, the value of the std.config property will be added to the configuration file after the CScript functions in it are resolved.

An process class can access to the process configuration as follows.

String myprop = callDef.getProcessConfig().getParameter("myprop").stringValue();

 

 

Required Items

When this process definition element is placed into a page and the project is built, the items (Files, executables,etc.) required by the process should be deployed to the target directories under the application server.

We should use <reqitems> definitions for that purpose as in the example.

 

   <reqitems>

     <item name="res" target-prefix="\WEB-INF\MM-INF\resources\">myunit.res</item>

     <item name="jar" target-prefix="\WEB-INF\MM-INF\lib\">mycomp.jar</item>

   </reqitems>

 

There should be one item definition for the each item to be deployed. target-prefix attribute defines where to deploy the items on the server. myunit.res file in the example will be taken from the same directory where this process definition element is located and it will be copied to the

\WEB-INF\MM-INF\resources directory.

 
Process Class Name

The code piece below defines the name of the process class to be called by the Process Manager.

<class>mypack.MyProcess</class>

 

 

 

Unit Name

A Unit Name is used as the base identifier for the messages created by a Process Broker using createMessage() method. If the unit name, for instance, is myunit and a message is created with

createMessage("MY_MESSAGE_ID",null,null)

 

then:

 

1.The message text of the "MY_MESSAGE_ID" is taken from the resource file myunit.res
2.The message datasource is created with name myunit_messages as follows.

 

   <myunit_messages>
    <message id="MY_MESSAGE_ID">
      <text>Message text of MY_MESSAGE_ID</text>
      <unitname>myunit</unitname>
      <details>Message details</details>
    </message>
  </myunit_messages>