DLESE Tools
v1.6.0

org.dlese.dpc.index.reader
Class XMLDocReader

java.lang.Object
  extended by org.dlese.dpc.index.reader.DocReader
      extended by org.dlese.dpc.index.reader.FileIndexingServiceDocReader
          extended by org.dlese.dpc.index.reader.XMLDocReader
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
DcsDataDocReader, DleseAnnoDocReader, DleseCollectionDocReader, ItemDocReader, NewsOppsDocReader

public class XMLDocReader
extends FileIndexingServiceDocReader

A bean meant for subclassing that contains methods to read search results from indexed XML records. Subclasses of this bean provide specific accessor methods for XML data of their type. The data is read from a Lucene Document that was returned from a search and from XML on file.

In general, one XMLDocReader may be created for each document type that is defined in package org.dlese.dpc.index.writer.

Author:
John Weatherley
See Also:
XMLFileIndexingWriter, Serialized Form

Nested Class Summary
 class XMLDocReader.VocabUiLabelsCollection
          A collection of user interface labels derived from vocabulary field/value IDs.
 
Field Summary
protected  MetadataVocab metadataVocab
          The vocab manager
protected  RecordDataService recordDataService
          The record data service
protected  RepositoryManager repositoryManager
          The RepositoryManager
 
Fields inherited from class org.dlese.dpc.index.reader.DocReader
conf, doc, resultDoc, score
 
Constructor Summary
XMLDocReader()
          Constructor for the XMLDocReader object
XMLDocReader(org.apache.lucene.document.Document doc)
          Constructor that may be used programatically to wrap a reader around a Lucene Document created by a FileIndexingServiceWriter.
 
Method Summary
 String[] getAllIds()
          Gets all the IDs associated with this resource, including this record's ID.
 String[] getAnnoCollectionKeys()
          Gets the annotataion collection keys, for example {06, 08}, for all collections that annotate this item.
 ArrayList getAnnoFormats()
          Gets the annotation formats that are associated with this item.
 ArrayList getAnnoPathways()
          Gets the anno pathways that are associated with this record.
 String[] getAnnoRatings()
          Gets a String array of all annotation star ratings for this item in numerical form from 1 to 5, or null if none.
 ArrayList getAnnoStatus()
          Gets the annotation statuses that are associated with this item.
 ResultDocList getAnnotationResultDocs()
          Gets the ResultDocs for all annotations that refer to this resource.
 String[] getAnnoTypes()
          Gets the anno types that are associated with this record.
 Map getAssignedByIdRelatedRecordsMap()
          Gets a Map of records that this item assignes a relationship to by ID, keyed by relationship type, for example 'isAnnotatedBy'.
 Map getAssignedByUrlRelatedRecordsMap()
          Gets a Map of record ResultDoc arrays that this item assignes a relationship to by URL, keyed by relationship type, for example 'isAnnotatedBy'.
 String[] getAssignedRelatedIdsOfType(String relationType)
          Gets the record IDs for the items that this record assignes the given relationship to.
 String[] getAssignedRelatedUrlsOfType(String relationType)
          Gets the URLs for the items that this record assignes the given relationship to.
 String[] getAssignedRelationshipByIdTypes()
          Gets the types of relationships that were asigned by this item by related ID, for example 'isAnnotatedBy'.
 String[] getAssignedRelationshipByUrlTypes()
          Gets the types of relationships that were asigned by this item by related URL, for example 'isAnnotatedBy'.
 Map getAssignedRelationshipsForItemsMap()
          Gets a Map of record IDs and the corresponding relationships they are assigned.
 String[] getAssociatedIds()
          Gets the IDs of records that refer to the same resource, not including this record's ID.
 ArrayList getAudioAnnosInProgress()
          Gets a list of DleseAnnoDocReaders containing each of the in-progress type 'audio' annotations for this resource.
 ArrayList getAvailableFormats()
          Gets the XML formats that are available for this item including those that are available through XMLConversionService.
 String getAverageAnnoRating()
          Gets a the average of all star ratings for this item as a String, or null if none.
 float getAverageAnnoRatingFloat()
          Gets a the average of all star ratings for this item as a float, or -1 if none.
 boolean getCanDissiminateFormat()
          Determine if XML for this item can be dissiminated in the requested format specified using the setRequestedXmlFormat(String), as available through XMLConversionService.
 String getCollection()
          Gets the primary collection associated with this item, for example 'dcc'.
 String getCollectionKey()
          Gets the collection key associated with this record, for example 01.
 String[] getCollectionKeys()
          Gets all collection keys associated with this record, for example {01,02}.
 String getCollectionLabel()
          Gets the collection UI label from the vocab manager for this record, for example 'DLESE Community Collection (DCC)', or the short title from the collection record if the vocab manager is not available.
 String[] getCollections()
          Gets the collections associated with this record as an array of Strings, for example {dcc,comet}.
 ArrayList getCompletedAdvice()
          Gets a list of DleseAnnoDocReaders containing each of the completed type 'advice' annotations for this resource.
 String[] getCompletedAnnoCollectionKeys()
          Gets the annotataion collection keys, for example {06, 08}, for all collections that annotate this item with one or more status completed annotations.
 ArrayList getCompletedAnnos()
          Gets a list of DleseAnnoDocReaders containing each of the completed annotations, regardless of type, for this resource.
 ArrayList getCompletedAnnosOfType(String type)
          Gets a list of all completed annotataions for this item of the given type.
 ArrayList getCompletedAnnotation()
          Gets a list of DleseAnnoDocReaders containing each of the completed type 'annotation' annotations for this resource.
 ArrayList getCompletedAverageScores()
          Gets a list of DleseAnnoDocReaders containing each of the completed type 'average scores' annotations for this resource.
 ArrayList getCompletedBias()
          Gets a list of DleseAnnoDocReaders containing each of the completed type 'bias' annotations for this resource.
 ArrayList getCompletedChallengingSituations()
          Gets a list of DleseAnnoDocReaders containing each of the completed type 'challenging situation' annotations for this resource.
 ArrayList getCompletedChange()
          Gets a list of DleseAnnoDocReaders containing each of the completed type 'change' annotations for this resource.
 ArrayList getCompletedComment()
          Gets a list of DleseAnnoDocReaders containing each of the completed type 'comment' annotations for this resource.
 ArrayList getCompletedEditorSummaries()
          Gets a list of DleseAnnoDocReaders containing each of the completed type 'editors summary' annotations for this resource.
 ArrayList getCompletedEducationalStandard()
          Gets a list of DleseAnnoDocReaders containing each of the completed type 'educational standard' annotations for this resource.
 ArrayList getCompletedExample()
          Gets a list of DleseAnnoDocReaders containing each of the completed type 'example' annotations for this resource.
 ArrayList getCompletedExplanation()
          Gets a list of DleseAnnoDocReaders containing each of the completed type 'explanation' annotations for this resource.
 ArrayList getCompletedQuestion()
          Gets a list of DleseAnnoDocReaders containing each of the completed type 'question' annotations for this resource.
 ArrayList getCompletedReviews()
          Gets a list of DleseAnnoDocReaders containing each of the completed type 'review' annotations for this resource.
 ArrayList getCompletedSeeAlso()
          Gets a list of DleseAnnoDocReaders containing each of the completed type 'see also' annotations for this resource.
 ArrayList getCompletedTeachingTips()
          Gets a list of DleseAnnoDocReaders containing each of the completed type 'teaching tip' annotations for this resource.
 String getDescription()
          Gets the description for the item.
 String getDocsource()
          Gets the path to the source file of the document used to create this index record.
