Class DatabaseDocumentBean

All Implemented Interfaces:
Serializable, Comparable<Object>, IDBean, Cacheable
Direct Known Subclasses:
Briefing, Tour

public abstract class DatabaseDocumentBean extends DatabaseBlobBean
An abstract bean that contains a document. This has helper methods that provide PDF detection and allow the size to be loaded without loading the entire binary payload.
Since:
10.0
Version:
10.0
Author:
Luke
See Also:
  • Constructor Details

    • DatabaseDocumentBean

      public DatabaseDocumentBean()
  • Method Details

    • getBuffer

      public byte[] getBuffer()
      Returns the file buffer.
      Returns:
      the buffer
      Throws:
      IllegalStateException - if not loaded
    • getIsPDF

      public boolean getIsPDF()
      Returns if the briefing format is PDF.
      Returns:
      TRUE if PDF, otherwise FALSE
    • getSize

      public int getSize()
      Description copied from class: DatabaseBlobBean
      Returns the size of the image/file data.
      Overrides:
      getSize in class DatabaseBlobBean
      Returns:
      the size of the data, in bytes. If the buffer is not initialized, returns -1
      See Also:
    • getContentType

      public String getContentType()
      Returns the document's MIME type.
      Returns:
      the MIME type
    • getExtension

      public String getExtension()
      Returns the document's file extension.
      Returns:
      the extension
    • load

      public void load(String txt)
      Loads a text document from a string.
      Parameters:
      txt - the text
    • setForcePDF

      public void setForcePDF(boolean isPDF)
      Forces the object type.
      Parameters:
      isPDF - TRUE if a PDF, otherwise FALSE
    • setForceSize

      public void setForceSize(int size)
      Forces the object size.
      Parameters:
      size - the size in bytes
    • getText

      public String getText()
      Returns a text representation of the document. Since some subclasses may not just be a briefing document, this deliberately does not override toString().
      Returns:
      the briefing text, or "PDF" if a PDF document