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 aHighlightGet aTableDataProviderto all savedhighlightsGet the currently displayed highlight.Get all objected contained ingetCurrentObjectsProvider()Get aTableDataProviderto all currenthighlights.Get the currentHighlightsBean.EditStatusgetHighlightsBefore(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 recordGet 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 selectedHighlightGet the URL to the highlighted object.voidinit()called after initialization to load listing of existing highlightsbooleanCheck if the currently selected highlight has been persisted alreadyvoidsaveObject(Highlight object) Persist the givenHighlightto the databasevoidsetEditStatus(HighlightsBean.EditStatus editStatus) Set thegetEditStatus()voidCreate a newHighlightand set as the selected highlightvoidsetSelectedObject(Highlight selectedObject) Set theHighlightselected for editingvoidsetSelectedObjectId(long id) Set 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
@PostConstruct public void init()called after initialization to load listing of existing highlights -
getAllObjectsProvider
Get aTableDataProviderto all savedhighlights- Returns:
- a
TableDataProvider
-
getCurrentObjectsProvider
Get aTableDataProviderto all currenthighlights. That is all highlights which are valid for the current date and set to active- Returns:
- a
TableDataProvider
-
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
-
deleteObject
Delete aHighlight- Parameters:
object-
-
getSelectedObject
Get the currently selectedHighlight- Returns:
- a
Highlight
-
setSelectedObject
Set theHighlightselected for editing- Parameters:
selectedObject-
-
setSelectedObjectId
public void setSelectedObjectId(long id) Set theHighlightselected for editing via its database id- Parameters:
id-
-
setNewSelectedObject
public void setNewSelectedObject()Create a newHighlightand set as the selected highlight -
isNewObject
public boolean isNewObject()Check 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-- 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
Highlight - 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:
- a
HighlightsBean.EditStatus
-
setEditStatus
Set thegetEditStatus()- Parameters:
editStatus-
-
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
-