Expresso 5-5-0

com.jcorporate.expresso.services.dbobj
Class RowPermissions

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.services.dbobj.RowPermissions
All Implemented Interfaces:
Cacheable, ContextNested, DataObject, LookupInterface, Serializable

public class RowPermissions
extends DBObject

storage for read/write permissions concerning a given row in the database this table stores user & "other" permissions this object and its table should be manipulated only through RowSecuredDBObject

Author:
larry hamel
See Also:
RowSecuredDBObject, RowGroupPerms, Serialized Form

Nested Class Summary
 
Nested classes inherited from class com.jcorporate.expresso.core.dbobj.DBObject
DBObject.FieldError, DBObject.FieldUpdate
 
Field Summary
static String DEFAULT_PERMISSION_GROUP
          if no group has been named, here's a default name (10 char max) which is created by UserGroup.populateDefaultValues()
static int DEFAULT_PERMISSIONS
           
static int GROUP_ONLY_READWRITE_PERMISSIONS
          group can write, but others cannot even read
static int GROUP_PERMISSION_MASK
           
static int GROUP_READ_MASK
           
static int GROUP_READ_ONLY_PERMISSIONS
           
static int GROUP_WRITE_MASK
           
static int MAX_KEY_LENGTH
          max length of a primary key of this table, which is made up of the target table name + target row PK Most databases have a system limit.
static int MAX_TABLE_NAME_LENGTH
          Maximum length of name of table; all tables must have names that fit.
static int OTHERS_PERMISSION_MASK
           
static int OTHERS_READ_AND_GROUP_WRITES_PERMISSIONS
           
static int OTHERS_READ_MASK
           
static int OTHERS_WRITE_MASK
           
static int OWNER_AND_GROUP_WRITE_PERMISSIONS
           
static String OWNER_ID
          field name for owner
static int OWNER_ONLY_PERMISSIONS
           
static int OWNER_PERMISSION_MASK
           
static int OWNER_READ_MASK
           
static int OWNER_WRITE_MASK
          bitmasks for permissions, stored as Java int
static String PERMISSIONS
          field name for bits that make up permissions
static String PERMISSIONS_TABLE_DESCRIP
           
static String PERMISSIONS_TABLE_NAME
           
static String ROW_KEY
          field name for primary key of row
protected static String sKeyType
           
protected static int sMaxKeyLen
           
static String TABLE_NAME
          field name for name of table
static int WIDE_OPEN_PERMISSIONS
           
 
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
RowPermissions()
           
RowPermissions(String table, String rowKey)
           
 
Method Summary
 boolean canOthersAdministrate()
           
 boolean canOthersRead()
           
 boolean canOthersWrite()
           
 boolean canOwnerAdministrate()
          always returns true
 boolean canOwnerRead()
           
 boolean canOwnerWrite()
           
static int getMaxKeyLen()
           
 boolean isFresh()
          indicates that this object is new--no permissions have been set
 int owner()
           
 void owner(int theOwner)
           
 int permissions()
          set permissions
 void permissions(int perm)
          set permissions
protected  void setupFields()
          override in subclesses, and be sure to call this as first line of override
 
Methods inherited from class com.jcorporate.expresso.core.dbobj.DBObject
add, addCacheEventListener, addDetail, addField, addField, addFieldError, addFoundKeys, addIfNeeded, addIndex, addKey, addOrUpdate, addSortKey, addToCache, addTransition, addVirtualField, addVirtualField, addVirtualField, addVirtualField, allowsNull, average, basicAdd, checkAllowed, checkAllReferredToBy, checkAllRefs, checkAllRefsPublic, checkDeleteDetailPerm, checkField, checkRef, checkRef, clear, clearDistinctFields, clearError, clearFieldsToRetrieve, clearSortKeys, containsWildCards, copyAttributes, count, delete, delete, deleteAll, deleteDetails, denotesRange, disableLogging, enableLogging, equals, find, forKey, formatDateTime, get, getAllAttributes, getAllDBFields, getAllFields, getAllFieldsIterator, getAllFieldsMap, getAllKeys, getAllKeysIterator, getAllKeysMap, getAttribute, getAttribute, getAttributesIterator, getBinaryField, getBooleanFieldValue, getCacheSize, getCacheStats, getCacheStatsMap, getCharset, getCheckZeroUpdate, getCustomWhereClause, getDataContext, getDataField, getDataTransferObject, getDBName, getDefaultValue, getDescription, getDescription, 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, getValues, 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, populateDefaultValues, referredToBy, removeAttribute, removeAttribute, removeFromCache, retrieve, retrieveFromCache, saveBinaryField, saveBinaryField, search, search, searchAndRetrieveList, searchAndRetrieveList, set, setAttribute, setAttribute, setCacheSize, setCharset, setCheckZeroUpdate, setConnection, setConnection, setCustomWhereClause, setCustomWhereClause, setDataContext, 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, 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, setDBName, 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

PERMISSIONS_TABLE_NAME

public static final String PERMISSIONS_TABLE_NAME
See Also:
Constant Field Values

PERMISSIONS_TABLE_DESCRIP

public static final String PERMISSIONS_TABLE_DESCRIP
See Also:
Constant Field Values

TABLE_NAME

public static final String TABLE_NAME
field name for name of table

See Also:
Constant Field Values

