Processlist Options XML - Web Services - Foundation 23.2 - Foundation 23.2 - Ready - Content Composer - external

Content Composer Web Services

Platform
Content Composer
Product
Web Services
Release
Foundation 23.2
License

This Options XML can be used to specify which processes should be included in the retrieved process list.

Possible Settings

  1. Returns the processes created by the user (default when empty string passed).
  2. Returns the processes forwarded to the user directly or to a group the user belongs to.
  3. Returns own processes and forwarded processes. If an empty string is passed for this parameter, only a user's own processes are returned (see 1. above).
<mws>
   <processlist>
      <item name="forwarded" include="1" />
      <item name="nonforwarded" include="0"/>
   </processlist>
</mws>

The items of the element processlist specify which processes are included in the process list returned.

The attributes have the following meaning:

Element Description

name

forwarded: Returns all forwarded processes. These are the processes forwarded either to the user directly, or to a group the user belongs to.

nonforwarded: Returns all processes that were not forwarded. These are processes that the user created.

include

0: The respective processes are not included in the process list returned.

1: The processes specified by the attribute name are included in the list.

Special features

If an empty string is passed for the options, or both attributes are disabled (include="0"), the default setting of only processes created by the user is returned.

Extended Optional XML Attributes

The following attributes can be optionally defined to further specify the process list returned:

<mws>
   <processlist>
      ...
      <item name="listuser" include="Admin" />
      <item name="shortprocdesc" include="10"/>
      <item name="additionalCondition" include=" AND (MWS_STATUS = 2)" />
      <item name="replacecondition" include="(MWS_STATUS = 2)" />
      ...
   </processlist>
</mws>

The attributes have the following meaning:

Element Description

name

listuser:

If this attribute is defined, a respective process list for the specified user is returned. In the list of forwarded processes, only processes that were forwarded to the specified user directly are listed.

shortprocdesc:

If this attribute is specified and a process has a process description, the process element inside the ProcessList XML returned, contains the attribute shortprocdesc.

This attribute contains the first X characters of the process description.

If no process description is found, the corresponding attribute is not included.

Example

<process id="ade9e10d-ccfb-490f-a5b4-6fb1ac69bfd8"
 user="Admin" system="dm1" type=""
 objectname="TestBundle" title="My Title"
 state="0" created_at="27012010140555"
 lastsaved="04022010173422" 
 created_by="Admin" 
 shortprocdesc="ShortDescription" />

additionalcondition:

If this attribute is defined, the condition of the select statement is expanded to include the specified condition.

In this way, the conditions that apply as a result of other process list options can be individually expanded.

replacecondition:

If this attribute is defined, the condition of the select statement is completely replaced by the condition specified here.

All other specified process list options are overwritten.

In this way, it is possible to return exactly those processes in the process list that match the specified condition.

include

Username: This attribute is ignored if it contains an empty string.

Number of characters: Number of characters to be returned from the process description. This attribute is ignored if it contains the value 0.

The condition to be added: This attribute is ignored if it contains an empty string.

New condition: This attribute is ignored if it contains an empty string.

Example of Use

In this example, all processes that are either finished (status = 2) or locked (status = 1) and have not been edited for at least a day are deleted.

To do this, the process list option replacecondition is used to completely redefine the condition for the select statement and, subsequently, to delete all processes returned in the process list.

;********************* MLMwsClient ****************************************
GetObject("MwsClient","MLMwsClient")
MwsClient.MwsUrl = "http://localhost:8011/mws/mwsprocess"
GetObject("date", "MLDate")
;
; Current date
CurrDateAsInt = date.CurrentDate()
;
; current date minus 1 day
SearchDateInt = date.IncDate(CurrDateAsInt, -1, 0, 0)
;
;SearchDate as string
SearchDateStr = date.Int64ToDateString("dd.MM.yyyy", SearchDateInt)
FreeObject("date")
Protocol(SearchDateStr, 8)
;
; replacecondition --> Status = 1 and last edit less than SearchDate
options = FormatStr("<mws><processlist><item name=""replacecondition"" include=""(MWS_STATUS = 2) OR ((MWS_STATUS = 1) AND (MWS_LASTSAVED &lt;= '%s'))"" /></processlist></mws>", SearchDateStr)
myXmlResult = ""
res = MwsClient.Process_GetList(0, 100, options)
;
Protocol(res, 8)
myXmlResult = MwsClient.LastXmlResult
Protocol(result, 8)
;
if (myXmlResult <> "")
   GetObject("xml", "MLXmlDocument")
   xml.LoadXml(myXmlResult)
   root = xml.DocumentElement ;rootElement holen
   nodeList = root.SelectNodes("/mws/processlist/process") ;get all nodes of the process list
   Protocol("Number of processes:  {0}", 8, nodeList.Count)
   nodeListEnumerator = nodeList.GetEnumerator() ; Get an enumerator for the nodes
   ;
   ; Iterate over all items...
   readNext = nodeListEnumerator.MoveNext()
   while (readNext)
      node = nodeListEnumerator.Current ; get current item node
      ;
      ;read processid
      attrColl = node.Attributes
      attr = attrColl.GetNamedItem("id")
      processId = attr.Value
      Protocol("ProcessId: {0}", 8, processId)
      if (processId <> "")
         MwsClient.Process_Delete(processId) ; Delete process
         Protocol("Process [{0}] deleted", 8, processId)
      end-if
      readNext = nodeListEnumerator.MoveNext() ; get next item node
   end-while
   FreeObject("xml")
end-if
FreeObject("MwsClient")
;