Search in sources :

Example 1 with WkfDmnModel

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);
    }
}
Also used : MetaFileRepository(com.axelor.meta.db.repo.MetaFileRepository) WkfDmnModelRepository(com.axelor.apps.bpm.db.repo.WkfDmnModelRepository) DmnImportService(com.axelor.apps.dmn.service.DmnImportService) WkfDmnModel(com.axelor.apps.bpm.db.WkfDmnModel) MetaFile(com.axelor.meta.db.MetaFile) AxelorException(com.axelor.exception.AxelorException)

Example 2 with WkfDmnModel

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);
}
Also used : DmnDeploymentService(com.axelor.apps.dmn.service.DmnDeploymentService) WkfDmnModel(com.axelor.apps.bpm.db.WkfDmnModel)

Example 3 with WkfDmnModel

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);
    }
}
Also used : MetaFiles(com.axelor.meta.MetaFiles) WkfDmnModel(com.axelor.apps.bpm.db.WkfDmnModel) MetaFile(com.axelor.meta.db.MetaFile) File(java.io.File) MetaFile(com.axelor.meta.db.MetaFile) DmnExportService(com.axelor.apps.dmn.service.DmnExportService) FileInputStream(java.io.FileInputStream) AxelorException(com.axelor.exception.AxelorException)

Aggregations

WkfDmnModel (com.axelor.apps.bpm.db.WkfDmnModel)3 AxelorException (com.axelor.exception.AxelorException)2 MetaFile (com.axelor.meta.db.MetaFile)2 WkfDmnModelRepository (com.axelor.apps.bpm.db.repo.WkfDmnModelRepository)1 DmnDeploymentService (com.axelor.apps.dmn.service.DmnDeploymentService)1 DmnExportService (com.axelor.apps.dmn.service.DmnExportService)1 DmnImportService (com.axelor.apps.dmn.service.DmnImportService)1 MetaFiles (com.axelor.meta.MetaFiles)1 MetaFileRepository (com.axelor.meta.db.repo.MetaFileRepository)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1