[Minor] Always allow to execute Release actions

This commit is contained in:
Robert von Burg 2021-09-28 16:55:12 +02:00
parent e4a4c3bf36
commit eab14c2839
1 changed files with 4 additions and 7 deletions

View File

@ -35,11 +35,9 @@ public class ReservationExecution extends DurationExecution {
public boolean isExecutable(Action action) { public boolean isExecutable(Action action) {
switch (action.getType()) { switch (action.getType()) {
case TYPE_RESERVE: case TYPE_RESERVE:
return !isReserved(tx(), action);
case TYPE_RELEASE: case TYPE_RELEASE:
if (action.getType().equals(TYPE_RESERVE)) return true;
return !isReserved(tx(), action);
return isReserved(tx(), action);
default: default:
return super.isExecutable(action); return super.isExecutable(action);
} }
@ -80,9 +78,8 @@ public class ReservationExecution extends DurationExecution {
Resource resource = tx.getResourceFor(action, true); Resource resource = tx.getResourceFor(action, true);
if (!resource.hasParameter(BAG_PARAMETERS, PARAM_RESERVED)) if (!resource.hasParameter(BAG_PARAMETERS, PARAM_RESERVED))
throw new StrolchModelException( throw new StrolchModelException("Parameter " + PARAM_RESERVED + " on bag " + BAG_PARAMETERS + " missing on "
"Parameter " + PARAM_RESERVED + " on bag " + BAG_PARAMETERS + " missing on " + resource + resource.getLocator());
.getLocator());
BooleanParameter reservedP = resource.getParameter(BAG_PARAMETERS, PARAM_RESERVED); BooleanParameter reservedP = resource.getParameter(BAG_PARAMETERS, PARAM_RESERVED);
return reservedP.getValue(); return reservedP.getValue();