Examples of ProfileConfigurationManager


Examples of org.wso2.carbon.user.core.profile.ProfileConfigurationManager

            UserRealm realm = getUserRealm();

            UserStoreManager ur = realm.getUserStoreManager();

            ProfileConfigurationManager profileAdmin = realm
                    .getProfileConfigurationManager();
            if (profileAdmin != null) {
                availableProfileConfigurations = getAvailableProfileConfiguration(profileAdmin);
            }
View Full Code Here

Examples of org.wso2.carbon.user.core.profile.ProfileConfigurationManager

        String[] availableProfileConfigurations = new String[0];
        try {
            UserRealm realm = getUserRealm();
            Claim[] claims = getClaimsToEnterData(realm);

            ProfileConfigurationManager profileAdmin = realm
                    .getProfileConfigurationManager();
            if (profileAdmin != null) {
                availableProfileConfigurations = getAvailableProfileConfiguration(profileAdmin);
            }
View Full Code Here

Examples of org.wso2.carbon.user.core.profile.ProfileConfigurationManager

            }

            UserRealm realm = getUserRealm();

            UserStoreManager ur = realm.getUserStoreManager();
            ProfileConfigurationManager profileAdmin = realm
                    .getProfileConfigurationManager();

            String[] profileNames = ur.getProfileNames(username);
            boolean found = false;
View Full Code Here

