com.groiss.dms
Class DocumentVersion

java.lang.Object
  extended by com.groiss.store.PersistentObject
      extended by com.dec.gi.sql.SQLObject
          extended by com.groiss.dms.DocumentVersion
All Implemented Interfaces:
KeyValuePair, Exportable, Persistent, java.io.Serializable, java.lang.Cloneable

public class DocumentVersion
extends com.dec.gi.sql.SQLObject

This is the class representing a version of a DMSForm in @enterprise.

See Also:
Serialized Form

Field Summary
 byte[] content
          holds the version of the content of a DocForm, else it is empty.
 java.util.Date createdAt
          Holds the date when this version was made.
 com.dec.avw.core.User createdBy
          Holds the user who has made this version.
 java.lang.String description
          Holds some description for this version.
 com.dec.avw.core.Form doc
          Holds a reference to the document of which this is a version
 java.lang.String extension
          Holds the extension of the versioned document, but only if it is a DocForm
 java.lang.String formContent
          Holds the version of the forms html-page
 java.lang.String id
          Holds the id of this version
static int MAX_DESC_LENGTH
          Holds the maximum length for the description field of a version
 byte[] messageDigest
          Holds the message digest for the content of this version.
static java.lang.String TMP_ID
           
 
Fields inherited from class com.dec.gi.sql.SQLObject
DO_BLIND
 
Fields inherited from class com.groiss.store.PersistentObject
filled, oid, store
 
Fields inherited from interface com.groiss.store.Exportable
emptyKeys
 
Constructor Summary
DocumentVersion()
           
DocumentVersion(com.dec.avw.core.Form doc, com.dec.avw.core.User user, java.lang.String description)
          Creates a new version of a document.
 
Method Summary
protected  void checkDescription()
          Checks if the description is not longer as allowed.
 void delete()
          This method deletes a document version from the database.
 void finalizeVersion()
          This methods sets the id and creation date correctly and will update the version object but only if this version is a temporary version
 byte[] getContent()
          Returns the content of this version
 java.util.Date getCreatedAt()
          Returns the creation date of this version.
 com.dec.avw.core.User getCreatedBy()
          Returns the user who has made this version.
 java.lang.String getDescription()
          Returns the description of this version.
 com.dec.avw.core.Form getDocument()
          Returns the document which is the origin of this version.
 java.lang.String getExtension()
          Returns the extension of the document at the time of the version
 com.dec.gi.sql.FieldDescriptor getFieldDescriptor(java.lang.String field)
          Returns the field descriptor for the passed field or null if there is none.
 java.lang.String getFormContent()
          Returns the content of the metadata form of this version
 byte[] getMessageDigest()
          Returns the message digest of the content of this document.
 java.lang.String getTableName()
          This method must return the table name of the database table in which this persistent object is stored.
 void insert()
          This method inserts a document version into the database.
 boolean isContentEqual(byte[] data)
          This method checks if the passed array is equal to the content of this version.
 boolean isFormEqual(byte[] data)
          This method checks if the passed array is equal to the htmlpage of this version.
 boolean isMessageDigestEqual(byte[] md)
          Checks if the message digest of this version is equal to the passed one
 void saveToLocal(java.io.OutputStream os)
          Write this document to the file system.
 void setContent()
          Fills the content of this object.
 void update()
           
 
Methods inherited from class com.dec.gi.sql.SQLObject
addRequiredObjects, beforeImport, clone, count, count, dbAttrs, dbFieldString, delete, delete, delete, executeStatement, executeStatement, exportAsElements, get, get, get, get, get2, getCache, getFieldName, getHTMLClass, getKey, getKeys, getLocalClassName, getLocalObjectName, getLoggingContext, getNoCache, getStore, getTableDefinition, getValue, getValueText, hasRows, hasRows, ignoreFields, inDatabase, insertBlind, isValid, list, list, list, list, list2, list2, onInsert, onUpdate, retrieveLoggingContextByOid, setEmpty, setFromDB, setNewOid, setOid, setValues, setValues, table, table, toListString, updateBlind
 
Methods inherited from class com.groiss.store.PersistentObject
dbFields, equals, getOid, hashCode, isFilled, onDelete, onRead, setFilled, setOid, setStore
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TMP_ID

public static final java.lang.String TMP_ID
See Also:
Constant Field Values

MAX_DESC_LENGTH

public static final int MAX_DESC_LENGTH
Holds the maximum length for the description field of a version

See Also:
Constant Field Values

doc

