Expresso 5-5-0

com.jcorporate.expresso.services.dbobj
Class UserGroup

java.lang.Object
  extended bycom.jcorporate.expresso.core.dataobjects.BaseDataObject
      extended bycom.jcorporate.expresso.core.dataobjects.jdbc.JDBCDataObject
          extended bycom.jcorporate.expresso.core.dbobj.DBObject
              extended bycom.jcorporate.expresso.core.dbobj.SecuredDBObject
                  extended bycom.jcorporate.expresso.services.dbobj.SecurityDBObject
                      extended bycom.jcorporate.expresso.services.dbobj.UserGroup
All Implemented Interfaces:
Cacheable, ContextNested, DataObject, LookupInterface, Securable, Serializable

public class UserGroup
extends SecurityDBObject

UserGroup.java

Copyright 1999-2002 Jcorporate Ltd.

UserGroup is a grouping of a number of users for security purposes. Modern terms would call this a Role table. Groups are the equivalant under a different name

Since:
Expresso 1.0
Version:
$Revision: 1.19 $ $Date: 2004/04/04 08:02:51 $
Author:
Michael Nash
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class com.jcorporate.expresso.core.dbobj.DBObject
DBObject.FieldError, DBObject.FieldUpdate
 
Field Summary
static String ADMIN_GROUP
           
static String ALL_USERS_GROUP
          used as default group for all users who register and their reg domain has no other group set
static String DEMO_GROUP
           
static int GROUP_DESCRIP_MAX_LEN
           
static String GROUP_DESCRIPTION
           
static String GROUP_NAME_FIELD
           
static int GROUP_NAME_MAX_LEN
           
static String NOT_REG_USERS_GROUP
           
static String UNKNOWN_USERS_GROUP
          groups created as part of DBTool.setupSecurity bootstrap
 
Fields inherited from class com.jcorporate.expresso.services.dbobj.SecurityDBObject
SECURITY_CONTEXT, SECURITY_OBJECTS
 
Fields inherited from class com.jcorporate.expresso.core.dbobj.SecuredDBObject
ADD, ALL_FUNCTIONS, CACHE_NAME, CACHE_TTY, DELETE, SEARCH, SYSTEM_ACCOUNT, 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, EMAIL_MASK, FLOAT_MASK, INT_MASK, IS_CHECK_RELATIONAL_INTEGRITY
 
Fields inherited from class com.jcorporate.expresso.core.dataobjects.jdbc.JDBCDataObject
anyFieldsDistinct, anyFieldsToRetrieve, appendCustomWhere, caseSensitiveQuery, customWhereClause, dbKey, distinctFields, localConnection, maxRecords, myClassName, myUpdates, offsetRecord, recordSet, retrieveFields, sMetadataMap, sortKeys
 
Fields inherited from class com.jcorporate.expresso.core.dataobjects.BaseDataObject
currentStatus
 
Fields inherited from interface com.jcorporate.expresso.core.dataobjects.DataObject
STATUS_CURRENT, STATUS_DELETED, STATUS_NEW, STATUS_UPDATED
 
Constructor Summary
UserGroup()
           
UserGroup(ControllerRequest request)
          For using DBObjects within Controllers.
UserGroup(int uid)
          Initializes the usergroup with the permissions of the given user.
 
Method Summary
protected  void checkAllReferredToBy()
          Check referential integrity of objects referring to this object
 void delete()
          Extend the super.delete() method to first delete the GroupMembers elements that refer to the group being deleted
static UserGroup getGroup(String groupname)
           
 String getGroupDescription()
          convenience method
 String getGroupName()
          convenience method
 Vector getValues()
          Gets the valid values, specifically it returns a map of GroupNames to GroupDescriptions
 void populateDefaultValues()
          Populates the default user groups.
 void setGroupName(String groupName)
          convenience method
protected  void setupFields()
          Method to set up the fields for this database object.
 
Methods inherited from class com.jcorporate.expresso.services.dbobj.SecurityDBObject
overrideDataContext, setDataContext, setDBName
 
Methods inherited from class com.jcorporate.expresso.core.dbobj.SecuredDBObject
add, canRequesterAdd, canRequesterDelete, canRequesterRead, canRequesterUpdate, checkAllowed, copyAttributes, count, createSecurityCache, deleteAll, find, getCharset, getDescription, getDescription, getRequestingUid, getString, getString, getString, getString, getString, getString, getSystemUid, getUser, getUserName, instantiate, isAllowed, retrieve, search, searchAndRetrieveList, searchAndRetrieveList, setRequestingUid, setUser, update
 
