com.groiss.dms
Class DocForm

java.lang.Object
  extended by com.groiss.store.PersistentObject
      extended by com.dec.gi.sql.SQLObject
          extended by com.dec.gi.sql.LoggedObject
              extended by com.dec.avw.core.Form
                  extended by com.groiss.dms.DocForm
All Implemented Interfaces:
com.dec.avw.acl.HasACL, com.dec.avw.core.OwnedObject, DMSDocForm, DMSForm, DMSObject, KeyValuePair, HasLog, RightCheck, Exportable, HasSubclasses, OptimisticLocking, Persistent, java.io.Serializable, java.lang.Cloneable

public abstract class DocForm
extends com.dec.avw.core.Form
implements DMSDocForm

This class is the superclass of all form classes generated by the system to which documents can be attached.

See Also:
Serialized Form

Field Summary
 byte[] avwcontent
          the content of the document
 long avwcontentSize
          the size of the document
 java.lang.String avwextension
          extension of the document
 byte[] avwmessageDigest
          Holds the message digest for the content of this document.
 int avwstatus
          status of the document (IN or OUT)
 com.dec.avw.core.User avwusedBy
          user, who edits the document
static int LOCAL
          Deprecated.  
 
Fields inherited from class com.dec.avw.core.Form
AUTO_VERSION_TEXT, avwchangedAt, avwchangedBy, avwcreatedAt, avwcreatedBy, formtype, loadFormType, loadNotes, noteViewers, task
 
Fields inherited from class com.dec.gi.sql.LoggedObject
acl, canDeleteAlreadyChecked, changetime, NO_CHECK_DEFFERRED, transactionId
 
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.dms.DMSDocForm
IN, LOCKED, OUT
 
Fields inherited from interface com.groiss.store.Exportable
emptyKeys
 
Constructor Summary
DocForm()
           
 
Method Summary
 void checkIn(User user)
          Checks the document in
 void checkIn(User user, byte[] barr)
          Checks the document in
 void checkIn(User user, java.io.InputStream is)
          Checks the document in
 void checkIn(User user, java.lang.String tmpFile)
          Checks the document in
 void checkIn(User user, java.lang.String tmpFile, boolean deleteTmpFile)
          Checks the document in
static void checkInRemote(DocForm doc)
          Check in from remote.
 java.lang.String checkOut(User user)
          Check out the attached document and write it to the file system.
 java.lang.String checkOut(User u, java.lang.String file)
          Check out a document.
static DocForm checkOutRemote(long doc, java.lang.String className, long user, long tid)
          check out on start server
 void delete()
          Must override delete-method to guarantee that the associated document is also deleted.
static java.lang.String getCheckOutDir(com.dec.avw.core.StepInstance process)
          Returns the check out directory for the passed process
 java.lang.String getCheckOutFilePath()
          Returns the path of the check out directory for this document
 byte[] getContent()
          Returns the content of this document
protected  com.dec.avw.core.Form getCopy(User user)
          Creates a copy of this document
 java.lang.String getDefaultIcon()
          Returns the string determining the file holding the icon for this document
 java.lang.String getExtension()
          Returns the extension of the attached document
 java.lang.String getFullName()
          Returns the full name of the document which is the name and the extension separated by a dot
 byte[] getMessageDigest()
          Returns the message digest of the content of this document.
 long getSize()
          Get the size of the document.
 int getStatus()
          Get the status of the document.
 User getUsedBy()
          Get the user who has locked or checked out the document.
 boolean isCheckedOut()
          Returns if this document is currently checked out
 boolean isLocked()
          Returns if this document is locked
 void lock(User user)
          Locks this document.
 void onInsert()
          Inserts this document and its content
 void revert()
          Performs an undo of checkout by setting status to IN and usedBy to Null.
 void revert(boolean deleteFile)
          Performs an undo of checkout by setting status to IN and usedBy to Null.
 void saveContent(User user)
           
 void saveToLocal(java.io.OutputStream os)
          Write this document to the passed stream.
 void saveVersionToLocal(long version, java.io.OutputStream os)
          Write the specified document version to the passed stream.
 void setContent()
          write the content into a byte buffer
 void setExtension(java.lang.String extension)
          Sets the extension of the attached document
 java.lang.String toListString()
           
 java.lang.String toString()
           
 void undoCheckOut()
          Undoes the check out of the document
 void unlock()
          Unlocks this document.
 void updateContent()
          Updates the content of this document
 void write(java.io.OutputStream os)
          Write the document to the file system.
 
