Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved


Chapter 13 GI Forms Interface : Interface Properties and Methods : createLockRequest

createLockRequest
Purpose
This method creates and returns the Action Processor LockItems request.
This method only returns the LockItems request; it does not submit it to the Action Processor. To submit the request, you must call the socketRequest method (see page 294).
Note that it is not required that you call this method — it is called by the custom form class lockWorkItem method. It is available, however, if you want the Action Processor LockItems request to lock a work item and get field data.
Syntax
createLockRequest(fieldNames,
                  requestId)
Parameters
 
If not provided, the xmlCacheIdAp is used (which can be obtained with the this.getXmlCacheIdAp function).
Returns
A string — LockItems request XML
Example
The following is an example usage from com.tibco.bpm.ipc.Form:

 
ipcClass.prototype.lockWorkItem = function(
            fieldNames, xslPath, apCacheId, cdfCacheId) {
   var fieldData = null;
   var useApCacheId = apCacheId != null ? apCacheId :
                      this.getXmlCacheIdAp();
   var useXslPath = xslPath != null ? xslPath :
                      com.tibco.bpm.ipc.Form.DIR + 'xsl/lockItemsToCdf.xsl';
   var useCdfCacheId = cdfCacheId != null ? cdfCacheId :
                      this.getXmlCacheId();
   var lockRequest = this.createLockRequest(fieldNames, useApCacheId);
   var socket = this.socketRequest(lockRequest, useApCacheId);
   if (socket.isSuccess() && socket.getSsoErrorMsg() == null) {
       this.transformData(useXslPath, useApCacheId, useCdfCacheId);
       var doc = this.getApp().getCache().getDocument(useCdfCacheId);
       fieldData = new com.tibco.bpm.ipc.FieldData();
       fieldData.loadFromCdfDoc(doc);
   }
   return fieldData;
};
Example XML
The following provides example XML for this method.
Lock Items Request:

 
<?xml version="1.0" encoding="UTF-8"?>
<ap:Action xmlns:ap="http://tibco.com/bpm/actionprocessor"
           xmlns:sso="http://tibco.com/bpm/sso/types">
 <ap:WorkQ>
    <ap:LockItems Id="y76R20">
        <sso:WorkQTag>i2tagtest|swadmin|R</sso:WorkQTag>
        <sso:WorkItemTags>
            <sso:string>i2tagtest|ALLOCATE|swadmin|R|2050|408966|i2tagtest|
             SUMMARY|0|2</string>
         </sso:WorkItemTags>
         <sso:WIFGContent>
            <sso:WIFieldNames>
               <sso:string>LOCATION</sso:string>
               <sso:string>MEMO</sso:string>
               <sso:string>NAME</sso:string>
               <sso:string>NUMERIC</sso:string>
               <sso:string>REASON</sso:string>
               <sso:string>TEXT</sso:string>
               <sso:string>TITLE</sso:string>
            </sso:WIFieldNames>
            <sso:FieldsOption>ssoAllMarkings</sso:FieldsOption>
         </sso:WIFGContent>
     </ap:LockItems>
  </ap:WorkQ>
</ap:Action>

 
 
