Examples of ProfileConfiguration


Examples of org.wso2.carbon.um.ws.api.stub.ProfileConfiguration

    public static ProfileConfiguration convertToADBProfileConfiguration(
            org.wso2.carbon.user.core.profile.ProfileConfiguration profileConfig) {
        if (profileConfig == null) {
            return null;
        }
        ProfileConfiguration profz = new ProfileConfiguration();
        profz.setDialectName(profileConfig.getDialectName());
        List<String> lst = profileConfig.getHiddenClaims();
        profz.setHiddenClaims(lst.toArray(new String[lst.size()]));
        lst = profileConfig.getInheritedClaims();
        profz.setInheritedClaims(lst.toArray(new String[lst.size()]));
        lst = profileConfig.getOverriddenClaims();
        profz.setOverriddenClaims(lst.toArray(new String[lst.size()]));
        profz.setProfileName(profileConfig.getProfileName());
        return profz;
    }
View Full Code Here

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

            String profileConfigName = null;
            Iterator<OMElement> profileIter = null;
            List<String> hidden = null;
            List<String> overridden = null;
            List<String> inherited = null;
            ProfileConfiguration profileConfiguration = null;

            profileConfigName = profileElem.getAttribute(
                    new QName(ATTR_PROFILE_CONFIG_NAME)).getAttributeValue();
            dialectName = profileElem.getAttribute(new QName(ATTR_DIALECT_URI))
                    .getAttributeValue();
            profileIter = profileElem.getChildrenWithLocalName(LOCAL_NAME_CLAIM);

            hidden = new ArrayList<String>();
            overridden = new ArrayList<String>();
            inherited = new ArrayList<String>();

            while (profileIter.hasNext()) {
                OMElement claimElem = null;
                String claimURI = null;
                String behavior = null;

                claimElem = profileIter.next();
                claimURI = claimElem.getFirstChildWithName(
                        new QName(LOCAL_NAME_CLAIM_URI)).getText();
                behavior = claimElem.getFirstChildWithName(
                        new QName(LOCAL_NAME_CLAIM_BEHAVIOR)).getText();
                if (behavior.equals(UserCoreConstants.CLAIM_HIDDEN)) {
                    hidden.add(claimURI);
                } else if (behavior.equals(UserCoreConstants.CLAIM_OVERRIDEN)) {
                    overridden.add(claimURI);
                } else {
                    inherited.add(claimURI);
                }
            }
            profileConfiguration = new ProfileConfiguration(profileConfigName, hidden, overridden,
                    inherited);
            profileConfiguration.setDialectName(dialectName);
            profileConfigs.put(profileConfigName, profileConfiguration);

        }
       
        try {
View Full Code Here

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

            while (rs.next()) {
                String claimUri = rs.getString(1);
                String profileName = rs.getString(2);
                short behavior = rs.getShort(3);
                String dialectUri = rs.getString(4);
                ProfileConfiguration profConfig = map.get(profileName);
                if (profConfig == null) {
                    profConfig = new ProfileConfiguration();
                    map.put(profileName, profConfig);
                }
                profConfig.setDialectName(dialectUri);
                profConfig.setProfileName(profileName);
                if (behavior == UserCoreConstants.BEHAVIOUR_HIDDEN) {
                    profConfig.addHiddenClaim(claimUri);
                } else if (behavior == UserCoreConstants.BEHAVIOUR_INHERITED) {
                    profConfig.addInheritedClaim(claimUri);
                } else if (behavior == UserCoreConstants.BEHAVIOUR_OVERRIDDEN) {
                    profConfig.addOverriddenClaim(claimUri);
                } else {
                    assert (false);
                }
            }
        } catch (SQLException e) {
View Full Code Here

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

            property = claimManager.getAttributeName(claim);
        } catch (org.wso2.carbon.user.api.UserStoreException e) {
            throw new UserStoreException(e);
        }

        ProfileConfiguration profileConfig;
        try {
            profileConfig =
                    (ProfileConfiguration) profileManager.getProfileConfig(profileConfiguration);
        } catch (org.wso2.carbon.user.api.UserStoreException e) {
            throw new UserStoreException(e);
        }
        if (profileConfig != null) {
            List<String> hidden = getMappingAttributeList(profileConfig.getHiddenClaims());
            if (hidden.contains(property)) {
                return null;
            }
        }

        String value = this.getUserPropertyValues(userName, new String[] { property }, profileName)
                .get(property);
        if ((value == null || value.trim().length() == 0)
                && !UserCoreConstants.DEFAULT_PROFILE.equals(profileName) && profileConfig != null) {
            List<String> overridden = getMappingAttributeList(profileConfig.getOverriddenClaims());
            if (!overridden.contains(property)) {
                value = this.getUserPropertyValues(userName, new String[] { property },
                        UserCoreConstants.DEFAULT_PROFILE).get(property);
            }
        }
View Full Code Here

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

        profileConfigurationName = uerProperties.get(UserCoreConstants.PROFILE_CONFIGURATION);
        if (profileConfigurationName == null) {
            profileConfigurationName = UserCoreConstants.DEFAULT_PROFILE_CONFIGURATION;
        }

        ProfileConfiguration profileConfig;
        try {
            profileConfig = (ProfileConfiguration) profileManager.getProfileConfig(profileConfigurationName);
        } catch (org.wso2.carbon.user.api.UserStoreException e) {
            throw new UserStoreException(e);
        }

        List<String> hidden = null;
        if (profileConfig != null) {
            hidden = getMappingAttributeList(profileConfig.getHiddenClaims());
        }

        List<String> overridden = null;
        if (profileConfig != null) {
            overridden = getMappingAttributeList(profileConfig.getOverriddenClaims());
        }

        List<String> getAgain = new ArrayList<String>();
        Map<String, String> finalValues = new HashMap<String, String>();
View Full Code Here

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

    }

    public static Map<String, ProfileConfiguration> getProfileTestData() {
        Map<String, ProfileConfiguration> map = new HashMap<String, ProfileConfiguration>();
        ProfileConfiguration profConfig = new ProfileConfiguration();
        profConfig.setProfileName(HOME_PROFILE_NAME);
        profConfig.addHiddenClaim(CLAIM_URI1);
        profConfig.addInheritedClaim(CLAIM_URI2);
        profConfig.setDialectName("http://wso2.org/claims");
        map.put(HOME_PROFILE_NAME, profConfig);
        return map;
    }
View Full Code Here

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

    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();

            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);
                    if (definedClaimsList.contains(string)) {
                        // If this claim being removed, then we are not going
                        // add this.
                        claimList.add(claim);
                        definedClaimsList.remove(string);
                    }
                }
            }

            overriddenClaims = profileConfiguration.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);
                    if (definedClaimsList.contains(string)) {
                        // If this claim being removed, then we are not going
                        // add this.
                        claimList.add(claim);
                        definedClaimsList.remove(string);
                    }
                }
            }

            inheritedClaims = profileConfiguration.getInheritedClaims();

            if (inheritedClaims != null) {
                for (Iterator<String> iter = inheritedClaims.iterator(); iter.hasNext();) {
                    String string = iter.next();
                    claim = new ClaimConfigurationDTO();
View Full Code Here

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

        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.ProfileConfiguration

                    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.ProfileConfiguration

                    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.