Class DisplayConditions
- All Implemented Interfaces:
Serializable
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classWrapper for aUIComponentwith convenience methods to count contained jsf components with certain attributes. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidGets thePageTypeof the current page.GetDisplayConditions.UIComponentHelperfor theUIComponentwith the given identifier within the composite component from which the method is called.booleanCalled with a string in form of a modified json object.booleanmatchRecord(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{ contentType:[IMAGE, AUDIO, VIDEO, MODEL], accessCondition: VIEW_IMAGES, pageType: ![viewMetadata], numPages:2 }The object may contain the following properties. Each given property is checked against the current view, request and record:
-
- 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, 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.
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 record. Preceding a number, the '!' means that the actual value must be less than the given number for the condition to return true. Values for contentType and accessCondition are cached per http session and record
- Parameters:
json- JSON string describing the visibility conditions to check- Returns:
- true if the given conditions are met by the current record, false otherwise
- Throws:
IOException- An exception occurred accessing file system resourcesIndexUnreachableException- An exception occurred communicating with the viewer data index (Solr)DAOException- An exception occurred 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{ contentType:[IMAGE, AUDIO, VIDEO, MODEL], accessCondition: VIEW_IMAGES, pageType: ![viewMetadata], }The object may contain the following properties. Each given property is checked against the current view, request and record:
-
- 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(HttpSession, String, String, String, String)to check access
-
- pageType
- Possible values: An array of one or more of the following: viewToc, viewThumbs, viewMetadata, viewFulltext, viewFullscreen, viewObject, 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- JSON string describing the visibility conditions to check- Returns:
- true if the given conditions are met by the current page, false otherwise
- Throws:
IOException- An exception occurred accessing file system resourcesIndexUnreachableException- An exception occurred communicating with the viewer data index (Solr)DAOException- An exception occurred 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
Gets thePageTypeof the current page.- Returns:
- A
PageType
-
getTag
GetDisplayConditions.UIComponentHelperfor theUIComponentwith 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- identifier of the child UIComponent to look up- Returns:
- a
DisplayConditions.UIComponentHelperfor theUIComponentwith the given id. If no such component exists, the current component
-
clearCache
public void clearCache()
-