[Minor] Code cleanup in ReservationExecution

This commit is contained in:
Robert von Burg 2023-02-24 14:16:23 +01:00
parent 7280f65ddf
commit 8811b39585
Signed by: eitch
GPG Key ID: 75DB9C85C74331F7
1 changed files with 5 additions and 4 deletions

View File

@ -99,16 +99,17 @@ public class ReservationExecution extends DurationExecution {
}
protected boolean jobCountSemaphoreSatisfied(Action action) {
StringListParameter jobCountSemaphoreTypesP = action.findParameter(BAG_OBJECTIVES,
PARAM_JOB_COUNT_SEMAPHORE_TYPES, false);
StringListParameter jobCountSemaphoreTypesP = action.findObjectivesParam(PARAM_JOB_COUNT_SEMAPHORE_TYPES,
false);
String[] types = jobCountSemaphoreTypesP == null ?
new String[] { action.getRootElement().getType() } :
jobCountSemaphoreTypesP.getValue().toArray(String[]::new);
long nrOfActivitiesInExecution = tx().streamActivities(types).filter(Activity::inExecutionPlanningPhase)
long nrOfActivitiesInExecution = tx().streamActivities(types)
.filter(Activity::inExecutionPlanningPhase)
.count();
IntegerParameter jobCountSemaphoreP = action.findParameter(BAG_OBJECTIVES, PARAM_JOB_COUNT_SEMAPHORE, true);
IntegerParameter jobCountSemaphoreP = action.findObjectivesParam(PARAM_JOB_COUNT_SEMAPHORE, true);
if (nrOfActivitiesInExecution < jobCountSemaphoreP.getValue())
return true;