コード例 #1
0
 public boolean isConstraintValid(DTColumnConfig col, SuggestionCompletionEngine sce) {
   if (col instanceof RowNumberCol) {
     return true;
   }
   if (col instanceof DescriptionCol) {
     return true;
   }
   if (col instanceof MetadataCol) {
     return true;
   }
   if (col instanceof AttributeCol) {
     return true;
   }
   if (col instanceof ConditionCol) {
     ConditionCol c = (ConditionCol) 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 ActionCol) {
     return true;
   }
   return false;
 }
コード例 #2
0
 private boolean isDataType(DTColumnConfig col, SuggestionCompletionEngine sce, String dataType) {
   if (col instanceof RowNumberCol) {
     throw new IllegalArgumentException(
         "Only ConditionCol and Actions permitted. Consider using one of the public is<DataType> methods.");
   }
   if (col instanceof DescriptionCol) {
     throw new IllegalArgumentException(
         "Only ConditionCol and Actions permitted. Consider using one of the public is<DataType> methods.");
   }
   if (col instanceof MetadataCol) {
     throw new IllegalArgumentException(
         "Only ConditionCol and Actions permitted. Consider using one of the public is<DataType> methods.");
   }
   if (col instanceof AttributeCol) {
     throw new IllegalArgumentException(
         "Only ConditionCol and Actions permitted. Consider using one of the public is<DataType> methods.");
   }
   if (col instanceof ConditionCol) {
     ConditionCol c = (ConditionCol) col;
     if (c.getConstraintValueType() == BaseSingleFieldConstraint.TYPE_LITERAL) {
       if (c.getOperator() == null || "".equals(c.getOperator())) {
         return false;
       }
       String ft = sce.getFieldType(c.getFactType(), c.getFactField());
       if (ft != null && ft.equals(dataType)) {
         return true;
       }
     }
   } else if (col instanceof ActionSetFieldCol) {
     ActionSetFieldCol c = (ActionSetFieldCol) col;
     String ft = sce.getFieldType(getBoundFactType(c.getBoundName()), c.getFactField());
     if (ft != null && ft.equals(dataType)) {
       return true;
     }
   } else if (col instanceof ActionInsertFactCol) {
     ActionInsertFactCol c = (ActionInsertFactCol) col;
     String ft = sce.getFieldType(c.getFactType(), c.getFactField());
     if (ft != null && ft.equals(dataType)) {
       return true;
     }
   }
   return false;
 }