[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) {
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();