org.nuxeo.ecm.diff.service.impl
Class FieldDiffHelper
java.lang.Object
org.nuxeo.ecm.diff.service.impl.FieldDiffHelper
public final class FieldDiffHelper
- extends Object
Helper for computing a field diff.
- Since:
- 5.6
- Author:
- Antoine Taillefer
FACET_ELEMENT
public static final String FACET_ELEMENT
- See Also:
- Constant Field Values
SCHEMA_ELEMENT
public static final String SCHEMA_ELEMENT
- See Also:
- Constant Field Values
NAME_ATTRIBUTE
public static final String NAME_ATTRIBUTE
- See Also:
- Constant Field Values
TYPE_ATTRIBUTE
public static final String TYPE_ATTRIBUTE
- See Also:
- Constant Field Values
FieldDiffHelper
public FieldDiffHelper()
computeFieldDiff
public static boolean computeFieldDiff(DocumentDiff docDiff,
org.custommonkey.xmlunit.NodeDetail controlNodeDetail,
org.custommonkey.xmlunit.NodeDetail testNodeDetail,
int fieldDifferenceCount,
org.custommonkey.xmlunit.Difference difference)
throws ClientException
- Computes a field diff.
First gets all needed elements to compute the field diff:
-
propertyHierarchy: list holding the property hierarchy
Every time we encounter a list, a complex or a content node going up in the DOM tree
from the property node to the prefixed field node, we add it to the property
hierarchy.
If it is a list item node, we set its index in the hierarchy.
If it is a complex item node, we set its name in the hierarchy.
If it is a content item node (ie. "encoding", "mime-type", "filename" or "digest"),
we set its name in the hierarchy.
Example: complex list
The "true" property's hierarchy is:
[{list,"0"},{complex, "complexBoolean"}]
The "jack" property's hierarchy is:
[{list,"1"},{complex, "complexString"}]
The "UTF-8" property's hierarchy is:
[{list,"0"},{complex, "complexString"},{content, "encoding"}]
joe
true
UTF-8
text/plain
My_file.txt
5dafdabf966043c8c8cef20011e939a2
jack
false
- Parameters:
docDiff
- the doc diffcontrolNodeDetail
- the control node detailtestNodeDetail
- the test node detailfieldDifferenceCount
- the field difference countadddifference
- the difference
- Returns:
- true if a field diff has been found
- Throws:
ClientException
- the client exception
getPropertyType
public static String getPropertyType(Node node)
- Gets the node property type.
- Parameters:
node
- the node
- Returns:
- the property diff type
applyPropertyHierarchyToDiff
public static PropertyDiff applyPropertyHierarchyToDiff(PropertyDiff firstPropertyDiff,
List<PropertyHierarchyNode> propertyHierarchy)
throws ClientException
- Sets the property diff hierarchy.
- Parameters:
firstPropertyDiff
- the first property diffpropertyHierarchy
- the property hierarchy
- Returns:
- the property diff
- Throws:
ClientException
- the client exception
Copyright © 2012 Nuxeo SA. All Rights Reserved.