Package io.goobi.viewer.managedbeans
Class HighlightsBean
java.lang.Object
io.goobi.viewer.managedbeans.HighlightsBean
- All Implemented Interfaces:
Serializable
Managed bean handling
Highlight objects.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumStatus of editing theselected highlightin the administration backend. -
Constructor Summary
ConstructorsConstructorDescriptionEmpty defaul constructor.HighlightsBean(IDAO dao, NavigationHelper navigationHelper, ImageDeliveryBean imaging) Testing constructor explicitly initializing required properties. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteObject(Highlight object) Delete aHighlight.Get aTableDataProviderto all savedhighlights.Get the currently displayed highlight.Get all objected contained ingetCurrentObjectsProvider().Get aTableDataProviderto all currenthighlights.Get the currentHighlightsBean.EditStatus.getHighlightsBefore(LocalDate date) Get allHighlights which are not valid for the given date but were before.If aHighlighthas been selected and it points to a record (rather than a URL), retrieve the metadata for this record.Get the URL of a representative image for the record related to the currently selected highlight if a highlight is selected and it refers to a record.getRecordRepresentativeURI(int width, int height) Get the URL of a representative image for the record related to the currently selected highlight if a highlight is selected and it refers to a record.Get the currently selectedHighlight.Get the URL to the highlighted object.voidinit()Called after initialization to load listing of existing highlights.booleanChecks if the currently selected highlight has been persisted already.voidsaveObject(Highlight object) Persist the givenHighlightto the database.voidsetEditStatus(HighlightsBean.EditStatus editStatus) Set thegetEditStatus().voidCreates a newHighlightand set as the selected highlight.voidsetSelectedObject(Highlight selectedObject) Sets theHighlightselected for editing.voidsetSelectedObjectId(long id) Sets theHighlightselected for editing via its database id.
-
Constructor Details
-
HighlightsBean
public HighlightsBean()Empty defaul constructor. The required properties are being injected automatically
-
-
Method Details
-
init
Called after initialization to load listing of existing highlights. -
getAllObjectsProvider
Get aTableDataProviderto all savedhighlights.- Returns:
- the TableDataProvider for all saved highlights
-
getCurrentObjectsProvider
Get aTableDataProviderto all currenthighlights. That is all highlights which are valid for the current date and set to active- Returns:
- the TableDataProvider for all currently active highlights
-
getUrl
Get the URL to the highlighted object. Either the record page URL of the URL given in highlight creation- Parameters:
object- the highlight object- Returns:
- the URL of the highlighted object, or an empty string if none can be determined
-
deleteObject
Delete aHighlight.- Parameters:
object- the highlight to delete
-
getSelectedObject
Get the currently selectedHighlight.- Returns:
- the currently selected highlight, or null if none is selected
-
setSelectedObject
Sets theHighlightselected for editing.- Parameters:
selectedObject- the highlight to set as selected for editing
-
setSelectedObjectId
public void setSelectedObjectId(long id) Sets theHighlightselected for editing via its database id.- Parameters:
id- database id of the highlight to select
-
setNewSelectedObject
public void setNewSelectedObject()Creates a newHighlightand set as the selected highlight. -
isNewObject
public boolean isNewObject()Checks if the currently selected highlight has been persisted already.- Returns:
- true if
getSelectedObject()has no database id and has thus not been persisted yet
-
saveObject
Persist the givenHighlightto the database.- Parameters:
object- the highlight to persist to the database- Throws:
DAOException
-
getMetadataElement
If aHighlighthas been selected and it points to a record (rather than a URL), retrieve the metadata for this record.- Returns:
- A
MetadataElementwith metadata for the related record if one exists. Otherwise null
-
getCurrentHighlight
Get the currently displayed highlight. This highlight is randomly chosen from all highlights valid for the current day which are set to enabled- Returns:
- a randomly selected currently active highlight, or null if none are active
- Throws:
DAOException
-
getRecordRepresentativeURI
public URI getRecordRepresentativeURI() throws IndexUnreachableException, PresentationException, ViewerConfigurationExceptionGet the URL of a representative image for the record related to the currently selected highlight if a highlight is selected and it refers to a record. Otherwise return null- Returns:
- A URL to the record for the selected highlight if one exists. Otherwise null
- Throws:
IndexUnreachableExceptionPresentationExceptionViewerConfigurationException
-
getRecordRepresentativeURI
public URI getRecordRepresentativeURI(int width, int height) throws IndexUnreachableException, PresentationException, ViewerConfigurationException Get the URL of a representative image for the record related to the currently selected highlight if a highlight is selected and it refers to a record. Otherwise return null- Parameters:
width- the desired width of the image. Chose '0' for original image widthheight- the desired height of the image. Chose '0' for original image height- Returns:
- A URL to the record for the selected highlight if one exists. Otherwise null
- Throws:
IndexUnreachableExceptionPresentationExceptionViewerConfigurationException
-
getCurrentObjects
Get all objected contained ingetCurrentObjectsProvider().- Returns:
- A list of all currently active
Highlights
-
getEditStatus
Get the currentHighlightsBean.EditStatus.- Returns:
- the current edit status of the highlight editor
-
setEditStatus
Set thegetEditStatus().- Parameters:
editStatus- the edit status to set
-
getHighlightsBefore
Get allHighlights which are not valid for the given date but were before. Only highlights withHighlight.isEnabled()true are included- Parameters:
date- the date up to which to return the highlights (exclusively)- Returns:
- A list of
Highlights - Throws:
DAOException
-