有没有办法检索 ADT?似乎使用 DDMTemplateLocalServiceUtil 不是要走的路

Is there a way to retrieve the ADTs? It doesn't seem like using DDMTemplateLocalServiceUtil is the way to go

我正在尝试让一个网站的所有广告都知道它是 groupid。但是,似乎 adts 与数据库中 DDMTemplate table 中站点的所有其他模板混合在一起。

DDMTemplates 是一个通用的门户概念,用于管理不同类型的门户资产(不仅是 ADT)的模板。 DDMTemplateLocalService 是一项用于列出特定资产类型的 ADT 的服务。您需要先获取要渲染的所需资产类型的 ClassNameId。例如:

com.liferay.portal.kernel.service.ClassNameLocalService.getClassNameId(AssetEntry.class)

对于 AssetPublisher 条目(或 BlogsEntry 等等 - 对于所有其他感兴趣的类型)。 有了这个 ID,您可以使用以下方式查询站点 (groupId) 的 ADT:

com.liferay.dynamic.data.mapping.service.DDMTemplateLocalService.getTemplates(long groupId, long classNameId)

除了使用 *LocalServiceUtil 静态函数,您还可以使用 @Reference 注释注入服务。例如 @Reference private DDMTemplateLocalService ddmTemplateService;.