agave-profiles/profiles-core/src/main/java/org/iplantc/service/profile/dao/ScimProfileDAO.java
/**
	 * Makes API call to SCIM API to update user profile
	 * @param username the username of the user to update
	 * @param updatedProfile the profile object to use to update the SCIM service.
	 * @return a Profile object mapped from the query response of the SCIM2 service
	 * @throws RemoteDataException if the service is unavailable or update fails
	 * @throws ProfileException if the updated Profile is not valid.
	 */
Makes API call to SCIM API to update user profile
@param username the username of the user to update
@param updatedProfile the profile object to use to update the SCIM service.
@return a Profile object mapped from the query response of the SCIM2 service
@throws RemoteDataException if the service is unavailable or update fails
@throws ProfileException if the updated Profile is not valid.
Makes API call to SCIM API to update user profile @param username the username of the user to update @param updatedProfile the profile object to use to update the SCIM service . @return a Profile object mapped from the query response of the SCIM2 service @throws RemoteDataException if the service is unavailable or update fails @throws ProfileException if the updated Profile is not valid .
private Profile update(String username, ScimProfile updatedProfile) throws RemoteDataException, ProfileException
	{
		try {
			ScimService scimService = getScimService();
			ListResponse<UserResource> searchResponse = scimService.searchRequest("Users")
					.filter(Filter.eq("userName", username).toString())
					.page(1, 1)
					.invoke(UserResource.class);
			if (searchResponse.getTotalResults() != 0) {
				throw new RemoteDataException("Failed to update user profile. Multiple users found with username " + username);
			}
			UserResource existingResource = mergeExistingUserResource(searchResponse.getResources().get(0), updatedProfile);
			UserResource updatedResource = scimService.replace(existingResource);
			return new ScimProfile(updatedResource);
		}
		catch (RemoteDataException|ProfileException e) {
			throw e;
		}
		catch (Exception e) {
			throw new RemoteDataException("Failed to update profile data", e);
		}
	}
private Profile update ( String username , ScimProfile updatedProfile ) throws RemoteDataException , ProfileException { try { ScimService scimService = getScimService ( ) ; ListResponse < UserResource > searchResponse = scimService . searchRequest ( "Users" ) . filter ( Filter . eq ( "userName" , username ) . toString ( ) ) . page ( 1 , 1 ) . invoke ( UserResource . class ) ; if ( searchResponse . getTotalResults ( ) != 0 ) { throw new RemoteDataException ( "Failed to update user profile. Multiple users found with username " + username ) ; } UserResource existingResource = mergeExistingUserResource ( searchResponse . getResources ( ) . get ( 0 ) , updatedProfile ) ; UserResource updatedResource = scimService . replace ( existingResource ) ; return new ScimProfile ( updatedResource ) ; } catch ( RemoteDataException | ProfileException e ) { throw e ; } catch ( Exception e ) { throw new RemoteDataException ( "Failed to update profile data" , e ) ; } }
Makes API call to SCIM API to update user profile
 @param username the username of the user to update
 @param updatedProfile the profile object to use to update the SCIM service.
Makes API call to SCIM API to update user profile @param username the username of the user to update @param updatedProfile the profile object to use to update the SCIM service .
// Create a ScimService using the credentials in the service config // fetch the current profile so we have a deterministic way to update values when value mapping on 1-N // fields is not deterministic.