use of nikita.common.util.exceptions.NoarkEntityNotFoundException in project nikita-noark5-core by HiOA-ABI.
the class BasicRecordService method getBasicRecordOrThrow.
// All HELPER operations
/**
* Internal helper method. Rather than having a find and try catch in multiple methods, we have it here once.
* If you call this, be aware that you will only ever get a valid BasicRecord back. If there is no valid
* BasicRecord, an exception is thrown
*
* @param basicRecordSystemId
* @return
*/
protected BasicRecord getBasicRecordOrThrow(@NotNull String basicRecordSystemId) {
BasicRecord basicRecord = basicRecordRepository.findBySystemId(basicRecordSystemId);
if (basicRecord == null) {
String info = INFO_CANNOT_FIND_OBJECT + " BasicRecord, using systemId " + basicRecordSystemId;
logger.info(info);
throw new NoarkEntityNotFoundException(info);
}
return basicRecord;
}
use of nikita.common.util.exceptions.NoarkEntityNotFoundException in project nikita-noark5-core by HiOA-ABI.
the class CaseFileService method getCaseFileOrThrow.
// All HELPER operations
/**
* Internal helper method. Rather than having a find and try catch in multiple methods, we have it here once.
* If you call this, be aware that you will only ever get a valid CaseFile back. If there is no valid
* CaseFile, an exception is thrown
*
* @param caseFileSystemId
* @return
*/
protected CaseFile getCaseFileOrThrow(@NotNull String caseFileSystemId) {
CaseFile caseFile = caseFileRepository.findBySystemId(caseFileSystemId);
if (caseFile == null) {
String info = INFO_CANNOT_FIND_OBJECT + " CaseFile, using systemId " + caseFileSystemId;
logger.info(info);
throw new NoarkEntityNotFoundException(info);
}
return caseFile;
}
use of nikita.common.util.exceptions.NoarkEntityNotFoundException in project nikita-noark5-core by HiOA-ABI.
the class ClassificationSystemService method getClassificationSystemOrThrow.
// All HELPER operations
/**
* Internal helper method. Rather than having a find and try catch in multiple methods, we have it here once.
* If you call this, be aware that you will only ever get a valid ClassificationSystem back. If there is no valid
* ClassificationSystem, an exception is thrown
*
* @param classificationSystemSystemId
* @return
*/
protected ClassificationSystem getClassificationSystemOrThrow(@NotNull String classificationSystemSystemId) {
ClassificationSystem classificationSystem = classificationSystemRepository.findBySystemId(classificationSystemSystemId);
if (classificationSystem == null) {
String info = INFO_CANNOT_FIND_OBJECT + " ClassificationSystem, using systemId " + classificationSystemSystemId;
logger.info(info);
throw new NoarkEntityNotFoundException(info);
}
return classificationSystem;
}
use of nikita.common.util.exceptions.NoarkEntityNotFoundException in project nikita-noark5-core by HiOA-ABI.
the class DocumentDescriptionService method getDocumentDescriptionOrThrow.
// All HELPER operations
/**
* Internal helper method. Rather than having a find and try catch in multiple methods, we have it here once.
* If you call this, be aware that you will only ever get a valid DocumentDescription back. If there is no valid
* DocumentDescription, an exception is thrown
*
* @param documentDescriptionSystemId
* @return
*/
protected DocumentDescription getDocumentDescriptionOrThrow(@NotNull String documentDescriptionSystemId) {
DocumentDescription documentDescription = documentDescriptionRepository.findBySystemId(documentDescriptionSystemId);
if (documentDescription == null) {
String info = INFO_CANNOT_FIND_OBJECT + " DocumentDescription, using systemId " + documentDescriptionSystemId;
logger.info(info);
throw new NoarkEntityNotFoundException(info);
}
return documentDescription;
}
use of nikita.common.util.exceptions.NoarkEntityNotFoundException in project nikita-noark5-core by HiOA-ABI.
the class DocumentDescriptionService method createDocumentObjectAssociatedWithDocumentDescription.
// All CREATE operations
@Override
public DocumentObject createDocumentObjectAssociatedWithDocumentDescription(String documentDescriptionSystemId, DocumentObject documentObject) {
DocumentObject persistedDocumentObject = null;
DocumentDescription documentDescription = documentDescriptionRepository.findBySystemId(documentDescriptionSystemId);
if (documentDescription == null) {
String info = INFO_CANNOT_FIND_OBJECT + " DocumentDescription, using documentDescriptionSystemId " + documentDescriptionSystemId;
logger.info(info);
throw new NoarkEntityNotFoundException(info);
} else {
documentObject.setReferenceDocumentDescription(documentDescription);
List<DocumentObject> documentObjects = documentDescription.getReferenceDocumentObject();
documentObjects.add(documentObject);
persistedDocumentObject = documentObjectService.save(documentObject);
}
return persistedDocumentObject;
}
Aggregations