com.sri.emo.dbobj
Class NodeType

java.lang.Object
  extended by com.jcorporate.expresso.core.dataobjects.BaseDataObject
      extended by com.jcorporate.expresso.core.dataobjects.jdbc.JDBCDataObject
          extended by com.jcorporate.expresso.core.dbobj.DBObject
              extended by com.jcorporate.expresso.core.dbobj.SecuredDBObject
                  extended by com.jcorporate.expresso.core.dbobj.RowSecuredDBObject
                      extended by com.sri.emo.dbobj.NodeType
All Implemented Interfaces:
Cacheable, ContextNested, DataObject, Securable, LookupInterface, IViewable, ModelVisitable, Serializable, Comparable

public class NodeType
extends RowSecuredDBObject
implements Comparable, ModelVisitable, IViewable

Encapsulate the finite list of types allowed for a node.

Author:
larry hamel
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.jcorporate.expresso.core.dbobj.DBObject
DBObject.FieldError, DBObject.FieldUpdate
 
Field Summary
static String ANY_OBJECT
           
static String DISPLAY_TITLE
           
static String NODE_TYPE_DESCRIP
           
static String NODE_TYPE_HANDLER
          Class name for special handling if any.
static String NODE_TYPE_ID
           
static String NODE_TYPE_NAME
           
static String NODE_TYPE_TABLE_NAME
           
static String NODE_TYPE_VERSION
           
static String USE_ID_FOR_REFERENCE
          boolean for whether, when outputting xml, this node type should be 'abbreviated' as an ID rather than a full XML tree.
 
Fields inherited from class com.jcorporate.expresso.core.dbobj.RowSecuredDBObject
DEFAULT_PERMISSION_CODE
 
Fields inherited from class com.jcorporate.expresso.core.dbobj.SecuredDBObject
ADD, ALL_FUNCTIONS, CACHE_NAME, CACHE_TTY, DELETE, SEARCH, SYSTEM_ACCOUNT_NAME, UPDATE
 
Fields inherited from class com.jcorporate.expresso.core.dbobj.DBObject
ATTRIBUTE_ERROR, ATTRIBUTE_ERROR_MESSAGE, ATTRIBUTE_PAGE_LIMIT, BIG_DECIMAL_ZERO, CACHE_LIMIT_PERCENT, CACHE_LIMIT_TTL, EMAIL_MASK, EVENT_ADD, EVENT_DELETE, EVENT_UPDATE, FLOAT_MASK, INT_MASK, IS_CHECK_RELATIONAL_INTEGRITY, IS_MUTABLE, sCacheStats, UPDATE_CHANGED_ONLY, WHERE_KEYWORD
 
Fields inherited from class com.jcorporate.expresso.core.dataobjects.jdbc.JDBCDataObject
anyFieldsDistinct, anyFieldsToInput, anyFieldsToRetrieve, appendCustomWhere, caseSensitiveQuery, customWhereClause, dbKey, distinctFields, inputFields, localConnection, LONGBINARY_READ_DEFAULT_SIZE, maxRecords, myClassName, myUpdates, offsetRecord, recordSet, retrieveFields, sMetadataMap, sortKeys
 
Fields inherited from class com.jcorporate.expresso.core.dataobjects.BaseDataObject
currentStatus, globalMask
 
Fields inherited from interface com.jcorporate.expresso.core.dataobjects.Securable
SYSTEM_ACCOUNT
 
Fields inherited from interface com.jcorporate.expresso.core.dataobjects.DataObject
STATUS_CURRENT, STATUS_DELETED, STATUS_NEW, STATUS_UPDATED
 
Constructor Summary
NodeType()
          Default constructor for NodeType creates a new object of this type with no connection yet allocated.
NodeType(DBConnection theConnection, int theUser)
          Constructor
NodeType(ExpressoRequest request)
          Deprecated. Use RequestRegistry to propagate request contexts.
