use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class GetAttributeSchemaChoiceValues method handleRequest.
@Override
public void handleRequest(RequestContext rc) throws CLIException {
super.handleRequest(rc);
ldapLogin();
String schemaType = getStringOptionValue(IArgument.SCHEMA_TYPE);
String serviceName = getStringOptionValue(IArgument.SERVICE_NAME);
String subSchemaName = getStringOptionValue(IArgument.SUBSCHEMA_NAME);
String attributeName = getStringOptionValue(IArgument.ATTRIBUTE_NAME);
ServiceSchema ss = getServiceSchema();
IOutput outputWriter = getOutputWriter();
String[] params = { serviceName, schemaType, subSchemaName, attributeName };
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_GET_ATTRIBUTE_SCHEMA_CHOICE_VALUES", params);
AttributeSchema attrSchema = ss.getAttributeSchema(attributeName);
if (attrSchema == null) {
String[] args = { serviceName, schemaType, subSchemaName, attributeName, "attribute schema does not exist" };
attributeSchemaNoExist(attributeName, "FAILED_GET_ATTRIBUTE_SCHEMA_CHOICE_VALUES", args);
}
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEED_GET_ATTRIBUTE_SCHEMA_CHOICE_VALUES", params);
getOutputWriter().printlnMessage(FormatUtils.formatMap(getResourceString("attribute-schema-i18nkey"), getResourceString("attribute-schema-choice-value"), getChoiceValues(attrSchema)));
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class FSSAMLServiceModelImpl method setAttributeValues.
/**
* Set SAMLv1.x attribute values.
*
* @param values Attribute values. Map of attribute name to set of values.
* @throws AMConsoleException if values cannot be set.
*/
public void setAttributeValues(Map values) throws AMConsoleException {
String[] params = new String[3];
params[0] = SAML_SERVICE_NAME;
params[1] = "-";
String curAttrSchemaName = "";
try {
for (Iterator iter = values.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry) iter.next();
String name = (String) entry.getKey();
curAttrSchemaName = name;
params[2] = name;
logEvent("ATTEMPT_SET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", params);
AttributeSchema as = (AttributeSchema) attributeSchemas.get(name);
as.setDefaultValues((Set) entry.getValue());
logEvent("SUCCEED_SET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", params);
}
} catch (SSOException e) {
String strError = getErrorString(e);
String[] paramsEx = { SAML_SERVICE_NAME, "-", curAttrSchemaName, strError };
logEvent("SSO_EXCEPTION_SET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", paramsEx);
throw new AMConsoleException(strError);
} catch (SMSException e) {
String strError = getErrorString(e);
String[] paramsEx = { SAML_SERVICE_NAME, "-", curAttrSchemaName, strError };
logEvent("SMS_EXCEPTION_SET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", paramsEx);
throw new AMConsoleException(strError);
}
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class FSSAMLServiceModelImpl method modifyTrustPartners.
/*
* modify trusted partners.
*
* @param values a Set of trusted partners .
* @throws AMConsoleException if name cannot be set.
*/
public void modifyTrustPartners(Set values) throws AMConsoleException {
String curAttrSchemaName = SAML_TRUSTED_PARTNERS;
String[] params = new String[5];
params[0] = SAML_SERVICE_NAME;
params[1] = "-";
params[2] = curAttrSchemaName;
params[3] = "-";
params[4] = values.toString();
try {
AttributeSchema as = (AttributeSchema) attributeSchemas.get(curAttrSchemaName);
as.setDefaultValues(values);
logEvent("SUCCEED_SET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", params);
} catch (SSOException e) {
String strError = getErrorString(e);
String[] paramsEx = { SAML_SERVICE_NAME, "-", curAttrSchemaName, strError };
logEvent("SSO_EXCEPTION_SET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", paramsEx);
throw new AMConsoleException(strError);
} catch (SMSException e) {
String strError = getErrorString(e);
String[] paramsEx = { SAML_SERVICE_NAME, "-", curAttrSchemaName, strError };
logEvent("SMS_EXCEPTION_SET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", paramsEx);
throw new AMConsoleException(strError);
}
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class FSSAMLServiceModelImpl method getAttributeLabels.
/**
* Returns localized labels for all attributes.
*
* @return localized labels for all attributes.
*/
public Map getAttributeLabels() {
Map labels = new HashMap(attributeSchemas.size() * 2);
for (Iterator i = attributeSchemas.keySet().iterator(); i.hasNext(); ) {
String name = (String) i.next();
AttributeSchema as = (AttributeSchema) attributeSchemas.get(name);
String i18nKey = as.getI18NKey();
if (resBundle != null) {
labels.put(name, Locale.getString(resBundle, i18nKey, debug));
} else {
labels.put(name, i18nKey);
}
}
return labels;
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class FSSAMLServiceModelImpl method getAttributeInlineHelps.
/**
* Returns localized inline help for all attributes.
*
* @return localized inline help for all attributes.
*/
public Map getAttributeInlineHelps() {
Map helps = new HashMap(attributeSchemas.size() * 2);
for (Iterator iter = attributeSchemas.keySet().iterator(); iter.hasNext(); ) {
String name = (String) iter.next();
AttributeSchema as = (AttributeSchema) attributeSchemas.get(name);
String i18nKey = as.getI18NKey() + ".help";
if (resBundle != null) {
String help = Locale.getString(resBundle, i18nKey, debug);
if ((help != null) && !help.equals(i18nKey)) {
helps.put(name, help);
}
}
}
return helps;
}
Aggregations