public com.dec.avw.core.Form doc
Holds a reference to the document of which this is a version


createdBy

public com.dec.avw.core.User createdBy
Holds the user who has made this version.


createdAt

public java.util.Date createdAt
Holds the date when this version was made.


description

public java.lang.String description
Holds some description for this version.


id

public java.lang.String id
Holds the id of this version


messageDigest

public byte[] messageDigest
Holds the message digest for the content of this version.


extension

public java.lang.String extension
Holds the extension of the versioned document, but only if it is a DocForm


formContent

public java.lang.String formContent
Holds the version of the forms html-page


content

public volatile byte[] content
holds the version of the content of a DocForm, else it is empty.

Constructor Detail

DocumentVersion

public DocumentVersion()

DocumentVersion

public DocumentVersion(com.dec.avw.core.Form doc,
                       com.dec.avw.core.User user,
                       java.lang.String description)
                throws java.lang.Exception
Creates a new version of a document.

Parameters:
doc - the document which should be versioned
user - the user who makes the version
description - the description for this version
Throws:
java.lang.Exception
Method Detail

getCreatedBy

public com.dec.avw.core.User getCreatedBy()
Returns the user who has made this version.


getCreatedAt

public java.util.Date getCreatedAt()
Returns the creation date of this version.


getDescription

public java.lang.String getDescription()
Returns the description of this version.


getExtension

public java.lang.String getExtension()
Returns the extension of the document at the time of the version


getDocument

public com.dec.avw.core.Form getDocument()
Returns the document which is the origin of this version.


getContent

public byte[] getContent()
                  throws java.lang.Exception
Returns the content of this version

Throws:
java.lang.Exception

getFormContent

public java.lang.String getFormContent()
Returns the content of the metadata form of this version


setContent

public void setContent()
                throws java.lang.Exception
Fills the content of this object.

Throws:
java.lang.Exception

getTableName

public java.lang.String getTableName()
Description copied from interface: Persistent
This method must return the table name of the database table in which this persistent object is stored.

Returns:
The table name of the database table in which this persistent object is stored.

insert

public void insert()
            throws java.lang.Exception
This method inserts a document version into the database. It stores the content of the document in the IStore.

Overrides:
insert in class com.dec.gi.sql.SQLObject
Throws:
java.lang.Exception

delete

public void delete()
            throws java.lang.Exception
This method deletes a document version from the database. It also removes the content of the document from the defined store.

Overrides:
delete in class com.dec.gi.sql.SQLObject
Throws:
java.lang.Exception

update

public void update()
            throws java.lang.Exception
Overrides:
update in class com.dec.gi.sql.SQLObject
Throws:
java.lang.Exception

saveToLocal

public void saveToLocal(java.io.OutputStream os)
                 throws java.lang.Exception
Write this document to the file system.

Parameters:
os - the output stream to write on
Throws:
java.lang.Exception

isFormEqual

public boolean isFormEqual(byte[] data)
                    throws java.lang.Exception
This method checks if the passed array is equal to the htmlpage of this version.

Parameters:
data - the byte array which should be compared with the htmlpage of this version
Returns:
true if the passed array is equal to the htmlpage of this version, otherwise false is returned
Throws:
java.lang.Exception

isContentEqual

public boolean isContentEqual(byte[] data)
                       throws java.lang.Exception
This method checks if the passed array is equal to the content of this version.

Parameters:
data - the byte array which should be compared with the content of this version
Returns:
true if the passed array is equal to the content of this version, otherwise false is returned
Throws:
java.lang.Exception

isMessageDigestEqual

public boolean isMessageDigestEqual(byte[] md)
                             throws java.lang.Exception
Checks if the message digest of this version is equal to the passed one

Parameters:
md - the message digest which should be compared
Throws:
java.lang.Exception

getMessageDigest

public byte[] getMessageDigest()
Returns the message digest of the content of this document.


checkDescription

protected void checkDescription()
Checks if the description is not longer as allowed.


getFieldDescriptor

public com.dec.gi.sql.FieldDescriptor getFieldDescriptor(java.lang.String field)
Returns the field descriptor for the passed field or null if there is none.

Overrides:
getFieldDescriptor in class com.dec.gi.sql.SQLObject
Parameters:
field - the field for which the descriptor is wanted

finalizeVersion

public void finalizeVersion()
                     throws java.lang.Exception
This methods sets the id and creation date correctly and will update the version object but only if this version is a temporary version

Throws:
java.lang.Exception


Copyright © 2001-2006 Groiss Informatics GmbH. All Rights Reserved.