org.wso2.carbon.identity.user.profile.stub.types.UserFieldDTO Java Examples

The following examples show how to use org.wso2.carbon.identity.user.profile.stub.types.UserFieldDTO. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UserProfileCient.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public int compare(UserFieldDTO filed1, UserFieldDTO filed2) {
    if (filed1.getDisplayOrder() == 0) {
        filed1.setDisplayOrder(Integer.MAX_VALUE);
    }

    if (filed2.getDisplayOrder() == 0) {
        filed2.setDisplayOrder(Integer.MAX_VALUE);
    }

    if (filed1.getDisplayOrder() < filed2.getDisplayOrder()) {
        return -1;
    }
    if (filed1.getDisplayOrder() == filed2.getDisplayOrder()) {
        return 0;
    }
    if (filed1.getDisplayOrder() > filed2.getDisplayOrder()) {
        return 1;
    }
    return 0;
}
 
Example #2
Source File: UserProfileCient.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
@Override
public int compare(UserFieldDTO filed1, UserFieldDTO filed2) {
    if (filed1.getDisplayOrder() == 0) {
        filed1.setDisplayOrder(Integer.MAX_VALUE);
    }

    if (filed2.getDisplayOrder() == 0) {
        filed2.setDisplayOrder(Integer.MAX_VALUE);
    }

    if (filed1.getDisplayOrder() < filed2.getDisplayOrder()) {
        return -1;
    }
    if (filed1.getDisplayOrder() == filed2.getDisplayOrder()) {
        return 0;
    }
    if (filed1.getDisplayOrder() > filed2.getDisplayOrder()) {
        return 1;
    }
    return 0;
}
 
Example #3
Source File: EmailUtil.java    From product-es with Apache License 2.0 5 votes vote down vote up
/**
 * Update user profile for particular user in order to enable e-mail subscription.
 *
 * @param automationContext
 * @param backendURL        URL of the server.
 * @param session           session cookie obtained after logging in.
 * @throws UserProfileMgtServiceClient
 * @throws IOException
 * @throws XPathExpressionException
 * @throws AutomationUtilException
 */
public static void updateProfileAndEnableEmailConfiguration(AutomationContext automationContext, String backendURL,
        String session)
        throws UserProfileMgtServiceUserProfileExceptionException, IOException, XPathExpressionException,
        AutomationUtilException {
    UserProfileMgtServiceClient userProfileMgtClient = new UserProfileMgtServiceClient(backendURL, session);
    File axis2File = new File(
            TestConfigurationProvider.getResourceLocation("GREG") + File.separator + "axis2" + File.separator
                    + "axis2.xml");
    UserProfileDTO profile = new UserProfileDTO();
    profile.setProfileName("default");

    UserFieldDTO lastName = new UserFieldDTO();
    lastName.setClaimUri("http://wso2.org/claims/lastname");
    lastName.setFieldValue("GregUserFirstName");

    UserFieldDTO givenName = new UserFieldDTO();
    givenName.setClaimUri("http://wso2.org/claims/givenname");
    givenName.setFieldValue("GregUserLastName");

    UserFieldDTO email = new UserFieldDTO();
    email.setClaimUri("http://wso2.org/claims/emailaddress");
    email.setFieldValue(emailAddress);

    UserFieldDTO[] fields = new UserFieldDTO[3];
    fields[0] = lastName;
    fields[1] = givenName;
    fields[2] = email;

    profile.setFieldValues(fields);

    userProfileMgtClient
            .setUserProfile(automationContext.getContextTenant().getContextUser().getUserName(), profile);

    // apply new axis2.xml configuration
    ServerConfigurationManager serverConfigurationManager = new ServerConfigurationManager(automationContext);
    serverConfigurationManager.applyConfiguration(axis2File);
}
 
Example #4
Source File: EmailUtil.java    From product-es with Apache License 2.0 5 votes vote down vote up
/**
 * Update user profile for particular user in order to enable e-mail subscription.
 *
 * @param automationContext
 * @param backendURL        URL of the server.
 * @param session           session cookie obtained after logging in.
 * @throws UserProfileMgtServiceClient
 * @throws IOException
 * @throws XPathExpressionException
 * @throws AutomationUtilException
 */
public static void updateProfileAndEnableEmailConfiguration(AutomationContext automationContext, String backendURL,
        String session)
        throws UserProfileMgtServiceUserProfileExceptionException, IOException, XPathExpressionException,
        AutomationUtilException {
    UserProfileMgtServiceClient userProfileMgtClient = new UserProfileMgtServiceClient(backendURL, session);
    File axis2File = new File(
            TestConfigurationProvider.getResourceLocation("GREG") + File.separator + "axis2" + File.separator
                    + "axis2.xml");
    UserProfileDTO profile = new UserProfileDTO();
    profile.setProfileName("default");

    UserFieldDTO lastName = new UserFieldDTO();
    lastName.setClaimUri("http://wso2.org/claims/lastname");
    lastName.setFieldValue("GregUserFirstName");

    UserFieldDTO givenName = new UserFieldDTO();
    givenName.setClaimUri("http://wso2.org/claims/givenname");
    givenName.setFieldValue("GregUserLastName");

    UserFieldDTO email = new UserFieldDTO();
    email.setClaimUri("http://wso2.org/claims/emailaddress");
    email.setFieldValue(emailAddress);

    UserFieldDTO[] fields = new UserFieldDTO[3];
    fields[0] = lastName;
    fields[1] = givenName;
    fields[2] = email;

    profile.setFieldValues(fields);

    userProfileMgtClient
            .setUserProfile(automationContext.getContextTenant().getContextUser().getUserName(), profile);

    // apply new axis2.xml configuration
    ServerConfigurationManager serverConfigurationManager = new ServerConfigurationManager(automationContext);
    serverConfigurationManager.applyConfiguration(axis2File);
}
 
Example #5
Source File: UserProfileCient.java    From carbon-identity-framework with Apache License 2.0 4 votes vote down vote up
public UserFieldDTO[] getOrderedUserFields(UserFieldDTO[] userFields)
        throws Exception {
    Arrays.sort(userFields, new UserFieldComparator());
    return userFields;
}
 
Example #6
Source File: UserProfileCient.java    From carbon-identity with Apache License 2.0 4 votes vote down vote up
public UserFieldDTO[] getOrderedUserFields(UserFieldDTO[] userFields)
        throws Exception {
    Arrays.sort(userFields, new UserFieldComparator());
    return userFields;
}