Saturday, October 14, 2017

How to Get Catalog Details for a Particular Request - OIM API

Hello guys,


Today I just want to share how you can get the Catalog details for a particular request in OIM 11g PS3.







       



// Thiago Leoncio - OIM API - Code Snippet to Get Catalog Details for a Particular Request.
  public void getCatalogDetailsForRequest(String requestID) throws RequestServiceException,
                                                                       NoRequestPermissionException,
                                                                       CatalogException {
          //get required services
          RequestService requestService = Platform.getService(RequestService.class);
          CatalogService catalogService = Platform.getService(CatalogService.class);
          
          //get request object
          Request request = requestService.getBasicRequestData(requestID);
          
          List reqBeneficiaries = request.getBeneficiaries();
          
          for (Beneficiary beneficiary : reqBeneficiaries){
              List requestBeneficiaryEntityThiagoList = beneficiary.getTargetEntities();
              for(RequestBeneficiaryEntity requestBeneficiaryEntity : requestBeneficiaryEntityThiagoList){
                  String entityKey = requestBeneficiaryEntity.getEntityKey();
                  OIMType entityType = requestBeneficiaryEntity.getRequestEntityType();
                  
                  Catalog catalog = catalogService.getCatalogItemDetails(null, entityKey, entityType, null);
                  
                  System.out.println("Approver Role :: " + catalog.getApproverRole()); 
                  System.out.println("Approver User :: " + catalog.getApproverUser());
                  System.out.println("Category :: " + catalog.getCategoryName());
              } 
          }
   }
  







Happy coding,

Thiago

No comments:

Post a Comment