Monday, January 20, 2014

# 305 Adaptive Case Management Java API Part 2

Building on from the previous post - let's get some more information -

        Case myCase = new Case();
                List caseInfo =
            new ArrayList();
           caseInfo.add(ICaseConstants.CaseInfo.ALL);   

Note the additional line above -

This gives us access to more case related info such as Activities, Data, Milestones, Comments etc.

            // Case Activities
            CompletedCaseActivityList ccal =
                myCase.getCaseHeader().getCompletedCaseActivityList();
            List cca_l =
                ccal.getCompletedCaseActivity();
            System.out.println("### Nr of Case Activities Completed for this instance =" +
                               cca_l.size());

            for (int a = 0; a < cca_l.size(); a++) {
                CompletedCaseActivity cca = cca_l.get(a);
                String name = cca.getName();
                System.out.println("Completed Case Activity name = " + name);
            }

            System.out.println("### End of Case Header Info ...");

            System.out.println("");
                      // Case Data
            List cd_l = myCase.getCaseData();
            System.out.println("Case Data list size " + cd_l.size());
            for (int b = 0; b < cd_l.size(); b++) {
                CaseData cd = cd_l.get(b);
                System.out.println("Case Data  = " + cd.getData());
                System.out.println("");

            }

            // Case Actions
            List myActions = myCase.getActions();
            for (int c = 0; c < myActions.size(); c++) {
                System.out.println("+++ Actions : " +
                                   myActions.get(c).toString());
                

            }
            System.out.println("");
            
            // Case Comments
            List c_l = myCase.getComments();
            System.out.println("Comment list size " + c_l.size());
            for (int d = 0; d < c_l.size(); d++) {
                Comment comment = c_l.get(d);
                System.out.println("Comment :" + comment.getCaseObjectComment());
            }
            System.out.println("");

          
            List caseDataList = myCase.getCaseData();
            System.out.println("Case Data List size = " + caseDataList.size());
            for (int e = 0; e < caseDataList.size(); e++) {
                CaseData caseData = caseDataList.get(e);
                System.out.println("Case Data Name :" + caseData.caseDataName);
            }
            System.out.println("");
          
            List caseMilestoneList = myCase.getCaseMilestones();
            System.out.println("Case Milestone List size = " +
                               caseMilestoneList.size());

            for (int f = 0; f < caseMilestoneList.size(); f++) {
                CaseMilestone caseMilestone = caseMilestoneList.get(f);
                System.out.println("Case Milestone :" +
                                   caseMilestone.getObjectDisplayName());
                System.out.println("Case Milestone state :" +
                                   caseMilestone.getState());

            }
            System.out.println("");
            


FYI - here is one of my case composites -


         























































I have a test instance running - the case is configured with a rule to automatically reach the milestone ApproveOrderStarted. The Case data below contains my input

I run the above code - and get the following output -

### Case Header Info ...
Composite Name = default/SimpleOrderProcessingCase!1.0*soa_9f7e0a57-cfea-4ce1-8f91-5ca2280c4a13
Case Def. = SimpleOrderProcessingCase
ECM Folder = MyOrders/123
Id Key = 123 
Case Definition Name = SimpleOrderProcessingCase
Application Name = default
Component Name = SimpleOrderProcessingCase
Case Number = 42
Case Definition Id = default/SimpleOrderProcessingCase!1.0/SimpleOrderProcessingCase
### Nr of Case Activities Completed for this instance =0
### End of Case Header Info ...

Case Data list size 1
Case Data  = 123iBikeA1234NiallCMain StIEN
         

+++ Actions : abortCase
+++ Actions : updateCaseHeader
+++ Actions : closeCase
+++ Actions : suspendCase
+++ Actions : getCase
+++ Actions : queryCase

Comment list size 1
Comment :auto-start

Case Data List size = 1
Case Data Name :caseDataName

Case Milestone List size = 4
Case Milestone :OrderApprovalCompleted
Case Milestone state :NOT_ATTAINED
Case Milestone :OrderApprovalStarted
Case Milestone state :ATTAINED
Case Milestone :OrderShippingCompleted
Case Milestone state :NOT_ATTAINED
Case Milestone :OrderShippingStarted
Case Milestone state :NOT_ATTAINED

Case StakeHolder List size = 1
Case StakeHolder Name :CSR
+++ Case StakeHolder Member Name :James Cooper
+++ Case StakeHolder Member Name :John Steinbeck

Revised JDeveloper project available here




No comments:

Post a Comment