use of org.eclipse.che.api.user.server.model.impl.ProfileImpl in project che by eclipse.
the class ProfileDaoTest method shouldCreateProfile.
@Test(dependsOnMethods = { "shouldGetProfileById", "shouldRemoveProfile" })
public void shouldCreateProfile() throws Exception {
final ProfileImpl profile = profiles[0];
profileDao.remove(profile.getUserId());
profileDao.create(profile);
assertEquals(profileDao.getById(profile.getUserId()), profile);
}
use of org.eclipse.che.api.user.server.model.impl.ProfileImpl in project che by eclipse.
the class ProfileDaoTest method shouldGetProfileById.
@Test
public void shouldGetProfileById() throws Exception {
final ProfileImpl profile = profiles[0];
assertEquals(profileDao.getById(profile.getUserId()), profile);
}
use of org.eclipse.che.api.user.server.model.impl.ProfileImpl in project che by eclipse.
the class ProfileManager method update.
/**
* Updates current profile using replace strategy.
*
* <p>Note that {@link Profile#getEmail()} can't be updated using this method
* as it is mirrored from the {@link User#getEmail()}.
*
* @param profile
* profile update
* @throws NullPointerException
* when {@code profile} is null
* @throws NotFoundException
* when there is no profile for the user with the id {@code profile.getUserId()}
* @throws ServerException
* when any other error occurs
*/
public void update(Profile profile) throws NotFoundException, ServerException {
requireNonNull(profile, "Required non-null profile");
profileDao.update(new ProfileImpl(profile));
}
use of org.eclipse.che.api.user.server.model.impl.ProfileImpl in project che by eclipse.
the class ProfileManager method create.
/**
* Creates a new user's profile .
*
* @param profile
* new profile
* @throws NullPointerException
* when profile is null
* @throws ConflictException
* when profile for the user {@code profile.getUserId()} already exists
* @throws ServerException
* when any other error occurs
*/
public void create(Profile profile) throws ServerException, ConflictException {
requireNonNull(profile, "Required non-null profile");
profileDao.create(new ProfileImpl(profile));
}
use of org.eclipse.che.api.user.server.model.impl.ProfileImpl in project che by eclipse.
the class ProfileService method updateAttributes.
@PUT
@Path("/attributes")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@GenerateLink(rel = LINK_REL_CURRENT_PROFILE_ATTRIBUTES)
@ApiOperation(value = "Update the profile attributes of the currently logged in user", notes = "The replace strategy is used for the update, so all the existing profile " + "attributes will be override with incoming values")
public ProfileDto updateAttributes(@ApiParam("New profile attributes") Map<String, String> updates) throws NotFoundException, ServerException, BadRequestException {
checkAttributes(updates);
final ProfileImpl profile = new ProfileImpl(profileManager.getById(userId()));
profile.setAttributes(updates);
profileManager.update(profile);
return linksInjector.injectLinks(asDto(profile, userManager.getById(profile.getUserId())), getServiceContext());
}
Aggregations