mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
ALF-17891: Mappings for Metadata Embedders Should be Defined in Config
- Changed AbstractMappingMetadataExtracter.getDefaultEmbedMapping to look for embed file in new alfresco/metadata classpath as well as old location git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@46538 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1641,20 +1641,46 @@ abstract public class AbstractMappingMetadataExtracter implements MetadataExtrac
|
|||||||
*/
|
*/
|
||||||
protected Map<QName, Set<String>> getDefaultEmbedMapping()
|
protected Map<QName, Set<String>> getDefaultEmbedMapping()
|
||||||
{
|
{
|
||||||
String className = this.getClass().getName();
|
Map<QName, Set<String>> embedMapping = null;
|
||||||
// Replace $
|
String metadataPropertiesUrl = null;
|
||||||
className = className.replace('$', '-');
|
try
|
||||||
// Replace .
|
{
|
||||||
className = className.replace('.', '/');
|
// Can't use getSimpleName here because we lose inner class $ processing
|
||||||
// Append .properties
|
String className = this.getClass().getName();
|
||||||
String propertiesUrl = className + ".embed.properties";
|
String shortClassName = className.split("\\.")[className.split("\\.").length - 1];
|
||||||
// Attempt to load the properties
|
// Replace $
|
||||||
Map<QName, Set<String>> embedMapping = readEmbedMappingProperties(propertiesUrl);
|
shortClassName = shortClassName.replace('$', '-');
|
||||||
|
// Append .properties
|
||||||
|
metadataPropertiesUrl = "alfresco/metadata/" + shortClassName + ".embed.properties";
|
||||||
|
// Attempt to load the properties
|
||||||
|
embedMapping = readEmbedMappingProperties(metadataPropertiesUrl);
|
||||||
|
}
|
||||||
|
catch (AlfrescoRuntimeException e)
|
||||||
|
{
|
||||||
|
// No embed mapping found at default location
|
||||||
|
}
|
||||||
|
// Try package location
|
||||||
|
try
|
||||||
|
{
|
||||||
|
String canonicalClassName = this.getClass().getName();
|
||||||
|
// Replace $
|
||||||
|
canonicalClassName = canonicalClassName.replace('$', '-');
|
||||||
|
// Replace .
|
||||||
|
canonicalClassName = canonicalClassName.replace('.', '/');
|
||||||
|
// Append .properties
|
||||||
|
String packagePropertiesUrl = canonicalClassName + ".embed.properties";
|
||||||
|
// Attempt to load the properties
|
||||||
|
embedMapping = readEmbedMappingProperties(packagePropertiesUrl);
|
||||||
|
}
|
||||||
|
catch (AlfrescoRuntimeException e)
|
||||||
|
{
|
||||||
|
// No embed mapping found at legacy location
|
||||||
|
}
|
||||||
if (embedMapping == null)
|
if (embedMapping == null)
|
||||||
{
|
{
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug("No explicit embed mapping properties found at: " + propertiesUrl + ", assuming reverse of extract mapping");
|
logger.debug("No explicit embed mapping properties found at: " + metadataPropertiesUrl + ", assuming reverse of extract mapping");
|
||||||
}
|
}
|
||||||
Map<String, Set<QName>> extractMapping = this.mapping;
|
Map<String, Set<QName>> extractMapping = this.mapping;
|
||||||
if (extractMapping == null || extractMapping.size() == 0)
|
if (extractMapping == null || extractMapping.size() == 0)
|
||||||
|
Reference in New Issue
Block a user