use of com.iplanet.ums.TemplateManager in project OpenAM by OpenRock.
the class DirectoryServicesImpl method createResource.
private void createResource(PersistentObject parentObj, Map attributes, String profileName) throws UMSException, AMException {
AttrSet attrSet = CommonUtils.mapToAttrSet(attributes);
makeNamingFirst(attrSet, getNamingAttribute(AMObject.RESOURCE), profileName);
TemplateManager tempMgr = TemplateManager.getTemplateManager();
String orgDN = getOrganizationDN(internalToken, parentObj.getDN());
CreationTemplate creationTemp = tempMgr.getCreationTemplate("BasicResource", new Guid(orgDN), TemplateManager.SCOPE_ANCESTORS);
com.iplanet.ums.Resource resource = new com.iplanet.ums.Resource(creationTemp, attrSet);
parentObj.addChild(resource);
}
use of com.iplanet.ums.TemplateManager in project OpenAM by OpenRock.
the class DirectoryServicesImpl method createRole.
private void createRole(SSOToken token, PersistentObject parentObj, Map attributes, String profileName) throws UMSException, AMException {
// Invoke the Pre Processing plugin
String orgDN = getOrganizationDN(internalToken, parentObj.getDN());
String entryDN = getNamingAttribute(AMObject.ROLE) + "=" + profileName + "," + parentObj.getDN();
attributes = callBackHelper.preProcess(token, entryDN, orgDN, null, attributes, CallBackHelper.CREATE, AMObject.ROLE, false);
AttrSet attrSet = CommonUtils.mapToAttrSet(attributes);
makeNamingFirst(attrSet, getNamingAttribute(AMObject.ROLE), profileName);
TemplateManager tempMgr = TemplateManager.getTemplateManager();
CreationTemplate creationTemp = tempMgr.getCreationTemplate("BasicManagedRole", new Guid(orgDN), TemplateManager.SCOPE_ANCESTORS);
attrSet = combineOCs(creationTemp, attrSet);
com.iplanet.ums.ManagedRole role = new com.iplanet.ums.ManagedRole(creationTemp, attrSet);
parentObj.addChild(role);
// Invoke Post processing impls
callBackHelper.postProcess(token, role.getDN(), orgDN, null, attributes, CallBackHelper.CREATE, AMObject.ROLE, false);
}
use of com.iplanet.ums.TemplateManager in project OpenAM by OpenRock.
the class SearchFilterManager method getSearchFilterFromTemplate.
static String getSearchFilterFromTemplate(int objectType, String orgDN, String searchTemplateName) {
SearchTemplate searchTemp = null;
String filter;
try {
String searchTempName = ((searchTemplateName == null) ? getSearchTemplateName(objectType) : searchTemplateName);
if (searchTempName == null) {
debug.warning("SearchFilterManager." + "getSearchFilterFromTemplate(): Search template name" + " is null. Unable to retrieve search filter. " + "Returning <empty> value.");
return "";
}
TemplateManager mgr = TemplateManager.getTemplateManager();
Guid orgGuid = ((orgDN == null) ? null : new Guid(orgDN));
searchTemp = mgr.getSearchTemplate(searchTempName, orgGuid, TemplateManager.SCOPE_TOP);
// Get the Original search filter
// Check to see if the filter starts with "(" and ends with ")"
// In which case there is no need to add opening and closing braces.
// otherwise add the opening and closing braces.
} catch (UMSException ue) {
if (debug.messageEnabled()) {
debug.message("SearchFilterManager." + "getSearchFilterFrom" + "Template() Got Exception", ue);
}
}
if (searchTemp != null) {
filter = searchTemp.getSearchFilter();
} else {
// FIXME: Why do we need to make it objectclass=*, can't we send the
// default filter here?
filter = "(objectclass=*)";
}
if (!filter.startsWith("(") || !filter.endsWith(")")) {
filter = "(" + filter + ")";
}
if (debug.messageEnabled()) {
if (searchTemp != null) {
debug.message("SearchFilterManager." + "getSearchFilterFrom" + "Template() SearchTemplate Name = " + searchTemp.getName() + ", objectType = " + objectType + ", orgDN = " + orgDN + ", Obtained Filter = " + searchTemp.getSearchFilter() + ", Modified Filter = " + filter);
} else {
debug.message("SearchFilterManager." + "getSearchFilterFrom" + "Template() Filter = " + filter);
}
}
return filter;
}
use of com.iplanet.ums.TemplateManager in project OpenAM by OpenRock.
the class DirectoryServicesImpl method createAssignDynamicGroup.
private void createAssignDynamicGroup(SSOToken token, PersistentObject parentObj, Map attributes, String profileName) throws UMSException, AMException {
// Invoke the Pre Processing plugin
String orgDN = getOrganizationDN(internalToken, parentObj.getDN());
String entryDN = getNamingAttribute(AMObject.GROUP) + "=" + profileName + "," + parentObj.getDN();
attributes = callBackHelper.preProcess(token, entryDN, orgDN, null, attributes, CallBackHelper.CREATE, AMObject.ASSIGNABLE_DYNAMIC_GROUP, false);
AttrSet attrSet = CommonUtils.mapToAttrSet(attributes);
makeNamingFirst(attrSet, getNamingAttribute(AMObject.ASSIGNABLE_DYNAMIC_GROUP), profileName);
TemplateManager tempMgr = TemplateManager.getTemplateManager();
CreationTemplate creationTemp = tempMgr.getCreationTemplate("BasicAssignableDynamicGroup", new Guid(orgDN), TemplateManager.SCOPE_ANCESTORS);
attrSet = combineOCs(creationTemp, attrSet);
AssignableDynamicGroup adgroup = new AssignableDynamicGroup(creationTemp, attrSet);
adgroup.setSearchFilter("(memberof=" + entryDN + ")");
adgroup.setSearchScope(SearchScope.WHOLE_SUBTREE.intValue());
adgroup.setSearchBase(new Guid(orgDN));
parentObj.addChild(adgroup);
// Invoke Post processing impls
callBackHelper.postProcess(token, adgroup.getDN(), orgDN, null, attributes, CallBackHelper.CREATE, AMObject.ASSIGNABLE_DYNAMIC_GROUP, false);
}
Aggregations