public boolean isConstraintValid(final DTColumnConfig52 col) { if (col instanceof RowNumberCol52) { return true; } if (col instanceof DescriptionCol52) { return true; } if (col instanceof MetadataCol52) { return true; } if (col instanceof AttributeCol52) { return true; } if (col instanceof ConditionCol52) { final ConditionCol52 c = (ConditionCol52) col; if (c.getConstraintValueType() == BaseSingleFieldConstraint.TYPE_LITERAL) { if (c.getFactField() == null || c.getFactField().equals("")) { return false; } if (c.getOperator() == null || c.getOperator().equals("")) { return false; } return true; } return true; } if (col instanceof ActionCol52) { return true; } return false; }
@Override public void getOperatorCompletions( final Pattern52 selectedPattern, final ConditionCol52 selectedCondition, final Callback<String[]> callback) { final String factType = selectedPattern.getFactType(); final String factField = selectedCondition.getFactField(); this.oracle.getOperatorCompletions( factType, factField, new Callback<String[]>() { @Override public void callback(final String[] ops) { // Operators "in" and "not in" are only allowed if the Calculation Type is a Literal final List<String> filteredOps = new ArrayList<String>(); for (String op : ops) { filteredOps.add(op); } if (BaseSingleFieldConstraint.TYPE_LITERAL != selectedCondition.getConstraintValueType()) { filteredOps.remove("in"); filteredOps.remove("not in"); } final String[] displayOps = new String[filteredOps.size()]; filteredOps.toArray(displayOps); callback.callback(displayOps); } }); }
private String getType(final Pattern52 pattern, final ConditionCol52 col) { // Columns with "Value Lists" etc are always Text (for now) if (hasValueList(col)) { return DataType.TYPE_STRING; } // Operator "in" and "not in" requires a List as the value. These are always Text (for now) if (OperatorsOracle.operatorRequiresList(col.getOperator())) { return DataType.TYPE_STRING; } // Literals without operators are always Text (as the user can specify the operator "in cell") if (col.getConstraintValueType() == BaseSingleFieldConstraint.TYPE_LITERAL) { if (col.getOperator() == null || "".equals(col.getOperator())) { return DataType.TYPE_STRING; } } // Formula are always Text (as the user can specify anything "in cell") if (col.getConstraintValueType() == BaseSingleFieldConstraint.TYPE_PREDICATE) { return DataType.TYPE_STRING; } // Predicates are always Text (as the user can specify anything "in cell") if (col.getConstraintValueType() == BaseSingleFieldConstraint.TYPE_RET_VALUE) { return DataType.TYPE_STRING; } // Otherwise lookup from SuggestionCompletionEngine final String factType = pattern.getFactType(); final String fieldName = col.getFactField(); return getTypeFromDataOracle(factType, fieldName); }
@Override public boolean requiresValueList( final Pattern52 selectedPattern, final ConditionCol52 selectedCondition) { // Don't show a Value List if either the Fact\Field is empty final String factType = selectedPattern.getFactType(); final String factField = selectedCondition.getFactField(); boolean enableValueList = !((factType == null || "".equals(factType)) || (factField == null || "".equals(factField))); // Don't show Value List if operator does not accept one if (enableValueList) { enableValueList = validator.doesOperatorAcceptValueList(selectedCondition); } // Don't show a Value List if the Fact\Field has an enumeration if (enableValueList) { enableValueList = !oracle.hasEnums(factType, factField); } return enableValueList; }
@Override public boolean hasEnum(final Pattern52 selectedPattern, final ConditionCol52 selectedCondition) { final String factType = selectedPattern.getFactType(); final String factField = selectedCondition.getFactField(); return oracle.hasEnums(factType, factField); }