Search in sources :

Example 6 with AttributeSchema

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

Example 7 with AttributeSchema

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;
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) SSOToken(com.iplanet.sso.SSOToken) Set(java.util.Set) SMSException(com.sun.identity.sm.SMSException) AttributeSchema(com.sun.identity.sm.AttributeSchema) SSOException(com.iplanet.sso.SSOException) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 8 with AttributeSchema

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));
    }
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) HashMap(java.util.HashMap) 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 9 with AttributeSchema

use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.

the class CLIUtil method getPasswordFields.

/**
     * Returns a set of attributes (of password syntax) of a given service.
     *
     * @param serviceName Name of service.
     * @return a set of attributes (of password syntax) of a given service.
     * @throws SMSException if error occurs when reading the service schema 
     *         layer
     * @throws SSOException if Single sign-on token is invalid.
     */
public static Set getPasswordFields(String serviceName) throws SMSException, SSOException {
    Set setPasswords = new HashSet();
    SSOToken ssoToken = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
    ServiceSchemaManager ssm = new ServiceSchemaManager(serviceName, ssoToken);
    if (ssm != null) {
        ServiceSchema schema = ssm.getOrganizationSchema();
        if (schema != null) {
            Set attributeSchemas = schema.getAttributeSchemas();
            for (Iterator i = attributeSchemas.iterator(); i.hasNext(); ) {
                AttributeSchema as = (AttributeSchema) i.next();
                if (as.getSyntax().equals(AttributeSchema.Syntax.PASSWORD)) {
                    setPasswords.add(as.getName());
                }
            }
        }
    }
    return setPasswords;
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) Set(java.util.Set) HashSet(java.util.HashSet) SSOToken(com.iplanet.sso.SSOToken) Iterator(java.util.Iterator) AttributeSchema(com.sun.identity.sm.AttributeSchema) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager) HashSet(java.util.HashSet)

Example 10 with AttributeSchema

use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.

the class CLIUtil method getPasswordFields.

/**
     * Returns a set of attributes (of password syntax) of a given service.
     *
     * @param serviceName Name of service.
     * @param schemaType Type of Schema.
     * @param subSchema Name of SubSchema
     * @return a set of attributes (of password syntax) of a given service.
     * @throws SMSException if error occurs when reading the service schema 
     *         layer
     * @throws SSOException if Single sign-on token is invalid.
     */
public static Set getPasswordFields(String serviceName, SchemaType schemaType, String subSchema) throws SMSException, SSOException {
    Set setPasswords = new HashSet();
    SSOToken ssoToken = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
    ServiceSchemaManager ssm = new ServiceSchemaManager(serviceName, ssoToken);
    if (ssm != null) {
        ServiceSchema schema = ssm.getSchema(schemaType);
        if (schema != null) {
            ServiceSchema ss = schema.getSubSchema(subSchema);
            Set attributeSchemas = ss.getAttributeSchemas();
            for (Iterator i = attributeSchemas.iterator(); i.hasNext(); ) {
                AttributeSchema as = (AttributeSchema) i.next();
                if (as.getSyntax().equals(AttributeSchema.Syntax.PASSWORD)) {
                    setPasswords.add(as.getName());
                }
            }
        }
    }
    return setPasswords;
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) Set(java.util.Set) HashSet(java.util.HashSet) SSOToken(com.iplanet.sso.SSOToken) Iterator(java.util.Iterator) AttributeSchema(com.sun.identity.sm.AttributeSchema) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager) HashSet(java.util.HashSet)

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