Skip to Main Content

How to make heterogeneous request with OIM API

BaduelMar 21 2018 — edited Mar 21 2018

Hello everyone.

I'd like to make an heterogeneous request with OIM API. I do the following:

        public static boolean heterogeneousRequest(List<Entitlement> entitlements, User user) {

           

            List<RequestBeneficiaryEntity> entities = new ArrayList<RequestBeneficiaryEntity>();

            // Setup Request Entity for the App Instance

            RequestBeneficiaryEntity reqBenefEntitApp = new RequestBeneficiaryEntity();

            reqBenefEntitApp.setRequestEntityType(OIMType.ApplicationInstance);

            reqBenefEntitApp.setEntitySubType("EntitySubType");

            reqBenefEntitApp.setEntityKey("000");

            reqBenefEntitApp.setOperation(RequestConstants.MODEL_PROVISION_APPLICATION_INSTANCE_OPERATION);

            entities.add(reqBenefEntitApp);

            // Setup Request Entity for Entitlements

            RequestBeneficiaryEntity reqBenefEntity = null;

            for (Entitlement entitlement : entitlements) {

                reqBenefEntity = new RequestBeneficiaryEntity();

                reqBenefEntity.setRequestEntityType(OIMType.Entitlement);

                reqBenefEntity.setEntitySubType(entitlement.getEntitlementValue());

                reqBenefEntity.setEntityKey(String.valueOf(entitlement.getEntitlementKey()));

                reqBenefEntity.setOperation(RequestConstants.MODEL_PROVISION_ENTITLEMENT_OPERATION);

                entities.add(reqBenefEntity);

            }

            // Setup beneficiary to grant entitlement

            Beneficiary beneficiary = new Beneficiary();

            beneficiary.setBeneficiaryKey(user.getId());

            beneficiary.setBeneficiaryType(Beneficiary.USER_BENEFICIARY);

            beneficiary.setTargetEntities(entities);

            // Add single beneficiary to list

            List<Beneficiary> beneficiaries = new ArrayList<Beneficiary>();

            beneficiaries.add(beneficiary);

            // Setup Request Data

            RequestData reqData = new RequestData();

            reqData.setBeneficiaries(beneficiaries);

            // Invoke request operation in OIM

            OperationResult result = null;

            try {

                result = OIM_SERVICE.doOperation(reqData, OIMService.Intent.ANY);

            } catch (Exception e) {

                e.printStackTrace();

            }

            if (result != null) {

                return true;

            }

            return false;

        }

OIM_SERVICE is a client related to OIMService class.

I have the following error:

Caused by: oracle.iam.request.exception.RequestServiceException: Related application instance {app instance name} and entitlement {entitlement name} can not be requested together.

I tried also replacing both operations with the parameter RequestConstants.REQUEST_TYPE_HETEROGENEOUS whit a different error:

oracle.iam.request.exception.RequestServiceException: No request type found for entity type ApplicationInstance and operation Heterogeneous Request.

Please help.

Thanks in advance.

Post Details
Locked due to inactivity on Apr 18 2018
Added on Mar 21 2018
0 comments
67 views