Holger's Java API

## com.antelmann.sql
Class BaseDocumentMapper<T extends BaseDocument>

    java.lang.Object
      com.antelmann.sql.BaseRowMapper<T>
          com.antelmann.sql.BaseDocumentMapper<T>

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

Direct Known Subclasses:
  DBDocumentStore.Mapper

    public class BaseDocumentMapper<T extends BaseDocument>

extends BaseRowMapper<T>

a bases for implementing a store for a given BaseDocument class

Since:
  13.12.2009, 05:21:44
Author:
  holger
See Also:
  `TaggablePropertyEntrySQLStore`

Nested Class Summary
`static class` `BaseDocumentMapper.Column`

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

Field Summary
`protected String` `beginColumn`
`protected String` `descriptionColumn`
`protected String` `endColumn`
`protected String` `locationColumn`
`protected String` `notesColumn`
`protected String` `titleColumn`

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

Constructor Summary
`BaseDocumentMapper(Database<Connection> db, String tableName, String idColumn, String displayColumn, IDFactory idFactory, Class<T> type, String query)`

Method Summary
`protected Map<String,Object>` `generateRowProperties(T 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.
`RelationshipManager` `getRelationshipManager()`
`protected void` `initInstance(T entry, RowItem row)`
`protected void` `initKeys()` this is the place to adjust column names for a subclass
`T` `instantiate(RowItem row)` instantiates the DBEntry based on the properties in the given row.
`void` `setRelationshipManager(RelationshipManager rm)`
`void` `verifyBeforeDelete(Object id)` if a relationshipManager is set, it is verified that there are no relations to this document

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, verifyBeforeStore`

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

Field Detail

### titleColumn

    protected String titleColumn

### descriptionColumn

    protected String descriptionColumn

### notesColumn

    protected String notesColumn

### locationColumn

    protected String locationColumn

### beginColumn

    protected String beginColumn

### endColumn

    protected String endColumn

Constructor Detail

### BaseDocumentMapper

    public BaseDocumentMapper(Database<Connection> db,
                              String tableName,
                              String idColumn,
                              String displayColumn,
                              IDFactory idFactory,
                              Class<T> type,
                              String query)
                       throws DatabaseException

Throws:
  `DatabaseException`

Method Detail

### initKeys

    @Warning(value="this method is called by the constructor, so the inheriting class is not yet initialized")
    protected void initKeys()

  this is the place to adjust column names for a subclass

### generateRowProperties

    protected Map<String,Object> generateRowProperties(T 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<T extends BaseDocument>`
  Throws:
    `WrongDataException`

### instantiate

    public T 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`

### initInstance

    protected void initInstance(T entry,
                                RowItem row)
                         throws Exception

  Throws:
    `Exception`

### getRelationshipManager

    public RelationshipManager getRelationshipManager()

### setRelationshipManager

    public void setRelationshipManager(RelationshipManager rm)

### verifyBeforeDelete

    public void verifyBeforeDelete(Object id)
                            throws DatabaseException,
                                   SQLException

  if a relationshipManager is set, it is verified that there are no relations to this document

  Specified by:
    `verifyBeforeDelete` in interface `ObjectRowMapper<T extends BaseDocument>`
  Overrides:
    `verifyBeforeDelete` in class `BaseRowMapper<T extends BaseDocument>`
  Throws:
    `WrongDataException` - if the deletion is not allowed for semantical reasons
    `DatabaseException`
    `SQLException`

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