Search in sources :

Example 6 with WkfModel

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

the class WkfModelController method createNewVersion.

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

Example 7 with WkfModel

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

the class WkfModelController method deploy.

@SuppressWarnings("unchecked")
public void deploy(ActionRequest request, ActionResponse response) {
    Context context = request.getContext();
    WkfModel wkfModel = context.asType(WkfModel.class);
    Map<String, Map<String, String>> migrationMap = (Map<String, Map<String, String>>) context.get("wkfMigrationMap");
    Boolean isMigrateOld = (Boolean) context.get("isMigrateOld");
    if (isMigrateOld != null && !isMigrateOld) {
        migrationMap = null;
    }
    wkfModel = wkfModelRepository.find(wkfModel.getId());
    Beans.get(BpmDeploymentService.class).deploy(wkfModel, migrationMap);
    response.setReload(true);
}
Also used : Context(com.axelor.rpc.Context) WkfModel(com.axelor.apps.bpm.db.WkfModel) BpmDeploymentService(com.axelor.apps.bpm.service.deployment.BpmDeploymentService) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 8 with WkfModel

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

the class WkfModelServiceImpl method findVersions.

@Override
public List<Long> findVersions(WkfModel wkfModel) {
    List<Long> wkfModelIds = new ArrayList<Long>();
    WkfModel previousModel = wkfModel.getPreviousVersion();
    while (previousModel != null) {
        wkfModelIds.add(previousModel.getId());
        previousModel = previousModel.getPreviousVersion();
    }
    return wkfModelIds;
}
Also used : WkfModel(com.axelor.apps.bpm.db.WkfModel) ArrayList(java.util.ArrayList)

Example 9 with WkfModel

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

the class BpmWkfModelRepository method copy.

@Override
public WkfModel copy(WkfModel entity, boolean deep) {
    WkfModel copyModel = super.copy(entity, deep);
    copyModel.setWkfProcessList(null);
    copyModel.setWkfTaskConfigList(null);
    copyModel.setStatusSelect(WkfModelRepository.STATUS_NEW);
    return copyModel;
}
Also used : WkfModel(com.axelor.apps.bpm.db.WkfModel)

Example 10 with WkfModel

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

the class BpmDashboardServiceImpl method getWkfModelsByUser.

private List<WkfModel> getWkfModelsByUser(User user) {
    List<WkfModel> wkfModelList = wkfModelRepo.all().order("code").fetch();
    List<WkfModel> filterWkfModels = new ArrayList<>();
    for (WkfModel wkfModel : wkfModelList) {
        List<WkfProcess> processes = wkfModelService.getProcesses(wkfModel);
        if (CollectionUtils.isEmpty(processes)) {
            continue;
        }
        boolean isSuperAdmin = user.getCode().equals("admin");
        boolean isAdmin = wkfModelController.isAdmin(wkfModel, user);
        boolean isManager = wkfModelController.isManager(wkfModel, user);
        boolean isUser = wkfModelController.isUser(wkfModel, user);
        if (!isSuperAdmin && !isAdmin && !isManager && !isUser) {
            continue;
        }
        filterWkfModels.add(wkfModel);
    }
    return filterWkfModels;
}
Also used : WkfProcess(com.axelor.apps.bpm.db.WkfProcess) WkfModel(com.axelor.apps.bpm.db.WkfModel) ArrayList(java.util.ArrayList)

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