use of com.liferay.portal.model.User in project liferay-ide by liferay.
the class UserLocalServiceImpl method updateEmailAddressVerified.
/**
* Updates whether the user has verified email address.
*
* @param userId the primary key of the user
* @param emailAddressVerified whether the user has verified email address
* @return the user
* @throws PortalException if a user with the primary key could not be found
* @throws SystemException if a system exception occurred
*/
@Override
public User updateEmailAddressVerified(long userId, boolean emailAddressVerified) throws PortalException, SystemException {
User user = userPersistence.findByPrimaryKey(userId);
user.setEmailAddressVerified(emailAddressVerified);
userPersistence.update(user);
return user;
}
use of com.liferay.portal.model.User in project liferay-ide by liferay.
the class UserLocalServiceImpl method deletePortrait.
/**
* Deletes the user's portrait image.
*
* @param userId the primary key of the user
* @throws PortalException if a user with the primary key could not be found
* or if the user's portrait could not be found
* @throws SystemException if a system exception occurred
*/
@Override
public void deletePortrait(long userId) throws PortalException, SystemException {
User user = userPersistence.findByPrimaryKey(userId);
long portraitId = user.getPortraitId();
if (portraitId > 0) {
user.setPortraitId(0);
userPersistence.update(user);
imageLocalService.deleteImage(portraitId);
}
}
use of com.liferay.portal.model.User in project liferay-ide by liferay.
the class WebServerServlet method _getGroupId.
private static long _getGroupId(long companyId, String name) throws Exception {
try {
Group group = GroupLocalServiceUtil.getFriendlyURLGroup(companyId, StringPool.SLASH + name);
return group.getGroupId();
} catch (NoSuchGroupException nsge) {
}
User user = UserLocalServiceUtil.getUserByScreenName(companyId, name);
Group group = user.getGroup();
return group.getGroupId();
}
use of com.liferay.portal.model.User in project liferay-ide by liferay.
the class WebServerServlet method _getUser.
private static User _getUser(HttpServletRequest request) throws Exception {
HttpSession session = request.getSession();
if (PortalSessionThreadLocal.getHttpSession() == null) {
PortalSessionThreadLocal.setHttpSession(session);
}
User user = PortalUtil.getUser(request);
if (user != null) {
return user;
}
String userIdString = (String) session.getAttribute("j_username");
String password = (String) session.getAttribute("j_password");
if ((userIdString != null) && (password != null)) {
long userId = GetterUtil.getLong(userIdString);
user = UserLocalServiceUtil.getUser(userId);
} else {
long companyId = PortalUtil.getCompanyId(request);
Company company = CompanyLocalServiceUtil.getCompany(companyId);
user = company.getDefaultUser();
}
return user;
}
use of com.liferay.portal.model.User in project liferay-ide by liferay.
the class AlbumLocalServiceImpl method updateAlbum.
@Indexable(type = IndexableType.REINDEX)
public Album updateAlbum(long userId, long albumId, long artistId, String name, int year, InputStream inputStream, ServiceContext serviceContext) throws PortalException, SystemException {
// Event
User user = userPersistence.findByPrimaryKey(userId);
validate(name);
Album album = albumPersistence.findByPrimaryKey(albumId);
album.setModifiedDate(serviceContext.getModifiedDate(null));
album.setArtistId(artistId);
album.setName(name);
album.setYear(year);
album.setExpandoBridgeAttributes(serviceContext);
albumPersistence.update(album);
if (inputStream != null) {
Repository repository = PortletFileRepositoryUtil.fetchPortletRepository(serviceContext.getScopeGroupId(), Constants.JUKEBOX_PORTLET_REPOSITORY);
if (repository != null) {
try {
PortletFileRepositoryUtil.deletePortletFileEntry(repository.getRepositoryId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, String.valueOf(album.getAlbumId()));
} catch (Exception e) {
if (_log.isDebugEnabled()) {
_log.debug("Cannot delete album cover");
}
}
}
PortletFileRepositoryUtil.addPortletFileEntry(serviceContext.getScopeGroupId(), userId, Album.class.getName(), album.getAlbumId(), Constants.JUKEBOX_PORTLET_REPOSITORY, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, inputStream, String.valueOf(album.getAlbumId()), StringPool.BLANK, true);
}
// Asset
updateAsset(userId, album, serviceContext.getAssetCategoryIds(), serviceContext.getAssetTagNames(), serviceContext.getAssetLinkEntryIds());
return album;
}
Aggregations