Holger's
Java API

com.antelmann.db
Class BaseDocument

java.lang.Object
  extended by com.antelmann.db.AbstractDBEntry
      extended by com.antelmann.db.PropertyEntryImpl
          extended by com.antelmann.db.BaseDocument
All Implemented Interfaces:
DBEntry, DocumentEntry, PropertyEntry, Taggable<Keyword>, Imageable, DetailedString, LifeCycleObject, Localizable, Serializable
Direct Known Subclasses:
DBDocument

public class BaseDocument
extends PropertyEntryImpl
implements DocumentEntry

a base implementation for a DocumentEntry

Since:
12.12.2009, 19:36:37
Author:
Holger Antelmann
See Also:
Serialized Form

Nested Class Summary
 
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
protected  BinaryData binaryData
           
protected  ImageHolder 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
BaseDocument(Object id)
           
 
Method Summary
 boolean add(Keyword word)
          makes this instance member of the given group
 boolean addKeyword(String keyword)
           
 Date getBeginTime()
           
 InputStream getContent()
          accesses the raw content of this document
 ValueRetriever<? extends InputStream> getContentRetriever()
           
 String getDescription()
          provides a detailed description of this document
 Image getDisplayIcon()
          returns an image that is suitable for use as an icon for this instance.
 Image getDisplayImage()
          returns an image that represents a visual representation of this instance.
 Date getEndTime()
           
 ValueRetriever<? extends Image> getImageRetriever()
          responsible for getting/generating the image used as a display image.
 String[] getKeywords()
           
 Locale getLocale()
          allows access to the Locale that this instance currently uses to localize its messages,
 String getNotes()
          returns internal notes of this document
 URL getOriginalLocation()
          returns the originating URL - if applicable
 Collection<Keyword> getTags()
          lists all groups that this instance is currently a member of (the data is essentially derived from a set)
 String getTitle()
          returns the title of this document
 boolean hasKeyword(String keyword)
           
 boolean isTagged(Keyword word)
          allows to determine the membership of the given tag or group
 boolean remove(Keyword word)
          terminates the membership of this instance to the given group
 boolean removeKeyword(String keyword)
           
 void setBeginTime(Date beginTime)
           
 void setContent(InputStream stream)
           
 void setContent(URL url)
           
 void setContentRetriever(ValueRetriever<InputStream> contentRetriever)
           
 void setDescription(String description)
           
 void setDisplayImage(Image image)
           
 void setDisplayImage(URL url)
           
 void setEndTime(Date endTime)
           
 void setImageRetriever(ValueRetriever<Image> imageRetriever)
           
 void setLocale(Locale locale, Object context)
          sets the Locale for this object so that all subsequent return values of method calls to this instance can be localized accordingly until a different Locale is set.
 void setNotes(String notes)
           
 void setOriginalLocation(URL url)
           
 void setTitle(String title)
           
 void storeContentTo(File file)
           
 String toDetailedString()
          provides full details of this instance in a String.
 String 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
 

Field Detail

imageHolder

protected final ImageHolder imageHolder

binaryData

protected final BinaryData binaryData
Constructor Detail

BaseDocument

public BaseDocument(Object id)
Method Detail

getLocale

public Locale getLocale()
Description copied from interface: Localizable
allows access to the Locale that this instance currently uses to localize its messages,

Specified by:
getLocale in interface Localizable
Returns:
the current Locale that this instance uses to determine return values for its methods; if null is returned, this instance is expected to use the default Locale of the system.
See Also:
Localizable.setLocale(Locale, Object)

setLocale

public void setLocale(Locale locale,
                      Object context)
Description copied from interface: Localizable
sets the Locale for this object so that all subsequent return values of method calls to this instance can be localized accordingly until a different Locale is set.

Specified by:
setLocale in interface Localizable
Parameters:
locale - the Locale that is to be used to determine return values for all methods of this instance; if set to null, the default locale is to be used.
context - a context that may be required for this instance to load the resources for the given locale; this context may be null for objects that do not require an external context. Examples of a context may be a database, a resource file, some map or no context at all.
See Also:
Localizable.getLocale()

getTitle

public String getTitle()
Description copied from interface: DocumentEntry
returns the title of this document

