import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import sailpoint.api.SailPointContext;
import sailpoint.object.Custom;
import sailpoint.object.ResourceObject;
import sailpoint.tools.GeneralException;
ResourceObject object = null;
ResourceObject resourceObject = null;
Custom custom = null;
Map tablueauMap = null;
Map tablueauENTMap = null;
List listENT = null;
try {
if (object != null) {
if (object.getStringList("memberOf") != null && object.getStringList("memberOf").size() > 0
&& !object.getStringList("memberOf").isEmpty()) {
listENT = object.getStringList("memberOf");
log.error("TABLEAU groups are : "+listENT);
custom = context.getObjectByName(Custom.class, "Test Custom Object");
if (custom != null) {
tablueauMap = custom.getAttributes().getMap();
if (tablueauMap.size() > 0 @and tablueauMap.get("TABLEAU") != null) {
tablueauENTMap = (Map) tablueauMap.get("TABLEAU");
resourceObject = new ResourceObject();
for (String ent: listENT) {
if (tablueauENTMap.containsValue(ent)) {
resourceObject = object;
}
}
} else {
log.error("Custom Object doesn't contains TABLEAU ");
}
} else {
log.error("Custom Object is null");
}
} else {
log.error("Resource Object doesn't contains groups and length is zero");
}
} else {
log.error("ResourceObject is null");
}
return resourceObject;
} catch (GeneralException e) {
log.error("GeneralException : " + e.getMessage());
}
==========================================================================
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import sailpoint.api.SailPointContext;
import sailpoint.object.Custom;
import sailpoint.object.ResourceObject;
import sailpoint.tools.GeneralException;
public class ResourceObjectTest {
static SailPointContext context = null;
static ResourceObject object = null;
static ResourceObject resourceObject = null;
static Log log = null;
public static void main(String[] args) {
Custom custom = null;
Map tablueauMap = null;
Map tablueauENTMap = null;
List listENT = null;
try {
if (object != null) {
if (object.getAttribute("memberOf") != null) {
listENT = (List) object.getAttribute("memberOf");
if (listENT.size() > 0) {
custom = context.getObjectByName(Custom.class, "");
if (custom != null) {
tablueauMap = custom.getAttributes().getMap();
if (tablueauMap.size() > 0 && tablueauMap.get("TABLEAU") != null) {
tablueauENTMap = (Map) tablueauMap.get("TABLEAU");
for (Object object1 : listENT) {
if (tablueauENTMap.containsValue(object1)) {
resourceObject = object;
}
}
}
}
}
} else {
log.error("Resource Object doesn't contains groups ");
}
} else {
log.error("ResourceObject is : " + object);
}
} catch (GeneralException e) {
log.error("GeneralException : " + e.getMessage());
}
}
}
No comments:
Post a Comment