protected  String getFieldId(String fieldString, String metadataFormat)
          Gets the field ID from the field name, for example 'gradeRange' will return 'gr'.
 ArrayList getGraphicalAnnosInProgress()
          Gets a list of DleseAnnoDocReaders containing each of the in-progress type 'graphical' annotations for this resource.
 boolean getHasAssignedRelations()
          Determines whether this item assigns one or more relationships by ID or URL.
 String getHasCompletedAnno()
          Gets the hasCompletedAnno attribute of the ItemDocReader object
 String getHasInProgressAnno()
          Determines whether the item has an annotation in progress.
 boolean getHasRelations()
          Determines whether this item has one or more relations.
 String getId()
          Gets the id for this record, for example 'DLESE-000-000-000-001'.
 String getIdEncoded()
          Gets the id for this record as encoded for unique searching and inexing.
 List getIdsOfRecordsWithAssignedRelationships()
          Gets a List of all IDs for records that this item assignes relationships for by ID or URL.
 String getIndexedContent()
          Gets the full text of the content that was indexed.
 ArrayList getInProgressAnnosOfFormat(String format)
          Gets all in-progress annotations for this item that have the given format, which is one of 'text', 'audio', 'graphical', or 'video'.
 boolean getIsMyCollectionDisabled()
          Determines whether my collection is 'disabled'.
 boolean getIsMyCollectionEnabled()
          Determines whether my collection is 'enabled'.
 String getMetadataPrefix()
          Gets the metadata previx (format) of the file associated with this reader, for example 'dlese_ims' or 'adn'.
 MetadataVocab getMetadataVocab()
          Gets the metadataVocab manager, or null if one is not available
 String getMetadataVocabAudience()
          Gets the metadataVocabAudience attribute of the XMLDocReader object
 String getMetadataVocabLanguage()
          Gets the metadataVocabLanguage attribute of the XMLDocReader object
protected  org.apache.lucene.document.Document getMultiDoc()
          Gets the multiDoc lucene Document for this item, or the single doc, if none available.
 DleseCollectionDocReader getMyCollectionDoc()
          Gets the collection doc for the collection in which this record is a part.
 String getMyCollectionsRecordId()
          Gets the ID of collection record in which this item belongs.
 String getNativeFormat()
          Gets the nativeFormat of the file associated with this reader, for example 'dlese_ims' or 'adn'.
 String getNsdlDublinCoreXml()
          Gets the content in NSDL Dublin Core XML format, or empty String if not available.
 String getNumAnnoRatings()
          Gets a the total number of star ratings for this item as a String.
 int getNumAnnoRatingsInt()
          Gets a the total number of star ratings for this item as a int.
 String getNumAudioAnnosInProgress()
          Gets the numAudioAnnosInProgress attribute of the ItemDocReader object
 String getNumCompletedAnnos()
          Gets the numCompletedAnnos attribute of the ItemDocReader object
 String getNumGraphicalAnnosInProgress()
          Gets the numGraphicalAnnosInProgress attribute of the ItemDocReader object
 String getNumInProgressAnnos()
          Gets the numInProgressAnnos attribute of the ItemDocReader object
 String getNumTextAnnosInProgress()
          Gets the numTextAnnosInProgress attribute of the ItemDocReader object
 String getNumVideoAnnosInProgress()
          Gets the number of video format annotations in progress for this item.
 String getOaiDatestamp()
          Gets the oaiDatestamp in UTC format for the given record.
 String getOaiDublinCoreXml()
          Gets the content in OAI Dublin Core XML format, or empty String if not available.
 String getOaiLastModifiedString()
          Gets a String representataion of the oai datestamp in readable format.
 List getOaiSets()
          Gets the OAI sets associated with this record as an ArrayList of Strings, for example 'dcc' or null.
 String getReaderType()
          Gets the String 'XmlDocReader,' which is the key that describes this reader type.
 String[] getRelatedIdsOfType(String relationType)
          Gets the record IDs for the documents with the given relationship to this item, for example 'isAnnotatedBy'.
 Map getRelatedRecordsMap()
          Gets a Map of records that are related to this item, keyed by relationship type, for example 'isAnnotatedBy'.
 String[] getRelationshipTypes()
          Gets the types of relationships that were indexed for this item, for example 'isAnnotatedBy'.
 String getRequestedXml()
          Same as getRequestedXmlFormat() except returns the non-localized XML if no format was specified.
 String getRequestedXmlFormat()
          Gets XML in the format that was previously specified using the setRequestedXmlFormat(String) method, or the localized native format if none was specified.
 String getSet()
          Gets the primary set (collection) associated with this item, for example dcc.
 String[] getSets()
          Gets the sets (collections) associated with this record as an array of Strings, for example dcc, which is not the same as the OAI sets.
 String getSetString()
          Gets the collections associated with this record as a single String.
 ArrayList getTextAnnosInProgress()
          Gets a list of DleseAnnoDocReaders containing each of the in-progress type 'text' annotations for this resource.
 String getTitle()
          Gets the title of the item.
