@Test public void testFolderCreationNoOverwrite() throws OperationException { DocumentModel folder = session.createDocumentModel(parent.getPathAsString(), "bar", "Folder"); folder.setPropertyValue("dc:title", "bar"); folder.setPropertyValue("dc:description", "foobar"); folder = session.createDocument(folder); try (OperationContext ctx = new OperationContext(session)) { ctx.setInput(parent); Map<String, Serializable> params = new HashMap<>(); params.put("title", "bar"); DocumentModel doc = (DocumentModel) service.run(ctx, FileManagerCreateFolder.ID, params); assertNotNull(doc); assertNotNull(doc.getId()); assertNotEquals(folder.getId(), doc.getId()); assertEquals("Folder", doc.getType()); assertNotEquals("bar", doc.getName()); assertNotEquals("/foo/bar", doc.getPathAsString()); assertEquals("bar", doc.getTitle()); } }
@OperationMethod public DocumentModel run(DocumentModel parent) throws IOException { DocumentModel doc = fileManager.createFolder(session, title, parent.getPathAsString(), overwrite); if (properties != null) { DocumentHelper.setProperties(session, doc, properties); if (doc.isDirty()) { doc = session.saveDocument(doc); } } return doc; }
FileManagerCreateFolder { @OperationMethod public DocumentModel run(DocumentModel parent) throws IOException { DocumentModel doc = fileManager.createFolder(session, title, parent.getPathAsString(), overwrite); if (properties != null) { DocumentHelper.setProperties(session, doc, properties); if (doc.isDirty()) { doc = session.saveDocument(doc); } } return doc; } }
FileManagerCreateFolder { @OperationMethod public DocumentModel run(DocumentModel parent) throws IOException { DocumentModel doc = fileManager.createFolder(session, title, parent.getPathAsString(), overwrite); if (properties != null) { DocumentHelper.setProperties(session, doc, properties); if (doc.isDirty()) { doc = session.saveDocument(doc); } } return doc; }  }
FileManagerCreateFolder { @OperationMethod public DocumentModel run(DocumentModel parent) throws IOException { DocumentModel doc = fileManager.createFolder(session, title, parent.getPathAsString(), overwrite); if (properties != null) { DocumentHelper.setProperties(session, doc, properties); if (doc.isDirty()) { doc = session.saveDocument(doc); } } return doc; }  @OperationMethod DocumentModel run(DocumentModel parent); }
FileManagerCreateFolder { @OperationMethod public DocumentModel run(DocumentModel parent) throws IOException { DocumentModel doc = fileManager.createFolder(session, title, parent.getPathAsString(), overwrite); if (properties != null) { DocumentHelper.setProperties(session, doc, properties); if (doc.isDirty()) { doc = session.saveDocument(doc); } } return doc; }  @OperationMethod DocumentModel run(DocumentModel parent); static final String ID; }