use of nikita.common.util.exceptions.NoarkEntityNotFoundException in project nikita-noark5-core by HiOA-ABI.
the class CorrespondencePartTypeService method getCorrespondencePartTypeOrThrow.
/**
* 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 CorrespondencePartType back. If there is no valid
* CorrespondencePartType, an exception is thrown
*
* @param correspondencePartTypeCode
* @return
*/
protected CorrespondencePartType getCorrespondencePartTypeOrThrow(@NotNull String correspondencePartTypeCode) {
CorrespondencePartType correspondencePartType = correspondencePartTypeRepository.findByCode(correspondencePartTypeCode);
if (correspondencePartType == null) {
String info = INFO_CANNOT_FIND_OBJECT + " correspondencePartType, using kode " + correspondencePartTypeCode;
logger.info(info);
throw new NoarkEntityNotFoundException(info);
}
return correspondencePartType;
}
use of nikita.common.util.exceptions.NoarkEntityNotFoundException in project nikita-noark5-core by HiOA-ABI.
the class CountryService method getCountryOrThrow.
/**
* 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 Country object back. If there
* is no Country object, a NoarkEntityNotFoundException exception
* is thrown
*
* @param systemId The systemId of the Country object to retrieve
* @return the Country object
*/
private Country getCountryOrThrow(@NotNull String systemId) {
Country country = countryRepository.findBySystemId(systemId);
if (country == null) {
String info = INFO_CANNOT_FIND_OBJECT + " Country, using " + "systemId " + systemId;
logger.error(info);
throw new NoarkEntityNotFoundException(info);
}
return country;
}
use of nikita.common.util.exceptions.NoarkEntityNotFoundException in project nikita-noark5-core by HiOA-ABI.
the class DocumentTypeService method getDocumentTypeOrThrow.
/**
* 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 DocumentType object back. If there
* is no DocumentType object, a NoarkEntityNotFoundException exception
* is thrown
*
* @param systemId The systemId of the DocumentType object to retrieve
* @return the DocumentType object
*/
private DocumentType getDocumentTypeOrThrow(@NotNull String systemId) {
DocumentType documentType = documentTypeRepository.findBySystemId(systemId);
if (documentType == null) {
String info = INFO_CANNOT_FIND_OBJECT + " DocumentType, using " + "systemId " + systemId;
logger.error(info);
throw new NoarkEntityNotFoundException(info);
}
return documentType;
}
use of nikita.common.util.exceptions.NoarkEntityNotFoundException in project nikita-noark5-core by HiOA-ABI.
the class FileTypeService method getFileTypeOrThrow.
/**
* 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 FileType object back. If there
* is no FileType object, a NoarkEntityNotFoundException exception
* is thrown
*
* @param systemId The systemId of the FileType object to retrieve
* @return the FileType object
*/
private FileType getFileTypeOrThrow(@NotNull String systemId) {
FileType fileType = fileTypeRepository.findBySystemId(systemId);
if (fileType == null) {
String info = INFO_CANNOT_FIND_OBJECT + " FileType, using " + "systemId " + systemId;
logger.error(info);
throw new NoarkEntityNotFoundException(info);
}
return fileType;
}
use of nikita.common.util.exceptions.NoarkEntityNotFoundException in project nikita-noark5-core by HiOA-ABI.
the class FlowStatusService method getFlowStatusOrThrow.
/**
* 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 FlowStatus object back. If there is
* no FlowStatus object, a NoarkEntityNotFoundException exception is thrown
*
* @param systemId The systemId of the FlowStatus object to retrieve
* @return the FlowStatus object
*/
private FlowStatus getFlowStatusOrThrow(@NotNull String systemId) {
FlowStatus flowStatus = flowStatusRepository.findBySystemId(systemId);
if (flowStatus == null) {
String info = INFO_CANNOT_FIND_OBJECT + " FlowStatus, using " + "systemId " + systemId;
logger.error(info);
throw new NoarkEntityNotFoundException(info);
}
return flowStatus;
}
Aggregations