throw Exception when modify repo-role type

This commit is contained in:
Eduard Heimbuch
2019-05-10 13:23:01 +02:00
parent a26f86d545
commit 7fa2898420

View File

@@ -7,6 +7,8 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import static sonia.scm.ScmConstraintViolationException.Builder.doThrow;
public class ManagerDaoAdapter<T extends ModelObject> {
private final GenericDAO<T> dao;
@@ -19,6 +21,9 @@ public class ManagerDaoAdapter<T extends ModelObject> {
T notModified = dao.get(object.getId());
if (notModified != null) {
permissionCheck.apply(notModified).check();
doThrow().violation("type must not be changed").when(!notModified.getType().equals(object.getType()));
AssertUtil.assertIsValid(object);
beforeUpdate.handle(notModified);