Package org.wso2.carbon.user.core.claim

Examples of org.wso2.carbon.user.core.claim.Claim


            prepStmt.setInt(1, tenantId);
            prepStmt.setInt(2, tenantId);
            rs = prepStmt.executeQuery();
            while (rs.next()) {
                ClaimMapping cm = new ClaimMapping();
                Claim claim = new Claim();
                String value = rs.getString(1);
                claim.setDialectURI(value);
                value = rs.getString(2);
                claim.setClaimUri(value);
                value = rs.getString(3);
                claim.setDisplayTag(value);
                value = rs.getString(4);
                claim.setDescription(value);
                value = rs.getString(5);
                cm.setMappedAttribute(value);
                value = rs.getString(6);
                claim.setRegEx(value);
                short is = rs.getShort(7);
                if (is == 1) {
                    claim.setSupportedByDefault(true);
                }
                is = rs.getShort(8);
                if (is == 1) {
                    claim.setRequired(true);
                }
                claim.setDisplayOrder(rs.getInt(9));
                cm.setClaim(claim);
                lst.add(cm);
            }
        } catch (SQLException e) {
            log.error("Database Error - " + e.getMessage(), e);
View Full Code Here


    protected void updateClaimMapping(Connection dbConnection, ClaimMapping cm)
            throws UserStoreException {
        PreparedStatement prepStmt = null;
        try {
            Claim claim = cm.getClaim();
            short isSupported = 0;
            if (claim.isSupportedByDefault()) {
                isSupported = 1;
            }

            short isRequired = 0;
            if (claim.isRequired()) {
                isRequired = 1;
            }

            prepStmt = dbConnection.prepareStatement(ClaimDBConstants.UPDATE_CLAIM_SQL);
            prepStmt.setString(1, claim.getDisplayTag());
            prepStmt.setString(2, claim.getDescription());
            prepStmt.setString(3, cm.getMappedAttribute());
            prepStmt.setString(4, claim.getRegEx());
            prepStmt.setShort(5, isSupported);
            prepStmt.setShort(6, isRequired);
            prepStmt.setInt(7, claim.getDisplayOrder());
            prepStmt.setString(8, claim.getClaimUri());
            prepStmt.setString(9, claim.getDialectURI());
            prepStmt.setInt(10, tenantId);
            prepStmt.setInt(11, tenantId);

            prepStmt.executeUpdate();
        } catch (SQLException e) {
View Full Code Here

            dialectUri = dialect.getAttribute(new QName(ATTR_DIALECT_URI)).getAttributeValue();
            claimIterator = dialect.getChildrenWithLocalName(LOCAL_NAME_CLAIM);

            while (claimIterator.hasNext()) {
                OMElement claimElement = null;
                Claim claim = null;
                ClaimMapping claimMapping = null;
                String displayName = null;
                String claimUri = null;
                String attributeId = null;
                String description = null;
                String regEx = null;
                int displayOrder = 0;

                claimElement = claimIterator.next();
                validateSchema(claimElement);

                claim = new Claim();
                claim.setDialectURI(dialectUri);

                claimUri = claimElement.getFirstChildWithName(new QName(LOCAL_NAME_CLAIM_URI))
                        .getText();
                claim.setClaimUri(claimUri);

                if (claimElement.getFirstChildWithName(new QName(LOCAL_NAME_DISPLAY_NAME)) != null) {
                    displayName = claimElement.getFirstChildWithName(
                            new QName(LOCAL_NAME_DISPLAY_NAME)).getText();
                    claim.setDisplayTag(displayName);
                }

                description = claimElement.getFirstChildWithName(new QName(LOCAL_NAME_DESCRIPTION))
                        .getText();
                claim.setDescription(description);

                if (claimElement.getFirstChildWithName(new QName(LOCAL_NAME_REG_EX)) != null) {
                    regEx = claimElement.getFirstChildWithName(new QName(LOCAL_NAME_REG_EX))
                            .getText();
                    claim.setRegEx(regEx);
                }

                if (claimElement.getFirstChildWithName(new QName(LOCAL_NAME_REQUIRED)) != null) {
                    claim.setRequired(true);
                }

                if (claimElement.getFirstChildWithName(new QName(LOCAL_NAME_SUPPORTED_BY_DEFAULT)) != null) {
                    claim.setSupportedByDefault(true);
                }

                if (claimElement.getFirstChildWithName(new QName(LOCAL_NAME_DISPLAY_OREDR)) != null) {
                    displayOrder = Integer.parseInt(claimElement.getFirstChildWithName(
                            new QName(LOCAL_NAME_DISPLAY_OREDR)).getText());
                    claim.setDisplayOrder(displayOrder);
                }

                attributeId = claimElement.getFirstChildWithName(new QName(LOCAL_NAME_ATTR_ID))
                        .getText();
View Full Code Here

     * @throws Exception
     */
    public void removeClaimMapping(String dialectUri, String claimUri)
            throws Exception {
        ClaimMapping mapping = null;
        Claim claim = null;
        ClaimManager claimManager = null;
        try {
            UserRealm realm = getRealm();
            claimManager = realm.getClaimManager();
            if (claimManager != null) {
                // There can be cases - we get a request for an external user store - where we don'
                // have a claims administrator.
                claim = new Claim();
                claim.setClaimUri(claimUri);
                claim.setDialectURI(dialectUri);
                mapping = new ClaimMapping(claim, null);
                claimManager.deleteClaimMapping(mapping);
            }
        } catch (UserStoreException e) {
            log.error("Error occurred while removing new claim mapping", e);
View Full Code Here

         public static final String CLAIM_URI5 = "http://wso2.org/claims/telephone";
    public static final String HOME_PROFILE_NAME = "HomeProfile";

    public static Map<String, ClaimMapping> getClaimTestData() {
        Map<String, ClaimMapping> claims = new HashMap<String, ClaimMapping>();
        Claim claim1 = new Claim();
        claim1.setClaimUri(CLAIM_URI1);
        claim1.setDescription("About Me");
        claim1.setDialectURI("http://wso2.org/claims");
        claim1.setDisplayTag("About Me");
        //claim1.setRegEx("ty&*RegEx");
        claim1.setRequired(true);
        claim1.setSupportedByDefault(true);
        ClaimMapping cm1 = new ClaimMapping();
        cm1.setClaim(claim1);
        cm1.setMappedAttribute("attr1");
        claims.put("http://wso2.org/claims/aboutme", cm1);

        Claim claim2 = new Claim();
        claim2.setClaimUri(CLAIM_URI2);
        claim2.setDescription("Given Name");
        claim2.setDialectURI("http://wso2.org/claims");
        claim2.setDisplayTag("Given Name");
        claim2.setRegEx("ty&*RegEx2");
        claim2.setRequired(true);
        claim2.setSupportedByDefault(true);
        ClaimMapping cm2 = new ClaimMapping();
        cm2.setClaim(claim2);
        cm2.setMappedAttribute("attr2");
        claims.put("http://wso2.org/claims/givenname", cm2);

        Claim claim4 = new Claim();
        claim4.setClaimUri(CLAIM_URI4);
        claim4.setDescription("Email");
        claim4.setDialectURI("http://wso2.org/claims");
        claim4.setDisplayTag("Email");
        //claim4.setRegEx("ty&*RegEx2");
        claim4.setRequired(true);
        claim4.setSupportedByDefault(true);
        ClaimMapping cm4 = new ClaimMapping();
        cm4.setClaim(claim4);
        cm4.setMappedAttribute("attr4");
        claims.put("http://wso2.org/claims/emailaddress", cm4);

        Claim claim5 = new Claim();
        claim5.setClaimUri(CLAIM_URI5);
        claim5.setDescription("Phone Number");
        claim5.setDialectURI("http://wso2.org/claims");
        claim5.setDisplayTag("Phone Number");
        //claim5.setRegEx("ty&*RegEx2");
        claim5.setRequired(true);
        claim5.setSupportedByDefault(true);
        ClaimMapping cm5 = new ClaimMapping();
        cm5.setClaim(claim5);
        cm5.setMappedAttribute("attr5");
        claims.put("http://wso2.org/claims/telephone", cm5);

        Claim claim3 = new Claim();
        claim3.setClaimUri(CLAIM_URI3);
        claim3.setDescription("The description is nutts3");
        claim3.setDialectURI("http://wso2.org/");
        claim3.setDisplayTag("Given Name3");
        claim3.setRegEx("ty&*RegEx3");
        claim3.setRequired(true);
        claim3.setSupportedByDefault(true);
        ClaimMapping cm3 = new ClaimMapping();
        cm3.setClaim(claim3);
        cm3.setMappedAttribute("attr3");
        claims.put("http://wso2.org/givenname3", cm3);

View Full Code Here

        claimDTO.setValue(claim.getValue());
        return claimDTO;
    }

    private Claim convertClaimDTOToClaim(ClaimDTO claimDTO){
        Claim claim=new Claim();
        claim.setSupportedByDefault(claimDTO.isSupportedByDefault());
        claim.setValue(claimDTO.getValue());
        claim.setClaimUri(claimDTO.getClaimUri());
        claim.setDescription(claimDTO.getDescription());
        claim.setDialectURI(claimDTO.getDialectURI());
        claim.setDisplayOrder(claimDTO.getDisplayOrder());
        claim.setDisplayTag(claimDTO.getDisplayTag());
        claim.setRegEx(claimDTO.getRegEx());
        claim.setRequired(claimDTO.isRequired());
               
        return claim;
    }
View Full Code Here

    public static final String CLAIM_URI3 = "http://wso2.org/givenname3";
    public static final String HOME_PROFILE_NAME = "HomeProfile";

    public static Map<String, ClaimMapping> getClaimTestData() {
        Map<String, ClaimMapping> claims = new HashMap<String, ClaimMapping>();
        Claim claim1 = new Claim();
        claim1.setClaimUri(CLAIM_URI1);
        claim1.setDescription("The description is nutts");
        claim1.setDialectURI("http://wso2.org/");
        claim1.setDisplayTag("Given Name");
        claim1.setRegEx("ty&*RegEx");
        claim1.setRequired(true);
        claim1.setSupportedByDefault(true);
        ClaimMapping cm1 = new ClaimMapping();
        cm1.setClaim(claim1);
        cm1.setMappedAttribute("attr1");
        claims.put("http://wso2.org/givenname", cm1);

        Claim claim2 = new Claim();
        claim2.setClaimUri(CLAIM_URI2);
        claim2.setDescription("The description is nutts2");
        claim2.setDialectURI("http://wso2.org2/");
        claim2.setDisplayTag("Given Name2");
        claim2.setRegEx("ty&*RegEx2");
        claim2.setRequired(true);
        claim2.setSupportedByDefault(true);
        ClaimMapping cm2 = new ClaimMapping();
        cm2.setClaim(claim2);
        cm2.setMappedAttribute("attr2");
        claims.put("http://wso2.org2/givenname2", cm2);

        Claim claim3 = new Claim();
        claim3.setClaimUri(CLAIM_URI3);
        claim3.setDescription("The description is nutts3");
        claim3.setDialectURI("http://wso2.org/");
        claim3.setDisplayTag("Given Name3");
        claim3.setRegEx("ty&*RegEx3");
        claim3.setRequired(true);
        claim3.setSupportedByDefault(true);
        ClaimMapping cm3 = new ClaimMapping();
        cm3.setClaim(claim3);
        cm3.setMappedAttribute("attr3");
        claims.put("http://wso2.org/givenname3", cm3);
    
View Full Code Here

        }

        public void run() {
            try {
                MessageContext msgCtx = ((Axis2MessageContext) synCtx).getAxis2MessageContext();
                Event<MessageContext> event = new Event(msgCtx);
                subscriptions = subscriptionManager.getMatchingSubscriptions(event);
            } catch (EventException e) {
                handleException("Matching subscriptions fetching error", e);
            }
View Full Code Here

     * @throws EventException event
     */
    private void processGetStatusRequest(MessageContext mc,
                                         ResponseMessageBuilder messageBuilder)
            throws AxisFault, EventException {
        Subscription subscription =
                SubscriptionMessageBuilder.createGetStatusMessage(mc);
        if (log.isDebugEnabled()) {
            log.debug("GetStatus request recived for SynapseSubscription ID : " +
                    subscription.getId());
        }
        subscription = subscriptionManager.getSubscription(subscription.getId());
        if (subscription != null) {
            if (log.isDebugEnabled()) {
                log.debug("Sending GetStatus responce for SynapseSubscription ID : " +
                        subscription.getId());
            }
            //send the responce
            SOAPEnvelope soapEnvelope = messageBuilder.genGetStatusResponse(subscription);
            dispatchResponse(soapEnvelope, EventingConstants.WSE_GET_STATUS_RESPONSE,
                    mc, false);
View Full Code Here


    public SynapseSubscription() {
        this.setId(UIDGenerator.generateURNString());
        this.setDeliveryMode(EventingConstants.WSE_DEFAULT_DELIVERY_MODE);
        SubscriptionData subscriptionData = new SubscriptionData();
        subscriptionData.setProperty(SynapseEventingConstants.STATIC_ENTRY, "false");
        this.setSubscriptionData(subscriptionData);
    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.user.core.claim.Claim

Copyright © 2018 www.massapicom. 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.