Package org.opencms.workplace.comparison
Class CmsResourceComparison
java.lang.Object
org.opencms.workplace.comparison.CmsResourceComparison
- Direct Known Subclasses:
CmsXmlDocumentComparison
Comparison of two OpenCms resources.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Constant indicating that an item (e.g.static final String
Constant indicating that an item has been changed.static final String
Constant indicating that an item has been removed.static final String
Constant indicating that an item has not been changed. -
Constructor Summary
ModifierConstructorDescriptionprotected
Constructs a new resource comparison object. -
Method Summary
Modifier and TypeMethodDescriptionstatic List<CmsAttributeComparison>
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 List<CmsAttributeComparison>
compareProperties
(CmsObject cms, CmsResource resource1, String version1, CmsResource resource2, String version2) Helper method that finds out, which of the properties were added, removed, modified or remain unchanged.
-
Field Details
-
TYPE_ADDED
Constant indicating that an item (e.g. element or property) has been added.- See Also:
-
TYPE_CHANGED
Constant indicating that an item has been changed.- See Also:
-
TYPE_REMOVED
Constant indicating that an item has been removed.- See Also:
-
TYPE_UNCHANGED
Constant indicating that an item has not been changed.- See Also:
-
-
Constructor Details
-
CmsResourceComparison
protected CmsResourceComparison()Constructs a new resource comparison object.
-
-
Method Details
-
compareAttributes
public static List<CmsAttributeComparison> 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 useresource1
- the first resource to read the properties fromresource2
- the second resource to read the properties from- Returns:
- a list of the compared attributes
-
compareProperties
public static List<CmsAttributeComparison> compareProperties(CmsObject cms, CmsResource resource1, String version1, CmsResource resource2, 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 useresource1
- the first resource to read the properties fromversion1
- the version of the first resourceresource2
- the second resource to read the properties fromversion2
- the version of the second resource- Returns:
- a list of the compared attributes
- Throws:
CmsException
- if something goes wrong
-