Skip to content

Commit

Permalink
LU-181: Include suffix in controller urls (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
wikumChamith authored Jan 29, 2024
1 parent 356df07 commit f4ffabf
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public class ExportController {
@Autowired
private JsonObjectView jsonView;

@RequestMapping(LIST_PATH)
@RequestMapping(LIST_PATH + ".form")
public void list(Model model) {
List<ExportedPackageSummary> packages = getService().getAllExportedPackageSummaries();
Map<String, ExportedPackageSummary> latestVersion = new HashMap<String, ExportedPackageSummary>();
Expand Down Expand Up @@ -153,7 +153,7 @@ public void list(Model model) {
* Gets all packages with the given group and passes to the model (they will be rendered in .jsp
* page)
*/
@RequestMapping(DETAILS_PATH)
@RequestMapping(DETAILS_PATH + ".form")
public String details(String group, Model model) {
List<ExportedPackageSummary> packages = new ArrayList<ExportedPackageSummary>();
for (ExportedPackageSummary summary : getService().getAllExportedPackageSummaries()) {
Expand All @@ -174,7 +174,7 @@ public String details(String group, Model model) {
}
}

@RequestMapping(DELETE_PATH)
@RequestMapping(DELETE_PATH + ".form")
public String delete(Integer id, Model model) {
ExportedPackage pack = MetadataSharing.getService().getExportedPackageById(id);
if (pack != null) {
Expand Down Expand Up @@ -206,22 +206,22 @@ public String togglePublished(Integer id, Model model) {
}
}

@RequestMapping(DOWNLOAD_PATH)
@RequestMapping(DOWNLOAD_PATH + ".form")
public ModelAndView download(Integer id, Model model) {
ExportedPackage pack = MetadataSharing.getService().getExportedPackageById(id);
model.addAttribute("package", pack);
return new ModelAndView(downloadPackageView);
}

@RequestMapping(value = CREATE_PATH, method = RequestMethod.GET)
@RequestMapping(value = CREATE_PATH + ".form", method = RequestMethod.GET)
public void create(Model model) {
if (!model.containsAttribute(EXPORTER)) {
model.addAttribute(EXPORTER, MetadataSharing.getInstance().newPackageExporter());
}
model.addAttribute("publishConfigured", MetadataSharing.getInstance().isPublishConfigured());
}

@RequestMapping(value = UPGRADE_PATH)
@RequestMapping(value = UPGRADE_PATH + ".form")
public String upgrade(Integer id, Boolean empty, Model model) throws SerializationException, IOException {
ExportedPackage exportedPackage = MetadataSharing.getService().getExportedPackageById(id);
PackageVersioner versioner = null;
Expand Down Expand Up @@ -257,7 +257,7 @@ public String upgrade(Integer id, Boolean empty, Model model) throws Serializati
return WebUtils.redirect(CREATE_PATH);
}

@RequestMapping(value = CREATE_PATH, method = RequestMethod.POST)
@RequestMapping(value = CREATE_PATH + ".form", method = RequestMethod.POST)
public String create(@ModelAttribute(EXPORTER)
PackageExporter exporter, Errors errors, Model model) {
model.addAttribute("publishConfigured", MetadataSharing.getInstance().isPublishConfigured());
Expand All @@ -279,11 +279,11 @@ public String create(@ModelAttribute(EXPORTER)
}
}

@RequestMapping(value = EDIT_PATH)
@RequestMapping(value = EDIT_PATH + ".form")
public void edit() {
}

@RequestMapping(value = ADD_ALL_ITEMS_PATH)
@RequestMapping(value = ADD_ALL_ITEMS_PATH + ".form")
public String addAllItems(@ModelAttribute(PACKAGE_ITEMS)
PackageItems packageItems, String type, Boolean includeRetired) {
if (includeRetired) {
Expand All @@ -302,15 +302,15 @@ public String addAllItems(@ModelAttribute(PACKAGE_ITEMS)
return WebUtils.redirect(EDIT_PATH);
}

@RequestMapping(value = REMOVE_ALL_ITEMS_PATH)
@RequestMapping(value = REMOVE_ALL_ITEMS_PATH + ".form")
public String removeAllItems(@ModelAttribute(PACKAGE_ITEMS)
PackageItems packageItems, String type) {
packageItems.getCompleteTypes().remove(type);
packageItems.getItems().remove(type);
return WebUtils.redirect(EDIT_PATH);
}

@RequestMapping(value = SELECT_ITEMS_PATH, method = RequestMethod.GET)
@RequestMapping(value = SELECT_ITEMS_PATH + ".form", method = RequestMethod.GET)
public void selectItems(@RequestParam(required = false)
String type, Model model) {
if (type == null) {
Expand All @@ -322,7 +322,7 @@ public void selectItems(@RequestParam(required = false)
// Items will be fetched with JSON.
}

@RequestMapping(value = SELECT_ITEMS_PATH, method = RequestMethod.POST)
@RequestMapping(value = SELECT_ITEMS_PATH + ".form", method = RequestMethod.POST)
public String selectItems(@ModelAttribute(PACKAGE_ITEMS)
PackageItems packageItems, String type, HttpServletRequest request) {
String[] addUuids = request.getParameterValues("addUuids");
Expand Down Expand Up @@ -372,7 +372,7 @@ public String selectItems(@ModelAttribute(PACKAGE_ITEMS)
return WebUtils.redirect(EDIT_PATH);
}

@RequestMapping(JSON_ITEMS_PATH)
@RequestMapping(JSON_ITEMS_PATH + ".form`")
public ModelAndView jsonItems(@ModelAttribute(PACKAGE_ITEMS)
PackageItems packageItems, String type, HttpServletRequest httpRequest, Model model) throws IOException {
DatatablesRequest request = DatatablesRequest.parseRequest(httpRequest);
Expand Down Expand Up @@ -421,7 +421,7 @@ public ModelAndView jsonItems(@ModelAttribute(PACKAGE_ITEMS)
return new ModelAndView(jsonView);
}

@RequestMapping(value = COMPLETE_PATH, method = RequestMethod.POST)
@RequestMapping(value = COMPLETE_PATH + ".form", method = RequestMethod.POST)
public String complete(@ModelAttribute(EXPORTER)
PackageExporter exporter, Errors errors, @ModelAttribute(PACKAGE_ITEMS)
PackageItems packageItems, Model model, SessionStatus session) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@ public class ImportController {
@Autowired
private SubscriptionUpdater updater;

@RequestMapping(LIST_PATH)
@RequestMapping(LIST_PATH + ".form")
public void list(Model model) {
model.addAttribute("subscriptions", MetadataSharing.getService().getAllImportedPackages());
}

@RequestMapping(value = TOGGLE_SUBSCRIBE_PATH, method = RequestMethod.GET)
@RequestMapping(value = TOGGLE_SUBSCRIBE_PATH + ".form", method = RequestMethod.GET)
public String toggleSubscribe(Integer id) {
ImportedPackage importedPackage = MetadataSharing.getService().getImportedPackageById(id);
if (importedPackage != null) {
Expand All @@ -172,7 +172,7 @@ public String toggleSubscribe(Integer id) {
return WebUtils.redirect(LIST_PATH);
}

@RequestMapping(value = DELETE_SUBSCRIBE_PATH, method = RequestMethod.GET)
@RequestMapping(value = DELETE_SUBSCRIBE_PATH + ".form", method = RequestMethod.GET)
public String purgeSubscribe(Integer id) {
ImportedPackage importedPackage = MetadataSharing.getService().getImportedPackageById(id);
if (importedPackage != null) {
Expand All @@ -182,7 +182,7 @@ public String purgeSubscribe(Integer id) {
}


@RequestMapping(value = JSON_CHECK_UPDATES_PATH, method = RequestMethod.GET)
@RequestMapping(value = JSON_CHECK_UPDATES_PATH + ".form", method = RequestMethod.GET)
public ModelAndView jsonCheckUpdates(Integer id, ModelMap model) {
ImportedPackage importedPackage = MetadataSharing.getService().getImportedPackageById(id);
if (importedPackage != null && importedPackage.isSubscribed()) {
Expand Down Expand Up @@ -263,12 +263,12 @@ public ModelAndView jsonPerformDownload(@ModelAttribute(DOWNLOADER)
return new ModelAndView(jsonObjectView);
}

@RequestMapping(value = UPLOAD_PATH, method = RequestMethod.GET)
@RequestMapping(value = UPLOAD_PATH + ".form", method = RequestMethod.GET)
public void upload(SessionStatus status) {
status.setComplete();
}

@RequestMapping(value = UPLOAD_PATH, method = RequestMethod.POST)
@RequestMapping(value = UPLOAD_PATH + ".form", method = RequestMethod.POST)
public String uploadPOST(UploadForm uploadForm, Errors errors, Model model) throws IOException {
uploadFormValidator.validate(uploadForm, errors);
if (errors.hasErrors()) {
Expand Down Expand Up @@ -315,13 +315,13 @@ public String uploadPOST(UploadForm uploadForm, Errors errors, Model model) thro
}
}

@RequestMapping(value = VALIDATE_PATH, method = RequestMethod.GET)
@RequestMapping(value = VALIDATE_PATH + ".form", method = RequestMethod.GET)
public void validate(@ModelAttribute(IMPORTER)
PackageImporter importer, Errors errors) throws SerializationException {
packageContainerValidator.validateForErrorsAndWarnings(importer, errors);
}

@RequestMapping(value = VALIDATE_PATH, method = RequestMethod.POST)
@RequestMapping(value = VALIDATE_PATH + ".form", method = RequestMethod.POST)
public String validatePOST(@ModelAttribute(IMPORTER)
PackageImporter importer, Errors errors) {
packageContainerValidator.validate(importer, errors);
Expand All @@ -333,11 +333,11 @@ public String validatePOST(@ModelAttribute(IMPORTER)
}
}

@RequestMapping(value = MODE_PATH, method = RequestMethod.GET)
@RequestMapping(value = MODE_PATH + ".form", method = RequestMethod.GET)
public void mode() {
}

@RequestMapping(value = MODE_PATH, method = RequestMethod.POST)
@RequestMapping(value = MODE_PATH + ".form", method = RequestMethod.POST)
public String modePOST(@ModelAttribute(IMPORTER)
PackageImporter importer, String importMode) {
ImportMode mode = ImportMode.valueOf(importMode);
Expand All @@ -354,12 +354,12 @@ public String modePOST(@ModelAttribute(IMPORTER)
return WebUtils.redirect(CONFIG_PATH);
}

@RequestMapping(value = CONFIG_PATH, method = RequestMethod.GET)
@RequestMapping(value = CONFIG_PATH + ".form", method = RequestMethod.GET)
public void config(@ModelAttribute(IMPORTER)
PackageImporter importer) {
}

@RequestMapping(value = CONFIG_PATH, method = RequestMethod.POST)
@RequestMapping(value = CONFIG_PATH + ".form", method = RequestMethod.POST)
public String configPOST(@ModelAttribute(IMPORTER)
PackageImporter importer, Model model) throws IOException {
ImportedPackage importedPackage = MetadataSharing.getService().getImportedPackageByGroup(
Expand All @@ -380,7 +380,7 @@ public String configPOST(@ModelAttribute(IMPORTER)
return WebUtils.redirect(LOAD_PATH);
}

@RequestMapping(value = LOAD_PATH, params = "part")
@RequestMapping(value = LOAD_PATH + ".form", params = "part")
public String load(@ModelAttribute(IMPORTER)
PackageImporter importer, @ModelAttribute(PARTS)
Map<Integer, Boolean> parts, Integer part, Model model) {
Expand Down Expand Up @@ -412,7 +412,7 @@ public String load(@ModelAttribute(IMPORTER)
}
}

@RequestMapping(LOAD_PATH)
@RequestMapping(LOAD_PATH + ".form")
public String load(@ModelAttribute(IMPORTER)
PackageImporter importer, @ModelAttribute(ITEMS_STATS)
ImportedItemsStats stats, @ModelAttribute(PARTS)
Expand All @@ -429,7 +429,7 @@ public String load(@ModelAttribute(IMPORTER)
return VIEW_PATH;
}

@RequestMapping(VIEW_PATH)
@RequestMapping(VIEW_PATH + ".form")
public void view(@ModelAttribute(IMPORTER)
PackageImporter importer, @ModelAttribute(ITEMS_STATS)
ImportedItemsStats stats, @ModelAttribute(PARTS)
Expand All @@ -444,7 +444,7 @@ public void view(@ModelAttribute(IMPORTER)
model.addAttribute(ITEMS_STATS, itemsStats);
}

@RequestMapping(value = COMPLETE_PATH)
@RequestMapping(value = COMPLETE_PATH + ".form")
public String complete(@ModelAttribute(IMPORTER)
PackageImporter importer, Errors errors, Model model, SessionStatus session) {
Task task = importer.schedulePackageImport();
Expand Down Expand Up @@ -573,7 +573,7 @@ public void assessItem(@ModelAttribute(ITEMS)
model.addAttribute(assessItemForm);
}

@RequestMapping(value = ITEM_PATH, method = RequestMethod.GET, params = "uuid")
@RequestMapping(value = ITEM_PATH + ".form", method = RequestMethod.GET, params = "uuid")
public void assessItem(@ModelAttribute(ITEMS)
List<ImportedItem> items, Integer index, String uuid, Model model) {
ImportedItem importedItem = items.get(index);
Expand All @@ -589,7 +589,7 @@ public void assessItem(@ModelAttribute(ITEMS)
assessItem(items, index, model);
}

@RequestMapping(value = ITEM_PATH, method = RequestMethod.POST)
@RequestMapping(value = ITEM_PATH + ".form", method = RequestMethod.POST)
public String assessItemPOST(@ModelAttribute(ITEMS)
List<ImportedItem> items, AssessItemForm assessItemForm, Model model) {
ImportedItem importedItem = items.get(assessItemForm.getIndex());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class TaskController {
@Autowired
private TaskEngine taskEngine;

@RequestMapping(value = LIST_PATH)
@RequestMapping(value = LIST_PATH + ".form")
public void list(Model model) {
model.addAttribute(TASKS, taskEngine.getTasks());
}
Expand All @@ -56,7 +56,7 @@ public String remove(String uuid, HttpSession session) {
return WebUtils.redirect(LIST_PATH);
}

@RequestMapping(value = DETAILS_PATH)
@RequestMapping(value = DETAILS_PATH + ".form")
public void details(String uuid, Model model) {
Task task = taskEngine.getTask(uuid);
model.addAttribute(TASK, task);
Expand Down

0 comments on commit f4ffabf

Please sign in to comment.