Class MetaDataFramework

java.lang.Object
org.dlese.dpc.schemedit.MetaDataFramework
All Implemented Interfaces:
Serializable

public class MetaDataFramework extends Object implements 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:

Author:
ostwald
See Also:
  • Constructor Details

    • MetaDataFramework

      public MetaDataFramework(String configFilePath, String docRoot)
      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 Parameter
      docRoot - The context document root as obtainied by calling getServletContext().getRealPath("/");
    • MetaDataFramework

      public MetaDataFramework(File configFile, String docRoot)
      Constructor for the MetaDataFramework object
      Parameters:
      configFile - Description of the Parameter
      docRoot - path to the application context
    • MetaDataFramework

      public MetaDataFramework(FrameworkConfigReader configReader)
      Constructor for the MetaDataFramework object
      Parameters:
      configReader - Description of the Parameter
    • MetaDataFramework

      public MetaDataFramework(FrameworkConfigReader configReader, String docRoot)
      Constructor for the MetaDataFramework object
      Parameters:
      configReader - Description of the Parameter
      docRoot - Description of the Parameter
  • Method Details

    • init

      public void init()
      Description of the Method
    • validateVocabLayoutPaths

      public List validateVocabLayoutPaths()
      check the vocabLayoutConfig paths to make sure they are legal schema paths ...
    • validateFieldInfoPaths

      public List 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

      public VocabLayoutConfig getVocabLayouts()
      Gets the vocabLayouts attribute of the MetaDataFramework object
      Returns:
      The vocabLayouts value
    • getConfigReader

      public FrameworkConfigReader getConfigReader()
      Gets the configReader attribute of the MetaDataFramework object
      Returns:
      The configReader value
    • writeProps

      public void writeProps() throws Exception
      update config file with current values
      Throws:
      Exception - Description of the Exception
    • getDocRoot

      public String getDocRoot()
      Gets the docRoot attribute of the MetaDataFramework object
      Returns:
      The docRoot value
    • setDocRoot

      public void setDocRoot(String docRoot)
      used by stand-alone AutoForm to explicitly set docRoot
      Parameters:
      docRoot - The new docRoot value
    • getPageList

      public PageList getPageList()
      Gets the pageList attribute of the MetaDataFramework object
      Returns:
      The pageList value
    • getFieldInfoMap

      public FieldInfoMap getFieldInfoMap()
      Gets the fieldInfoMap attribute of the MetaDataFramework object
      Returns:
      The fieldInfoMap value
    • getFieldInfo

      public FieldInfoReader getFieldInfo(String xpath)
      Gets the FieldInfo for the given xpath
      Parameters:
      xpath - Description of the Parameter
      Returns:
      The fieldInfo value
    • getInitialFieldCollapse

      public String getInitialFieldCollapse(String xpath)
      Return configured value for initialFieldCollapse for this xpath
      Parameters:
      xpath - NOT YET DOCUMENTED
      Returns:
      The initialFieldCollapse value
    • getSchemaPathMap

      public SchemaPathMap getSchemaPathMap()
      Gets the schemaPathMap for this framework.
      Returns:
      The schemaPathMap value
    • getUserInfo

      public UserInfo 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

      public void setMuiGroups(MetadataVocab vocab, String audience, String language)
      Returns a list of xpaths for which MUI Groups files exist for this framework.
      Parameters:
      vocab - The new muiGroups value
      audience - The new muiGroups value
      language - The new muiGroups value
    • getMuiGroups

      public List getMuiGroups()
      Gets the muiGroups attribute of the MetaDataFramework object
      Returns:
      The muiGroups value
    • getStandardsManager

      public StandardsManager getStandardsManager()
      Gets the standardsManager attribute of the MetaDataFramework object
      Returns:
      The standardsManager value
    • setStandardsManager

      public void setStandardsManager(StandardsManager standardsManager)
      Sets the standardsManager attribute of the MetaDataFramework object (called by loadSchemaHelper)
      Parameters:
      standardsManager - The new standardsManager value
    • getRenderer

      public String getRenderer()
      Gets the renderer that will create the editor for records of this framework.
      Returns:
      The renderer value
    • setRenderer

      public void setRenderer(String r)
      Sets the renderer that will create the editor for records of this framework.
      Parameters:
      r - The new renderer value
    • getBestPracticesLabel

      public String getBestPracticesLabel()
      Gets the bestPracticesLabel attribute of the MetaDataFramework object
      Returns:
      The bestPracticesLabel value
    • setBestPracticesLabel

      public void setBestPracticesLabel(String r)
      Sets the bestPracticesLabel attribute of the MetaDataFramework object
      Parameters:
      r - The new bestPracticesLabel value
    • getWorkingSchemaURI

      public String getWorkingSchemaURI()
      Gets the workingSchemaURI attribute (pointing to the location of the last successfully loaded schema) of the MetaDataFramework object.
      Returns:
      The workingSchemaURI value
    • setWorkingSchemaURI

      public void setWorkingSchemaURI(String uri)
      Sets the workingSchemaURI attribute of the MetaDataFramework object
      Parameters:
      uri - The new workingSchemaURI value
    • getWorkingRenderer

      public String getWorkingRenderer()
      Gets the workingRenderer attribute of the MetaDataFramework object
      Returns:
      The workingRenderer value
    • setWorkingRenderer

      public void setWorkingRenderer(String renderer)
      Sets the workingRenderer attribute of the MetaDataFramework object
      Parameters:
      renderer - The new workingRenderer value
    • getRecordsDir

      public String getRecordsDir()
      Gets the recordsDir attribute of the MetaDataFramework object
      Returns:
      The recordsDir value
    • setRecordsDir

      public void setRecordsDir(File dir)
      Sets the recordsDir attribute of the MetaDataFramework object
      Parameters:
      dir - The new recordsDir value
    • setRecordsDir

      public void setRecordsDir(String dir)
      Sets the recordsDir attribute of the MetaDataFramework object
      Parameters:
      dir - The new recordsDir value
    • getSchemaHelper

      public SchemaHelper getSchemaHelper()
      Gets the schemaHelper attribute of the MetaDataFramework object
      Returns:
      The schemaHelper value
    • setSchemaHelper

      public void setSchemaHelper(SchemaHelper schemaHelper)
      Sets the schemaHelper attribute of the MetaDataFramework object
      Parameters:
      schemaHelper - The new schemaHelper value
    • loadSchemaHelper

      public void loadSchemaHelper() throws Exception
      Load a SchemaHelper instance for this framework. Necessary before calls to renderEditorPages
      Throws:
      Exception - Description of the Exception
    • getRootElementName

      public String getRootElementName()
      Gets the rootElementName attribute of the MetaDataFramework.
      Returns:
      The rootElementName value
    • setRootElementName

      public void setRootElementName(String name)
      Sets the rootElementName attribute of the MetaDataFramework object
      Parameters:
      name - The new rootElementName value
    • getSchemaURI

      public String getSchemaURI()
      Gets the schemaFile attribute of the MetaDataFramework object
      Returns:
      The schemaFile value
    • getValidator

      public XMLValidator getValidator()
      Gets the validator attribute of the MetaDataFramework object
      Returns:
      The validator value
    • resetValidator

      public void resetValidator()
      NOT YET DOCUMENTED
    • validateRecord

      public String validateRecord(Object record)
      NOT YET DOCUMENTED
      Parameters:
      record - NOT YET DOCUMENTED
      Returns:
      NOT YET DOCUMENTED
    • getUniqueUrlPath

      public String getUniqueUrlPath()
      Gets the uniqueUrlPath attribute of the MetaDataFramework object
      Returns:
      The uniqueUrlPath value
    • getNamedSchemaPathXpath

      public String getNamedSchemaPathXpath(String pathName)
      Gets the namedSchemaPath attribute of the MetaDataFramework object
      Parameters:
      pathName - Description of the Parameter
      Returns:
      The namedSchemaPath value
    • getNamedSchemaPath

      public SchemaPath getNamedSchemaPath(String pathName)
      Gets the namedSchemaPath attribute of the MetaDataFramework object
      Parameters:
      pathName - Description of the Parameter
      Returns:
      The namedSchemaPath value
    • getUrlPaths

      public List getUrlPaths()
      Returns normalized xpaths specified in framework configuration as "url paths".
      Returns:
      A List of urlPaths value (never null)
    • getIdPath

      public String getIdPath()
      Gets the idPath attribute of the MetaDataFramework object
      Returns:
      The idPath value
    • getDateCreatedPath

      public String getDateCreatedPath()
      Gets the dateCreatedPath attribute of the MetaDataFramework object
      Returns:
      The dateCreatedPath value
    • getUrlPath

      public String getUrlPath()
      Gets the urlPath attribute of the MetaDataFramework object
      Returns:
      The urlPath value
    • getRecordUrl

      public String getRecordUrl(org.dom4j.Document itemRecord) throws Exception
      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

      public void setSchemaURI(String uri)
      Sets the schemaURI attribute of the MetaDataFramework object
      Parameters:
      uri - The new schemaURI value
    • getAutoFormDir

      public String 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

      public String getXmlFormat()
      Gets the xmlFormat attribute of the MetaDataFramework object
      Returns:
      The xmlFormat value
    • getVersion

      public String getVersion()
      Gets the version attribute of the MetaDataFramework object
      Returns:
      The version value
    • getName

      public String 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

      public String 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

      public void setDiscussionURL(String s)
      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 copied
      id - id for new record
      collectionConfig - the collection configuration
      user - the current user (from which to populate user fields if so configured)
      Returns:
      new Document
      Throws:
      Exception - Description of the Exception
    • makeMinimalRecord

      public org.dom4j.Document makeMinimalRecord(String id) 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 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 record
      collectionConfig - 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 record
      collectionConfig - Description of the Parameter
      user - NOT YET DOCUMENTED
      Returns:
      minimal instance Document for this framework.
      Throws:
      Exception - Description of the Exception
    • renderEditorPages

      public void renderEditorPages() throws Exception
      Generate the pages of the editor for records of this MetaDataFramework.
      Throws:
      Exception - Description of the Exception
    • getEditableDocument

      public org.dom4j.Document getEditableDocument(File file) throws org.dom4j.DocumentException
      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

      public org.dom4j.Document getEditableDocument(String filePath) throws org.dom4j.DocumentException
      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

      public String getWritableRecordXml(org.dom4j.Document doc) throws org.dom4j.DocumentException
      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) via getWritableRecordXml and writes it to disk.
      Parameters:
      doc - an editable Document
      file - 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

      public String toString()
      String representation for debugging
      Overrides:
      toString in class Object
      Returns:
      Description of the Return Value
    • preprocessEditableDocument

      public DocMap preprocessEditableDocument(DocMap docMap)
      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