ALF-17892: Should be Easier to Override Individual Mappings for Metadata Extractors

- Changed behavior of AbstractMappingMetadataExtracter.init to allow for specified mapping property entries to override the default entries rather than be merged with them
   - Added Javadoc notes to setInheritDefaultMapping and setInheritDefaultEmbedMapping indicating on the behavior
   - Changed MappingMetadataExtracterTest.testPropertyMappingMerge to reflect the new expected result
   - Added MappingMetadataExtracterTest.testPropertyMappingDisable to test disabling a mapping

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@47010 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ray Gauss
2013-02-22 19:30:50 +00:00
parent 5921570ac1
commit b0cd84dde7
2 changed files with 27 additions and 7 deletions

View File

@@ -373,6 +373,9 @@ abstract public class AbstractMappingMetadataExtracter implements MetadataExtrac
* Set if the property mappings augment or override the mapping generically provided by the
* extracter implementation. The default is <tt>false</tt>, i.e. any mapping set completely
* replaces the {@link #getDefaultMapping() default mappings}.
* <p>
* Note that even when set to <tt>true</tt> an individual property mapping entry replaces the
* entry provided by the extracter implementation.
*
* @param inheritDefaultMapping <tt>true</tt> to add the configured mapping
* to the list of default mappings.
@@ -426,6 +429,9 @@ abstract public class AbstractMappingMetadataExtracter implements MetadataExtrac
* Set if the embed property mappings augment or override the mapping generically provided by the
* extracter implementation. The default is <tt>false</tt>, i.e. any mapping set completely
* replaces the {@link #getDefaultEmbedMapping() default mappings}.
* <p>
* Note that even when set to <tt>true</tt> an individual property mapping entry replaces the
* entry provided by the extracter implementation.
*
* @param inheritDefaultEmbedMapping <tt>true</tt> to add the configured embed mapping
* to the list of default embed mappings.
@@ -976,9 +982,9 @@ abstract public class AbstractMappingMetadataExtracter implements MetadataExtrac
{
systemQNames = new HashSet<QName>(3);
mapping.put(documentKey, systemQNames);
Set<QName> defaultQNames = defaultMapping.get(documentKey);
systemQNames.addAll(defaultQNames);
}
Set<QName> defaultQNames = defaultMapping.get(documentKey);
systemQNames.addAll(defaultQNames);
}
}
@@ -1018,9 +1024,9 @@ abstract public class AbstractMappingMetadataExtracter implements MetadataExtrac
{
metadataKeys = new HashSet<String>(3);
embedMapping.put(modelProperty, metadataKeys);
Set<String> defaultMetadataKeys = defaultEmbedMapping.get(modelProperty);
metadataKeys.addAll(defaultMetadataKeys);
}
Set<String> defaultMetadataKeys = defaultEmbedMapping.get(modelProperty);
metadataKeys.addAll(defaultMetadataKeys);
}
}