com.sri.emo.dbobj
Class PickList

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.PickList
All Implemented Interfaces:
Cacheable, ContextNested, DataObject, Securable, LookupInterface, IViewable, ModelVisitable, Serializable, Comparable, Comparator

public class PickList
extends RowSecuredDBObject
implements Comparator, Comparable, ModelVisitable, IViewable

Provide picklists for any attribute.

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 ATTRIBUTE_TYPE
           
static String COMMENT
           
static String CONTINUOUS_SMV_TYPE
           
static String DISPLAY_IN_PICKLIST
           
static String DUMMY_NODE_TYPE
          string constant to use for custom pick list which is INDEPENDENT of any given node type.
static String FINITE_SMV_TYPE
           
static String LIST_ID
           
static String NODE_TYPE
           
static String NOT_SPECIFIED_DISPLAY
           
static String ORDER_NUM
           
static String TABLE_NAME
           
static String TASK_SPECIFICATION_MENU_VALUE
           
static String TEMPLATE_MENU_VALUE
           
 
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
PickList()
          constructor without parameters is required by framework, but if you use this constructor, be sure to setRequestingUid() after instantiation
PickList(ControllerRequest request)
           
PickList(ControllerRequest request, String id)
           
PickList(DBConnection theConnection, int theUser)
          Constructor
PickList(ReadOnlyUser theUser)
           
PickList(String nodeType, String attribType)
           
 
Method Summary
 void acceptVisitor(ModelVisitor visitor)
          Accepts the visitor and redirects the visitor to the appropriate type we're dealing with.
 int compare(Object o1, Object o2)
          implement comparator interface
 int compareTo(Object o)
          Compares this object with the specified object for order.
 String getComment()
           
 String getDisplayString()
           
 String getID()
           
 int getIndexNum()
           
 String getNodeType()
           
 String getOrderNum()
           
 int getOrderNumInt()
           
static String getPick(String pickindex)
           
 String getPickAttribType()
           
static String getPickFast(String pickindex, String dbname)
          speedy version that skips permission check (for xml)
static String getPicklistID(String dbName, String nodeType, String attribType, String matchValue)
          determine ID for particular items
 Transition getViewTrans()
          provide a transition for viewing this object, suitable for creating an HTTP link
 void isAllowed(String requestedFunction)
          OVERRIDE to use node type permissions
 boolean isRowAllowed(String requestedFunction)
          determine if this function is allowed for this requesting user
 void setDisplayValue(String descrip)
           
 void setID(String id)
           
 void setNodeType(String type)
           
 void setOrderNum(int order)
           
 void setPickAttribType(String type)
           
protected  void setupFields()
          Defines the database table name and fields for this DB object
 
Methods inherited from class com.jcorporate.expresso.core.dbobj.RowSecuredDBObject
add, add, addGroupPerm, canRequesterAdministrate, canRequesterRead, canRequesterWrite, checkDeleteDetailPerm, checkKeyLength, defaultGroup, defaultPermissions, delete, deleteAll, find, getAdministrateGroups, getGroups, getPermissions, getReadGroups, getWriteGroups, isAdminGroup, isReadGroup, isRowAllowed, isWriteGroup, ownerID, removeGroup, retrieve, searchAndRetrieveList, searchAndRetrieveList, setPermissions, setPermissions, update
 
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, 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, getValues, 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
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

TABLE_NAME

public static final String TABLE_NAME
See Also:
Constant Field Values

NODE_TYPE

public static final String NODE_TYPE
See Also:
Constant Field Values

ATTRIBUTE_TYPE

public static final String ATTRIBUTE_TYPE
See Also:
Constant Field Values

LIST_ID

public static final String LIST_ID
See Also:
Constant Field Values

DISPLAY_IN_PICKLIST

public static final String DISPLAY_IN_PICKLIST
See Also:
Constant Field Values

COMMENT

public static final String COMMENT
See Also:
Constant Field Values

ORDER_NUM

public static final String ORDER_NUM
See Also:
Constant Field Values

NOT_SPECIFIED_DISPLAY

public static final String NOT_SPECIFIED_DISPLAY
See Also:
Constant Field Values

CONTINUOUS_SMV_TYPE

