public class SessionBean
extends java.lang.Object
implements javax.servlet.http.HttpSessionBindingListener, java.io.Serializable
getLock(String)
), and getPaigingParam()
)SessionRegistry
. Because they are
bound to the session context, SessionBeans are available to jsp pages.This class aims as much as possible to be a read-only structure that gets information from the application's form beans which are accessed via the session.
A tricky aspect of accessing Session attributes is that the session can be
invalidated at any time (e.g., when a session times out). Thus, accesses to
session attributes must be wrapped in a try statement that can catch a
IllegalStateException exception. When such an exception is encountered, the
SessionBean instance is destroyed
. As a HttpSessionBindingListener, receives notification when
attributes are bound to, or removed from, the session context.
Modifier and Type | Class and Description |
---|---|
static class |
SessionBean.IdComparator
Implements Comparator to enable sorting by session id.
|
static class |
SessionBean.IdleTimeComparator
Implements Comparator to enable sorting SessionBeans by their sessions idle
time
|
Modifier and Type | Field and Description |
---|---|
java.util.List |
creators |
static java.lang.String |
DEFAULT_REC_SORT
Specifies the default sort order for display of records.
|
java.util.List |
editors |
java.util.List |
indexedFormats |
Constructor and Description |
---|
SessionBean()
Argumentless Constructor for the SessionBean object.
|
SessionBean(javax.servlet.http.HttpSession session,
javax.servlet.ServletContext servletContext)
Constructor for the SessionBean object
|
Modifier and Type | Method and Description |
---|---|
void |
clearSearchParams()
Wipes out information about the last search.
|
void |
destroy()
Description of the Method
|
java.util.List |
getAuthorizedCollections()
Get the keys of the collections the sessionUser is authorized to access.
|
boolean |
getBatchLocks(RecordList records) |
CollectionConfig |
getCollectionConfig(java.lang.String collection)
Gets the collectionConfig attribute of the SessionBean object
|
long |
getCollectionConfigMod() |
org.apache.struts.util.LabelValueBean |
getCollectionFilter() |
java.util.List |
getCollectionLabelValues()
Generate list of collections for use by jsp tags.
|
CollectionRegistry |
getCollectionRegistry()
Gets the collectionRegistry attribute of the SessionBean object
|
java.lang.String |
getCollectionsQueryClause()
Return a query clause ORing together all the collections the current user
is authorized to search over.
|
java.util.List |
getCreators() |
DcsDataRecord |
getDcsDataRecord(java.lang.String id)
Get DcsDataRecord for the given id via the DcsDataManager
|
java.util.List |
getEditors() |
RecordList |
getFailedBatchLocks()
List of ids to records that could not be locked during getBatchLocks.
|
java.lang.String |
getFinalStatusLabel(java.lang.String collection)
Gets the finalStatusLabel attribute of the SessionBean object
|
java.lang.String |
getId()
Gets the id of this session.
|
java.lang.String |
getInactiveIntervalRemaining()
Gets the inactiveIntervalRemaining attribute of the SessionBean object
|
java.util.List |
getIndexedFormats() |
long |
getIndexLastModified() |
java.lang.String |
getIp()
Gets the ip attribute of the SessionBean object
|
java.util.Date |
getLastAccessedTime()
Gets the lastAccessedTime attribute of the session as a Date.
|
boolean |
getLock(java.lang.String recId)
Locks a record for this session through a call to
SessionRegistry.getLock(String, String) . |
java.util.List |
getLockedRecords()
Gets the records locked by this session.
|
int |
getNumSecsToTimeout()
Returns the number of seconds left until this session times out.
|
int |
getPaigingParam()
Compute the start record index of the page on which the current record
(recIndex) will be found.
|
int |
getPaigingParam(java.lang.String id)
Compute the start record index of the page on which the specified record
will be found.
|
java.lang.String |
getQueryUrl()
Returns the url (decoded to preserve query string) that will reproduce the
last query preformed on the search page.
|
java.lang.String |
getRecId()
Gets the recId attribute of the SessionBean object, which keeps track of
the record the user has last edited so that particular record can be
highlighted in lists of records.
|
RecordList |
getRecords()
Provides access to current set of search results, which is updated by
DCSQueryAction, but needed by other actions that need to operate over the results
(e.g.,
BatchOperationsAction ). |
javax.servlet.http.HttpServletRequest |
getRequest()
get the last request for this session - NOT currently used
|
RoleManager |
getRoleManager()
Gets the roleManager attribute of the SessionBean object
|
SearchHelper |
getSearchHelper() |
java.lang.String |
getSearchParams()
A string representation (http request's query parameters) of the last
search performed by the user.
|
java.util.List |
getServletContextAttributeNames()
Gets the AttributeNames defined in the servlet Context.
|
javax.servlet.http.HttpSession |
getSession()
Gets the session attribute of the SessionBean object
|
java.util.List |
getSessionAttributeNames()
Gets the sessionAttributeNames of this session.
|
SessionRegistry |
getSessionRegistry()
Gets the Global
SessionRegistry from the
servlet context, |
java.util.List |
getSets()
Gets a List of
SetInfo objects that
provide information about the collections known to RepositoryManager. |
java.util.Map |
getStatuses() |
SyncService |
getSyncService() |
java.lang.String |
getTimeSinceCreation()
Gets the timeSinceCreation attribute of the session as a formatted string.
|
java.lang.String |
getTimeSinceLastAccessed()
Gets the timeSinceLastAccessed of the session as a formated String for use
in jsp.
|
User |
getUser() |
boolean |
isAuthorized(java.lang.String operation)
Gets the authorized attribute of the SessionBean object
|
boolean |
isAuthorized(java.lang.String operation,
java.lang.String collection)
Gets the authorized attribute of the SessionBean object
|
boolean |
isAuthorizedCollection(Roles.Role role,
java.lang.String collection) |
boolean |
isNew()
Gets the new attribute of the SessionBean object
|
boolean |
isQuerySelectorsInitialized() |
boolean |
ownsLock(java.lang.String recId)
Does this session own the lock for the record?
|
boolean |
releaseAllLocks()
Release all locks held by this session.
|
boolean |
releaseLock(java.lang.String recId)
Release lock for given record.
|
void |
setCollectionConfigMod(long mod) |
void |
setCreators(java.util.List creators) |
void |
setEditors(java.util.List editors) |
void |
setIndexedFormats(java.util.List formats) |
void |
setIndexLastModified(long mod) |
void |
setIp(java.lang.String ip)
Sets the ip attribute of the SessionBean object
|
void |
setQuerySelectorsInitialized(boolean b) |
void |
setRecId(java.lang.String id)
Sets the recId attribute of the SessionBean object
|
void |
setRequest(javax.servlet.http.HttpServletRequest request)
Sets the request attribute of the SessionBean object
|
void |
setSets(java.util.List sets)
Sets the sets attribute of the SessionBean object
|
void |
setStatuses(java.util.Map statusMap) |
void |
setSyncService(SyncService svc) |
void |
updateCollectionFilter(java.lang.String column,
java.lang.String value)
The collectionFilter is used to filter UI displays using dcsTables
|
void |
valueBound(javax.servlet.http.HttpSessionBindingEvent event)
Method called each time a attribute is bound to this SessionBean's session.
|
void |
valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
Method called each time any attribute is removed from this SessionBean's
session.
|
public static java.lang.String DEFAULT_REC_SORT
org.dlese.dpc.schemedit.action.form.DCSQueryForm#getSortRecsBy()
.public java.util.List indexedFormats
public java.util.List editors
public java.util.List creators
public SessionBean(javax.servlet.http.HttpSession session, javax.servlet.ServletContext servletContext)
session
- Description of the ParameterservletContext
- Description of the Parameterpublic SessionBean()
public void updateCollectionFilter(java.lang.String column, java.lang.String value)
public org.apache.struts.util.LabelValueBean getCollectionFilter()
public javax.servlet.http.HttpSession getSession()
public User getUser()
public javax.servlet.http.HttpServletRequest getRequest()
public void setRequest(javax.servlet.http.HttpServletRequest request)
request
- The new request valuepublic void setRecId(java.lang.String id)
id
- The new recId valuepublic java.util.Date getLastAccessedTime()
public java.lang.String getTimeSinceLastAccessed()
public int getNumSecsToTimeout()
public boolean isNew()
public java.lang.String getInactiveIntervalRemaining()
public java.lang.String getTimeSinceCreation()
public java.lang.String getRecId()
public java.lang.String getId()
public java.lang.String getIp()
public void setIp(java.lang.String ip)
ip
- The new ip valuepublic java.util.List getLockedRecords()
public void valueBound(javax.servlet.http.HttpSessionBindingEvent event)
This method is not currently used ...
valueBound
in interface javax.servlet.http.HttpSessionBindingListener
event
- Description of the Parameterpublic void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
This method is not currently used ...
valueUnbound
in interface javax.servlet.http.HttpSessionBindingListener
event
- Description of the Parameterpublic DcsDataRecord getDcsDataRecord(java.lang.String id)
id
- Description of the Parameterpublic java.util.List getServletContextAttributeNames()
public boolean ownsLock(java.lang.String recId)
recId
- Description of the Parameterpublic boolean releaseLock(java.lang.String recId)
recId
- Id of record to releasepublic boolean releaseAllLocks()
public boolean getLock(java.lang.String recId)
SessionRegistry.getLock(String, String)
.recId
- Description of the Parameterpublic RecordList getFailedBatchLocks()
ResultDoc
instances.#getBatchLocks(ResultDoc[])
public boolean getBatchLocks(RecordList records)
public boolean isAuthorized(java.lang.String operation)
operation
- Description of the Parameterpublic boolean isAuthorized(java.lang.String operation, java.lang.String collection)
operation
- Description of the Parametercollection
- Description of the Parameterpublic boolean isAuthorizedCollection(Roles.Role role, java.lang.String collection)
public java.util.List getSessionAttributeNames()
public SessionRegistry getSessionRegistry()
SessionRegistry
from the
servlet context,public RoleManager getRoleManager()
public CollectionRegistry getCollectionRegistry()
public CollectionConfig getCollectionConfig(java.lang.String collection)
collection
- Description of the Parameterpublic java.lang.String getFinalStatusLabel(java.lang.String collection)
collection
- Description of the Parameterpublic SearchHelper getSearchHelper()
public RecordList getRecords()
BatchOperationsAction
).public java.lang.String getSearchParams()
Enables system to take user back to the last search they performed. For example,searchParams is used by the "Search" link in the page header, so when user returns to search it is as they left it. queryForm
public void clearSearchParams()
public int getPaigingParam()
public int getPaigingParam(java.lang.String id)
id
- Description of the Parameterpublic java.lang.String getQueryUrl()
public java.util.List getSets()
SetInfo
objects that
provide information about the collections known to RepositoryManager.
NOTE: why isn't the set list encapsulated by CollectionRegistry, and the
SetInfo
s themselves by CollectionConfig.
Then, the CollectionRegistry would be accessed through the servlet context.
public void setSets(java.util.List sets)
sets
- The new sets valuepublic java.util.List getAuthorizedCollections()
sessionBean
- NOT YET DOCUMENTEDpublic java.lang.String getCollectionsQueryClause()
sessionBean
- NOT YET DOCUMENTEDpublic boolean isQuerySelectorsInitialized()
public void setQuerySelectorsInitialized(boolean b)
public long getIndexLastModified()
public void setIndexLastModified(long mod)
public long getCollectionConfigMod()
public void setCollectionConfigMod(long mod)
public java.util.Map getStatuses()
public void setStatuses(java.util.Map statusMap)
public java.util.List getIndexedFormats()
public void setIndexedFormats(java.util.List formats)
public java.util.List getEditors()
public void setEditors(java.util.List editors)
public java.util.List getCreators()
public void setCreators(java.util.List creators)
public java.util.List getCollectionLabelValues()
public SyncService getSyncService()
public void setSyncService(SyncService svc)
public void destroy()