use of com.walmartlabs.concord.policyengine.ConcurrentProcessRule in project concord by walmartlabs.
the class ConcurrentProcessFilter method findProcess.
@Override
protected List<UUID> findProcess(DSLContext tx, ProcessQueueEntry item, List<ProcessQueueEntry> startingProcesses) {
PolicyEngine pe = getPolicyEngine(item.orgId(), item.projectId(), item.initiatorId());
if (pe == null) {
return Collections.emptyList();
}
CheckResult<ConcurrentProcessRule, List<UUID>> result = pe.getConcurrentProcessPolicy().check(() -> processesPerOrg(tx, item.orgId(), startingProcesses), () -> processesPerProject(tx, item.projectId(), startingProcesses));
if (result.getDeny().isEmpty()) {
return Collections.emptyList();
}
return result.getDeny().get(0).getEntity();
}
Aggregations