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
-
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>
-
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>
-
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.
-
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>
-
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>
-
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.