Using Dataviews

There are several operations that allow you to create and reuse case data searches.

These are available in BusinessDataServices.

The following step-by-step descriptions correspond to the numbered steps above. Note that the descriptions are from a web service operation point of view, and provide an example of performing the operations using the web service API (SOAP).

Procedure

  1. Find out the case classes and their attributes for a specific case model deployed in TIBCO ActiveMatrix BPM by calling getCaseClassInfo.
    Note: Only the attributes that have been specified as searchable in the business object model are returned. You must specify the searchable attributes at designtime. See TIBCO Business Studio Modeling Guide for more information.

    The response returns all the case classes and attribute information for the specified case model.

    // Step 1 : Get a list of the case classes and their attributes
    <soapenv:Body>
          <api:GetCaseClassInfoRequest>
             <appDetails>
                <name>com.example.gddemo-2</name>
                <majorVersion>2</majorVersion>
             </appDetails>
          </api:GetCaseClassInfoRequest>
    </soapenv:Body>
    <SOAP-ENV:Body>
          <GetCaseClassInfoResponse xmlns="http://api.bds.tibco.com">
             <caseClassInfo xmlns="">
                <name>com.example.gddemo.Car</name>
                <attributeInfo>
                   <path>vehicleID</path>
                   <type>ATTR_TEXT</type>
                </attributeInfo>
                <attributeInfo>
                   <path>vehicleType</path>
                   <type>ATTR_ENUM</type>
                   <enumLiteral>CAR</enumLiteral>
                   <enumLiteral>TWOWHEELER</enumLiteral>
                </attributeInfo>
             </caseClassInfo>
             <caseClassInfo xmlns="">
                <name>com.example.gddemo.Customer</name>
                <attributeInfo>
                   <path>customerID</path>
                   <type>ATTR_INTEGER</type>
                </attributeInfo>
                <attributeInfo>
                   <path>name</path>
                   <type>ATTR_TEXT</type>
                </attributeInfo>
             </caseClassInfo>
             <caseClassInfo xmlns="">
                <name>com.example.gddemo.Vehicle</name>
                <attributeInfo>
                   <path>vehicleID</path>
                   <type>ATTR_TEXT</type>
                </attributeInfo>
                <attributeInfo>
                   <path>vehicleType</path>
                   <type>ATTR_ENUM</type>
                   <enumLiteral>CAR</enumLiteral>
                   <enumLiteral>TWOWHEELER</enumLiteral>
                </attributeInfo>
             </caseClassInfo>
          </GetCaseClassInfoResponse>
    </SOAP-ENV:Body>
  2. Define your data view using createDataView. The request specifies the search query you want to use to search the case data.

    The response lists the ID of the created data view

    // Step 2: Create the dataview
    <soapenv:Body>
          <api:CreateDataViewRequest>
             <viewSpecification>
                <caseClassDetails>
                   <caseClass>com.example.gddemo.Car</caseClass>
                   <majorVersion>2</majorVersion>
                </caseClassDetails>
                <name>New Cars</name>
                <description>All cars</description>
                <condition xsi:type="api:AttributeSearchCondition">
                   <attrPath>vehicleID</attrPath>
                   <operator>EQ</operator>
                   <value>%</value>
                </condition>
                </viewSpecification>
          </api:CreateDataViewRequest>
    </soapenv:Body>
    <SOAP-ENV:Body>
          <CreateDataViewResponse xmlns="http://api.bds.tibco.com">
             <viewID xmlns="">1</viewID>
          </CreateDataViewResponse>
    </SOAP-ENV:Body>
  3. Perform the search using getCaseReferencesForDataView. The request identifies the data view that you created in step 2.

    The response lists the case references of the case data that matches the criteria specified in the search query.

    // Step 3: Define the search query you want to use in the dataview
    <soapenv:Body>
          <api:GetCaseReferencesForDataViewRequest>
             <viewID>1</viewName>
          </api:GetCaseReferencesForDataViewRequest>
       </soapenv:Body>
    <SOAP-ENV:Body>
          <GetCaseReferencesForDataViewResponse xmlns="http://api.bds.tibco.com">
             <caseReference xmlns="">BDS-2-com.example.gddemo.Car-1-0</caseReference>
             <hasMoreResults xmlns="">false</hasMoreResults>
          </GetCaseReferencesForDataViewResponse>
    </SOAP-ENV:Body>
  4. You can view a data view without executing it, for example, if you want to make sure it is the data view you require, using getDataViewDetails. The request must specify the data view whose details you want to view;

    The response lists the data view specification.

    // Step 4: View a dataview without executing it
    <soapenv:Body>
          <api:GetDataViewDetailsRequest>
             <viewID>1</viewID>
          </api:GetDataViewDetailsRequest>
    </soapenv:Body>
    <SOAP-ENV:Body>
          <GetDataViewDetailsResponse xmlns="http://api.bds.tibco.com">
             <result xmlns="">
                <viewID>1</viewID>
                <specification>
                   <caseClassDetails>
                      <caseClass>com.example.gddemo.Car</caseClass>
                      <majorVersion>2</majorVersion>
                   </caseClassDetails>
                   <name>New Cars</name>
                   <description>Cars less than 6 months old</description>
                   <condition xsi:type="api:AttributeSearchCondition"
    xmlns:api="http://api.bds.tibco.com"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                      <attrPath>vehicleID</attrPath>
                      <operator>EQ</operator>
                      <value>%</value>
                   </condition>
                </specification>
             </result>
          </GetDataViewDetailsResponse>
    </SOAP-ENV:Body>
  5. You can edit a data view at anytime using editDataView. The request must specify the data view whose details you want to edit.

    The response indicates success by returning the editDataViewResponse.

    // Step 4: Edit a dataview
    <soapenv:Body>
          <api:EditDataViewRequest>
             <viewID>1</viewID>
             <viewSpecification>
                <caseClassDetails>
                   <caseClass>com.example.gddemo.Car</caseClass>
                   <majorVersion>2</majorVersion>
                </caseClassDetails>
                <name>Luxury Cars</name>
                <description>Cars with Luxury features</description>
             </viewSpecification>
          </api:EditDataViewRequest>
    </soapenv:Body>
     <SOAP-ENV:Body>
          <EditDataViewResponse xmlns="http://api.bds.tibco.com"/>
    </SOAP-ENV:Body>
  6. You can delete a data view at anytime using deleteDataView. The request must specify the data view whose details you want to edit.

    The response indicates success by returning a deleteDataViewResponse.

    // Step 4: Delete a dataview
    <soapenv:Body>
          <api:DeleteDataViewRequest>
             <viewID>1</viewID>
          </api:DeleteDataViewRequest>
    </soapenv:Body>
    <SOAP-ENV:Body>
          <DeleteDataViewResponse xmlns="http://api.bds.tibco.com"/>
    </SOAP-ENV:Body>