Package io.goobi.viewer.controller
Class ProcessDataResolver
java.lang.Object
io.goobi.viewer.controller.ProcessDataResolver
Utility class for retrieving data folders, data files and source files. Must be instantiated with
Configuration
, SolrSearchIndex
and RestApiManager
as data sources No-Args constructor creates required data sources from DataManager.getInstance()
-
Constructor Summary
ConstructorDescriptionProcessDataResolver
(Configuration config, SolrSearchIndex searchIndex, RestApiManager restApiManager) -
Method Summary
Modifier and TypeMethodDescriptiongetDataFilePath
(String pi, String relativeFilePath) getDataFilePath.getDataFilePath
(String pi, String dataFolderName, String altDataFolderName, String inFileName) Returns the path to the data file (if file name given) or data folder for the given record identifier.getDataFolder
(String pi, String dataFolderName) Constructs the folder path for data of the given pi, either directly in viewer-home or within a data repository.getDataFolder
(String pi, String dataFolderName, String dataRepositoryFolder) Returns the data folder path for the given record identifier.getDataFolders
(String pi, String... dataFolderNames) Returns a map of Paths for each data folder name passed as an argument.Retrieves the path to viewer home or repositories root, depending on the record.getDataset
(String pi) creates a Dataset object, containing all relevant file pathsgetMediaFolder
(String pi) Constructs the media folder path for the given pi, either directly in viewer-home or within a data repositorygetSourceFilePath
(String fileName, String format) Returns the absolute path to the source (METS/LIDO) file with the given file name.getSourceFilePath
(String fileName, String dataRepository, String format) Returns the absolute path to the source (METS/LIDO/DENKXWEB/DUBLINCORE) file with the given file name.getTextFilePath
(String pi, String relativeFilePath) getTextFilePath.getTextFilePath
(String pi, String fileName, String format) getTextFilePath.loadFulltext
(String altoFilePath, String fulltextFilePath, boolean mergeLineBreakWords, javax.servlet.http.HttpServletRequest request) Loads plain full-text via the REST service.loadTei.
-
Constructor Details
-
ProcessDataResolver
public ProcessDataResolver(Configuration config, SolrSearchIndex searchIndex, RestApiManager restApiManager) -
ProcessDataResolver
public ProcessDataResolver()
-
-
Method Details
-
getDataRepositoryPathForRecord
public String getDataRepositoryPathForRecord(String pi) throws PresentationException, IndexUnreachableException Retrieves the path to viewer home or repositories root, depending on the record. Used to generate a specific task client query parameter.- Parameters:
pi
- Record identifier- Returns:
- The root folder path of the data repositories; viewer home if none are used
- Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getMediaFolder
Constructs the media folder path for the given pi, either directly in viewer-home or within a data repository- Parameters:
pi
- The work PI. This is both the actual name of the folder and the identifier used to look up data repository in solr- Returns:
- A Path to the media folder for the given PI
- Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getDataFolders
public Map<String,Path> getDataFolders(String pi, String... dataFolderNames) throws PresentationException, IndexUnreachableException Returns a map of Paths for each data folder name passed as an argument.- Parameters:
pi
- The record identifier. This is both the actual name of the folder and the identifier used to look up data repository in SolrdataFolderNames
- aString
object.- Returns:
- HashMap<dataFolderName,Path>
- Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getDataFolder
public Path getDataFolder(String pi, String dataFolderName) throws PresentationException, IndexUnreachableException Constructs the folder path for data of the given pi, either directly in viewer-home or within a data repository.- Parameters:
pi
- The record identifier. This is both the actual name of the folder and the identifier used to look up data repository in SolrdataFolderName
- the data folder within the repository; e.g 'media' or 'alto'- Returns:
- A Path to the data folder for the given PI
- Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getDataFolder
Returns the data folder path for the given record identifier. To be used in clients that already possess the data repository name. -
getDataFilePath
public Path getDataFilePath(String pi, String dataFolderName, String altDataFolderName, String inFileName) throws PresentationException, IndexUnreachableException Returns the path to the data file (if file name given) or data folder for the given record identifier.- Parameters:
pi
- Record identifierdataFolderName
- Name of the data folder (e.g. 'alto') - first choicealtDataFolderName
- Name of the data folder - second choiceinFileName
- Optional name of the content file- Returns:
- Path to the requested file or folder
- Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getDataFilePath
public Path getDataFilePath(String pi, String relativeFilePath) throws PresentationException, IndexUnreachableException getDataFilePath.
- Parameters:
pi
- Record identifierrelativeFilePath
- File path relative to data repositories root- Returns:
- File represented by the relative file path
- Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getSourceFilePath
public String getSourceFilePath(String fileName, String format) throws PresentationException, IndexUnreachableException Returns the absolute path to the source (METS/LIDO) file with the given file name.- Parameters:
fileName
- aString
object.format
- aString
object.- Returns:
- a
String
object. - Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getSourceFilePath
Returns the absolute path to the source (METS/LIDO/DENKXWEB/DUBLINCORE) file with the given file name. -
getTextFilePath
public String getTextFilePath(String pi, String fileName, String format) throws PresentationException, IndexUnreachableException getTextFilePath.
- Parameters:
pi
- aString
object.fileName
- aString
object.format
- aString
object.- Returns:
- a
String
object. - Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
getTextFilePath
public Path getTextFilePath(String pi, String relativeFilePath) throws PresentationException, IndexUnreachableException getTextFilePath.
- Parameters:
pi
- aString
object.relativeFilePath
- ALTO/text file path relative to the data folder- Returns:
- a
Path
object. - Throws:
PresentationException
- if any.IndexUnreachableException
- if any.
-
loadFulltext
public String loadFulltext(String altoFilePath, String fulltextFilePath, boolean mergeLineBreakWords, javax.servlet.http.HttpServletRequest request) throws IOException, IndexUnreachableException, DAOException, ViewerConfigurationException Loads plain full-text via the REST service. ALTO is is a fallback (and converted to plain text, with a plain text fallback.- Parameters:
altoFilePath
- ALTO file path relative to the repository root (e.g. "alto/PPN123/00000001.xml")fulltextFilePath
- plain full-text file path relative to the repository root (e.g. "fulltext/PPN123/00000001.xml")mergeLineBreakWords
- a boolean.request
- aHttpServletRequest
object.- Returns:
- a
String
object. - Throws:
AccessDeniedException
- if any.IOException
- if any.IndexUnreachableException
- if any.DAOException
- if any.ViewerConfigurationException
- if any.
-
loadAlto
public StringPair loadAlto(String altoFilePath) throws de.unigoettingen.sub.commons.contentlib.exceptions.ContentNotFoundException, IndexUnreachableException, PresentationException, FileNotFoundException - Parameters:
altoFilePath
-- Returns:
- StringPair(ALTO,charset)
- Throws:
de.unigoettingen.sub.commons.contentlib.exceptions.ContentNotFoundException
IndexUnreachableException
PresentationException
FileNotFoundException
-
loadTei
loadTei.
- Parameters:
pi
- aString
object.language
- aString
object.- Returns:
- a
String
object. - Throws:
AccessDeniedException
- if any.IOException
- if any.ViewerConfigurationException
- if any.
-
getDataset
public Dataset getDataset(String pi) throws PresentationException, IndexUnreachableException, RecordNotFoundException, IOException creates a Dataset object, containing all relevant file paths- Parameters:
pi
- aString
object.- Returns:
- a
Dataset
object. - Throws:
PresentationException
IndexUnreachableException
RecordNotFoundException
IOException
-