@Override public String getXML() throws KettleValueException { return getXML( 0 ); }
public String getXML() throws KettleException { StringBuilder retval = new StringBuilder( 200 ); retval.append( XMLHandler.addTagValue( "send_true_to", getTrueStepname() ) ); retval.append( XMLHandler.addTagValue( "send_false_to", getFalseStepname() ) ); retval.append( " <compare>" ).append( Const.CR ); if ( condition != null ) { retval.append( condition.getXML() ); } retval.append( " </compare>" ).append( Const.CR ); return retval.toString(); }
@Override public String getXML() throws KettleException { StringBuilder retval = new StringBuilder( 300 ); retval.append( " " ).append( XMLHandler.addTagValue( "directory", directory ) ); retval.append( " " ).append( XMLHandler.addTagValue( "prefix", prefix ) ); retval.append( " " ).append( XMLHandler.addTagValue( "cache_size", cacheSize ) ); if ( mainStepname == null ) { mainStepname = getLookupStepname(); } retval.append( " " ).append( XMLHandler.addTagValue( "main", mainStepname ) ); retval.append( " <compare>" ).append( Const.CR ); if ( condition != null ) { retval.append( condition.getXML() ); } retval.append( " </compare>" ).append( Const.CR ); return retval.toString(); }
@Override public boolean validateTestObject( Condition testObject, Object actual ) { if ( !( actual instanceof Condition ) ) { return false; } Condition another = (Condition) actual; try { return ( testObject.getXML().equals( another.getXML() ) ); } catch ( KettleException ex ) { throw new RuntimeException( ex ); } } }
public String getConditionXML() { String conditionXML = null; try { conditionXML = condition.getXML(); } catch ( KettleValueException e ) { log.logError( e.getMessage() ); } return conditionXML; }
public void saveConditionStepAttribute( ObjectId idTransformation, ObjectId idStep, String code, Condition condition ) throws KettleException { DataNode conditionNode = node.addNode( code ); conditionNode.setProperty( PROPERTY_XML, condition.getXML() ); }
@Override public void saveConditionStepAttribute( ObjectId id_transformation, ObjectId id_step, String code, Condition condition ) throws KettleException { this.saveStepAttribute( id_transformation, id_step, code, condition.getXML() ); }
@Override public void widgetSelected( SelectionEvent e ) { Condition c = active_condition.getCondition( cond_nr ); try { String xml = c.getXML(); GUIResource.getInstance().toClipboard( xml ); widget.redraw(); } catch ( Exception ex ) { new ErrorDialog( shell, "Error", "Error encoding to XML", ex ); } } } );
@Test public void test() throws Exception { check( "SEND_FALSE_STEP", new StringGetter() { public String get() { return meta.getFalseStepname(); } } ); check( "SEND_TRUE_STEP", new StringGetter() { public String get() { return meta.getTrueStepname(); } } ); check( "CONDITION", new StringGetter() { public String get() { return meta.getConditionXML(); } }, new Condition().getXML() ); } }
public String getXML( int level ) throws KettleValueException { String retval = ""; String indent1 = Const.rightPad( " ", level ); String indent2 = Const.rightPad( " ", level + 1 ); String indent3 = Const.rightPad( " ", level + 2 ); retval += indent1 + XMLHandler.openTag( XML_TAG ) + Const.CR; retval += indent2 + XMLHandler.addTagValue( "negated", isNegated() ); if ( getOperator() != OPERATOR_NONE ) { retval += indent2 + XMLHandler.addTagValue( "operator", Const.rtrim( getOperatorDesc() ) ); } if ( isAtomic() ) { retval += indent2 + XMLHandler.addTagValue( "leftvalue", getLeftValuename() ); retval += indent2 + XMLHandler.addTagValue( "function", getFunctionDesc() ); retval += indent2 + XMLHandler.addTagValue( "rightvalue", getRightValuename() ); if ( getRightExact() != null ) { retval += indent2 + getRightExact().getXML(); } } else { retval += indent2 + "<conditions>" + Const.CR; for ( int i = 0; i < nrConditions(); i++ ) { Condition c = getCondition( i ); retval += c.getXML( level + 2 ); } retval += indent3 + "</conditions>" + Const.CR; } retval += indent2 + XMLHandler.closeTag( XML_TAG ) + Const.CR; return retval; }