NodeType(ReadOnlyUser userSecurityContext)
          Constructor that takes the user security context.
 
Method Summary
 void acceptVisitor(ModelVisitor visitor)
          Accepts the visitor and redirects the visitor to the appropriate type we're dealing with.
 void add()
          If the user is allowed to add, invoke the superclass add
 int compareTo(Object o)
          Compares this object with the specified object for order.
 List getAllNodes()
          Potentially hazardous function due to memory requirements for lots of nodes, but for small node sets, this is a valueable function for navigating the hierarchy of nodes.
static NodeType[] getAllTypes()
           
 INodeHandler getCustomHandler()
          Retrieve a custom handler, null if there is none.
 String getDisplayName()
           
static String getDisplayName(String type)
          Convenience method.
 String getEntityDescription()
           
 String getEntityName()
           
static NodeType getFromId(int id)
           
static NodeType getFromTypeString(String s)
           
 String getId()
           
 Part[] getParts()
          queries db for all parts; not efficient for repeated use.
 String getSpecialHandlerName()
           
 Vector getValues()
          Override of getValues to provide specific name to display formatting.
 String getVersion()
           
 Transition getViewTrans()
          provide a transition for viewing this object, suitable for creating an HTTP link
 boolean hasCustomHandler()
           
 void incrementVersion()
           
 boolean isReferenceIdPreferred()
          Whether or not this node type prefers to export xml as a reference or not.
 void isReferenceIdPreferred(boolean is)
          Whether or not this node type prefers to export xml as a reference or not.
static boolean isValidType(String type)
           
 void setCustomHandler(String customHandler)
           
 void setDisplayName(String name)
           
 void setEntityDescription(String s)
           
 void setEntityName(String defaultType)
          set name.
 void setId(String id)
           
protected  void setupFields()
          Defines the database table name and fields for this DB object
 void update()
          Update the database with the new info SIDE-EFFECT: increments version number each time there is an update
 
Methods inherited from class com.jcorporate.expresso.core.dbobj.RowSecuredDBObject
add, addGroupPerm, canRequesterAdministrate, canRequesterRead, canRequesterWrite, checkDeleteDetailPerm, checkKeyLength, defaultGroup, defaultPermissions, delete, deleteAll, find, getAdministrateGroups, getGroups, getPermissions, getReadGroups, getWriteGroups, isAdminGroup, isReadGroup, isRowAllowed, isRowAllowed, isWriteGroup, ownerID, removeGroup, retrieve, searchAndRetrieveList, searchAndRetrieveList, setPermissions, setPermissions
 
Methods inherited from class com.jcorporate.expresso.core.dbobj.SecuredDBObject
canRequesterAdd, canRequesterDelete, canRequesterUpdate, checkAllowed, copyAttributes, count, createSecurityCache, delete, getRequestingUid, getRequestingUser, getString, getString, getString, getString, getString, getString, getSystemUid, instantiate, isAllowed, search, setRequestingUid, setRequestingUser
 
