public void dumpItem(UserContext userContext) {
    System.out.print("Enter Item ID: ");

    long itemID = IOUtils.readLong();
    DataExtent de = new DataExtent();
    de.setStartLevel(0);
    de.setEndLevel(Integer.MAX_VALUE);

    try {
      ItemSummary is = dataService.getItemSummaryForItem1(userContext, new Long(itemID), de);
      DataDumper.dumper(is);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 public Object[] fetchItemSummaries(UserContext userContext) {
   Object[] itemSummaries = null;
   List itemSummariesList = null;
   try {
     itemSummariesList = dataService.getItemSummaries(userContext);
     if (itemSummariesList != null) {
       itemSummaries = itemSummariesList.getElements();
     }
     if (itemSummaries == null || itemSummaries.length == 0) System.out.println("no Items found");
   } catch (StaleConversationCredentialsExceptionFault e) {
     e.printStackTrace();
   } catch (InvalidConversationCredentialsExceptionFault e) {
     e.printStackTrace();
   } catch (CoreExceptionFault e) {
     e.printStackTrace();
   } catch (IllegalArgumentValueExceptionFault e) {
     e.printStackTrace();
   } catch (InvalidUserContextExceptionFault e) {
     e.printStackTrace();
   } catch (RemoteException e) {
     e.printStackTrace();
   }
   return itemSummaries;
 }
 public void viewItems(UserContext userContext) {
   Object[] itemSummaries;
   List itemSummariesList;
   try {
     itemSummariesList = dataService.getItemSummaries(userContext);
     itemSummaries = itemSummariesList.getElements();
     if (itemSummaries == null || itemSummaries.length == 0) {
       System.out.println("You have no Items Added.");
     } else {
       for (int i = 0; i < itemSummaries.length; i++) {
         ItemSummary is = (ItemSummary) itemSummaries[i];
         String displayName = is.getContentServiceInfo().getContentServiceDisplayName();
         System.out.println(
             "ItemId: "
                 + is.getItemId()
                 + " DisplayName: "
                 + displayName
                 + " errorCode: "
                 + is.getRefreshInfo().getStatusCode()
                 + " refreshInfo time: "
                 + new Date(is.getRefreshInfo().getLastUpdatedTime() * 1000));
         ItemData id = is.getItemData();
         if (id != null) {
           Object[] itemAccounts = id.getAccounts().getElements();
           for (int j = 0; j < itemAccounts.length; j++) {
             if (is.getContentServiceInfo() != null
                 && is.getContentServiceInfo().getContainerInfo() != null
                 && is.getContentServiceInfo()
                     .getContainerInfo()
                     .getContainerName()
                     .equals(ContainerTypesHelper.LOAN)) {
               LoanLoginAccountData loanLoginAccountData = (LoanLoginAccountData) itemAccounts[j];
               if (loanLoginAccountData != null && loanLoginAccountData.getLoans() != null) {
                 Object[] loans = loanLoginAccountData.getLoans().getElements();
                 if (loans != null && loans.length > 0) {
                   for (int l = 0; l < loans.length; l++) {
                     Loan loan = (Loan) loans[l];
                     if (loan.getItemAccountId() != null) {
                       System.out.println("\tItemAccountId: " + loan.getItemAccountId());
                     }
                   }
                 }
               }
             } else {
               BaseTagData baseTagData = (BaseTagData) itemAccounts[j];
               System.out.println("\tItemAccountId: " + baseTagData.getItemAccountId());
             }
           }
         }
       }
     }
   } catch (StaleConversationCredentialsExceptionFault e) {
     e.printStackTrace();
   } catch (InvalidConversationCredentialsExceptionFault e) {
     e.printStackTrace();
   } catch (CoreExceptionFault e) {
     e.printStackTrace();
   } catch (IllegalArgumentValueExceptionFault e) {
     e.printStackTrace();
   } catch (InvalidUserContextExceptionFault e) {
     e.printStackTrace();
   } catch (RemoteException e) {
     e.printStackTrace();
   }
 }