Package io.goobi.viewer.managedbeans
Class DisplayConditions
java.lang.Object
io.goobi.viewer.managedbeans.DisplayConditions
- All Implemented Interfaces:
Serializable
DisplayConditions tests whether GUI elements in record views should be visible by a number of factors. These factors encompass the the current
view, access conditions and properties of the current record and page. There are two key methods to test display conditions:
The methods check against properties of the record and of the current page respectively. Both that a pseudo-json string as an agument that is
explained in more detail in the documentation of both methods.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Wrapper for aUIComponent
with convenience methods to count contained jsf components with certain attributes. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Get thePageType
of the current pageGetDisplayConditions.UIComponentHelper
for theUIComponent
with the given identifier within the composite component from which the method is called.boolean
Called with a string in form of a modified json object.boolean
matchRecord
(String json) Called with a string in form of a modified json object.
-
Field Details
-
activeDocumentBean
-
-
Constructor Details
-
DisplayConditions
public DisplayConditions()
-
-
Method Details
-
matchRecord
public boolean matchRecord(String json) throws IOException, IndexUnreachableException, DAOException, RecordNotFoundException, PresentationException, ViewerConfigurationException Called with a string in form of a modified json object. The object may not contain any quotation marks and values may be preceded by a '!' indicating a negation of the check for this value. A typical form is
The object may contain the following properties. Each given property is checked against the current view, request and record:{ contentType:[IMAGE, AUDIO, VIDEO, MODEL], accessCondition: VIEW_IMAGES, pageType: ![viewMetadata], numPages:2 }
-
- contentType
- Possible values: An array of one or more of the following: IMAGE, AUDIO, VIDEO, MODEL, ALTO, TEI, PDF, EPUB
- Description: Content file types available for the record in the file system. If the record contains at least one of the listed file types, the check returns true
-
- mimeType
- Possible values: An array of one or more of the following: image, video, audio, application, text, model (3D-Objekt), other
- Description: Base part of the mime type set for the record in the SOLR database. Generally the mime type of the files within the record's media folder. This check return true if the mime type is any of the values within the list
-
- accessCondition
- Possible values: An array of any of the string values of the 'PRIV_' constants defined in
IPrivilegeHolder
, which is the name of the constant without the 'PRIV_' prefix - Description: The access privilege which must be satisfied by the current request for the current record. Calls the method
AccessConditionUtils.checkAccessPermissionByIdentifierAndLogId(String, String, String, HttpServletRequest)
to check access
-
- pageType
- Possible values: An array of one or more of the following: viewToc, viewThumbs, viewMetadata, viewFulltext, viewFullscreen, viewObject, viewCalendar, cmsPage
- Descrption: Name of the current record page or 'view'. The condition returns true if the current view is one of the values of the given array
-
- sourceFormat
- Possible values: An array of one or more of the following: METS, LIDO, DUBLINCORE, METS_MARC, DENKXWEB
- Description: The source metadata format of the current record. This condition returns true if the format is within the given list.
-
- docType
- Possible values: An array of one or more doc struct types from the SOLR field 'DOCSTRCT' and some additional values document structure: 'group', 'groupMember', 'anchor', 'volume', 'record' and 'subStruct' (structure element within a record)
- Description: The structure type of the current record as well as some of the additional values detailing structure hierarchy. The condition returns true if any of the listed values matches one or more structure properties of the current record. 'subStruct' returns true if a structure element within the record is selected
-
- numPages
- Possible values: The number of pages within the current record. An integer equals '0' or larger
- Descrption:This condition returns true if the number of pages of the current record equals at least the given number.
-
- tocSize
- Possible values: The number of elements within the record's table of content. An integer equals '1' or larger
- Descrption: This condition returns true if the table of content of the current record equals at least the given number. The record document itself counts towards this number so the lowest possible value is 1.
- Parameters:
json
-- Returns:
- true if the given conditions are met by the current record, false otherwise
- Throws:
IOException
- An exception occured file system resourcesIndexUnreachableException
- An exception occured communicating the the viewer data index (SOLR)DAOException
- An exception occured communicating with the viewer sql databaseRecordNotFoundException
- The current record could not be found in the viewer data index when checking access conditionsPresentationException
- Any other exception encountered while checking file system resources or the SOLR databaseViewerConfigurationException
-
-
matchPage
public boolean matchPage(String json) throws IOException, IndexUnreachableException, DAOException, RecordNotFoundException, PresentationException Called with a string in form of a modified json object. The object may not contain any quotation marks and values may be preceded by a '!' indicating a negation of the check for this value. A typical form is
The object may contain the following properties. Each given property is checked against the current view, request and record:{ contentType:[IMAGE, AUDIO, VIDEO, MODEL], accessCondition: VIEW_IMAGES, pageType: ![viewMetadata], }
-
- contentType
- Possible values: An array of one or more of the following: IMAGE, AUDIO, VIDEO, MODEL, ALTO, TEI, PDF, EPUB
- Description: Content file types available for the current page in the file system.
-
- mimeType
- Possible values: An array of one or more of the following: image, video, audio, application, text, model (3D-Objekt), other
- Description: Base part of the mime type set for the page document in the SOLR database.
-
- accessCondition
- Possible values: An array of any of the string values of the 'PRIV_' constants defined in
IPrivilegeHolder
, which is the name of the constant without the 'PRIV_' prefix - Description: The access privilege which must be satisfied by the current request for the current record and page. Calls the method
AccessConditionUtils.checkAccessPermissionByIdentifierAndFileNameWithSessionMap(HttpServletRequest, String, String, String)
to check access
-
- pageType
- Possible values: An array of one or more of the following: viewToc, viewThumbs, viewMetadata, viewFulltext, viewFullscreen, viewObject, viewCalendar, cmsPage
- Descrption: Name of the current record page or 'view'. The condition returns true if the current view is one of the values of the given array
A '!' character preceding a string value means that the condition should not match the value for the check to return true; preceding an array,
it means that none of the values within the list should match the page. Values for contentType and accessCondition are cached per http session
and page
- Parameters:
json
-- Returns:
- true if the given conditions are met by the current page, false otherwise
- Throws:
IOException
- An exception occured file system resourcesIndexUnreachableException
- An exception occured communicating the the viewer data index (SOLR)DAOException
- An exception occured communicating with the viewer sql databaseRecordNotFoundException
- The current record could not be found in the viewer data index when checking access conditionsPresentationException
- Any other exception encountered while checking file system resources or the SOLR database
-
-
getPageType
Get thePageType
of the current page- Returns:
- A
PageType
-
getTag
GetDisplayConditions.UIComponentHelper
for theUIComponent
with the given identifier within the composite component from which the method is called. This is used to count the number of rendered jsf-components with a specific attribute within said UIComponent.- Parameters:
id
-- Returns:
- a
DisplayConditions.UIComponentHelper
for theUIComponent
with the given id. If no such component exists, the current component
-
clearCache
public void clearCache()
-