[英]Exporting AEM experience fragments to Adobe Target automatically every time a related Content Fragment is updated
I have this unique requirement where each time a particular Content Fragment is updated in AEM, all the Experience Fragments referencing that particular Content Fragment need to be automatically exported to Adobe Target.我有一个独特的要求,每次在 AEM 中更新特定内容片段时,引用该特定内容片段的所有体验片段都需要自动导出到 Adobe Target。
Thinking about using SQL2 query to retrieve XFs referencing a particular CF and then incorporating this into a workflow process.考虑使用 SQL2 查询来检索引用特定 CF 的 XF,然后将其合并到工作流程中。 Also, wondering if I can leverage aem OOTB workflow process called "Export to Target" in this.另外,想知道我是否可以在其中利用称为“导出到目标”的 aem OOTB 工作流程。 Not really sure of how to call this "Export to Target" process on each Experience Fragment that we need to export to Target or is this possible at all?不太确定如何在我们需要导出到 Target 的每个体验片段上调用此“导出到 Target”过程,或者这是否可能?
Wondering if anyone has ever come across this requirement and succeeded.想知道是否有人遇到过这个要求并成功了。 Highly appreciate any tips or suggestions in this regard.非常感谢这方面的任何提示或建议。 Many Thanks in advance.提前谢谢了。
Whenever a Content Fragment is created or updated an OSGi event is triggered.每当创建或更新内容片段时,都会触发 OSGi 事件。 All events are logged under http://localhost:4502/system/console/events.所有事件都记录在 http://localhost:4502/system/console/events 下。 You could write a EventListener or EventHandler , get the path of the event, get the Resource and adapt it to com.adobe.cq.dam.cfm.ContentFragment
.您可以编写一个EventListener 或 EventHandler ,获取事件的路径,获取 Resource 并将其调整为com.adobe.cq.dam.cfm.ContentFragment
。 The topic for these events is "com/day/cq/dam" or in this constant .这些事件的主题是“com/day/cq/dam”或这个常量。
From the adapted Class or Resource you can get informations about the model and if it's the model you want to process.从改编的 Class 或资源中,您可以获得有关 model 的信息,以及它是否是您要处理的 model。
To find all references I would also create an oak index and use SQL2 query to find all references.要查找所有引用,我还会创建一个oak 索引并使用 SQL2 查询来查找所有引用。
The query would be something like this:查询将是这样的:
select [jcr:path], [jcr:score], * from [nt:base] as a where contains(*, '"/content/dam/myReferencedModel"')
If you have all referencing XF's you can kick off any workflow via WorkflowService :如果你有所有引用 XF,你可以通过WorkflowService启动任何工作流:
@Reference
private WorkflowService workflowService;
WorkflowSession wfSession = workflowService.getWorkflowSession(session);
WorkflowModel wfModel = wfSession.getModel("/var/workflow/models/mymodel");
WorkflowData wfData = wfSession.newWorkflowData("JCR_PATH", "/payload");
wfSession.startWorkflow(wfModel, wfData);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.