Search in sources :

Example 81 with AttributeSchema

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)));
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) IOutput(com.sun.identity.cli.IOutput) AttributeSchema(com.sun.identity.sm.AttributeSchema)

Example 82 with AttributeSchema

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);
    }
}
Also used : SMSException(com.sun.identity.sm.SMSException) Iterator(java.util.Iterator) AttributeSchema(com.sun.identity.sm.AttributeSchema) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map)

Example 83 with AttributeSchema

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);
    }
}
Also used : SMSException(com.sun.identity.sm.SMSException) AttributeSchema(com.sun.identity.sm.AttributeSchema) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 84 with AttributeSchema

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;
}
Also used : HashMap(java.util.HashMap) Iterator(java.util.Iterator) AttributeSchema(com.sun.identity.sm.AttributeSchema) HashMap(java.util.HashMap) Map(java.util.Map)

Example 85 with AttributeSchema

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;
}
Also used : HashMap(java.util.HashMap) Iterator(java.util.Iterator) AttributeSchema(com.sun.identity.sm.AttributeSchema) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

AttributeSchema (com.sun.identity.sm.AttributeSchema)149 Iterator (java.util.Iterator)80 ServiceSchema (com.sun.identity.sm.ServiceSchema)76 Set (java.util.Set)75 SMSException (com.sun.identity.sm.SMSException)67 HashSet (java.util.HashSet)59 SSOException (com.iplanet.sso.SSOException)58 ServiceSchemaManager (com.sun.identity.sm.ServiceSchemaManager)46 HashMap (java.util.HashMap)36 Map (java.util.Map)34 CLIException (com.sun.identity.cli.CLIException)28 CLIRequest (com.sun.identity.cli.CLIRequest)18 AfterTest (org.testng.annotations.AfterTest)18 BeforeTest (org.testng.annotations.BeforeTest)18 Parameters (org.testng.annotations.Parameters)18 Test (org.testng.annotations.Test)18 IOutput (com.sun.identity.cli.IOutput)14 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)10 CaseInsensitiveHashMap (com.sun.identity.common.CaseInsensitiveHashMap)9 SSOToken (com.iplanet.sso.SSOToken)8