public static final String CONTINUOUS_SMV_TYPE
See Also:
Constant Field Values

FINITE_SMV_TYPE

public static final String FINITE_SMV_TYPE
See Also:
Constant Field Values

TASK_SPECIFICATION_MENU_VALUE

public static final String TASK_SPECIFICATION_MENU_VALUE
See Also:
Constant Field Values

TEMPLATE_MENU_VALUE

public static final String TEMPLATE_MENU_VALUE
See Also:
Constant Field Values

DUMMY_NODE_TYPE

public static String DUMMY_NODE_TYPE
string constant to use for custom pick list which is INDEPENDENT of any given node type. (the node type field requires a value)

Constructor Detail

PickList

public PickList(ReadOnlyUser theUser)
         throws DBException
Throws:
DBException

PickList

public PickList()
         throws DBException
constructor without parameters is required by framework, but if you use this constructor, be sure to setRequestingUid() after instantiation

Throws:
DBException - upon error.

PickList

public PickList(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

PickList

public PickList(ControllerRequest request)
         throws DBException
Throws:
DBException

PickList

public PickList(ControllerRequest request,
                String id)
         throws DBException
Throws:
DBException

PickList

public PickList(String nodeType,
                String attribType)
         throws DBException
Throws:
DBException
Method Detail

getPicklistID

public static String getPicklistID(String dbName,
                                   String nodeType,
                                   String attribType,
                                   String matchValue)
                            throws DBException
determine ID for particular items

Parameters:
dbName - The data context
nodeType - The node type.
attribType - The attribute type.
matchValue - the picklist value.
Returns:
id for specified menu value, or null if not found.
Throws:
DBException - upon error.

getID

public String getID()
             throws DBException
Throws:
DBException

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

compare

public int compare(Object o1,
                   Object o2)
implement comparator interface

Specified by:
compare in interface Comparator
See Also:
Comparator

getOrderNum

public String getOrderNum()
                   throws DBException
Throws:
DBException

getOrderNumInt

public int getOrderNumInt()
                   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.

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.

getPick

public static String getPick(String pickindex)
                      throws DBException
Parameters:
pickindex -
Returns:
String that is display value for given ID, or null if not found
Throws:
DBException - upon error.

getPickFast

public static String getPickFast(String pickindex,
                                 String dbname)
                          throws DBException
speedy version that skips permission check (for xml)

Returns:
String that is display value for given ID, or null if not found
Throws:
DBException - upon error.

getIndexNum

public int getIndexNum()
                throws DBException
Returns:
id which is unique across all lists--index num in table
Throws:
DBException

getDisplayString

public String getDisplayString()
                        throws DBException
Throws:
DBException

setID

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

getPickAttribType

public String getPickAttribType()
                         throws DBException
Throws:
DBException

setPickAttribType

public void setPickAttribType(String type)
                       throws DBException
Throws:
DBException

getNodeType

public String getNodeType()
                   throws DBException
Throws:
DBException

setNodeType

public void setNodeType(String type)
                 throws DBException
Throws:
DBException

setOrderNum

public void setOrderNum(int order)
                 throws DBException
Throws:
DBException

getComment

public String getComment()
                  throws DBException
Throws:
DBException

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 database access 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

isAllowed

public void isAllowed(String requestedFunction)
               throws SecurityException,
                      DBException
OVERRIDE to use node type permissions

Specified by:
isAllowed in interface Securable
Overrides:
isAllowed in class SecuredDBObject
Parameters:
requestedFunction - The code of the requested function. The codes are:
  1. A: Add
  2. S: Search
  3. U: Update
  4. D: Delete
Throws:
DBException - If the requested operation is not permitted to this user
SecurityException - if the user is not allowed access to the object.

isRowAllowed

public boolean isRowAllowed(String requestedFunction)
                     throws DBException
determine if this function is allowed for this requesting user

Overrides:
isRowAllowed in class RowSecuredDBObject
Parameters:
requestedFunction - code for function -- Add, Update, Delete, Search (read)
Returns:
true if this function is allowed for this requesting user
Throws:
SecurityException - (unchecked) if not allowed
DBException - for other data-related errors.

setDisplayValue

public void setDisplayValue(String descrip)
                     throws DBException
Throws:
DBException


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