我想使用CQ API调用来删除作品集生成器中的作品集。我看到http://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/adobe/cq/media/publishing/dps/fp/DPSSessionService.html可以创建一个会话 创建会话后,我可以使用http://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/adobe/cq/media/publishing/dps/fp/DPSFolioProducerService.html删除包含folioId的作品集 我不知道如何实现此接口以使其工作。我试过@Reference 私人DPSSessionService dpssession;
但是,这不会将我的流程部署到我的工作流程。我不确定如何才能让它发挥作用。
答案 0 :(得分:0)
也许您可以通过OSGi包的上下文获得服务。
你可以尝试这样的事情(虽然没有经过测试):
BundleContext bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
ServiceReference dpsFolioProducerServiceReference = bundleContext.getServiceReference(DPSFolioProducerService.class);
DPSFolioProducerService yourDPSFolioProducerService = (DPSFolioProducerService) bundleContext.getService(dpsFolioProducerServiceReference );
您可以在servlet中使用它。
答案 1 :(得分:0)
最后让它发挥作用:
@Reference
private DPSSessionService sessionService;
private DPSSession dpsSession = null;
private DPSFolioProducerService folioProducer;
try {
dpsSession = sessionService.createSession("username", "password");
folioProducer = dpsSession.adaptTo(DPSFolioProducerService.class);
folioProducer.deleteFolio(folioId);
sessionService.deleteSession(dpsSession);
} catch (DPSSessionServiceException ex) {
log.error("Failed setup", ex);
} catch (DPSFolioProducerServiceException e) {
log.error("Delete Folio failed", e);
}