adobe / adobe/aio-lib-java

`aem.events_osgi_mapping` enrich xdm Asset to add DamAsset metadata

未关闭
#90 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Java
星标
7
派生
22
PR 合并指标
30 天内没有已合并 PR

描述

The challenge would be in white-listing the metadata, as it can be too large.

it could be like this:

```
package package com.adobe.aio.aem.event.xdm.aem;

import com.adobe.xdm.assets.Asset;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.apache.sling.api.resource.ValueMap;

@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class DamAsset extends Asset {

Map metadatas;

@JsonIgnore
public void setMetadata(ValueMap valueMap) {
if (valueMap != null) {
metadatas = new HashMap<>();
for (String entry : valueMap.keySet()) {
Object value = valueMap.get(entry);
if (value != null && !entry.startsWith("jcr:") && !(value instanceof GregorianCalendar)
&& !(value.getClass().isArray())) {
metadatas.put(entry, value.toString());
//TODO better filtering with metadata whitelist configuration
}
}
}
}

@JsonProperty("xdmAsset:metadatas")
public Map getMetadata() {
return metadatas;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
if (!super.equals(o)) {
return false;
}
DamAsset damAsset = (DamAsset) o;
return Objects.equals(metadatas, damAsset.metadatas);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), metadatas);
}

@Override
public String toString() {
return "DamAsset{id='" + this.id + '\'' + ", type='" + this.type + '\'' + ", assetId='"
+ this.getAssetId() + '\'' + ", assetName='" + this.getAssetName() + '\''
+ ", etag='" + this.getEtag()
+ '\'' + ", path='" + this.getPath() + '\'' + ", format='" + this.getFormat() + '\''
+ "metadatas=" + metadatas +
'}';
}
}

```

贡献指南

打开贡献指南

调研方向

首先定位 aem.events_osgi_mapping 的实现以及现有的 XDM Asset 映射入口点。检查如何获取 AEM 资产元数据,然后定义 issue 中描述的元数据白名单和 DamAsset 映射。完成的标准是 XDM asset 包含允许的 DamAsset 元数据,同时不包含过大的值或被排除的值。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
api
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。