@Test public void testUnpublishDocument() throws InvalidChainException, OperationException, Exception { OperationContext ctx = new OperationContext(session); ctx.setInput(fileToPublish); OperationChain chain = new OperationChain("testpublish"); chain.add(FetchContextDocument.ID); chain.add(PublishDocument.ID).set("target",section.getId()); DocumentModel publishedDoc = (DocumentModel)service.run(ctx, chain); Assert.assertEquals("Section", session.getDocument(publishedDoc.getParentRef()).getTitle()); Assert.assertEquals(1, session.getChildren(section.getRef()).size()); OperationChain unpublishChain = new OperationChain("testunpublish"); unpublishChain.add(FetchContextDocument.ID); unpublishChain.add(UnpublishDocument.ID); service.run(ctx, unpublishChain); Assert.assertEquals(0, session.getChildren(section.getRef()).size()); }
@OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel input) { DocumentModelList proxies = session.getProxies(input.getRef(), null); for (DocumentModel proxy : proxies) { session.removeDocument(proxy.getRef()); } session.save(); return null; }
UnpublishDocument { @OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel input) { DocumentModelList proxies = session.getProxies(input.getRef(), null); for (DocumentModel proxy : proxies) { session.removeDocument(proxy.getRef()); } session.save(); return null; } }
UnpublishDocument { @OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel input) { DocumentModelList proxies = session.getProxies(input.getRef(), null); for (DocumentModel proxy : proxies) { session.removeDocument(proxy.getRef()); } session.save(); return null; }  }
UnpublishDocument { @OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel input) { DocumentModelList proxies = session.getProxies(input.getRef(), null); for (DocumentModel proxy : proxies) { session.removeDocument(proxy.getRef()); } session.save(); return null; }  @OperationMethod(collector = DocumentModelCollector.class) DocumentModel run(DocumentModel input); }
UnpublishDocument { @OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel input) { DocumentModelList proxies = session.getProxies(input.getRef(), null); for (DocumentModel proxy : proxies) { session.removeDocument(proxy.getRef()); } session.save(); return null; }  @OperationMethod(collector = DocumentModelCollector.class) DocumentModel run(DocumentModel input); static final String ID; }