Search in sources :

Example 16 with WkfModel

use of com.axelor.apps.bpm.db.WkfModel in project axelor-open-suite by axelor.

the class WkfModelController method getDataList.

private List<Map<String, Object>> getDataList(ActionRequest request, String type) {
    if (request.getData().get("id") == null) {
        return new ArrayList<>();
    }
    Long wkfModelId = Long.valueOf(request.getData().get("id").toString());
    WkfModel wkfModel = Beans.get(WkfModelRepository.class).find(wkfModelId);
    switch(type) {
        case PROCESS_PER_STATUS:
            return Beans.get(WkfModelService.class).getProcessPerStatus(wkfModel);
        case PROCESS_PER_USER:
            return Beans.get(WkfModelService.class).getProcessPerUser(wkfModel);
        default:
            return new ArrayList<>();
    }
}
Also used : WkfModelService(com.axelor.apps.bpm.service.WkfModelService) WkfModelRepository(com.axelor.apps.bpm.db.repo.WkfModelRepository) WkfModel(com.axelor.apps.bpm.db.WkfModel) ArrayList(java.util.ArrayList)

Example 17 with WkfModel

use of com.axelor.apps.bpm.db.WkfModel in project axelor-open-suite by axelor.

the class WkfModelController method terminate.

public void terminate(ActionRequest request, ActionResponse response) {
    WkfModel wkfModel = request.getContext().asType(WkfModel.class);
    wkfModel = wkfModelRepository.find(wkfModel.getId());
    wkfModelService.terminate(wkfModel);
    response.setReload(true);
}
Also used : WkfModel(com.axelor.apps.bpm.db.WkfModel)

Aggregations

WkfModel (com.axelor.apps.bpm.db.WkfModel)17 ArrayList (java.util.ArrayList)7 WkfProcess (com.axelor.apps.bpm.db.WkfProcess)4 User (com.axelor.auth.db.User)3 AxelorException (com.axelor.exception.AxelorException)3 Map (java.util.Map)3 WkfProcessConfig (com.axelor.apps.bpm.db.WkfProcessConfig)2 Transactional (com.google.inject.persist.Transactional)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Wizard (com.axelor.apps.base.db.Wizard)1 WkfInstance (com.axelor.apps.bpm.db.WkfInstance)1 WkfTaskConfig (com.axelor.apps.bpm.db.WkfTaskConfig)1 WkfInstanceRepository (com.axelor.apps.bpm.db.repo.WkfInstanceRepository)1 WkfModelRepository (com.axelor.apps.bpm.db.repo.WkfModelRepository)1 WkfTaskConfigRepository (com.axelor.apps.bpm.db.repo.WkfTaskConfigRepository)1 WkfModelService (com.axelor.apps.bpm.service.WkfModelService)1 BpmDeploymentService (com.axelor.apps.bpm.service.deployment.BpmDeploymentService)1 WkfInstanceService (com.axelor.apps.bpm.service.execution.WkfInstanceService)1 ProcessEngineService (com.axelor.apps.bpm.service.init.ProcessEngineService)1