ITaskQueryServiceの使い方は、公式APIから来ています。

17751 ワード

oracle.bpel.services.workflow.query Interface ITaskQueryService
http://docs.oracle.com/cd/E23943_01/appirefs.111/e 1060/oracle/bpel/services/workflow/query/ITaskQueryService.
public interface ITaskQueryService
 This class provides a programmatic means for retrieving tasks, task details, etc
 
 A typical usage would be as follows:
  1. Use an authentication method to authenticate a user and obtain a context
  2. Use the context and a task list method to retrieve tasks that match some filter criterion
  3. Use the context and a task details method to drill down on a task in the list (retrieve task details
        and actions that can be performed on the task)
  4. Use task service, to perform operations on the task
  
 A sample code fragment that shows the usage in the above pattern in shown below:
 
   import java.util.ArrayList;
   import java.util.Date;
   import java.util.List;    
   import oracle.bpel.services.workflow.IWorkflowConstants;
   import oracle.bpel.services.workflow.client.IWorkflowServiceClient;
   import oracle.bpel.services.workflow.client.IWorkflowServiceClientConstants;
   import oracle.bpel.services.workflow.client.WorkflowServiceClientFactory;
   import oracle.bpel.services.workflow.query.ITaskQueryService;
   import oracle.bpel.services.workflow.repos.Ordering;
   import oracle.bpel.services.workflow.repos.Predicate;
   import oracle.bpel.services.workflow.repos.TableConstants;
   import oracle.bpel.services.workflow.task.ITaskService;
   import oracle.bpel.services.workflow.task.model.Task;
   import oracle.bpel.services.workflow.verification.IWorkflowContext;      
   
   //User whose task list needs to be queried
   String userid="jstein";
   // Password for the user
   String password = "welcome1";
   
   // You can use keyword to specify sql % around the keyword like: %keyword% on the following
   // attributes: task title, identification key, all textAttributes in task, task number (only
   // if the keyword is a number)
   
   String keyword = null;
   String nullParam = null;
 
   // Get workflow service client
   IWorkflowServiceClient wfSvcClient = WorkflowServiceClientFactory.getWorkflowServiceClient(WorkflowServiceClientFactory.SOAP_CLIENT);
   // Get the workflow context
   IWorkflowContext wfCtx = wfSvcClient.getTaskQueryService().authenticate(userId, password, 
                                 oracle.tip.pc.services.identity.config.ISConfiguration.getDefaultRealmName(),
                                 null);
   // Admin can authenticate on behalf of another user
   //IWorkflowContext adminCtx = wfSvcClient.getTaskQueryService().authenticate(adminUserId, pwd, 
   //                              oracle.tip.pc.services.identity.config.ISConfiguration.getDefaultRealmName(),
   //                              userId);
   
   ITaskQueryService querySvc = wfSvcClient.getTaskQueryService();      
   
   // Only for SOAP clients and it is mandatory for SOAP clients
   Predicate.enableXMLSerialization(true);
   
   // Build the predicate
   Predicate statePredicate = new Predicate(TableConstants.WFTASK_STATE_COLUMN,
                                Predicate.OP_NEQ,
                                IWorkflowConstants.TASK_STATE_ASSIGNED);
        statePredicate.addClause(Predicate.AND,
                         TableConstants.WFTASK_NUMBERATTRIBUTE1_COLUMN,
                         Predicate.OP_IS_NULL,
                         nullParam);
   Predicate datePredicate = new Predicate(TableConstants.WFTASK_ENDDATE_COLUMN,
                                Predicate.OP_ON,
                                new Date());
   Predicate predicate = new Predicate(statePredicate, Predicate.AND, datePredicate);
   
   // Create the ordering
   Ordering ordering = new Ordering(TableConstants.WFTASK_TITLE_COLUMN, true, true);        
     ordering.addClause(TableConstants.WFTASK_PRIORITY_COLUMN, true, true);
     
   // List of display columns
   // For those columns that are not specified here, the queried Task object will not hold any value.
   // For example: If TITLE is not specified, task.getTitle() will return null
   // For the list of most comonly used columns, check the table below
   // Note: TASKID is fetched by default. So there is no need to explicitly specity it.
   List queryColumns = new ArrayList();
     queryColumns.add("TASKNUMBER");     
     queryColumns.add("TITLE");
     queryColumns.add("PRIORITY");
     queryColumns.add("STATE");
     queryColumns.add("ENDDATE");
     queryColumns.add("NUMBERATTRIBUTE1");
     queryColumns.add("TEXTATTRIBUTE1");
     
   // List of optional info
   // Any optionalInfo specified can be fetched from the Task object
   // For example: if you have specified "CustomActions", you can retrieve
   // it using task.getSystemAttributes().getCustomActions();
   // "Actions" (All Actions) - task.getSystemAttributes().getSystemActions()
   // "GroupActions" (Only group Actions: Actions that can be permoded by the user as a member of a group)
   //                - task.getSystemAttributes().getSystemActions()
   // "ShortHistory" - task.getSystemAttributes().getShortHistory()
   List optionalInfo = new ArrayList();
     optionalInfo.add("Actions");
     //optionalInfo.add("GroupActions");
     //optionalInfo.add("CustomActions");
     //optionalInfo.add("ShortHistory");
     // The following is reserved for future use. 
     // If you need them, please use getTaskDetailsById (or) getTaskDetailsByNumber,
     // which will fetch all information related to a task, which includes these
        //optionalInfo.add("Attachments");
        //optionalInfo.add("Comments");
        //optionalInfo.add("Payload");

   List tasksList = querySvc.queryTasks(wfCtx,
                               queryColumns,
                               optionalInfo,
                               ITaskQueryService.ASSIGNMENT_FILTER_MY_AND_GROUP,
                               keyword,
                               predicate, 
                               ordering, 
                               0,0); // No Paging
                               
   // How to use paging:
   // 1. If you need to dynamically calculate paging size (or) to display/find 
   //    out the number of pages, the user has to scroll (Like page X of Y)
   //      Call queryTasks to find out the number of tasks it returns. Using this 
   //      calculate your paging size (The number of taks you want in a page)
   //      Call queryTasks successively varing the startRow and endRow params.  
   //      For example: If the total number of tasks is 30 and your want a paging size
   //      of 10, you can call with (startRow, endRow): (1, 10) (11, 20) (21, 30) 
   // 2. If you have fixed paging size, just keep calling queryTasks successively with 
   //      the paging size (If your paging size is 10, you can call with (startRow, endRow): 
   //      (1, 10) (11, 20) (21, 30) (31, 40).....  until the number of tasks returned is 
   //      less than your paging size (or) there are no more tasks returned     

   if (tasksList != null) { // There are tasks 
     System.out.println("Total number of tasks: " + tasksList.size()); 
     System.out.println("Tasks List: ");
     Task task = null; 
     for (int i = 0; i < tasksList.size(); i++) { 
       task = (Task) tasksList.get(i);          
       System.out.println("Task Number: " + task.getSystemAttributes().getTaskNumber());
       System.out.println("Task Id: " + task.getSystemAttributes().getTaskId());
       System.out.println("Title: " + task.getTitle());
       System.out.println("Priority: " + task.getPriority());
       System.out.println("State: " + task.getSystemAttributes().getState());
       System.out.println();
       // Retrive any Optional Info specified
       // Use task service, to perform operations on the task
     }
   }
   
 Beyond authentication, all methods require the worklist context as the first argument. The worklist context 
 helps the worklist service determine the user requesting the action, whether the user has permission to 
 perform the requested action on the task and so forth. The context also contains information about the 
 user's locale and timezone information.
 
