Class SessionBean
- All Implemented Interfaces:
Serializable,EventListener,HttpSessionBindingListener
- record locking (e.g.,
getLock(String)), and - navigation support (e.g.,
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.
- Author:
- ostwald
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classImplements Comparator to enable sorting by session id.static classImplements Comparator to enable sorting SessionBeans by their sessions idle time -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic StringSpecifies the default sort order for display of records. -
Constructor Summary
ConstructorsConstructorDescriptionArgumentless Constructor for the SessionBean object.SessionBean(HttpSession session, ServletContext servletContext) Constructor for the SessionBean object -
Method Summary
Modifier and TypeMethodDescriptionvoidWipes out information about the last search.voiddestroy()Description of the MethodGet the keys of the collections the sessionUser is authorized to access.booleangetBatchLocks(RecordList records) getCollectionConfig(String collection) Gets the collectionConfig attribute of the SessionBean objectlongorg.apache.struts.util.LabelValueBeanGenerate list of collections for use by jsp tags.Gets the collectionRegistry attribute of the SessionBean objectReturn a query clause ORing together all the collections the current user is authorized to search over.Get DcsDataRecord for the given id via the DcsDataManagerList of ids to records that could not be locked during getBatchLocks.getFinalStatusLabel(String collection) Gets the finalStatusLabel attribute of the SessionBean objectgetId()Gets the id of this session.Gets the inactiveIntervalRemaining attribute of the SessionBean objectlonggetIp()Gets the ip attribute of the SessionBean objectGets the lastAccessedTime attribute of the session as a Date.booleanLocks a record for this session through a call toSessionRegistry.getLock(String, String).Gets the records locked by this session.intReturns the number of seconds left until this session times out.intCompute the start record index of the page on which the current record (recIndex) will be found.intCompute the start record index of the page on which the specified record will be found.Returns the url (decoded to preserve query string) that will reproduce the last query preformed on the search page.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.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).get the last request for this session - NOT currently usedGets the roleManager attribute of the SessionBean objectA string representation (http request's query parameters) of the last search performed by the user.Gets the AttributeNames defined in the servlet Context.Gets the session attribute of the SessionBean objectGets the sessionAttributeNames of this session.Gets the GlobalSessionRegistryfrom the servlet context,getSets()Gets a List ofSetInfoobjects that provide information about the collections known to RepositoryManager.Gets the timeSinceCreation attribute of the session as a formatted string.Gets the timeSinceLastAccessed of the session as a formated String for use in jsp.getUser()booleanisAuthorized(String operation) Gets the authorized attribute of the SessionBean objectbooleanisAuthorized(String operation, String collection) Gets the authorized attribute of the SessionBean objectbooleanisAuthorizedCollection(Roles.Role role, String collection) booleanisNew()Gets the new attribute of the SessionBean objectbooleanbooleanDoes this session own the lock for the record?booleanRelease all locks held by this session.booleanreleaseLock(String recId) Release lock for given record.voidsetCollectionConfigMod(long mod) voidsetCreators(List creators) voidsetEditors(List editors) voidsetIndexedFormats(List formats) voidsetIndexLastModified(long mod) voidSets the ip attribute of the SessionBean objectvoidsetQuerySelectorsInitialized(boolean b) voidSets the recId attribute of the SessionBean objectvoidsetRequest(HttpServletRequest request) Sets the request attribute of the SessionBean objectvoidSets the sets attribute of the SessionBean objectvoidsetStatuses(Map statusMap) voidvoidupdateCollectionFilter(String column, String value) The collectionFilter is used to filter UI displays using dcsTablesvoidMethod called each time a attribute is bound to this SessionBean's session.voidMethod called each time any attribute is removed from this SessionBean's session.
-
Field Details
-
DEFAULT_REC_SORT
Specifies the default sort order for display of records. Used in.invalid reference
org.dlese.dpc.schemedit.action.form.DCSQueryForm#getSortRecsBy() -
indexedFormats
-
editors
-
creators
-
-
Constructor Details
-
SessionBean
Constructor for the SessionBean object- Parameters:
session- Description of the ParameterservletContext- Description of the Parameter
-
SessionBean
public SessionBean()Argumentless Constructor for the SessionBean object.
-
-
Method Details
-
updateCollectionFilter
The collectionFilter is used to filter UI displays using dcsTables -
getCollectionFilter
public org.apache.struts.util.LabelValueBean getCollectionFilter() -
getSession
Gets the session attribute of the SessionBean object- Returns:
- The session value
-
getUser
-
getRequest
get the last request for this session - NOT currently used- Returns:
- The request value
-
setRequest
Sets the request attribute of the SessionBean object- Parameters:
request- The new request value
-
setRecId
Sets the recId attribute of the SessionBean object- Parameters:
id- The new recId value
-
getLastAccessedTime
Gets the lastAccessedTime attribute of the session as a Date.- Returns:
- The lastAccessedTime value
-
getTimeSinceLastAccessed
Gets the timeSinceLastAccessed of the session as a formated String for use in jsp.- Returns:
- The timeSinceLastAccessed value
-
getNumSecsToTimeout
public int getNumSecsToTimeout()Returns the number of seconds left until this session times out. Dependent on the session's MaxInactiveInterval- Returns:
- The numSecsToTimeout value
-
isNew
public boolean isNew()Gets the new attribute of the SessionBean object- Returns:
- The new value
-
getInactiveIntervalRemaining
Gets the inactiveIntervalRemaining attribute of the SessionBean object- Returns:
- The inactiveIntervalRemaining value
-
getTimeSinceCreation
Gets the timeSinceCreation attribute of the session as a formatted string.- Returns:
- The timeSinceCreation value
-
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.- Returns:
- The recId value
-
getId
Gets the id of this session.- Returns:
- The sessionId value
-
getIp
Gets the ip attribute of the SessionBean object- Returns:
- The ip value
-
setIp
Sets the ip attribute of the SessionBean object- Parameters:
ip- The new ip value
-
getLockedRecords
Gets the records locked by this session.- Returns:
- A List of record Ids
-
valueBound
Method called each time a attribute is bound to this SessionBean's session.This method is not currently used ...
- Specified by:
valueBoundin interfaceHttpSessionBindingListener- Parameters:
event- Description of the Parameter
-
valueUnbound
Method called each time any attribute is removed from this SessionBean's session.This method is not currently used ...
- Specified by:
valueUnboundin interfaceHttpSessionBindingListener- Parameters:
event- Description of the Parameter
-
getDcsDataRecord
Get DcsDataRecord for the given id via the DcsDataManager- Parameters:
id- Description of the Parameter- Returns:
- The dcsDataRecord value
-
getServletContextAttributeNames
Gets the AttributeNames defined in the servlet Context.- Returns:
- A list of attribute names
-
ownsLock
Does this session own the lock for the record?- Parameters:
recId- Description of the Parameter- Returns:
- Description of the Return Value
-
releaseLock
Release lock for given record.- Parameters:
recId- Id of record to release- Returns:
- Description of the Return Value
-
releaseAllLocks
public boolean releaseAllLocks()Release all locks held by this session.- Returns:
- Description of the Return Value
-
getLock
Locks a record for this session through a call toSessionRegistry.getLock(String, String).- Parameters:
recId- Description of the Parameter- Returns:
- The lock value
-
getFailedBatchLocks
List of ids to records that could not be locked during getBatchLocks.- Returns:
- a list of
ResultDocinstances. - See Also:
-
getBatchLocks
-
isAuthorized
Gets the authorized attribute of the SessionBean object- Parameters:
operation- Description of the Parameter- Returns:
- The authorized value
-
isAuthorized
Gets the authorized attribute of the SessionBean object- Parameters:
operation- Description of the Parametercollection- Description of the Parameter- Returns:
- The authorized value
-
isAuthorizedCollection
-
getSessionAttributeNames
Gets the sessionAttributeNames of this session.- Returns:
- The sessionAttributeNames value
-
getSessionRegistry
Gets the GlobalSessionRegistryfrom the servlet context,- Returns:
- The sessionRegistry value
-
getRoleManager
Gets the roleManager attribute of the SessionBean object- Returns:
- The roleManager value
-
getCollectionRegistry
Gets the collectionRegistry attribute of the SessionBean object- Returns:
- The collectionRegistry value
-
getCollectionConfig
Gets the collectionConfig attribute of the SessionBean object- Parameters:
collection- Description of the Parameter- Returns:
- The collectionConfig value
-
getFinalStatusLabel
Gets the finalStatusLabel attribute of the SessionBean object- Parameters:
collection- Description of the Parameter- Returns:
- The finalStatusLabel value
-
getSearchHelper
-
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). -
getSearchParams
A string representation (http request's query parameters) of the last search performed by the user.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
- Returns:
- The part of a url that specifies a search
-
clearSearchParams
public void clearSearchParams()Wipes out information about the last search. -
getPaigingParam
public int getPaigingParam()Compute the start record index of the page on which the current record (recIndex) will be found.- Returns:
- The paigingParam value
-
getPaigingParam
Compute the start record index of the page on which the specified record will be found.- Parameters:
id- Description of the Parameter- Returns:
- The paigingParam value
-
getQueryUrl
Returns the url (decoded to preserve query string) that will reproduce the last query preformed on the search page. -
getSets
Gets a List ofSetInfoobjects that provide information about the collections known to RepositoryManager.NOTE: why isn't the set list encapsulated by CollectionRegistry, and the
SetInfos themselves by CollectionConfig. Then, the CollectionRegistry would be accessed through the servlet context.- Returns:
- A List of SetInfo objects.
-
setSets
Sets the sets attribute of the SessionBean object- Parameters:
sets- The new sets value
-
getAuthorizedCollections
Get the keys of the collections the sessionUser is authorized to access.- Parameters:
sessionBean- NOT YET DOCUMENTED- Returns:
- The authorizedCollections value
-
getCollectionsQueryClause
Return a query clause ORing together all the collections the current user is authorized to search over.- Parameters:
sessionBean- NOT YET DOCUMENTED- Returns:
- The collectionsQueryClause value
-
isQuerySelectorsInitialized
public boolean isQuerySelectorsInitialized() -
setQuerySelectorsInitialized
public void setQuerySelectorsInitialized(boolean b) -
getIndexLastModified
public long getIndexLastModified() -
setIndexLastModified
public void setIndexLastModified(long mod) -
getCollectionConfigMod
public long getCollectionConfigMod() -
setCollectionConfigMod
public void setCollectionConfigMod(long mod) -
getStatuses
-
setStatuses
-
getIndexedFormats
-
setIndexedFormats
-
getEditors
-
setEditors
-
getCreators
-
setCreators
-
getCollectionLabelValues
Generate list of collections for use by jsp tags. Note: this could also be done by CollectionRegistry?- Returns:
- The collectionLabelValues value
-
getSyncService
-
setSyncService
-
destroy
public void destroy()Description of the Method
-