protected  String getUiLabelFromVocabId(String fieldId, String valueId, String metadataFormat)
          Gets the UI label corresponding to the given vocab value IDs and field ID.
protected  String getUiLabelFromVocabName(String fieldName, String vocabName, String metadataFormat)
          Gets the UI label corresponding to the given vocab value name from the XML and field name.
protected  Collection getUiLabelsFromVocabIds(String fieldId, String[] valueIds, String metadataFormat)
          Gets the UI labels corresponding to the given vocab value IDs and field ID.
 String getUrl()
          Gets the url for the item.
 String getValidationReport()
          Gets the validationReport for this document, or null if no validationReport was found.
protected  String getValueId(String fieldName, String vocabName, String metadataFormat)
          Gets the value ID from the field name and value name, for example 'key', 'dcc' will return '09'.
 ArrayList getVideoAnnosInProgress()
          Gets a list of DleseAnnoDocReaders containing each of the in-progress type 'video' annotations for this resource.
 Document getW3CXmlDoc()
          Gets a org.w3c.dom.Document for this record.
 String getWhatsNewDate()
          Gets the Whats New date as a String.
 Date getWhatsNewDateDate()
          Gets the Whats New date as a Date.
 String getWhatsNewType()
          Gets the Whats New type, which is one of 'itemnew,' 'itemannocomplete,' 'itemannoinprogress,' 'annocomplete,' 'annoinprogress,' 'drcannocomplete,' 'drcannoinprogress,' 'collection'.
 String getXml()
          Gets the full XML for this record in it's native format.
 Document getXmlDoc()
          Gets a dom4j XML Document for this record.
 String getXmlFormat(String format, boolean filter)
          Gets XML in the given format.
 String getXmlLocalized()
          Gets the native format in a localized form if available, otherwise returns the native format stripped of XML and DTD declarations.
 String getXmlStripped()
          Gets the full XML for this record in it's native format, with no XML or DTD declaration.
 boolean hasAnnotations()
          Determines whether this item has annotations.
 boolean hasCompletedAnno()
          Determines whether this item has at least one completed annotation.
 boolean hasCompletedAnnoOfType(String type)
          Determines whether this item has a completed annotataion of the given type, for example 'Review', 'Comment', 'Educational standard', etc.
 boolean hasInProgressAnno()
          Determines whether the item has an annotation in progress.
 boolean hasInProgressAnnoOfFormat(String format)
          Determines whether the item has an annotation in progress of the given format, which is one of 'text', 'audio', 'graphical', or 'video'.
 void init()
          Initialized a new XMLDocReader at search time.
 boolean isValid()
          Determines whether the XML for this record is valid.
protected static void prtln(String s)
          Output a line of text to standard out, with datestamp, if debug is set to true.
protected static void prtlnErr(String s)
          Output a line of text to error out, with datestamp.
 void setMetadataVocabAudience(String audience)
          Sets the metadataVocabAudience attribute of the XMLDocReader object
 void setMetadataVocabLanguage(String language)
          Sets the metadataVocabLanguage attribute of the XMLDocReader object
 void setRequestedXmlFormat(String format)
          Sets the XML format that will be returned by the getRequestedXmlFormat() method.
 
Methods inherited from class org.dlese.dpc.index.reader.FileIndexingServiceDocReader
fileExists, getDateFileWasIndexed, getDateFileWasIndexedString, getDateStamp, getDeleted, getDocDir, getDocsourceEncoded, getDoctype, getFile, getFileExists, getFileName, getFullContent, getFullContentEncodedAs, getLastModified, getLastModifiedAsUTC, getLastModifiedString, isDeleted, setDebug
 
Methods inherited from class org.dlese.dpc.index.reader.DocReader
doInit, getAttribute, getDocMap, getDocument, getIndex, getLazyDocMap, getQuery, getRepositoryManager, getScore, setDoc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

metadataVocab

protected MetadataVocab metadataVocab
The vocab manager


recordDataService

protected RecordDataService recordDataService
The record data service


repositoryManager

protected RepositoryManager repositoryManager
The RepositoryManager

Constructor Detail

XMLDocReader

public XMLDocReader()
Constructor for the XMLDocReader object


XMLDocReader

public XMLDocReader(org.apache.lucene.document.Document doc)
Constructor that may be used programatically to wrap a reader around a Lucene Document created by a FileIndexingServiceWriter.

Parameters:
doc - A Lucene Document created by a ItemFileIndexingWriter.
Method Detail

init

public void init()
Initialized a new XMLDocReader at search time.

Specified by:
init in class DocReader

getReaderType

