com.wm.app.tn.doc
Class BizDocTypeReg

java.lang.Object
  extended by com.wm.app.tn.doc.BizDocTypeReg

public class BizDocTypeReg
extends java.lang.Object

A registry for BizDocTypes. Included are methods for adding/deleting/updating the BizDocTypes and for determining the document type of a document.


Field Summary
static boolean cacheXQLQueryResults
           
 
Constructor Summary
BizDocTypeReg()
           
 
Method Summary
 void add(BizDocType bdt)
          Adds a BizDocType to the registry.
 java.util.Hashtable getFamilyMap()
           
 BizDocType getType(java.lang.String id)
          Retrieves a BizDocType.
 BizDocType[] getTypes()
          Retrieves all BizDocTypes.
 BizDocType[] getTypes(java.lang.String className)
          Retrieves all BizDocTypes in a family.
 void mapMonitoredAttributes(com.wm.data.IData in, BizDocEnvelope env)
           
 java.util.Vector recognize(com.wm.data.IData in)
          Tries to determine the type(s) of the inputted document based upon the existing lists of BizDocType(s).
 java.lang.String[] recognizeAll(com.wm.data.IData in)
          Returns a list of all matching document types
 BizDocEnvelope recognizeAndCreate(com.wm.data.IData in)
          Tries to determine the type of the inputted document based upon the existing lists of biz document types and returns a new BizDocEnvelope.
 BizDocType remove(BizDocType bdt)
          Removes a BizDocType from the registry.
 java.lang.String toString()
           
 BizDocType update(BizDocType bdt)
          Updates a BizDocType.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cacheXQLQueryResults

public static boolean cacheXQLQueryResults
Constructor Detail

BizDocTypeReg

public BizDocTypeReg()
Method Detail

add

public void add(BizDocType bdt)
Adds a BizDocType to the registry. It is up to the user of this method to create the specific BizDocType.

Parameters:
bdt - BizDocType to be added to the registry
Throws:
BizDocTypeException - may be thrown if the type exists Note: The id of the BizDocType needs to be unique across all concrete types. The best way to get a unique id is to call com.wm.app.tn.db.Counter.next().

remove

public BizDocType remove(BizDocType bdt)
Removes a BizDocType from the registry.

Parameters:
name - name of the BizDocType
Returns:
the removed BizDocType (possibly null)

update

public BizDocType update(BizDocType bdt)
                  throws BizDocTypeRegException
Updates a BizDocType.

Parameters:
bdt - updated BizDocType replacing old one
Returns:
the old BizDocType
Throws:
BizDocTypeException - may be thrown if the type does not exist
BizDocTypeRegException

getType

public BizDocType getType(java.lang.String id)
Retrieves a BizDocType.

Parameters:
id - id of the BizDocType to be retrieved
Returns:
BizDocType object for the associated name. Will return UnknownDocType if type does not exist

getTypes

public BizDocType[] getTypes(java.lang.String className)
Retrieves all BizDocTypes in a family.

Parameters:
className - class name of the concreate BizDocType of interest
Returns:
array of all the concrete BizDocTypes specified in the param or null if non-existent

getTypes

public BizDocType[] getTypes()
Retrieves all BizDocTypes.

Returns:
array of all BizDocTypes in the registry or null if none exist

getFamilyMap

public java.util.Hashtable getFamilyMap()

recognize

public java.util.Vector recognize(com.wm.data.IData in)
                           throws BizDocTypeException
Tries to determine the type(s) of the inputted document based upon the existing lists of BizDocType(s).

Parameters:
in - IData object containing keyword and document data
Returns:
a vector of BizDocType(s) (if no matches were found, the Vector will contain one element - an UnknowDocType)
Throws:
BizDocTypeException

recognizeAll

public java.lang.String[] recognizeAll(com.wm.data.IData in)
                                throws BizDocTypeException
Returns a list of all matching document types

Parameters:
in - IData object containing keyword and document data
Returns:
a list of all matching document types (last should be the unknown document type)
Throws:
BizDocTypeException

recognizeAndCreate

public BizDocEnvelope recognizeAndCreate(com.wm.data.IData in)
                                  throws BizDocTypeException
Tries to determine the type of the inputted document based upon the existing lists of biz document types and returns a new BizDocEnvelope. If the type cannot be determined (including multiple matches) then a BizDocEnvelope with an UnknownDocType is created. If multiple matches are found then an ActivityLogEntry error is created with a list of all the matching types and added to the BizDocErrorSet of the BizDocEnvelope.

Parameters:
in - IData object containing keyword and document data
Returns:
a new BizDocEnvelope
Throws:
BizDocTypeException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

mapMonitoredAttributes

public void mapMonitoredAttributes(com.wm.data.IData in,
                                   BizDocEnvelope env)