use of org.pentaho.di.trans.step.errorhandling.StreamInterface in project pentaho-kettle by pentaho.
the class BaseStepMeta method clone.
/*
* (non-Javadoc)
*
* @see java.lang.Object#clone()
*/
@Override
public Object clone() {
try {
BaseStepMeta retval = (BaseStepMeta) super.clone();
// then the step references must be corrected.
if (ioMeta != null) {
StepIOMetaInterface stepIOMeta = new StepIOMeta(ioMeta.isInputAcceptor(), ioMeta.isOutputProducer(), ioMeta.isInputOptional(), ioMeta.isSortedDataRequired(), ioMeta.isInputDynamic(), ioMeta.isOutputDynamic());
List<StreamInterface> infoStreams = ioMeta.getInfoStreams();
for (StreamInterface infoStream : infoStreams) {
stepIOMeta.addStream(new Stream(infoStream));
}
List<StreamInterface> targetStreams = ioMeta.getTargetStreams();
for (StreamInterface targetStream : targetStreams) {
stepIOMeta.addStream(new Stream(targetStream));
}
retval.ioMeta = stepIOMeta;
}
return retval;
} catch (CloneNotSupportedException e) {
return null;
}
}
use of org.pentaho.di.trans.step.errorhandling.StreamInterface in project pentaho-kettle by pentaho.
the class FuzzyMatchMeta method getXML.
public String getXML() {
StringBuilder retval = new StringBuilder();
StreamInterface infoStream = getStepIOMeta().getInfoStreams().get(0);
retval.append(" " + XMLHandler.addTagValue("from", infoStream.getStepname()));
retval.append(" " + XMLHandler.addTagValue("lookupfield", lookupfield));
retval.append(" " + XMLHandler.addTagValue("mainstreamfield", mainstreamfield));
retval.append(" " + XMLHandler.addTagValue("outputmatchfield", outputmatchfield));
retval.append(" " + XMLHandler.addTagValue("outputvaluefield", outputvaluefield));
retval.append(" " + XMLHandler.addTagValue("caseSensitive", caseSensitive));
retval.append(" " + XMLHandler.addTagValue("closervalue", closervalue));
retval.append(" " + XMLHandler.addTagValue("minimalValue", minimalValue));
retval.append(" " + XMLHandler.addTagValue("maximalValue", maximalValue));
retval.append(" " + XMLHandler.addTagValue("separator", separator));
retval.append(" ").append(XMLHandler.addTagValue("algorithm", getAlgorithmTypeCode(algorithm)));
retval.append(" <lookup>" + Const.CR);
for (int i = 0; i < value.length; i++) {
retval.append(" <value>" + Const.CR);
retval.append(" " + XMLHandler.addTagValue("name", value[i]));
retval.append(" " + XMLHandler.addTagValue("rename", valueName[i]));
retval.append(" </value>" + Const.CR);
}
retval.append(" </lookup>" + Const.CR);
return retval.toString();
}
use of org.pentaho.di.trans.step.errorhandling.StreamInterface in project pentaho-kettle by pentaho.
the class FuzzyMatchMeta method getStepIOMeta.
/**
* Returns the Input/Output metadata for this step. The generator step only produces output, does not accept input!
*/
public StepIOMetaInterface getStepIOMeta() {
if (ioMeta == null) {
ioMeta = new StepIOMeta(true, true, false, false, false, false);
StreamInterface stream = new Stream(StreamType.INFO, null, BaseMessages.getString(PKG, "FuzzyMatchMeta.InfoStream.Description"), StreamIcon.INFO, null);
ioMeta.addStream(stream);
}
return ioMeta;
}
use of org.pentaho.di.trans.step.errorhandling.StreamInterface in project pentaho-kettle by pentaho.
the class FuzzyMatchMeta method readData.
private void readData(Node stepnode, List<? extends SharedObjectInterface> databases) throws KettleXMLException {
try {
String lookupFromStepname = XMLHandler.getTagValue(stepnode, "from");
StreamInterface infoStream = getStepIOMeta().getInfoStreams().get(0);
infoStream.setSubject(lookupFromStepname);
lookupfield = XMLHandler.getTagValue(stepnode, "lookupfield");
mainstreamfield = XMLHandler.getTagValue(stepnode, "mainstreamfield");
caseSensitive = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "caseSensitive"));
closervalue = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "closervalue"));
minimalValue = XMLHandler.getTagValue(stepnode, "minimalValue");
maximalValue = XMLHandler.getTagValue(stepnode, "maximalValue");
separator = XMLHandler.getTagValue(stepnode, "separator");
outputmatchfield = XMLHandler.getTagValue(stepnode, "outputmatchfield");
outputvaluefield = XMLHandler.getTagValue(stepnode, "outputvaluefield");
algorithm = getAlgorithmTypeByCode(Const.NVL(XMLHandler.getTagValue(stepnode, "algorithm"), ""));
Node lookup = XMLHandler.getSubNode(stepnode, "lookup");
int nrvalues = XMLHandler.countNodes(lookup, "value");
allocate(nrvalues);
for (int i = 0; i < nrvalues; i++) {
Node vnode = XMLHandler.getSubNodeByNr(lookup, "value", i);
value[i] = XMLHandler.getTagValue(vnode, "name");
valueName[i] = XMLHandler.getTagValue(vnode, "rename");
if (valueName[i] == null) {
// default: same name to return!
valueName[i] = value[i];
}
}
} catch (Exception e) {
throw new KettleXMLException(BaseMessages.getString(PKG, "FuzzyMatchMeta.Exception.UnableToLoadStepInfoFromXML"), e);
}
}
use of org.pentaho.di.trans.step.errorhandling.StreamInterface in project pentaho-kettle by pentaho.
the class FuzzyMatchMeta method saveRep.
public void saveRep(Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step) throws KettleException {
try {
StreamInterface infoStream = getStepIOMeta().getInfoStreams().get(0);
rep.saveStepAttribute(id_transformation, id_step, "lookup_from_step", infoStream.getStepname());
rep.saveStepAttribute(id_transformation, id_step, "lookupfield", lookupfield);
rep.saveStepAttribute(id_transformation, id_step, "mainstreamfield", mainstreamfield);
rep.saveStepAttribute(id_transformation, id_step, "outputmatchfield", outputmatchfield);
rep.saveStepAttribute(id_transformation, id_step, "outputvaluefield", outputvaluefield);
rep.saveStepAttribute(id_transformation, id_step, "caseSensitive", caseSensitive);
rep.saveStepAttribute(id_transformation, id_step, "closervalue", closervalue);
rep.saveStepAttribute(id_transformation, id_step, "minimalValue", minimalValue);
rep.saveStepAttribute(id_transformation, id_step, "maximalValue", maximalValue);
rep.saveStepAttribute(id_transformation, id_step, "separator", separator);
rep.saveStepAttribute(id_transformation, id_step, "algorithm", getAlgorithmTypeCode(algorithm));
for (int i = 0; i < value.length; i++) {
rep.saveStepAttribute(id_transformation, id_step, i, "return_value_name", value[i]);
rep.saveStepAttribute(id_transformation, id_step, i, "return_value_rename", valueName[i]);
}
} catch (Exception e) {
throw new KettleException(BaseMessages.getString(PKG, "FuzzyMatchMeta.Exception.UnableToSaveStepInfoToRepository") + id_step, e);
}
}
Aggregations