Skip to content

Commit 4429a35

Browse files
chore: Move last remaining shadow variable to declarative shadow variables
1 parent a85f225 commit 4429a35

File tree

4 files changed

+10
-108
lines changed

4 files changed

+10
-108
lines changed

java/food-packaging/src/main/java/org/acme/foodpackaging/domain/Job.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,7 @@ public class Job {
3838
@InverseRelationShadowVariable(sourceVariableName = "jobs")
3939
private Line line;
4040

41-
// TODO: Replace me when declarative shadow variables support
42-
// non-declarative shadow on non-declarative shadow sources
43-
@ShadowVariable(
44-
variableListenerClass = LineOperatorUpdatingVariableListener.class,
45-
sourceEntityClass = Line.class,
46-
sourceVariableName = "operator")
47-
@ShadowVariable(
48-
variableListenerClass = JobOperatorUpdatingVariableListener.class,
49-
sourceVariableName = "line")
41+
@ShadowVariable(supplierName = "lineOperatorSupplier")
5042
private Operator lineOperator;
5143
@JsonIgnore
5244
@PreviousElementShadowVariable(sourceVariableName = "jobs")
@@ -194,6 +186,14 @@ public void setEndDateTime(LocalDateTime endDateTime) {
194186
// ************************************************************************
195187
// Complex methods
196188
// ************************************************************************
189+
@SuppressWarnings("unused")
190+
@ShadowSources({"line", "line.operator"})
191+
private Operator lineOperatorSupplier() {
192+
if (line == null) {
193+
return null;
194+
}
195+
return line.getOperator();
196+
}
197197

198198
@SuppressWarnings("unused")
199199
@ShadowSources({"line", "previousJob.endDateTime"})

java/food-packaging/src/main/java/org/acme/foodpackaging/domain/JobOperatorUpdatingVariableListener.java

Lines changed: 0 additions & 53 deletions
This file was deleted.

java/food-packaging/src/main/java/org/acme/foodpackaging/domain/LineOperatorUpdatingVariableListener.java

Lines changed: 0 additions & 45 deletions
This file was deleted.

java/maintenance-scheduling/src/main/java/org/acme/maintenancescheduling/domain/MaintenanceSchedule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public MaintenanceSchedule(HardSoftLongScore score, SolverStatus solverStatus) {
5050
public List<LocalDate> createStartDateList() {
5151
return workCalendar.getFromDate().datesUntil(workCalendar.getToDate())
5252
// Skip weekends. Does not work for holidays.
53-
// Keep in sync with EndDateUpdatingVariableListener.updateEndDate().
53+
// Keep in sync with Job.calculateEndDate().
5454
// To skip holidays too, cache all working days in WorkCalendar.
5555
.filter(date -> date.getDayOfWeek() != DayOfWeek.SATURDAY
5656
&& date.getDayOfWeek() != DayOfWeek.SUNDAY)

0 commit comments

Comments
 (0)