Methods inherited from class com.jcorporate.expresso.core.dbobj.DBObject
addDetail, addField, addField, addFieldError, addFoundKeys, addIfNeeded, addIndex, addKey, addMaster, addOrUpdate, addSortKey, addTransition, addVirtualField, addVirtualField, addVirtualField, addVirtualField, average, basicAdd, cacheIsChangedComparison, canUseRetrieve, checkAllReferredToBy, checkAllRefs, checkAllRefsPublic, checkField, checkMutable, checkRef, checkRef, clear, clearDistinctFields, clearError, clearFieldsToInput, clearFieldsToRetrieve, clearSortKeys, clone, containsWildCards, copyAllFields, deleteAll, deleteDetails, denotesRange, equals, fetchImmut, fetchImmutable, forKey, formatDateTime, get, getAllAttributes, getAttribute, getAttributesIterator, getBooleanFieldValue, getCacheSize, getCacheStatsMap, getCacheUtil, getCheckZeroUpdate, getCustomWhereClause, getDataContext, getDataField, getDataTransferObject, getDBName, getDetails, getDistinctFieldCount, getDistinctFields, getField, getFieldAttributesIterator, getFieldBigDecimal, getFieldBoolean, getFieldByte, getFieldByteArray, getFieldData, getFieldDate, getFieldDecimalFormatted, getFieldDouble, getFieldErrorMessage, getFieldFloat, getFieldInt, getFieldLong, getFieldMetaData, getFieldShort, getFieldsToInputCount, getFieldsToRetrieveCount, getFilterClass, getFoundCount, getFoundKeysArray, getIndexArray, getISOValuesDefault, getISOValuesDefault, getISOValuesDefault, getKey, getKeyFieldListIterator, getLength, getLengthInt, getLocale, getLogger, getLookupObject, getMax, getMax, getMaxRecords, getMyKeys, getMyUpdatesArray, getOffsetRecord, getPatternMatcher, getPrecision, getSerializedForm, getSizeEstimate, getStringFilter, getThisDBbj, getThisDBObj, getValidValueDescrip, getValidValues, getValidValuesList, getValuesDefault, getValuesDefault, getValuesDefault, hasError, hasErrors, haveAllKeys, initialize, isCached, isChanged, isDistinct, isEmpty, isFieldDistinct, isFieldNull, isFieldsToInput, isFieldsToRetrieve, isFieldToRetrieve, isMultiValued, isMutable, isMutable, isReadOnly, isSecret, isVirtual, loadFromConnection, logChange, max, min, newInstance, noNewLine, noQuotes, notifyListeners, populateDefaultValues, referredToBy, removeAttribute, removeFromCache, retrieveFromCache, saveBinaryField, search, set, setAttribute, setCacheLimit, setCacheLimit, setCacheLimitAsPercent, setCacheSize, setCharset, setCheckZeroUpdate, setConnection, setConnection, setCustomWhereClause, setCustomWhereClause, setDataContext, setDataField, setDataTransferObject, setDefaultValue, setDescription, setField, setField, setField, setField, setField, setField, setField, setField, setField, setField, setFieldData, setFieldData, setFieldDistinct, setFieldsToInput, setFieldsToRetrieve, setFilterClass, setFilterClass, setKey, setKeys, setLocale, setLookupField, setLookupObject, setMask, setMaxRecords, setMultiValued, setName, setOffsetRecord, setReadOnly, setSchema, setSecret, setSortKey, setStringFilter, setStringFiltersOnAll, setTargetDbSchema, setTargetTable, sqlAggrFunction, sum, toDebugString, update, updateAll, updateAll, updateIsChanged, verify
 
Methods inherited from class com.jcorporate.expresso.core.dataobjects.jdbc.JDBCDataObject
addInParam, addOutParam, buildWhereClause, buildWhereClauseBuffer, checkZeroUpdate, constructNewMetaData, createAndExecuteSearch, createAndRunStoreProcedure, createSQLSelectStatement, createSQLSelectStatement, getConnectionPool, getCustomStringFieldValue, getDef, getDistinctFieldArrayList, getExecutor, getFieldsToInputIterator, getFieldsToRetrieveIterator, getJDBCMetaData, getJDBCUtil, getLocalConnection, getMappedDataContext, getMetaData, getQueryInterface, getSerialForm, loadFromConnection, makeLimitationStub, quoteIfNeeded, runStoredProcedure, runStoredProcedureAndRetrieveList, selectFieldString, setCaseSensitiveQuery, setDBConnectionPool, setDBName, setMappedDataContext, setOriginalDBName, setTargetStoreProcedure
 
Methods inherited from class com.jcorporate.expresso.core.dataobjects.BaseDataObject
getGlobalMask, getStatus, isGlobalMasked, setFieldsWithDefaults, setGlobalMask, setStatus
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NODE_TYPE_TABLE_NAME

