本文整理匯總了Java中org.pentaho.di.core.row.ValueMeta類的典型用法代碼示例。如果您正苦於以下問題:Java ValueMeta類的具體用法?Java ValueMeta怎麽用?Java ValueMeta使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ValueMeta類屬於org.pentaho.di.core.row包,在下文中一共展示了ValueMeta類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getFields
import org.pentaho.di.core.row.ValueMeta; //導入依賴的package包/類
public void getFields(RowMetaInterface r, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) {
JSONArray transInfo = configInfo.getJSONArray(TRANS_INFO);
for(JSONObject ti:transInfo.toArray(new JSONObject[]{})){
//將轉換結果賦予新字段的,添加新字段
if(ti.containsKey(RESULT_LATER)&&StringUtils.isNotBlank(ti.getString(RESULT_LATER))){
addField(r,ti.getString(TRANS_FIELD)+ti.getString(RESULT_LATER),
ValueMeta.TYPE_STRING,ValueMeta.TRIM_TYPE_BOTH,origin,ti.getString(TRANS_FIELD)+"名稱");
}
if(RULE_TOJSON.equals(ti.getString(TRANS_RULE))){
//轉換為JSON串
addField(r,ti.getString(TRANS_FIELD),
ValueMeta.TYPE_STRING,ValueMeta.TRIM_TYPE_BOTH,origin,ti.getString(TRANS_FIELD));
}
if(RULE_TOTXT.equals(ti.getString(TRANS_RULE))){
//轉換為JSON串
addField(r,ti.getString(TRANS_FIELD),
ValueMeta.TYPE_STRING,ValueMeta.TRIM_TYPE_BOTH,origin,ti.getString(TRANS_FIELD));
}
}
if(isHbjl()){
addField(r,"GROUP_KEY",ValueMeta.TYPE_STRING,ValueMeta.TRIM_TYPE_BOTH,origin,"分組字段拚接出的key");
}
}
示例2: setStepOutputInterface
import org.pentaho.di.core.row.ValueMeta; //導入依賴的package包/類
/**
* This method will be used for setting the output interface.
* Output interface is how this step will process the row to next step
*/
private void setStepOutputInterface() {
ValueMetaInterface[] out = new ValueMetaInterface[measureCount + 1];
for (int i = 0; i < measureCount; i++) {
out[i] = new ValueMeta("measure" + i, ValueMetaInterface.TYPE_NUMBER,
ValueMetaInterface.STORAGE_TYPE_NORMAL);
out[i].setStorageMetadata(new ValueMeta("measure" + i, ValueMetaInterface.TYPE_NUMBER,
ValueMetaInterface.STORAGE_TYPE_NORMAL));
}
out[out.length - 1] = new ValueMeta("id", ValueMetaInterface.TYPE_BINARY,
ValueMetaInterface.STORAGE_TYPE_BINARY_STRING);
out[out.length - 1].setStorageMetadata(new ValueMeta("id", ValueMetaInterface.TYPE_STRING,
ValueMetaInterface.STORAGE_TYPE_NORMAL));
out[out.length - 1].setLength(256);
out[out.length - 1].setStringEncoding(CarbonCommonConstants.BYTE_ENCODING);
out[out.length - 1].getStorageMetadata().setStringEncoding(CarbonCommonConstants.BYTE_ENCODING);
data.outputRowMeta.setValueMetaList(Arrays.asList(out));
}
示例3: FastJsonInputField
import org.pentaho.di.core.row.ValueMeta; //導入依賴的package包/類
public FastJsonInputField(Node fnode) throws KettleValueException {
setName(XMLHandler.getTagValue(fnode, "name"));
setPath(XMLHandler.getTagValue(fnode, "path"));
setType(ValueMeta.getType(XMLHandler.getTagValue(fnode, "type")));
setFormat(XMLHandler.getTagValue(fnode, "format"));
setCurrencySymbol(XMLHandler.getTagValue(fnode, "currency"));
setDecimalSymbol(XMLHandler.getTagValue(fnode, "decimal"));
setGroupSymbol(XMLHandler.getTagValue(fnode, "group"));
setLength(Const.toInt(XMLHandler.getTagValue(fnode, "length"), -1));
setPrecision(Const
.toInt(XMLHandler.getTagValue(fnode, "precision"), -1));
setTrimType(getTrimTypeByCode(XMLHandler
.getTagValue(fnode, "trim_type")));
setRepeated(!"N".equalsIgnoreCase(XMLHandler.getTagValue(fnode,
"repeat")));
}
示例4: createExpectedResults
import org.pentaho.di.core.row.ValueMeta; //導入依賴的package包/類
/**
* Create result data for test case 1. Each list object should mirror the output of the parsed JSON
*
* @return list of metadata/data couples of how the result should look.
*/
private List<RowMetaAndData> createExpectedResults() {
List<RowMetaAndData> list = new ArrayList<RowMetaAndData>();
ValueMetaInterface[] valuesMeta =
{ new ValueMeta("id", ValueMeta.TYPE_INTEGER), new ValueMeta("first_name", ValueMeta.TYPE_STRING),
new ValueMeta("last_name", ValueMeta.TYPE_STRING), new ValueMeta("city", ValueMeta.TYPE_STRING)};
RowMetaInterface rm = createRowMetaInterface(valuesMeta);
Object[] r1 = new Object[] { "123", "Jesse", "Adametz", "Santa Barbara" };
Object[] r2 = new Object[] { "456", "James", "Ebentier", "Santa Barbara" };
list.add(new RowMetaAndData(rm, r1));
list.add(new RowMetaAndData(rm, r2));
return list;
}
示例5: getXML
import org.pentaho.di.core.row.ValueMeta; //導入依賴的package包/類
public String getXML()
{
String xml="";
xml+="<"+XML_TAG+">";
xml+=XMLHandler.addTagValue("field_name", fieldName);
xml+=XMLHandler.addTagValue("formula_string", formula);
xml+=XMLHandler.addTagValue("value_type", ValueMeta.getTypeDesc(valueType));
xml+=XMLHandler.addTagValue("value_length", valueLength);
xml+=XMLHandler.addTagValue("value_precision", valuePrecision);
xml+=XMLHandler.addTagValue("replace_field", replaceField);
xml+="</"+XML_TAG+">";
return xml;
}
示例6: createRowMetaInterfaceResult1
import org.pentaho.di.core.row.ValueMeta; //導入依賴的package包/類
/**
* Create the meta data for the results (ltrim/rtrim/trim).
*/
public RowMetaInterface createRowMetaInterfaceResult1()
{
RowMetaInterface rm = new RowMeta();
ValueMetaInterface valuesMeta[] = {
new ValueMeta("string", ValueMeta.TYPE_STRING),
new ValueMeta("bool", ValueMeta.TYPE_BOOLEAN)
};
for (int i=0; i < valuesMeta.length; i++ )
{
rm.addValueMeta(valuesMeta[i]);
}
return rm;
}
示例7: createSourceRowMetaInterface1
import org.pentaho.di.core.row.ValueMeta; //導入依賴的package包/類
public RowMetaInterface createSourceRowMetaInterface1()
{
RowMetaInterface rm = new RowMeta();
ValueMetaInterface valuesMeta[] = {
new ValueMeta("ID", ValueMeta.TYPE_INTEGER, 8, 0),
new ValueMeta("CODE", ValueMeta.TYPE_INTEGER, 8, 0),
};
for (int i=0; i < valuesMeta.length; i++ )
{
rm.addValueMeta(valuesMeta[i]);
}
return rm;
}
示例8: getFields
import org.pentaho.di.core.row.ValueMeta; //導入依賴的package包/類
public void getFields(RowMetaInterface rowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException
{
for (int i=0;i<fieldName.length;i++) {
if (!Const.isEmpty(fieldName[i])) {
int type=ValueMeta.getType(fieldType[i]);
if (type==ValueMetaInterface.TYPE_NONE) type=ValueMetaInterface.TYPE_STRING;
ValueMetaInterface v=new ValueMeta(fieldName[i], type);
v.setLength(fieldLength[i]);
v.setPrecision(fieldPrecision[i]);
v.setOrigin(name);
v.setConversionMask(fieldFormat[i]);
v.setCurrencySymbol(currency[i]);
v.setGroupingSymbol(group[i]);
v.setDecimalSymbol(decimal[i]);
rowMeta.addValueMeta(v);
}
}
}
示例9: get
import org.pentaho.di.core.row.ValueMeta; //導入依賴的package包/類
private void get() {
try {
RowMetaInterface r = transMeta.getPrevStepFields( stepname );
if ( r != null ) {
TableItemInsertListener listener = new TableItemInsertListener() {
public boolean tableItemInserted( TableItem tableItem, ValueMetaInterface v ) {
if ( v.getType() == ValueMeta.TYPE_STRING ) {
// Only process strings
return true;
} else {
return false;
}
}
};
BaseStepDialog.getFieldsFromPrevious( r, wFields, 1, new int[] { 1 }, new int[] {}, -1, -1, listener );
}
} catch ( KettleException ke ) {
new ErrorDialog(
shell, BaseMessages.getString( PKG, "StringOperationsDialog.FailedToGetFields.DialogTitle" ),
BaseMessages.getString( PKG, "StringOperationsDialog.FailedToGetFields.DialogMessage" ), ke );
}
}
示例10: ok
import org.pentaho.di.core.row.ValueMeta; //導入依賴的package包/類
private void ok()
{
if (Const.isEmpty(textStepName.getText())) return;
this.stepname = textStepName.getText();
meta.setFieldToParse(comboFieldToParse.getText());
int nbrFields = tableviewFields.nrNonEmpty();
meta.allocate(nbrFields);
for (int i = 0; i < meta.getFieldName().length; i++)
{
final TableItem item = tableviewFields.getNonEmpty(i);
meta.getFieldName()[i] = item.getText(1);
meta.getXPath()[i] = item.getText(2);
meta.getFieldType()[i] = ValueMeta.getType(item.getText(3));
meta.getFieldFormat()[i] = item.getText(4);
meta.getFieldLength()[i] = Const.toInt(item.getText(5),-1);
meta.getFieldPrecision()[i] = Const.toInt(item.getText(6),-1);
meta.getFieldCurrency()[i] = item.getText(7);
meta.getFieldDecimal()[i] = item.getText(8);
meta.getFieldGroup()[i] = item.getText(9);
meta.getFieldTrimType()[i] = ValueMeta.getTrimTypeByDesc(item.getText(10));
meta.getFieldRepeat()[i] = "Y".equalsIgnoreCase(item.getText(11));
}
this.dispose();
}
示例11: getFields
import org.pentaho.di.core.row.ValueMeta; //導入依賴的package包/類
public void getFields(RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException
{
// change the case insensitive flag too
for (int i=0;i<compareFields.length;i++)
{
int idx = row.indexOfValue(compareFields[i]);
if (idx>=0)
{
row.getValueMeta(idx).setCaseInsensitive(caseInsensitive[i]);
}
}
if (countRows)
{
ValueMetaInterface v = new ValueMeta(countField, ValueMetaInterface.TYPE_INTEGER);
v.setLength(ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0);
v.setOrigin(name);
row.addValueMeta(v);
}
}
示例12: saveRep
import org.pentaho.di.core.row.ValueMeta; //導入依賴的package包/類
public void saveRep(Repository rep, ObjectId id_transformation, ObjectId id_step) throws KettleException
{
try
{
rep.saveDatabaseMetaStepAttribute(id_transformation, id_step, "id_connection", database);
rep.saveStepAttribute(id_transformation, id_step, "procedure", procedure); //$NON-NLS-1$
for (int i = 0; i < argument.length; i++)
{
rep.saveStepAttribute(id_transformation, id_step, i, "arg_name", argument[i]); //$NON-NLS-1$
rep.saveStepAttribute(id_transformation, id_step, i, "arg_direction", argumentDirection[i]); //$NON-NLS-1$
rep.saveStepAttribute(id_transformation, id_step, i, "arg_type", ValueMeta.getTypeDesc(argumentType[i])); //$NON-NLS-1$
}
rep.saveStepAttribute(id_transformation, id_step, "result_name", resultName); //$NON-NLS-1$
rep.saveStepAttribute(id_transformation, id_step, "result_type", ValueMeta.getTypeDesc(resultType)); //$NON-NLS-1$
rep.saveStepAttribute(id_transformation, id_step, "auto_commit", autoCommit); //$NON-NLS-1$
// Also, save the step-database relationship!
if (database != null) rep.insertStepDatabase(id_transformation, id_step, database.getObjectId());
}
catch (Exception e)
{
throw new KettleException(BaseMessages.getString(PKG, "DBProcMeta.Exception.UnableToSaveStepInfo") + id_step, e); //$NON-NLS-1$
}
}
示例13: createResultRowMetaInterface5
import org.pentaho.di.core.row.ValueMeta; //導入依賴的package包/類
public RowMetaInterface createResultRowMetaInterface5()
{
RowMetaInterface rm = new RowMeta();
ValueMetaInterface[] valuesMeta = {
new ValueMeta("PARAM1", ValueMeta.TYPE_STRING),
new ValueMeta("PARAM2", ValueMeta.TYPE_STRING),
};
for (int i=0; i < valuesMeta.length; i++ )
{
rm.addValueMeta(valuesMeta[i]);
}
return rm;
}
示例14: showArguments
import org.pentaho.di.core.row.ValueMeta; //導入依賴的package包/類
public void showArguments() {
RowMetaAndData allArgs = new RowMetaAndData();
for (int ii = 0; ii < arguments.length; ++ii) {
allArgs.addValue(new ValueMeta(Props.STRING_ARGUMENT_NAME_PREFIX + (1 + ii), ValueMetaInterface.TYPE_STRING), arguments[ii]);
}
// Now ask the use for more info on these!
EnterStringsDialog esd = new EnterStringsDialog(shell, SWT.NONE, allArgs);
esd.setTitle(Messages.getString("Spoon.Dialog.ShowArguments.Title"));
esd.setMessage(Messages.getString("Spoon.Dialog.ShowArguments.Message"));
esd.setReadOnly(true);
esd.setShellImage(GUIResource.getInstance().getImageLogoSmall());
esd.open();
}
示例15: getFields
import org.pentaho.di.core.row.ValueMeta; //導入依賴的package包/類
public void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface info[], StepMeta nextStep,
VariableSpace space) throws KettleStepException
{
for(int i=0;i<fieldOutStream.length;i++) {
ValueMetaInterface valueMeta = new ValueMeta(space.environmentSubstitute(fieldOutStream[i]), ValueMeta.TYPE_STRING);
valueMeta.setLength(100, -1);
valueMeta.setOrigin(name);
if (!Const.isEmpty(fieldOutStream[i])){
inputRowMeta.addValueMeta(valueMeta);
} else {
int index = inputRowMeta.indexOfValue(fieldInStream[i]);
if (index>=0) {
valueMeta.setName(fieldInStream[i]);
inputRowMeta.setValueMeta(index, valueMeta);
}
}
}
}