use of com.axelor.apps.bpm.db.WkfDmnModel in project axelor-open-suite by axelor.
the class WkfDmnModelController method importDmnTable.
@SuppressWarnings("rawtypes")
public void importDmnTable(ActionRequest request, ActionResponse response) {
try {
MetaFile dataFile = Beans.get(MetaFileRepository.class).find(Long.parseLong(((Map) request.getContext().get("dataFile")).get("id").toString()));
Long dmnModelId = Long.parseLong(request.getContext().get("_dmnModelId").toString());
WkfDmnModel dmnModel = Beans.get(WkfDmnModelRepository.class).find(dmnModelId);
Beans.get(DmnImportService.class).importDmnTable(dataFile, dmnModel);
response.setCanClose(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.bpm.db.WkfDmnModel in project axelor-open-suite by axelor.
the class WkfDmnModelController method deploy.
public void deploy(ActionRequest request, ActionResponse response) {
WkfDmnModel dmnModel = request.getContext().asType(WkfDmnModel.class);
dmnModel = Beans.get(WkfDmnModelRepository.class).find(dmnModel.getId());
Beans.get(DmnDeploymentService.class).deploy(dmnModel);
response.setReload(true);
}
use of com.axelor.apps.bpm.db.WkfDmnModel in project axelor-open-suite by axelor.
the class WkfDmnModelController method exportDmnTable.
public void exportDmnTable(ActionRequest request, ActionResponse response) {
try {
WkfDmnModel dmnModel = request.getContext().asType(WkfDmnModel.class);
dmnModel = Beans.get(WkfDmnModelRepository.class).find(dmnModel.getId());
File file = Beans.get(DmnExportService.class).exportDmnTable(dmnModel);
FileInputStream inStream = new FileInputStream(file);
MetaFile exportFile = Beans.get(MetaFiles.class).upload(inStream, dmnModel.getName() + ".xlsx");
inStream.close();
file.delete();
if (exportFile != null) {
response.setView(ActionView.define(I18n.get("Export file")).model(WkfDmnModel.class.getName()).add("html", "ws/rest/com.axelor.meta.db.MetaFile/" + exportFile.getId() + "/content/download?v=" + exportFile.getVersion()).param("download", "true").map());
}
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
Aggregations