/** * parse a process definition from a process archive zip-stream. * * @throws org.jbpm.jpdl.JpdlException if parsing reported an error. */ public static ProcessDefinition parseParZipInputStream(ZipInputStream zipInputStream) throws IOException { return new ProcessArchive(zipInputStream).parseProcessDefinition(); }
/** * parse a process definition from a process archive zip-stream. * * @throws org.jbpm.jpdl.JpdlException if parsing reported an error. */ public static ProcessDefinition parseParZipInputStream(ZipInputStream zipInputStream) throws IOException { return new ProcessArchive(zipInputStream).parseProcessDefinition(); }
void convertPars() throws Exception { File[] files = indir.listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".par"); } }); for (File inputFile: files) { ZipInputStream zip = new ZipInputStream(new BufferedInputStream(Files.newInputStream(inputFile.toPath()))); ProcessArchive pa = new ProcessArchive(zip); String xml = convertPar(pa); // Create new process archive in designated output directory File outputFile = new File(outdir, inputFile.getName()); ZipOutputStream zippo = new ZipOutputStream(new BufferedOutputStream(Files.newOutputStream(outputFile.toPath()))); // Copy all non-pdl entries and insert new pdl for (Iterator iter = pa.getEntries().keySet().iterator(); iter.hasNext();) { String name = (String) iter.next(); zippo.putNextEntry(new ZipEntry(name)); if ("processdefinition.xml".equalsIgnoreCase(name)) { zippo.write(xml.getBytes()); } else { zippo.write(pa.getEntry(name)); } zippo.closeEntry(); } zippo.close(); System.out.println("Converted " + inputFile.getName()); } // process next PAR }
void convertPars() throws Exception { String[] files = indir.list(new FilenameFilter() { public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".par"); } }); for (int i = 0; i < files.length; i++) { ZipInputStream zip = new ZipInputStream(new FileInputStream(indir.getPath() + "/" + files[i])); ProcessArchive pa = new ProcessArchive(zip); String xml = convertPar(pa); // Create new process archive in designated output directory ZipOutputStream zippo = new ZipOutputStream(new FileOutputStream(outdir.getPath() + "/" + files[i])); // Copy all non-pdl entries and insert new pdl for (Iterator iter = pa.getEntries().keySet().iterator(); iter.hasNext();) { String name = (String) iter.next(); zippo.putNextEntry(new ZipEntry(name)); if ("processdefinition.xml".equalsIgnoreCase(name)) { zippo.write(xml.getBytes()); } else { zippo.write(pa.getEntry(name)); } zippo.closeEntry(); } zippo.close(); System.out.println("Converted " + files[i]); } // process next PAR }