use of org.drools.workbench.services.verifier.api.client.index.Condition in project drools-wb by kiegroup.
the class RuleInspectorCache method deleteColumns.
public void deleteColumns(final int firstColumnIndex) {
final Collection<Column> all = index.getColumns().where(Column.index().is(firstColumnIndex)).select().all();
final Fields.FieldSelector fieldSelector = index.getRules().where(UUIDMatcher.uuid().any()).select().patterns().where(UUIDMatcher.uuid().any()).select().fields().where(UUIDMatcher.uuid().any()).select();
final ArrayList<Action> actions = new ArrayList<>();
final ArrayList<Condition> conditions = new ArrayList<>();
for (final Field field : fieldSelector.all()) {
for (final Column column : all) {
final Collection<Action> all1 = field.getActions().where(Action.columnUUID().is(column.getUuidKey())).select().all();
final Collection<Condition> all2 = field.getConditions().where(Condition.columnUUID().is(column.getUuidKey())).select().all();
actions.addAll(all1);
conditions.addAll(all2);
}
}
for (final Action action : actions) {
action.getUuidKey().retract();
}
for (final Condition condition : conditions) {
condition.getUuidKey().retract();
}
for (final Column column : all) {
column.getUuidKey().retract();
}
reset();
}
use of org.drools.workbench.services.verifier.api.client.index.Condition in project drools-wb by kiegroup.
the class RuleInspector method isDeficient.
@Override
public boolean isDeficient(final RuleInspector other) {
if (other.atLeastOneActionHasAValue() && !getActionsInspectors().conflicts(other.getActionsInspectors())) {
return false;
}
final Collection<Condition> allConditionsFromTheOtherRule = other.rule.getConditions().where(Condition.value().any()).select().all();
if (allConditionsFromTheOtherRule.isEmpty()) {
return true;
} else {
for (final Condition condition : allConditionsFromTheOtherRule) {
if (condition.getValues() == null) {
continue;
}
if (condition instanceof FieldCondition) {
final FieldCondition fieldCondition = (FieldCondition) condition;
final Conditions conditions = rule.getPatterns().where(Pattern.name().is(fieldCondition.getField().getFactType())).select().fields().where(Field.name().is(fieldCondition.getField().getName())).select().conditions();
if (conditions.where(Condition.value().any()).select().exists()) {
return false;
}
}
}
return true;
}
}
use of org.drools.workbench.services.verifier.api.client.index.Condition in project drools-wb by kiegroup.
the class RuleBuilder method resolveColumns.
private void resolveColumns() throws BuildException {
int columnIndex = 0;
for (final BaseColumn baseColumn : model.getExpandedColumns()) {
if (baseColumn instanceof ConditionCol52) {
final Condition condition = builderFactory.getConditionBuilder().with((ConditionCol52) baseColumn).with(rule).with(row).with(columnIndex).build();
rule.getConditions().add(condition);
} else if (baseColumn instanceof ActionCol52) {
final Action action = builderFactory.getActionBuilder().with(rule).with((ActionCol52) baseColumn).with(row).with(columnIndex).build();
rule.getActions().add(action);
}
columnIndex++;
}
}
use of org.drools.workbench.services.verifier.api.client.index.Condition in project drools-wb by kiegroup.
the class FieldInspectorUpdateTest method makeCondition.
private FieldCondition makeCondition(final Field field) {
final FieldCondition fieldAction = new FieldCondition(field, mock(Column.class), "==", new Values(11), configurationMock);
final ArrayList<Condition> actionsList = new ArrayList<>();
actionsList.add(fieldAction);
final Conditions conditions = new Conditions(actionsList);
when(field.getConditions()).thenReturn(conditions);
return fieldAction;
}
use of org.drools.workbench.services.verifier.api.client.index.Condition in project drools-wb by kiegroup.
the class CellBuilder method build.
public void build() throws BuildException {
if (baseColumn instanceof ActionCol52) {
final Action action = builderFactory.getActionBuilder().with(rule).with(row).with(columnIndex).with((ActionCol52) baseColumn).build();
rule.getActions().add(action);
} else if (baseColumn instanceof ConditionCol52) {
if (baseColumn instanceof BRLConditionVariableColumn) {
final Condition condition = builderFactory.getBRLConditionBuilder().with((BRLConditionVariableColumn) baseColumn).with(getRealCellValue((BRLConditionVariableColumn) baseColumn, row.get(columnIndex))).with(columnIndex).build();
rule.getConditions().add(condition);
} else {
final Condition condition = builderFactory.getFieldConditionsBuilder().with(resolvePattern(rule)).with((ConditionCol52) baseColumn).with(getRealCellValue((ConditionCol52) baseColumn, row.get(columnIndex))).with(columnIndex).build();
rule.getConditions().add(condition);
}
}
}
Aggregations