Examples of DataValue


Examples of net.helipilot50.stocktrade.framework.DataValue

            else if (NumericData.class.isAssignableFrom(valueClass)) {
              Class<? extends NumericData>numericValueClass = (Class<? extends NumericData>)valueClass;
            try {
              // TF:10/4/08:Added in the scale of decimaldatas if necessary
              Object currentValue = this.docFilter.field.getValue();
          DataValue dataValue = FormatterUtils.createDataValueInstance(numericValueClass);
          if (currentValue instanceof DecimalData) {
            DecimalData originalValue = (DecimalData)currentValue;
            if (!originalValue.isNull() && dataValue instanceof DecimalData) {
              ((DecimalData)dataValue).setScale(originalValue.getScale());
            }
View Full Code Here

Examples of net.helipilot50.stocktrade.framework.DataValue

     */
    public String valueToString(Object value) throws ParseException {
      log.debug("valueToString(" + value + ")");

      if (value instanceof DataValue) {
        DataValue dataValue = (DataValue) value;
        Class<?> vc = this.getValueClass();
       
        //PM:7 oct. 2008:this is a special case for DateTimeNullable
        /*
         * if it is set to the beginning of the Gregorian calendar
         * the mask should contain '*'
         */
        if (DateTimeNullable.class.isAssignableFrom(vc)){
          DateTimeNullable dtn = (DateTimeNullable)value;
          if (dtn.asDate().getTime()==DateTimeData.GREGORIAN_START_AS_LONG){
            return super.valueToString(null);
          }
        }
       
        if (dataValue.isNullable() && dataValue.isNull()) {

          // TF+CraigM:19/08/2008 - Only set N/A if we are based on a TextData
          if (TextData.class.isAssignableFrom(vc)) {
            // TF:19/06/2008:Changed this to return N/A if the data field is null
            return "N/A";
View Full Code Here

Examples of net.helipilot50.stocktrade.framework.DataValue

  public Object stringToValue(String value) throws ParseException {
        log.debug("stringToValue(" + value + ")");
        Class<?> vc = getValueClass();
        if (vc != null) {
            if (DataValue.class.isAssignableFrom(vc)) {
                DataValue dataValue = null;
                // If its already created we want to reuse the same instance in
                // order to preseve the datavalues current state
                if (installedTextField != null
                        && installedTextField.getValue() != null) {
                    log.debug("using existing data value");
                    DataValue existingValue = (DataValue) installedTextField.getValue();

                    // The setValue mutator fires a value change that we dont want
                    // anyone to receive so we need to remolve any listeners from
                    // the textfield before we set the value
                    PropertyChangeListener[] listeners = removeValueChangeListeners(existingValue);
                    // TF:07/06/2008:Added in safety in case an exception is thrown
                    try {
                      // CraigM:15/01/2009 - Removed length==0 check as it meant it would incorrectly force
                      //             a non null TextNullable with length 0, to be null.
                      // if (existingValue.isNullable() && (value == null || value.length() == 0))
                      if (existingValue.isNullable() && value == null)
                      {
                          existingValue.setIsNull(true);
                          dataValue = existingValue;
                      }
                      else
                      {
                          // Set the internal value from the string
View Full Code Here

Examples of net.helipilot50.stocktrade.framework.DataValue

    protected DataValue createDataValueInstance(Class<? extends DataValue> dataValueClass, String value)
            throws ParseException {
        try {
            Constructor<? extends DataValue> constructor = dataValueClass.getConstructor(new Class[0]);
            DataValue dataValue = constructor.newInstance(new Object[0]);
            return setDataValueFromString(dataValue,  value);
        } catch (Throwable t) {
            ParseException errorVar = new ParseException("Unable to instantiate valueclass", 0);
            ErrorMgr.addError(errorVar);
            throw errorVar;
View Full Code Here

Examples of net.helipilot50.stocktrade.framework.DataValue

              return "N/A";
          }
          return format(numericValue, (NumberFormat) getFormat());
        }
        else if (value instanceof DataValue) {
            DataValue dataValue = (DataValue) value;
            if (dataValue.isNullable() && dataValue.isNull()) {
              return "N/A";
            }
            else {
              return dataValueToString((DataValue)value);
            }
View Full Code Here

Examples of net.helipilot50.stocktrade.framework.DataValue

     * @return a DataValue instance of the specified typethat contains the value in the column
     * @throws UsageException if there is a type mismatch between the specified type and the database, or if data exceptions occur.
     */
    public DataValue getDataValue(int pColumnID, Class<? extends DataValue> c) {
        try {
            DataValue tn = c.newInstance();
            this.getDataValue(pColumnID, tn); // CraigM:24/09/2008 - Moved code into getDataValue(int, DataValue) method

            return tn;
        } catch (IllegalAccessException e1){
          throw processException("ResultSetHelper: Cannot construct the property type", e1);
View Full Code Here

Examples of net.helipilot50.stocktrade.framework.DataValue

                ps.setNull(paramIndex, sqlType);
            }
        }
        else if (inValue instanceof DataValue) {
            // work out the correct type to call
            DataValue value = (DataValue)inValue;
            if (value instanceof TextData) {
                if (value.isNull()) {
                    ps.setNull(paramIndex, Types.VARCHAR);
                }
                else {
                    ps.setString(paramIndex, inValue.toString());
                }
            }
            else if (value instanceof IntegerData) {
                if (value.isNull()) {
                    ps.setNull(paramIndex, Types.INTEGER);
                }
                else {
                    ps.setInt(paramIndex, ((IntegerData)value).intValue());
                }
            }
            else if (value instanceof DecimalData) {
                if (value.isNull()) {
                    ps.setNull(paramIndex, Types.DOUBLE);
                }
                else {
                    ps.setDouble(paramIndex, ((DecimalData)value).doubleValue());
                }
            }
            else if (value instanceof DoubleData) {
                if (value.isNull()) {
                    ps.setNull(paramIndex, Types.DOUBLE);
                }
                else {
                    ps.setDouble(paramIndex, ((DoubleData)value).doubleValue());
                }
            }
            else if (value instanceof DateTimeData) {
                if (value.isNull()) {
                    ps.setNull(paramIndex, Types.DATE);
                }
                else {
                    java.util.Date theDate = ((DateTimeData)value).asDate();
                    ps.setTimestamp(paramIndex, new java.sql.Timestamp(theDate.getTime()));
                }
            }
            else if (value instanceof BinaryData) {
                if (value.isNull()) {
                    ps.setNull(paramIndex, Types.BINARY);
                }
                else {
                    ps.setBytes(paramIndex, ((BinaryData)inValue).toByteArray());
                }
            }
            // TF:20/3/08:Added a missing case for inserting boolean datas into the database
            else if (value instanceof BooleanData) {
              if (sqlType == SqlTypeValue.TYPE_UNKNOWN){ //PM:23/01/2009: special case to handle the BooleanData into column type of number(1)
                if (value.isNull()) {
                  ps.setNull(paramIndex, Types.NULL);
                }
                else {
                  int numericBoolean = ((((BooleanData)inValue).getValue()) ? 1 : 0);
                  ps.setInt(paramIndex, numericBoolean);
                }

              } else {
                if (value.isNull()) {
                  ps.setNull(paramIndex, Types.BOOLEAN);
                }
                else {
                  ps.setBoolean(paramIndex, ((BooleanData)inValue).getValue());
                }
View Full Code Here

Examples of org.apache.drill.exec.ref.values.DataValue

        aggs[x].addRecord()
      }
     
      // if we're in target mode and this row matches the target criteria, we're going to copy carry over values and mark foundTarget = true.
      if(targetMode){
        DataValue v = targetEvaluator.eval();
        if(v.getDataType().getMinorType() == MinorType.BIT && v.getAsBooleanValue().getBoolean()){
          foundTarget = true;
          for(int i =0 ; i < carryovers.length; i++){
            carryoverValues[i] = carryovers[i].eval();
          }
        }
View Full Code Here

Examples of org.apache.drill.exec.ref.values.DataValue

     * @return Whether or not the record should be included in the output.
     */
    private boolean writeOutputRecord(){
      outputRecord.clear();
      for(int x = 0; x < aggs.length; x++){
        DataValue dv = aggs[x].eval();
//        logger.debug("Adding Aggregated Values named {} with value {}", outputNames[x], dv);
        outputRecord.addField(aggNames[x], dv);
      }
     
      // Add the carryover keys.
View Full Code Here

Examples of org.apache.drill.exec.ref.values.DataValue

    }
  }

  @Override
  public DataValue eval() {
    DataValue v = new ScalarValues.LongScalar(l);
    l = 0;
    return v;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.