public String getReaderType()
Gets the String 'XmlDocReader,' which is the key that describes this reader type. This may be used in (Struts) beans to determine which type of reader is available for a given search result and thus what data is available for display in the UI. The reader type determines which getter methods are available.

Specified by:
getReaderType in class DocReader
Returns:
The String 'XmlDocReader'.

getIndexedContent

public String getIndexedContent()
Gets the full text of the content that was indexed.

Returns:
The indexedContent value.

getTitle

public String getTitle()
Gets the title of the item.

Returns:
The title or empty if none

getDescription

public String getDescription()
Gets the description for the item.

Returns:
The description or empty

getUrl

public String getUrl()
Gets the url for the item.

Returns:
The url or empty

getId

public String getId()
Gets the id for this record, for example 'DLESE-000-000-000-001'.

Returns:
The id value

getIdEncoded

public String getIdEncoded()
Gets the id for this record as encoded for unique searching and inexing.

Returns:
The id encoded

getMetadataPrefix

public String getMetadataPrefix()
Gets the metadata previx (format) of the file associated with this reader, for example 'dlese_ims' or 'adn'.

Returns:
The metadataPrefix value

getNativeFormat

public String getNativeFormat()
Gets the nativeFormat of the file associated with this reader, for example 'dlese_ims' or 'adn'. Same as getMetadataPrefix().

Returns:
The nativeFormat.

getWhatsNewType

public String getWhatsNewType()
Gets the Whats New type, which is one of 'itemnew,' 'itemannocomplete,' 'itemannoinprogress,' 'annocomplete,' 'annoinprogress,' 'drcannocomplete,' 'drcannoinprogress,' 'collection'.

Returns:
The What's New type or empty String.

getWhatsNewDate

public String getWhatsNewDate()
Gets the Whats New date as a String. Note that for ADN records, the appropriate method to use when displaying this value to an end user is ItemDocReader.getMultiWhatsNewDate().

Returns:
The What's New date or empty String.

getWhatsNewDateDate

public Date getWhatsNewDateDate()
Gets the Whats New date as a Date. Note that for ADN records, the appropriate method to use when displaying this value to an end user is ItemDocReader.getMultiWhatsNewDateDate().

Returns:
The What's New date or null.

getSetString

public String getSetString()
Gets the collections associated with this record as a single String.

Returns:
The collections.

getSets

public String[] getSets()
Gets the sets (collections) associated with this record as an array of Strings, for example dcc, which is not the same as the OAI sets. Assumes the set key has not been encoded using the vocab manager. The first set in the array is the primary set. Additional sets, if present, represent secondary sets that have been associated with this record via the ID mapper service.

Returns:
The set(s) associated with this record.

getOaiSets

public List getOaiSets()
Gets the OAI sets associated with this record as an ArrayList of Strings, for example 'dcc' or null.

Returns:
A List of OAI set Strings, or null if none

getSet

public String getSet()
Gets the primary set (collection) associated with this item, for example dcc. The first collection in the array is the primary collection. Additional collection, if present, represent secondary collections that have been associated with this record via the ID mapper service.

Returns:
The primary collection associated with this record.

getCollection

public String getCollection()
Gets the primary collection associated with this item, for example 'dcc'. The first collection in the array is the primary collection. Additional collection, if present, represent secondary collections that have been associated with this record via the ID mapper service.

Returns:
The primary collection associated with this record.

getCollections

public String[] getCollections()
Gets the collections associated with this record as an array of Strings, for example {dcc,comet}. Assumes the collection key has not been encoded using the vocab manager. The first collection in the array is the primary collection. Additional collection, if present, represent secondary collections that have been associated with this record via the ID mapper service.

Returns:
The collection(s) associated with this record.

getCollectionKey

public String getCollectionKey()
Gets the collection key associated with this record, for example 01. Assumes the set key has been encoded using the vocab manager and that there is only one collection associated with this item.

Returns:
The collection for which this item belogs.

getCollectionKeys

public String[] getCollectionKeys()
Gets all collection keys associated with this record, for example {01,02}. Assumes the set key has been encoded using the vocab manager and that there are more than one collections associated with this item.

Returns:
The collections for which this item belogs.

getCollectionLabel

public String getCollectionLabel()
Gets the collection UI label from the vocab manager for this record, for example 'DLESE Community Collection (DCC)', or the short title from the collection record if the vocab manager is not available. To specify the vocab interface to use, first call #setVocabInterface(String), otherwise the default will be used, which is 'dds.descr.en-us'.

An example application using JSTL might look like:

   <%-- The following line is optional --%>
   <c:set property="vocabInterface" target="${docReader}" value="dds.descr.en-us"/>
   ${docReader.collectionLabel}
  

Returns:
The collection label for this record

getMyCollectionDoc

public DleseCollectionDocReader getMyCollectionDoc()
Gets the collection doc for the collection in which this record is a part.

Returns:
The myCollectionDoc value, or null if none available.

getIsMyCollectionEnabled

public boolean getIsMyCollectionEnabled()
Determines whether my collection is 'enabled'.

Returns:
True if my collection is configured and is enabled, false if not

getIsMyCollectionDisabled

public boolean getIsMyCollectionDisabled()
Determines whether my collection is 'disabled'.

Returns:
True if my collection is configured and is disabled, false if not

getMyCollectionsRecordId

public String getMyCollectionsRecordId()
Gets the ID of collection record in which this item belongs.

Returns:
The ID of this item's collection record, or null if not available.

getXml

public final String getXml()
Gets the full XML for this record in it's native format. Characters in the String returned are encoded as UTF-8.

Returns:
The XML, or empty string if unable to process.

getXmlDoc

public final Document getXmlDoc()
Gets a dom4j XML Document for this record. This method is optimized to create only one DOM when accessed multiple times for the same XMLDocReader.

Returns:
A dom4j XML Document, or null if unable to read

