use of org.hisp.dhis.appmanager.AppStatus in project dhis2-core by dhis2.
the class AppController method installApp.
@RequestMapping(method = RequestMethod.POST)
@PreAuthorize("hasRole('ALL') or hasRole('M_dhis-web-app-management')")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void installApp(@RequestParam("file") MultipartFile file) throws IOException, WebMessageException {
File tempFile = File.createTempFile("IMPORT_", "_ZIP");
file.transferTo(tempFile);
AppStatus status = appManager.installApp(tempFile, file.getOriginalFilename());
if (!status.ok()) {
String message = i18nManager.getI18n().getString(status.getMessage());
throw new WebMessageException(WebMessageUtils.conflict(message));
}
}
Aggregations