use of cz.mzk.recordmanager.server.facade.exception.JobExecutionFailure in project RecordManager2 by moravianlibrary.
the class HarvestingFacadeImpl method incrementalHarvest.
public void incrementalHarvest(long conf_id, String job_name) {
LocalDateTime lastHarvestTime = getLastHarvest(conf_id, job_name);
Map<String, JobParameter> parameters = new HashMap<>();
parameters.put(Constants.JOB_PARAM_CONF_ID, new JobParameter(conf_id));
if (lastHarvestTime != null) {
Date lastHarvest = Date.from(lastHarvestTime.atZone(ZoneId.systemDefault()).toInstant());
logger.trace("Starting harvest from {}", lastHarvest);
parameters.put(Constants.JOB_PARAM_FROM_DATE, new JobParameter(lastHarvest));
}
parameters.put(Constants.JOB_PARAM_UNTIL_DATE, new JobParameter(new Date()));
parameters.put(Constants.JOB_PARAM_START_TIME, new JobParameter(new Date()));
JobParameters params = new JobParameters(parameters);
JobExecution exec = jobExecutor.execute(job_name, params);
if (!ExitStatus.COMPLETED.equals(exec.getExitStatus())) {
throw new JobExecutionFailure("Incremental harvest failed", exec);
}
}
use of cz.mzk.recordmanager.server.facade.exception.JobExecutionFailure in project RecordManager2 by moravianlibrary.
the class ImportRecordFacadeImpl method downloadAndImportRecordSJob.
@Override
public void downloadAndImportRecordSJob(DownloadImportConfiguration dic) {
Map<String, JobParameter> parameters = new HashMap<>();
parameters.put(Constants.JOB_PARAM_CONF_ID, new JobParameter(dic.getId()));
parameters.put(Constants.JOB_PARAM_REPEAT, new JobParameter(Constants.JOB_PARAM_ONE_VALUE));
JobParameters params = new JobParameters(parameters);
JobExecution exec = jobExecutor.execute(dic.getJobName(), params);
if (!ExitStatus.COMPLETED.equals(exec.getExitStatus())) {
throw new JobExecutionFailure("Download and import failed", exec);
}
}
use of cz.mzk.recordmanager.server.facade.exception.JobExecutionFailure in project RecordManager2 by moravianlibrary.
the class ImportRecordFacadeImpl method importFile.
@Override
public void importFile(long importConfId, File file, String format) {
Map<String, JobParameter> parameters = new HashMap<>();
parameters.put(Constants.JOB_PARAM_IN_FILE, new JobParameter(file.getAbsolutePath()));
parameters.put(Constants.JOB_PARAM_FORMAT, new JobParameter(format));
parameters.put(Constants.JOB_PARAM_CONF_ID, new JobParameter(importConfId));
JobParameters params = new JobParameters(parameters);
JobExecution exec = jobExecutor.execute(Constants.JOB_ID_IMPORT, params);
if (!ExitStatus.COMPLETED.equals(exec.getExitStatus())) {
throw new JobExecutionFailure("Incremental harvest failed", exec);
}
}
use of cz.mzk.recordmanager.server.facade.exception.JobExecutionFailure in project RecordManager2 by moravianlibrary.
the class ImportRecordFacadeImpl method importOaiRecordsJob.
@Override
public void importOaiRecordsJob(long impotrConfId, String fileName) {
Map<String, JobParameter> parameters = new HashMap<>();
parameters.put(Constants.JOB_PARAM_CONF_ID, new JobParameter(impotrConfId));
parameters.put(Constants.JOB_PARAM_IN_FILE, new JobParameter(fileName));
parameters.put(Constants.JOB_PARAM_REPEAT, new JobParameter(Constants.JOB_PARAM_ONE_VALUE));
JobParameters params = new JobParameters(parameters);
JobExecution exec = jobExecutor.execute(Constants.JOB_ID_IMPORT_OAI, params);
if (!ExitStatus.COMPLETED.equals(exec.getExitStatus())) {
throw new JobExecutionFailure("ImportOaiRecords failed", exec);
}
}
use of cz.mzk.recordmanager.server.facade.exception.JobExecutionFailure in project RecordManager2 by moravianlibrary.
the class ZakonyProLidiFacadeImpl method runZakonyProLidiHarvestJob.
@Override
public void runZakonyProLidiHarvestJob() {
Map<String, JobParameter> parameters = new HashMap<>();
parameters.put(Constants.JOB_PARAM_CONF_ID, new JobParameter(Constants.IMPORT_CONF_ID_ZAKONY));
parameters.put(Constants.JOB_PARAM_REPEAT, new JobParameter(Constants.JOB_PARAM_ONE_VALUE));
JobParameters params = new JobParameters(parameters);
JobExecution exec = jobExecutor.execute(Constants.JOB_ID_HARVEST_ZAKONYPROLIDI, params);
if (!ExitStatus.COMPLETED.equals(exec.getExitStatus())) {
throw new JobExecutionFailure("ZakonyProLidi harvest failed", exec);
}
}
Aggregations