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.Getter for the fieldcollections.Getter for the fieldcurrentCollection.getCurrentDescription(String language) getCurrentDescription.getCurrentLabel(String language) getCurrentLabel.Returns theMessageEntryrepresenting existing translations for the current value ofsolrFieldValue.getSearchUrl(CMSCollection collection) Getter for the fieldsolrField.Getter for the fieldsolrFieldValue.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()booleanbooleanbooleanbooleanvoidloadCollection(String field) Initializes the collection tree for the given index field name.resetCurrentCollection.saveCurrentCollection.voidsetCollectionName(String collectionName) Loads existing or creates a newCMSCollectionfor the currentsolrfieldand the givencollectionName.voidsetCurrentCollection(CMSCollection currentCollection) Setter for the fieldcurrentCollection.voidsetCurrentTab(CMSCollectionTreeTab currentTab) 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 number of available collections is greater than 1; 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
-
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
-
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
-