Class RepositoryUtils
java.lang.Object
org.dlese.dpc.services.dds.toolkit.RepositoryUtils
Provides functions that use the DDSServicesToolkit to get information about collections, itemRecords,
terms and other data from a DDS repository.
- Author:
- ostwald, weatherley
-
Constructor Summary
ConstructorsConstructorDescriptionRepositoryUtils(String baseUrl) Constructor for the RepositoryUtils objectRepositoryUtils(DDSServicesToolkit ddsServicesToolkit) Constructor for the RepositoryUtils object -
Method Summary
Modifier and TypeMethodDescriptionString[]checkForErrorResponse(org.dom4j.Document doc) protected CollectionInfogetCollectionInfo(String collection) Gets the collectionInfo instance for the specified collectionGets the collectionInfos attribute of the RepositoryUtils objectReturns a List of collection keys (e.g., "dcc") defined in the repository.protected intgetIntAtPath(org.dom4j.Node baseElement, String relativePath) Gets the integer value of the node located at relativePath from given baseElement.getItemRecordMap(String collection) Gets a mapping of recordIds to itemRecords (as Documents) for the specified collectiongetItemRecordMap(CollectionInfo collectionInfo, int startOffset, int numReturns) Returns an itemRecordMap for the specified collection, startOffset and batchSizegetItemRecords(String collection) Returns the itemRecords of the specified collection as dom4j.DocumentsgetItemRecords(CollectionInfo collectionInfo, int startOffset, int numReturns) Gets a batch of itemRecordsgetTermsInfoForFields(String[] fields) Get terms data for one or more fields in a DDS repository index.protected StringgetValueAtPath(org.dom4j.Node baseElement, String relativePath) Gets the textual value of the node located at relativePath from given baseElement.static voidThe main program for the RepositoryUtils classprotected StringsubElementValue(org.dom4j.Element parent, String childTagName) Gets the text value of the specified child of a given parent element.
-
Constructor Details
-
RepositoryUtils
Constructor for the RepositoryUtils object- Parameters:
baseUrl- DDSWebservice baseUrl (e.g., "http://www.dlese.org/dds/services/ddsws1-1")
-
RepositoryUtils
Constructor for the RepositoryUtils object- Parameters:
ddsServicesToolkit- A DDSServicesToolkit
-
-
Method Details
-
getToolKit
-
getItemRecordMap
Gets a mapping of recordIds to itemRecords (as Documents) for the specified collection- Parameters:
collection- collection key (e.g., "dcc")- Returns:
- The itemRecordMap value
- Throws:
Exception- if the itemRecordMap cannot be constructed
-
getItemRecordMap
public Map getItemRecordMap(CollectionInfo collectionInfo, int startOffset, int numReturns) throws Exception Returns an itemRecordMap for the specified collection, startOffset and batchSizeNOTE: to search over all records,
- Parameters:
collectionInfo- NOT YET DOCUMENTEDstartOffset- NOT YET DOCUMENTEDnumReturns- NOT YET DOCUMENTED- Returns:
- The itemRecordMap value
- Throws:
Exception- NOT YET DOCUMENTED
-
checkForErrorResponse
-
getItemRecords
Returns the itemRecords of the specified collection as dom4j.Documents- Parameters:
collection- collection key ("dcc")- Returns:
- The itemRecords value
- Throws:
Exception- Description of the Exception
-
getItemRecords
public Collection getItemRecords(CollectionInfo collectionInfo, int startOffset, int numReturns) throws Exception Gets a batch of itemRecords- Parameters:
collectionInfo- NOT YET DOCUMENTEDstartOffset- NOT YET DOCUMENTEDnumReturns- NOT YET DOCUMENTED- Returns:
- The itemRecords value
- Throws:
Exception- NOT YET DOCUMENTED
-
getCollectionKeys
Returns a List of collection keys (e.g., "dcc") defined in the repository.- Returns:
- The collectionKeys value
- Throws:
Exception- NOT YET DOCUMENTED
-
getCollectionInfos
Gets the collectionInfos attribute of the RepositoryUtils object- Returns:
- A list of CollectionInfo instances
- Throws:
Exception- Description of the Exception
-
getCollectionInfo
Gets the collectionInfo instance for the specified collection- Parameters:
collection- collection key (e.g., "dcc")- Returns:
- The collectionInfo value
- Throws:
Exception- NOT YET DOCUMENTED
-
getValueAtPath
Gets the textual value of the node located at relativePath from given baseElement.- Parameters:
baseElement- Description of the ParameterrelativePath- Description of the Parameter- Returns:
- The valueAtPath value
- Throws:
Exception- if there is no node at relativePath from baseElement
-
getIntAtPath
Gets the integer value of the node located at relativePath from given baseElement.- Parameters:
baseElement- Description of the ParameterrelativePath- Description of the Parameter- Returns:
- The intAtPath value
- Throws:
Exception- if there is no node at relativePath from baseElement, or if the value found is not an integer
-
subElementValue
Gets the text value of the specified child of a given parent element.- Parameters:
parent- Element whose child element supplies the textchildTagName- tagName of child element- Returns:
- textual content of named child element
-
main
The main program for the RepositoryUtils class- Parameters:
args- The command line arguments- Throws:
Exception- NOT YET DOCUMENTED
-
getTermsInfoForFields
public TermsInfo getTermsInfoForFields(String[] fields) throws DDSServiceErrorResponseException, Exception Get terms data for one or more fields in a DDS repository index. The request accepts one or more fields to list the terms data for. Note that this request is much less efficient when more than one field is requested.- Parameters:
fields- One or more fields to get terms data for- Returns:
- The data about the terms in the given field(s)
- Throws:
DDSServiceErrorResponseException- If service errorException- If other error
-