Search in sources :

Example 1 with ConcurrentProcessRule

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();
}
Also used : PolicyEngine(com.walmartlabs.concord.policyengine.PolicyEngine) ConcurrentProcessRule(com.walmartlabs.concord.policyengine.ConcurrentProcessRule)

Aggregations

ConcurrentProcessRule (com.walmartlabs.concord.policyengine.ConcurrentProcessRule)1 PolicyEngine (com.walmartlabs.concord.policyengine.PolicyEngine)1