org.opencms.workplace.comparison
Class CmsResourceComparison

java.lang.Object
  extended by org.opencms.workplace.comparison.CmsResourceComparison
Direct Known Subclasses:
CmsXmlDocumentComparison

public class CmsResourceComparison
extends java.lang.Object

Comparison of two OpenCms resources.

Author:
Jan Baudisch

Field Summary
static java.lang.String TYPE_ADDED
          Constant indicating that an item (e.g. element or property) has been added.
static java.lang.String TYPE_CHANGED
          Constant indicating that an item has been changed.
static java.lang.String TYPE_REMOVED
          Constant indicating that an item has been removed.
static java.lang.String TYPE_UNCHANGED
          Constant indicating that an item has not been changed.
 
Constructor Summary
protected CmsResourceComparison()
          Constructs a new resource comparison object.
 
Method Summary
static java.util.List compareAttributes(CmsObject cms, CmsResource resource1, CmsResource resource2)
          Helper method that collects all meta attributes of the two file versions and finds out, which of the attributes were added, removed, modified or remain unchanged.
static java.util.List compareProperties(CmsObject cms, CmsResource resource1, java.lang.String version1, CmsResource resource2, java.lang.String version2)
          Helper method that finds out, which of the properties were added, removed, modified or remain unchanged.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_ADDED

public static final java.lang.String TYPE_ADDED
Constant indicating that an item (e.g. element or property) has been added.

See Also:
Constant Field Values

TYPE_CHANGED

public static final java.lang.String TYPE_CHANGED
Constant indicating that an item has been changed.

See Also:
Constant Field Values

TYPE_REMOVED

public static final java.lang.String TYPE_REMOVED
Constant indicating that an item has been removed.

See Also:
Constant Field Values

TYPE_UNCHANGED

public static final java.lang.String TYPE_UNCHANGED
Constant indicating that an item has not been changed.

See Also:
Constant Field Values
Constructor Detail

CmsResourceComparison

protected CmsResourceComparison()
Constructs a new resource comparison object.

Method Detail

compareAttributes

public static java.util.List compareAttributes(CmsObject cms,
                                               CmsResource resource1,
                                               CmsResource resource2)
Helper method that collects all meta attributes of the two file versions and finds out, which of the attributes were added, removed, modified or remain unchanged.

Parameters:
cms - the CmsObject to use
resource1 - the first resource to read the properties from
resource2 - the second resource to read the properties from
Returns:
a list of the compared attributes

compareProperties

public static java.util.List compareProperties(CmsObject cms,
                                               CmsResource resource1,
                                               java.lang.String version1,
                                               CmsResource resource2,
                                               java.lang.String version2)
                                        throws CmsException
Helper method that finds out, which of the properties were added, removed, modified or remain unchanged.

Parameters:
cms - the CmsObject to use
resource1 - the first resource to read the properties from
version1 - the version of the first resource
resource2 - the second resource to read the properties from
version2 - the version of the second resource
Returns:
a list of the compared attributes
Throws:
CmsException - if something goes wrong