public class ReadOnlyDataSource extends java.lang.Object implements DataSource
Modifier and Type | Field and Description |
---|---|
protected DataSource |
rootDS
the calling/root datasource
|
Constructor and Description |
---|
ReadOnlyDataSource(DataSource ds)
Creates a read only data source from another data source
|
ReadOnlyDataSource(Login login)
A valid login is required to create a ReadOnlyDataSource
All database requests will be limited by the ACLs associated
with Login's access group.
|
ReadOnlyDataSource(Session session)
Create a read only data source for a session
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Don't null anything out as this is a multi threaded class.
|
DBObject |
create(DBClass dbClass)
Creates a new DBObject of a particular type
|
DBObject |
create(GlobalId classGid)
Creates a new DBObject of a particular type
|
DBObject |
create(java.lang.String className)
Creates a new DBObject of a particular type
|
void |
dispose()
dispose of this ReadOnlyDataSource clear to tables and make sure we can't use this MutableDataSource after calling this method
|
DBClass |
findDBClass(GlobalId classId)
Find a DBClass by it's global id.
|
DBClass |
findDBClass(java.lang.String className)
Finds the DBClass by name
|
DBClassAbstract |
findDBClassAbstract(GlobalId classId)
Find a DBClass by it's global id.
|
DBClassAbstract |
findDBClassAbstract(java.lang.String className)
Finds the DBClass by name
|
DBObject |
findKey(GlobalId valueId,
GlobalId classId)
Find a DBObject via it's value global ID and class global ID
|
DBObject |
findKey(GlobalId id,
java.lang.String defName)
Finds a new DBObject by its value id and the class name
|
DBObject |
findKey(GlobalKey gKey)
Finds a new DBObject by its primary key
|
DBObject |
findKey(java.lang.String value,
java.lang.String defName)
Finds a unique DBObject based on supplied key value
|
DBObject |
findRow(long rowId,
DBClassConcrete def,
Hint hint)
Finds a DBObject by it's rowId
|
java.lang.Object |
getAttribute(java.lang.String name)
Gets a general purpose attribute
|
java.lang.Object |
getCacheObject(java.lang.String key)
Get an object out of cache
WARNING: This is a MULTI-THREAD datasource and is pooled for performance reasons
|
DataSource |
getCurrentDataSource()
get the current datasource, if from VurtualDB then the thread local version
|
VirtualDB |
getDataBase()
Returns the VirtualDB for this MutableDataSource.
|
DataSource |
getDataBaseReadOnly()
Returns the VirtualDB for this MutableDataSource.
|
Globals |
getGlobalObject()
Get the globals object
|
DBResult |
getInwardLinkage(DBClass sourceClass,
DBField sourceField,
DBObject target,
HintField hint)
If this is an incoming link and the base object is new
then don't check the database for records as there
will not/should not be any records.
|
Login |
getLogin()
Returns the Login for this MutableDataSource.
|
DBQueryHandler |
getQueryHandler(DBClass searchClass)
Makes a Query handler for simple virtual db.
|
Login |
getRealLogin()
Returns the "real" Login for this read only data source.
|
Session |
getSession()
Get the current session
|
java.util.TimeZone |
getTimeZone()
Returns the login which created this MutableDataSource's current timeZone.
|
Person |
getUser()
Returns the User for this MutableDataSource.
|
boolean |
hasChild(DBClass mapClass,
DBField parentField,
DBObject parentObject,
DBField childField,
DBObject childObject)
does this map table contain a mapping for the parent to child.
|
boolean |
hasExcludedGroups()
are any contacts excluded ?
|
boolean |
isDisposed()
is this datasource disposed of ?
|
boolean |
isExcludeFromGroup(ContactGroup group,
Person person)
is the contact excluded from the group.
|
DALQuery |
makeQuery(java.lang.String className) |
long |
nextNumber(java.lang.String key)
Returns the next number for the passed key.
|
long |
nextNumber(java.lang.String key,
int cacheSize)
Returns the next number for the passed key.
|
void |
resetReadChecks()
resets the time stamp used for read access checking.
|
void |
setCacheObject(java.lang.String key,
java.lang.Object obj)
a cache of the objects
|
ReadOnlyDataSource |
setTimeZone(java.util.TimeZone tz)
Sets the time zone for this datasource
|
java.lang.String |
toString()
Display the details of this datasource
|
protected DataSource rootDS
public ReadOnlyDataSource(@Nonnull Login login)
login
- The user's login.public ReadOnlyDataSource(@Nonnull Session session)
session
- The session to usepublic ReadOnlyDataSource(@Nonnull DataSource ds)
ds
- The data source to use@CheckReturnValue public boolean hasChild(DBClass mapClass, DBField parentField, DBObject parentObject, DBField childField, DBObject childObject) throws java.lang.Exception
hasChild
in interface DataSource
mapClass
- The map classparentField
- the parent linkparentObject
- the parent objectchildField
- the child linkchildObject
- the child objectjava.lang.Exception
- a serious problem@CheckReturnValue public boolean isDisposed()
public void dispose()
@CheckReturnValue @Nullable public Session getSession()
getSession
in interface DataSource
@CheckReturnValue public boolean isExcludeFromGroup(ContactGroup group, Person person)
isExcludeFromGroup
in interface DataSource
person
- the person to check.group
- the group to check if the contact is excluded.@CheckReturnValue public boolean hasExcludedGroups()
hasExcludedGroups
in interface DataSource
@CheckReturnValue @Nonnull public DataSource getCurrentDataSource()
getCurrentDataSource
in interface DataSource
public void clear()
@CheckReturnValue @Nonnull public Globals getGlobalObject() throws java.lang.Exception
getGlobalObject
in interface DataSource
java.lang.Exception
- A serious problem@CheckReturnValue public long nextNumber(@Nonnull java.lang.String key)
nextNumber
in interface DataSource
key
- The next number key@CheckReturnValue public long nextNumber(@Nonnull java.lang.String key, int cacheSize)
nextNumber
in interface DataSource
key
- The next number keycacheSize
- The number of additional numbers to book.@Nonnull @CheckReturnValue public DBResult getInwardLinkage(@Nonnull DBClass sourceClass, @Nonnull DBField sourceField, @Nullable DBObject target, @Nullable HintField hint) throws java.lang.Exception
getInwardLinkage
in interface DataSource
sourceClass
- The source classhint
- the other objects that will be searchedsourceField
- The field that points to the target's classtarget
- The actual DBObject that the source field pionts to.java.lang.Exception
- A serious problem@CheckReturnValue @Nonnull public VirtualDB getDataBase()
getDataBase
in interface DataSource
@CheckReturnValue @Nonnull public DataSource getDataBaseReadOnly()
getDataBaseReadOnly
in interface DataSource
@CheckReturnValue @Nonnull public Login getLogin()
getLogin
in interface DataSource
@CheckReturnValue @Nonnull public Login getRealLogin()
getRealLogin
in interface DataSource
@CheckReturnValue @Nullable public Person getUser()
getUser
in interface DataSource
@CheckReturnValue @Nonnull public java.util.TimeZone getTimeZone()
getTimeZone
in interface DataSource
@Nonnull public final ReadOnlyDataSource setTimeZone(@Nonnull java.util.TimeZone tz)
tz
- The timezone@CheckReturnValue @Nonnull public DBClass findDBClass(@Nonnull java.lang.String className) throws NotFoundException
findDBClass
in interface DataSource
className
- The class name to find.NotFoundException
- The class name doesn't exist@CheckReturnValue @Nonnull public DBClass findDBClass(@Nonnull GlobalId classId) throws NotFoundException
findDBClass
in interface DataSource
classId
- The class's global id.NotFoundException
- The class was not found.@CheckReturnValue @Nonnull public DBClassAbstract findDBClassAbstract(@Nonnull java.lang.String className) throws NotFoundException
findDBClassAbstract
in interface DataSource
className
- The class name to find.NotFoundException
- The class name doesn't exist@CheckReturnValue @Nonnull public DBClassAbstract findDBClassAbstract(@Nonnull GlobalId classId) throws NotFoundException
findDBClassAbstract
in interface DataSource
classId
- The class's global id.NotFoundException
- The class was not found.@CheckReturnValue @Nonnull public DBObject findKey(@Nonnull GlobalId valueId, @Nonnull GlobalId classId) throws NotFoundException
findKey
in interface DataSource
valueId
- The value idclassId
- The class idNotFoundException
- The DBObject wasn't found@CheckReturnValue @Nonnull public DBObject findKey(@Nonnull GlobalId id, @Nonnull java.lang.String defName) throws NotFoundException
findKey
in interface DataSource
id
- The value iddefName
- The class nameNotFoundException
- The DBObject wasn't found@CheckReturnValue @Nonnull public DBObject findKey(@Nonnull GlobalKey gKey) throws NotFoundException
findKey
in interface DataSource
gKey
- The global keyNotFoundException
- The DBObject wasn't found@CheckReturnValue @Nonnull public DBObject findKey(@Nonnull java.lang.String value, @Nonnull java.lang.String defName) throws NotFoundException, TooManyRowsException, java.lang.Exception
findKey
in interface DataSource
value
- The value to searchdefName
- The class namejava.lang.Exception
- A serious problemNotFoundException
- The key was not foundTooManyRowsException
- The key was not found@CheckReturnValue @Nonnull public DBObject findRow(long rowId, DBClassConcrete def, Hint hint) throws NotFoundException
findRow
in interface DataSource
hint
- The hint of other rows to be fetchedrowId
- The row iddef
- The DBClassNotFoundException
- The row wasn't found@CheckReturnValue @Nonnull public java.lang.String toString()
toString
in class java.lang.Object
@CheckReturnValue @Nonnull public DBObject create(java.lang.String className) throws java.lang.Exception
create
in interface DataSource
className
- The class Namejava.lang.Exception
- A serious problem occurred@CheckReturnValue @Nonnull public DBObject create(DBClass dbClass) throws java.lang.Exception
create
in interface DataSource
dbClass
- The classjava.lang.Exception
- A serious problem occurred@CheckReturnValue @Nonnull public DBObject create(GlobalId classGid) throws java.lang.Exception
create
in interface DataSource
classGid
- The class idjava.lang.Exception
- A serious problem occurredpublic void resetReadChecks()
@CheckReturnValue @Nonnull public DBQueryHandler getQueryHandler(@Nonnull DBClass searchClass)
getQueryHandler
in interface DataSource
searchClass
- The class that is being searchedpublic void setCacheObject(java.lang.String key, java.lang.Object obj)
setCacheObject
in interface DataSource
key
- A keyobj
- The value@CheckReturnValue @Nullable public java.lang.Object getCacheObject(java.lang.String key)
getCacheObject
in interface DataSource
key
- The key@CheckReturnValue @Nullable public java.lang.Object getAttribute(@Nonnull java.lang.String name)
getAttribute
in interface DataSource
name
- the name of the attribute@CheckReturnValue @Nonnull public DALQuery makeQuery(java.lang.String className)
stSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.