Package io.goobi.viewer.model.archives
Class ArchiveManager
java.lang.Object
io.goobi.viewer.model.archives.ArchiveManager
- All Implemented Interfaces:
Serializable
Loads and holds archive tree models. This class should have an application wide scope
- Author:
- Florian Alpers
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindIndexedNeighbours(String entryId) In the list of archive document search hits, find the id of the entry just before the given one.getArchive(String resourceId) Returns the loaded archive with the given resource ID.getArchiveHierarchyForIdentifier(ArchiveResource resource, String identifier) Returns the entry hierarchy from the root down to the entry with the given identifier.getArchiveResource(String archiveName) getArchiveTree(String resourceId) getArchiveUrl(ArchiveResource resource, String entryIdentifier) getNodeType(String name) Returns the node type configured for the given name.If only one archive database exists and database status isArchiveManager.DatabaseState.ARCHIVES_LOADED, redirect to the matching url.Reloads nodeTyps from the config.booleanloadArchiveForEntry(String identifier) intunloadArchives(Set<String> resourceIds) Removes archives from the loaded archives map if their resourceId matches any in the given list.voidChecks the list of ead archives for updates.
-
Constructor Details
-
ArchiveManager
public ArchiveManager()
-
-
Method Details
-
getArchiveTree
public ArchiveTree getArchiveTree(String resourceId) throws IllegalStateException, PresentationException, IndexUnreachableException - Parameters:
resourceId- identifier of the archive resource to load- Returns:
ArchiveTree- Throws:
IllegalStateExceptionPresentationExceptionIndexUnreachableException
-
getArchiveResource
- Parameters:
archiveName- name of the archive resource to look up- Returns:
- ArchiveResource
-
getNodeType
Returns the node type configured for the given name. If no node type is configured for the name, then the default node type - indicated by thedefault="true"attribute - is used- Parameters:
name- node type name to look up in the configuration- Returns:
NodeType
-
getOnlyDatabaseResource
If only one archive database exists and database status isArchiveManager.DatabaseState.ARCHIVES_LOADED, redirect to the matching url.- Returns:
- Optional
-
loadArchiveForEntry
public ArchiveResource loadArchiveForEntry(String identifier) throws IllegalStateException, PresentationException, IndexUnreachableException - Parameters:
identifier- EAD node ID used to locate the containing archive- Returns:
- ArchiveResource
- Throws:
IllegalStateExceptionPresentationExceptionIndexUnreachableException
-
getArchiveUrl
- Parameters:
resource- archive resource the entry belongs toentryIdentifier- identifier of the selected archive entry- Returns:
- Constructed URL
-
getDatabaseState
-
getDatabases
- Returns:
- List
-
findIndexedNeighbours
public static org.apache.commons.lang3.tuple.Pair<Optional<String>,Optional<String>> findIndexedNeighbours(String entryId) throws PresentationException, IndexUnreachableException In the list of archive document search hits, find the id of the entry just before the given one.- Parameters:
entryId- EAD node ID for which neighbours are to be found- Returns:
- the neighboring entry id if it exists
- Throws:
PresentationExceptionIndexUnreachableException
-
getArchiveHierarchyForIdentifier
public List<ArchiveEntry> getArchiveHierarchyForIdentifier(ArchiveResource resource, String identifier) Returns the entry hierarchy from the root down to the entry with the given identifier.- Parameters:
resource- archive resource whose tree is searchedidentifier- Entry identifier- Returns:
- List of entries An empty list if the identified node has no ancestors or doesn't exist
-
getArchive
Returns the loaded archive with the given resource ID.- Parameters:
resourceId- the resource identifier of the archive to look up- Returns:
- the matching
ArchiveResource, or null if not found or resourceId is blank
-
getUpdatedNodeTypes
Reloads nodeTyps from the config.- Returns:
- this.nodeTypes
-
updateArchiveList
public void updateArchiveList()Checks the list of ead archives for updates. An update occurs if either the "lastModifiedDate" of an archive has changed since the last request, or if an archive was added or removed. In these cases, the list of records associated with an archive entry is updated as well -
unloadArchives
Removes archives from the loaded archives map if their resourceId matches any in the given list.- Parameters:
resourceIds- List of archive resource IDs to remove- Returns:
- Number of removed archives
-
isInErrorState
public boolean isInErrorState() -
getEadParser
-