added missing ControllerExceptions

This commit is contained in:
2019-02-09 14:15:26 +01:00
parent 6117cc6c10
commit 03281643ad

View File

@ -58,7 +58,7 @@ public abstract class AbstractController<T> {
this.entityClass = clazz; this.entityClass = clazz;
} }
public void applyUpdateableChanges(Updateable updateable, boolean onCreate) { public void applyUpdateableChanges(Updateable updateable, boolean onCreate) throws ControllerException {
if (onCreate) { if (onCreate) {
updateable.setCreatedBy(account.getUsername()); updateable.setCreatedBy(account.getUsername());
updateable.setCreatedOn(new Date()); updateable.setCreatedOn(new Date());
@ -74,7 +74,7 @@ public abstract class AbstractController<T> {
@TransactionAttribute(TransactionAttributeType.REQUIRED) @TransactionAttribute(TransactionAttributeType.REQUIRED)
@Transactional @Transactional
@Lock(LockType.WRITE) @Lock(LockType.WRITE)
public void create(T entity) { public void create(T entity) throws ControllerException {
if (Updateable.class.isAssignableFrom(entity.getClass())) { if (Updateable.class.isAssignableFrom(entity.getClass())) {
Updateable updateable = (Updateable) entity; Updateable updateable = (Updateable) entity;
applyUpdateableChanges(updateable, true); applyUpdateableChanges(updateable, true);
@ -85,7 +85,7 @@ public abstract class AbstractController<T> {
@TransactionAttribute(TransactionAttributeType.REQUIRED) @TransactionAttribute(TransactionAttributeType.REQUIRED)
@Transactional @Transactional
@Lock(LockType.WRITE) @Lock(LockType.WRITE)
public T update(T entity) { public T update(T entity) throws ControllerException {
if (Updateable.class.isAssignableFrom(entity.getClass())) { if (Updateable.class.isAssignableFrom(entity.getClass())) {
Updateable updateable = (Updateable) entity; Updateable updateable = (Updateable) entity;
applyUpdateableChanges(updateable, false); applyUpdateableChanges(updateable, false);
@ -125,7 +125,7 @@ public abstract class AbstractController<T> {
} }
/** /**
* returnns null, if the list is empty or null itself. Returns the one * returns null, if the list is empty or null itself. Returns the one
* element if there is exactly one element in the list. Otherwise an * element if there is exactly one element in the list. Otherwise an
* exception is thrown * exception is thrown
* *