Methods inherited from class com.dec.avw.core.Form
attachNote, checkDelete, checkEdit, clone, createPrototypeCopy, deleteAttachedNotes, deleteVersion, deleteVersion, deleteVersions, disableAutoUpdate, enableAutoUpdate, fill, getAndLock, getChangedAt, getChangedBy, getContentForVersion, getCreatedAt, getCreatedBy, getDefaultDept, getDefaultOrgUnit, getDependent, getEventHandler, getField, getFormClassDir, getFormType, getHTMLClass, getIcon, getLatestVersion, getLatestVersion, getLocalClassName, getLocalObjectName, getMasterForm, getName, getName, getOwner, getProcess, getSelectFieldValue, getSubForm, getSubform, getSubforms, getTabledef, getTableName, getTask, getTemporaryVersion, getTemporaryVersion2, getTypeName, getVersionId, getVersionsForDistribution, getVersionsForDistribution, getViewer, hasAttachedNotes, hasAttributes, hasVersion, hasVersions, ignoreSubstitution, isAutoUpdate, isPrototype, isView, listAttachedNotes, listVersions, makeCopy, makeCopy, makeProcessFormVersion, makeVersion, makeVersion, mayDelete, mayInsert, mayUpdate, onDelete, onRead, onUpdate, removeNote, setField, setFormRelation, setFormType, setName, setNoteViewers, setTask, setVersionId
 
Methods inherited from class com.dec.gi.sql.LoggedObject
canDelete, delete, deleteExtensions, deleteNoCheck, getAcl, getAllVersions, getExtensions, getExtensionsWithDummies, getLogInfo, getTransactionId, getVersion, getVersion, ignoreFields, increaseTransactionId, insert, insertNoCheck, makeVersion, setAcl, setTransactionId, toString, update, updateAt, updateNoCheck, updateNoVersioning
 
Methods inherited from class com.dec.gi.sql.SQLObject
addRequiredObjects, beforeImport, count, count, dbAttrs, dbFieldString, delete, delete, delete, executeStatement, executeStatement, exportAsElements, get, get, get, get, get2, getCache, getFieldDescriptor, getFieldName, getKey, getKeys, getLoggingContext, getNoCache, getStore, getTableDefinition, getValue, getValueText, hasRows, hasRows, inDatabase, insert, insertBlind, isValid, list, list, list, list, list2, list2, retrieveLoggingContextByOid, setEmpty, setFromDB, setNewOid, setOid, setValues, setValues, table, table, update, updateBlind
 
Methods inherited from class com.groiss.store.PersistentObject
dbFields, equals, getOid, hashCode, isFilled, setFilled, setOid, setStore
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.groiss.dms.DMSDocForm
hasAttributes
 
Methods inherited from interface com.groiss.dms.DMSForm
getField, getFormType, setField
 
Methods inherited from interface com.groiss.dms.DMSObject
attachNote, getAcl, getChangedAt, getChangedBy, getCreatedAt, getCreatedBy, getDefaultOrgUnit, getIcon, getName, getOid, getTypeName, hasAttachedNotes, hasVersions, listAttachedNotes, listVersions, makeCopy, makeVersion, removeNote, setAcl, setName
 
Methods inherited from interface com.dec.avw.core.OwnedObject
getOwner, ignoreSubstitution
 
Methods inherited from interface com.groiss.store.Persistent
dbFields, getStore, getTableName, isFilled, onDelete, onRead, onUpdate, setFilled, setOid, setStore
 
Methods inherited from interface com.groiss.org.HasLog
getVersionId, setVersionId
 

Field Detail

LOCAL

public static final int LOCAL
Deprecated. 
status: the document is copied to a local file system

See Also:
Constant Field Values

avwextension

public java.lang.String avwextension
extension of the document


avwstatus

public int avwstatus
status of the document (IN or OUT)


avwusedBy

public com.dec.avw.core.User avwusedBy
user, who edits the document


avwcontentSize

public long avwcontentSize
the size of the document


avwmessageDigest

public byte[] avwmessageDigest
Holds the message digest for the content of this document.


avwcontent

public volatile byte[] avwcontent
the content of the document

Constructor Detail

DocForm

public DocForm()
Method Detail

delete

public void delete()
            throws java.lang.Exception
Must override delete-method to guarantee that the associated document is also deleted.

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

getCopy

protected com.dec.avw.core.Form getCopy(User user)
                                 throws java.lang.Exception
Creates a copy of this document

Overrides:
getCopy in class com.dec.avw.core.Form
Throws:
java.lang.Exception

getContent

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

Specified by:
getContent in interface DMSDocForm
Overrides:
getContent in class com.dec.avw.core.Form
Throws:
java.lang.Exception

getDefaultIcon

public java.lang.String getDefaultIcon()
Returns the string determining the file holding the icon for this document

Overrides:
getDefaultIcon in class com.dec.avw.core.Form

getSize

public long getSize()
Get the size of the document.

Specified by:
getSize in interface DMSDocForm
Overrides:
getSize in class com.dec.avw.core.Form
Returns:
the size of the document

checkIn

public void checkIn(User user)
             throws java.lang.Exception
Checks the document in

Parameters:
user - the user who wants to check in.
Throws:
java.lang.Exception

checkIn

public void checkIn(User user,
                    java.lang.String tmpFile)
             throws java.lang.Exception
Checks the document in

Parameters:
user - the user who wants to check in.
tmpFile - the file (on the server) to check in.
Throws:
java.lang.Exception

checkIn

public void checkIn(User user,
                    java.lang.String tmpFile,
                    boolean deleteTmpFile)
             throws java.lang.Exception
Checks the document in

