(WID/WPS) Query Tables

Query tables support task and process list queries on data that is contained in the BPC database schema.This includes human task data and business process data that is managed by BPC, and external business data.


Predefined query tables
Predefined query tables provide access to the data in the BPC database. 
They are the query table representation of the corresponding predefined Business Process Choreographer database views, such as the TASK view or the PROCESS_INSTANCE view.


Query tables have the following properties : Name, Attributes, Authorization.


Predefined query tables containing instance data :
TASK 
PROCESS_INSTANCE 
ACTIVITY 
ACTIVITY_ATTRIBUTE 
ACTIVITY_SERVICE 
ESCALATION 
ESCALATION_CPROP 
ESCALATION_DESC 
PROCESS_ATTRIBUTE 
QUERY_PROPERTY 
TASK_CPROP 
TASK_DESC 


Predefined query tables containing template data :
APPLICATION_COMP
ESC_TEMPL
ESC_TEMPL_CPROP
ESC_TEMPL_DESC
PROCESS_TEMPLATE
PROCESS_TEMPL_ATTR
TASK_TEMPL
TASK_TEMPL_CPROP
TASK_TEMPL_DESC


Supplemental query tables
Supplemental query tables in BPC expose to the query table API business data that is not managed by BPC. With supplemental query tables, this external data can be used with data from the predefined query tables when retrieving business process instance information or human task information.


Composite query tables
Composite query tables in BPC comprise predefined query tables and supplemental query tables. They combine data from existing tables or views. Use a composite query table to retrieve the information for a process instance list or task list, such as My To Dos.


Sample code to access all the predefined query tables with its columns & values :


String predefinedTables[] = {

"TASK",
"PROCESS_INSTANCE",
"ACTIVITY",
"ACTIVITY_ATTRIBUTE",
"ACTIVITY_SERVICE",
"ESCALATION",
"ESCALATION_CPROP",
"ESCALATION_DESC",
"PROCESS_ATTRIBUTE",
"QUERY_PROPERTY",
"TASK_CPROP",
"TASK_DESC",
"APPLICATION_COMP",
"ESC_TEMPL",
"ESC_TEMPL_CPROP",
"ESC_TEMPL_DESC",
"PROCESS_TEMPLATE",
"PROCESS_TEMPL_ATTR",
"TASK_TEMPL",
"TASK_TEMPL_CPROP",
"TASK_TEMPL_DESC"
};

Context ctx = new InitialContext();
com.ibm.bpe.api.LocalBusinessFlowManagerHome bfmHome = (LocalBusinessFlowManagerHome)ctx.lookup("local:ejb/com/ibm/bpe/api/BusinessFlowManagerHome");
BusinessFlowManagerService bfmService = bfmHome.create();
for(int counter=0; counter<predefinedTables.length;counter++){
EntityResultSet ers =  bfmService.queryEntities(predefinedTables[counter], null, null, null);
if (ers != null) {
com.ibm.bpe.api.EntityInfo ei = ers.getEntityInfo();
java.util.List aiList = ei.getAttributeInfo(); //Gives the list of columns
System.out.println("\n\n");
System.out.println("Query Table Name : "+predefinedTables[counter]);
for (int i = 0; i < aiList.size(); i++) {
com.ibm.bpe.api.AttributeInfo ai = (com.ibm.bpe.api.AttributeInfo) aiList.get(i);
System.out.print( ai.getName() +"\t\t\t\t");
}
System.out.println();
for (int i = 0; i < ers.getEntities().size(); i++) { // loop thru all the rows.
com.ibm.bpe.api.Entity entity = (com.ibm.bpe.api.Entity) ers.getEntities().get(i);
System.out.println();
for (int o = 0; o < aiList.size(); o++) {
com.ibm.bpe.api.AttributeInfo ai = (com.ibm.bpe.api.AttributeInfo) aiList.get(o);
System.out.print("\t\t\t\t");
if (entity.getAttributeValue(ai.getName()) != null) {
if (! ai.isArray()) {
if (ai.getType() == com.ibm.bpe.api.AttributeType.TIMESTAMP) {
System.out.print(((java.util.Calendar) entity.getAttributeValue(ai.getName())).getTime());
} else {
System.out.print(entity.getAttributeValue(ai.getName()));
}
} else {
System.out.print("arrays not supported");
}
} else {
System.out.print("n/a");
}
System.out.print("\t\t\t\t");
}
System.out.println("");
}
}
}


For more info : http://publib.boulder.ibm.com/infocenter/dmndhelp/v6r2mx/index.jsp?topic=/com.ibm.websphere.bpc.620.doc/doc/bpc/c6bpel_querytables.html

No comments:

Post a Comment