use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class GetAttributes method isPassword.
private boolean isPassword(Set attrSchemas, String attrName) {
boolean isPwd = false;
for (Iterator i = attrSchemas.iterator(); i.hasNext(); ) {
AttributeSchema as = (AttributeSchema) i.next();
if (attrName.equals(as.getName())) {
AttributeSchema.Syntax syntax = as.getSyntax();
isPwd = (syntax != null) && (syntax == AttributeSchema.Syntax.PASSWORD);
break;
}
}
return isPwd;
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class AMServiceProfileModelImpl method getAttributeValues.
/**
* Returns attributes values.
*
* @return attributes values.
*/
public Map getAttributeValues() {
String[] param = { serviceName };
logEvent("ATTEMPT_READ_ALL_GLOBAL_DEFAULT_ATTRIBUTE_VALUES", param);
Set attributeSchemas = xmlBuilder.getAttributeSchemas();
Map values = new HashMap(attributeSchemas.size() * 2);
for (Iterator iter = attributeSchemas.iterator(); iter.hasNext(); ) {
AttributeSchema as = (AttributeSchema) iter.next();
AttributeSchema.UIType uiType = as.getUIType();
if ((uiType == null) || (!uiType.equals(AttributeSchema.UIType.NAME_VALUE_LIST) && !uiType.equals(AttributeSchema.UIType.BUTTON) && !uiType.equals(AttributeSchema.UIType.LINK))) {
AttributeSchema.Type type = as.getType();
if ((type == AttributeSchema.Type.MULTIPLE_CHOICE) || (type == AttributeSchema.Type.SINGLE_CHOICE)) {
Map tmp = new HashMap(4);
tmp.put("choices", AMAdminUtils.toSet(as.getChoiceValues()));
tmp.put("values", as.getDefaultValues());
values.put(as.getName(), tmp);
}
values.put(as.getName(), as.getDefaultValues());
}
}
logEvent("SUCCEED_READ_ALL_GLOBAL_DEFAULT_ATTRIBUTE_VALUES", param);
return values;
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class AMServiceProfileModelImpl method getAttributeValues.
/**
* Returns attribute values.
*
* @param name Name of attribute.
* @return attribute values.
*/
public Set getAttributeValues(String name) {
boolean found = false;
Set values = null;
Set attributeSchemas = xmlBuilder.getAttributeSchemas();
String[] params = { serviceName, name };
logEvent("ATTEMPT_READ_GLOBAL_DEFAULT_ATTRIBUTE_VALUES", params);
for (Iterator i = attributeSchemas.iterator(); i.hasNext() && !found; ) {
AttributeSchema as = (AttributeSchema) i.next();
if (as.getName().equals(name)) {
values = as.getDefaultValues();
found = true;
}
}
if (found) {
logEvent("SUCCEED_READ_GLOBAL_DEFAULT_ATTRIBUTE_VALUES", params);
} else {
logEvent("FAILED_READ_GLOBAL_DEFAULT_ATTRIBUTE_VALUES", params);
}
return (values == null) ? Collections.EMPTY_SET : values;
}
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));
}
}
}
Aggregations