当前位置: 首页>>代码示例>>Java>>正文


Java ValueMetaInterface.getDate方法代码示例

本文整理汇总了Java中org.pentaho.di.core.row.ValueMetaInterface.getDate方法的典型用法代码示例。如果您正苦于以下问题:Java ValueMetaInterface.getDate方法的具体用法?Java ValueMetaInterface.getDate怎么用?Java ValueMetaInterface.getDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pentaho.di.core.row.ValueMetaInterface的用法示例。


在下文中一共展示了ValueMetaInterface.getDate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: replayHistory

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void replayHistory() {
	int idx = wFields.getSelectionIndex();
	if (idx >= 0) {
		String fields[] = wFields.getItem(idx);
		String dateString = fields[13];
		try {
			ValueMetaInterface stringValueMeta = replayDateMeta.clone();
			stringValueMeta.setType(ValueMetaInterface.TYPE_STRING);
			
			Date replayDate = stringValueMeta.getDate(dateString);
			
			spoon.executeJob(jobGraph.getManagedObject(), true, false, replayDate, false);
		} catch (KettleException e1) {
			new ErrorDialog(jobGraph.getShell(), 
					Messages.getString("TransHistory.Error.ReplayingTransformation2"), //$NON-NLS-1$
					Messages.getString("TransHistory.Error.InvalidReplayDate") + dateString, e1); //$NON-NLS-1$
		}
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:20,代码来源:JobHistoryDelegate.java

示例2: replayHistory

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void replayHistory() {
	int idx = wFields.getSelectionIndex();
	if (idx >= 0) {
		String fields[] = wFields.getItem(idx);
		String dateString = fields[13];
		try {
			ValueMetaInterface stringValueMeta = replayDateMeta.clone();
			stringValueMeta.setType(ValueMetaInterface.TYPE_STRING);
			
			Date replayDate = stringValueMeta.getDate(dateString);
			
			spoon.executeTransformation(transGraph.getManagedObject(), true, false, false, false, false, replayDate, false);
		} catch (KettleException e1) {
			new ErrorDialog(transGraph.getShell(), 
					Messages.getString("TransHistory.Error.ReplayingTransformation2"), //$NON-NLS-1$
					Messages.getString("TransHistory.Error.InvalidReplayDate") + dateString, e1); //$NON-NLS-1$
		}
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:20,代码来源:TransHistoryDelegate.java

示例3: compare

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
/**
 * Compare 2 rows of data using the natural keys and indexes specified.
 * 
 * @param o1
 * @param o2
 * @return
 */
public int compare(Object[] o1, Object[] o2) {
	try {
		// First compare on the natural keys...
		//
		int cmp = rowMeta.compare(o1, o2, keyIndexes);
		if (cmp!=0) return cmp;

		// Then see if the start of the date range of o2 falls between the start and end of o2
		//
		ValueMetaInterface fromDateMeta = rowMeta.getValueMeta(fromDateIndex);
		ValueMetaInterface toDateMeta = rowMeta.getValueMeta(toDateIndex);
		
		Date fromDate  = fromDateMeta.getDate(o1[fromDateIndex]);
		Date toDate    = toDateMeta.getDate(o1[toDateIndex]);
		Date lookupDate = fromDateMeta.getDate(o2[fromDateIndex]);
		
		if (toDate!=null) {
			int cmpTo = lookupDate.compareTo(toDate);
			
			if (fromDate==null && cmpTo<0) return 0; // match!
			
			int cmpFrom = lookupDate.compareTo(fromDate);

			if (fromDate!=null && cmpFrom>=0 && cmpTo<0) return 0; // match
		}
		
		return fromDateMeta.compare(o1[fromDateIndex], o2[fromDateIndex]);
	}
	catch(Exception e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:40,代码来源:DimensionCache.java

示例4: getPrimitive

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public static Object getPrimitive(ValueMetaInterface valueMeta, Object valueData) throws KettleValueException
{
    switch(valueMeta.getType())
    {
    case ValueMetaInterface.TYPE_BIGNUMBER: return valueMeta.getBigNumber(valueData);
    case ValueMetaInterface.TYPE_BINARY: return valueMeta.getBinary(valueData);
    case ValueMetaInterface.TYPE_BOOLEAN: return valueMeta.getBoolean(valueData);
    case ValueMetaInterface.TYPE_DATE: return valueMeta.getDate(valueData);
    case ValueMetaInterface.TYPE_INTEGER: valueMeta.getInteger(valueData);
    case ValueMetaInterface.TYPE_NUMBER: return valueMeta.getNumber(valueData);
    // case ValueMetaInterface.TYPE_SERIALIZABLE: return valueMeta.(valueData);
    case ValueMetaInterface.TYPE_STRING: return valueMeta.getString(valueData);
    default: return null;
    }
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:16,代码来源:RowForumulaContext.java

示例5: getIncrementalFieldValue

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
private Date getIncrementalFieldValue() throws KettleException {
  Date result = null;
  boolean firstRow = true;
  Object[] row;
  RowMetaInterface inputRowMeta;

  while ( ( row = getRow() ) != null ) {
    if ( firstRow ) {
      firstRow = false;
      inputRowMeta = getInputRowMeta();

      if ( inputRowMeta == null || inputRowMeta.size() <= 0 ) {
        if ( log.isBasic() ) {
          logBasic( BaseMessages.getString( PKG, "ZendeskInput.Error.NoIncomingRows" ) );
        }
        return null;
      }

      String filenameField = environmentSubstitute( meta.getTimestampFieldName() );
      int fieldIndex = inputRowMeta.indexOfValue( filenameField );
      if ( fieldIndex < 0 ) {
        throw new KettleStepException( BaseMessages.getString(
          PKG, "ZendeskInputIncremental.Exception.StartDateFieldNotFound", filenameField ) );
      }
      ValueMetaInterface fieldValueMeta = inputRowMeta.getValueMeta( fieldIndex );
      if ( !( fieldValueMeta instanceof ValueMetaDate ) ) {
        throw new KettleStepException( BaseMessages.getString( PKG, "ZendeskInput.Error.WrongFieldType",
          ValueMetaFactory.getValueMetaName( fieldValueMeta.getType() ) ) );
      } else {
        result = fieldValueMeta.getDate( row[fieldIndex] );
      }
    } else {
      if ( log.isDetailed() ) {
        logDetailed( BaseMessages.getString( PKG, "ZendeskInput.Warning.IgnoringAdditionalInputRows" ) );
      }
    }
  }

  if ( firstRow ) {
    if ( log.isBasic() ) {
      logBasic( BaseMessages.getString( PKG, "ZendeskInput.Error.NoIncomingRows" ) );
    }
  }

  return result;
}
 
开发者ID:matthewtckr,项目名称:pdi-zendesk-plugin,代码行数:47,代码来源:ZendeskInputIncremental.java

示例6: writeRowToBulk

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
private void writeRowToBulk(RowMetaInterface rowMeta, Object[] r) throws KettleException {

    	try {
    		for (int i=0;i<data.keynrs.length;i++) {
	    		int index = data.keynrs[i];
	    		ValueMetaInterface valueMeta = rowMeta.getValueMeta(index);
	    		Object valueData = r[index];
	    		

	    		switch(valueMeta.getType()) {
	    		case ValueMetaInterface.TYPE_STRING :
	    			data.fifoStream.write(TeraDataBulkLoaderRoutines.convertVarchar(valueMeta.getString(valueData)));
	    			break;
	    		case ValueMetaInterface.TYPE_INTEGER:
	    			data.fifoStream.write(TeraDataBulkLoaderRoutines.convertLong(valueMeta.getInteger(valueData)));
	    			break;
	    		case ValueMetaInterface.TYPE_DATE:
	    			Date date = valueMeta.getDate(valueData);
	    			data.fifoStream.write(TeraDataBulkLoaderRoutines.convertDateTime(date));
	    			break;
	    		case ValueMetaInterface.TYPE_BOOLEAN:
	    			Boolean b= valueMeta.getBoolean(valueData);
	    			data.fifoStream.write(TeraDataBulkLoaderRoutines.convertBoolean(b));
	    			break;
	    		case ValueMetaInterface.TYPE_NUMBER:
	    			Double d = valueMeta.getNumber(valueData);
	    			data.fifoStream.write(TeraDataBulkLoaderRoutines.convertFloat(d));
	    			break;
	    		case ValueMetaInterface.TYPE_BIGNUMBER:
	    			BigDecimal bn = valueMeta.getBigNumber(valueData);
	    			data.fifoStream.write(TeraDataBulkLoaderRoutines.convertBignum(bn));
	    			break;
	    		default:
	    			logError("This is seen when a type in the PDI stream is not handleed by the step.  Type is "+valueMeta.getType());
	    			throw new KettleException("Unsupported type in stream");
	    		}
    		}
			
    	}
    	catch(IOException e)
    	{
    		// If something went wrong with writing to the fifo, get the underlying error from MySQL  
    		try{
    			logError("IOException writing to fifo.  Waiting up to " + this.threadWaitTimeText + " for the tbuild command thread to return with the error.");
    		}
    		catch (Exception loadEx){
         		logError("Caught Loadex error :"+ loadEx);
    			throw new KettleException("loadEx Error serializing rows of data to the fifo file 1", loadEx);
    		}
    		
			// throw the generic "Pipe" exception.
    		logError("Caught IO error (pipe?):"+ e);
			throw new KettleException("IO Error serializing rows of data to the fifo file 2", e);

    	}
    	catch (Exception e2){ 
    		logError("Caught some error :"+ e2);
    		// Null pointer exceptions etc.
    		throw new KettleException("Error serializing rows of data to the fifo file", e2);
    	}
	}
 
开发者ID:jbleuel,项目名称:pdi-teradata-tpt-plugin,代码行数:62,代码来源:TeraDataBulkLoader.java

示例7: createObjectsForRow

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public static Object[] createObjectsForRow(RowMetaInterface rowMeta, Object[] rowData) throws KettleValueException
{
    Object[] values = new Object[rowMeta.size()];
    for (int i=0;i<rowMeta.size();i++)
    {
        ValueMetaInterface valueMeta = rowMeta.getValueMeta(i);
        Object valueData = rowData[i];
        
        int length = valueMeta.getLength();
        
        switch(valueMeta.getType())
        {
        case ValueMetaInterface.TYPE_INTEGER:
            if (length<3)
            {
                values[i] = new Byte( valueMeta.getInteger(valueData).byteValue() );
            }
            else
            {
                if (length<5)
                {
                    values[i] = new Short(valueMeta.getInteger(valueData).shortValue());
                }
                else
                {
                    values[i] = valueMeta.getInteger(valueData);
                }
            }
            break;
        case ValueMetaInterface.TYPE_NUMBER:
            values[i] = valueMeta.getNumber(valueData);
            break;
        case ValueMetaInterface.TYPE_DATE:
            values[i] = valueMeta.getDate(valueData);
            break;
        case ValueMetaInterface.TYPE_STRING:
            values[i] = valueMeta.getString(valueData);
            break;
        case ValueMetaInterface.TYPE_BINARY:
            values[i] = valueMeta.getBinary(valueData);
            break;
        case ValueMetaInterface.TYPE_BOOLEAN:
            values[i] = valueMeta.getBoolean(valueData);
            break;
        case ValueMetaInterface.TYPE_BIGNUMBER:
            values[i] = valueMeta.getNumber(valueData);
            break;
        default: break;
        }
    }
    return values;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:53,代码来源:AccessOutputMeta.java

示例8: createObjectsForRow

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public static Object[] createObjectsForRow(RowMetaInterface rowMeta, Object[] rowData) throws KettleValueException
{
    Object[] values = new Object[rowMeta.size()];
    for (int i=0;i<rowMeta.size();i++)
    {
        ValueMetaInterface valueMeta = rowMeta.getValueMeta(i);
        Object valueData = rowData[i];

        // Prevent a NullPointerException below
        if (valueData == null || valueMeta == null)
        {
          values[i] = null;
          continue;
        }

        int length = valueMeta.getLength();
        
        switch(valueMeta.getType())
        {
        case ValueMetaInterface.TYPE_INTEGER:
            if (length<3)
            {
                values[i] = new Byte( valueMeta.getInteger(valueData).byteValue() );
            }
            else
            {
                if (length<5)
                {
                    values[i] = new Short(valueMeta.getInteger(valueData).shortValue());
                }
                else
                {
                    values[i] = valueMeta.getInteger(valueData);
                }
            }
            break;
        case ValueMetaInterface.TYPE_NUMBER:
            values[i] = valueMeta.getNumber(valueData);
            break;
        case ValueMetaInterface.TYPE_DATE:
            values[i] = valueMeta.getDate(valueData);
            break;
        case ValueMetaInterface.TYPE_STRING:
            values[i] = valueMeta.getString(valueData);
            break;
        case ValueMetaInterface.TYPE_BINARY:
            values[i] = valueMeta.getBinary(valueData);
            break;
        case ValueMetaInterface.TYPE_BOOLEAN:
            values[i] = valueMeta.getBoolean(valueData);
            break;
        case ValueMetaInterface.TYPE_BIGNUMBER:
            values[i] = valueMeta.getNumber(valueData);
            break;
        default: break;
        }
    }
    return values;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:60,代码来源:AccessOutputMeta.java


注:本文中的org.pentaho.di.core.row.ValueMetaInterface.getDate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。