public static final String NODE_TYPE_TABLE_NAME
See Also:
Constant Field Values

NODE_TYPE_ID

public static final String NODE_TYPE_ID
See Also:
Constant Field Values

NODE_TYPE_NAME

public static final String NODE_TYPE_NAME
See Also:
Constant Field Values

DISPLAY_TITLE

public static final String DISPLAY_TITLE
See Also:
Constant Field Values

NODE_TYPE_DESCRIP

public static final String NODE_TYPE_DESCRIP
See Also:
Constant Field Values

NODE_TYPE_VERSION

public static final String NODE_TYPE_VERSION
See Also:
Constant Field Values

NODE_TYPE_HANDLER

public static final String NODE_TYPE_HANDLER
Class name for special handling if any.

See Also:
Constant Field Values

USE_ID_FOR_REFERENCE

public static final String USE_ID_FOR_REFERENCE
boolean for whether, when outputting xml, this node type should be 'abbreviated' as an ID rather than a full XML tree. Useful for large objects (like template, design pattern)

See Also:
Constant Field Values

ANY_OBJECT

public static final String ANY_OBJECT
See Also:
Constant Field Values
Constructor Detail

NodeType

public NodeType()
         throws DBException
Default constructor for NodeType creates a new object of this type with no connection yet allocated.

Throws:
DBException - If the new object cannot be created

NodeType

public NodeType(ExpressoRequest request)
         throws DBException
Deprecated. Use RequestRegistry to propagate request contexts.

Do not use anymore.

Parameters:
request - ExpressoRequest
Throws:
DBException

NodeType

public NodeType(DBConnection theConnection,
                int theUser)
         throws DBException
Constructor

Parameters:
theConnection - DBConnection to be used to communicate with the database
theUser - User name attempting to access the object
Throws:
DBException - If the user cannot access this object or the object cannot be initialized

NodeType

public NodeType(ReadOnlyUser userSecurityContext)
         throws DBException
Constructor that takes the user security context.

Parameters:
userSecurityContext - ReadOnlyUser
Throws:
DBException - upon construction error
Method Detail

setupFields

protected void setupFields()
                    throws DBException
Defines the database table name and fields for this DB object

Overrides:
setupFields in class DBObject
Throws:
DBException - if the operation cannot be performed

getDisplayName

public static String getDisplayName(String type)
                             throws DBException
Convenience method.

Parameters:
type - the internal entity name
Returns:
String the display name.
Throws:
DBException - upon database access error.

isValidType

public static boolean isValidType(String type)

getId

public String getId()
             throws DBException
Throws:
DBException

getEntityName

public String getEntityName()
                     throws DBException
Throws:
DBException

getEntityDescription

public String getEntityDescription()
                            throws DBException
Throws:
DBException

setId

public void setId(String id)
           throws DBException
Throws:
DBException

getDisplayName

public String getDisplayName()
                      throws DBException
Throws:
DBException

getParts

public Part[] getParts()
                throws DBException
queries db for all parts; not efficient for repeated use.

Returns:
an array of parts
Throws:
DBException - upon database access error.
See Also:
for more efficient (cached) usage

getAllNodes

public List getAllNodes()
                 throws DBException
Potentially hazardous function due to memory requirements for lots of nodes, but for small node sets, this is a valueable function for navigating the hierarchy of nodes.

Returns:
List of nodes.
Throws:
DBException

setEntityName

public void setEntityName(String defaultType)
                   throws DBException
set name. this is NOT primary key

Parameters:
defaultType - the type name
Throws:
DBException - upon database access error.

getAllTypes

public static NodeType[] getAllTypes()
                              throws DBException
Throws:
DBException

getFromId

public static NodeType getFromId(int id)
                          throws DBException
Throws:
DBException

getFromTypeString

