From eab14c2839bb45e947ed2b560de795ce9af2f7e8 Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Tue, 28 Sep 2021 16:55:12 +0200 Subject: [PATCH] [Minor] Always allow to execute Release actions --- .../execution/policy/ReservationExecution.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/li.strolch.service/src/main/java/li/strolch/execution/policy/ReservationExecution.java b/li.strolch.service/src/main/java/li/strolch/execution/policy/ReservationExecution.java index 9d661d4fe..3acda5859 100644 --- a/li.strolch.service/src/main/java/li/strolch/execution/policy/ReservationExecution.java +++ b/li.strolch.service/src/main/java/li/strolch/execution/policy/ReservationExecution.java @@ -35,11 +35,9 @@ public class ReservationExecution extends DurationExecution { public boolean isExecutable(Action action) { switch (action.getType()) { case TYPE_RESERVE: + return !isReserved(tx(), action); case TYPE_RELEASE: - if (action.getType().equals(TYPE_RESERVE)) - return !isReserved(tx(), action); - return isReserved(tx(), action); - + return true; default: return super.isExecutable(action); } @@ -80,9 +78,8 @@ public class ReservationExecution extends DurationExecution { Resource resource = tx.getResourceFor(action, true); if (!resource.hasParameter(BAG_PARAMETERS, PARAM_RESERVED)) - throw new StrolchModelException( - "Parameter " + PARAM_RESERVED + " on bag " + BAG_PARAMETERS + " missing on " + resource - .getLocator()); + throw new StrolchModelException("Parameter " + PARAM_RESERVED + " on bag " + BAG_PARAMETERS + " missing on " + + resource.getLocator()); BooleanParameter reservedP = resource.getParameter(BAG_PARAMETERS, PARAM_RESERVED); return reservedP.getValue();