Examples of DetailedProfileConfigurationDTO


Examples of org.wso2.carbon.profiles.mgt.dto.DetailedProfileConfigurationDTO

        // To iterate over profileConfigurations
        Iterator<Entry<String, ProfileConfiguration>> iterator = null;
        // This is the profile configuration corresponding to the given dialect
        // to act on the given
        // user store.
        DetailedProfileConfigurationDTO detailedConfiguration = null;
        List<ProfileConfigurationDTO> configurations = null;

        validateInputParameters(new String[] { dialect });

        try {

            // Get available profile configurations for internal user store.
            realm = getRealm();
            profileManager = realm.getProfileConfigurationManager();

            if (profileManager == null) {
                String message = "No profile configurations defined ";
                if (log.isDebugEnabled()) {
                    log.debug(message);
                }
                return null;
            }

            // Get all profile configurations defined for the given user store.
            // profileConfigurations = profileManager.getProfileConfigs();
            detailedConfiguration = new DetailedProfileConfigurationDTO();
            profileConfigs = (ProfileConfiguration[]) profileManager.getAllProfiles();
            // We are interested on the given dialect only.
            detailedConfiguration.setDialect(dialect);
            configurations = new ArrayList<ProfileConfigurationDTO>();
            for (ProfileConfiguration profileConfig : profileConfigs) {
                if (profileConfig.getDialectName().equals(dialect)) {
                    // This is a profile configuration defined for the given
                    // dialect.
                    ProfileConfigurationDTO profile = null;
                    ClaimConfigurationDTO claim = null;
                    List<ClaimConfigurationDTO> claimList = null;
                    List<String> hiddenClaims = null;
                    List<String> overriddenClaims = null;
                    List<String> inheritedClaims = null;
                    // A container for all the claims applicable to the current
                    // profile
                    // configuration.
                    claimList = new ArrayList<ClaimConfigurationDTO>();
                    hiddenClaims = profileConfig.getHiddenClaims();

                    if (hiddenClaims != null) {
                        for (Iterator<String> iter = hiddenClaims.iterator(); iter.hasNext();) {
                            String string = iter.next();
                            claim = new ClaimConfigurationDTO();
                            claim.setClaimUri(string);
                            claim.setBehavior(UserCoreConstants.CLAIM_HIDDEN);
                            claimList.add(claim);
                        }
                    }

                    overriddenClaims = profileConfig.getOverriddenClaims();

                    if (overriddenClaims != null) {
                        for (Iterator<String> iter = overriddenClaims.iterator(); iter.hasNext();) {
                            String string = iter.next();
                            claim = new ClaimConfigurationDTO();
                            claim.setClaimUri(string);
                            claim.setBehavior(UserCoreConstants.CLAIM_OVERRIDEN);
                            claimList.add(claim);
                        }
                    }

                    inheritedClaims = profileConfig.getInheritedClaims();

                    if (inheritedClaims != null) {
                        for (Iterator<String> iter = inheritedClaims.iterator(); iter.hasNext();) {
                            String string = iter.next();
                            claim = new ClaimConfigurationDTO();
                            claim.setClaimUri(string);
                            claim.setBehavior(UserCoreConstants.CLAIM_INHERITED);
                            claimList.add(claim);
                        }
                    }

                    // A given profile configuration has a claim set and a name.
                    profile = new ProfileConfigurationDTO();
                    profile.setConfigurationName(profileConfig.getProfileName());
                    profile.setClaimConfiguration(claimList
                            .toArray(new ClaimConfigurationDTO[claimList.size()]));
                    // Here comes one more profile configuration defined under
                    // the given
                    // dialect.
                    configurations.add(profile);
                }

                // By now we should have all the profile configurations defined
                // under the given
                // dialect.
            }

            detailedConfiguration.setProfileConfiguartions(configurations
                    .toArray(new ProfileConfigurationDTO[configurations.size()]));
            return detailedConfiguration;
        } catch (Exception e) {
            String message = "Error while loading available profile configurations for dialect "
                    + dialect;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.