Monday, November 16, 2020

How to fetch childData(Roles or Entitlements ) in OIM?

 public static HashMap<String, String> getChildData(Account resourceAccount) {

String methodName = "getChildData";

System.out.println(CLASS_NAME + "/" + methodName);

LOGGER.debug(CLASS_NAME + "/" + methodName);

HashMap<String, String> childDataMap = new HashMap<String, String>();

String childFormName = "UD_PEDIA_PC";

        String fieldName = "";

String fieldValue = "";

Map<String, ArrayList<ChildTableRecord>> childData = resourceAccount.getAccountData().getChildData();

Iterator iter = childData.entrySet().iterator();

while (true) {

String currentChildFormName;

ArrayList childFormData;

do {

if (!iter.hasNext()) {

return childDataMap;

}

Entry pairs = (Entry) iter.next();

currentChildFormName = (String) pairs.getKey();

childFormData = (ArrayList) pairs.getValue();

} while (!currentChildFormName.equals(childFormName));

Iterator var10 = childFormData.iterator();

while (var10.hasNext()) {

ChildTableRecord record = (ChildTableRecord) var10.next();

Map<String, Object> childRecordData = record.getChildData();

fieldName = (String) childRecordData.get("UD_PEDIA_PC_FIELDNAME");

fieldValue = (String) childRecordData.get("UD_PEDIA_PC_VALUE");

childDataMap.put(fieldName, fieldValue);

}

}

}

How to fetch user key and user status by using UserLogin in OIM?

 public static HashMap<String, String> getUserDetails(String userLogin) {

String methodName = "getUserDetails";

System.out.println(CLASS_NAME + "/" + methodName + "; userLogin = " + userLogin);

LOGGER.debug(CLASS_NAME + "/" + methodName + "; userLogin = " + userLogin);

String userKey = "";

String userStatus = "";

String query = "SELECT * FROM USR WHERE usr_login ='" + userLogin + "' AND                            usr_status = 'Active'";

HashMap<String, String> hashMap = null;

Connection connection = null;

PreparedStatement preparedStatement = null;

ResultSet rs = null;

try {

hashMap = new HashMap<String, String>();

connection = Platform.getOperationalDS().getConnection();

preparedStatement = connection.prepareStatement(query);

rs = preparedStatement.executeQuery(query);

while (rs.next()) {

userKey = rs.getString("USR_KEY");

userStatus = rs.getString("USR_STATUS");

hashMap.put("User Key", userKey);

hashMap.put("User Status", userStatus);

}

} catch (SQLException e) {

System.out.println("SQLException : " + e.getMessage());

LOGGER.error("SQLException : " + e.getMessage());

e.printStackTrace();

} finally {

closeDatabaseConnections(connection, preparedStatement, rs);

}

System.out.println("Exiting from the method : " + methodName);

LOGGER.debug("Exiting from the method : " + methodName);

return hashMap;

}

Fetch Members from Workgroup

  import java.util.ArrayList;   import java.util.Iterator;   import java.util.List;   import sailpoint.api.ObjectUtil;   import sailpoint.ob...