Monday, 21 January 2019

OIM API - Get RoleCategory Details through RoleCategory Name.


public RoleCategory getRoleCategoryDetails(String roleCategoryName) {
final String logp = CLASS_NAME + " #getRoleCategoryDetails - ";
LOGGER.info(logp + "START");
RoleCategory roleCategory = null;
try {
RoleCategoryManager roleCategoryManager = Platform.getService(RoleCategoryManager.class);

List<RoleCategory> list = roleCategoryManager.search(new SearchCriteria(RoleManagerConstants.RoleCategoryAttributeName.NAME.getId(), roleCategoryName, SearchCriteria.Operator.EQUAL),
null, null);

if (list.size() == 1) {
roleCategory = list.get(0);
LOGGER.info("Category Name :: " + roleCategory.getName());
LOGGER.info("Category Description :: " + roleCategory.getDescription());
}
} catch (AccessDeniedException e) {
e.printStackTrace();
} catch (RoleCategorySearchException e) {
e.printStackTrace();
}
LOGGER.info(logp + "END");
return roleCategory;
}

No comments:

Post a Comment