Package org.dlese.dpc.schemedit
Class MetaDataFramework
java.lang.Object
org.dlese.dpc.schemedit.MetaDataFramework
- All Implemented Interfaces:
Serializable
Encapsulates information about a metadata framework in support of creating,
displaying, editing and managing metadata records.
MetaDataFramework instances are configured from a framework configuration
file, and registered in a FrameworkRegistry.
Major components include:
- a
SchemaHelperinstance - a
FieldInfoMapfor information such as best practices and definitions - a
SchemaPathMap - a
FrameworkConfigReaderthat provides information from the framework configuration file
- Author:
- ostwald
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMetaDataFramework(File configFile, String docRoot) Constructor for the MetaDataFramework objectMetaDataFramework(String configFilePath, String docRoot) Constructor for the MetaDataFramework object given the path to a config file for the particular framework (e.g., "adn").MetaDataFramework(FrameworkConfigReader configReader) Constructor for the MetaDataFramework objectMetaDataFramework(FrameworkConfigReader configReader, String docRoot) Constructor for the MetaDataFramework object -
Method Summary
Modifier and TypeMethodDescriptionorg.dom4j.DocumentcopyRecord(String xml, String id, CollectionConfig collectionConfig, User user) Copy the given xml record, inserting new values as specified by the Collection configuration.voiddestroy()Description of the MethodGets the directory to which metadata editor pages are written.intGets the baseRenderLevel attribute of the MetaDataFramework object.Gets the bestPracticesLabel attribute of the MetaDataFramework objectGets the configReader attribute of the MetaDataFramework objectGets the dateCreatedPath attribute of the MetaDataFramework objectGets the discussionURL attribute of the MetaDataFramework object.Gets the docRoot attribute of the MetaDataFramework objectorg.dom4j.DocumentgetEditableDocument(File file) Gets a localized Document (with ampersands expanded) that is suitable for editing.org.dom4j.DocumentgetEditableDocument(String filePath) Gets a localized Document (with ampersands expanded) that is suitable for editing.getFieldInfo(String xpath) Gets the FieldInfo for the given xpathGets the fieldInfoMap attribute of the MetaDataFramework objectGets the idPath attribute of the MetaDataFramework objectgetInitialFieldCollapse(String xpath) Return configured value for initialFieldCollapse for this xpathGets the muiGroups attribute of the MetaDataFramework objectgetName()Gets the name attribute of the MetaDataFramework.getNamedSchemaPath(String pathName) Gets the namedSchemaPath attribute of the MetaDataFramework objectgetNamedSchemaPathXpath(String pathName) Gets the namedSchemaPath attribute of the MetaDataFramework objectGets the pageList attribute of the MetaDataFramework objectbooleanGets the rebuildOnStart attribute of the MetaDataFramework objectGets the recordsDir attribute of the MetaDataFramework objectgetRecordUrl(org.dom4j.Document itemRecord) Extracts the URL from the provided record using the "urlPath" configured SchemaPath for this framework.Gets the renderer that will create the editor for records of this framework.Gets the rootElementName attribute of the MetaDataFramework.Gets the schemaHelper attribute of the MetaDataFramework objectGets the schemaPathMap for this framework.Gets the schemaFile attribute of the MetaDataFramework objectGets the standardsManager attribute of the MetaDataFramework objectGets the uniqueUrlPath attribute of the MetaDataFramework objectGets the urlPath attribute of the MetaDataFramework objectReturns normalized xpaths specified in framework configuration as "url paths".Gets the userInfo been for this framework, which specifies xpaths that can be populated with attributes from the SessionUser object, such as name, institution, and email.Gets the validator attribute of the MetaDataFramework objectGets the version attribute of the MetaDataFramework objectGets the vocabLayouts attribute of the MetaDataFramework objectGets the workingRenderer attribute of the MetaDataFramework objectGets the workingSchemaURI attribute (pointing to the location of the last successfully loaded schema) of the MetaDataFramework object.org.dom4j.DocumentgetWritableRecord(org.dom4j.Document doc) Converts a editable Document into an xml record that can be written to disk.getWritableRecordXml(org.dom4j.Document doc) Gets the writableRecordXml attribute of the MetaDataFramework objectGets the xmlFormat attribute of the MetaDataFramework objectvoidinit()Description of the MethodbooleanGets the initialized attribute of the MetaDataFramework objectvoidLoad a SchemaHelper instance for this framework.org.dom4j.DocumentReturns an instance document containing only required nodes, with the "id" field populated with provided idorg.dom4j.DocumentmakeMinimalRecord(String id, CollectionConfig collectionConfig) Returns an instance document containing only required nodes, with the "id" field populated with provided idorg.dom4j.DocumentmakeMinimalRecord(String id, CollectionConfig collectionConfig, User user) Returns an instance document containing only required nodes, with the "id" field populated with provided id and collectionConfig fields populated if collectionConfig is provided.preprocessEditableDocument(DocMap docMap) NOT YET DOCUMENTEDorg.dom4j.DocumentpreprocessEditableDocument(org.dom4j.Document doc) NOT YET DOCUMENTEDvoidprocessOrderedElements(org.dom4j.Document doc) Orders elements as specified by the framework configuration.voidrefresh()NOT YET DOCUMENTEDvoidGenerate the pages of the editor for records of this MetaDataFramework.voidNOT YET DOCUMENTEDvoidsetBaseRenderLevel(int level) Sets the baseRenderLevel attribute of the MetaDataFramework objectvoidSets the bestPracticesLabel attribute of the MetaDataFramework objectstatic voidsetDebug(boolean bool) Sets the debug attribute of the MetaDataFramework classvoidSets the discussionURL attribute of the MetaDataFramework objectvoidsetDocRoot(String docRoot) used by stand-alone AutoForm to explicitly set docRootvoidsetMuiGroups(MetadataVocab vocab, String audience, String language) Returns a list of xpaths for which MUI Groups files exist for this framework.voidsetRebuildOnStart(boolean bool) Sets the rebuildOnStart attribute of the MetaDataFramework objectvoidsetRecordsDir(File dir) Sets the recordsDir attribute of the MetaDataFramework objectvoidsetRecordsDir(String dir) Sets the recordsDir attribute of the MetaDataFramework objectvoidSets the renderer that will create the editor for records of this framework.voidsetRootElementName(String name) Sets the rootElementName attribute of the MetaDataFramework objectvoidsetSchemaHelper(SchemaHelper schemaHelper) Sets the schemaHelper attribute of the MetaDataFramework objectvoidsetSchemaURI(String uri) Sets the schemaURI attribute of the MetaDataFramework objectvoidsetStandardsManager(StandardsManager standardsManager) Sets the standardsManager attribute of the MetaDataFramework object (called by loadSchemaHelper)voidsetWorkingRenderer(String renderer) Sets the workingRenderer attribute of the MetaDataFramework objectvoidSets the workingSchemaURI attribute of the MetaDataFramework objecttoString()String representation for debuggingcheck the fieldInfo paths to make sure they are legal schema paths ...validateRecord(Object record) NOT YET DOCUMENTEDcheck the vocabLayoutConfig paths to make sure they are legal schema paths ...voidwriteEditableDocument(org.dom4j.Document doc, File file) Converts an editable Document into a writable xmlRecord (string) viagetWritableRecordXmland writes it to disk.voidupdate config file with current values
-
Constructor Details
-
MetaDataFramework
Constructor for the MetaDataFramework object given the path to a config file for the particular framework (e.g., "adn"). The docRoot parameter enables expanding of partial paths into absolute paths.- Parameters:
configFilePath- Description of the ParameterdocRoot- The context document root as obtainied by calling getServletContext().getRealPath("/");
-
MetaDataFramework
Constructor for the MetaDataFramework object- Parameters:
configFile- Description of the ParameterdocRoot- path to the application context
-
MetaDataFramework
Constructor for the MetaDataFramework object- Parameters:
configReader- Description of the Parameter
-
MetaDataFramework
Constructor for the MetaDataFramework object- Parameters:
configReader- Description of the ParameterdocRoot- Description of the Parameter
-
-
Method Details
-
init
public void init()Description of the Method -
validateVocabLayoutPaths
check the vocabLayoutConfig paths to make sure they are legal schema paths ... -
validateFieldInfoPaths
check the fieldInfo paths to make sure they are legal schema paths ... -
refresh
public void refresh()NOT YET DOCUMENTED -
isInitialized
public boolean isInitialized()Gets the initialized attribute of the MetaDataFramework object- Returns:
- The initialized value
-
getVocabLayouts
Gets the vocabLayouts attribute of the MetaDataFramework object- Returns:
- The vocabLayouts value
-
getConfigReader
Gets the configReader attribute of the MetaDataFramework object- Returns:
- The configReader value
-
writeProps
update config file with current values- Throws:
Exception- Description of the Exception
-
getDocRoot
Gets the docRoot attribute of the MetaDataFramework object- Returns:
- The docRoot value
-
setDocRoot
used by stand-alone AutoForm to explicitly set docRoot- Parameters:
docRoot- The new docRoot value
-
getPageList
Gets the pageList attribute of the MetaDataFramework object- Returns:
- The pageList value
-
getFieldInfoMap
Gets the fieldInfoMap attribute of the MetaDataFramework object- Returns:
- The fieldInfoMap value
-
getFieldInfo
Gets the FieldInfo for the given xpath- Parameters:
xpath- Description of the Parameter- Returns:
- The fieldInfo value
-
getInitialFieldCollapse
Return configured value for initialFieldCollapse for this xpath- Parameters:
xpath- NOT YET DOCUMENTED- Returns:
- The initialFieldCollapse value
-
getSchemaPathMap
Gets the schemaPathMap for this framework.- Returns:
- The schemaPathMap value
-
getUserInfo
Gets the userInfo been for this framework, which specifies xpaths that can be populated with attributes from the SessionUser object, such as name, institution, and email.- Returns:
- The userInfo object derived from the framework configuration
-
setMuiGroups
Returns a list of xpaths for which MUI Groups files exist for this framework.- Parameters:
vocab- The new muiGroups valueaudience- The new muiGroups valuelanguage- The new muiGroups value
-
getMuiGroups
Gets the muiGroups attribute of the MetaDataFramework object- Returns:
- The muiGroups value
-
getStandardsManager
Gets the standardsManager attribute of the MetaDataFramework object- Returns:
- The standardsManager value
-
setStandardsManager
Sets the standardsManager attribute of the MetaDataFramework object (called by loadSchemaHelper)- Parameters:
standardsManager- The new standardsManager value
-
getRenderer
Gets the renderer that will create the editor for records of this framework.- Returns:
- The renderer value
-
setRenderer
Sets the renderer that will create the editor for records of this framework.- Parameters:
r- The new renderer value
-
getBestPracticesLabel
Gets the bestPracticesLabel attribute of the MetaDataFramework object- Returns:
- The bestPracticesLabel value
-
setBestPracticesLabel
Sets the bestPracticesLabel attribute of the MetaDataFramework object- Parameters:
r- The new bestPracticesLabel value
-
getWorkingSchemaURI
Gets the workingSchemaURI attribute (pointing to the location of the last successfully loaded schema) of the MetaDataFramework object.- Returns:
- The workingSchemaURI value
-
setWorkingSchemaURI
Sets the workingSchemaURI attribute of the MetaDataFramework object- Parameters:
uri- The new workingSchemaURI value
-
getWorkingRenderer
Gets the workingRenderer attribute of the MetaDataFramework object- Returns:
- The workingRenderer value
-
setWorkingRenderer
Sets the workingRenderer attribute of the MetaDataFramework object- Parameters:
renderer- The new workingRenderer value
-
getRecordsDir
Gets the recordsDir attribute of the MetaDataFramework object- Returns:
- The recordsDir value
-
setRecordsDir
Sets the recordsDir attribute of the MetaDataFramework object- Parameters:
dir- The new recordsDir value
-
setRecordsDir
Sets the recordsDir attribute of the MetaDataFramework object- Parameters:
dir- The new recordsDir value
-
getSchemaHelper
Gets the schemaHelper attribute of the MetaDataFramework object- Returns:
- The schemaHelper value
-
setSchemaHelper
Sets the schemaHelper attribute of the MetaDataFramework object- Parameters:
schemaHelper- The new schemaHelper value
-
loadSchemaHelper
Load a SchemaHelper instance for this framework. Necessary before calls to renderEditorPages- Throws:
Exception- Description of the Exception
-
getRootElementName
Gets the rootElementName attribute of the MetaDataFramework.- Returns:
- The rootElementName value
-
setRootElementName
Sets the rootElementName attribute of the MetaDataFramework object- Parameters:
name- The new rootElementName value
-
getSchemaURI
Gets the schemaFile attribute of the MetaDataFramework object- Returns:
- The schemaFile value
-
getValidator
Gets the validator attribute of the MetaDataFramework object- Returns:
- The validator value
-
resetValidator
public void resetValidator()NOT YET DOCUMENTED -
validateRecord
NOT YET DOCUMENTED- Parameters:
record- NOT YET DOCUMENTED- Returns:
- NOT YET DOCUMENTED
-
getUniqueUrlPath
Gets the uniqueUrlPath attribute of the MetaDataFramework object- Returns:
- The uniqueUrlPath value
-
getNamedSchemaPathXpath
Gets the namedSchemaPath attribute of the MetaDataFramework object- Parameters:
pathName- Description of the Parameter- Returns:
- The namedSchemaPath value
-
getNamedSchemaPath
Gets the namedSchemaPath attribute of the MetaDataFramework object- Parameters:
pathName- Description of the Parameter- Returns:
- The namedSchemaPath value
-
getUrlPaths
Returns normalized xpaths specified in framework configuration as "url paths".- Returns:
- A List of urlPaths value (never null)
-
getIdPath
Gets the idPath attribute of the MetaDataFramework object- Returns:
- The idPath value
-
getDateCreatedPath
Gets the dateCreatedPath attribute of the MetaDataFramework object- Returns:
- The dateCreatedPath value
-
getUrlPath
Gets the urlPath attribute of the MetaDataFramework object- Returns:
- The urlPath value
-
getRecordUrl
Extracts the URL from the provided record using the "urlPath" configured SchemaPath for this framework.- Parameters:
itemRecord- NOT YET DOCUMENTED- Returns:
- The recordUrl value
- Throws:
Exception- NOT YET DOCUMENTED
-
setSchemaURI
Sets the schemaURI attribute of the MetaDataFramework object- Parameters:
uri- The new schemaURI value
-
getAutoFormDir
Gets the directory to which metadata editor pages are written.E.g., for "adn" format, the autoFormDir would be ${docRoot}/editor/adn.
- Returns:
- The autoFormDir value
-
getXmlFormat
Gets the xmlFormat attribute of the MetaDataFramework object- Returns:
- The xmlFormat value
-
getVersion
Gets the version attribute of the MetaDataFramework object- Returns:
- The version value
-
getName
Gets the name attribute of the MetaDataFramework.- Returns:
- The name value
-
getBaseRenderLevel
public int getBaseRenderLevel()Gets the baseRenderLevel attribute of the MetaDataFramework object. The baseRenderLevel tells the renderer at which level of the schema to begin rendering. This level is determined by the way the schema is split into pages. If there is a single page the baselevel is 2 (skipping the root element which is level 1). if the editor is split into pages representing the next level of the schema (as is the case with ADN) then the base level is 3- Returns:
- The baseRenderLevel value
-
setBaseRenderLevel
public void setBaseRenderLevel(int level) Sets the baseRenderLevel attribute of the MetaDataFramework object- Parameters:
level- The new baseRenderLevel value
-
getDiscussionURL
Gets the discussionURL attribute of the MetaDataFramework object. Used to create a link at the top of all the editor pages to a discussion page- Returns:
- The discussionURL value
-
setDiscussionURL
Sets the discussionURL attribute of the MetaDataFramework object- Parameters:
s- The new discussionURL value
-
getRebuildOnStart
public boolean getRebuildOnStart()Gets the rebuildOnStart attribute of the MetaDataFramework object- Returns:
- The rebuildOnStart value
-
setRebuildOnStart
public void setRebuildOnStart(boolean bool) Sets the rebuildOnStart attribute of the MetaDataFramework object- Parameters:
bool- The new rebuildOnStart value
-
copyRecord
public org.dom4j.Document copyRecord(String xml, String id, CollectionConfig collectionConfig, User user) throws Exception Copy the given xml record, inserting new values as specified by the Collection configuration.- Parameters:
xml- xml record to be copiedid- id for new recordcollectionConfig- the collection configurationuser- the current user (from which to populate user fields if so configured)- Returns:
- new Document
- Throws:
Exception- Description of the Exception
-
makeMinimalRecord
Returns an instance document containing only required nodes, with the "id" field populated with provided id- Parameters:
id- id value to be inserted into the id field for created record- Returns:
- minimal instance Document for this framework.
- Throws:
Exception
-
makeMinimalRecord
public org.dom4j.Document makeMinimalRecord(String id, CollectionConfig collectionConfig) throws Exception Returns an instance document containing only required nodes, with the "id" field populated with provided id- Parameters:
id- id value to be inserted into the id field for created recordcollectionConfig- NOT YET DOCUMENTED- Returns:
- minimal instance Document for this framework.
- Throws:
Exception
-
makeMinimalRecord
public org.dom4j.Document makeMinimalRecord(String id, CollectionConfig collectionConfig, User user) throws Exception Returns an instance document containing only required nodes, with the "id" field populated with provided id and collectionConfig fields populated if collectionConfig is provided.- Parameters:
id- id value to be inserted into the id field for created recordcollectionConfig- Description of the Parameteruser- NOT YET DOCUMENTED- Returns:
- minimal instance Document for this framework.
- Throws:
Exception- Description of the Exception
-
renderEditorPages
Generate the pages of the editor for records of this MetaDataFramework.- Throws:
Exception- Description of the Exception
-
getEditableDocument
Gets a localized Document (with ampersands expanded) that is suitable for editing.- Parameters:
file- file containing xml Record- Returns:
- an editable Document
- Throws:
org.dom4j.DocumentException- Description of the Exception
-
getEditableDocument
Gets a localized Document (with ampersands expanded) that is suitable for editing.- Parameters:
filePath- path to file containing xml record.- Returns:
- an editable Document
- Throws:
org.dom4j.DocumentException- Description of the Exception
-
getWritableRecordXml
Gets the writableRecordXml attribute of the MetaDataFramework object- Parameters:
doc- NOT YET DOCUMENTED- Returns:
- The writableRecordXml value
- Throws:
org.dom4j.DocumentException- NOT YET DOCUMENTED
-
getWritableRecord
public org.dom4j.Document getWritableRecord(org.dom4j.Document doc) throws org.dom4j.DocumentException Converts a editable Document into an xml record that can be written to disk.The xml record returned is delocalized (namespace info added) and the ampersands are contracted.
- Parameters:
doc- an editable Document- Returns:
- string representation of xml record suitable to be written to disk.
- Throws:
org.dom4j.DocumentException- Description of the Exception
-
processOrderedElements
public void processOrderedElements(org.dom4j.Document doc) Orders elements as specified by the framework configuration. In the config, ordered paths have a "value" type of "ordered".- Parameters:
doc- instanceDocument containing elements to be ordered
-
writeEditableDocument
public void writeEditableDocument(org.dom4j.Document doc, File file) throws org.dom4j.DocumentException Converts an editable Document into a writable xmlRecord (string) viagetWritableRecordXmland writes it to disk.- Parameters:
doc- an editable Documentfile- destination file for write operation.- Throws:
org.dom4j.DocumentException- Description of the Exception
-
setDebug
public static void setDebug(boolean bool) Sets the debug attribute of the MetaDataFramework class- Parameters:
bool- The new debug value
-
toString
String representation for debugging -
preprocessEditableDocument
NOT YET DOCUMENTED- Parameters:
docMap- NOT YET DOCUMENTED- Returns:
- NOT YET DOCUMENTED
-
preprocessEditableDocument
public org.dom4j.Document preprocessEditableDocument(org.dom4j.Document doc) NOT YET DOCUMENTED- Parameters:
doc- NOT YET DOCUMENTED- Returns:
- NOT YET DOCUMENTED
-
destroy
public void destroy()Description of the Method
-