use of nikita.common.util.exceptions.NoarkEntityNotFoundException in project nikita-noark5-core by HiOA-ABI.
the class PrecedenceStatusService method getPrecedenceStatusOrThrow.
/**
* 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 PrecedenceStatus object back. If
* there is no PrecedenceStatus object, a NoarkEntityNotFoundException
* exception is thrown
*
* @param systemId The systemId of the PrecedenceStatus object to retrieve
* @return the PrecedenceStatus object
*/
private PrecedenceStatus getPrecedenceStatusOrThrow(@NotNull String systemId) {
PrecedenceStatus precedenceStatus = precedenceStatusRepository.findBySystemId(systemId);
if (precedenceStatus == null) {
String info = INFO_CANNOT_FIND_OBJECT + " PrecedenceStatus, " + "using systemId " + systemId;
logger.error(info);
throw new NoarkEntityNotFoundException(info);
}
return precedenceStatus;
}
use of nikita.common.util.exceptions.NoarkEntityNotFoundException in project nikita-noark5-core by HiOA-ABI.
the class RegistryEntryTypeService method getRegistryEntryTypeOrThrow.
/**
* 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 RegistryEntryType object back. If
* there is no RegistryEntryType object, a NoarkEntityNotFoundException
* exception is thrown
*
* @param systemId The systemId of the RegistryEntryType object to retrieve
* @return the RegistryEntryType object
*/
private RegistryEntryType getRegistryEntryTypeOrThrow(@NotNull String systemId) {
RegistryEntryType format = formatRepository.findBySystemId(systemId);
if (format == null) {
String info = INFO_CANNOT_FIND_OBJECT + " RegistryEntryType, " + "using systemId " + systemId;
logger.error(info);
throw new NoarkEntityNotFoundException(info);
}
return format;
}
use of nikita.common.util.exceptions.NoarkEntityNotFoundException in project nikita-noark5-core by HiOA-ABI.
the class SignOffMethodService method getSignOffMethodOrThrow.
/**
* 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 SignOffMethod object back. If there
* is no SignOffMethod object, a NoarkEntityNotFoundException exception
* is thrown
*
* @param systemId The systemId of the SignOffMethod object to retrieve
* @return the SignOffMethod object
*/
private SignOffMethod getSignOffMethodOrThrow(@NotNull String systemId) {
SignOffMethod SignOffMethod = SignOffMethodRepository.findBySystemId(systemId);
if (SignOffMethod == null) {
String info = INFO_CANNOT_FIND_OBJECT + " SignOffMethod, using " + "systemId " + systemId;
logger.error(info);
throw new NoarkEntityNotFoundException(info);
}
return SignOffMethod;
}
use of nikita.common.util.exceptions.NoarkEntityNotFoundException in project nikita-noark5-core by HiOA-ABI.
the class CorrespondencePartService method getCorrespondencePartOrThrow.
/**
* 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 CorrespondencePart back. If there is no valid
* CorrespondencePart, an exception is thrown
*
* @param correspondencePartSystemId
* @return
*/
protected CorrespondencePart getCorrespondencePartOrThrow(@NotNull String correspondencePartSystemId) {
CorrespondencePart correspondencePart = correspondencePartRepository.findBySystemId(correspondencePartSystemId);
if (correspondencePart == null) {
String info = INFO_CANNOT_FIND_OBJECT + " CorrespondencePart, using systemId " + correspondencePartSystemId;
logger.info(info);
throw new NoarkEntityNotFoundException(info);
}
return correspondencePart;
}
use of nikita.common.util.exceptions.NoarkEntityNotFoundException in project nikita-noark5-core by HiOA-ABI.
the class ClassService method createClassAssociatedWithClass.
public Class createClassAssociatedWithClass(String classSystemId, Class klass) {
Class persistedClass = null;
Class parentKlass = classRepository.findBySystemId(classSystemId);
if (parentKlass == null) {
String info = INFO_CANNOT_FIND_OBJECT + " Class, using classSystemId " + classSystemId;
logger.info(info);
throw new NoarkEntityNotFoundException(info);
} else if (parentKlass.getFinalisedDate() != null) {
String info = INFO_CANNOT_ASSOCIATE_WITH_CLOSED_OBJECT + ". Class with classSystemId " + classSystemId + "has been finalised. Cannot associate a new class object with a finalised class object";
logger.info(info);
throw new NoarkEntityEditWhenClosedException(info);
} else {
klass.setReferenceParentClass(parentKlass);
persistedClass = this.save(klass);
}
return persistedClass;
}
Aggregations