Package org.cyclos.impl.messaging
Class MessageServiceImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseServiceImpl
-
- org.cyclos.impl.messaging.MessageServiceImpl
-
- All Implemented Interfaces:
MessageServiceLocal,MessageService,Service
@Service public class MessageServiceImpl extends BaseServiceImpl implements MessageServiceLocal
Implementation forMessageService
-
-
Field Summary
-
Fields inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
authHandler, conversionHandler, customFieldValueHandler, entityManagerHandler, groupsHandler, productsHandler, restBeanPropertyMapping, userLocatorHandler
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, configurationHandler, dataTranslationHandler, notificationHandler, profileFieldHandler, transactionHandler, translationHandler
-
-
Constructor Summary
Constructors Constructor Description MessageServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanSendMessage(MessageDestination destination)Returns true if the logged user can send a message to the given destinationbooleancanSendMessageToUser(User user)Returns true if the logged user can send a message to the given destination user.booleancanViewMessages()Returns true if the the logged user can view his messages.intcountNewMessages()Return messages count since the last time seenintcountUnreadMessages()Return unread messages countMessageDatagetData(Long id)Returns details data for the given messageMessagesStatusVOgetMessagesStatus()Returns the messages status containing the unread/new messages and the last view date.
The last view date is updated through theUserValidationService.updateUserActivity(org.cyclos.model.users.users.UserActivityType)method with the parameterUserActivityType.MESSAGE.MessageSearchDatagetSearchData()Returns data used to search messagesSendMessageDatagetSendData(Long replyId, UserLocatorVO toUserVO)Returns data for sending a message.voidmarkAsRead(Set<Long> ids, boolean isRead)Marks all the given message as either read or as unreadvoidmoveToTrash(Set<Long> ids)Moves all the given messages to the trash binprotected voidregisterNetworkMappings(NetworkPathRegistry networkPathRegistry)Needs to be overridden by subclasses to register the path up to the networkvoidremoveAll(Set<Long> ids)Permanently removes all the given messagesvoidremoveAll(User user)Clears all message boxes of the specified user completely, by physically deleting all the messagesvoidrestoreAll(Set<Long> ids)Restores the given messages, that is, move them from the trash bin to the original message box (either inbox or sent items)Page<MessageVO>search(MessageQuery params)Searches for messages according to the given criterialongsend(SendMessageDTO sendMessage)Sends a message and returns the id of the outgoing message-
Methods inherited from class org.cyclos.impl.BaseServiceImpl
initializeNetworkMappings
-
Methods inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
canManage, checkManagesUser, checkPermission, checkRelatesToUser, checkValue, clearAlreadyValidated, getBaseEntityManagerHandler, getConfiguration, getLoggedBasicUser, getLoggedUser, getProducts, getTranslatedName, getTranslatedValue, hasPermission, hasValue, inSameNetwork, inSameNetworkOrGlobal, isAdmin, isAlreadyValidated, isBroker, isGlobalAdmin, isGlobalAdminInNetwork, isGuest, isLoggedIn, isMember, isMemberOnly, isNetworkAdmin, isOperator, isRelatedToUser, isSystem, isUserManager, isUserManagerOf, message, message, permission, permission, permissionOptionalValue, permissionOptionalValue, setAlreadyValidated, toDate, toDateTime, validate
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, dataTranslationProxy, delete, detach, doDataTranslationProxy, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, message, message, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
-
-
-
Method Detail
-
canSendMessage
public boolean canSendMessage(MessageDestination destination)
Description copied from interface:MessageServiceLocalReturns true if the logged user can send a message to the given destination- Specified by:
canSendMessagein interfaceMessageServiceLocal- Parameters:
destination- The destination of the message. If null, it returns true if the logged user can send the message to at least one destination.
-
canSendMessageToUser
public boolean canSendMessageToUser(User user)
Description copied from interface:MessageServiceLocalReturns true if the logged user can send a message to the given destination user.- Specified by:
canSendMessageToUserin interfaceMessageServiceLocal
-
canViewMessages
public boolean canViewMessages()
Description copied from interface:MessageServiceLocalReturns true if the the logged user can view his messages. In case of an admin, the method returns true if he can view the system messages.- Specified by:
canViewMessagesin interfaceMessageServiceLocal
-
countNewMessages
public int countNewMessages()
Description copied from interface:MessageServiceReturn messages count since the last time seen- Specified by:
countNewMessagesin interfaceMessageService
-
countUnreadMessages
public int countUnreadMessages()
Description copied from interface:MessageServiceReturn unread messages count- Specified by:
countUnreadMessagesin interfaceMessageService
-
getData
public MessageData getData(Long id) throws FrameworkException
Description copied from interface:MessageServiceReturns details data for the given message- Specified by:
getDatain interfaceMessageService- Throws:
FrameworkException
-
getMessagesStatus
public MessagesStatusVO getMessagesStatus()
Description copied from interface:MessageServiceReturns the messages status containing the unread/new messages and the last view date.
The last view date is updated through theUserValidationService.updateUserActivity(org.cyclos.model.users.users.UserActivityType)method with the parameterUserActivityType.MESSAGE.- Specified by:
getMessagesStatusin interfaceMessageService
-
getSearchData
public MessageSearchData getSearchData()
Description copied from interface:MessageServiceReturns data used to search messages- Specified by:
getSearchDatain interfaceMessageService
-
getSendData
public SendMessageData getSendData(Long replyId, UserLocatorVO toUserVO)
Description copied from interface:MessageServiceReturns data for sending a message. If replyId is given, the new message will be a reply for that one. If toUser is given, the message will be to that specific user.- Specified by:
getSendDatain interfaceMessageService
-
markAsRead
public void markAsRead(Set<Long> ids, boolean isRead)
Description copied from interface:MessageServiceMarks all the given message as either read or as unread- Specified by:
markAsReadin interfaceMessageService
-
moveToTrash
public void moveToTrash(Set<Long> ids)
Description copied from interface:MessageServiceMoves all the given messages to the trash bin- Specified by:
moveToTrashin interfaceMessageService
-
removeAll
public void removeAll(Set<Long> ids)
Description copied from interface:MessageServicePermanently removes all the given messages- Specified by:
removeAllin interfaceMessageService
-
removeAll
public void removeAll(User user)
Description copied from interface:MessageServiceLocalClears all message boxes of the specified user completely, by physically deleting all the messages- Specified by:
removeAllin interfaceMessageServiceLocal
-
restoreAll
public void restoreAll(Set<Long> ids)
Description copied from interface:MessageServiceRestores the given messages, that is, move them from the trash bin to the original message box (either inbox or sent items)- Specified by:
restoreAllin interfaceMessageService
-
search
public Page<MessageVO> search(MessageQuery params)
Description copied from interface:MessageServiceSearches for messages according to the given criteria- Specified by:
searchin interfaceMessageService
-
send
public long send(SendMessageDTO sendMessage)
Description copied from interface:MessageServiceSends a message and returns the id of the outgoing message- Specified by:
sendin interfaceMessageService
-
registerNetworkMappings
protected void registerNetworkMappings(NetworkPathRegistry networkPathRegistry)
Description copied from class:BaseServiceImplNeeds to be overridden by subclasses to register the path up to the network- Specified by:
registerNetworkMappingsin classBaseServiceImpl
-
-