Examples of org.wso2.carbon.user.core.profile.ProfileConfigurationManager

     * @throws ProfileManagementException
     */
    public DetailedProfileConfigurationDTO getAllAvailableProfileConfiguraionsForDialect(
            String dialect) throws ProfileManagementException {
        UserRealm realm = null;
        ProfileConfigurationManager profileManager = null;
        // This map contains profile configurations against their corresponding
        // configuration name.
        ProfileConfiguration[] profileConfigs = null;
        // 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)) {
View Full Code Here

Examples of org.wso2.carbon.user.core.profile.ProfileConfigurationManager

     * @return
     */
    public ClaimConfigurationDTO[] getProfileConfiguration(String dialect, String profileConfig)
            throws ProfileManagementException {
        UserRealm realm = null;
        ProfileConfigurationManager profileManager = null;
        ClaimManager claimManager = null;
        ProfileConfiguration profileConfiguration = null;
        ClaimConfigurationDTO claim = null;
        List<ClaimConfigurationDTO> claimList = null;
        List<String> hiddenClaims = null;
        List<String> overriddenClaims = null;
        List<String> inheritedClaims = null;
        Claim[] definedClaims = null;
        List<String> definedClaimsList = null;

        validateInputParameters(new String[] { dialect, profileConfig });

        try {
            realm = getRealm();
            profileManager = realm.getProfileConfigurationManager();

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

            claimManager = realm.getClaimManager();

            if (claimManager == null) {
                String message = "No claim configurations defined";
                if (log.isDebugEnabled()) {
                    log.debug(message);
                }
                throw new ProfileManagementException(message);
            }

            definedClaimsList = new ArrayList<String>();
            definedClaims = (Claim[]) claimManager.getAllClaims(dialect);

            for (int i = 0; i < definedClaims.length; i++) {
                definedClaimsList.add(definedClaims[i].getClaimUri());
            }

            profileConfiguration = (ProfileConfiguration) profileManager.getProfileConfig(profileConfig);

            // A container for all the claims applicable to the current profile
            // configuration.
            claimList = new ArrayList<ClaimConfigurationDTO>();
            hiddenClaims = profileConfiguration.getHiddenClaims();
View Full Code Here

Examples of org.wso2.carbon.user.core.profile.ProfileConfigurationManager

     * @return
     * @throws ProfileManagementException
     */
    public DialectDTO[] getDialects() throws ProfileManagementException {
        UserRealm realm = null;
        ProfileConfigurationManager profileManager = null;
        // This map contains profile configurations against their corresponding
        // configuration name.
        ProfileConfiguration[] profileConfigs = null;
        // To iterate over profileConfigurations
        Iterator<Entry<String, ProfileConfiguration>> iterator = null;
        Map<String, DialectDTO> basicConfigurations = null;
        String[] dialects = null;

        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.
            profileConfigs = (ProfileConfiguration[]) profileManager.getAllProfiles();
            basicConfigurations = new HashMap<String, DialectDTO>();

            // Okay - we have profile configurations.
            for (ProfileConfiguration profileConfig : profileConfigs) {
                // Okay - we have the first profile configuration in.
View Full Code Here

Examples of org.wso2.carbon.user.core.profile.ProfileConfigurationManager

        UserRealm realm = getRealm();
        try {
            if (UserCoreConstants.DEFAULT_PROFILE.equals(profileName)) {
                throw new ProfileManagementException("Cannot delete default profile");
            }
            ProfileConfigurationManager admin = realm.getProfileConfigurationManager();
            ProfileConfiguration profileConfig = new ProfileConfiguration(profileName, dialect,
                    new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>());
            admin.deleteProfileConfig(profileConfig);
        } catch (org.wso2.carbon.user.api.UserStoreException e) {
            throw new ProfileManagementException("Could not delete profil configuration.", e);
        }
    }
View Full Code Here

Examples of org.wso2.carbon.user.core.profile.ProfileConfigurationManager

        validateInputParameters(new String[] { profileName, dialectName });

        try {
            UserRealm realm = null;
            ProfileConfigurationManager profileManager = null;
            realm = getRealm();
            profileManager = realm.getProfileConfigurationManager();

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

            ProfileConfiguration profConfig =
                    (ProfileConfiguration) profileManager.getProfileConfig(profileName);
            if (profConfig != null) {
                String message = "Profile configuration already exist for the user store. " +
                                 "Please select a different name.";
                if (log.isDebugEnabled()) {
                    log.debug(message);
                }
                throw new ProfileManagementException(message);
            }
            List<String> hidden = new ArrayList<String>();
            List<String> overridden = new ArrayList<String>();
            List<String> inherited = new ArrayList<String>();

            for (ClaimConfigurationDTO claim : claimsConfiguration) {
                String claimURI = claim.getClaimUri();
                String behavior = claim.getBehavior();
                if (UserCoreConstants.CLAIM_HIDDEN.equals(behavior)) {
                    hidden.add(claimURI);
                } else if (UserCoreConstants.CLAIM_OVERRIDEN.equals(behavior)) {
                    overridden.add(claimURI);
                } else {
                    inherited.add(claimURI);
                }
            }

            ProfileConfiguration config = new ProfileConfiguration(profileName, hidden, overridden,
                    inherited);
            config.setDialectName(dialectName);
            profileManager.addProfileConfig(config);
        } catch (org.wso2.carbon.user.api.UserStoreException e) {
            String message = "Error while adding profile configurations for dialect " + dialectName;
            log.error(message, e);
            throw new ProfileManagementException(message, e);
        }
View Full Code Here

Examples of org.wso2.carbon.user.core.profile.ProfileConfigurationManager

        }
    }

    public DialectDTO[] getDialectsForUserStore() throws ProfileManagementException {
        UserRealm realm = null;
        ProfileConfigurationManager profileAdmin = null;
        // This map contains profile configurations against their corresponding
        // configuration name.
        ProfileConfiguration[] profileConfigs = null;
        // To iterate over profileConfigurations
        Iterator<Entry<String, ProfileConfiguration>> iterator = null;
        Map<String, DialectDTO> basicConfigurations = null;
        String[] dialects = null;

        try {

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

            if (profileAdmin == 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.
            profileConfigs = (ProfileConfiguration[]) profileAdmin.getAllProfiles();
            basicConfigurations = new HashMap<String, DialectDTO>();

            // Okay - we have profile configurations.
            for (ProfileConfiguration profileConfig : profileConfigs) {
                // Okay - we have the first profile configuration in.
View Full Code Here

Examples of org.wso2.carbon.user.core.profile.ProfileConfigurationManager

     * @throws ProfileManagementException
     */
    public void updateClaimMappingBehavior(String profileName,
            ClaimConfigurationDTO[] claimsConfiguration) throws ProfileManagementException {
        UserRealm realm = null;
        ProfileConfigurationManager profileManager = null;

        validateInputParameters(new String[] { profileName });

        try {
            realm = getRealm();
            profileManager = realm.getProfileConfigurationManager();

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

            ProfileConfiguration config =
                    (ProfileConfiguration) profileManager.getProfileConfig(profileName);
            List<String> hidden = new ArrayList<String>();
            List<String> overridden = new ArrayList<String>();
            List<String> inherited = new ArrayList<String>();

            for (ClaimConfigurationDTO claim : claimsConfiguration) {
                String claimURI = claim.getClaimUri();
                String behavior = claim.getBehavior();
                if (UserCoreConstants.CLAIM_HIDDEN.equals(behavior)) {
                    hidden.add(claimURI);
                } else if (UserCoreConstants.CLAIM_OVERRIDEN.equals(behavior)) {
                    overridden.add(claimURI);
                } else {// inherited
                    inherited.add(claimURI);
                }
            }
            config.setHiddenClaims(hidden);
            config.setInheritedClaims(inherited);
            config.setOverriddenClaims(overridden);
            profileManager.updateProfileConfig(config);
        } catch (org.wso2.carbon.user.api.UserStoreException e) {
            String message = "Error occurred while upating profile configurations" + profileName;
            log.error(message, e);
            throw new ProfileManagementException(message, e);
        }
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.