@Override public PublishedDocument publish(DocumentModel doc, PublicationNode targetNode) { SimpleCorePublishedDocument publishedDocument = (SimpleCorePublishedDocument) super.publish(doc, targetNode); PublicationRelationHelper.addPublicationRelation(publishedDocument.getProxy(), this); return publishedDocument; }
public void unpublish(PublishedDocument publishedDocument) { if (!accept(publishedDocument)) { return; } DocumentModel proxy = ((SimpleCorePublishedDocument) publishedDocument).getProxy(); PublicationRelationHelper.removePublicationRelation(proxy); getCoreSession().removeDocument(proxy.getRef()); getCoreSession().save(); }