Specified by:
getTitle in interface DocumentEntry

setTitle

public void setTitle(String title)

getDescription

public String getDescription()
Description copied from interface: DocumentEntry
provides a detailed description of this document

Specified by:
getDescription in interface DocumentEntry

setDescription

public void setDescription(String description)

toString

public String toString()
Overrides:
toString in class AbstractDBEntry

toDetailedString

public String toDetailedString()
Description copied from interface: DetailedString
provides full details of this instance in a String. In case the String contains multiple lines, it is recommended to use '\n' rather than the platform specific line-break for better compatibility.

Specified by:
toDetailedString in interface DetailedString
Overrides:
toDetailedString in class PropertyEntryImpl
Returns:
a (potentially multi-line) String providing full details on this object instance

getNotes

public String getNotes()
Description copied from interface: DocumentEntry
returns internal notes of this document

Specified by:
getNotes in interface DocumentEntry

setNotes

public void setNotes(String notes)

addKeyword

public boolean addKeyword(String keyword)

add

public boolean add(Keyword word)
Description copied from interface: Taggable
makes this instance member of the given group

Specified by:
add in interface Taggable<Keyword>
Parameters:
word - the Group object that this instance is to become a member of
Returns:
true only if the group was actually added to this instance or false if it already was a member of that group

getTags

public Collection<Keyword> getTags()
Description copied from interface: Taggable
lists all groups that this instance is currently a member of (the data is essentially derived from a set)

Specified by:
getTags in interface Taggable<Keyword>

getKeywords

public String[] getKeywords()

hasKeyword

public boolean hasKeyword(String keyword)

isTagged

public boolean isTagged(Keyword word)
Description copied from interface: Taggable
allows to determine the membership of the given tag or group

Specified by:
isTagged in interface Taggable<Keyword>

removeKeyword

public boolean removeKeyword(String keyword)

remove

public boolean remove(Keyword word)
Description copied from interface: Taggable
terminates the membership of this instance to the given group

Specified by:
remove in interface Taggable<Keyword>
Parameters:
word - the Group that this instance is to be removed from as a member
Returns:
true only if this instance was previously a member of the given group.

getBeginTime

public Date getBeginTime()
Specified by:
getBeginTime in interface LifeCycleObject

setBeginTime

public void setBeginTime(Date beginTime)

getEndTime

public Date getEndTime()
Specified by:
getEndTime in interface LifeCycleObject

setEndTime

public void setEndTime(Date endTime)

setContentRetriever

public void setContentRetriever(ValueRetriever<InputStream> contentRetriever)

getContentRetriever

public ValueRetriever<? extends InputStream> getContentRetriever()

setContent

public void setContent(InputStream stream)
                throws OutOfMemoryError,
                       IOException
Throws:
OutOfMemoryError
IOException

setContent

public void setContent(URL url)

getContent

public InputStream getContent()
                       throws IOException
Description copied from interface: DocumentEntry
accesses the raw content of this document

Specified by:
getContent in interface DocumentEntry
Throws:
IOException

storeContentTo

public void storeContentTo(File file)
                    throws IOException
Throws:
IOException

getOriginalLocation

public URL getOriginalLocation()
Description copied from interface: DocumentEntry
returns the originating URL - if applicable

Specified by:
getOriginalLocation in interface DocumentEntry

setOriginalLocation

public void setOriginalLocation(URL url)

setImageRetriever

public void setImageRetriever(ValueRetriever<Image> imageRetriever)

getImageRetriever

public ValueRetriever<? extends Image> getImageRetriever()
responsible for getting/generating the image used as a display image.

See Also:
getDisplayImage(), setImageRetriever(ValueRetriever)

setDisplayImage

public void setDisplayImage(URL url)

setDisplayImage

public void setDisplayImage(Image image)

getDisplayImage

public Image getDisplayImage()
                      throws IOException
Description copied from interface: Imageable
returns an image that represents a visual representation of this instance. The method may return null;

Specified by:
getDisplayImage in interface Imageable
Throws:
IOException

getDisplayIcon

public Image getDisplayIcon()
                     throws IOException
Description copied from interface: Imageable
returns an image that is suitable for use as an icon for this instance. The method may return null;

Specified by:
getDisplayIcon in interface Imageable
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