getW3CXmlDoc

public Document getW3CXmlDoc()
Gets a org.w3c.dom.Document for this record. This method is optimized to create only one DOM when accessed multiple times for the same XMLDocReader.

Returns:
A org.w3c.dom.Document, or null if unable to read.

getXmlStripped

public final String getXmlStripped()
Gets the full XML for this record in it's native format, with no XML or DTD declaration. Characters in the returned String are encoded as UTF-8.

Returns:
The XML, or empty string if unable to process.

getXmlLocalized

public final String getXmlLocalized()
Gets the native format in a localized form if available, otherwise returns the native format stripped of XML and DTD declarations. Localized XML contains no namespace declarations, making XPath sytax much simpler to work with since there is no need to use the local-name() function. Characters in the String retured are encoded at UTF-8.

Returns:
The localized XML, or the native format stripped of XML and DTD declarations.

getXmlFormat

public String getXmlFormat(String format,
                           boolean filter)
Gets XML in the given format. The resulting String contains XML in the given format, or an empty String if unable to dissiminate. Uses an XMLConversionService to perform the transformation from the native format to the requested format. If filter is set to true then the output will have the XML declaration stripped out and the DTD declaration will be commented out, in the case of DLESE IMS. Use filter=true to get XML suitable for insertion into an OAI container. Use filter=true to get the full XML including XML and DTD declaration, if present. Characters in the String returned are encoded as UTF-8.

Parameters:
format - The format desired.
filter - Indicates whether to filter out the XML and DTD declaration.
Returns:
XML for the given format, or an empty String if unable to process.

getRequestedXmlFormat

public final String getRequestedXmlFormat()
Gets XML in the format that was previously specified using the setRequestedXmlFormat(String) method, or the localized native format if none was specified. The resulting String contains XML in the requested format, or an empty String if unable to process. Uses an XMLConversionService to perform the transformation from the native format to the requested format. XML and DTD declarations do not appear the output.

Returns:
XML for the requested format, or an empty String if unable to process.
See Also:
setRequestedXmlFormat(String)

getRequestedXml

public final String getRequestedXml()
Same as getRequestedXmlFormat() except returns the non-localized XML if no format was specified. XML and DTD declarations do not appear the output.

Returns:
XML for the requested format, or an empty String if unable to process.
See Also:
setRequestedXmlFormat(String), getRequestedXmlFormat()

setRequestedXmlFormat

public void setRequestedXmlFormat(String format)
Sets the XML format that will be returned by the getRequestedXmlFormat() method.

Parameters:
format - The new requestedXmlFormat value
See Also:
getRequestedXmlFormat()

getAvailableFormats

public ArrayList getAvailableFormats()
Gets the XML formats that are available for this item including those that are available through XMLConversionService.

Returns:
The availableFormats, for example adn, oai_dc

getCanDissiminateFormat

public boolean getCanDissiminateFormat()
Determine if XML for this item can be dissiminated in the requested format specified using the setRequestedXmlFormat(String), as available through XMLConversionService.

Returns:
True if the requested XML format can be dissiminated
See Also:
setRequestedXmlFormat(String), getXmlFormat(java.lang.String, boolean), getRequestedXmlFormat(), getRequestedXml()

getOaiDublinCoreXml

public String getOaiDublinCoreXml()
Gets the content in OAI Dublin Core XML format, or empty String if not available. The output contains no XML and DTD declaration.

Returns:
The oaiDublinCoreXml or empty String

getNsdlDublinCoreXml

public String getNsdlDublinCoreXml()
Gets the content in NSDL Dublin Core XML format, or empty String if not available. The output contains no XML and DTD declaration.

Returns:
The nsdlDublinCoreXml or empty String

getOaiDatestamp

public String getOaiDatestamp()
Gets the oaiDatestamp in UTC format for the given record.

Returns:
The oaiDatestamp value.

getOaiLastModifiedString

public String getOaiLastModifiedString()
Gets a String representataion of the oai datestamp in readable format.

Returns:
The File modification time.

getValidationReport

public String getValidationReport()
Gets the validationReport for this document, or null if no validationReport was found.

Returns:
The validationReport value.
See Also:
isValid()

getDocsource

public String getDocsource()
Gets the path to the source file of the document used to create this index record.

Overrides:
getDocsource in class FileIndexingServiceDocReader
Returns:
The document source file path

isValid

public boolean isValid()
Determines whether the XML for this record is valid. To search for valididity, use field valid:[true|false] (unstored). If the XML was not valid there will be a validation report available.

Returns:
True if valid, else false.
See Also:
getValidationReport()

getFieldId

protected String getFieldId(String fieldString,
                            String metadataFormat)
Gets the field ID from the field name, for example 'gradeRange' will return 'gr'.

Parameters:
fieldString - A vocab field, for example 'gradeRange'
metadataFormat - The metadata format, for example 'adn'
Returns:
The field ID, for example 'gr', or the original field name if a translation is not available

getValueId

protected String getValueId(String fieldName,
                            String vocabName,
                            String metadataFormat)
Gets the value ID from the field name and value name, for example 'key', 'dcc' will return '09'.

Parameters:
fieldName - The vocab field ID, for example 'key' or 'gradeRange'.
vocabName - The vocab value name, for example 'dcc' or 'DLESE:High school'.
metadataFormat - The metadata format, for example 'adn'
Returns:
The value ID, for example '09' or '02', or the original value name if a translation is not available

getMetadataVocab

public MetadataVocab getMetadataVocab()
Gets the metadataVocab manager, or null if one is not available

Returns:
The metadataVocab manager

getMetadataVocabLanguage

public String getMetadataVocabLanguage()
Gets the metadataVocabLanguage attribute of the XMLDocReader object

Returns:
The metadataVocabLanguage value

