コード例 #1
0
 private String getType(final AttributeCol52 col) {
   String type = DataType.TYPE_STRING;
   final String attrName = col.getAttribute();
   if (attrName.equals(GuidedDecisionTable52.SALIENCE_ATTR)) {
     type = DataType.TYPE_NUMERIC_INTEGER;
   } else if (attrName.equals(GuidedDecisionTable52.ENABLED_ATTR)) {
     type = DataType.TYPE_BOOLEAN;
   } else if (attrName.equals(GuidedDecisionTable52.NO_LOOP_ATTR)) {
     type = DataType.TYPE_BOOLEAN;
   } else if (attrName.equals(GuidedDecisionTable52.DURATION_ATTR)) {
     type = DataType.TYPE_NUMERIC_LONG;
   } else if (attrName.equals(GuidedDecisionTable52.TIMER_ATTR)) {
     type = DataType.TYPE_STRING;
   } else if (attrName.equals(GuidedDecisionTable52.CALENDARS_ATTR)) {
     type = DataType.TYPE_STRING;
   } else if (attrName.equals(GuidedDecisionTable52.AUTO_FOCUS_ATTR)) {
     type = DataType.TYPE_BOOLEAN;
   } else if (attrName.equals(GuidedDecisionTable52.LOCK_ON_ACTIVE_ATTR)) {
     type = DataType.TYPE_BOOLEAN;
   } else if (attrName.equals(GuidedDecisionTable52.DATE_EFFECTIVE_ATTR)) {
     type = DataType.TYPE_DATE;
   } else if (attrName.equals(GuidedDecisionTable52.DATE_EXPIRES_ATTR)) {
     type = DataType.TYPE_DATE;
   } else if (attrName.equals(GuidedDecisionTable52.DIALECT_ATTR)) {
     type = DataType.TYPE_STRING;
   } else if (attrName.equals(GuidedDecisionTable52.NEGATE_RULE_ATTR)) {
     type = DataType.TYPE_BOOLEAN;
   }
   return type;
 }
コード例 #2
0
  /**
   * Make a Model cell for the given column
   *
   * @param column
   * @return
   */
  @Override
  public DTCellValue52 makeModelCellValue(BaseColumn column) {
    DataType.DataTypes dataType = utilities.getDataType(column);
    DTCellValue52 dcv = null;
    if (column instanceof LimitedEntryCol) {
      dcv = new DTCellValue52(Boolean.FALSE);
    } else if (column instanceof AttributeCol52) {
      AttributeCol52 ac = (AttributeCol52) column;
      if (ac.getAttribute().equals(RuleAttributeWidget.DIALECT_ATTR)) {
        dcv = new DTCellValue52(RuleAttributeWidget.DEFAULT_DIALECT);
      } else {
        dcv = new DTCellValue52(column.getDefaultValue());
      }

    } else {
      dcv = new DTCellValue52(column.getDefaultValue());
    }
    utilities.assertDTCellValue(dataType, dcv);
    return dcv;
  }
コード例 #3
0
  /**
   * Convert a Model cell to one that can be used in the UI
   *
   * @param dcv
   * @return
   */
  @Override
  public CellValue<? extends Comparable<?>> convertModelCellValue(
      BaseColumn column, DTCellValue52 dcv) {

    // Analysis cells do not use data-type
    if (column instanceof AnalysisCol52) {
      return makeNewAnalysisCellValue();
    }

    // Other cells do use data-type
    DataType.DataTypes dataType = utilities.getDataType(column);
    utilities.assertDTCellValue(dataType, dcv);

    CellValue<? extends Comparable<?>> cell = null;
    switch (dataType) {
      case BOOLEAN:
        cell = makeNewBooleanCellValue(dcv.getBooleanValue());
        break;
      case DATE:
        cell = makeNewDateCellValue(dcv.getDateValue());
        break;
      case NUMERIC:
        cell = makeNewNumericCellValue((BigDecimal) dcv.getNumericValue());
        break;
      case NUMERIC_BIGDECIMAL:
        cell = makeNewBigDecimalCellValue((BigDecimal) dcv.getNumericValue());
        break;
      case NUMERIC_BIGINTEGER:
        cell = makeNewBigIntegerCellValue((BigInteger) dcv.getNumericValue());
        break;
      case NUMERIC_BYTE:
        cell = makeNewByteCellValue((Byte) dcv.getNumericValue());
        break;
      case NUMERIC_DOUBLE:
        cell = makeNewDoubleCellValue((Double) dcv.getNumericValue());
        break;
      case NUMERIC_FLOAT:
        cell = makeNewFloatCellValue((Float) dcv.getNumericValue());
        break;
      case NUMERIC_INTEGER:
        cell = makeNewIntegerCellValue((Integer) dcv.getNumericValue());
        break;
      case NUMERIC_LONG:
        if (column instanceof RowNumberCol52) {
          cell = makeNewRowNumberCellValue((Long) dcv.getNumericValue());
        } else {
          cell = makeNewLongCellValue((Long) dcv.getNumericValue());
          if (column instanceof AttributeCol52) {
            AttributeCol52 at = (AttributeCol52) column;
            if (at.getAttribute().equals(RuleAttributeWidget.SALIENCE_ATTR)) {
              if (at.isUseRowNumber()) {
                cell = makeNewRowNumberCellValue((Long) dcv.getNumericValue());
              }
            }
          }
        }
        break;
      case NUMERIC_SHORT:
        cell = makeNewShortCellValue((Short) dcv.getNumericValue());
        break;
      default:
        cell = makeNewStringCellValue(dcv.getStringValue());
        if (column instanceof AttributeCol52) {
          AttributeCol52 ac = (AttributeCol52) column;
          if (ac.getAttribute().equals(RuleAttributeWidget.DIALECT_ATTR)) {
            cell = makeNewDialectCellValue(dcv.getStringValue());
          }
        }
    }

    if (dcv.isOtherwise()) {
      cell.addState(CellState.OTHERWISE);
    }

    return cell;
  }
コード例 #4
0
 public boolean hasValueList(final AttributeCol52 col) {
   if ("no-loop".equals(col.getAttribute()) || "enabled".equals(col.getAttribute())) {
     return true;
   }
   return false;
 }
コード例 #5
0
 private String[] getValueList(final AttributeCol52 col) {
   if ("no-loop".equals(col.getAttribute()) || "enabled".equals(col.getAttribute())) {
     return new String[] {"true", "false"};
   }
   return new String[0];
 }