ROW_KEY

public static final String ROW_KEY
field name for primary key of row

See Also:
Constant Field Values

OWNER_ID

public static final String OWNER_ID
field name for owner

See Also:
Constant Field Values

PERMISSIONS

public static final String PERMISSIONS
field name for bits that make up permissions

See Also:
Constant Field Values

MAX_KEY_LENGTH

public static final int MAX_KEY_LENGTH
max length of a primary key of this table, which is made up of the target table name + target row PK Most databases have a system limit. InterBase probably has one of the lowest limits, 200 bytes for the index, which is a combination of all indexed fields, documented at http://bdn.borland.com/article/0,1410,25245,00.html increase this length if you need to, and if your database allows a larger number of bytes in indices.

See Also:
Constant Field Values

MAX_TABLE_NAME_LENGTH

public static final int MAX_TABLE_NAME_LENGTH
Maximum length of name of table; all tables must have names that fit. Most databases have a system limit.

See Also:
Constant Field Values

sMaxKeyLen

protected static int sMaxKeyLen

sKeyType

protected static String sKeyType

OWNER_WRITE_MASK

public static final int OWNER_WRITE_MASK
bitmasks for permissions, stored as Java int

See Also:
Constant Field Values

OWNER_READ_MASK

public static final int OWNER_READ_MASK
See Also:
Constant Field Values

OWNER_PERMISSION_MASK

public static final int OWNER_PERMISSION_MASK
See Also:
Constant Field Values

GROUP_READ_MASK

public static final int GROUP_READ_MASK
See Also:
Constant Field Values

GROUP_WRITE_MASK

public static final int GROUP_WRITE_MASK
See Also:
Constant Field Values

GROUP_PERMISSION_MASK

public static final int GROUP_PERMISSION_MASK
See Also:
Constant Field Values

OTHERS_READ_MASK

public static final int OTHERS_READ_MASK
See Also:
Constant Field Values

OTHERS_WRITE_MASK

public static final int OTHERS_WRITE_MASK
See Also:
Constant Field Values

OTHERS_PERMISSION_MASK

public static final int OTHERS_PERMISSION_MASK
See Also:
Constant Field Values

OTHERS_READ_AND_GROUP_WRITES_PERMISSIONS

public static final int OTHERS_READ_AND_GROUP_WRITES_PERMISSIONS
See Also:
Constant Field Values

DEFAULT_PERMISSIONS

public static final int DEFAULT_PERMISSIONS
See Also:
Constant Field Values

WIDE_OPEN_PERMISSIONS

public static final int WIDE_OPEN_PERMISSIONS
See Also:
Constant Field Values

OWNER_ONLY_PERMISSIONS

public static final int OWNER_ONLY_PERMISSIONS
See Also:
Constant Field Values

OWNER_AND_GROUP_WRITE_PERMISSIONS

public static final int OWNER_AND_GROUP_WRITE_PERMISSIONS
See Also:
Constant Field Values

GROUP_READ_ONLY_PERMISSIONS

public static final int GROUP_READ_ONLY_PERMISSIONS
See Also:
Constant Field Values

GROUP_ONLY_READWRITE_PERMISSIONS

public static final int GROUP_ONLY_READWRITE_PERMISSIONS
group can write, but others cannot even read

See Also:
Constant Field Values

DEFAULT_PERMISSION_GROUP

public static final String DEFAULT_PERMISSION_GROUP
if no group has been named, here's a default name (10 char max) which is created by UserGroup.populateDefaultValues()

See Also:
Constant Field Values
Constructor Detail

RowPermissions

public RowPermissions()
               throws DBException

RowPermissions

public RowPermissions(String table,
                      String rowKey)
               throws DBException
Method Detail

canOwnerAdministrate

public boolean canOwnerAdministrate()
                             throws DBException
always returns true

Returns:
true if the own can administrate the row
Throws:
DBException - upon error

canOwnerRead

public boolean canOwnerRead()
                     throws DBException
Throws:
DBException

canOwnerWrite

public boolean canOwnerWrite()
                      throws DBException
Throws:
DBException

canOthersAdministrate

public boolean canOthersAdministrate()
                              throws DBException
Throws:
DBException

canOthersRead

public boolean canOthersRead()
                      throws DBException
Throws:
DBException

canOthersWrite

public boolean canOthersWrite()
                       throws DBException
Throws:
DBException

setupFields

protected void setupFields()
                    throws DBException
override in subclesses, and be sure to call this as first line of override

Overrides:
setupFields in class DBObject
Throws:
DBException - upon error

owner

public int owner()
          throws DBException
Throws:
DBException

owner

public void owner(int theOwner)
           throws DBException
Throws:
DBException

permissions

public void permissions(int perm)
                 throws DBException
set permissions

Parameters:
perm - the permissions to set
Throws:
DBException - upon DataObject error

permissions

public int permissions()
                throws DBException
set permissions

Returns:
the permission code
Throws:
DBException - upon DataObject error

isFresh

public boolean isFresh()
                throws DBException
indicates that this object is new--no permissions have been set

Returns:
true if the field is Fresh.
Throws:
DBException - upon DataObject error

getMaxKeyLen

public static int getMaxKeyLen()
Returns:
the maximum length permitted for a primary key, if the table is to be acommodated by RowPermissions

Expresso 5-5-0

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