Most commonly used columns Column object are defined in oracle.bpel.services.workflow.repos.Table Conts,and the y can batained by passing the column name to the static method Colunon oracle.bpel.services.workflow.repos.C.olumn.A list task atributes and column names can be obtained by caling the method ITaskMetadata Services.getTaskyAttributes(oracle.bpel.services.workflow.verification.IWorkflowContext) or ITaskMetadata Services.getTasky Attributes ForTasDefinition(oracle.bpel.services.workflow.verification.IWorkfloweContext,java.lang.String).
Column
Description
Column Object
How to retrieve
ACQUIREDBY
Acquired By
WFTASK_ACQUIREDBY_COLUMN
task.get System Attributes().getAcquiredBy()
ASSIGNEES
アッシュネス
WFTASK_ASSIGNEES_COLUMN
task.get System Attributes().get Asignes()
REVIEWERS
Reviewers
WFTASK_REVIEWERS_COLUMN
task.get System Attributes().getReviewers()
ASSIGN EEGROPS
Asignee Groups
WFTASK_ASSIGN EEGROPS_COLUMN
task.get System Attributes().get AsigneeGroups()
ASSIGN EEUSERS
Asignee Users
WFTASK_ASSIGN EEUSERS_COLUMN
task.get System Attributes().get AsigneeUsers()
CREATOR
クリエーター
WFTASK_CREATOR_COLUMN
task.get Creator()
DIGITA LSIGNATURREQUID
Digital Signature Required
WFTASK_DIGITA LSIGNATURREQUIRED_COLUMN
task.get System Attributes()isDigital Signature Required()
EXPIRATIONSDATE
Expiration Date
WFTASK_EXPIRATIONSDATECOLUMN
task.get System Attributes().getExpirationDate()
IDENTITY CONTEXT
Identity Conttext
WFTASK_IDENTITY CONTEXT_COLUMN
task.getIdentityConttext()
OWNERUSER
Owner User
WFTASK_OWNERUSER_COLUMN
task.getOwnerUser()
OWNERROUP
Ownerグループ
WFTASK_OWNERGROUP_COLUMN
task.getOwner Group()
PASSWORDREQUIREDONUPDATE
Password Required On Update
WFTASK_PASSWORDREQUIREDONUPDATE_COLUMN
task.get System Attributes().isPassword Required OnUpdate()
PRIORITY
Priority
WFTASK_PRIORITY_COLUMN
task.get Priority()
SECURENOT IFFATIONS
Secure Notifications
WFTASK_SECURENOT IFICATIONS_COLUMN
task.get System Attributes()isSecureNotifitions()
ASSIGN EDATE
Asigned Date
WFTASK_ASSIGN EDATE_COLUMN
task.get System Attributes().get AsignedDate()
CREATEDDATE
Created Date
WFTASK_CREATEDDATE_COLUMN
task.get System Attributes().get CreatedDate()
ENDDATE
End Date
WFTASK_ENDDATE_COLUMN
task.get System Attributes().get EndDate()
FROMUSER
From User
WFTASK_FROMUSER_COLUMN
task.get System Attributes().get FroomUser()
HASSUBTASK
Has Subtask
WFTASK_HASSUBTASK_COLUMN
task.gets System Attributes().isHas SubTass()
ISGROUTP
Isグループ
WFTASK_ISGROUT_COLUMN
task.get System Attributes().isIs Group()
ORIGINA LASSIGNEEUSER
Original Asignee User
WFTASK_ORIGINALASSIGNEEUSER_COLUMN
task.get System Attributes().()
OUTTCOME
アウトカム
WFTASK_OUTTCOMECOLUMN
task.get System Attributes().get Original AssingneeUser()
STATE
State
WFTASK_STATE_COLUMN
task.get System Attributes().get State()
TASKID
Task Id
WFTASK_TASKID_COLUMN
task.get System Attributes().gets Taskid()
TASKNUMBER
Task Number
WFTASK_TASKNUMBER_COLUMN
task.get System Attributes().getTaskNumber()
UPDATEDBY
Updated By
WFTASK_UPDATEDBY_COLUMN
task.get System Attributes().getUpdatedBy()
UDATEDDATE
Updated Date
WFTASK_UDATEDDATE_COLUMN
task.get System Attributes().getUpdatedDate()
TEXTATTRIBTE 1 to TEXTATTRIBTE 10
Textattribute 1 to Textattribute 10
WFTASK_TEXTATTRIBTE 1_COLUMN to WFTASK_TEXTATTRIBTE 10_COLUMN
task.gets System Message Attributes().get Text Attributes 1()to task.get System Message Attributes().get Text Attributes 10()
FOREMATTRIBTE 1 to FOREMATTRIBTE 5
FormAttribute 1 to FormAttribute 5
WFTASK_FOREMATTRIBTE 1_COLUMN to WFTASK_FOREMATTRIBTE 5_COLUMN
task.get System Message Attributes().get FormAttributes 1()to task.get System Message Attributes().get FormAttributes 5()
URLATTRIBTE 1 to URLATTRIBTE 5
UrlAttribute 1 to UrlAttribute 5
WFTASK_URLATTRIBTE 1_COLUMN to WFTASK_URLATTRIBTE 5_COLUMN
task.get System Message Attributes().get UrlAttribute 1()to task.get System Message Attributes().get UrlAttribute 5()
DATEATTRIBUTE 1 to DATETRIBUTE 5
DateAttribute 1 to DateAttribute 5
WFTASK_DATEATTRIBUTE 1_COLUMN to WFTASK_DATEATTRIBUTE 5_COLUMN
task.get System Message Attributes().get DateAttribute 1()to task.get System Message Attributes()
NUMBERATTRIBTE 1 to NUMBERATTRIBTE 5
Number Attribute 1 to Number Attribute 5
WFTASK_NUMBERATTRIBTE 1_COLUMN to WFTASK_NUMBERATTRIBTE 5_COLUMN
task.get System Message Attributes().getNumber Attribute 1()to task.get System Message Attributes().getNumber Attribut 5()
TITLE
Title
WFTASK_TITLE_COLUMN
task.getTitle()
IDENTIFICATIONKE
Identification key
WFTASK_IDENTIFICATIONKE_COLUMN
task.getIdentification Key()
TASKDEFINITIOID
Task Definition Id
WFTASK_TASKDEFINITIOID_COLUMN
task.getTask DefinitionId()
TASKDEFINITIONAME
Task Definition Name
WFTASK_TASKDEFINITIONAME_COLUMN
task.gets System Attributes().getTask DefinitionName()
PROTECTEDEXTATTRIBTE 1 to PROTECTEDEXTATTRIBTE 10
ProttectedTextAttribute 1 to ProttectedText Attribute 10
WFTASK_PROTECTEDEXTATTRIBTE 1_COLUMN to WFTASK_PROTECTEDEXTATTRIBTE 10_COLUMN
task.get System Message Attributes().get Protedtected Text Attribute 1()to task.get System Message Attributes()get Protedtected Text Attributes 10()
PROTECTEDFORMATTRIBTE 1 to PROTECTEDF ORMATTRIBTE 5
ProttectedFormAttribute 1 to Prottected FormAttribute 5
WFTASK_PROTECTEDF ORMATTRIBTE 1_COLUMN to WFTASK_PROTECTEDF ORMATTRIBTE 5_COLUMN
task.get System Message Attributes().get FormAttributes 1()to task.get System Message Attributes().get FormAttributes 5()
PROTECTEDURLATTRIBUTE 1 to PROTECTEDURLATTRIBUTE 5
ProttectedUR LAttribute 1 to ProtedURLAttribut 5
WFTASK_PROTECTEDURLATTRIBUTE 1_COLUMN to WFTASK_PROTECTEDURLATTRIBUTE 5_COLUMN
task.gets System Message Attributes().get Protect edUR LAttribute 1()to task.get System Message Attributes()get Protedictur LAttribute 5()
PROTECTEDDEATTRIBTE 1 to PROTECTEDDEATTRIBTE 5
ProttectedDateAttribute 1 to Prottected DateAttribut 5
WFTASK_PROTECTEDDEATTRIBTE 1_COLUMN to WFTASK_PROTECTEDDEATTRIBTE 5_COLUMN
task.get System Message Attributes().get ProttectedDateAttributed 1()to task.get System Message Attributes()get Protedtected Dattribut 5()
PROTECTEDNUM BERATTRIBTE 1 to PROTECTEDNUM BERATTRIBTE 5
ProttectedNumber Attribute 1 to ProttectedNumber Attribut 5
WFTASK_PROTECTEDNUM BERATTRIBTE 1_COLUMN to WFTASK_PROTECTEDNUM BERATTRIBTE 5_COLUMN
task.get System Message Attributes().get ProttectedNumber Attribute 1()to task.get System Message Attributes().get Protected Number Attribute 5()
APPLICATIONCONSTEXT
Apple Conteet
WFTASK_APPLICATIONCONSTEXT_COLUMN
task.getApplication Contect()
CATEGORY
Category
WFTASK_CATEGORY_COLUMN
task.getCategory()
DUEDATE
Due Date
WFTASK_DUEDATE_COLUMN
task.getDueDate()
ISPUBLIC
Is Public
WFTASK_ISPUBLIC_COLUMN
task.isIs Public()
PATICIPANTNAME
Partcipart Name
WFTASK_PATICIPANTNAME_COLUMN
task.get System Attributes().getPartpartName()
PERCENTAGECOMPLETE
Percentage Coplete
WFTASK_PERCENTAGECOMPLETE_COLUMN
task.getPercentage Complettee()
STARTDATE
Start Date
WFTASK_STARTDATE_COLUMN
task.get StartDate()
TASKDISPLAYURL
Task Display Url
WFTASK_TASKDISPLAYURL_COLUMN
task.getTask DisplayUrl()