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.
Caused by: oracle.iam.request.exception.RequestServiceException: Related application instance {app instance name} and entitlement {entitlement name} can not be requested together.
oracle.iam.request.exception.RequestServiceException: No request type found for entity type ApplicationInstance and operation Heterogeneous Request.
Please help.
Thanks in advance.