Read OIM IT Resource via API
Objective:
Many a times it becomes necessary to read OIM IT resource via API. This method will help you
Many a times it becomes necessary to read OIM IT resource via API. This method will help you
do the same.
Let's start:
Initialize OIM client as usual. You can follow my other post to get started with writting OIM client.
Following is the method which you can use to read IT resource by providing IT Resource Name.
public static HashMap<String, String> getITResourceAttributeInMap(String itResourceName) {
HashMap<String, String> adITResourcefileds = new HashMap<String, String> ();
try{
tcITResourceInstanceOperationsIntf tcITResourceIntf = oimClient.getService(tcITResourceInstanceOperationsIntf.class);
HashMap<String, String> searchcriteria = new HashMap<String, String>();
searchcriteria.put("IT Resources.Name", itResourceName);
tcResultSet resultSet = tcITResourceIntf.findITResourceInstances(searchcriteria);
resultSet = tcITResourceIntf.getITResourceInstanceParameters(resultSet.getLongValue("IT Resources.Key"));
for (int i = 0; i < resultSet.getRowCount(); i++) {
resultSet.goToRow(i);
String name = resultSet.getStringValue("IT Resources Type Parameter.Name");
String value= resultSet.getStringValue("IT Resources Type Parameter Value.Value");
adITResourcefileds.put(name,value);
}
}catch (Exception ae) {
ae.printStackTrace();
}
return adITResourcefileds;
}
Conclusion : We are good to get the IT resource values via API :)
Comments
Post a Comment