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
Modifier and TypeClassDescriptionstatic enum
Status of editing theselected highlight
in the administration backend -
Constructor Summary
ConstructorDescriptionEmpty defaul constructor.HighlightsBean
(IDAO dao, NavigationHelper navigationHelper, ImageDeliveryBean imaging) Testing constructor explicitly initializing required properties -
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteObject
(Highlight object) Delete aHighlight
Get aTableDataProvider
to all savedhighlights
Get the currently displayed highlight.Get all objected contained ingetCurrentObjectsProvider()
Get aTableDataProvider
to all currenthighlights
.Get the currentHighlightsBean.EditStatus
getHighlightsBefore
(LocalDate date) Get allHighlight
s which are not valid for the given date but were before.If aHighlight
has 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 selectedHighlight
Get the URL to the highlighted object.void
init()
called after initialization to load listing of existing highlightsboolean
Check if the currently selected highlight has been persisted alreadyvoid
saveObject
(Highlight object) Persist the givenHighlight
to the databasevoid
setEditStatus
(HighlightsBean.EditStatus editStatus) Set thegetEditStatus()
void
Create a newHighlight
and set as the selected highlightvoid
setSelectedObject
(Highlight selectedObject) Set theHighlight
selected for editingvoid
setSelectedObjectId
(long id) Set theHighlight
selected 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 aTableDataProvider
to all savedhighlights
- Returns:
- a
TableDataProvider
-
getCurrentObjectsProvider
Get aTableDataProvider
to 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 theHighlight
selected for editing- Parameters:
selectedObject
-
-
setSelectedObjectId
public void setSelectedObjectId(long id) Set theHighlight
selected for editing via its database id- Parameters:
id
-
-
setNewSelectedObject
public void setNewSelectedObject()Create a newHighlight
and 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 givenHighlight
to the database- Parameters:
object
-- Throws:
DAOException
-
getMetadataElement
If aHighlight
has been selected and it points to a record (rather than a URL), retrieve the metadata for this record- Returns:
- A
MetadataElement
with 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:
IndexUnreachableException
PresentationException
ViewerConfigurationException
-
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:
IndexUnreachableException
PresentationException
ViewerConfigurationException
-
getCurrentObjects
Get all objected contained ingetCurrentObjectsProvider()
- Returns:
- A list of all currently active
Highlight
s
-
getEditStatus
Get the currentHighlightsBean.EditStatus
- Returns:
- a
HighlightsBean.EditStatus
-
setEditStatus
Set thegetEditStatus()
- Parameters:
editStatus
-
-
getHighlightsBefore
Get allHighlight
s which are not valid for the given date but were before. Only hightlights withHighlight.isEnabled()
true are included- Parameters:
date
- the date up to which to return the highlights (exclusively)- Returns:
- A list of
Highlight
s - Throws:
DAOException
-