DLESE Tools
v1.6.0

org.dlese.dpc.schemedit
Class DocContentMap

java.lang.Object
  extended by org.dlese.dpc.schemedit.DocContentMap

public class DocContentMap
extends Object

Utilities for comparing metadata records for content-based equality (rather than structural equality).

Note: why isn't NodeComparator used to compare? see more info on NodeComparator

Author:
ostwald


Method Summary
static void cmpMaps(Map map1, Map map2)
          Compares two docContent Maps - used for debugging and testing.
static void cmpValLists(List list1, List list2)
          compare the values of a doc field for the cashed and active docs
static void cmpVals(List list1, List list2)
          Debugging method to compare two value-lists.
static Map getDocContentMap(Document doc, MetaDataFramework framework)
          Returns a representation of a metadata record that can be compared with another record to determine if there are differences in content.
 Map getDocContentMap(File file)
          Returns a content map of the provided file, assuming it belongs to the MetaDataFramework of this DocContentMap instance.
 Document getDocument()
          Gets the document attribute of the DocContentMap object
static void main(String[] args)
          The main program for the DocContentMap class
static void prtmap(Map map)
          Utility method to print the contents of a contentMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDocument

public Document getDocument()
Gets the document attribute of the DocContentMap object

Returns:
The document value

getDocContentMap

public static Map getDocContentMap(Document doc,
                                   MetaDataFramework framework)
Returns a representation of a metadata record that can be compared with another record to determine if there are differences in content.

The DocContentMap has an entry for each normalized (i.e., containing no indexing info) xpath having a value. The entries are a sorted list of the values for that xpath. As a map with sorted entries, this representation allows records to be compared using the Map "equals" method.

DocContentMaps are used to determine if a metadata has been edited in the metadata editor so the user can be warned of unsaved changes before exiting.

Parameters:
doc - a Document representing a metadata record
framework - the MetaDataFramework for the metadata record
Returns:
The docContentMap value

getDocContentMap

public Map getDocContentMap(File file)
Returns a content map of the provided file, assuming it belongs to the MetaDataFramework of this DocContentMap instance.

Parameters:
file - Description of the Parameter
Returns:
The docContentMap value

main

public static void main(String[] args)
                 throws Exception
The main program for the DocContentMap class

Parameters:
args - The command line arguments
Throws:
Exception - Description of the Exception

prtmap

public static void prtmap(Map map)
Utility method to print the contents of a contentMap

Parameters:
map - Description of the Parameter

cmpMaps

public static void cmpMaps(Map map1,
                           Map map2)
Compares two docContent Maps - used for debugging and testing.

Parameters:
map1 - Description of the Parameter
map2 - Description of the Parameter

cmpVals

public static void cmpVals(List list1,
                           List list2)
Debugging method to compare two value-lists.

Parameters:
list1 - Description of the Parameter
list2 - Description of the Parameter

cmpValLists

public static void cmpValLists(List list1,
                               List list2)
compare the values of a doc field for the cashed and active docs


DLESE Tools
v1.6.0