Elexis API documentation
Version 2.1.6 as of December 11 2011

ch.elexis.text
Class GenericDocument

java.lang.Object
  extended by ch.elexis.text.GenericDocument
All Implemented Interfaces:
IOpaqueDocument

public class GenericDocument
extends java.lang.Object
implements IOpaqueDocument

An IDocument implementation, based on a File

Author:
gerry

Constructor Summary
GenericDocument(Patient pat, java.lang.String title, java.lang.String category, byte[] content, java.lang.String date, java.lang.String keywords, java.lang.String mimetype)
          Create a new GenericDocument from a File.
GenericDocument(Patient pat, java.lang.String title, java.lang.String category, java.io.File file, java.lang.String date, java.lang.String keywords, java.lang.String mimetype)
          Create a new GenericDocument from a File.
 
Method Summary
 java.lang.String getCategory()
          Category of the document.
 byte[] getContentsAsBytes()
          A representation of the contents as byte array
 java.io.InputStream getContentsAsStream()
          Return the contents of this document as Stream Note: The caller must ensure that the stream is closed after using it.
 java.lang.String getCreationDate()
          Date this document was created
 java.lang.String getGUID()
          A globally unique identifier for this document.
 java.lang.String getKeywords()
          Arbitrary keywords for this document
 java.lang.String getMimeType()
          Mime-Type of the contents.
 java.lang.String getPatientID()
          The Patient this document belongs to.
 java.lang.String getTitle()
          Title for the document.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericDocument

public GenericDocument(Patient pat,
                       java.lang.String title,
                       java.lang.String category,
                       java.io.File file,
                       java.lang.String date,
                       java.lang.String keywords,
                       java.lang.String mimetype)
                throws java.io.IOException
Create a new GenericDocument from a File.

Parameters:
pat - The patient this document belongs to. Can be null
title - Title for the document. Never Null and Never empty
category - Category for the document. Can be null or empty
file - File to import in this document
date - date of creation
keywords - space- or comma- separated list of keywords. May be empty or null
Throws:
java.io.IOException

GenericDocument

public GenericDocument(Patient pat,
                       java.lang.String title,
                       java.lang.String category,
                       byte[] content,
                       java.lang.String date,
                       java.lang.String keywords,
                       java.lang.String mimetype)
                throws java.io.IOException
Create a new GenericDocument from a File.

Parameters:
pat - The patient this document belongs to. Can be null
title - Title for the document. Never Null and Never empty
category - Category for the document. Can be null or empty
content - Content as byte array
date - date of creation
keywords - space- or comma- separated list of keywords. May be empty or null
Throws:
java.io.IOException
Method Detail

getTitle

public java.lang.String getTitle()
Description copied from interface: IOpaqueDocument
Title for the document. Not more than 80 characters. Must not be null and must not be empty

Specified by:
getTitle in interface IOpaqueDocument

getMimeType

public java.lang.String getMimeType()
Description copied from interface: IOpaqueDocument
Mime-Type of the contents.

Specified by:
getMimeType in interface IOpaqueDocument
Returns:
The MimeType (see rfc2045) of the document. May be null or empty if not known

getContentsAsStream

public java.io.InputStream getContentsAsStream()
                                        throws ElexisException
Return the contents of this document as Stream Note: The caller must ensure that the stream is closed after using it.

Specified by:
getContentsAsStream in interface IOpaqueDocument
Returns:
an InpputStream
Throws:
ElexisException

getContentsAsBytes

public byte[] getContentsAsBytes()
                          throws ElexisException
Description copied from interface: IOpaqueDocument
A representation of the contents as byte array

Specified by:
getContentsAsBytes in interface IOpaqueDocument
Returns:
a byte array with the original contents
Throws:
ElexisException

getKeywords

public java.lang.String getKeywords()
Description copied from interface: IOpaqueDocument
Arbitrary keywords for this document

Specified by:
getKeywords in interface IOpaqueDocument
Returns:
null or empty or a list of keywords, separated by comma or space

getCategory

public java.lang.String getCategory()
Description copied from interface: IOpaqueDocument
Category of the document. This is an arbitrary, user-defined String

Specified by:
getCategory in interface IOpaqueDocument
Returns:
null or empty or the category for this document

getCreationDate

public java.lang.String getCreationDate()
Description copied from interface: IOpaqueDocument
Date this document was created

Specified by:
getCreationDate in interface IOpaqueDocument
Returns:
a date in ISO Format. Never null

getPatientID

public java.lang.String getPatientID()
Description copied from interface: IOpaqueDocument
The Patient this document belongs to.

Specified by:
getPatientID in interface IOpaqueDocument
Returns:
A Patient-ID or null if the document does not belong to a patient.

getGUID

public java.lang.String getGUID()
Description copied from interface: IOpaqueDocument
A globally unique identifier for this document. The implementation must ensure that (1) No two documents in the world ever exist with the same GUID, and (2) A document will always have the same GUID assigned within this application, i.e. the call getGUID on the same document will always return the same value.

Specified by:
getGUID in interface IOpaqueDocument
Returns:

Elexis API documentation
Version 2.1.6 as of December 11 2011

Copyright 2005-2011 by Gerry Weirich, Elexis