Package io.goobi.viewer.managedbeans
Class GeoMapBean
java.lang.Object
io.goobi.viewer.managedbeans.GeoMapBean
- All Implemented Interfaces:
IPolyglott,Serializable
Bean for managing
GeoMaps in the admin Backend.- Author:
- Florian Alpers
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFeatureSet(GeoMap map, String type) addFeatureSet.voidSets the currentMap to a new emptyGeoMap.voiddeleteMap.Getter for the fieldactiveFeatureSet.getActiveFeatureSetAsString.Gets a list of allGeoMaps from the databse.static StringgetCoordinateSearchQuery(SolrFeatureSet featureSet, String longLat) Getter for the fieldcurrentMap.getCurrentMapId.getEditMapUrl(GeoMap map) getEditMapUrl.getEmbeddingCmsPages.getFeatureUrl.getFromCache(GeoMap geomap) getFromCache.getHeatmapUrl.getPossibleMapTypes.getPossibleMarkers.Getter for the fieldselectedLanguage.booleanhasCurrentFeature.booleanisActiveFeatureSet(FeatureSet featureSet) isActiveFeatureSet.booleanisComplete(Locale locale) If this returns true, an associated language tab should have the 'already-translated' class, otherwise the '-partly-translated' class unlessIPolyglott.isEmpty(Locale)also returns true.booleanIf this returns true, an associated language tab should have neither the 'already-translated' nor the '-partly-translated' class.booleanisHasMaps.booleanisInUse.booleanOnly meaningful for the default language for which all required fields must be filled.voidremoveFeatureSet(GeoMap map, FeatureSet set) removeFeatureSet.voidIf the current map has an id, restore the map from the database, removing all unsaved changes.voidSaves the current map.voidSetter for the fieldactiveFeatureSet.voidsetActiveFeatureSet(ManualFeatureSet activeFeatureSet) Setter for the fieldactiveFeatureSet.voidsetActiveFeatureSetAsString(String features) setActiveFeatureSetAsString.voidsetCurrentGeoMapType.voidsetCurrentMap(GeoMap currentMap) Sets the current map to a clone of the given map.voidsetCurrentMapId(Long mapId) If a GeoMap of the given mapId exists in the database, set the current map to a clone of that map.voidsetSelectedLanguage(Locale selectedLanguage) Setter for the fieldselectedLanguage.voidsetSelectedLocale(Locale locale) Sets the locale to use for display and editing.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.goobi.viewer.model.translations.IPolyglott
getLocales, isDefaultLocaleSelected, isSelected, setSelectedLocale
-
Constructor Details
-
GeoMapBean
public GeoMapBean()Creates a new GeoMapBean instance.
-
-
Method Details
-
getCurrentMap
Getter for the fieldcurrentMap.- Returns:
- the GeoMap currently being edited, or null if none is selected
-
setCurrentMap
Sets the current map to a clone of the given map.- Parameters:
currentMap- the GeoMap to clone and set as the currently edited map
-
setCurrentMapId
If a GeoMap of the given mapId exists in the database, set the current map to a clone of that map.- Parameters:
mapId- database ID of the map to load- Throws:
DAOException
-
getCurrentMapId
getCurrentMapId.- Returns:
- ID of the currently loaded map
-
saveCurrentMap
Saves the current map. Either add it to database if it has no id yet, or otherwise update it in the database.- Throws:
DAOException
-
deleteMap
deleteMap.- Parameters:
map- GeoMap to delete from the database- Throws:
DAOException
-
getEditMapUrl
getEditMapUrl.- Parameters:
map- GeoMap whose edit URL to build- Returns:
- Map edit URL
-
resetCurrentMap
If the current map has an id, restore the map from the database, removing all unsaved changes. If the current map exists but has no id, set the current map to a new empty map.- Throws:
DAOException
-
createEmptyCurrentMap
public void createEmptyCurrentMap()Sets the currentMap to a new emptyGeoMap. -
getSelectedLanguage
Getter for the fieldselectedLanguage.- Returns:
- the locale representing the language currently selected for editing map translations
-
setSelectedLanguage
Setter for the fieldselectedLanguage.- Parameters:
selectedLanguage- the locale representing the language selected for editing map translations
-
getAllMaps
Gets a list of allGeoMaps from the databse. Note that the databse is queries at each method call.- Returns:
- a list of all stored GeoMaps
- Throws:
DAOException
-
getPossibleMapTypes
getPossibleMapTypes.- Returns:
- the collection of all available geo map type values
-
getPossibleMarkers
getPossibleMarkers.- Returns:
- the collection of all configured geo map marker definitions
-
hasCurrentFeature
public boolean hasCurrentFeature()hasCurrentFeature.- Returns:
- true if a current GeoJSON feature is selected in the editor, false otherwise
-
isInUse
isInUse.- Parameters:
map- GeoMap to check for usage in CMS pages- Returns:
- true if the given map is referenced by at least one CMS page, false otherwise
- Throws:
DAOException- if any.
-
getEmbeddingCmsPages
getEmbeddingCmsPages.- Parameters:
map- GeoMap to find embedding CMS pages for- Returns:
- a list of CMS pages that embed the given GeoMap
- Throws:
DAOException- if any.
-
isHasMaps
isHasMaps.- Returns:
- true if at least one geo map is stored in the database, false otherwise
- Throws:
DAOException- if any.
-
getCoordinateSearchQuery
-
getHeatmapUrl
getHeatmapUrl.- Returns:
- the URL to the spatial heatmap REST endpoint
-
getFeatureUrl
getFeatureUrl.- Returns:
- the URL to the spatial search REST endpoint
-
addFeatureSet
addFeatureSet.- Parameters:
map- GeoMap to add the feature set totype- feature set type identifier (MANUAL, SOLR_QUERY, SEARCH_RESULTS)
-
removeFeatureSet
removeFeatureSet.- Parameters:
map- GeoMap to remove the feature set fromset- feature set to remove
-
setCurrentGeoMapType
setCurrentGeoMapType.- Parameters:
type- new map type to apply to the current map
-
getActiveFeatureSet
Getter for the fieldactiveFeatureSet.- Returns:
- the currently active feature set, or null if none is selected
-
setActiveFeatureSet
Setter for the fieldactiveFeatureSet.- Parameters:
activeFeatureSet- manual feature set to mark as active
-
getActiveFeatureSetAsString
getActiveFeatureSetAsString.- Returns:
- the GeoJSON string representation of the active feature set, or an empty string if none is active
- Throws:
PresentationException- if any.
-
setActiveFeatureSetAsString
setActiveFeatureSetAsString.- Parameters:
features- GeoJSON string representing the features to set
-
setActiveFeatureSet
public void setActiveFeatureSet()Setter for the fieldactiveFeatureSet. -
isActiveFeatureSet
isActiveFeatureSet.- Parameters:
featureSet- feature set to check against the active one- Returns:
- true if the given feature set is the currently active feature set, false otherwise
-
getFromCache
getFromCache.- Parameters:
geomap- GeoMap to look up or store in cache- Returns:
- the cached GeoMap if recently cached; otherwise the given GeoMap itself
-
isComplete
If this returns true, an associated language tab should have the 'already-translated' class, otherwise the '-partly-translated' class unlessIPolyglott.isEmpty(Locale)also returns true.Return true if the the current geomap is not null and its title in the given locale is not empty and the description is either not empty for the current locale of the description for the default locale is empty. Otherwise return false
- Specified by:
isCompletein interfaceIPolyglott- Parameters:
locale- the locale to check translation completeness for- Returns:
- true if
IPolyglott.isValid(Locale)returns true for the given locale and all fields contain a value which have a value in the default locale. For the default locale,IPolyglott.isComplete(Locale)andIPolyglott.isValid(Locale)are identical. For implementations with only one field, both methods are also always identical
-
isValid
Only meaningful for the default language for which all required fields must be filled.Return true if the the current geomap is not null and its tile in the given locale is not empty Otherwise return false
- Specified by:
isValidin interfaceIPolyglott- Parameters:
locale- the locale to validate required fields for- Returns:
- true if all required fields contain a value in the given locale
-
isEmpty
If this returns true, an associated language tab should have neither the 'already-translated' nor the '-partly-translated' class.return false if
isValid(Locale)returns true and vice versa- Specified by:
isEmptyin interfaceIPolyglott- Parameters:
locale- the locale to check for empty fields- Returns:
- true if no fields are filled for the given locale
-
getSelectedLocale
- Specified by:
getSelectedLocalein interfaceIPolyglott- Returns:
- the locale currently set by
IPolyglott.setSelectedLocale(Locale)
-
setSelectedLocale
Sets the locale to use for display and editing.- Specified by:
setSelectedLocalein interfaceIPolyglott- Parameters:
locale- the locale to select
-