Methods inherited from class com.jcorporate.expresso.core.dbobj.DBObject
addCacheEventListener, addDetail, addField, addField, addFieldError, addFoundKeys, addIfNeeded, addIndex, addKey, addOrUpdate, addSortKey, addToCache, addTransition, addVirtualField, addVirtualField, addVirtualField, addVirtualField, allowsNull, average, basicAdd, checkAllRefs, checkAllRefsPublic, checkDeleteDetailPerm, checkField, checkRef, checkRef, clear, clearDistinctFields, clearError, clearFieldsToRetrieve, clearSortKeys, containsWildCards, delete, deleteDetails, denotesRange, disableLogging, enableLogging, equals, forKey, formatDateTime, get, getAllAttributes, getAllDBFields, getAllFields, getAllFieldsIterator, getAllFieldsMap, getAllKeys, getAllKeysIterator, getAllKeysMap, getAttribute, getAttribute, getAttributesIterator, getBinaryField, getBooleanFieldValue, getCacheSize, getCacheStats, getCacheStatsMap, getCheckZeroUpdate, getCustomWhereClause, getDataContext, getDataField, getDataTransferObject, getDBName, getDefaultValue, getDetailFieldsForeign, getDetailFieldsLocal, getDetails, getDistinctFieldCount, getDistinctFieldList, getDistinctFields, getField, getFieldBigDecimal, getFieldBoolean, getFieldByte, getFieldData, getFieldDate, getFieldDecimalFormatted, getFieldDouble, getFieldErrorMessage, getFieldFloat, getFieldInt, getFieldList, getFieldListArray, getFieldListIterator, getFieldLong, getFieldMetaData, getFields, getFieldShort, getFieldsToRetrieveCount, getFilterClass, getFoundCount, getFoundKeys, getFoundKeysArray, getIndexArray, getISOValuesDefault, getISOValuesDefault, getISOValuesDefault, getKey, getKeyFieldList, getKeyFieldListArray, getKeyFieldListIterator, getLength, getLengthInt, getLimitationPosition, getLimitationSyntax, getLocalConnection, getLocale, getLookupObject, getMax, getMax, getMaxRecords, getMyKeys, getMyUpdates, getMyUpdatesArray, getName, getOffsetRecord, getOriginalDBName, getPatternMatcher, getPrecision, getRecordSet, getRecordSetArrayList, getSchema, getSerializedForm, getStringFilter, getTableName, getTargetTable, getThisDBbj, getThisDBObj, getTransitionsIterator, getType, getValidValueDescrip, getValidValues, getValidValuesList, getValuesDefault, getValuesDefault, getValuesDefault, hasError, hasErrors, hasField, hasIndex, haveAllKeys, initialize, isCached, isDateType, isDistinct, isEmpty, isField, isFieldDistinct, isFieldIgnoreCase, isFieldNull, isFieldsToRetrieve, isFieldToRetrieve, isMultiValued, isNumericType, isQuotedType, isReadOnly, isSecret, isVirtual, loadFromConnection, logChange, max, min, newInstance, noNewLine, noQuotes, notifyListeners, referredToBy, removeAttribute, removeAttribute, removeFromCache, retrieveFromCache, saveBinaryField, saveBinaryField, search, set, setAttribute, setAttribute, setCacheSize, setCharset, setCheckZeroUpdate, setConnection, setConnection, setCustomWhereClause, setCustomWhereClause, setDataField, setDataTransferObject, setDefaultValue, setDescription, setField, setField, setField, setField, setField, setField, setField, setField, setField, setFieldData, setFieldDistinct, setFieldsToRetrieve, setFilterClass, setFilterClass, setKeys, setLocale, setLookupField, setLookupObject, setMask, setMaxRecords, setMultiValued, setName, setOffsetRecord, setReadOnly, setSchema, setSchema, setSecret, setSortKey, setStringFilter, setStringFiltersOnAll, setTargetTable, sqlAggrFunction, sum, toDebugString, update, verify
 
