Package io.goobi.viewer.managedbeans
Class CmsCollectionsBean
java.lang.Object
io.goobi.viewer.managedbeans.CmsCollectionsBean
- All Implemented Interfaces:
Serializable
Bean handling CMS settings for collections.
- Author:
- Florian Alpers
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteCollection(CMSCollection collection) deleteCollection.editCollection(CMSCollection collection) editCollection.getAllCollectionFields.DynaView method for the collection edit pretty-URL: dynamic collections and Solr field collections share the same URL but are edited on different views.Getter for the fieldcollections.Getter for the fieldcurrentCollection.getCurrentDescription(String language) getCurrentDescription.getCurrentLabel(String language) getCurrentLabel.Collection source to fall back to when the selected source is no longer available.Returns theMessageEntryrepresenting existing translations for the current value ofsolrFieldValue.getSearchUrl(CMSCollection collection) Getter for the fieldsolrField.Getter for the fieldsolrFieldValue.Options for the collection source dropdown: all configured collection Solr fields plus the dynamic collections pseudo field.importDescriptionsAction(String solrField) voidSets the value ofimageModedepending on the properties ofcurrentCollection.voidInitializes the collection tree for the currentsolrField, but only if not yet loaded.booleanChecks the current collection for validity.booleanisDirty()booleanbooleanbooleanbooleanbooleanWhether the collection source dropdown is set to the database-defined dynamic collections instead of a Solr field.booleanWhether the dynamic collections source is selected although no dynamic collections exist any more, e.g. after deleting the last one.voidloadCollection(String field) Initializes the collection tree for the given index field name.voidLoads the collection addressed byeditCollectionNamefor editing, delegating toDynamicCollectionsBeanif a dynamic collection with that name exists.resetCurrentCollection.saveCurrentCollection.voidSelects the database-defined dynamic collections as the collection source, so that the collection listing shows them without the user having to switch the source in the sidebar.voidsetCollectionName(String collectionName) Loads existing or creates a newCMSCollectionfor the currentsolrfieldand the givencollectionName.voidsetCurrentCollection(CMSCollection currentCollection) Setter for the fieldcurrentCollection.voidsetCurrentTab(CMSCollectionTreeTab currentTab) voidsetEditCollectionName(String editCollectionName) voidvoidsetSolrField(String solrField) Setter for the fieldsolrField.voidsetSolrFieldValue(String solrFieldValue) Setter for the fieldsolrFieldValue.voidupdateCollections.voidvalidatePI(FacesContext context, UIComponent comp, Object value) validatePI.static booleanvalidatePI(String pi) Checks if the given pi matches a known PI in the solr index.
-
Constructor Details
-
CmsCollectionsBean
public CmsCollectionsBean()Creates a new CmsCollectionsBean instance.
-
-
Method Details
-
isDisplayTranslationWidget
public boolean isDisplayTranslationWidget()- Returns:
- true if the if translations for the values of
solrFieldare not or only partially translated; false if they are fully translated
-
isDisplayTranslationWidgetEdit
public boolean isDisplayTranslationWidgetEdit()- Returns:
- true if the if translations for the values of
solrFieldandsolrFieldValueare not or only partially translated; false if they are fully translated
-
isDisplaySolrFieldSelectionWidget
public boolean isDisplaySolrFieldSelectionWidget()- Returns:
- true if there is more than one source option (configured collection fields plus the dynamic collections entry); false otherwise
-
getMessageEntryForFieldValue
Returns theMessageEntryrepresenting existing translations for the current value ofsolrFieldValue. Use for the info widget in the collection administration.- Returns:
MessageEntrycontaining the translations forsolrFieldValue; emptyMessageEntryif none found
-
isDisplayImportDescriptionsWidget
public boolean isDisplayImportDescriptionsWidget()- Returns:
- true keys with description suffix found; false otherwise
-
importDescriptionsAction
- Parameters:
solrField- Solr field whose collection descriptions to import- Returns:
- empty string
- Throws:
DAOException
-
getCurrentCollection
Getter for the fieldcurrentCollection.- Returns:
- the currently selected CMS collection being edited
-
setCurrentCollection
Setter for the fieldcurrentCollection.- Parameters:
currentCollection- the CMSCollection to set as the currently selected collection
-
getSolrField
Getter for the fieldsolrField.- Returns:
- the Solr field name used to group and display collections
-
setSolrField
Setter for the fieldsolrField.- Parameters:
solrField- the Solr field name used to group and display collections
-
isDynamicCollectionsSource
public boolean isDynamicCollectionsSource()Whether the collection source dropdown is set to the database-defined dynamic collections instead of a Solr field.- Returns:
- true if the
SolrConstants.DC_DYNAMICpseudo field is selected as the collection source; false otherwise
-
selectDynamicCollectionsSource
public void selectDynamicCollectionsSource()Selects the database-defined dynamic collections as the collection source, so that the collection listing shows them without the user having to switch the source in the sidebar. -
getSourceSelectItems
Options for the collection source dropdown: all configured collection Solr fields plus the dynamic collections pseudo field. The dynamic entry only appears once at least one dynamic collection exists (or while it is the selected source, so the selection stays valid after the last collection is deleted).- Returns:
- the source options for the sidebar widget
-
isDynamicSourceObsolete
public boolean isDynamicSourceObsolete()Whether the dynamic collections source is selected although no dynamic collections exist any more, e.g. after deleting the last one.- Returns:
- true if the selected source is no longer available; false otherwise
-
getDefaultCollectionField
Collection source to fall back to when the selected source is no longer available.- Returns:
- the first configured collection field;
SolrConstants.DCif none are configured
-
getSolrFieldValue
Getter for the fieldsolrFieldValue.- Returns:
- the value of the Solr field identifying the current collection
-
setSolrFieldValue
Setter for the fieldsolrFieldValue.- Parameters:
solrFieldValue- the value of the Solr field identifying the current collection
-
getCollectionName
-
setCollectionName
Loads existing or creates a newCMSCollectionfor the currentsolrfieldand the givencollectionName.- Parameters:
collectionName- Collection field value- Throws:
DAOException
-
getEditCollectionName
-
setEditCollectionName
-
getCollectionEditView
DynaView method for the collection edit pretty-URL: dynamic collections and Solr field collections share the same URL but are edited on different views.- Returns:
- the view id matching the type of the collection addressed by
editCollectionName
-
openCollectionForEditing
Loads the collection addressed byeditCollectionNamefor editing, delegating toDynamicCollectionsBeanif a dynamic collection with that name exists. The name is taken from the field instead of an action parameter because the pretty-URL action runs in the DynaView-dispatched request, where path parameters can no longer be resolved from the URL.- Throws:
DAOException
-
getAllCollectionFields
getAllCollectionFields.- Returns:
- a list of all configured collection Solr field names
-
getCollections
Getter for the fieldcollections.- Returns:
- the list of all CMS collections for the currently selected Solr field
-
updateCollections
updateCollections.- Throws:
DAOException- if any.
-
deleteCollection
deleteCollection.- Parameters:
collection- collection to delete from the database- Throws:
DAOException- if any.
-
editCollection
editCollection.- Parameters:
collection- collection to set as current and prepare for editing- Returns:
- the pretty URL name for the collection edit view
-
getCurrentLabel
getCurrentLabel.- Parameters:
language- ISO language code to retrieve the label for- Returns:
- the label translation of the current collection for the given language
-
getCurrentDescription
getCurrentDescription.- Parameters:
language- ISO language code to retrieve the description for- Returns:
- the description translation of the current collection for the given language
-
saveCurrentCollection
saveCurrentCollection.- Returns:
- the pretty URL name for the collections overview after saving the current collection
- Throws:
DAOException- if any.
-
resetCurrentCollection
resetCurrentCollection.- Returns:
- the pretty URL name for the collections overview after discarding changes to the current collection
- Throws:
DAOException- if any.
-
isCurrentCollectionValid
public boolean isCurrentCollectionValid()Checks the current collection for validity. Currently only checks if a possibly entered PI exists in the solr- Returns:
- true if the current collection is valid (i.e. any configured representative work PI exists in Solr), false otherwise
-
validatePI
public void validatePI(FacesContext context, UIComponent comp, Object value) throws ValidatorException validatePI.- Parameters:
context- current JSF faces contextcomp- UI component that triggered the validationvalue- PI value submitted by the user- Throws:
ValidatorException- if any.
-
validatePI
Checks if the given pi matches a known PI in the solr index. If the pi is empty, true is returned to allow not setting any pi- Parameters:
pi- persistent identifier to look up in the Solr index- Returns:
- false if no current collection is set, the pi does not match any known work
- Throws:
IndexUnreachableException- if any.PresentationException- if any.
-
getImageMode
-
setImageMode
-
initImageMode
public void initImageMode()Sets the value ofimageModedepending on the properties ofcurrentCollection. -
getCurrentTab
-
setCurrentTab
-
loadCollection
public void loadCollection(String field) throws de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException, IndexUnreachableException Initializes the collection tree for the given index field name.- Parameters:
field- Solr field name to load the collection for- Throws:
de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestExceptionIndexUnreachableException
-
initSolrField
public void initSolrField() throws de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestException, IndexUnreachableExceptionInitializes the collection tree for the currentsolrField, but only if not yet loaded.- Throws:
de.unigoettingen.sub.commons.contentlib.exceptions.IllegalRequestExceptionIndexUnreachableException
-
isDirty
public boolean isDirty() -
getSearchUrl
-