Note - This code is only to help developers. Please use this on your own risk.
public class GetITResourceAttributesValueTest{
private static tcITResourceInstanceOperationsIntf tcITResOp;
private static OIMClient oimClient = null;
static UserManager userMgrOps = null;
static ProvisioningService provServOps = null;
static RoleManager roleManager = null;
static RequestService reqServOps = null;
// This Test Code code will help developer to get the IT resource attribute values programitacally. Do not use this code in production
tcITResOp=oimClient.getService(tcITResourceInstanceOperationsIntf.class);
private static tcITResourceInstanceOperationsIntf getTcITResOp(){
if(tcITResOp==null)
tcITResOp=oimClient.getService(tcITResourceInstanceOperationsIntf.class);
return tcITResOp;
}
private static HashMap<String, String> getITResourceParamters(String itResource){
HashMap<String, String> map = new HashMap<String, String>();
map.put("IT Resource.Name", itResource);
try{
tcResultSet set = getTcITResOp().findITResourceInstances(map);
map.clear();
if (!set.isEmpty()){
set = getTcITResOp().getITResourceInstanceParameters(set.getLongValue("IT Resource.Key"));
for (int i=0;i<set.getTotalRowCount();i++){
set.goToRow(i);
System.out.println(set.getStringValue("IT Resources Type Parameter.Name")+" "+set.getStringValue("IT Resource.Parameter.Value"));
map.put(set.getStringValue("IT Resources Type Parameter.Name"), set.getStringValue("IT Resource.Parameter.Value"));
}
}
} catch (Exception e) {
System.out.println("Exception : - "+e);
}
return map;
}
// Running via Main method to see Test Server IT Resource Details
public static void main(String[] args) {
Map itData= getITResourceParamters("Test Server");
Iterator it = itData.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pair = (Map.Entry)it.next();
System.out.println(pair.getKey() + " = " + pair.getValue());
it.remove();
}
}
}
No comments:
Post a Comment