Here's the sample code for modifying a user with request generation. In this code example, I am submitting a request for modifying a custom user attribute (employeeStatus) and setting the value as "loa".
public void submitModifyUserRequest(OIMService oimService){
String userKey = "101";
RequestData requestData = new RequestData();
List attrs = new ArrayList();
RequestEntityAttribute attr = new RequestEntityAttribute("employeeStatus", "loa", TYPE.String );
attrs.add(attr);
requestData.setJustification("Required Justification");
RequestEntity requestEntity = new RequestEntity();
requestEntity.setRequestEntityType(OIMType.User);
requestEntity.setEntityKey(userKey);
requestEntity.setOperation(RequestConstants.MODEL_MODIFY_OPERATION);
requestEntity.setEntityData(attrs);
List entities = new ArrayList();
entities.add(requestEntity);
requestData.setTargetEntities(entities);
try {
OperationResult result = oimService.doOperation(requestData, OIMService.Intent.REQUEST);
System.out.println("Result :: " + result.getOperationStatus());
System.out.println("Request ID :: " + result.getRequestID());
} catch (OIMServiceException e) {
e.printStackTrace();
}
}
public void submitModifyUserRequest(OIMService oimService){
String userKey = "101";
RequestData requestData = new RequestData();
List
RequestEntityAttribute attr = new RequestEntityAttribute("employeeStatus", "loa", TYPE.String );
attrs.add(attr);
requestData.setJustification("Required Justification");
RequestEntity requestEntity = new RequestEntity();
requestEntity.setRequestEntityType(OIMType.User);
requestEntity.setEntityKey(userKey);
requestEntity.setOperation(RequestConstants.MODEL_MODIFY_OPERATION);
requestEntity.setEntityData(attrs);
List
entities.add(requestEntity);
requestData.setTargetEntities(entities);
try {
OperationResult result = oimService.doOperation(requestData, OIMService.Intent.REQUEST);
System.out.println("Result :: " + result.getOperationStatus());
System.out.println("Request ID :: " + result.getRequestID());
} catch (OIMServiceException e) {
e.printStackTrace();
}
}