public void init() { List<ProcessInstanceBOInfo> infoes = processInstanceBOService.getAllNormalProcessInstanceBOInfo(); if (infoes != null && infoes.size() > 0) { for (ProcessInstanceBOInfo info : infoes) { put(info.getProcessId(), info.getBusinessId(), info.getProcessInstanceId()); } } }
public String getBusinessId(Long processInstanceId) { String businessId = businessIdCache.get(processInstanceId); if (businessId == null) { synchronized (ProcessInstanceBOCache.class) { if (businessId == null) { logger.info("fetch from database"); ProcessInstanceBOInfo info = processInstanceBOService.getProcessInstanceBOInfo(processInstanceId); businessId = info != null ? info.getBusinessId() : null; if (businessId != null) { put(info.getProcessId(), businessId, processInstanceId); } } } } return businessId; }
public Long getProcessInstanceId(String processId, String businessId) { Long value = processInstanceIdCache.get(processId + "_" + businessId); if (value == null) { synchronized (ProcessInstanceBOCache.class) { if (value == null) { logger.info("fetch from database"); ProcessInstanceBOInfo info = processInstanceBOService.getProcessInstanceBOInfo(processId, businessId); value = info != null ? info.getProcessInstanceId() : null; if (value != null) { put(processId, businessId, value); } } } } return value; }
public void putAndSave(String processId, String businessId, Long processInstanceId) { ProcessInstanceBOInfo info = new ProcessInstanceBOInfo(); info.setBusinessId(businessId); info.setProcessId(processId); info.setProcessInstanceId(processInstanceId); info.setCreateTime(new Date()); info.setStatus(String.valueOf(ProcessInstanceBOInfo.Status.NORMAL.ordinal())); processInstanceBOService.createProcessInstanceBOInfo(info); put(processId, businessId, processInstanceId); }