setMetadataVocabLanguage

public void setMetadataVocabLanguage(String language)
Sets the metadataVocabLanguage attribute of the XMLDocReader object

Parameters:
language - The new metadataVocabLanguage value

getMetadataVocabAudience

public String getMetadataVocabAudience()
Gets the metadataVocabAudience attribute of the XMLDocReader object

Returns:
The metadataVocabAudience value

setMetadataVocabAudience

public void setMetadataVocabAudience(String audience)
Sets the metadataVocabAudience attribute of the XMLDocReader object

Parameters:
audience - The new metadataVocabAudience value

getUiLabelFromVocabId

protected String getUiLabelFromVocabId(String fieldId,
                                       String valueId,
                                       String metadataFormat)
Gets the UI label corresponding to the given vocab value IDs and field ID. To specify the vocab interface to use, first call #setVocabInterface(String), otherwise the default will be used, which is 'dds.descr.en-us'. Note that if the vocab manager can not translate the given IDs then a comment string <!-- MUI... will be returned.

Parameters:
fieldId - The vocab field ID, for example 'gr'.
valueId - The vocab value IDs, for example '07'.
metadataFormat - The metadata format, for example 'adn'
Returns:
The UI lables for the given IDs, for example 'Primary (K-2)'

getUiLabelFromVocabName

protected String getUiLabelFromVocabName(String fieldName,
                                         String vocabName,
                                         String metadataFormat)
Gets the UI label corresponding to the given vocab value name from the XML and field name. To specify the vocab interface to use, first call #setVocabInterface(String), otherwise the default will be used, which is 'dds.descr.en-us'. Note that if the vocab manager can not translate the given name then a comment string <!-- MUI... will be returned.

Parameters:
fieldName - The vocab field ID, for example 'key' or 'gradeRange'.
vocabName - The vocab value name, for example 'dcc' or 'DLESE:High school'.
metadataFormat - The metadata format, for example 'adn'
Returns:
The UI lables for the given IDs, for example 'DLESE Community Collection (DCC)' or 'High (9-12)'.

getUiLabelsFromVocabIds

protected Collection getUiLabelsFromVocabIds(String fieldId,
                                             String[] valueIds,
                                             String metadataFormat)
Gets the UI labels corresponding to the given vocab value IDs and field ID. To specify the vocab interface to use, first call #setVocabInterface(String), otherwise the default will be used, which is 'dds.descr.en-us'. Note that if the vocab manager can not translate the given IDs then the valueIds will be returned unchanged.

Parameters:
fieldId - The vocab field ID, for example 'gr'.
valueIds - The vocab value IDs, for example '07', '04', '05'.
metadataFormat - The metadata format, for example 'adn'
Returns:
The UI lables for the given IDs, for example 'Primary (K-2)', 'Intermediate (3-5)', 'Middle (6-8)'

getMultiDoc

protected org.apache.lucene.document.Document getMultiDoc()
Gets the multiDoc lucene Document for this item, or the single doc, if none available. A multiDoc is a Document that holds data from multiple XML records that catalog/reference the same resource. This method is overridden by the sub classes that support it.

Returns:
The multiDoc value

getHasAssignedRelations

public boolean getHasAssignedRelations()
Determines whether this item assigns one or more relationships by ID or URL.

Returns:
True if asigned relations are present, false otherwise.

getAssignedRelationshipByIdTypes

public String[] getAssignedRelationshipByIdTypes()
Gets the types of relationships that were asigned by this item by related ID, for example 'isAnnotatedBy'.

Returns:
The types of assigned relationships, or empty array if none

getAssignedRelationshipByUrlTypes

public String[] getAssignedRelationshipByUrlTypes()
Gets the types of relationships that were asigned by this item by related URL, for example 'isAnnotatedBy'.

Returns:
The types of assigned relationships, or empty array if none

getAssignedRelatedIdsOfType

public String[] getAssignedRelatedIdsOfType(String relationType)
Gets the record IDs for the items that this record assignes the given relationship to.

Parameters:
relationType - The type of relationship assigned, for example 'isAnnotatedBy'
Returns:
The IDs of the related records

getAssignedRelatedUrlsOfType

public String[] getAssignedRelatedUrlsOfType(String relationType)
Gets the URLs for the items that this record assignes the given relationship to.

Parameters:
relationType - The type of relationship assigned, for example 'isAnnotatedBy'
Returns:
The URLs of the related items

getAssignedByIdRelatedRecordsMap

public Map getAssignedByIdRelatedRecordsMap()
Gets a Map of records that this item assignes a relationship to by ID, keyed by relationship type, for example 'isAnnotatedBy'.

Returns:
A Map of record ResultDoc arrays keyed by relationship type

getAssignedByUrlRelatedRecordsMap

public Map getAssignedByUrlRelatedRecordsMap()
Gets a Map of record ResultDoc arrays that this item assignes a relationship to by URL, keyed by relationship type, for example 'isAnnotatedBy'.

Returns:
A Map of record ResultDoc arrays keyed by relationship type

getAssignedRelationshipsForItemsMap

public Map getAssignedRelationshipsForItemsMap()
Gets a Map of record IDs and the corresponding relationships they are assigned. The key is the record ID, the value is a list of relationships assigned for that ID (assigned by ID or URL).

Returns:
A Map of type

getIdsOfRecordsWithAssignedRelationships

public List getIdsOfRecordsWithAssignedRelationships()
Gets a List of all IDs for records that this item assignes relationships for by ID or URL.

Returns:
A List of ID Strings.

getHasRelations

public boolean getHasRelations()
Determines whether this item has one or more relations.

Returns:
True if relations are present, false otherwise.

getRelationshipTypes

public String[] getRelationshipTypes()
Gets the types of relationships that were indexed for this item, for example 'isAnnotatedBy'.

