Oracle-BPM(七)

代码下载:git


7、bpm api之以taskNumber或taskId查询

语言:java

[java]  view plain  copy
  1. package test01;  
  2.   
  3.   
  4. import com.taskQuery.services.TaskQueryService;  
  5. import com.taskQuery.services.TaskQueryService_Service;  
  6. import com.taskQuery.services.WorkflowErrorMessage;  
  7. import java.math.BigInteger;  
  8. import java.util.logging.Level;  
  9. import java.util.logging.Logger;  
  10. import java.util.logging.Level;  
  11. import java.util.logging.Logger;  
  12. import javax.xml.bind.JAXBContext;  
  13. import javax.xml.bind.JAXBElement;  
  14. import javax.xml.bind.JAXBException;  
  15. import javax.xml.bind.Unmarshaller;  
  16. import oracle.bpel.services.workflow.common.model.CredentialType;  
  17. import oracle.bpel.services.workflow.common.model.WorkflowContextType;  
  18. import oracle.bpel.services.workflow.query.model.TaskDetailsByNumberRequestType;  
  19. import oracle.bpel.services.workflow.task.model.Task;  
  20. import org.w3c.dom.Node;  
  21.   
  22.   
  23.   
  24. public class test1 {  
  25.     public test1() {  
  26.         super();  
  27.     }  
  28.       
  29.     //结合XML结构分析  
  30.     //1、以taskNumber来查询  
  31. /*    <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"> 
  32.        <soapenv:Header/> 
  33.        <soapenv:Body> 
  34.           <tas:taskDetailsByNumberRequest> 
  35.              <com:workflowContext> 
  36.                 <com:credential> 
  37.                    <com:login>weblogic</com:login> 
  38.                    <com:password>weblogic1</com:password> 
  39.                 </com:credential> 
  40.              </com:workflowContext> 
  41.              <tas:taskNumber>200000</tas:taskNumber> 
  42.           </tas:taskDetailsByNumberRequest> 
  43.        </soapenv:Body> 
  44.     </soapenv:Envelope> 
  45.  
  46.     //2、以taskId来查询 
  47.     <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"> 
  48.    <soapenv:Header/> 
  49.    <soapenv:Body> 
  50.       <tas:taskDetailsByIdRequest> 
  51.          <com:workflowContext> 
  52.             <com:credential> 
  53.                <com:login>weblogic</com:login> 
  54.                <com:password>weblogic1</com:password> 
  55.             </com:credential> 
  56.          </com:workflowContext> 
  57.          <tas:taskId>3fa4e9f7-5719-4efa-8215-ad2b47fcbace</tas:taskId> 
  58.       </tas:taskDetailsByIdRequest> 
  59.    </soapenv:Body> 
  60.   </soapenv:Envelope> 
  61.  
  62. */  
  63.       
  64.       
  65.       
  66.     /* 
  67.      * function testAccess 
  68.      * 作用:human Task 登陆验证 
  69.      * 参数:无 
  70.      * return 无 
  71.      *  
  72.      */  
  73.     public void testAccess(){  
  74.         try{  
  75.             //1、新建【启动】一个Task查询服务对象。  
  76.             TaskQueryService_Service taskQueryService_Service = new TaskQueryService_Service();  
  77.             //2、获得一个Task查询服务实例。  
  78.             TaskQueryService taskQueryService = taskQueryService_Service.getTaskQueryServicePort();  
  79.               
  80.             //3、获取凭证【通过凭证登陆,才能通过验证】  
  81.             //新建一个CredentialType,存储各种凭证  
  82.             CredentialType credentialType = new CredentialType();  
  83.             credentialType.setLogin("weblogic");  
  84.             credentialType.setPassword("11111111");  
  85.               
  86.             //4、通过凭证,登陆验证。【在有操作者的情况之下,human task才能成功被操作】  
  87.             System.out.println("Authenticating...");  
  88.             WorkflowContextType workflowContextType = taskQueryService.authenticate(credentialType);  
  89.             System.out.println("Authenticated to TaskQueryService");  
  90.               
  91.             //5、成功登陆之后,通过task number、taskid等查询整个task【这里使用task number】  
  92.             //新建一个TaskDetailsByNumberRequestType,存储查询task时需要的task number  
  93.             TaskDetailsByNumberRequestType taskDetailsRequest = new TaskDetailsByNumberRequestType();  
  94.             taskDetailsRequest.setTaskNumber(new BigInteger("200029"));  
  95.             taskDetailsRequest.setWorkflowContext(workflowContextType);  
  96.             //6、查询task  
  97.             Task task = taskQueryService.getTaskDetailsByNumber(taskDetailsRequest);  
  98.             System.out.println("Task:" + task.getSystemAttributes().getTaskId());  
  99.               
  100.         }catch(WorkflowErrorMessage e){  
  101.             Logger.getLogger(test1.class.getName()).log(Level.SEVERE, null, e);  
  102.             }  
  103.           
  104.         }  
  105.       
  106.     public static void main(String [] args){  
  107.             test1 test = new  test1();  
  108.             test.testAccess();  
  109.         }  
  110. }  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值