public static NodeType getFromTypeString(String s)
                                  throws DBException
Throws:
DBException

getVersion

public String getVersion()
                  throws DBException
Throws:
DBException

getValues

public Vector getValues()
                 throws DBException
Override of getValues to provide specific name to display formatting.

Specified by:
getValues in interface LookupInterface
Overrides:
getValues in class DBObject
Returns:
Vector of ValidValue Value/Description pairs Node Types
Throws:
DBException - If the values cannot be retrieved

getSpecialHandlerName

public String getSpecialHandlerName()
                             throws DBException
Throws:
DBException

add

public void add()
         throws DBException
If the user is allowed to add, invoke the superclass add

Specified by:
add in interface DataObject
Overrides:
add in class RowSecuredDBObject
Throws:
DBException - If the user is not permitted to add or if the add fails

update

public void update()
            throws DBException
Update the database with the new info SIDE-EFFECT: increments version number each time there is an update

Specified by:
update in interface DataObject
Overrides:
update in class RowSecuredDBObject
Throws:
DBException - if update is not allowed for the current user

incrementVersion

public void incrementVersion()
                      throws DBException
Throws:
DBException

hasCustomHandler

public boolean hasCustomHandler()
                         throws DBException
Throws:
DBException

getCustomHandler

public INodeHandler getCustomHandler()
                              throws DBException
Retrieve a custom handler, null if there is none.

Returns:
the custom handler or null if this part does not have one
Throws:
DBException - upon database access error.

setCustomHandler

public void setCustomHandler(String customHandler)
                      throws DBException
Throws:
DBException

compareTo

public int compareTo(Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

In the foregoing description, the notation sgn(expression) designates the mathematical signum function, which is defined to return one of -1, 0, or 1 according to whether the value of expression is negative, zero or positive.

The implementor must ensure sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception iff y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y)>0 && y.compareTo(z)>0) implies x.compareTo(z)>0.

Finally, the implementer must ensure that x.compareTo(y)==0 implies that sgn(x.compareTo(z)) == sgn(y.compareTo(z)), for all z.

It is strongly recommended, but not strictly required that (x.compareTo(y)==0) == (x.equals(y)). Generally speaking, any class that implements the Comparable interface and violates this condition should clearly indicate this fact. The recommended language is "Note: this class has a natural ordering that is inconsistent with equals."

Specified by:
compareTo in interface Comparable
Parameters:
o - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
ClassCastException - if the specified object's type prevents it from being compared to this Object.

setDisplayName

public void setDisplayName(String name)
                    throws DBException
Throws:
DBException

setEntityDescription

public void setEntityDescription(String s)
                          throws DBException
Throws:
DBException

isReferenceIdPreferred

public boolean isReferenceIdPreferred()
                               throws DBException
Whether or not this node type prefers to export xml as a reference or not.

(large entities like template and ed. standard prefer being exported as refs)

Returns:
boolean
Throws:
DBException - upon database access error.

isReferenceIdPreferred

public void isReferenceIdPreferred(boolean is)
                            throws DBException
Whether or not this node type prefers to export xml as a reference or not.

(large entities like template and ed. standard prefer being exported as refs)

Parameters:
is - boolean
Throws:
DBException - upon database access error.

getViewTrans

public Transition getViewTrans()
                        throws DBException
provide a transition for viewing this object, suitable for creating an HTTP link

Specified by:
getViewTrans in interface IViewable
Returns:
transtion for viewing, including label for name of object; never null
Throws:
DBException - upon self-query error.

acceptVisitor

public void acceptVisitor(ModelVisitor visitor)
Description copied from interface: ModelVisitable
Accepts the visitor and redirects the visitor to the appropriate type we're dealing with.

Specified by:
acceptVisitor in interface ModelVisitable
Parameters:
visitor - ViewVisitor


Copyright © 2004-2006 Codeguild, Inc.. All Rights Reserved.