diff --git a/core/src/main/java/com/adobe/aem/commons/assetshare/content/impl/MetadataSchemaPropertiesImpl.java b/core/src/main/java/com/adobe/aem/commons/assetshare/content/impl/MetadataSchemaPropertiesImpl.java index 130fd0521d..88fca1fd5e 100644 --- a/core/src/main/java/com/adobe/aem/commons/assetshare/content/impl/MetadataSchemaPropertiesImpl.java +++ b/core/src/main/java/com/adobe/aem/commons/assetshare/content/impl/MetadataSchemaPropertiesImpl.java @@ -194,23 +194,32 @@ protected void visit(final Resource resource) { collectMetadataProperty(fieldLabel, propertyName, metadata); } - private boolean isWidget(Resource resource) { - if (resource == null) { + private boolean isWidget(Resource widgetResource) { + if (widgetResource == null) { return false; } if (metadataFieldResourceTypes != null && metadataFieldResourceTypes.size() > 0) { // Overriding the allowed field resource types; only match these. - return metadataFieldResourceTypes.stream().anyMatch(metaType -> checkMetaDataType(resource, metaType)); + return metadataFieldResourceTypes.stream().anyMatch(metaType -> checkMetaDataType(widgetResource, metaType)); } else { // Default use the Granite UI (foundation and coral) Field resourceTypes - return Arrays.stream(RT_FIELDS).anyMatch(resourceType -> resource.isResourceType(resourceType)); + return Arrays.stream(RT_FIELDS).anyMatch(resourceType -> widgetResource.isResourceType(resourceType)); } } - private boolean checkMetaDataType(Resource resource, String metaType) { - return Arrays.stream(METADATA_TYPES_PROPERTIES).anyMatch(metaTypeProperty-> resource.getValueMap().containsKey(metaTypeProperty) - && resource.getValueMap().get(metaTypeProperty).equals(metaType)); + private boolean checkMetaDataType(Resource widgetResource, String metaType) { + final ValueMap properties = widgetResource.getValueMap(); + for (final String propertyName : METADATA_TYPES_PROPERTIES) { + + final String metaTypeCandidate = properties.get("granite:data/" + propertyName, properties.get(propertyName, String.class)); + + if (StringUtils.equals(metaType, metaTypeCandidate)) { + return true; + } + } + + return false; } }