Search in sources :

Example 16 with SchemaType

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

the class SCUtils method getServiceDisplayURL.

/**
     * The display URL for a service is the class  that controls the 
     * presentation of the service information.  To get the URL 
     * requires a <code>ServiceSchema</code> object. It can be
     * any of the <code>ServiceSchema</code> defined for the 
     * service. 
     */
public String getServiceDisplayURL() {
    String displayURL = null;
    try {
        Set schemaTypes = manager.getSchemaTypes();
        //we need to use any schema, so get the first one
        if (schemaTypes != null && !schemaTypes.isEmpty()) {
            Iterator iter = schemaTypes.iterator();
            SchemaType type = (SchemaType) iter.next();
            ServiceSchema schema = manager.getSchema(type);
            if (schema != null) {
                displayURL = schema.getPropertiesViewBeanURL();
            }
        }
    } catch (SMSException smse) {
        AMModelBase.debug.error("SCUtils.getServiceDisplayURL", smse);
    }
    return displayURL;
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) Set(java.util.Set) SMSException(com.sun.identity.sm.SMSException) Iterator(java.util.Iterator) SchemaType(com.sun.identity.sm.SchemaType)

Example 17 with SchemaType

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

the class FormatUtils method printServiceNames.

public static String printServiceNames(Set serviceNames, String template, SSOToken ssoToken) throws SMSException, SSOException {
    StringBuilder buff = new StringBuilder();
    String[] arg = new String[1];
    if (serviceNames != null) {
        for (Iterator i = serviceNames.iterator(); i.hasNext(); ) {
            String serviceName = (String) i.next();
            ServiceSchemaManager mgr = new ServiceSchemaManager(serviceName, ssoToken);
            Set types = mgr.getSchemaTypes();
            if (!types.isEmpty()) {
                SchemaType type = (SchemaType) types.iterator().next();
                ServiceSchema schema = mgr.getSchema(type);
                if (schema != null) {
                    String i18nKey = schema.getI18NKey();
                    if ((i18nKey != null) && (i18nKey.length() > 0)) {
                        arg[0] = serviceName;
                        buff.append(MessageFormat.format(template, (Object[]) arg)).append("\n");
                    }
                }
            }
        }
    }
    return buff.toString();
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) Set(java.util.Set) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) Iterator(java.util.Iterator) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager) SchemaType(com.sun.identity.sm.SchemaType)

Aggregations

SchemaType (com.sun.identity.sm.SchemaType)17 Set (java.util.Set)12 ServiceSchema (com.sun.identity.sm.ServiceSchema)9 ServiceSchemaManager (com.sun.identity.sm.ServiceSchemaManager)9 HashSet (java.util.HashSet)9 SMSException (com.sun.identity.sm.SMSException)8 Iterator (java.util.Iterator)8 SSOException (com.iplanet.sso.SSOException)4 HashMap (java.util.HashMap)4 Map (java.util.Map)4 AttributeSchema (com.sun.identity.sm.AttributeSchema)3 AMHashMap (com.iplanet.am.sdk.AMHashMap)2 SSOToken (com.iplanet.sso.SSOToken)2 CaseInsensitiveHashMap (com.sun.identity.common.CaseInsensitiveHashMap)2 CaseInsensitiveHashSet (com.sun.identity.common.CaseInsensitiveHashSet)2 IdType (com.sun.identity.idm.IdType)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 ResourceBundle (java.util.ResourceBundle)2 StringTokenizer (java.util.StringTokenizer)2