Parameters:
user - the user who wants to check in.
tmpFile - the file (on the server) to check in.
deleteTmpFile - if true the passed tmpfile is deleted after the check in
Throws:
java.lang.Exception

checkIn

public void checkIn(User user,
                    java.io.InputStream is)
             throws java.lang.Exception
Checks the document in

Specified by:
checkIn in interface DMSDocForm
Parameters:
user - the user who wants to check in.
is - the inputstream from which the content of the document is read.
Throws:
java.lang.Exception

checkIn

public void checkIn(User user,
                    byte[] barr)
             throws java.lang.Exception
Description copied from interface: DMSDocForm
Checks the document in

Specified by:
checkIn in interface DMSDocForm
Parameters:
user - the user who performs this action
barr - a byte array holding the content of the document
Throws:
java.lang.Exception

saveContent

public void saveContent(User user)
                 throws java.lang.Exception
Throws:
java.lang.Exception

checkOut

public java.lang.String checkOut(User user)
                          throws java.lang.Exception
Check out the attached document and write it to the file system.

Specified by:
checkOut in interface DMSDocForm
Parameters:
user - the user performing the action.
Returns:
the path of the file to which the document was checked out
Throws:
java.lang.Exception

checkOut

public java.lang.String checkOut(User u,
                                 java.lang.String file)
                          throws java.lang.Exception
Check out a document. The method writes the document to the file system.

Parameters:
u - the user performing the action.
file - the pathname of the temporary file where the document is written
Throws:
java.lang.Exception

getCheckOutDir

public static java.lang.String getCheckOutDir(com.dec.avw.core.StepInstance process)
                                       throws java.lang.Exception
Returns the check out directory for the passed process

Throws:
java.lang.Exception

getCheckOutFilePath

public java.lang.String getCheckOutFilePath()
                                     throws java.lang.Exception
Returns the path of the check out directory for this document

Throws:
java.lang.Exception

revert

public void revert()
            throws java.lang.Exception
Performs an undo of checkout by setting status to IN and usedBy to Null. The document written to the file service will not be deleted by this method.

Throws:
java.lang.Exception

revert

public void revert(boolean deleteFile)
            throws java.lang.Exception
Performs an undo of checkout by setting status to IN and usedBy to Null.

Parameters:
deleteFile - if true the file written to the file system by checkout will be deleted, otherwise not
Throws:
java.lang.Exception

getFullName

public java.lang.String getFullName()
Returns the full name of the document which is the name and the extension separated by a dot


write

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

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

isCheckedOut

public boolean isCheckedOut()
Returns if this document is currently checked out


getUsedBy

public User getUsedBy()
Get the user who has locked or checked out the document.

Specified by:
getUsedBy in interface DMSDocForm
Returns:
the user or null if not locked or checked out

saveToLocal

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

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

saveVersionToLocal

public void saveVersionToLocal(long version,
                               java.io.OutputStream os)
                        throws java.lang.Exception
Write the specified document version to the passed stream.

Parameters:
version - the oid of the version which should be written
os - the output stream to write on
Throws:
java.lang.Exception

getExtension

public java.lang.String getExtension()
Returns the extension of the attached document

Specified by:
getExtension in interface DMSDocForm

setExtension

public void setExtension(java.lang.String extension)
Sets the extension of the attached document


getStatus

public int getStatus()
Get the status of the document.

Specified by:
getStatus in interface DMSDocForm
Returns:
one of: IN, OUT, LOCKED

getMessageDigest

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


setContent

public void setContent()
                throws java.lang.Exception
write the content into a byte buffer

Throws:
java.lang.Exception

checkInRemote

public static void checkInRemote(DocForm doc)
                          throws java.lang.Exception
Check in from remote.

Throws:
java.lang.Exception

onInsert

public void onInsert()
              throws java.lang.Exception
Inserts this document and its content

Specified by:
onInsert in interface Persistent
Overrides:
onInsert in class com.dec.avw.core.Form
Throws:
java.lang.Exception

updateContent

public void updateContent()
                   throws java.lang.Exception
Updates the content of this document

Throws:
java.lang.Exception

checkOutRemote

public static DocForm checkOutRemote(long doc,
                                     java.lang.String className,
                                     long user,
                                     long tid)
                              throws java.lang.Exception
check out on start server

Throws:
java.lang.Exception

lock

public void lock(User user)
          throws java.lang.Exception
Locks this document.

Specified by:
lock in interface DMSDocForm
Parameters:
user - the user who performs this action
Throws:
java.lang.Exception

unlock

public void unlock()
            throws java.lang.Exception
Unlocks this document.

Specified by:
unlock in interface DMSDocForm
Throws:
java.lang.Exception

isLocked

public boolean isLocked()
Returns if this document is locked


toString

public java.lang.String toString()
Overrides:
toString in class com.dec.avw.core.Form

toListString

public java.lang.String toListString()
Overrides:
toListString in class com.dec.avw.core.Form

undoCheckOut

public void undoCheckOut()
                  throws java.lang.Exception
Description copied from interface: DMSDocForm
Undoes the check out of the document

Specified by:
undoCheckOut in interface DMSDocForm
Throws:
java.lang.Exception


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