Holger's Java API

## com.antelmann.net.mail
Class MessageEntryMapper<M extends MessageEntry>

    java.lang.Object
      com.antelmann.sql.BaseRowMapper<M>
          com.antelmann.net.mail.MessageEntryMapper<M>

All Implemented Interfaces:
  TransactionRequired, MappingInfo, ObjectRowMapper<M>, Converter<RowItem,M>

    public class MessageEntryMapper<M extends MessageEntry>

extends BaseRowMapper<M>

Since:
  07.10.2016, 19:55:15
Author:
  holger

Nested Class Summary
`static class` `MessageEntryMapper.Topic` out of these topics, only `MessageEntryMapper.Topic.CONTENT` is really required; all others are optional (for effective search capabilities)

Nested classes/interfaces inherited from interface com.antelmann.util.Converter
`Converter.Adapter<T1,T2>`

Field Summary

Fields inherited from class com.antelmann.sql.BaseRowMapper
`db, helper`

Constructor Summary
`MessageEntryMapper(Database<Connection> db, MappingInfo mi, Class<M> type)`
`MessageEntryMapper(Database<Connection> db, MappingInfo mi, IDFactory idFactory, Class<M> type)`
`MessageEntryMapper(Database<Connection> db, String tableName, String idColumn, String contentColumn, Class<M> type, IDFactory idFactory)`

Method Summary
`protected M` `createEntry(MessageEntry entry)` this implementation assumes that there is a constructor that takes the given entry
`protected MessageEntry` `createMessage(RowItem row)`
`protected Map<String,Object>` `generateRowProperties(M entry)` generates a map that contains all columns mapped to their values, so that the map can be used to store the object into a row.
`M` `instantiate(RowItem row)` instantiates the DBEntry based on the properties in the given row.
`void` `verifyBeforeStore(M entry, boolean isInsert)` checks whether the filter (if non-null) accepts the entry.

Methods inherited from class com.antelmann.sql.BaseRowMapper

`addColumnsForTopic, applyFromMapping, checkExistence, convert, convertBack, convertTopicFilter, emptyStringsToNull, extractReference, extractStub, extractStub, generateNewID, getAll, getColumnDisplayMapping, getColumnNames, getColumnsForTopic, getColumnSize, getConnection, getConnectionHelper, getDisplayColumn, getDisplayNameForColumn, getEntryClass, getEntryClassMapper, getIDColumn, getIDFactory, getMappedValue, getMappingForTopic, getNextIntID, getNextIntIDFactory, getNextIntIDFactory, getPreStoreFilter, getReadOnlyColumns, getRestrictMappedColumns, getResultSet, getSQLTypeforColumn, getStubColumns, getStubQuery, getStubResultSet, getSupportedTopicColumns, getTableColumnNames, getTableName, getTableQuery, getTableQueryForComboFilter, getTransactionCounter, getUniqueRandomString, handleAfterStore, initMapping, isMappedTopic, isTranslate, javaToSql, javaToSql, lockTable, mapReference, mapReference, mapToRow, removeColumnTopic, setColumnsForTopic, setDisplayColumn, setEntryClass, setEntryClassMapper, setIDFactory, setMappedValue, setNextIntIdAsFactory, setPreStoreFilter, setReadOnlyColumns, setRestrictedMappedColumns, setStubQuery, setTableQuery, setTableQuery, setTopic, setTranslate, sqlToJava, toSQLMap, verifyBeforeDelete`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### MessageEntryMapper

    public MessageEntryMapper(Database<Connection> db,
                              String tableName,
                              String idColumn,
                              String contentColumn,
                              Class<M> type,
                              IDFactory idFactory)
                       throws DatabaseException

Throws:
  `DatabaseException`

### MessageEntryMapper

    public MessageEntryMapper(Database<Connection> db,
                              MappingInfo mi,
                              Class<M> type)
                       throws DatabaseException

Throws:
  `DatabaseException`

### MessageEntryMapper

    public MessageEntryMapper(Database<Connection> db,
                              MappingInfo mi,
                              IDFactory idFactory,
                              Class<M> type)
                       throws DatabaseException

Throws:
  `DatabaseException`

Method Detail

### createEntry

    protected M createEntry(MessageEntry entry)
                                          throws Exception

  this implementation assumes that there is a constructor that takes the given entry

  Throws:
    `Exception`

### createMessage

    protected MessageEntry createMessage(RowItem row)
                                  throws Exception

  Throws:
    `Exception`

### instantiate

    public M instantiate(RowItem row)
                                       throws Exception

  Description copied from interface: `ObjectRowMapper`
  instantiates the DBEntry based on the properties in the given row. The given row contains all the columns of the queried ResultSet unless the columns to be retrieved are restricted by `ObjectRowMapper.getRestrictMappedColumns()`.

  Throws:
    `Exception`

### generateRowProperties

    protected Map<String,Object> generateRowProperties(M entry)
                                                throws WrongDataException

  Description copied from class: `BaseRowMapper`
  generates a map that contains all columns mapped to their values, so that the map can be used to store the object into a row. The ID column and the corresponding ID should not be put in there, as this will happen automatically later.

  Specified by:
    `generateRowProperties` in class `BaseRowMapper<M extends MessageEntry>`
  Throws:
    `WrongDataException`

### verifyBeforeStore

    public void verifyBeforeStore(M entry,
                                  boolean isInsert)
                           throws DatabaseException,
                                  SQLException

  Description copied from class: `BaseRowMapper`
  checks whether the filter (if non-null) accepts the entry. If the entry is not accepted by the filter, a `NotApplicableDataWarning` is thrown. When overriding this method, it is advised to call this super implementation.

  Specified by:
    `verifyBeforeStore` in interface `ObjectRowMapper<M extends MessageEntry>`
  Overrides:
    `verifyBeforeStore` in class `BaseRowMapper<M extends MessageEntry>`
    `isInsert` - if true, the entry is about to be inserted; if false, it is an update
  Throws:
    `DatabaseException`
    `SQLException`
  See Also:
    `BaseRowMapper.setPreStoreFilter(Filter)`

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads