Oracle-BPM(九)

代码下载:git


9、bpm api之taskQueryService【分页__没有测试】



[java]  view plain  copy
  1. package com.ui.bpm;  
  2.   
  3. import com.proxy.bpm.query.TaskQueryService;  
  4. import com.proxy.bpm.query.TaskQueryService_Service;  
  5.   
  6. import com.proxy.bpm.query.WorkflowErrorMessage;  
  7. import com.proxy.bpm.service.TaskServiceContextTaskBaseType;  
  8. import com.proxy.bpm.service.TaskService_Service;  
  9.   
  10. import java.math.BigInteger;  
  11.   
  12. import java.util.HashMap;  
  13. import java.util.List;  
  14.   
  15. import java.util.Map;  
  16.   
  17. import oracle.adf.share.logging.ADFLogger;  
  18.   
  19. import oracle.bpel.services.workflow.common.model.CredentialType;  
  20. import oracle.bpel.services.workflow.common.model.WorkflowContextType;  
  21. import oracle.bpel.services.workflow.query.model.AssignmentFilterEnum;  
  22. import oracle.bpel.services.workflow.query.model.ClauseType;  
  23. import oracle.bpel.services.workflow.query.model.ColumnType;  
  24. import oracle.bpel.services.workflow.query.model.DisplayColumnType;  
  25. import oracle.bpel.services.workflow.query.model.CountTasksRequestType;  
  26. import oracle.bpel.services.workflow.query.model.DisplayColumnType;  
  27. import oracle.bpel.services.workflow.query.model.OrderingClauseType;  
  28. import oracle.bpel.services.workflow.query.model.PredicateClauseType;  
  29. import oracle.bpel.services.workflow.query.model.PredicateOperationEnum;  
  30. import oracle.bpel.services.workflow.query.model.PredicateType;  
  31. import oracle.bpel.services.workflow.query.model.SortOrderEnum;  
  32. import oracle.bpel.services.workflow.query.model.TaskDetailsByIdRequestType;  
  33. import oracle.bpel.services.workflow.query.model.TaskListRequestType;  
  34. import oracle.bpel.services.workflow.query.model.TaskListResponseType;  
  35. import oracle.bpel.services.workflow.query.model.TaskOptionalInfoEnum;  
  36. import oracle.bpel.services.workflow.query.model.TaskOptionalInfoType;  
  37. import oracle.bpel.services.workflow.query.model.TaskOrderingType;  
  38. import oracle.bpel.services.workflow.query.model.TaskPredicateQueryType;  
  39. import oracle.bpel.services.workflow.query.model.TaskPredicateType;  
  40. import oracle.bpel.services.workflow.query.model.ValueListType;  
  41. import oracle.bpel.services.workflow.query.model.LogicalOperatorEnumType;  
  42. import oracle.bpel.services.workflow.query.model.PredicateOperationEnum;  
  43. import oracle.bpel.services.workflow.query.model.PredicateJoinOperatorEnum;  
  44. import oracle.bpel.services.workflow.task.model.Task;  
  45.   
  46. public class Test4 {  
  47.     //日志  
  48.     private static ADFLogger logger=ADFLogger.createADFLogger(Test3.class);  
  49.       
  50.     public Test4() {  
  51.         super();  
  52.     }  
  53.       
  54.     /** 
  55.      * 分页 
  56.      * */  
  57.       
  58.     //参照XML  
  59. /*    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"xmlns:tas="http://xmlns.oracle.com/bpel/workflow/taskQueryService"xmlns:com="http://xmlns.oracle.com/bpel/workflow/common"xmlns:tas1="http://xmlns.oracle.com/bpel/workflow/taskQuery"xmlns:task="http://xmlns.oracle.com/bpel/workflow/task"> 
  60.        <soapenv:Header/> 
  61.        <soapenv:Body> 
  62.           <tas:taskListRequest> 
  63.              <com:workflowContext> 
  64.                 <com:credential> 
  65.                    <com:login>weblogic</com:login> 
  66.                    <com:password>weblogic1</com:password> 
  67.                 </com:credential> 
  68.              </com:workflowContext> 
  69.              <tas1:taskPredicateQuery startRow="1" endRow="10"> 
  70.                 <tas1:displayColumnList> 
  71.                    <tas1:displayColumn>textAttribute1</tas1:displayColumn> 
  72.                    <tas1:displayColumn>textAttribute2</tas1:displayColumn> 
  73.                    <tas1:displayColumn>textAttribute3</tas1:displayColumn> 
  74.                 </tas1:displayColumnList> 
  75.                 <tas1:optionalInfoList> 
  76.                    <tas1:taskOptionalInfo>Comments</tas1:taskOptionalInfo> 
  77.                    <tas1:taskOptionalInfo>Attachments</tas1:taskOptionalInfo> 
  78.                    <tas1:taskOptionalInfo>Payload</tas1:taskOptionalInfo> 
  79.                 </tas1:optionalInfoList> 
  80.                 <tas1:predicate> 
  81.                    <tas1:assignmentFilter>My+Group</tas1:assignmentFilter> 
  82.                    <tas1:predicate> 
  83.                       <tas1:lhs> 
  84.                          <tas1:clause> 
  85.                             <tas1:column tableName="WFTask"> 
  86.                                <tas1:columnName>state</tas1:columnName> 
  87.                             </tas1:column> 
  88.                             <tas1:operator>IN</tas1:operator> 
  89.                             <tas1:valueList> 
  90.                                <tas1:value>ASSIGNED</tas1:value> 
  91.                                <tas1:value>INFO_REQUESTED</tas1:value> 
  92.                                <tas1:value>OUTCOME_UPDATED</tas1:value> 
  93.                             </tas1:valueList> 
  94.                          </tas1:clause> 
  95.                       </tas1:lhs> 
  96.                       <tas1:logicalOperator>AND</tas1:logicalOperator> 
  97.                       <tas1:rhs> 
  98.                          <tas1:lhs> 
  99.                             <tas1:clause> 
  100.                                <tas1:column tableName="WFTask"> 
  101.                                   <tas1:columnName>textAttribute1</tas1:columnName> 
  102.                                </tas1:column> 
  103.                                <tas1:operator>EQ</tas1:operator> 
  104.                                <tas1:value>MyTask</tas1:value> 
  105.                             </tas1:clause> 
  106.                             <tas1:clause joinOperator="AND"> 
  107.                                <tas1:column tableName="WFTask"> 
  108.                                   <tas1:columnName>textAttribute2</tas1:columnName> 
  109.                                </tas1:column> 
  110.                                <tas1:operator>EQ</tas1:operator> 
  111.                                <tas1:value>1234</tas1:value> 
  112.                             </tas1:clause> 
  113.                          </tas1:lhs> 
  114.                          <tas1:logicalOperator>OR</tas1:logicalOperator> 
  115.                          <tas1:rhs> 
  116.                             <tas1:clause> 
  117.                                <tas1:column tableName="WFTask"> 
  118.                                   <tas1:columnName>textAttribute2</tas1:columnName> 
  119.                                </tas1:column> 
  120.                                <tas1:operator>EQ</tas1:operator> 
  121.                                <tas1:value>123</tas1:value> 
  122.                             </tas1:clause> 
  123.                         </tas1:rhs> 
  124.                      </tas1:rhs> 
  125.                    </tas1:predicate> 
  126.                 </tas1:predicate> 
  127.              </tas1:taskPredicateQuery> 
  128.           </tas:taskListRequest> 
  129.        </soapenv:Body> 
  130.     </soapenv:Envelope> 
  131. */  
  132.       
  133.       
  134.     public static List<Task> queryTestWithPages(){  
  135.         //启动一个TaskQueryService服务  
  136.         TaskQueryService_Service taskQueryService_Service = new TaskQueryService_Service();  
  137.         TaskQueryService taskQueryService = taskQueryService_Service.getTaskQueryServicePort();  
  138.           
  139.         //TaskListRequestType  
  140.         TaskListRequestType taskListRequestType = new TaskListRequestType();  
  141.           
  142.         //操作者登录验证  
  143.         //WorkflowContextType  
  144.         WorkflowContextType workflowContextType = new WorkflowContextType();  
  145.         //CredentialType  
  146.         CredentialType credentialType = new CredentialType();  
  147.         credentialType.setLogin("weblogic");  
  148.         credentialType.setPassword("qw82232160");  
  149.         try{  
  150.             //验证  
  151.             workflowContextType = taskQueryService.authenticate(credentialType);  
  152.         }catch(WorkflowErrorMessage e){  
  153.             e.printStackTrace();  
  154.             return null;  
  155.               
  156.             }  
  157.           
  158.         //设置需要查询的属性  
  159.         //TaskPredicateQueryType  
  160.         TaskPredicateQueryType taskPredicateQueryType = new TaskPredicateQueryType();  
  161.         //设置页数(startRow, endRow): (1, 10) (11, 20) (21, 30)。。。  
  162.         int startRow = 1;  
  163.         int endRow = 10;  
  164.         taskPredicateQueryType.setStartRow(BigInteger.valueOf(startRow));  
  165.         taskPredicateQueryType.setEndRow(BigInteger.valueOf(endRow));  
  166.           
  167.         //DisplayColumnType  
  168.         DisplayColumnType displayColumnType = new DisplayColumnType();  
  169.         displayColumnType.getDisplayColumn().add("textAttribute1");  
  170.         displayColumnType.getDisplayColumn().add("textAttribute2");  
  171.         displayColumnType.getDisplayColumn().add("textAttribute3");  
  172.           
  173.         //TaskOptionalInfoType  
  174.         TaskOptionalInfoType taskOptionalInfoType = new TaskOptionalInfoType();  
  175.         taskOptionalInfoType.getTaskOptionalInfo().add(TaskOptionalInfoEnum.COMMENTS);  
  176.         taskOptionalInfoType.getTaskOptionalInfo().add(TaskOptionalInfoEnum.ATTACHMENTS);  
  177.         taskOptionalInfoType.getTaskOptionalInfo().add(TaskOptionalInfoEnum.PAYLOAD);  
  178.           
  179.         //TaskPredicateType   
  180.         TaskPredicateType taskPredicateType = new TaskPredicateType();  
  181.         taskPredicateType.setAssignmentFilter(AssignmentFilterEnum.MY_GROUP);  
  182.         //PredicateType  
  183.         PredicateType predicateType1 = new PredicateType();//lhs  
  184.         PredicateType predicateType2 = new PredicateType();//注意这里的用法  
  185.         PredicateType predicateType3 = new PredicateType();  
  186.         PredicateType predicateType4 = new PredicateType();  
  187.         taskPredicateType.setPredicate(predicateType1);//  
  188.         predicateType1.setLhs(predicateType2);  
  189.         //PredicateClauseType  
  190.         //PredicateClauseType predicateClauseType = new PredicateClauseType();  
  191.         //ClauseType  
  192.         ClauseType clauseType1 = new ClauseType();  
  193.         //ColumnType  
  194.         ColumnType columnType1 = new ColumnType();  
  195.         columnType1.setTableName("WFTask");  
  196.         columnType1.setColumnName("state");  
  197.         clauseType1.setColumn(columnType1);  
  198.         clauseType1.setOperator(PredicateOperationEnum.IN);  
  199.         //ValueListType  
  200.         ValueListType valueListType = new ValueListType();  
  201.         valueListType.getValue().add("ASSIGNED");  
  202.         valueListType.getValue().add("INFO_REQUESTED");  
  203.         valueListType.getValue().add("OUTCOME_UPDATED");  
  204.         clauseType1.setValueList(valueListType);  
  205.         predicateType2.getClause().add(clauseType1);  
  206.         //PredicateJoinOperatorEnum  
  207.         predicateType1.setLogicalOperator(PredicateJoinOperatorEnum.AND);  
  208.         //rhs  
  209.         predicateType1.setRhs(predicateType3.getLhs());//这里不知道正不正确???  
  210.         //ClauseType  
  211.         ClauseType clauseType2 = new ClauseType();  
  212.         ColumnType columnType2 = new ColumnType();  
  213.         columnType2.setTableName("WFTask");  
  214.         columnType2.setColumnName("textAttribute1");  
  215.         clauseType2.setColumn(columnType2);  
  216.         clauseType2.setOperator(PredicateOperationEnum.EQ);  
  217.         clauseType2.setValue("MyTask");  
  218.         predicateType3.getClause().add(clauseType2);  
  219.         //ClauseType  
  220.         ClauseType clauseType3 = new ClauseType();  
  221.         clauseType3.setJoinOperator(PredicateJoinOperatorEnum.AND);  
  222.         ColumnType columnType3 = new ColumnType();  
  223.         columnType3.setTableName("WFTask");  
  224.         columnType3.setColumnName("textAttribute2");  
  225.         clauseType3.setColumn(columnType3);  
  226.         clauseType3.setOperator(PredicateOperationEnum.EQ);  
  227.         clauseType3.setValue("1234");  
  228.         predicateType3.getClause().add(clauseType3);  
  229.         //logicalOperator  
  230.         predicateType3.setLogicalOperator(PredicateJoinOperatorEnum.OR);  
  231.         predicateType3.setRhs(predicateType4);  
  232.         ClauseType clauseType4 = new ClauseType();  
  233.         ColumnType columnType4 = new ColumnType();  
  234.         columnType4.setTableName("WFTask");   
  235.         columnType4.setColumnName("textAttribute2");  
  236.         clauseType4.setColumn(columnType4);  
  237.         clauseType4.setOperator(PredicateOperationEnum.EQ);  
  238.         clauseType4.setValue("123");  
  239.         predicateType4.getClause().add(clauseType4);  
  240.           
  241.         //插入查询的条件  
  242.         //taskPredicateQueryType.setStartRow(value);分页条件  
  243.         //taskPredicateQueryType.setEndRow(value);  
  244.         taskPredicateQueryType.setDisplayColumnList(displayColumnType);  
  245.         taskPredicateQueryType.setOptionalInfoList(taskOptionalInfoType);  
  246.         taskPredicateQueryType.setPredicate(taskPredicateType);  
  247.           
  248.           
  249.         //实施查询  
  250.         taskListRequestType.setTaskPredicateQuery(taskPredicateQueryType);//执行条件  
  251.         taskListRequestType.setWorkflowContext(workflowContextType);//执行环境  
  252.         //TaskListResponseType  应答  
  253.         TaskListResponseType taskListResponseType = new TaskListResponseType(); //  
  254.         try {  
  255.             taskListResponseType = taskQueryService.queryTasks(taskListRequestType);//调用taskQueryService来查询task  
  256.             List<Task> list = taskListResponseType.getTask();//  
  257.             return list;  
  258.         } catch (WorkflowErrorMessage e) {  
  259.             e.printStackTrace();  
  260.             return null;  
  261.         }  
  262.           
  263.     }  
  264. }  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值