Methods inherited from class com.jcorporate.expresso.core.dataobjects.jdbc.JDBCDataObject
buildWhereClause, buildWhereClauseBuffer, checkZeroUpdate, constructNewMetaData, createAndExecuteSearch, getConnectionPool, getCustomStringFieldValue, getDef, getDistinctFieldArrayList, getExecutor, getFieldsToRetrieveIterator, getJDBCMetaData, getJDBCUtil, getMappedDataContext, getMetaData, getQueryInterface, getSerialForm, loadFromConnection, makeLimitationStub, quoteIfNeeded, selectFieldString, setCaseSensitiveQuery, setDBConnectionPool, setMappedDataContext, setOriginalDBName
 
Methods inherited from class com.jcorporate.expresso.core.dataobjects.BaseDataObject
getStatus, setStatus
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GROUP_NAME_FIELD

public static final String GROUP_NAME_FIELD
See Also:
Constant Field Values

GROUP_DESCRIPTION

public static final String GROUP_DESCRIPTION
See Also:
Constant Field Values

GROUP_NAME_MAX_LEN

public static final int GROUP_NAME_MAX_LEN
See Also:
Constant Field Values

GROUP_DESCRIP_MAX_LEN

public static final int GROUP_DESCRIP_MAX_LEN
See Also:
Constant Field Values

ALL_USERS_GROUP

public static final String ALL_USERS_GROUP
used as default group for all users who register and their reg domain has no other group set

See Also:
SimpleRegistration, Constant Field Values

DEMO_GROUP

public static final String DEMO_GROUP
See Also:
Constant Field Values

UNKNOWN_USERS_GROUP

public static final String UNKNOWN_USERS_GROUP
groups created as part of DBTool.setupSecurity bootstrap

See Also:
Constant Field Values

NOT_REG_USERS_GROUP

public static final String NOT_REG_USERS_GROUP
See Also:
Constant Field Values

ADMIN_GROUP

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

UserGroup

public UserGroup()
          throws DBException
Throws:
DBException
See Also:
SecuredDBObject

UserGroup

public UserGroup(int uid)
          throws DBException
Initializes the usergroup with the permissions of the given user.

Parameters:
uid - the User's uid
Throws:
DBException - upon instantion error

UserGroup

public UserGroup(ControllerRequest request)
          throws DBException
For using DBObjects within Controllers. Initializes based upon the current user and the requested db. [Of course this can be modified later]

Parameters:
request - - The controller request handed to you by the framework.
Throws:
DBException
Method Detail

checkAllReferredToBy

protected void checkAllReferredToBy()
                             throws DBException
Check referential integrity of objects referring to this object

Overrides:
checkAllReferredToBy in class DBObject
Throws:
DBException - If the integrity cannot be verified

delete

public void delete()
            throws DBException
Extend the super.delete() method to first delete the GroupMembers elements that refer to the group being deleted

Specified by:
delete in interface DataObject
Overrides:
delete in class SecuredDBObject
Throws:
DBException

setupFields

protected void setupFields()
                    throws DBException
Description copied from class: DBObject
Method to set up the fields for this database object. This method should be defined in the implementing object and should make calls to addField, addKey, setMultiValued, etc. as required to define the content of the DBObject. Each setupFields method should call "super.setupFields()" so that field definitions can be "inheritcable"

Overrides:
setupFields in class DBObject
Throws:
DBException
See Also:
SecuredDBObject

getValues

public Vector getValues()
                 throws DBException
Gets the valid values, specifically it returns a map of GroupNames to GroupDescriptions

Specified by:
getValues in interface LookupInterface
Overrides:
getValues in class DBObject
Returns:
a vector of valid values.
Throws:
DBException
See Also:
DBObject.getValidValues(java.lang.String)

populateDefaultValues

public void populateDefaultValues()
                           throws DBException
Populates the default user groups.

Overrides:
populateDefaultValues in class DBObject
Throws:
DBException

getGroupName

public String getGroupName()
                    throws DBException
convenience method

Returns:
name of group
Throws:
DBException - upon error

setGroupName

public void setGroupName(String groupName)
                  throws DBException
convenience method

Parameters:
groupName - the new gropu name
Throws:
DBException - upon error

getGroup

public static UserGroup getGroup(String groupname)
                          throws DBException
Parameters:
groupname - the new group name
Returns:
group for this name, or null if not found; uses "default" dbcontext
Throws:
DBException - upon error

getGroupDescription

public String getGroupDescription()
                           throws DBException
convenience method

Returns:
java.lang.String the group description
Throws:
DBException - upon error

Expresso 5-5-0

Please see www.jcorporate.com for information about new Expresso releases.