/**
* returns a HashMap with IT resource field details
* @param itResourceName
* @return
*/
public HashMap<String, String> getITResourceAttributeInMap(String itResourceName) {
HashMap<String, String> adITResourcefileds = new HashMap<String, String> ();
try{
tcITResourceInstanceOperationsIntf tcITResourceIntf = Platform.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;
}
* returns a HashMap with IT resource field details
* @param itResourceName
* @return
*/
public HashMap<String, String> getITResourceAttributeInMap(String itResourceName) {
HashMap<String, String> adITResourcefileds = new HashMap<String, String> ();
try{
tcITResourceInstanceOperationsIntf tcITResourceIntf = Platform.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;
}
No comments:
Post a Comment