Examples of TransformationException


Examples of org.teiid.core.types.TransformationException

            }
            reader.close();
            return contents.toString();        
           
        } catch (SQLException e) {
            throw new TransformationException(e, CorePlugin.Util.getString("failed_convert", new Object[] {getSourceType().getName(), getTargetType().getName()})); //$NON-NLS-1$           
        } catch(IOException e) {
            throw new TransformationException(e, CorePlugin.Util.getString("failed_convert", new Object[] {getSourceType().getName(), getTargetType().getName()})); //$NON-NLS-1$
        }
    }
View Full Code Here

Examples of org.teiid.core.types.TransformationException

            char[] result = new char[DataTypeManager.MAX_STRING_LENGTH];
            reader = source.getCharacterStream();
            int read = reader.read(result);
            return new String(result, 0, read);
        } catch (SQLException e) {
            throw new TransformationException(e, CorePlugin.Util.getString("failed_convert", new Object[] {getSourceType().getName(), getTargetType().getName()})); //$NON-NLS-1$           
        } catch (IOException e) {
            throw new TransformationException(e, CorePlugin.Util.getString("failed_convert", new Object[] {getSourceType().getName(), getTargetType().getName()})); //$NON-NLS-1$
        } finally {
          try {
            if (reader != null) {
              reader.close();
            }
View Full Code Here

Examples of org.teiid.core.types.TransformationException

   */
  public Object transformDirect(Object value) throws TransformationException {
    try {
      return Byte.valueOf(((String)value).trim());
    } catch(NumberFormatException e) {
      throw new TransformationException("ERR.003.029.0016", CorePlugin.Util.getString("ERR.003.029.0016", value));
    }
  }
View Full Code Here

Examples of org.teiid.core.types.TransformationException

      FileStoreInputStreamFactory fsisf = new FileStoreInputStreamFactory(fs, Streamable.ENCODING);
     
      try {
        ObjectConverterUtil.write(fsisf.getOuputStream(), ((DataSource)value).getInputStream(), -1);
      } catch (IOException e) {
        throw new TransformationException(e, e.getMessage());
      }
      return new BlobType(new BlobImpl(fsisf));
    }
    if (value instanceof Source) {
      if (value instanceof InputStreamFactory) {
View Full Code Here

Examples of org.teiid.core.types.TransformationException

            switch (type) {
                case DATETIME_CODE:
        try {
          valueStr = XMLSystemFunctions.convertToAtomicValue(value).getStringValue();
        } catch (TransformerException e) {
          throw new TransformationException(e, e.getMessage());
        }
                    break;
                case DOUBLE_CODE:
                    valueStr = doubleToDouble((Double)value);
                    break;
                case FLOAT_CODE:
                    valueStr = floatToFloat((Float)value);
                    break;
                case GDAY_CODE:
                    valueStr = bigIntegerTogDay((BigInteger)value);
                    break;
                case GMONTH_CODE:
                    valueStr = bigIntegerTogMonth((BigInteger)value);
                    break;
                case GMONTHDAY_CODE:
                    valueStr = FunctionMethods.format((Timestamp)value, GMONTHDAY_FORMAT);
                    break;
                case GYEAR_CODE:
                    valueStr = FunctionMethods.format((BigInteger)value, GYEAR_FORMAT);
                    break;
                case GYEARMONTH_CODE:
        DateTimeValue dtv;
        try {
          dtv = ((DateTimeValue)XMLSystemFunctions.convertToAtomicValue(value));
        } catch (TransformerException e) {
          throw new TransformationException(e, e.getMessage());
        }
                  valueStr = new GYearMonthValue(dtv.getYear(), dtv.getMonth(), dtv.getTimezoneInMinutes()).getStringValue();
                    break;
                default:
                    valueStr = defaultTranslation(value);
View Full Code Here

Examples of org.teiid.core.types.TransformationException

       
        Transform transform = DataTypeManager.getTransform(value.getClass(), getTargetType());
       
        if (transform == null || transform instanceof ObjectToAnyTransform) {
            Object[] params = new Object[] { getSourceType(), targetClass, value};
            throw new TransformationException(CorePlugin.Util.getString("ObjectToAnyTransform.Invalid_value", params)); //$NON-NLS-1$
        }
       
        try {
            return transform.transform(value);   
        } catch (TransformationException e) {
            Object[] params = new Object[] { getSourceType(), targetClass, value};
            throw new TransformationException(e, CorePlugin.Util.getString("ObjectToAnyTransform.Invalid_value", params)); //$NON-NLS-1$
        }
    }
View Full Code Here

Examples of org.teiid.core.types.TransformationException

    value = ((String) value).trim();
    Time result = null;
    try {
      result = Time.valueOf((String)value);
    } catch(Exception e) {
      throw new TransformationException(e, "ERR.003.029.0025", CorePlugin.Util.getString("ERR.003.029.0025", value)); //$NON-NLS-1$ //$NON-NLS-2$
    }
    if (!result.toString().equals(value)) {
      throw new TransformationException(CorePlugin.Util.getString("transform.invalid_string_for_date", value, getTargetType().getSimpleName())); //$NON-NLS-1$
    }
    return result;
  }
View Full Code Here

Examples of org.teiid.core.types.TransformationException

   */
  public Object transformDirect(Object value) throws TransformationException {
    try {
      return Short.valueOf(((String)value).trim());
    } catch(NumberFormatException e) {
      throw new TransformationException("ERR.003.029.0023", CorePlugin.Util.getString("ERR.003.029.0023", value)); //$NON-NLS-1$ //$NON-NLS-2$
    }
  }
View Full Code Here

Examples of org.teiid.core.types.TransformationException

    value = ((String) value).trim();
    Date result = null;
    try {
      result = Date.valueOf( (String) value );
    } catch(Exception e) {
      throw new TransformationException(e, "ERR.003.029.0018", CorePlugin.Util.getString("ERR.003.029.0018", value)); //$NON-NLS-1$ //$NON-NLS-2$
    }
    if (!result.toString().equals(value)) {
      throw new TransformationException(CorePlugin.Util.getString("transform.invalid_string_for_date", value, getTargetType().getSimpleName())); //$NON-NLS-1$
    }
    return result;
  }
View Full Code Here

Examples of org.teiid.core.types.TransformationException

   */
  public Object transformDirect(Object value) throws TransformationException {
    try {
      return Float.valueOf((String)value);
    } catch(NumberFormatException e) {
      throw new TransformationException("ERR.003.029.0020", CorePlugin.Util.getString("ERR.003.029.0020", value)); //$NON-NLS-1$ //$NON-NLS-2$
    }
  }
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.