Search in sources :

Example 1 with ConverterRuntimeException

use of com.odysseusinc.arachne.portal.exception.ConverterRuntimeException in project ArachneCentralAPI by OHDSI.

the class AnalysisHelper method getSplittedFolder.

public Path getSplittedFolder(SubmissionGroup source) {
    Path splitedFolder = getSubmissionGroupFolder(source).resolve(SPLITED_DIR);
    File file = splitedFolder.toFile();
    if (!file.exists()) {
        if (!file.mkdirs()) {
            throw new ConverterRuntimeException("Cann't create folder \"" + SPLITED_DIR + "\" ");
        }
    }
    return splitedFolder;
}
Also used : Path(java.nio.file.Path) ConverterRuntimeException(com.odysseusinc.arachne.portal.exception.ConverterRuntimeException) ResultFile(com.odysseusinc.arachne.portal.model.ResultFile) SubmissionFile(com.odysseusinc.arachne.portal.model.SubmissionFile) ZipFile(net.lingala.zip4j.core.ZipFile) File(java.io.File)

Example 2 with ConverterRuntimeException

use of com.odysseusinc.arachne.portal.exception.ConverterRuntimeException in project ArachneCentralAPI by OHDSI.

the class AnalysisHelper method getArchiveFolder.

public Path getArchiveFolder(SubmissionGroup source) {
    Path archiveFolderPath = getSubmissionGroupFolder(source).resolve(ARCHIVE_DIR);
    File archiveFolder = archiveFolderPath.toFile();
    if (!archiveFolder.exists()) {
        if (!archiveFolder.mkdirs()) {
            throw new ConverterRuntimeException("can not create folder archive");
        }
    }
    return archiveFolderPath;
}
Also used : Path(java.nio.file.Path) ConverterRuntimeException(com.odysseusinc.arachne.portal.exception.ConverterRuntimeException) ResultFile(com.odysseusinc.arachne.portal.model.ResultFile) SubmissionFile(com.odysseusinc.arachne.portal.model.SubmissionFile) ZipFile(net.lingala.zip4j.core.ZipFile) File(java.io.File)

Example 3 with ConverterRuntimeException

use of com.odysseusinc.arachne.portal.exception.ConverterRuntimeException in project ArachneCentralAPI by OHDSI.

the class AnalysisHelper method compressAndSplit.

public void compressAndSplit(ArrayList<File> files, File zipArchive) {
    try {
        ZipFile zipFile = new ZipFile(zipArchive.getAbsoluteFile());
        ZipParameters parameters = new ZipParameters();
        parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
        parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
        zipFile.createZipFile(files, parameters, true, maximumSize);
    } catch (ZipException ex) {
        LOGGER.error(ex.getMessage(), ex);
        throw new ConverterRuntimeException(ex.getMessage());
    }
}
Also used : ZipFile(net.lingala.zip4j.core.ZipFile) ZipException(net.lingala.zip4j.exception.ZipException) ConverterRuntimeException(com.odysseusinc.arachne.portal.exception.ConverterRuntimeException) ZipParameters(net.lingala.zip4j.model.ZipParameters)

Aggregations

ConverterRuntimeException (com.odysseusinc.arachne.portal.exception.ConverterRuntimeException)3 ZipFile (net.lingala.zip4j.core.ZipFile)3 ResultFile (com.odysseusinc.arachne.portal.model.ResultFile)2 SubmissionFile (com.odysseusinc.arachne.portal.model.SubmissionFile)2 File (java.io.File)2 Path (java.nio.file.Path)2 ZipException (net.lingala.zip4j.exception.ZipException)1 ZipParameters (net.lingala.zip4j.model.ZipParameters)1