@Test public void testRemoveProxies() throws OperationException { ctx.setInput(fileToPublish); OperationChain chain = new OperationChain("publishDocument"); 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 removeProxies = new OperationChain("testRemoveProxies"); removeProxies.add(FetchContextDocument.ID); removeProxies.add(RemoveProxies.ID); service.run(ctx, removeProxies); 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()); } if (save) { session.save(); } return input; }
RemoveProxies { @OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel input) { DocumentModelList proxies = session.getProxies(input.getRef(), null); for (DocumentModel proxy : proxies) { session.removeDocument(proxy.getRef()); } if (save) { session.save(); } return input; } }
RemoveProxies { @OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel input) { DocumentModelList proxies = session.getProxies(input.getRef(), null); for (DocumentModel proxy : proxies) { session.removeDocument(proxy.getRef()); } if (save) { session.save(); } return input; }  }
RemoveProxies { @OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel input) { DocumentModelList proxies = session.getProxies(input.getRef(), null); for (DocumentModel proxy : proxies) { session.removeDocument(proxy.getRef()); } if (save) { session.save(); } return input; }  @OperationMethod(collector = DocumentModelCollector.class) DocumentModel run(DocumentModel input); }
RemoveProxies { @OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel input) { DocumentModelList proxies = session.getProxies(input.getRef(), null); for (DocumentModel proxy : proxies) { session.removeDocument(proxy.getRef()); } if (save) { session.save(); } return input; }  @OperationMethod(collector = DocumentModelCollector.class) DocumentModel run(DocumentModel input); static final String ID; }