Returns:
The types of relationships, or empty array if none

getRelatedIdsOfType

public String[] getRelatedIdsOfType(String relationType)
Gets the record IDs for the documents with the given relationship to this item, for example 'isAnnotatedBy'.

Parameters:
relationType - The type of relationship, for example 'isAnnotatedBy'
Returns:
The IDs of the related records

getRelatedRecordsMap

public Map getRelatedRecordsMap()
Gets a Map of records that are related to this item, keyed by relationship type, for example 'isAnnotatedBy'.

Returns:
A Map of record ResultDoc arrays keyed by relationship type

hasAnnotations

public boolean hasAnnotations()
Determines whether this item has annotations.

Returns:
True if annotations are present, false otherwise.

getAllIds

public String[] getAllIds()
Gets all the IDs associated with this resource, including this record's ID.

Returns:
The allIds value

getAssociatedIds

public String[] getAssociatedIds()
Gets the IDs of records that refer to the same resource, not including this record's ID.

Returns:
The associated IDs value.

getAnnotationResultDocs

public ResultDocList getAnnotationResultDocs()
Gets the ResultDocs for all annotations that refer to this resource.

Returns:
The ResultDocs value

hasCompletedAnno

public boolean hasCompletedAnno()
Determines whether this item has at least one completed annotation.

Returns:
True if this item has one or more completed annotation, false otherwise.

getHasCompletedAnno

public String getHasCompletedAnno()
Gets the hasCompletedAnno attribute of the ItemDocReader object

Returns:
The hasCompletedAnno value

getNumCompletedAnnos

public String getNumCompletedAnnos()
Gets the numCompletedAnnos attribute of the ItemDocReader object

Returns:
The numCompletedAnnos value

getNumInProgressAnnos

public String getNumInProgressAnnos()
Gets the numInProgressAnnos attribute of the ItemDocReader object

Returns:
The numInProgressAnnos value

getNumTextAnnosInProgress

public String getNumTextAnnosInProgress()
Gets the numTextAnnosInProgress attribute of the ItemDocReader object

Returns:
The numTextAnnosInProgress value

getNumAudioAnnosInProgress

public String getNumAudioAnnosInProgress()
Gets the numAudioAnnosInProgress attribute of the ItemDocReader object

Returns:
The numAudioAnnosInProgress value

getNumGraphicalAnnosInProgress

public String getNumGraphicalAnnosInProgress()
Gets the numGraphicalAnnosInProgress attribute of the ItemDocReader object

Returns:
The numGraphicalAnnosInProgress value

getNumVideoAnnosInProgress

public String getNumVideoAnnosInProgress()
Gets the number of video format annotations in progress for this item.

Returns:
The number of video format annotations

hasCompletedAnnoOfType

public boolean hasCompletedAnnoOfType(String type)
Determines whether this item has a completed annotataion of the given type, for example 'Review', 'Comment', 'Educational standard', etc.

Parameters:
type - The annotation type
Returns:
True if this item has a completed annotataion of the given type.

getCompletedAnnosOfType

public ArrayList getCompletedAnnosOfType(String type)
Gets a list of all completed annotataions for this item of the given type.

Parameters:
type - The annotation type, for example 'Review', 'Teaching tip', etc.
Returns:
A list of DleseAnnoDocReaders for all completed annotataions for this item of the given type, or an empty list.

getHasInProgressAnno

public String getHasInProgressAnno()
Determines whether the item has an annotation in progress.

Returns:
'true' if the item has an annotation in progress, otherwise 'false'.

hasInProgressAnno

public boolean hasInProgressAnno()
Determines whether the item has an annotation in progress.

Returns:
True if the item has an annotation in progress, otherwise false.

hasInProgressAnnoOfFormat

public boolean hasInProgressAnnoOfFormat(String format)
Determines whether the item has an annotation in progress of the given format, which is one of 'text', 'audio', 'graphical', or 'video'.

Parameters:
format - Annotation format
Returns:
True if the item has an annotation in progress of the given format, otherwise false.

getInProgressAnnosOfFormat

public ArrayList getInProgressAnnosOfFormat(String format)
Gets all in-progress annotations for this item that have the given format, which is one of 'text', 'audio', 'graphical', or 'video'.

Parameters:
format - Annotation format
Returns:
A list of DleseAnnoDocReaders

getTextAnnosInProgress

public ArrayList getTextAnnosInProgress()
Gets a list of DleseAnnoDocReaders containing each of the in-progress type 'text' annotations for this resource.

Returns:
A list of DleseAnnoDocReaders or empty list

getAudioAnnosInProgress

public ArrayList getAudioAnnosInProgress()
Gets a list of DleseAnnoDocReaders containing each of the in-progress type 'audio' annotations for this resource.

Returns:
A list of DleseAnnoDocReaders

getGraphicalAnnosInProgress

public ArrayList getGraphicalAnnosInProgress()
Gets a list of DleseAnnoDocReaders containing each of the in-progress type 'graphical' annotations for this resource.

Returns:
A list of DleseAnnoDocReaders or empty list

getVideoAnnosInProgress

public ArrayList getVideoAnnosInProgress()
Gets a list of DleseAnnoDocReaders containing each of the in-progress type 'video' annotations for this resource.

Returns:
A list of DleseAnnoDocReaders or empty list

getCompletedAnnos

public ArrayList getCompletedAnnos()
Gets a list of DleseAnnoDocReaders containing each of the completed annotations, regardless of type, for this resource.

Returns:
A list of DleseAnnoDocReaders or empty list

getCompletedReviews

public ArrayList getCompletedReviews()
Gets a list of DleseAnnoDocReaders containing each of the completed type 'review' annotations for this resource.

Returns:
A list of DleseAnnoDocReaders or empty list

