Thursday 22 March 2018

OIM ADF UI - Code Snippet to get Selected Entitlements form Cart.

    public static final String CART_ITMS_ITR = "CartItemsVOIterator";
    public static final String ENTITY_TYPE = "entityType";
    public static final String ENTITY_KEY = "entityKey";
    public static final String ENTITY_NAME = "entityName";


    public HashMap<String,String> getSelectedEntitlementsFromCart() throws Exception{
        final String logp = CN + " :: getSelectedEntitlementsFromCart - ";
        LOGGER.debug(logp + "START");

        List<Row> cartRows = null;
        HashMap<String,String> entDetails = new HashMap<String,String>();
       
        cartRows = this.getAllRowsOfIterator(CART_ITMS_ITR);

        for (Row cartRow : cartRows) {
            String entityType = (String)cartRow.getAttribute(ENTITY_TYPE);
           
            if(ApprovalConstants.ENTITLEMENT_ENTITY.equalsIgnoreCase(entityType)){
                String entKey = (String)cartRow.getAttribute(ENTITY_KEY);
                String entName = (String)cartRow.getAttribute(ENTITY_NAME);
                entDetails.put(entKey,entName);
            }
        }
       
        LOGGER.debug(logp + "END");
        return entDetails;
    }


Happy Learning!!!

1 comment: