Skip to content

Commit 0fd2a53

Browse files
committed
chore: align urls
Some URLs were not consistent, for example "score-analysis".
1 parent 42878b9 commit 0fd2a53

File tree

64 files changed

+116
-131
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+116
-131
lines changed

java/bed-allocation/src/main/java/org/acme/bedallocation/rest/BedSchedulingResource.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ public String solve(BedPlan problem) {
108108
description = "Resulting score analysis, optionally without constraint matches.",
109109
content = @Content(mediaType = MediaType.APPLICATION_JSON,
110110
schema = @Schema(implementation = ScoreAnalysis.class))) })
111-
@PUT
111+
@POST
112112
@Consumes({ MediaType.APPLICATION_JSON })
113113
@Produces(MediaType.APPLICATION_JSON)
114-
@Path("analyze")
114+
@Path("score-analysis")
115115
public ScoreAnalysis<HardSoftScore> analyze(BedPlan problem,
116116
@QueryParam("fetchPolicy") ScoreAnalysisFetchPolicy fetchPolicy) {
117117
return fetchPolicy == null ? solutionManager.analyze(problem) : solutionManager.analyze(problem, fetchPolicy);

java/bed-allocation/src/main/resources/META-INF/resources/app.js

+1-14
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ function analyze() {
250250
scoreAnalysisModalContent.text("No score to analyze yet, please first press the 'solve' button.");
251251
} else {
252252
$('#scoreAnalysisScoreLabel').text(`(${loadedSchedule.score})`);
253-
$.put("/schedules/analyze", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
253+
$.post("/schedules/score-analysis", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
254254
let constraints = scoreAnalysis.constraints;
255255
constraints.sort((a, b) => {
256256
let aComponents = getScoreComponents(a.score), bComponents = getScoreComponents(b.score);
@@ -316,19 +316,6 @@ function analyze() {
316316
}
317317
}
318318

319-
function publish() {
320-
$("#publishButton").hide();
321-
$("#publishLoadingButton").show();
322-
$.put(`/schedules/${scheduleId}/publish`, function (schedule) {
323-
loadedSchedule = schedule;
324-
renderSchedule(schedule);
325-
})
326-
.fail(function (xhr, ajaxOptions, thrownError) {
327-
showError("Publish failed.", xhr);
328-
refreshSolvingButtons(false);
329-
});
330-
}
331-
332319
function getScoreComponents(score) {
333320
let components = {hard: 0, medium: 0, soft: 0};
334321

java/bed-allocation/src/test/java/org/acme/bedallocation/rest/BedSchedulingResourceTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void analyze() {
8383
.body(solution)
8484
.expect().contentType(ContentType.JSON)
8585
.when()
86-
.put("/schedules/analyze")
86+
.post("/schedules/score-analysis")
8787
.then()
8888
.extract()
8989
.asString();
@@ -96,7 +96,7 @@ void analyze() {
9696
.body(solution)
9797
.expect().contentType(ContentType.JSON)
9898
.when()
99-
.put("/schedules/analyze")
99+
.post("/schedules/score-analysis")
100100
.then()
101101
.extract()
102102
.asString();

java/conference-scheduling/src/main/java/org/acme/conferencescheduling/rest/ConferenceSchedulingResource.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ public String solve(ConferenceSchedule problem) {
108108
description = "Resulting score analysis, optionally without constraint matches.",
109109
content = @Content(mediaType = MediaType.APPLICATION_JSON,
110110
schema = @Schema(implementation = ScoreAnalysis.class))) })
111-
@PUT
111+
@POST
112112
@Consumes({ MediaType.APPLICATION_JSON })
113113
@Produces(MediaType.APPLICATION_JSON)
114-
@Path("analyze")
114+
@Path("score-analysis")
115115
public ScoreAnalysis<HardSoftScore> analyze(ConferenceSchedule problem,
116116
@QueryParam("fetchPolicy") ScoreAnalysisFetchPolicy fetchPolicy) {
117117
return fetchPolicy == null ? solutionManager.analyze(problem) : solutionManager.analyze(problem, fetchPolicy);

java/conference-scheduling/src/main/resources/META-INF/resources/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ function analyze() {
332332
scoreAnalysisModalContent.text("No score to analyze yet, please first press the 'solve' button.");
333333
} else {
334334
$('#scoreAnalysisScoreLabel').text(`(${loadedSchedule.score})`);
335-
$.put("/schedules/analyze", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
335+
$.post("/schedules/score-analysis", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
336336
let constraints = scoreAnalysis.constraints;
337337
constraints.sort((a, b) => {
338338
let aComponents = getScoreComponents(a.score), bComponents = getScoreComponents(b.score);

java/conference-scheduling/src/test/java/org/acme/conferencescheduling/rest/ConferenceScheduleResourceTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void analyze() {
8383
.body(solution)
8484
.expect().contentType(ContentType.JSON)
8585
.when()
86-
.put("/schedules/analyze")
86+
.post("/schedules/score-analysis")
8787
.then()
8888
.extract()
8989
.asString();
@@ -96,7 +96,7 @@ void analyze() {
9696
.body(solution)
9797
.expect().contentType(ContentType.JSON)
9898
.when()
99-
.put("/schedules/analyze")
99+
.post("/schedules/score-analysis")
100100
.then()
101101
.extract()
102102
.asString();

java/employee-scheduling/src/main/java/org/acme/employeescheduling/rest/EmployeeScheduleResource.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ public String solve(EmployeeSchedule problem) {
9898
description = "Resulting score analysis, optionally without constraint matches.",
9999
content = @Content(mediaType = MediaType.APPLICATION_JSON,
100100
schema = @Schema(implementation = ScoreAnalysis.class))) })
101-
@PUT
101+
@POST
102102
@Consumes({ MediaType.APPLICATION_JSON })
103103
@Produces(MediaType.APPLICATION_JSON)
104-
@Path("analyze")
104+
@Path("score-analysis")
105105
public ScoreAnalysis<HardSoftBigDecimalScore> analyze(EmployeeSchedule problem,
106106
@QueryParam("fetchPolicy") ScoreAnalysisFetchPolicy fetchPolicy) {
107107
return fetchPolicy == null ? solutionManager.analyze(problem) : solutionManager.analyze(problem, fetchPolicy);

java/employee-scheduling/src/main/resources/META-INF/resources/app.js

+1-18
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ function analyze() {
319319
scoreAnalysisModalContent.text("No score to analyze yet, please first press the 'solve' button.");
320320
} else {
321321
$('#scoreAnalysisScoreLabel').text(`(${loadedSchedule.score})`);
322-
$.put("/schedules/analyze", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
322+
$.post("/schedules/score-analysis", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
323323
let constraints = scoreAnalysis.constraints;
324324
constraints.sort((a, b) => {
325325
let aComponents = getScoreComponents(a.score), bComponents = getScoreComponents(b.score);
@@ -412,23 +412,6 @@ function refreshSolvingButtons(solving) {
412412
}
413413
}
414414

415-
function refreshSolvingButtons(solving) {
416-
if (solving) {
417-
$("#solveButton").hide();
418-
$("#stopSolvingButton").show();
419-
if (autoRefreshIntervalId == null) {
420-
autoRefreshIntervalId = setInterval(refreshSchedule, 2000);
421-
}
422-
} else {
423-
$("#solveButton").show();
424-
$("#stopSolvingButton").hide();
425-
if (autoRefreshIntervalId != null) {
426-
clearInterval(autoRefreshIntervalId);
427-
autoRefreshIntervalId = null;
428-
}
429-
}
430-
}
431-
432415
function stopSolving() {
433416
$.delete(`/schedules/${scheduleId}`, function () {
434417
refreshSolvingButtons(false);

java/facility-location/src/main/java/org/acme/facilitylocation/rest/SolverResource.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ public void solve() {
6767
.run());
6868
}
6969

70-
@PUT
70+
@POST
7171
@Consumes({ MediaType.APPLICATION_JSON })
7272
@Produces(MediaType.APPLICATION_JSON)
73-
@Path("analyze")
73+
@Path("score-analysis")
7474
public ScoreAnalysis<HardSoftLongScore> analyze(@QueryParam("fetchPolicy") ScoreAnalysisFetchPolicy fetchPolicy) {
7575
FacilityLocationProblem problem = repository.solution().get();
7676
return fetchPolicy == null ? solutionManager.analyze(problem) : solutionManager.analyze(problem, fetchPolicy);

java/facility-location/src/main/resources/META-INF/resources/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ function analyze() {
178178
scoreAnalysisModalContent.text("No score to analyze yet, please first press the 'solve' button.");
179179
} else {
180180
$('#scoreAnalysisScoreLabel').text(`(${loadedSchedule.score})`);
181-
$.put("/flp/analyze", function (scoreAnalysis) {
181+
$.post("/flp/score-analysis", function (scoreAnalysis) {
182182
let constraints = scoreAnalysis.constraints;
183183
constraints.sort((a, b) => {
184184
let aComponents = getScoreComponents(a.score), bComponents = getScoreComponents(b.score);

java/flight-crew-scheduling/src/main/java/org/acme/flighcrewscheduling/rest/FlightCrewSchedulingResource.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ public String solve(FlightCrewSchedule problem) {
108108
description = "Resulting score analysis, optionally without constraint matches.",
109109
content = @Content(mediaType = MediaType.APPLICATION_JSON,
110110
schema = @Schema(implementation = ScoreAnalysis.class))) })
111-
@PUT
111+
@POST
112112
@Consumes({ MediaType.APPLICATION_JSON })
113113
@Produces(MediaType.APPLICATION_JSON)
114-
@Path("analyze")
114+
@Path("score-analysis")
115115
public ScoreAnalysis<HardSoftScore> analyze(FlightCrewSchedule problem,
116116
@QueryParam("fetchPolicy") ScoreAnalysisFetchPolicy fetchPolicy) {
117117
return fetchPolicy == null ? solutionManager.analyze(problem) : solutionManager.analyze(problem, fetchPolicy);

java/flight-crew-scheduling/src/main/resources/META-INF/resources/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ function analyze() {
269269
scoreAnalysisModalContent.text("No score to analyze yet, please first press the 'solve' button.");
270270
} else {
271271
$('#scoreAnalysisScoreLabel').text(`(${loadedSchedule.score})`);
272-
$.put("/schedules/analyze", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
272+
$.post("/schedules/score-analysis", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
273273
let constraints = scoreAnalysis.constraints;
274274
constraints.sort((a, b) => {
275275
let aComponents = getScoreComponents(a.score), bComponents = getScoreComponents(b.score);

java/flight-crew-scheduling/src/test/java/org/acme/flighcrewscheduling/rest/FlightCrewSchedulingResourceTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void analyze() {
8484
.body(solution)
8585
.expect().contentType(ContentType.JSON)
8686
.when()
87-
.put("/schedules/analyze")
87+
.post("/schedules/score-analysis")
8888
.then()
8989
.extract()
9090
.asString();
@@ -97,7 +97,7 @@ void analyze() {
9797
.body(solution)
9898
.expect().contentType(ContentType.JSON)
9999
.when()
100-
.put("/schedules/analyze")
100+
.post("/schedules/score-analysis")
101101
.then()
102102
.extract()
103103
.asString();

java/food-packaging/src/main/java/org/acme/foodpackaging/rest/PackagingScheduleResource.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import jakarta.inject.Inject;
44
import jakarta.ws.rs.Consumes;
5+
import jakarta.ws.rs.DELETE;
56
import jakarta.ws.rs.GET;
67
import jakarta.ws.rs.POST;
78
import jakarta.ws.rs.PUT;
@@ -60,17 +61,16 @@ public void solve() {
6061
.run();
6162
}
6263

63-
@PUT
64+
@POST
6465
@Consumes({ MediaType.APPLICATION_JSON })
6566
@Produces(MediaType.APPLICATION_JSON)
66-
@Path("analyze")
67+
@Path("score-analysis")
6768
public ScoreAnalysis<HardMediumSoftLongScore> analyze(@QueryParam("fetchPolicy") ScoreAnalysisFetchPolicy fetchPolicy) {
6869
PackagingSchedule problem = repository.read();
6970
return fetchPolicy == null ? solutionManager.analyze(problem) : solutionManager.analyze(problem, fetchPolicy);
7071
}
7172

72-
@POST
73-
@Path("stopSolving")
73+
@DELETE
7474
public void stopSolving() {
7575
solverManager.terminateEarly(SINGLETON_SOLUTION_ID);
7676
}

java/food-packaging/src/main/resources/META-INF/resources/app.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ function analyze() {
199199
scoreAnalysisModalContent.text("No score to analyze yet, please first press the 'solve' button.");
200200
} else {
201201
$('#scoreAnalysisScoreLabel').text(`(${loadedSchedule.score})`);
202-
$.put("/schedule/analyze", function (scoreAnalysis) {
202+
$.post("/schedule/score-analysis", function (scoreAnalysis) {
203203
let constraints = scoreAnalysis.constraints;
204204
constraints.sort((a, b) => {
205205
let aComponents = getScoreComponents(a.score), bComponents = getScoreComponents(b.score);
@@ -293,7 +293,7 @@ function refreshSolvingButtons(solving) {
293293
}
294294

295295
function stopSolving() {
296-
$.post("/schedule/stopSolving", function () {
296+
$.delete("/schedule", function () {
297297
refreshSolvingButtons(false);
298298
refreshSchedule();
299299
}).fail(function (xhr, ajaxOptions, thrownError) {

java/maintenance-scheduling/src/main/java/org/acme/maintenancescheduling/rest/MaintenanceScheduleResource.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ public String solve(MaintenanceSchedule problem) {
9898
description = "Resulting score analysis, optionally without constraint matches.",
9999
content = @Content(mediaType = MediaType.APPLICATION_JSON,
100100
schema = @Schema(implementation = ScoreAnalysis.class))) })
101-
@PUT
101+
@POST
102102
@Consumes({ MediaType.APPLICATION_JSON })
103103
@Produces(MediaType.APPLICATION_JSON)
104-
@Path("analyze")
104+
@Path("score-analysis")
105105
public ScoreAnalysis<HardSoftScore> analyze(MaintenanceSchedule problem,
106106
@QueryParam("fetchPolicy") ScoreAnalysisFetchPolicy fetchPolicy) {
107107
return fetchPolicy == null ? solutionManager.analyze(problem) : solutionManager.analyze(problem, fetchPolicy);

java/maintenance-scheduling/src/main/resources/META-INF/resources/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ function analyze() {
251251
scoreAnalysisModalContent.text("No score to analyze yet, please first press the 'solve' button.");
252252
} else {
253253
$('#scoreAnalysisScoreLabel').text(`(${loadedSchedule.score})`);
254-
$.put("/schedules/analyze", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
254+
$.post("/schedules/score-analysis", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
255255
let constraints = scoreAnalysis.constraints;
256256
constraints.sort((a, b) => {
257257
let aComponents = getScoreComponents(a.score), bComponents = getScoreComponents(b.score);

java/meeting-scheduling/src/main/java/org/acme/meetingschedule/rest/MeetingSchedulingResource.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ public String solve(MeetingSchedule problem) {
108108
description = "Resulting score analysis, optionally without constraint matches.",
109109
content = @Content(mediaType = MediaType.APPLICATION_JSON,
110110
schema = @Schema(implementation = ScoreAnalysis.class))) })
111-
@PUT
111+
@POST
112112
@Consumes({ MediaType.APPLICATION_JSON })
113113
@Produces(MediaType.APPLICATION_JSON)
114-
@Path("analyze")
114+
@Path("score-analysis")
115115
public ScoreAnalysis<HardSoftScore> analyze(MeetingSchedule problem,
116116
@QueryParam("fetchPolicy") ScoreAnalysisFetchPolicy fetchPolicy) {
117117
return fetchPolicy == null ? solutionManager.analyze(problem) : solutionManager.analyze(problem, fetchPolicy);

java/meeting-scheduling/src/main/resources/META-INF/resources/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ function analyze() {
248248
scoreAnalysisModalContent.text("No score to analyze yet, please first press the 'solve' button.");
249249
} else {
250250
$('#scoreAnalysisScoreLabel').text(`(${loadedSchedule.score})`);
251-
$.put("/schedules/analyze", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
251+
$.post("/schedules/score-analysis", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
252252
let constraints = scoreAnalysis.constraints;
253253
constraints.sort((a, b) => {
254254
let aComponents = getScoreComponents(a.score), bComponents = getScoreComponents(b.score);

java/meeting-scheduling/src/test/java/org/acme/meetscheduling/rest/MeetingSchedulingResourceTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void analyze() {
8484
.body(solution)
8585
.expect().contentType(ContentType.JSON)
8686
.when()
87-
.put("/schedules/analyze")
87+
.post("/schedules/score-analysis")
8888
.then()
8989
.extract()
9090
.asString();
@@ -97,7 +97,7 @@ void analyze() {
9797
.body(solution)
9898
.expect().contentType(ContentType.JSON)
9999
.when()
100-
.put("/schedules/analyze")
100+
.post("/schedules/score-analysis")
101101
.then()
102102
.extract()
103103
.asString();

java/order-picking/src/main/java/org/acme/orderpicking/rest/OrderPickingSolverResource.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import jakarta.enterprise.context.ApplicationScoped;
66
import jakarta.inject.Inject;
77
import jakarta.ws.rs.Consumes;
8+
import jakarta.ws.rs.DELETE;
89
import jakarta.ws.rs.GET;
910
import jakarta.ws.rs.POST;
1011
import jakarta.ws.rs.PUT;
@@ -52,7 +53,6 @@ public OrderPickingPlanning getBestSolution() {
5253
}
5354

5455
@POST
55-
@Path("solve")
5656
public void solve() {
5757
solverWasNeverStarted.set(false);
5858
solverManager.solveBuilder()
@@ -62,17 +62,16 @@ public void solve() {
6262
.run();
6363
}
6464

65-
@PUT
65+
@POST
6666
@Consumes({ MediaType.APPLICATION_JSON })
6767
@Produces(MediaType.APPLICATION_JSON)
68-
@Path("analyze")
68+
@Path("score-analysis")
6969
public ScoreAnalysis<HardSoftLongScore> analyze(@QueryParam("fetchPolicy") ScoreAnalysisFetchPolicy fetchPolicy) {
7070
OrderPickingSolution problem = orderPickingRepository.find();
7171
return fetchPolicy == null ? solutionManager.analyze(problem) : solutionManager.analyze(problem, fetchPolicy);
7272
}
7373

74-
@POST
75-
@Path("stopSolving")
74+
@DELETE
7675
public void stopSolving() {
7776
solverManager.terminateEarly(PROBLEM_ID);
7877
}

java/order-picking/src/main/resources/META-INF/resources/app.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ function refreshSolvingButtons(solving) {
519519
}
520520

521521
function solve() {
522-
$.post("/orderPicking/solve", function () {
522+
$.post("/orderPicking", function () {
523523
refreshSolvingButtons(true);
524524
}).fail(function (xhr, ajaxOptions, thrownError) {
525525
showError("Start solving failed.", xhr);
@@ -534,7 +534,7 @@ function analyze() {
534534
scoreAnalysisModalContent.text("No score to analyze yet, please first press the 'solve' button.");
535535
} else {
536536
$('#scoreAnalysisScoreLabel').text(`(${loadedSchedule.score})`);
537-
$.put("/orderPicking/analyze", function (scoreAnalysis) {
537+
$.post("/orderPicking/score-analysis", function (scoreAnalysis) {
538538
let constraints = Object.values(scoreAnalysis.constraintMap);
539539
constraints.sort((a, b) => {
540540
let aComponents = getScoreComponents(a.score), bComponents = getScoreComponents(b.score);
@@ -607,7 +607,7 @@ function getScoreComponents(score) {
607607
}
608608

609609
function stopSolving() {
610-
$.post("/orderPicking/stopSolving", function () {
610+
$.delete("/orderPicking", function () {
611611
refreshSolvingButtons(false);
612612
refreshSolution();
613613
}).fail(function (xhr, ajaxOptions, thrownError) {

java/order-picking/src/test/java/org/acme/orderpicking/rest/OrderPickingResourceIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class OrderPickingResourceIT {
1818

1919
@Test
2020
void solveNative() {
21-
post("/orderPicking/solve")
21+
post("/orderPicking")
2222
.then()
2323
.statusCode(204)
2424
.extract();

0 commit comments

Comments
 (0)