getCompletedTeachingTips

public ArrayList getCompletedTeachingTips()
Gets a list of DleseAnnoDocReaders containing each of the completed type 'teaching tip' annotations for this resource.

Returns:
A list of DleseAnnoDocReaders or empty list

getCompletedEditorSummaries

public ArrayList getCompletedEditorSummaries()
Gets a list of DleseAnnoDocReaders containing each of the completed type 'editors summary' annotations for this resource.

Returns:
A list of DleseAnnoDocReaders or empty list

getCompletedChallengingSituations

public ArrayList getCompletedChallengingSituations()
Gets a list of DleseAnnoDocReaders containing each of the completed type 'challenging situation' annotations for this resource.

Returns:
A list of DleseAnnoDocReaders or empty list

getCompletedAverageScores

public ArrayList getCompletedAverageScores()
Gets a list of DleseAnnoDocReaders containing each of the completed type 'average scores' annotations for this resource.

Returns:
A list of DleseAnnoDocReaders or empty list

getCompletedAdvice

public ArrayList getCompletedAdvice()
Gets a list of DleseAnnoDocReaders containing each of the completed type 'advice' annotations for this resource.

Returns:
A list of DleseAnnoDocReaders or empty list

getCompletedAnnotation

public ArrayList getCompletedAnnotation()
Gets a list of DleseAnnoDocReaders containing each of the completed type 'annotation' annotations for this resource.

Returns:
A list of DleseAnnoDocReaders or empty list

getCompletedBias

public ArrayList getCompletedBias()
Gets a list of DleseAnnoDocReaders containing each of the completed type 'bias' annotations for this resource.

Returns:
A list of DleseAnnoDocReaders or empty list

getCompletedChange

public ArrayList getCompletedChange()
Gets a list of DleseAnnoDocReaders containing each of the completed type 'change' annotations for this resource.

Returns:
A list of DleseAnnoDocReaders or empty list

getCompletedComment

public ArrayList getCompletedComment()
Gets a list of DleseAnnoDocReaders containing each of the completed type 'comment' annotations for this resource.

Returns:
A list of DleseAnnoDocReaders or empty list

getCompletedEducationalStandard

public ArrayList getCompletedEducationalStandard()
Gets a list of DleseAnnoDocReaders containing each of the completed type 'educational standard' annotations for this resource.

Returns:
A list of DleseAnnoDocReaders or empty list

getCompletedExample

public ArrayList getCompletedExample()
Gets a list of DleseAnnoDocReaders containing each of the completed type 'example' annotations for this resource.

Returns:
A list of DleseAnnoDocReaders or empty list

getCompletedExplanation

public ArrayList getCompletedExplanation()
Gets a list of DleseAnnoDocReaders containing each of the completed type 'explanation' annotations for this resource.

Returns:
A list of DleseAnnoDocReaders or empty list

getCompletedQuestion

public ArrayList getCompletedQuestion()
Gets a list of DleseAnnoDocReaders containing each of the completed type 'question' annotations for this resource.

Returns:
A list of DleseAnnoDocReaders or empty list

getCompletedSeeAlso

public ArrayList getCompletedSeeAlso()
Gets a list of DleseAnnoDocReaders containing each of the completed type 'see also' annotations for this resource.

Returns:
A list of DleseAnnoDocReaders or empty list

getAnnoCollectionKeys

public String[] getAnnoCollectionKeys()
Gets the annotataion collection keys, for example {06, 08}, for all collections that annotate this item.

Returns:
The annoCollectionKeys value

getCompletedAnnoCollectionKeys

public String[] getCompletedAnnoCollectionKeys()
Gets the annotataion collection keys, for example {06, 08}, for all collections that annotate this item with one or more status completed annotations.

Returns:
The completedAnnoCollectionKeys value

getAnnoTypes

public String[] getAnnoTypes()
Gets the anno types that are associated with this record.

Returns:
The anno types value.

getAnnoPathways

public ArrayList getAnnoPathways()
Gets the anno pathways that are associated with this record.

Returns:
The list of anno pathway Strings

getAnnoStatus

public ArrayList getAnnoStatus()
Gets the annotation statuses that are associated with this item.

Returns:
A list of anno status Strings

getAnnoFormats

public ArrayList getAnnoFormats()
Gets the annotation formats that are associated with this item.

Returns:
A list of anno formats Strings

getAnnoRatings

public String[] getAnnoRatings()
Gets a String array of all annotation star ratings for this item in numerical form from 1 to 5, or null if none. Each rating represents a single annotation's star rating for this item.

Returns:
An String array of numbers 1, 2, 3, 4, 5, or null

getAverageAnnoRating

public String getAverageAnnoRating()
Gets a the average of all star ratings for this item as a String, or null if none. The rating is shown to three decimal points, for example '4.333' or '3.000'.

Returns:
The average star rating to three decimal points as a String

getAverageAnnoRatingFloat

public float getAverageAnnoRatingFloat()
Gets a the average of all star ratings for this item as a float, or -1 if none.

Returns:
The average star rating or -1 if none

getNumAnnoRatings

public String getNumAnnoRatings()
Gets a the total number of star ratings for this item as a String. The number is displayed to five digits, for example '00002' or '00000'.

Returns:
The number of star ratings as a String

getNumAnnoRatingsInt

public int getNumAnnoRatingsInt()
Gets a the total number of star ratings for this item as a int.

Returns:
The number of star ratings for this item

prtlnErr

protected static void prtlnErr(String s)
Output a line of text to error out, with datestamp.

Parameters:
s - The text that will be output to error out.

prtln

protected static void prtln(String s)
Output a line of text to standard out, with datestamp, if debug is set to true.

Parameters:
s - The String that will be output.

DLESE Tools
v1.6.0