Search in sources :

Example 11 with GenericSelector

use of org.finos.waltz.data.GenericSelector in project waltz by khartec.

the class FlowClassificationRuleService method findClassificationRules.

public Set<FlowClassificationRule> findClassificationRules(IdSelectionOptions options) {
    Condition customSelectionCriteria;
    switch(options.entityReference().kind()) {
        case ORG_UNIT:
            GenericSelector orgUnitSelector = genericSelectorFactory.apply(options);
            customSelectionCriteria = Tables.FLOW_CLASSIFICATION_RULE.PARENT_ID.in(orgUnitSelector.selector()).and(FlowClassificationRuleDao.SUPPLIER_APP.KIND.notIn(options.filters().omitApplicationKinds()));
            break;
        case DATA_TYPE:
            GenericSelector dataTypeSelector = genericSelectorFactory.apply(options);
            customSelectionCriteria = Tables.FLOW_CLASSIFICATION_RULE.DATA_TYPE_ID.in(dataTypeSelector.selector()).and(FlowClassificationRuleDao.SUPPLIER_APP.KIND.notIn(options.filters().omitApplicationKinds()));
            break;
        case APP_GROUP:
        case FLOW_DIAGRAM:
        case MEASURABLE:
        case PERSON:
            customSelectionCriteria = mkConsumerSelectionCondition(options);
            break;
        default:
            throw new UnsupportedOperationException("Cannot calculate flow classification rules for ref" + options.entityReference());
    }
    return flowClassificationRuleDao.findClassificationRules(customSelectionCriteria);
}
Also used : Condition(org.jooq.Condition) GenericSelector(org.finos.waltz.data.GenericSelector)

Example 12 with GenericSelector

use of org.finos.waltz.data.GenericSelector in project waltz by khartec.

the class FlowClassificationRuleService method findDiscouragedSources.

public List<DiscouragedSource> findDiscouragedSources(IdSelectionOptions options) {
    Condition customSelectionCriteria;
    switch(options.entityReference().kind()) {
        case DATA_TYPE:
            GenericSelector dataTypeSelector = genericSelectorFactory.apply(options);
            customSelectionCriteria = LOGICAL_FLOW_DECORATOR.DECORATOR_ENTITY_ID.in(dataTypeSelector.selector()).and(FlowClassificationRuleDao.SUPPLIER_APP.KIND.notIn(options.filters().omitApplicationKinds()));
            break;
        case ORG_UNIT:
            GenericSelector orgUnitSelector = genericSelectorFactory.apply(options);
            customSelectionCriteria = FlowClassificationRuleDao.CONSUMER_APP.ORGANISATIONAL_UNIT_ID.in(orgUnitSelector.selector()).and(FlowClassificationRuleDao.SUPPLIER_APP.KIND.notIn(options.filters().omitApplicationKinds()));
            break;
        case APP_GROUP:
        case FLOW_DIAGRAM:
        case MEASURABLE:
        case PERSON:
            customSelectionCriteria = mkConsumerSelectionCondition(options);
            break;
        default:
            throw new UnsupportedOperationException("Cannot calculate discouraged sources for ref" + options.entityReference());
    }
    return flowClassificationRuleDao.findDiscouragedSourcesBySelector(customSelectionCriteria);
}
Also used : Condition(org.jooq.Condition) GenericSelector(org.finos.waltz.data.GenericSelector)

Example 13 with GenericSelector

use of org.finos.waltz.data.GenericSelector in project waltz by khartec.

the class FlowDiagramEntityService method deleteForEntitySelector.

public int deleteForEntitySelector(IdSelectionOptions options) {
    checkNotNull(options, "options cannot be null");
    GenericSelector selector = genericSelectorFactory.apply(options);
    return flowDiagramEntityDao.deleteForGenericEntitySelector(selector);
}
Also used : GenericSelector(org.finos.waltz.data.GenericSelector)

Aggregations

GenericSelector (org.finos.waltz.data.GenericSelector)13 IdSelectionOptions (org.finos.waltz.model.IdSelectionOptions)4 BigDecimal (java.math.BigDecimal)2 LocalDate (java.time.LocalDate)2 java.util (java.util)2 Collectors.groupingBy (java.util.stream.Collectors.groupingBy)2 Collectors.toList (java.util.stream.Collectors.toList)2 Checks.checkNotNull (org.finos.waltz.common.Checks.checkNotNull)2 Checks.checkTrue (org.finos.waltz.common.Checks.checkTrue)2 ListUtilities (org.finos.waltz.common.ListUtilities)2 ListUtilities.map (org.finos.waltz.common.ListUtilities.map)2 MapUtilities.groupBy (org.finos.waltz.common.MapUtilities.groupBy)2 MapUtilities.indexBy (org.finos.waltz.common.MapUtilities.indexBy)2 SetUtilities (org.finos.waltz.common.SetUtilities)2 SetUtilities.fromCollection (org.finos.waltz.common.SetUtilities.fromCollection)2 GenericSelectorFactory (org.finos.waltz.data.GenericSelectorFactory)2 InvolvementDao (org.finos.waltz.data.involvement.InvolvementDao)2 PersonDao (org.finos.waltz.data.person.PersonDao)2 org.finos.waltz.data.survey (org.finos.waltz.data.survey)2 org.finos.waltz.model (org.finos.waltz.model)2