use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class AgentConfiguration method getDefaultValues.
/**
* Returns the default values of attribute schemas
* of a given agent type.
*
* @param agentType Type of agent.
* @param bGroup <code>true</code> if this is for a group.
* @throws SSOException if the Single Sign On token is invalid or has
* expired.
* @throws SMSException if there are errors in service management layers.
*/
public static Map getDefaultValues(String agentType, boolean bGroup) throws SMSException, SSOException {
Map mapDefault = new HashMap();
Set attributeSchemas = getAgentAttributeSchemas(agentType);
if ((attributeSchemas != null) && !attributeSchemas.isEmpty()) {
for (Iterator i = attributeSchemas.iterator(); i.hasNext(); ) {
AttributeSchema as = (AttributeSchema) i.next();
mapDefault.put(as.getName(), as.getDefaultValues());
}
}
if (bGroup) {
mapDefault.remove(ATTR_NAME_PWD);
}
return mapDefault;
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class AgentConfiguration method getAttributeSchemas.
/**
* Returns attribute schema for a given set of attribute names.
*
* @param agentType Agent type.
* @param names Set of attribute names.
* @return localized names for a given set of attribute names.
*/
public static Map getAttributeSchemas(String agentType, Collection names) throws SMSException, SSOException {
Map map = new HashMap();
Set attributeSchema = getAgentAttributeSchemas(agentType);
for (Iterator i = attributeSchema.iterator(); i.hasNext(); ) {
AttributeSchema as = (AttributeSchema) i.next();
if (names.contains(as.getName())) {
map.put(as.getName(), as);
}
}
return map;
}
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;
}
Aggregations