public void updateUserName(User user) { String userName = user.getFullName(); List<UserThread> userThreads = userThreadPersistence.findByUserId(user.getUserId()); for (UserThread userThread : userThreads) { if (!userName.equals(userThread.getUserName())) { userThread.setUserName(userName); userThreadPersistence.update(userThread); } } }
public void addUserThread( long userId, long mbThreadId, long topMBMessageId, boolean read, boolean deleted) throws PortalException { long userThreadId = counterLocalService.increment(); User user = UserLocalServiceUtil.getUser(userId); UserThread userThread = userThreadPersistence.create(userThreadId); userThread.setCompanyId(user.getCompanyId()); userThread.setUserId(userId); userThread.setUserName(user.getFullName()); userThread.setCreateDate(new Date()); userThread.setModifiedDate(new Date()); userThread.setMbThreadId(mbThreadId); userThread.setTopMBMessageId(topMBMessageId); userThread.setRead(read); userThread.setDeleted(deleted); userThreadPersistence.update(userThread); }