Package com.logicaldoc.core.communication

# Interface SystemMessageDAO

All Superinterfaces:
  `PersistentObjectDAO<SystemMessage>`

All Known Implementing Classes:
  `HibernateSystemMessageDAO`

public interface SystemMessageDAO extends PersistentObjectDAO<SystemMessage>
This is a DAO service for SystemMessages.

Version:
  1.0
Author:
  Michael Scholz, Marco Meschieri

## Field Summary

### Fields inherited from interface com.logicaldoc.core.PersistentObjectDAO

`ENTITY`

## Method Summary

Modifier and Type
Method
Description
`void`
`deleteExpiredMessages(int type)`
Removes all expired messages for the specified type
`void`
`deleteExpiredMessages(String recipient)`
Removes all system expired messages for the specified recipient
`List<SystemMessage>`
`findByMode(String mode)`
This method selects all the messages for the specified mode
`List<SystemMessage>`
`findByRecipient(String recipient, int type, Integer read)`
This method selects all the messages for the specified recipient and type
`List<SystemMessage>`
`findByType(int type)`
This method selects all the messages for the specified type
`List<SystemMessage>`
`findMessagesToBeSent(int type, int maxTrials)`
This method selects all the messages for the specified type that are not been already sent and for which the number of sending trials is less than the maximum number (parameter 'notifier.maxtrials')
`static SystemMessageDAO`
`get()`
Gets the object available in the application context
`int`
`getUnreadCount(String recipient, int type)`
This methods gets the number of unread messages for the specified recipient and type.

### Methods inherited from interface com.logicaldoc.core.PersistentObjectDAO

`bulkUpdate, count, count, count, delete, delete, deleteAll, deleteAll, evict, evict, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, initialize, initialize, isMariaDB, isMySQL, isOracle, isPostgreSQL, isSQLServer, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForObject, queryForResultSet, queryForString, queryForString, store`

## Method Details

### get

static SystemMessageDAO get()
Gets the object available in the application context

Returns:
  the instance of this object in the application context

### findByRecipient

List<SystemMessage> findByRecipient(String recipient, int type, Integer read) throws PersistenceException
This method selects all the messages for the specified recipient and type

Parameters:
  `recipient` - The recipient name
  `type` - The message type
  `read` - Optional flag
Returns:
  The messages list
Throws:
  `PersistenceException` - @throws PersistenceException Error in the database

### getUnreadCount

int getUnreadCount(String recipient, int type) throws PersistenceException
This methods gets the number of unread messages for the specified recipient and type.

Parameters:
  `recipient` - The recipient name
  `type` - The message type
Returns:
  The number of messages
Throws:
  `PersistenceException` - Error in the database

### deleteExpiredMessages

void deleteExpiredMessages(String recipient) throws PersistenceException
Removes all system expired messages for the specified recipient

Parameters:
  `recipient` - The recipient
Throws:
  `PersistenceException` - Error in the database

### deleteExpiredMessages

void deleteExpiredMessages(int type) throws PersistenceException
Removes all expired messages for the specified type

Parameters:
  `type` - The message type
Throws:
  `PersistenceException` - Error in the database

### findByType

List<SystemMessage> findByType(int type) throws PersistenceException
This method selects all the messages for the specified type

Parameters:
  `type` - type of the message
Returns:
  The list of messages with the given type
Throws:
  `PersistenceException` - Error in the database

### findByMode

List<SystemMessage> findByMode(String mode) throws PersistenceException
This method selects all the messages for the specified mode

Parameters:
  `mode` - The message mode
Returns:
  The list of messages of the given mode
Throws:
  `PersistenceException` - Error in the database

### findMessagesToBeSent

List<SystemMessage> findMessagesToBeSent(int type, int maxTrials) throws PersistenceException
This method selects all the messages for the specified type that are not been already sent and for which the number of sending trials is less than the maximum number (parameter 'notifier.maxtrials')

Parameters:
  `type` - The message type
  `maxTrials` - The maximum number of sending trials
Returns:
  The list of messages of the given type
Throws:
  `PersistenceException` - Error in the database