public Object clone() { FieldSplitterMeta retval = (FieldSplitterMeta) super.clone(); final int nrfields = fieldName.length; retval.allocate(nrfields); for (int i = 0; i < nrfields; i++) { retval.fieldName[i] = fieldName[i]; retval.fieldID[i] = fieldID[i]; retval.fieldRemoveID[i] = fieldRemoveID[i]; retval.fieldType[i] = fieldType[i]; retval.fieldLength[i] = fieldLength[i]; retval.fieldPrecision[i] = fieldPrecision[i]; retval.fieldFormat[i] = fieldFormat[i]; retval.fieldGroup[i] = fieldGroup[i]; retval.fieldDecimal[i] = fieldDecimal[i]; retval.fieldCurrency[i] = fieldCurrency[i]; retval.fieldNullIf[i] = fieldNullIf[i]; retval.fieldIfNull[i] = fieldIfNull[i]; retval.fieldTrimType[i] = fieldTrimType[i]; } return retval; }
private void readData(Node stepnode) throws KettleXMLException { try { splitField = XMLHandler.getTagValue(stepnode, "splitfield"); // $NON-NLS-1$ delimiter = XMLHandler.getTagValue(stepnode, "delimiter"); // $NON-NLS-1$ final Node fields = XMLHandler.getSubNode(stepnode, "fields"); // $NON-NLS-1$ final int nrfields = XMLHandler.countNodes(fields, "field"); // $NON-NLS-1$ allocate(nrfields); for (int i = 0; i < nrfields; i++) { final Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i); // $NON-NLS-1$ fieldName[i] = XMLHandler.getTagValue(fnode, "name"); // $NON-NLS-1$ fieldID[i] = XMLHandler.getTagValue(fnode, "id"); // $NON-NLS-1$ final String sidrem = XMLHandler.getTagValue(fnode, "idrem"); // $NON-NLS-1$ final String stype = XMLHandler.getTagValue(fnode, "type"); // $NON-NLS-1$ fieldFormat[i] = XMLHandler.getTagValue(fnode, "format"); // $NON-NLS-1$ fieldGroup[i] = XMLHandler.getTagValue(fnode, "group"); // $NON-NLS-1$ fieldDecimal[i] = XMLHandler.getTagValue(fnode, "decimal"); // $NON-NLS-1$ fieldCurrency[i] = XMLHandler.getTagValue(fnode, "currency"); // $NON-NLS-1$ final String slen = XMLHandler.getTagValue(fnode, "length"); // $NON-NLS-1$ final String sprc = XMLHandler.getTagValue(fnode, "precision"); // $NON-NLS-1$ fieldNullIf[i] = XMLHandler.getTagValue(fnode, "nullif"); // $NON-NLS-1$ fieldIfNull[i] = XMLHandler.getTagValue(fnode, "ifnull"); // $NON-NLS-1$ final String trim = XMLHandler.getTagValue(fnode, "trimtype"); // $NON-NLS-1$ fieldRemoveID[i] = "Y".equalsIgnoreCase(sidrem); // $NON-NLS-1$ fieldType[i] = ValueMeta.getType(stype); fieldLength[i] = Const.toInt(slen, -1); fieldPrecision[i] = Const.toInt(sprc, -1); fieldTrimType[i] = ValueMeta.getTrimTypeByCode(trim); } } catch (Exception e) { throw new KettleXMLException( BaseMessages.getString(PKG, "FieldSplitterMeta.Exception.UnableToLoadStepInfoFromXML"), e); //$NON-NLS-1$ } }
public void readRep( Repository rep, ObjectId id_step, List<DatabaseMeta> databases, Map<String, Counter> counters) throws KettleException { try { splitField = rep.getStepAttributeString(id_step, "splitfield"); // $NON-NLS-1$ delimiter = rep.getStepAttributeString(id_step, "delimiter"); // $NON-NLS-1$ int nrfields = rep.countNrStepAttributes(id_step, "field_name"); // $NON-NLS-1$ allocate(nrfields); for (int i = 0; i < nrfields; i++) { fieldName[i] = rep.getStepAttributeString(id_step, i, "field_name"); // $NON-NLS-1$ fieldID[i] = rep.getStepAttributeString(id_step, i, "field_id"); // $NON-NLS-1$ fieldRemoveID[i] = rep.getStepAttributeBoolean(id_step, i, "field_idrem"); // $NON-NLS-1$ fieldType[i] = ValueMeta.getType(rep.getStepAttributeString(id_step, i, "field_type")); // $NON-NLS-1$ fieldFormat[i] = rep.getStepAttributeString(id_step, i, "field_format"); // $NON-NLS-1$ fieldGroup[i] = rep.getStepAttributeString(id_step, i, "field_group"); // $NON-NLS-1$ fieldDecimal[i] = rep.getStepAttributeString(id_step, i, "field_decimal"); // $NON-NLS-1$ fieldLength[i] = (int) rep.getStepAttributeInteger(id_step, i, "field_length"); // $NON-NLS-1$ fieldPrecision[i] = (int) rep.getStepAttributeInteger(id_step, i, "field_precision"); // $NON-NLS-1$ fieldNullIf[i] = rep.getStepAttributeString(id_step, i, "field_nullif"); // $NON-NLS-1$ fieldIfNull[i] = rep.getStepAttributeString(id_step, i, "field_ifnull"); // $NON-NLS-1$ fieldTrimType[i] = ValueMeta.getTrimTypeByCode( rep.getStepAttributeString(id_step, i, "field_trimtype")); // $NON-NLS-1$ } } catch (Exception e) { throw new KettleException( BaseMessages.getString( PKG, "FieldSplitterMeta.Exception.UnexpectedErrorInReadingStepInfo"), e); //$NON-NLS-1$ } }
public void setDefault() { splitField = ""; // $NON-NLS-1$ delimiter = ","; // $NON-NLS-1$ allocate(0); }