public class ContentComparator extends AbstractLogEnabled implements Component, Serviceable
Modifier and Type | Class and Description |
---|---|
class |
ContentComparator.Change
One of the changes between 2 contents
|
static class |
ContentComparator.ChangeType
General type of change
|
static class |
ContentComparator.ChangeTypeDetail
More precise change info
|
class |
ContentComparator.Result
Result of a comparison between 2 contents
|
Modifier and Type | Field and Description |
---|---|
private ContentTypeExtensionPoint |
_contentTypeExtensionPoint |
private ContentTypesHelper |
_contentTypesHelper |
static String |
ROLE
The Avalon role
|
Constructor and Description |
---|
ContentComparator() |
Modifier and Type | Method and Description |
---|---|
private boolean |
_checkMetadataPresence(ContentComparator.Result result,
CompositeMetadata content1CompositeMetadata,
CompositeMetadata content2CompositeMetadata,
String contentPath,
String metadataName,
boolean logChange)
Check if a metadata is present in both contents and add a change if requested
|
private ContentComparator.Result |
_compare(Content content1,
Content content2,
String metadataSetName,
boolean strictCompare) |
private void |
_compareBinaryMetadata(ContentComparator.Result result,
CompositeMetadata content1CompositeMetadata,
CompositeMetadata content2CompositeMetadata,
String metadataName,
String contentPath)
Compare 2 Binary metadata
|
private void |
_compareBooleanMetadata(ContentComparator.Result result,
CompositeMetadata content1CompositeMetadata,
CompositeMetadata content2CompositeMetadata,
String metadataName,
String contentPath)
Compare 2 Boolean metadata
|
private void |
_compareCompositeMetadata(ContentComparator.Result result,
MetadataDefinition metadataDefinition1,
MetadataDefinitionReference metadataDefinitionReference,
Content content1,
CompositeMetadata content1CompositeMetadata,
Content content2,
CompositeMetadata content2CompositeMetadata,
String contentPath,
String metadataDefinitionPath)
Compare 2 composite metadatas (repeater or composite)
|
private void |
_compareContentMetadata(ContentComparator.Result result,
CompositeMetadata content1CompositeMetadata,
CompositeMetadata content2CompositeMetadata,
String metadataName,
String contentPath)
Compare 2 Content metadata
|
private void |
_compareDateMetadata(ContentComparator.Result result,
CompositeMetadata content1CompositeMetadata,
CompositeMetadata content2CompositeMetadata,
String metadataName,
String contentPath)
Compare 2 Date metadata
|
private void |
_compareDoubleMetadata(ContentComparator.Result result,
CompositeMetadata content1CompositeMetadata,
CompositeMetadata content2CompositeMetadata,
String metadataName,
String contentPath)
Compare 2 Double metadata
|
private void |
_compareFileMetadata(ContentComparator.Result result,
CompositeMetadata content1CompositeMetadata,
CompositeMetadata content2CompositeMetadata,
String metadataName,
String contentPath)
Compare 2 File metadata
If both files do not have the same type, a ContentComparator.ChangeTypeDetail.TYPE will be added to resultsee _compareBinaryMetadata(Result, CompositeMetadata, CompositeMetadata, String, String) if objects are binarysee _objectCompare(Result, Object, Object, String, String) if objects are references |
private void |
_compareGeoCodeMetadata(ContentComparator.Result result,
CompositeMetadata content1CompositeMetadata,
CompositeMetadata content2CompositeMetadata,
String metadataName,
String contentPath)
Compare 2 GeoCode metadata
|
private void |
_compareList(ContentComparator.Result result,
boolean[] list1,
boolean[] list2,
String metadataName,
String contentPath)
|
private void |
_compareList(ContentComparator.Result result,
double[] list1,
double[] list2,
String metadataName,
String contentPath)
|
private void |
_compareList(ContentComparator.Result result,
long[] list1,
long[] list2,
String metadataName,
String contentPath)
|
private <T> void |
_compareList(ContentComparator.Result result,
T[] list1,
T[] list2,
String metadataName,
String contentPath)
Compare 2 lists of any Object
|
private void |
_compareLongMetadata(ContentComparator.Result result,
CompositeMetadata content1CompositeMetadata,
CompositeMetadata content2CompositeMetadata,
String metadataName,
String contentPath)
Compare 2 Long metadata
|
private void |
_compareMetadataContent(ContentComparator.Result result,
CompositeMetadata content1CompositeMetadata,
CompositeMetadata content2CompositeMetadata,
MetadataDefinition metadataDefinition,
String metadataName,
String contentPath)
Compare 2 non-composite metadata
|
private void |
_compareMetadatas(ContentComparator.Result result,
Content content1,
CompositeMetadata content1CompositeMetadata,
Content content2,
CompositeMetadata content2CompositeMetadata,
String contentPath,
AbstractMetadataSetElement abstractMetadataSetElement,
String metadataDefinitionPath)
Compare 2 metadata and add the differences in result
|
private void |
_compareMultipleMetadata(ContentComparator.Result result,
CompositeMetadata content1CompositeMetadata,
CompositeMetadata content2CompositeMetadata,
MetadataDefinition metadataDefinition,
String metadataName,
String contentPath)
Compare 2 non-composite multivalued metadata
|
private void |
_compareReferenceMetadata(ContentComparator.Result result,
CompositeMetadata content1CompositeMetadata,
CompositeMetadata content2CompositeMetadata,
String metadataName,
String contentPath)
Compare 2 Reference metadata
|
private void |
_compareRichTextMetadata(ContentComparator.Result result,
CompositeMetadata content1CompositeMetadata,
CompositeMetadata content2CompositeMetadata,
String metadataName,
String contentPath)
Compare 2 RichText metadata
|
private void |
_compareSingleMetadata(ContentComparator.Result result,
CompositeMetadata content1CompositeMetadata,
CompositeMetadata content2CompositeMetadata,
MetadataDefinition metadataDefinition,
String metadataName,
String contentPath)
Compare 2 non-composite non-multivalued metadata
|
private void |
_compareStringMetadata(ContentComparator.Result result,
CompositeMetadata content1CompositeMetadata,
CompositeMetadata content2CompositeMetadata,
String metadataName,
String contentPath)
Compare 2 string metadata
|
private void |
_compareUserMetadata(ContentComparator.Result result,
CompositeMetadata content1CompositeMetadata,
CompositeMetadata content2CompositeMetadata,
String metadataName,
String contentPath)
Compare 2 User metadata
|
private void |
_fillMetadataSet(AbstractMetadataSetElement metadataSet,
MetadataDefinitionHolder rootDefinition)
Recursive method to generate a metadataSet
|
private MetadataSet |
_generateMetadataSet(String metadataSetName,
Content content)
Generate a metadataSet using a name (can be null) and a content
|
private MetadataDefinition |
_getMetadataDefinition(String metadataPath,
Content content)
Get the definition of a metadata in a content
|
private void |
_objectCompare(ContentComparator.Result result,
Object object1,
Object object2,
String contentPath,
String metadataName)
Compare 2 Objects
|
ContentComparator.Result |
compare(Content content1,
Content content2)
Compare 2 contents, for all their common metadatas (contents with different contentTypes are rejected)
|
ContentComparator.Result |
compare(Content content1,
Content content2,
boolean strictCompare)
Compare 2 contents, for all their common metadatas
|
ContentComparator.Result |
compare(Content content1,
Content content2,
String metadataSetName)
Compare 2 contents, filtering with a metadataSet (contents with different contentTypes are rejected)
|
ContentComparator.Result |
compare(Content content1,
Content content2,
String metadataSetName,
boolean strictCompare)
Compare 2 contents, filtering with a metadataSet
|
private static <T> boolean |
containsAllOnce(T[] list1,
T[] list2)
Check if all elements in list2 are present only 1 time in list1
[A, B, C], [A, A, B, C] will return false
[A, A, B, C], [A, A, A, B, C] will return false
[A, A, B, C], [A, B, C] will return true
|
private static <T> T[] |
removeAll(T[] list1,
T[] list2)
Remove ONCE all elements from list2 in list1
[A, A, B, C], [A, B] will result [A, C]
|
void |
service(ServiceManager manager) |
getLogger, setLogger
private ContentTypesHelper _contentTypesHelper
private ContentTypeExtensionPoint _contentTypeExtensionPoint
public ContentComparator()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public ContentComparator.Result compare(Content content1, Content content2) throws AmetysRepositoryException, IOException
content1
- 1st contentcontent2
- new contentContentComparator.Result
AmetysRepositoryException
- repository exceptionIOException
- IO exceptionpublic ContentComparator.Result compare(Content content1, Content content2, boolean strictCompare) throws AmetysRepositoryException, IOException
content1
- 1st contentcontent2
- new contentstrictCompare
- true to reject contents with different content typesContentComparator.Result
AmetysRepositoryException
- repository exceptionIOException
- IO exceptionpublic ContentComparator.Result compare(Content content1, Content content2, String metadataSetName) throws AmetysRepositoryException, IOException
content1
- 1st contentcontent2
- new contentmetadataSetName
- name of the metadataSetContentComparator.Result
AmetysRepositoryException
- repository exceptionIOException
- IO exceptionpublic ContentComparator.Result compare(Content content1, Content content2, String metadataSetName, boolean strictCompare) throws AmetysRepositoryException, IOException
content1
- 1st contentcontent2
- new contentmetadataSetName
- name of the metadataSetstrictCompare
- true to reject contents with different content typesContentComparator.Result
AmetysRepositoryException
- repository exceptionIOException
- IO exceptionprivate ContentComparator.Result _compare(Content content1, Content content2, String metadataSetName, boolean strictCompare) throws AmetysRepositoryException, IOException
AmetysRepositoryException
IOException
private MetadataSet _generateMetadataSet(String metadataSetName, Content content)
metadataSetName
- name of the metadataSet. If null, a __generated__ metadataSet will be created using all metadatascontent
- content where the metadataSet should be retreivedprivate void _fillMetadataSet(AbstractMetadataSetElement metadataSet, MetadataDefinitionHolder rootDefinition)
metadataSet
- MetadataSet where definitions will be addedrootDefinition
- holder of the definitions to look forprivate void _compareMetadatas(ContentComparator.Result result, Content content1, CompositeMetadata content1CompositeMetadata, Content content2, CompositeMetadata content2CompositeMetadata, String contentPath, AbstractMetadataSetElement abstractMetadataSetElement, String metadataDefinitionPath) throws AmetysRepositoryException, IOException
result
- global result where differences will be stockedcontent1
- 1st contentcontent1CompositeMetadata
- compositeMetadata fot content1content2
- 2nd contentcontent2CompositeMetadata
- compositeMetadata fot content2contentPath
- path of it's content (inside of composite for example)abstractMetadataSetElement
- element that will be comparedmetadataDefinitionPath
- path in the metadataDefinition (different from contentPath because of repeaters)AmetysRepositoryException
- repository exceptionIOException
- IO Exception (comparison of InputStream mainly)private void _compareCompositeMetadata(ContentComparator.Result result, MetadataDefinition metadataDefinition1, MetadataDefinitionReference metadataDefinitionReference, Content content1, CompositeMetadata content1CompositeMetadata, Content content2, CompositeMetadata content2CompositeMetadata, String contentPath, String metadataDefinitionPath) throws AmetysRepositoryException, IOException
result
- global result where differences will be stockedmetadataDefinition1
- definition of the metadata (from content1)metadataDefinitionReference
- metadata definition referencecontent1
- 1st contentcontent1CompositeMetadata
- 1st composite metadatacontent2
- 2nd contentcontent2CompositeMetadata
- 2nd composite metadatacontentPath
- path of it's content (inside of composite for example)metadataDefinitionPath
- path in the metadataDefinition (different from contentPath because of repeaters)AmetysRepositoryException
- repository exceptionIOException
- IO Exceptionprivate MetadataDefinition _getMetadataDefinition(String metadataPath, Content content)
metadataPath
- path of the metadatacontent
- contentprivate void _compareMetadataContent(ContentComparator.Result result, CompositeMetadata content1CompositeMetadata, CompositeMetadata content2CompositeMetadata, MetadataDefinition metadataDefinition, String metadataName, String contentPath) throws AmetysRepositoryException, IOException
result
- global result where differences will be stockedcontent1CompositeMetadata
- compositeMetadata fot content1content2CompositeMetadata
- compositeMetadata fot content2metadataDefinition
- metadata definitionmetadataName
- Metadata NamecontentPath
- path of it's content (inside of composite for example)AmetysRepositoryException
- repository exceptionIOException
- IO Exceptionprivate void _compareSingleMetadata(ContentComparator.Result result, CompositeMetadata content1CompositeMetadata, CompositeMetadata content2CompositeMetadata, MetadataDefinition metadataDefinition, String metadataName, String contentPath) throws AmetysRepositoryException, IOException
result
- global result where differences will be stockedcontent1CompositeMetadata
- compositeMetadata fot content1content2CompositeMetadata
- compositeMetadata fot content2metadataDefinition
- path in the metadataDefinition (different from contentPath because of repeaters)metadataName
- Metadata NamecontentPath
- path of it's content (inside of composite for example)AmetysRepositoryException
- repository exceptionIOException
- IO Exceptionprivate void _compareMultipleMetadata(ContentComparator.Result result, CompositeMetadata content1CompositeMetadata, CompositeMetadata content2CompositeMetadata, MetadataDefinition metadataDefinition, String metadataName, String contentPath)
result
- global result where differences will be stockedcontent1CompositeMetadata
- compositeMetadata fot content1content2CompositeMetadata
- compositeMetadata fot content2metadataDefinition
- path in the metadataDefinition (different from contentPath because of repeaters)metadataName
- Metadata NamecontentPath
- path of it's content (inside of composite for example)AmetysRepositoryException
- repository exceptionprivate void _compareList(ContentComparator.Result result, boolean[] list1, boolean[] list2, String metadataName, String contentPath)
result
- Result where diff will be addedlist1
- 1st listlist2
- 2nd listmetadataName
- Metadata NamecontentPath
- Content Pathprivate void _compareList(ContentComparator.Result result, long[] list1, long[] list2, String metadataName, String contentPath)
result
- Result where diff will be addedlist1
- 1st listlist2
- 2nd listmetadataName
- Metadata NamecontentPath
- Content Pathprivate void _compareList(ContentComparator.Result result, double[] list1, double[] list2, String metadataName, String contentPath)
result
- Result where diff will be addedlist1
- 1st listlist2
- 2nd listmetadataName
- Metadata NamecontentPath
- Content Pathprivate <T> void _compareList(ContentComparator.Result result, T[] list1, T[] list2, String metadataName, String contentPath)
T
- Any Objectresult
- result in which the differences will be addedlist1
- 1st listlist2
- 2nd listmetadataName
- Used only for the difference definitioncontentPath
- Used only for the difference definitionprivate static <T> T[] removeAll(T[] list1, T[] list2)
T
- Any Objectlist1
- origin listlist2
- list of objects to removeprivate static <T> boolean containsAllOnce(T[] list1, T[] list2)
T
- Any Objectlist1
- complete listlist2
- elements to checkprivate void _compareStringMetadata(ContentComparator.Result result, CompositeMetadata content1CompositeMetadata, CompositeMetadata content2CompositeMetadata, String metadataName, String contentPath)
ContentComparator.ChangeType
can be
ContentComparator.ChangeType.ADDED
if metadata is present in content2CompositeMetadata and not in content1CompositeMetadata
ContentComparator.ChangeType.MODIFIED
if metadata is present in content2CompositeMetadata and in content1CompositeMetadata
ContentComparator.ChangeType.REMOVED
if metadata is not present in content2CompositeMetadata and present in content1CompositeMetadata
ContentComparator.ChangeTypeDetail
can be
ContentComparator.ChangeTypeDetail.NONE
no particular change (ABCD - OHSGDS)
ContentComparator.ChangeTypeDetail.LESS_CONTENT_END
(ABCD - ABC)
ContentComparator.ChangeTypeDetail.MORE_CONTENT_END
(ABCD - ABCDZZ)
ContentComparator.ChangeTypeDetail.LESS_CONTENT_START
(ABCD - BCD)
ContentComparator.ChangeTypeDetail.MORE_CONTENT_START
(ABCD - ZZABCD)
ContentComparator.ChangeTypeDetail.LESS_CONTENT
(ABCD - BC)
ContentComparator.ChangeTypeDetail.MORE_CONTENT
(ABCD - ZZABCDZZ)
result
- Result where diff will be addedcontent1CompositeMetadata
- 1st contentcontent2CompositeMetadata
- 2nd contentmetadataName
- metadata NamecontentPath
- Content Pathprivate void _compareRichTextMetadata(ContentComparator.Result result, CompositeMetadata content1CompositeMetadata, CompositeMetadata content2CompositeMetadata, String metadataName, String contentPath) throws AmetysRepositoryException, IOException
ContentComparator.ChangeType
can be
ContentComparator.ChangeType.ADDED
if metadata is present in content2CompositeMetadata and not in content1CompositeMetadata
ContentComparator.ChangeType.MODIFIED
if metadata is present in content2CompositeMetadata and in content1CompositeMetadata
ContentComparator.ChangeType.REMOVED
if metadata is not present in content2CompositeMetadata and present in content1CompositeMetadata
sub-paths will be added for RichText : encoding, lastModified, mimeType and inputStream
result
- Result where diff will be addedcontent1CompositeMetadata
- 1st contentcontent2CompositeMetadata
- 2nd contentmetadataName
- metadata NamecontentPath
- Content PathAmetysRepositoryException
- repository exceptionIOException
- IO Exceptionprivate void _compareGeoCodeMetadata(ContentComparator.Result result, CompositeMetadata content1CompositeMetadata, CompositeMetadata content2CompositeMetadata, String metadataName, String contentPath)
ContentComparator.ChangeType
can be
ContentComparator.ChangeType.ADDED
if metadata is present in content2CompositeMetadata and not in content1CompositeMetadata
ContentComparator.ChangeType.MODIFIED
if metadata is present in content2CompositeMetadata and in content1CompositeMetadata
ContentComparator.ChangeType.REMOVED
if metadata is not present in content2CompositeMetadata and present in content1CompositeMetadata
sub-paths will be added for GeoCode : latitude and longitude
For each sub-path, ContentComparator.ChangeTypeDetail
can be
ContentComparator.ChangeTypeDetail.MORE
ContentComparator.ChangeTypeDetail.LESS
result
- Result where diff will be addedcontent1CompositeMetadata
- 1st contentcontent2CompositeMetadata
- 2nd contentmetadataName
- metadata NamecontentPath
- Content Pathprivate void _compareLongMetadata(ContentComparator.Result result, CompositeMetadata content1CompositeMetadata, CompositeMetadata content2CompositeMetadata, String metadataName, String contentPath)
ContentComparator.ChangeType
can be
ContentComparator.ChangeType.ADDED
if metadata is present in content2CompositeMetadata and not in content1CompositeMetadata
ContentComparator.ChangeType.MODIFIED
if metadata is present in content2CompositeMetadata and in content1CompositeMetadata
ContentComparator.ChangeType.REMOVED
if metadata is not present in content2CompositeMetadata and present in content1CompositeMetadata
ContentComparator.ChangeTypeDetail
can be
ContentComparator.ChangeTypeDetail.MORE
ContentComparator.ChangeTypeDetail.LESS
result
- Result where diff will be addedcontent1CompositeMetadata
- 1st contentcontent2CompositeMetadata
- 2nd contentmetadataName
- metadata NamecontentPath
- Content Pathprivate void _compareDoubleMetadata(ContentComparator.Result result, CompositeMetadata content1CompositeMetadata, CompositeMetadata content2CompositeMetadata, String metadataName, String contentPath)
ContentComparator.ChangeType
can be
ContentComparator.ChangeType.ADDED
if metadata is present in content2CompositeMetadata and not in content1CompositeMetadata
ContentComparator.ChangeType.MODIFIED
if metadata is present in content2CompositeMetadata and in content1CompositeMetadata
ContentComparator.ChangeType.REMOVED
if metadata is not present in content2CompositeMetadata and present in content1CompositeMetadata
ContentComparator.ChangeTypeDetail
can be
ContentComparator.ChangeTypeDetail.MORE
ContentComparator.ChangeTypeDetail.LESS
result
- Result where diff will be addedcontent1CompositeMetadata
- 1st contentcontent2CompositeMetadata
- 2nd contentmetadataName
- metadata NamecontentPath
- Content Pathprivate void _compareDateMetadata(ContentComparator.Result result, CompositeMetadata content1CompositeMetadata, CompositeMetadata content2CompositeMetadata, String metadataName, String contentPath)
ContentComparator.ChangeType
can be
ContentComparator.ChangeType.ADDED
if metadata is present in content2CompositeMetadata and not in content1CompositeMetadata
ContentComparator.ChangeType.MODIFIED
if metadata is present in content2CompositeMetadata and in content1CompositeMetadata
ContentComparator.ChangeType.REMOVED
if metadata is not present in content2CompositeMetadata and present in content1CompositeMetadata
ContentComparator.ChangeTypeDetail
can be
ContentComparator.ChangeTypeDetail.AFTER
ContentComparator.ChangeTypeDetail.BEFORE
result
- Result where diff will be addedcontent1CompositeMetadata
- 1st contentcontent2CompositeMetadata
- 2nd contentmetadataName
- metadata NamecontentPath
- Content Pathprivate void _compareContentMetadata(ContentComparator.Result result, CompositeMetadata content1CompositeMetadata, CompositeMetadata content2CompositeMetadata, String metadataName, String contentPath)
ContentComparator.ChangeType
can be
ContentComparator.ChangeType.ADDED
if metadata is present in content2CompositeMetadata and not in content1CompositeMetadata
ContentComparator.ChangeType.MODIFIED
if metadata is present in content2CompositeMetadata and in content1CompositeMetadata
ContentComparator.ChangeType.REMOVED
if metadata is not present in content2CompositeMetadata and present in content1CompositeMetadata
result
- Result where diff will be addedcontent1CompositeMetadata
- 1st contentcontent2CompositeMetadata
- 2nd contentmetadataName
- metadata NamecontentPath
- Content Pathprivate void _compareReferenceMetadata(ContentComparator.Result result, CompositeMetadata content1CompositeMetadata, CompositeMetadata content2CompositeMetadata, String metadataName, String contentPath)
ContentComparator.ChangeType
can be
ContentComparator.ChangeType.ADDED
if metadata is present in content2CompositeMetadata and not in content1CompositeMetadata
ContentComparator.ChangeType.MODIFIED
if metadata is present in content2CompositeMetadata and in content1CompositeMetadata
ContentComparator.ChangeType.REMOVED
if metadata is not present in content2CompositeMetadata and present in content1CompositeMetadata
sub-paths will be added for Reference : type and value
result
- Result where diff will be addedcontent1CompositeMetadata
- 1st contentcontent2CompositeMetadata
- 2nd contentmetadataName
- metadata NamecontentPath
- Content Pathprivate void _compareUserMetadata(ContentComparator.Result result, CompositeMetadata content1CompositeMetadata, CompositeMetadata content2CompositeMetadata, String metadataName, String contentPath)
ContentComparator.ChangeType
can be
ContentComparator.ChangeType.ADDED
if metadata is present in content2CompositeMetadata and not in content1CompositeMetadata
ContentComparator.ChangeType.MODIFIED
if metadata is present in content2CompositeMetadata and in content1CompositeMetadata
ContentComparator.ChangeType.REMOVED
if metadata is not present in content2CompositeMetadata and present in content1CompositeMetadata
result
- Result where diff will be addedcontent1CompositeMetadata
- 1st contentcontent2CompositeMetadata
- 2nd contentmetadataName
- metadata NamecontentPath
- Content Pathprivate void _compareFileMetadata(ContentComparator.Result result, CompositeMetadata content1CompositeMetadata, CompositeMetadata content2CompositeMetadata, String metadataName, String contentPath) throws AmetysRepositoryException, IOException
ContentComparator.ChangeTypeDetail.TYPE
will be added to result_compareBinaryMetadata(Result, CompositeMetadata, CompositeMetadata, String, String)
if objects are binary_objectCompare(Result, Object, Object, String, String)
if objects are referencesContentComparator.ChangeType
can be
ContentComparator.ChangeType.ADDED
if metadata is present in content2CompositeMetadata and not in content1CompositeMetadata
ContentComparator.ChangeType.MODIFIED
if metadata is present in content2CompositeMetadata and in content1CompositeMetadata
ContentComparator.ChangeType.REMOVED
if metadata is not present in content2CompositeMetadata and present in content1CompositeMetadata
result
- Result where diff will be addedcontent1CompositeMetadata
- 1st contentcontent2CompositeMetadata
- 2nd contentmetadataName
- metadata NamecontentPath
- Content PathAmetysRepositoryException
- repository exceptionIOException
- IO Exceptionprivate void _compareBinaryMetadata(ContentComparator.Result result, CompositeMetadata content1CompositeMetadata, CompositeMetadata content2CompositeMetadata, String metadataName, String contentPath) throws AmetysRepositoryException, IOException
ContentComparator.ChangeType
can be
ContentComparator.ChangeType.ADDED
if metadata is present in content2CompositeMetadata and not in content1CompositeMetadata
ContentComparator.ChangeType.MODIFIED
if metadata is present in content2CompositeMetadata and in content1CompositeMetadata
ContentComparator.ChangeType.REMOVED
if metadata is not present in content2CompositeMetadata and present in content1CompositeMetadata
sub-paths will be added for Binary : encoding, fileName, lastModified, mimeType and inputStream
result
- Result where diff will be addedcontent1CompositeMetadata
- 1st contentcontent2CompositeMetadata
- 2nd contentmetadataName
- metadata NamecontentPath
- Content PathAmetysRepositoryException
- repository exceptionIOException
- IO Exceptionprivate void _compareBooleanMetadata(ContentComparator.Result result, CompositeMetadata content1CompositeMetadata, CompositeMetadata content2CompositeMetadata, String metadataName, String contentPath)
ContentComparator.ChangeType
can be
ContentComparator.ChangeType.ADDED
if metadata is present in content2CompositeMetadata and not in content1CompositeMetadata
ContentComparator.ChangeType.MODIFIED
if metadata is present in content2CompositeMetadata and in content1CompositeMetadata
ContentComparator.ChangeType.REMOVED
if metadata is not present in content2CompositeMetadata and present in content1CompositeMetadata
result
- Result where diff will be addedcontent1CompositeMetadata
- 1st contentcontent2CompositeMetadata
- 2nd contentmetadataName
- metadata NamecontentPath
- Content Pathprivate void _objectCompare(ContentComparator.Result result, Object object1, Object object2, String contentPath, String metadataName)
ContentComparator.ChangeType
can be
ContentComparator.ChangeType.ADDED
if metadata is present in content2CompositeMetadata and not in content1CompositeMetadata
ContentComparator.ChangeType.MODIFIED
if metadata is present in content2CompositeMetadata and in content1CompositeMetadata
ContentComparator.ChangeType.REMOVED
if metadata is not present in content2CompositeMetadata and present in content1CompositeMetadata
result
- Result where diff will be addedobject1
- 1st objectobject2
- 2nd objectcontentPath
- path (used to log)metadataName
- metadata Nameprivate boolean _checkMetadataPresence(ContentComparator.Result result, CompositeMetadata content1CompositeMetadata, CompositeMetadata content2CompositeMetadata, String contentPath, String metadataName, boolean logChange)
result
- The resultcontent1CompositeMetadata
- 1st compositecontent2CompositeMetadata
- 2nd compositecontentPath
- path (used to log)metadataName
- name of the metadatalogChange
- true to add a change in the list (if one have it and the other don't)