use of com.centurylink.mdw.dataaccess.file.VcsArchiver in project mdw-designer by CenturyLinkCloud.
the class ImportPackageWizard method unzipToLocal.
void unzipToLocal(WorkflowProject wfp, java.io.File zipFile, java.io.File tempDir, java.io.File assetDir, List<WorkflowPackage> importedPackages, ProgressMonitor progressMonitor) throws IOException, DataAccessException, CoreException, JSONException {
VersionControl vcs = new VersionControlGit();
vcs.connect(null, null, null, wfp.getAssetDir());
progressMonitor.subTask("Archive existing assets...");
VcsArchiver archiver = new VcsArchiver(assetDir, tempDir, vcs, progressMonitor);
archiver.backup();
PluginMessages.log("Unzipping " + zipFile + " into: " + assetDir);
ZipHelper.unzip(zipFile, assetDir, null, null, true);
archiver.archive();
ZipHelper.unzip(zipFile, tempDir, null, null, true);
wfp.getSourceProject().refreshLocal(2, null);
java.io.File explodedDir = new java.io.File(tempDir + "/com");
if (explodedDir.isDirectory()) {
List<java.io.File> fileList = FileHelper.getFilesRecursive(explodedDir, "package.json", new ArrayList<java.io.File>());
for (java.io.File file : fileList) {
WorkflowPackage workflowPackage = new WorkflowPackage();
workflowPackage.setProject(wfp);
workflowPackage.setPackageVO(new PackageVO(new JSONObject(FileHelper.getFileContents(file.getPath()))));
importedPackages.add(workflowPackage);
}
FileHelper.deleteRecursive(explodedDir);
}
}
Aggregations