Search in sources :

Example 71 with AttributeSchema

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

Example 72 with AttributeSchema

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

Example 73 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 74 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 75 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)

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