Problems with metadata

Rationale: 

MGNLDAM-418 - Getting issue details... STATUS
MGNLDAM-411 - Getting issue details... STATUS

  • Metadata are only really used in DamTemplatingFunctions - the ui, for example, treats the metadata
    as JCR properties of underyling Node of an Asset.
    We need to be able to use custom metadata from templates & apps (fields, columns, ...)
  • In DamTemplatingFunctions we assume that Asset always support MagnoliaAssetMetadata and DublinCore
    and we construct maps from them (bean to map). 

Proposed solution:

    • Add method Asset#supports(Class<? extends AssetMetadata> metaData);

    • Create multibinding AssetMetadataDefinition interface which will bind namespace with AssetMetadata extending class.

    • Create AssetMetadataRegistry which wraps all registered AssetMetadataDefinition classes.


DamTemplatingFunctions could then check the asset for support of every registered metadata class and
construct a map from it:

public Map<String, Object> getAssetMap(Asset asset) {
    for (AssetMetadataDefinition metadataDefinition : metadataRegistry.getAll()) {
        if (asset.supports(metadataDefinition.getMetadataClass())) {
        ...

Then in template:

[#assign assetMap = damfn.getAssetMap(asset)]
${assetMap.metadata.dc.contributor!}

Sorting: MGNLDAM-546

assetQuery.withKeyword("foo").orderBy(asset.getMetadata(DublinCore.class), "contributor", Order.ASCENDING)
  • No labels