use of nikita.util.exceptions.NoarkEntityEditWhenClosedException in project nikita-noark5-core by HiOA-ABI.
the class SeriesService method createFileAssociatedWithSeries.
@Override
public File createFileAssociatedWithSeries(String seriesSystemId, File file) {
File persistedFile = null;
Series series = seriesRepository.findBySystemIdOrderBySystemId(seriesSystemId);
if (series == null) {
String info = INFO_CANNOT_FIND_OBJECT + " Series, using seriesSystemId " + seriesSystemId;
logger.info(info);
throw new NoarkEntityNotFoundException(info);
} else if (series.getSeriesStatus() != null && series.getSeriesStatus().equals(STATUS_CLOSED)) {
String info = INFO_CANNOT_ASSOCIATE_WITH_CLOSED_OBJECT + ". Series with seriesSystemId " + seriesSystemId + "has status " + STATUS_CLOSED;
logger.info(info);
throw new NoarkEntityEditWhenClosedException(info);
} else {
file.setReferenceSeries(series);
persistedFile = fileService.createFile(file);
}
return persistedFile;
}
use of nikita.util.exceptions.NoarkEntityEditWhenClosedException in project nikita-noark5-core by HiOA-ABI.
the class SeriesImportService method createCaseFileAssociatedWithSeries.
// All CREATE operations
@Override
public CaseFile createCaseFileAssociatedWithSeries(String seriesSystemId, CaseFile caseFile) {
CaseFile persistedFile = null;
Series series = seriesRepository.findBySystemIdOrderBySystemId(seriesSystemId);
if (series == null) {
String info = INFO_CANNOT_FIND_OBJECT + " Series, using seriesSystemId " + seriesSystemId;
logger.info(info);
throw new NoarkEntityNotFoundException(info);
} else if (series.getSeriesStatus() != null && series.getSeriesStatus().equals(STATUS_CLOSED)) {
String info = INFO_CANNOT_ASSOCIATE_WITH_CLOSED_OBJECT + ". Series with seriesSystemId " + seriesSystemId + "has status " + STATUS_CLOSED;
logger.info(info);
throw new NoarkEntityEditWhenClosedException(info);
} else {
caseFile.setReferenceSeries(series);
persistedFile = caseFileImportService.save(caseFile);
}
return persistedFile;
}
Aggregations