Search in sources :

Example 1 with ServiceTypeManager

use of com.sun.identity.policy.ServiceTypeManager in project OpenAM by OpenRock.

the class PolicyModelImpl method getSvcTypeNameToActionsMap.

private Map getSvcTypeNameToActionsMap(Policy policy, String realmName) {
    if (mapSvcTypeNameToActions == null) {
        try {
            Set serviceTypeNames = getServiceTypeNames().keySet();
            int sz = serviceTypeNames.size();
            mapSvcTypeNameToActions = new HashMap(sz * 2);
            mapSvcTypeNameToResBundle = new HashMap(sz * 2);
            ServiceTypeManager mgr = getServiceTypeManager();
            for (Iterator i = serviceTypeNames.iterator(); i.hasNext(); ) {
                String serviceTypeName = (String) i.next();
                ServiceType serviceType = mgr.getServiceType(serviceTypeName);
                if (serviceType != null) {
                    ResourceBundle rb = getResourceBundle(serviceType, getUserLocale());
                    if (rb != null) {
                        mapSvcTypeNameToResBundle.put(serviceTypeName, rb);
                        Set as = getActionSchemas(serviceType);
                        filterActionSchemaWithI18nKey(as);
                        if ((as != null) && !as.isEmpty()) {
                            mapSvcTypeNameToActions.put(serviceTypeName, as);
                            if (requiresResourceName(policy, realmName, serviceTypeName, as, true)) {
                                requiredResourceNameService.add(serviceTypeName);
                            }
                            if (requiresResourceName(policy, realmName, serviceTypeName, as, false)) {
                                notRequiredResourceNameService.add(serviceTypeName);
                            }
                        }
                    }
                }
            }
        } catch (AMConsoleException e) {
            debug.warning("PolicyModelImppl.getSvcTypeNameToActionsMap", e);
        } catch (SSOException e) {
            debug.warning("PolicyModelImppl.getSvcTypeNameToActionsMap", e);
        } catch (NameNotFoundException e) {
            debug.warning("PolicyModelImppl.getSvcTypeNameToActionsMap", e);
        }
    }
    return mapSvcTypeNameToActions;
}
Also used : ServiceTypeManager(com.sun.identity.policy.ServiceTypeManager) Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) ServiceType(com.sun.identity.policy.ServiceType) Iterator(java.util.Iterator) ResourceBundle(java.util.ResourceBundle) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Aggregations

SSOException (com.iplanet.sso.SSOException)1 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)1 NameNotFoundException (com.sun.identity.policy.NameNotFoundException)1 ServiceType (com.sun.identity.policy.ServiceType)1 ServiceTypeManager (com.sun.identity.policy.ServiceTypeManager)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 ResourceBundle (java.util.ResourceBundle)1 Set (java.util.Set)1