public long getUserKey(String obj){
long key = 0;
HashMap
try {
userMap.put("Users.User ID", obj);
tcResultSet moResultSet = moUserUtility.findUsers(userMap);
for (int i=0; i < moResultSet.getRowCount(); i++){ moResultSet.goToRow(i); key = moResultSet.getLongValue("Users.Key"); } }catch(Exception e){ e.printStackTrace(); } return key;} Code to get groupkey
public long getGroupKey(String obj){
long key = 0;
HashMap
try {
userMap.put("Groups.Group Name", obj);
tcResultSet moResultSet = moGroupUtility.findGroups(userMap);
for (int i=0; i < moResultSet.getRowCount(); i++){ moResultSet.goToRow(i); key = moResultSet.getLongValue("Groups.Key"); } }catch(Exception e){ e.printStackTrace(); } return key;} Getting Object key for resource
public long getObjectKey(String object) {
HashMap
long key = 0;
try {
objectMap.put("Objects.Name", object);
tcResultSet moResultSet = moObjectUtility.findObjects(objectMap);
if (moResultSet.getRowCount()==0)
{
System.out.println("Cannot get key value");
}
else
{
moResultSet.goToRow(0);
key = moResultSet.getLongValue("Objects.Key");
System.out.println("Key value " +key);
}
}catch(Exception e){
e.printStackTrace();
}
return key;
}
No comments:
Post a Comment