Holger's Java API

## com.antelmann.sql
Class DBDocument

    java.lang.Object
      com.antelmann.db.AbstractDBEntry
          com.antelmann.db.PropertyEntryImpl
              com.antelmann.db.BaseDocument
                  com.antelmann.sql.DBDocument

All Implemented Interfaces:
  DBEntry, DocumentEntry, PropertyEntry, Taggable<Keyword>, Imageable, DetailedString, LifeCycleObject, Localizable, Serializable

    public class DBDocument

extends BaseDocument

DBDocument stores/retrieves the content from a stream out of a table column in a relational database.

Since:
  14.12.2009, 21:34:40
Author:
  holger
See Also:
  Serialized Form

Nested Class Summary
`static class` `DBDocument.Header`

Nested classes/interfaces inherited from interface com.antelmann.db.Taggable
`Taggable.Adapter<T extends Tag>`

Nested classes/interfaces inherited from interface com.antelmann.util.Localizable
`Localizable.Adapter`

Field Summary

Fields inherited from class com.antelmann.db.BaseDocument
`binaryData, imageHolder`

Fields inherited from class com.antelmann.db.PropertyEntryImpl
`propertyChangeSupport, props, um, vcs`

Fields inherited from interface com.antelmann.db.DBEntry
`ENTRY_FLAVOR, ENTRY_LIST_FLAVOR`

Constructor Summary
`DBDocument(Object id, DBClassStore<DBDocument> store)`
`DBDocument(Object id, DBClassStore<DBDocument> store, boolean preloadContentStream)`

Method Summary

`static

`<T extends DBDocument> T`

`

`createDocument(Object id, DBClassStore<T> store, boolean preloadContentStream)`
provides a standard way to create instances of a subclass of DBDocument

`String` `getFileName()` provides an optional file name that ought to be used for storing the content locally
`boolean` `isContentSet()` determines whether a content stream has been set that needs to be stored into the database
`boolean` `isImageSet()` determines whether an image has been set that needs to be stored into the database
`boolean` `isPreloadContentStream()`
`void` `setFileName(String fileName)` allows to set an optional file name that ought to be used for storing the content locally
`void` `setPreloadContentStream(boolean flag)`
`void` `storeContentTo(File file)`
`protected void` `unsetContent()` allows to prevent that a previously set stream will be stored into the database.
`void` `unsetImage()` allows to prevent that a previously set stream will be stored into the database.

Methods inherited from class com.antelmann.db.BaseDocument

`add, addKeyword, getBeginTime, getContent, getContentRetriever, getDescription, getDisplayIcon, getDisplayImage, getEndTime, getImageRetriever, getKeywords, getLocale, getNotes, getOriginalLocation, getTags, getTitle, hasKeyword, isTagged, remove, removeKeyword, setBeginTime, setContent, setContent, setContentRetriever, setDescription, setDisplayImage, setDisplayImage, setEndTime, setImageRetriever, setLocale, setNotes, setOriginalLocation, setTitle, toDetailedString, toString`

Methods inherited from class com.antelmann.db.PropertyEntryImpl

`addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, asProperties, canRedo, canUndo, checkPropertyChange, clearProperties, containsPropertyText, containsValuePattern, equalWithProperties, equalWithProperties, getBoolean, getNumber, getProperties, getProperty, getProperty, getPropertyChangeListeners, getPropertyComparator, getPropertyExtractor, getPropertyExtractor, getPropertyKeys, getStringExtractor, getVetoableChangeListeners, isCaseInsensitive, isChangeListenerSupportEnabled, isKeyIn, isUndoSupport, isVetoableChangeSupportEnabled, putAll, redo, removeProperty, removePropertyChangeListener, removeVetoableChangeListener, setAllFrom, setCaseInsensitive, setChangeListenerSupport, setProperty, setUndoSupported, setVetoableChangeSupport, undo, verifyProperties`

Methods inherited from class com.antelmann.db.AbstractDBEntry
`equals, getID, hashCode, hashEntry, sameEntry`

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

Methods inherited from interface com.antelmann.db.PropertyEntry
`getProperties, getProperty, removeProperty, setProperty`

Methods inherited from interface com.antelmann.db.DBEntry
`getID`

Constructor Detail

### DBDocument

    public DBDocument(Object id,
                      DBClassStore<DBDocument> store)

### DBDocument

    public DBDocument(Object id,
                      DBClassStore<DBDocument> store,
                      boolean preloadContentStream)

Method Detail

### createDocument

    public static <T extends DBDocument> T createDocument(Object id,
                                                          DBClassStore<T> store,
                                                          boolean preloadContentStream)
                                               throws IllegalArgumentException,
                                                      SecurityException,
                                                      InstantiationException,
                                                      IllegalAccessException,
                                                      InvocationTargetException,
                                                      NoSuchMethodException

  provides a standard way to create instances of a subclass of DBDocument

  Throws:
    `IllegalArgumentException`
    `SecurityException`
    `InstantiationException`
    `IllegalAccessException`
    `InvocationTargetException`
    `NoSuchMethodException`

### isPreloadContentStream

    public boolean isPreloadContentStream()

### setPreloadContentStream

    public void setPreloadContentStream(boolean flag)

### isImageSet

    public boolean isImageSet()

  determines whether an image has been set that needs to be stored into the database

### unsetImage

    public void unsetImage()
                    throws IllegalStateException

  allows to prevent that a previously set stream will be stored into the database. The content will be derived from the store again.

  Throws:
    `IllegalStateException` - if no store is available

### isContentSet

    public boolean isContentSet()

  determines whether a content stream has been set that needs to be stored into the database

### unsetContent

    protected void unsetContent()
                         throws IllegalStateException

  allows to prevent that a previously set stream will be stored into the database. The content will be derived from the store again.

  Throws:
    `IllegalStateException` - if no store is available

### getFileName

    public String getFileName()

  provides an optional file name that ought to be used for storing the content locally

### setFileName

    public void setFileName(String fileName)

  allows to set an optional file name that ought to be used for storing the content locally

### storeContentTo

    public void storeContentTo(File file)
                        throws IOException

  Overrides:
    `storeContentTo` in class `BaseDocument`
  Throws:
    `IOException`

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