/** * Saves a settings section of a bundle. * * @param bundleId the id of the bundle * @param bundleSettings the settings section to be saved * @throws IOException if there was a problem reading the settings (if the config mode is FILE) */ @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/settings/{bundleId}", method = RequestMethod.POST) public void saveBundleSettings(@PathVariable long bundleId, @RequestBody Settings bundleSettings) throws IOException { settingsService.saveBundleSettings(bundleSettings, bundleId); statusMessageService.info("{admin.settings.saved.bundle}", ADMIN_MODULE_NAME); }
/** * Handles adding a new configuration location to the system. * * @param location the location to be added * @throws IOException if we were unable to add the location */ @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/settings/platform/location", method = RequestMethod.POST) public void uploadSettingsLocation(@RequestParam(required = true) String location) throws IOException { settingsService.addSettingsPath(location); statusMessageService.info("{settings.saved.location}", ADMIN_MODULE_NAME); }
/** * Handles an upload of a raw configuration file for a bundle. * * @param bundleId the id of the bundle which registers this file * @param filename the name of the file * @param file the representation of the file being uploaded */ @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/settings/{bundleId}/raw", method = RequestMethod.POST) void uploadRawFile( @PathVariable long bundleId, @RequestParam(required = true) String filename, @RequestParam(required = true) MultipartFile file) { settingsService.saveRawFile(file, filename, bundleId); statusMessageService.info("{admin.settings.saved.file}", ADMIN_MODULE_NAME); }
/** * Saves a particular section of the platform settings. * * @param platformSettings the platform settings section to be saved * @throws IOException if there was a problem reading the settings (if the config mode is FILE) */ @RequestMapping(value = "/settings/platform", method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) public void savePlatformSettings(@RequestBody Settings platformSettings) throws IOException { settingsService.savePlatformSettings(platformSettings); statusMessageService.info(PLATFORM_SETTINGS_SAVED, ADMIN_MODULE_NAME); }
/** * Saves all platform settings. * * @param platformSettings an array of {@link org.motechproject.admin.settings.Settings} objects * representing sections of the platform settings */ @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/settings/platform/list", method = RequestMethod.POST) public void savePlatformSettings(@RequestBody Settings[] platformSettings) { settingsService.savePlatformSettings(Arrays.asList(platformSettings)); statusMessageService.info("{admin.settings.saved.bundle}", ADMIN_MODULE_NAME); }
/** * Handles platform settings update through file upload. * * @param settingsFile the representation of the file being uploaded */ @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/settings/platform/upload", method = RequestMethod.POST) public void uploadSettingsFile(@RequestParam(required = true) MultipartFile settingsFile) { settingsService.saveSettingsFile(settingsFile); statusMessageService.info(PLATFORM_SETTINGS_SAVED, ADMIN_MODULE_NAME); }