use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class AMServiceProfileModelImpl method getPropertiesViewBean.
/**
* Returns properties view bean URL for an attribute schema.
*
* @param name Name of attribute schema.
* @return properties view bean URL for an attribute schema.
*/
public String getPropertiesViewBean(String name) {
Set attributeSchemas = xmlBuilder.getAttributeSchemas();
String url = null;
for (Iterator iter = attributeSchemas.iterator(); iter.hasNext() && (url == null); ) {
AttributeSchema as = (AttributeSchema) iter.next();
if (as.getName().equals(name)) {
url = as.getPropertiesViewBeanURL();
}
}
return url;
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class AMServiceProfileModelImpl method setAttributeValues.
/**
* Set attribute values.
*
* @param map Map of attribute name to Set of attribute values.
* @throws AMConsoleException if values cannot be set.
*/
public void setAttributeValues(Map map) throws AMConsoleException {
Set attributeSchemas = new HashSet();
attributeSchemas.addAll(xmlBuilder.getAttributeSchemas());
addMoreAttributeSchemasForModification(attributeSchemas);
// Need to find the service schema for each attributeSchema
Map mapSvcSchemaToMapNameToValues = new HashMap();
for (Iterator i = attributeSchemas.iterator(); i.hasNext(); ) {
AttributeSchema as = (AttributeSchema) i.next();
String name = as.getName();
Set values = (Set) map.get(name);
if (values != null) {
ServiceSchema ss = as.getServiceSchema();
Map m = (Map) mapSvcSchemaToMapNameToValues.get(ss);
if (m == null) {
m = new HashMap();
mapSvcSchemaToMapNameToValues.put(ss, m);
}
m.put(name, values);
}
}
if (!mapSvcSchemaToMapNameToValues.isEmpty()) {
for (Iterator i = mapSvcSchemaToMapNameToValues.keySet().iterator(); i.hasNext(); ) {
ServiceSchema ss = (ServiceSchema) i.next();
setDefaultValues(ss, (Map) mapSvcSchemaToMapNameToValues.get(ss));
}
}
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class AttributeI18NKeyComparator method compare.
/**
* Performs string comparison on attribute schema's i18n keys
*
* @param o1 <code>AttributeSchema</code> object.
* @param o2 <code>AttributeSchema</code> object.
* @return 0 if i18n key of o1 is equal to i18n key of o2; less than 0 if
* i18n key of o1 is lexicographically less than i18n key of o2; greater
* than 0 if i18n key of o1 is greater than i18n key of o2.
*/
public int compare(Object o1, Object o2) {
AttributeSchema attr1 = (AttributeSchema) o1;
AttributeSchema attr2 = (AttributeSchema) o2;
return (collator != null) ? collator.compare(attr1.getI18NKey(), attr2.getI18NKey()) : attr1.getI18NKey().compareTo(attr2.getI18NKey());
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class TabControllerBase method updateStatus.
protected void updateStatus() {
boolean status = false;
SSOToken adminSSOToken = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
try {
ServiceSchemaManager mgr = new ServiceSchemaManager(AMAdminConstants.ADMIN_CONSOLE_SERVICE, adminSSOToken);
ServiceSchema schema = mgr.getSchema(SchemaType.GLOBAL);
AttributeSchema as = schema.getAttributeSchema(getConfigAttribute());
Set defaultValue = as.getDefaultValues();
if ((defaultValue != null) && !defaultValue.isEmpty()) {
String val = (String) defaultValue.iterator().next();
status = (val != null) && val.equals("true");
}
} catch (SMSException e) {
AMModelBase.debug.error("TabControllerBase.updateStatus", e);
} catch (SSOException e) {
AMModelBase.debug.error("TabControllerBase.updateStatus", e);
}
visible = status;
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class AbstractAuditModel method getEventHandlerDefaultValues.
/**
* Get the default attribute values for the specified event handler type (schema ID).
*
* @param eventHandlerType The name of the event handler type.
* @return A map of default event handler attribute values.
* @throws AMConsoleException If an error occurs whilst reading the attributes.
*/
public Map<String, Set<?>> getEventHandlerDefaultValues(String eventHandlerType) throws AMConsoleException {
try {
Map<String, Set<?>> defaultValues = new HashMap<>();
ServiceSchema handlerSchema = getServiceSchema().getSubSchema(eventHandlerType);
Set attributeSchemas = handlerSchema.getAttributeSchemas();
for (Object value : attributeSchemas) {
AttributeSchema as = (AttributeSchema) value;
Set values = as.getDefaultValues();
if (values != null) {
defaultValues.put(as.getName(), values);
}
}
return defaultValues;
} catch (SSOException | SMSException e) {
throw new AMConsoleException(getErrorString(e));
}
}
Aggregations