public void readRep( Repository rep, ObjectId id_step, List<DatabaseMeta> databases, Map<String, Counter> counters) throws KettleException { try { 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$ fieldType[i] = ValueMeta.getType(rep.getStepAttributeString(id_step, i, "field_type")); // $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$ } selectingAndSortingUnspecifiedFields = rep.getStepAttributeBoolean(id_step, "select_unspecified"); } catch (Exception e) { throw new KettleException( BaseMessages.getString( PKG, "MappingInputMeta.Exception.UnexpectedErrorInReadingStepInfo"), e); //$NON-NLS-1$ } }
private void readData(Node stepnode) throws KettleXMLException { try { Node fields = XMLHandler.getSubNode(stepnode, "fields"); // $NON-NLS-1$ int nrfields = XMLHandler.countNodes(fields, "field"); // $NON-NLS-1$ allocate(nrfields); for (int i = 0; i < nrfields; i++) { Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i); // $NON-NLS-1$ fieldName[i] = XMLHandler.getTagValue(fnode, "name"); // $NON-NLS-1$ fieldType[i] = ValueMeta.getType(XMLHandler.getTagValue(fnode, "type")); // $NON-NLS-1$ String slength = XMLHandler.getTagValue(fnode, "length"); // $NON-NLS-1$ String sprecision = XMLHandler.getTagValue(fnode, "precision"); // $NON-NLS-1$ fieldLength[i] = Const.toInt(slength, -1); fieldPrecision[i] = Const.toInt(sprecision, -1); } selectingAndSortingUnspecifiedFields = "Y".equalsIgnoreCase(XMLHandler.getTagValue(fields, "select_unspecified")); } catch (Exception e) { throw new KettleXMLException( BaseMessages.getString(PKG, "MappingInputMeta.Exception.UnableToLoadStepInfoFromXML"), e); //$NON-NLS-1$ } }
public void setDefault() { int nrfields = 0; selectingAndSortingUnspecifiedFields = false; allocate(nrfields); for (int i = 0; i < nrfields; i++) { fieldName[i] = "field" + i; // $NON-NLS-1$ fieldType[i] = ValueMetaInterface.TYPE_STRING; fieldLength[i] = 30; fieldPrecision[i] = -1; } }
public Object clone() { MappingInputMeta retval = (MappingInputMeta) super.clone(); int nrfields = fieldName.length; retval.allocate(nrfields); for (int i = 0; i < nrfields; i++) { retval.fieldName[i] = fieldName[i]; retval.fieldType[i] = fieldType[i]; fieldLength[i] = fieldLength[i]; fieldPrecision[i] = fieldPrecision[i]; } return retval; }