Wednesday 14 December 2016

SOA Service Client : Get Attributes on Item/Item Revision Objects


How to get the revision list if we have item object ?

//localObject1 is Item object
String[] arrAttributes = new String[] { "revision_list"};
ModelObject arrModelObjects[]= new ModelObject[1];
arrModelObjects[0]=localObject1;
serviceData = dataManagementService.getProperties(arrModelObjects, arrAttributes);//Get the revision list attribute loaded for Item object
if(serviceData.sizeOfPlainObjects()>0)
localObject1 = 
(Item) serviceData.getPlainObject(0); //Get the original Item object with revision_list loaded
else
localObject1 = (Item)arrModelObjects[0];
ModelObject[] localObject4 = ((Item)localObject1).get_revision_list(); //Get All the Item revisions

How to get the item_revision_id for Item revisions found above?
for (int i = 0; i < localObject4.length; ++i) 
 {
    ItemRevision localItemRevision2 = (ItemRevision)localObject4[i];
    arrAttributes = new String[] { "item_revision_id"};  
    arrModelObjects = new ModelObject[1];
    arrModelObjects[0]=localItemRevision2;
    serviceData = 
    dataManagementService.getProperties(arrModelObjects, arrAttributes);
    if(serviceData.sizeOfPlainObjects()>0)
     localItemRevision2 = (ItemRevision) serviceData.getPlainObject(0);
    else
     localItemRevision2 = (ItemRevision)arrModelObjects[0];
     String str7 = localItemRevision2.get_item_revision_id(); //get id for item revision
}

How to get the release_status_list for item revision i.e get the Release status objects for Item Revisoin

 String[] arrAttributes = new String[] { "release_status_list"};
 ModelObject arrModelObjects[]= new ModelObject[1];
 //Considering we have localItemRevision1 which is Item Revision object
        arrModelObjects[0]=localItemRevision1;
       //This API will load release_status_list attribute for Item revision
 serviceData = dataManagementService.getProperties(arrModelObjects, arrAttributes);
 
       if(serviceData.sizeOfPlainObjects()>0)
 localItemRevision1 = (ItemRevision) serviceData.getPlainObject(0); //Get the Item revision object with release_status_list attribute loaded
       else
 localItemRevision1 = (ItemRevision)arrModelObjects[0];

 ReleaseStatus[] localObject4 = localItemRevision1.get_release_status_list(); //Get The ReleaseStatus object for Item Revision

 
Explanation : Important API
ModelObject[] localObject4 = ((Item)localObject1).get_revision_list();
String str7 =localItemRevision2.get_item_revision_id();
ReleaseStatus[] localObject4 = localItemRevision1.get_release_status_list(); 

3 comments:

  1. Hi,
    How to retrieve the custom attributes at Item and Item revision level ?

    Ambuj

    ReplyDelete
  2. how to get item details in java?

    ReplyDelete