private void writeFolderToZip(FolderAPI folder, ZipOutputStream zipOutputStream, String pathPrefix) throws IOException, ProjectException { Collection<? extends ArtefactAPI> artefacts = folder.getArtefacts(); for (ArtefactAPI artefact : artefacts) { if (artefact instanceof ResourceAPI) { ZipEntry entry = new ZipEntry(pathPrefix + artefact.getName()); zipOutputStream.putNextEntry(entry); InputStream content = ((ResourceAPI) artefact).getContent(); IOUtils.copy(content, zipOutputStream); content.close(); zipOutputStream.closeEntry(); } else { writeFolderToZip((FolderAPI) artefact, zipOutputStream, pathPrefix + artefact.getName() + "/"); } } }
artefactProps.put(ArtefactProperties.VERSION_COMMENT, comment); artefact.setProps(artefactProps); ((ResourceAPI) artefact).setContent(in); } else { artefact.delete(user);
artefactProps.put(ArtefactProperties.VERSION_COMMENT, comment); artefact.setProps(artefactProps); ((ResourceAPI) artefact).setContent(in); } else { artefact.delete(user);
private void writeFolderToZip(FolderAPI folder, ZipOutputStream zipOutputStream, String pathPrefix) throws IOException, ProjectException { Collection<? extends ArtefactAPI> artefacts = folder.getArtefacts(); for (ArtefactAPI artefact : artefacts) { if (artefact instanceof ResourceAPI) { ZipEntry entry = new ZipEntry(pathPrefix + artefact.getName()); zipOutputStream.putNextEntry(entry); InputStream content = ((ResourceAPI) artefact).getContent(); IOUtils.copy(content, zipOutputStream); content.close(); zipOutputStream.closeEntry(); } else { writeFolderToZip((FolderAPI) artefact, zipOutputStream, pathPrefix + artefact.getName() + "/"); } } }