Skip to content

chore: align urls #720

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ public String solve(BedPlan problem) {
description = "Resulting score analysis, optionally without constraint matches.",
content = @Content(mediaType = MediaType.APPLICATION_JSON,
schema = @Schema(implementation = ScoreAnalysis.class))) })
@PUT
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
@Path("analyze")
@Path("score-analysis")
public ScoreAnalysis<HardSoftScore> analyze(BedPlan problem,
@QueryParam("fetchPolicy") ScoreAnalysisFetchPolicy fetchPolicy) {
return fetchPolicy == null ? solutionManager.analyze(problem) : solutionManager.analyze(problem, fetchPolicy);
Expand Down
15 changes: 1 addition & 14 deletions java/bed-allocation/src/main/resources/META-INF/resources/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ function analyze() {
scoreAnalysisModalContent.text("No score to analyze yet, please first press the 'solve' button.");
} else {
$('#scoreAnalysisScoreLabel').text(`(${loadedSchedule.score})`);
$.put("/schedules/analyze", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
$.post("/schedules/score-analysis", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
let constraints = scoreAnalysis.constraints;
constraints.sort((a, b) => {
let aComponents = getScoreComponents(a.score), bComponents = getScoreComponents(b.score);
Expand Down Expand Up @@ -316,19 +316,6 @@ function analyze() {
}
}

function publish() {
$("#publishButton").hide();
$("#publishLoadingButton").show();
$.put(`/schedules/${scheduleId}/publish`, function (schedule) {
loadedSchedule = schedule;
renderSchedule(schedule);
})
.fail(function (xhr, ajaxOptions, thrownError) {
showError("Publish failed.", xhr);
refreshSolvingButtons(false);
});
}

function getScoreComponents(score) {
let components = {hard: 0, medium: 0, soft: 0};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void analyze() {
.body(solution)
.expect().contentType(ContentType.JSON)
.when()
.put("/schedules/analyze")
.post("/schedules/score-analysis")
.then()
.extract()
.asString();
Expand All @@ -96,7 +96,7 @@ void analyze() {
.body(solution)
.expect().contentType(ContentType.JSON)
.when()
.put("/schedules/analyze")
.post("/schedules/score-analysis")
.then()
.extract()
.asString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ public String solve(ConferenceSchedule problem) {
description = "Resulting score analysis, optionally without constraint matches.",
content = @Content(mediaType = MediaType.APPLICATION_JSON,
schema = @Schema(implementation = ScoreAnalysis.class))) })
@PUT
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
@Path("analyze")
@Path("score-analysis")
public ScoreAnalysis<HardSoftScore> analyze(ConferenceSchedule problem,
@QueryParam("fetchPolicy") ScoreAnalysisFetchPolicy fetchPolicy) {
return fetchPolicy == null ? solutionManager.analyze(problem) : solutionManager.analyze(problem, fetchPolicy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ function analyze() {
scoreAnalysisModalContent.text("No score to analyze yet, please first press the 'solve' button.");
} else {
$('#scoreAnalysisScoreLabel').text(`(${loadedSchedule.score})`);
$.put("/schedules/analyze", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
$.post("/schedules/score-analysis", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
let constraints = scoreAnalysis.constraints;
constraints.sort((a, b) => {
let aComponents = getScoreComponents(a.score), bComponents = getScoreComponents(b.score);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void analyze() {
.body(solution)
.expect().contentType(ContentType.JSON)
.when()
.put("/schedules/analyze")
.post("/schedules/score-analysis")
.then()
.extract()
.asString();
Expand All @@ -96,7 +96,7 @@ void analyze() {
.body(solution)
.expect().contentType(ContentType.JSON)
.when()
.put("/schedules/analyze")
.post("/schedules/score-analysis")
.then()
.extract()
.asString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ public String solve(EmployeeSchedule problem) {
description = "Resulting score analysis, optionally without constraint matches.",
content = @Content(mediaType = MediaType.APPLICATION_JSON,
schema = @Schema(implementation = ScoreAnalysis.class))) })
@PUT
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
@Path("analyze")
@Path("score-analysis")
public ScoreAnalysis<HardSoftBigDecimalScore> analyze(EmployeeSchedule problem,
@QueryParam("fetchPolicy") ScoreAnalysisFetchPolicy fetchPolicy) {
return fetchPolicy == null ? solutionManager.analyze(problem) : solutionManager.analyze(problem, fetchPolicy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ function analyze() {
scoreAnalysisModalContent.text("No score to analyze yet, please first press the 'solve' button.");
} else {
$('#scoreAnalysisScoreLabel').text(`(${loadedSchedule.score})`);
$.put("/schedules/analyze", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
$.post("/schedules/score-analysis", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
let constraints = scoreAnalysis.constraints;
constraints.sort((a, b) => {
let aComponents = getScoreComponents(a.score), bComponents = getScoreComponents(b.score);
Expand Down Expand Up @@ -412,23 +412,6 @@ function refreshSolvingButtons(solving) {
}
}

function refreshSolvingButtons(solving) {
if (solving) {
$("#solveButton").hide();
$("#stopSolvingButton").show();
if (autoRefreshIntervalId == null) {
autoRefreshIntervalId = setInterval(refreshSchedule, 2000);
}
} else {
$("#solveButton").show();
$("#stopSolvingButton").hide();
if (autoRefreshIntervalId != null) {
clearInterval(autoRefreshIntervalId);
autoRefreshIntervalId = null;
}
}
}

function stopSolving() {
$.delete(`/schedules/${scheduleId}`, function () {
refreshSolvingButtons(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ public void solve() {
.run());
}

@PUT
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
@Path("analyze")
@Path("score-analysis")
public ScoreAnalysis<HardSoftLongScore> analyze(@QueryParam("fetchPolicy") ScoreAnalysisFetchPolicy fetchPolicy) {
FacilityLocationProblem problem = repository.solution().get();
return fetchPolicy == null ? solutionManager.analyze(problem) : solutionManager.analyze(problem, fetchPolicy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ function analyze() {
scoreAnalysisModalContent.text("No score to analyze yet, please first press the 'solve' button.");
} else {
$('#scoreAnalysisScoreLabel').text(`(${loadedSchedule.score})`);
$.put("/flp/analyze", function (scoreAnalysis) {
$.post("/flp/score-analysis", function (scoreAnalysis) {
let constraints = scoreAnalysis.constraints;
constraints.sort((a, b) => {
let aComponents = getScoreComponents(a.score), bComponents = getScoreComponents(b.score);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ public String solve(FlightCrewSchedule problem) {
description = "Resulting score analysis, optionally without constraint matches.",
content = @Content(mediaType = MediaType.APPLICATION_JSON,
schema = @Schema(implementation = ScoreAnalysis.class))) })
@PUT
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
@Path("analyze")
@Path("score-analysis")
public ScoreAnalysis<HardSoftScore> analyze(FlightCrewSchedule problem,
@QueryParam("fetchPolicy") ScoreAnalysisFetchPolicy fetchPolicy) {
return fetchPolicy == null ? solutionManager.analyze(problem) : solutionManager.analyze(problem, fetchPolicy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ function analyze() {
scoreAnalysisModalContent.text("No score to analyze yet, please first press the 'solve' button.");
} else {
$('#scoreAnalysisScoreLabel').text(`(${loadedSchedule.score})`);
$.put("/schedules/analyze", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
$.post("/schedules/score-analysis", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
let constraints = scoreAnalysis.constraints;
constraints.sort((a, b) => {
let aComponents = getScoreComponents(a.score), bComponents = getScoreComponents(b.score);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void analyze() {
.body(solution)
.expect().contentType(ContentType.JSON)
.when()
.put("/schedules/analyze")
.post("/schedules/score-analysis")
.then()
.extract()
.asString();
Expand All @@ -97,7 +97,7 @@ void analyze() {
.body(solution)
.expect().contentType(ContentType.JSON)
.when()
.put("/schedules/analyze")
.post("/schedules/score-analysis")
.then()
.extract()
.asString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import jakarta.inject.Inject;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.PUT;
Expand Down Expand Up @@ -60,17 +61,16 @@ public void solve() {
.run();
}

@PUT
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
@Path("analyze")
@Path("score-analysis")
public ScoreAnalysis<HardMediumSoftLongScore> analyze(@QueryParam("fetchPolicy") ScoreAnalysisFetchPolicy fetchPolicy) {
PackagingSchedule problem = repository.read();
return fetchPolicy == null ? solutionManager.analyze(problem) : solutionManager.analyze(problem, fetchPolicy);
}

@POST
@Path("stopSolving")
@DELETE
public void stopSolving() {
solverManager.terminateEarly(SINGLETON_SOLUTION_ID);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function analyze() {
scoreAnalysisModalContent.text("No score to analyze yet, please first press the 'solve' button.");
} else {
$('#scoreAnalysisScoreLabel').text(`(${loadedSchedule.score})`);
$.put("/schedule/analyze", function (scoreAnalysis) {
$.post("/schedule/score-analysis", function (scoreAnalysis) {
let constraints = scoreAnalysis.constraints;
constraints.sort((a, b) => {
let aComponents = getScoreComponents(a.score), bComponents = getScoreComponents(b.score);
Expand Down Expand Up @@ -293,7 +293,7 @@ function refreshSolvingButtons(solving) {
}

function stopSolving() {
$.post("/schedule/stopSolving", function () {
$.delete("/schedule", function () {
refreshSolvingButtons(false);
refreshSchedule();
}).fail(function (xhr, ajaxOptions, thrownError) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ public String solve(MaintenanceSchedule problem) {
description = "Resulting score analysis, optionally without constraint matches.",
content = @Content(mediaType = MediaType.APPLICATION_JSON,
schema = @Schema(implementation = ScoreAnalysis.class))) })
@PUT
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
@Path("analyze")
@Path("score-analysis")
public ScoreAnalysis<HardSoftScore> analyze(MaintenanceSchedule problem,
@QueryParam("fetchPolicy") ScoreAnalysisFetchPolicy fetchPolicy) {
return fetchPolicy == null ? solutionManager.analyze(problem) : solutionManager.analyze(problem, fetchPolicy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ function analyze() {
scoreAnalysisModalContent.text("No score to analyze yet, please first press the 'solve' button.");
} else {
$('#scoreAnalysisScoreLabel').text(`(${loadedSchedule.score})`);
$.put("/schedules/analyze", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
$.post("/schedules/score-analysis", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
let constraints = scoreAnalysis.constraints;
constraints.sort((a, b) => {
let aComponents = getScoreComponents(a.score), bComponents = getScoreComponents(b.score);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ public String solve(MeetingSchedule problem) {
description = "Resulting score analysis, optionally without constraint matches.",
content = @Content(mediaType = MediaType.APPLICATION_JSON,
schema = @Schema(implementation = ScoreAnalysis.class))) })
@PUT
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
@Path("analyze")
@Path("score-analysis")
public ScoreAnalysis<HardSoftScore> analyze(MeetingSchedule problem,
@QueryParam("fetchPolicy") ScoreAnalysisFetchPolicy fetchPolicy) {
return fetchPolicy == null ? solutionManager.analyze(problem) : solutionManager.analyze(problem, fetchPolicy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function analyze() {
scoreAnalysisModalContent.text("No score to analyze yet, please first press the 'solve' button.");
} else {
$('#scoreAnalysisScoreLabel').text(`(${loadedSchedule.score})`);
$.put("/schedules/analyze", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
$.post("/schedules/score-analysis", JSON.stringify(loadedSchedule), function (scoreAnalysis) {
let constraints = scoreAnalysis.constraints;
constraints.sort((a, b) => {
let aComponents = getScoreComponents(a.score), bComponents = getScoreComponents(b.score);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void analyze() {
.body(solution)
.expect().contentType(ContentType.JSON)
.when()
.put("/schedules/analyze")
.post("/schedules/score-analysis")
.then()
.extract()
.asString();
Expand All @@ -97,7 +97,7 @@ void analyze() {
.body(solution)
.expect().contentType(ContentType.JSON)
.when()
.put("/schedules/analyze")
.post("/schedules/score-analysis")
.then()
.extract()
.asString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.PUT;
Expand Down Expand Up @@ -52,7 +53,6 @@ public OrderPickingPlanning getBestSolution() {
}

@POST
@Path("solve")
public void solve() {
solverWasNeverStarted.set(false);
solverManager.solveBuilder()
Expand All @@ -62,17 +62,16 @@ public void solve() {
.run();
}

@PUT
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
@Path("analyze")
@Path("score-analysis")
public ScoreAnalysis<HardSoftLongScore> analyze(@QueryParam("fetchPolicy") ScoreAnalysisFetchPolicy fetchPolicy) {
OrderPickingSolution problem = orderPickingRepository.find();
return fetchPolicy == null ? solutionManager.analyze(problem) : solutionManager.analyze(problem, fetchPolicy);
}

@POST
@Path("stopSolving")
@DELETE
public void stopSolving() {
solverManager.terminateEarly(PROBLEM_ID);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ function refreshSolvingButtons(solving) {
}

function solve() {
$.post("/orderPicking/solve", function () {
$.post("/orderPicking", function () {
refreshSolvingButtons(true);
}).fail(function (xhr, ajaxOptions, thrownError) {
showError("Start solving failed.", xhr);
Expand All @@ -534,7 +534,7 @@ function analyze() {
scoreAnalysisModalContent.text("No score to analyze yet, please first press the 'solve' button.");
} else {
$('#scoreAnalysisScoreLabel').text(`(${loadedSchedule.score})`);
$.put("/orderPicking/analyze", function (scoreAnalysis) {
$.post("/orderPicking/score-analysis", function (scoreAnalysis) {
let constraints = Object.values(scoreAnalysis.constraintMap);
constraints.sort((a, b) => {
let aComponents = getScoreComponents(a.score), bComponents = getScoreComponents(b.score);
Expand Down Expand Up @@ -607,7 +607,7 @@ function getScoreComponents(score) {
}

function stopSolving() {
$.post("/orderPicking/stopSolving", function () {
$.delete("/orderPicking", function () {
refreshSolvingButtons(false);
refreshSolution();
}).fail(function (xhr, ajaxOptions, thrownError) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class OrderPickingResourceIT {

@Test
void solveNative() {
post("/orderPicking/solve")
post("/orderPicking")
.then()
.statusCode(204)
.extract();
Expand Down
Loading
Loading