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());
}
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);
}
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;
}
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;
}
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;
}
Aggregations