當前位置: 首頁>>代碼示例>>Java>>正文


Java RowMetaInterface.cloneRow方法代碼示例

本文整理匯總了Java中org.pentaho.di.core.row.RowMetaInterface.cloneRow方法的典型用法代碼示例。如果您正苦於以下問題:Java RowMetaInterface.cloneRow方法的具體用法?Java RowMetaInterface.cloneRow怎麽用?Java RowMetaInterface.cloneRow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.pentaho.di.core.row.RowMetaInterface的用法示例。


在下文中一共展示了RowMetaInterface.cloneRow方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: buildRow

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
private Object[] buildRow()  throws KettleException {

		 // Build an empty row based on the meta-data		  
		 Object[] outputRowData=buildEmptyRow();

		 if(data.dynamic)  {
			 // Reserve room for new row
			 System.arraycopy(data.readRow, 0, outputRowData, 0, data.readRow.length);
		 }

		 try {	
	
				// Execute for each Input field...
				for (int i=0;i<meta.getInputFields().length;i++) {
										
					LDAPInputField field = meta.getInputFields()[i];
					// Get attribute value
					int index = data.nrIncomingFields + i;
					Attribute attr = data.attributes.get(field.getRealAttribute()); 
	                if (attr!=null) {
	                	//Let's try to get value of this attribute
	                	outputRowData[index]= getAttributeValue(field, attr, index, outputRowData[index]);		      
	                }
	        
					// Do we need to repeat this field if it is null?
					if (field.isRepeated())	{
						if (data.previousRow!=null && outputRowData[index]==null) {
							outputRowData[index] = data.previousRow[index];
						}
					}
	
				}    // End of loop over fields...
				
				int fIndex = data.nrIncomingFields + data.nrfields; 
		        
				// See if we need to add the row number to the row...  
		        if (meta.includeRowNumber() && !Const.isEmpty(meta.getRowNumberField())) {
		            outputRowData[fIndex] = new Long(data.rownr);
		        }
		        
				RowMetaInterface irow = getInputRowMeta();
				
				data.previousRow = irow==null?outputRowData:(Object[])irow.cloneRow(outputRowData); // copy it to make
				// surely the next step doesn't change it in between...
				data.rownr++;
				
				incrementLinesInput();        
			
		 } catch (Exception e) {
			throw new KettleException(BaseMessages.getString(PKG, "LDAPInput.Exception.CanNotReadLDAP"), e);
		 }
		return outputRowData;
	}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:54,代碼來源:LDAPInput.java


注:本文中的org.pentaho.di.core.row.RowMetaInterface.cloneRow方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。