Package com.logicaldoc.core.communication

# Interface MessageTemplateDAO

All Superinterfaces:
  `PersistentObjectDAO<MessageTemplate>`

All Known Implementing Classes:
  `HibernateMessageTemplateDAO`

public interface MessageTemplateDAO extends PersistentObjectDAO<MessageTemplate>
This is a DAO service for MessageTemplate.

Since:
  6.5
Author:
  Marco Meschieri - LogicalDOC

## Field Summary

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

`ENTITY`

## Method Summary

Modifier and Type
Method
Description
`List<MessageTemplate>`
`findByLanguage(String language, long tenantId)`
Finds the templates by given language
`List<MessageTemplate>`
`findByName(String name, long tenantId)`
Finds the templates by given name, you may have the same name but for different languages.
`MessageTemplate`
`findByNameAndLanguage(String name, String language, long tenantId)`
Finds the template by the alternate key.
`List<MessageTemplate>`
`findByTypeAndLanguage(String type, String language, long tenantId)`
Finds the templates by the type.
`static MessageTemplateDAO`
`get()`
Gets the object available in the application context

### 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 MessageTemplateDAO get()
Gets the object available in the application context

Returns:
  the instance of this object in the application context

### findByLanguage

List<MessageTemplate> findByLanguage(String language, long tenantId) throws PersistenceException
Finds the templates by given language

Parameters:
  `language` - the language
  `tenantId` - identifier of the tenant
Returns:
  collection of templates
Throws:
  `PersistenceException` - Error in the database

### findByName

List<MessageTemplate> findByName(String name, long tenantId) throws PersistenceException
Finds the templates by given name, you may have the same name but for different languages.

Parameters:
  `name` - name of the template
  `tenantId` - identifier of the tenant
Returns:
  collection of templates
Throws:
  `PersistenceException` - Error in the database

### findByNameAndLanguage

MessageTemplate findByNameAndLanguage(String name, String language, long tenantId) throws PersistenceException
Finds the template by the alternate key. If the template is not found for the specified language, the 'en' will be used instead.

Parameters:
  `name` - name of the template
  `language` - the language, if null 'en' will be used instead
  `tenantId` - the tenant
Returns:
  The found template or the 'en' if none was found
Throws:
  `PersistenceException` - Error in the database

### findByTypeAndLanguage

List<MessageTemplate> findByTypeAndLanguage(String type, String language, long tenantId) throws PersistenceException
Finds the templates by the type.

Parameters:
  `type` - type of the template
  `language` - the language
  `tenantId` - the tenant
Returns:
  the found templates
Throws:
  `PersistenceException` - Error in the database