Lock Items Request Result:

 
<ap:ActionResult xmlns:ap="http://tibco.com/bpm/actionprocessor">
   <ap:Status>
      <ap:Version>10.6.0</ap:Version>
      <ap:ReturnCode>0</ap:ReturnCode>
      <ap:ReturnComment>The Action was processed successfully. Check the individual           Request Results for their status.</ap:ReturnComment>
      <ap:ReturnDateTime>2006-02-06T10:43:42.698-0800</ap:ReturnDateTime>
   </ap:Status>
      <ap:SSO>
         <sso:vSSOData xmlns:sso="http://tibco.com/bpm/sso/types">
            <sso:Results>
               <sso:vResult Id="_jsx_ipcNS_301_XML_ap">
               <sso:WIFieldGroups>
                  <sso:vWIFieldGroup>
                     <sso:WorkItemTag>i2tagtest|ALLOCATE|swadmin|R|2050|408966|
                       i2tagtest|SUMMARY|0|2</sso:WorkItemTag>
                      <sso:WorkItemFields>
                         <sso:vField>
                            <sso:Name>TITLE</sso:Name>
                            <sso:FieldType>swText</sso:FieldType>
                            <sso:Value>test title 3</sso:Value>
                         </sso:vField>
                         <sso:vField>
                            <sso:Name>TEXT</sso:Name>
                            <sso:FieldType>swText</sso:FieldType>
                            <sso:Value>test</sso:Value>
                         </sso:vField>
                         <sso:vField>
                            <sso:Name>REASON</sso:Name>
                            <sso:FieldType>swText</sso:FieldType>
                            <sso:Value>test</sso:Value>
                         </sso:vField>
                         <sso:vField>
                            <sso:Name>NUMERIC</sso:Name>
                            <sso:FieldType>swNumeric</sso:FieldType>
                            <sso:Value>123.0</sso:Value>
                         </sso:vField>
                         <sso:vField>
                            <sso:Name>NAME</sso:Name>
                            <sso:FieldType>swText</sso:FieldType>
                            <sso:Value>test name 3</sso:Value>
                         </sso:vField>
                         <sso:vField>
                            <sso:Name>MEMO</sso:Name>
                            <sso:FieldType>swMemo</sso:FieldType>
                            <sso:Value>test memo 4</sso:Value>
                         </sso:vField>
                         <sso:vField>
                            <sso:Name>LOCATION</sso:Name>
                            <sso:FieldType>swText</sso:FieldType>
                            <sso:Value>test 6</sso:Value>
                         </sso:vField>
                      </sso:WorkItemFields>
                   </sso:vWIFieldGroup>
                </sso:WIFieldGroups>
             </sso:vResult>
         </sso:Results>
      </sso:vSSOData>
   </ap:SSO>
</ap:ActionResult>

 
Lock Items Request Transform XSL:

 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"    xmlns:sso="http://tibco.com/bpm/sso/types"    xmlns:ap="http://tibco.com/bpm/actionprocessor" exclude-result-prefixes=
      "sso ap">
   <xsl:output omit-xml-declaration="yes"/>
   <xsl:param name="uniqueId" select="'_jsx_ipcNS_264_XML_ap'"/>
   <xsl:output indent="yes"/>
   <xsl:template match="/">
      <data>
         <xsl:apply-templates select="/ap:ActionResult/ap:SSO/sso:vSSOData/
          sso:Results/sso:vResult[@Id = $uniqueId]"/>
      </data>
   </xsl:template>
   <xsl:template match="sso:vResult">
      <xsl:apply-templates select="sso:WIFieldGroups/sso:vWIFieldGroup/
       sso:WorkItemFields/sso:vField"/>
   </xsl:template>
   <xsl:template match="sso:vField">
      <xsl:element name="record">
         <xsl:attribute name="jsxid">
            <xsl:value-of select="generate-id()"/>
         </xsl:attribute>
         <xsl:attribute name="ssoName">
            <xsl:value-of select="sso:Name"/>
         </xsl:attribute>
         <xsl:attribute name="ssoFieldType">
            <xsl:value-of select="sso:FieldType"/>
         </xsl:attribute>
         <xsl:attribute name="ssoValue">
            <xsl:value-of select="sso:Value"/>
         </xsl:attribute>
      </xsl:element>
   </xsl:template>
</xsl:stylesheet>

 
Lock Items Request CDF:

 
<data>
   <record jsxid="IDAF1CZC" ssoName="TITLE" ssoFieldType="swText" ssoValue="test      title 3"/>
   <record jsxid="IDAJ1CZC" ssoName="TEXT" ssoFieldType="swText" ssoValue="test"/>
   <record jsxid="IDAN1CZC" ssoName="REASON" ssoFieldType="swText"      ssoValue="test"/>
   <record jsxid="IDAR1CZC" ssoName="NUMERIC" ssoFieldType="swNumeric"      ssoValue="123.0"/>
   <record jsxid="IDAV1CZC" ssoName="NAME" ssoFieldType="swText"      ssoValue="test name 3"/>
   <record jsxid="IDAZ1CZC" ssoName="MEMO" ssoFieldType="swMemo"      ssoValue="test memo 4"/>
   <record jsxid="IDA31CZC" ssoName="LOCATION" ssoFieldType="swText"      ssoValue="test 6"/>
</data>

 

Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved