Search in sources :

Example 1 with RuleLookupRequest

use of org.kie.workbench.common.stunner.core.lookup.rule.RuleLookupRequest in project kie-wb-common by kiegroup.

the class CommonLookups method lookupConnectionRules.

private <T> List<Rule> lookupConnectionRules(final String defSetId, final T sourceDefinition, final String edgeId, final int page, final int pageSize) {
    if (null != defSetId) {
        final Set<String> defLabels = getDefinitionLabels(sourceDefinition);
        final RuleLookupRequest.Builder builder = new RuleLookupRequest.Builder();
        builder.definitionSetId(defSetId).type(RuleLookupRequest.Builder.RuleType.CONNECTION).from(defLabels).page(page).pageSize(pageSize);
        if (null != edgeId) {
            builder.id(edgeId);
        }
        final RuleLookupRequest request = builder.build();
        final LookupManager.LookupResponse<Rule> response = ruleLookupManager.lookup(request);
        return response.getResults();
    }
    return null;
}
Also used : RuleLookupRequest(org.kie.workbench.common.stunner.core.lookup.rule.RuleLookupRequest) RuleContextBuilder(org.kie.workbench.common.stunner.core.rule.context.impl.RuleContextBuilder) LookupManager(org.kie.workbench.common.stunner.core.lookup.LookupManager) DefinitionLookupManager(org.kie.workbench.common.stunner.core.lookup.definition.DefinitionLookupManager) RuleLookupManager(org.kie.workbench.common.stunner.core.lookup.rule.RuleLookupManager) Rule(org.kie.workbench.common.stunner.core.rule.Rule)

Aggregations

LookupManager (org.kie.workbench.common.stunner.core.lookup.LookupManager)1 DefinitionLookupManager (org.kie.workbench.common.stunner.core.lookup.definition.DefinitionLookupManager)1 RuleLookupManager (org.kie.workbench.common.stunner.core.lookup.rule.RuleLookupManager)1 RuleLookupRequest (org.kie.workbench.common.stunner.core.lookup.rule.RuleLookupRequest)1 Rule (org.kie.workbench.common.stunner.core.rule.Rule)1 RuleContextBuilder (org.kie.workbench.common.stunner.core.rule.context.impl.RuleContextBuilder)1