@Test public void testCheck() { SalesforceInputMeta meta = new SalesforceInputMeta(); meta.setDefault(); List<CheckResultInterface> remarks = new ArrayList<CheckResultInterface>(); meta.check( remarks, null, null, null, null, null, null, null, null, null ); boolean hasError = false; for ( CheckResultInterface cr : remarks ) { if ( cr.getType() == CheckResult.TYPE_RESULT_ERROR ) { hasError = true; } } assertFalse( remarks.isEmpty() ); assertTrue( hasError ); remarks.clear(); meta.setDefault(); meta.setUsername( "user" ); meta.setInputFields( new SalesforceInputField[]{ new SalesforceInputField( "test" ) } ); meta.check( remarks, null, null, null, null, null, null, null, null, null ); hasError = false; for ( CheckResultInterface cr : remarks ) { if ( cr.getType() == CheckResult.TYPE_RESULT_ERROR ) { hasError = true; } } assertFalse( remarks.isEmpty() ); assertFalse( hasError ); remarks.clear(); meta.setDefault(); meta.setUsername( "user" ); meta.setIncludeDeletionDate( true ); meta.setIncludeModule( true ); meta.setIncludeRowNumber( true ); meta.setIncludeSQL( true ); meta.setIncludeTargetURL( true ); meta.setIncludeTimestamp( true ); meta.setInputFields( new SalesforceInputField[]{ new SalesforceInputField( "test" ) } ); meta.check( remarks, null, null, null, null, null, null, null, null, null ); hasError = false; int errorCount = 0; for ( CheckResultInterface cr : remarks ) { if ( cr.getType() == CheckResult.TYPE_RESULT_ERROR ) { hasError = true; errorCount++; } } assertFalse( remarks.isEmpty() ); assertTrue( hasError ); assertEquals( 6, errorCount ); remarks.clear(); meta.setDefault(); meta.setUsername( "user" ); meta.setIncludeDeletionDate( true ); meta.setDeletionDateField( "delDate" ); meta.setIncludeModule( true ); meta.setModuleField( "mod" ); meta.setIncludeRowNumber( true ); meta.setRowNumberField( "rownum" ); meta.setIncludeSQL( true ); meta.setSQLField( "theSQL" ); meta.setIncludeTargetURL( true ); meta.setTargetURLField( "theURL" ); meta.setIncludeTimestamp( true ); meta.setTimestampField( "ts_Field" ); meta.setInputFields( new SalesforceInputField[]{ new SalesforceInputField( "test" ) } ); meta.check( remarks, null, null, null, null, null, null, null, null, null ); hasError = false; for ( CheckResultInterface cr : remarks ) { if ( cr.getType() == CheckResult.TYPE_RESULT_ERROR ) { hasError = true; errorCount++; } } assertFalse( remarks.isEmpty() ); assertFalse( hasError ); }
public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { super.check( remarks, transMeta, stepMeta, prev, input, output, info, space, repository, metaStore ); CheckResult cr; if ( input != null && input.length > 0 ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoInputExpected" ), stepMeta ); } else { cr = new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoInput" ), stepMeta ); } remarks.add( cr ); if ( getInputFields().length == 0 ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoFields" ), stepMeta ); } else { cr = new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.FieldsOk" ), stepMeta ); } remarks.add( cr ); if ( includeTargetURL() && Utils.isEmpty( getTargetURLField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoTargetURLField" ), stepMeta ); remarks.add( cr ); } if ( includeSQL() && Utils.isEmpty( getSQLField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoSQLField" ), stepMeta ); remarks.add( cr ); } if ( includeModule() && Utils.isEmpty( moduleField ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoModuleField" ), stepMeta ); remarks.add( cr ); } if ( includeTimestamp() && Utils.isEmpty( getTimestampField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoTimestampField" ), stepMeta ); remarks.add( cr ); } if ( includeRowNumber() && Utils.isEmpty( getRowNumberField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoRowNumberField" ), stepMeta ); remarks.add( cr ); } if ( includeDeletionDate() && Utils.isEmpty( getDeletionDateField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoDeletionDateField" ), stepMeta ); remarks.add( cr ); } }
SalesforceInputMeta extends SalesforceStepMeta { public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { super.check( remarks, transMeta, stepMeta, prev, input, output, info, space, repository, metaStore ); CheckResult cr; if ( input != null && input.length > 0 ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoInputExpected" ), stepMeta ); } else { cr = new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoInput" ), stepMeta ); } remarks.add( cr ); if ( getInputFields().length == 0 ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoFields" ), stepMeta ); } else { cr = new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.FieldsOk" ), stepMeta ); } remarks.add( cr ); if ( includeTargetURL() && Utils.isEmpty( getTargetURLField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoTargetURLField" ), stepMeta ); remarks.add( cr ); } if ( includeSQL() && Utils.isEmpty( getSQLField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoSQLField" ), stepMeta ); remarks.add( cr ); } if ( includeModule() && Utils.isEmpty( moduleField ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoModuleField" ), stepMeta ); remarks.add( cr ); } if ( includeTimestamp() && Utils.isEmpty( getTimestampField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoTimestampField" ), stepMeta ); remarks.add( cr ); } if ( includeRowNumber() && Utils.isEmpty( getRowNumberField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoRowNumberField" ), stepMeta ); remarks.add( cr ); } if ( includeDeletionDate() && Utils.isEmpty( getDeletionDateField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoDeletionDateField" ), stepMeta ); remarks.add( cr ); } } }
SalesforceInputMeta extends SalesforceStepMeta { public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { super.check( remarks, transMeta, stepMeta, prev, input, output, info, space, repository, metaStore ); CheckResult cr; if ( input != null && input.length > 0 ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoInputExpected" ), stepMeta ); } else { cr = new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoInput" ), stepMeta ); } remarks.add( cr ); if ( getInputFields().length == 0 ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoFields" ), stepMeta ); } else { cr = new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.FieldsOk" ), stepMeta ); } remarks.add( cr ); if ( includeTargetURL() && Utils.isEmpty( getTargetURLField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoTargetURLField" ), stepMeta ); remarks.add( cr ); } if ( includeSQL() && Utils.isEmpty( getSQLField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoSQLField" ), stepMeta ); remarks.add( cr ); } if ( includeModule() && Utils.isEmpty( moduleField ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoModuleField" ), stepMeta ); remarks.add( cr ); } if ( includeTimestamp() && Utils.isEmpty( getTimestampField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoTimestampField" ), stepMeta ); remarks.add( cr ); } if ( includeRowNumber() && Utils.isEmpty( getRowNumberField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoRowNumberField" ), stepMeta ); remarks.add( cr ); } if ( includeDeletionDate() && Utils.isEmpty( getDeletionDateField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoDeletionDateField" ), stepMeta ); remarks.add( cr ); } } SalesforceInputMeta(); }
SalesforceInputMeta extends SalesforceStepMeta { public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { super.check( remarks, transMeta, stepMeta, prev, input, output, info, space, repository, metaStore ); CheckResult cr; if ( input != null && input.length > 0 ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoInputExpected" ), stepMeta ); } else { cr = new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoInput" ), stepMeta ); } remarks.add( cr ); if ( getInputFields().length == 0 ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoFields" ), stepMeta ); } else { cr = new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.FieldsOk" ), stepMeta ); } remarks.add( cr ); if ( includeTargetURL() && Utils.isEmpty( getTargetURLField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoTargetURLField" ), stepMeta ); remarks.add( cr ); } if ( includeSQL() && Utils.isEmpty( getSQLField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoSQLField" ), stepMeta ); remarks.add( cr ); } if ( includeModule() && Utils.isEmpty( moduleField ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoModuleField" ), stepMeta ); remarks.add( cr ); } if ( includeTimestamp() && Utils.isEmpty( getTimestampField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoTimestampField" ), stepMeta ); remarks.add( cr ); } if ( includeRowNumber() && Utils.isEmpty( getRowNumberField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoRowNumberField" ), stepMeta ); remarks.add( cr ); } if ( includeDeletionDate() && Utils.isEmpty( getDeletionDateField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoDeletionDateField" ), stepMeta ); remarks.add( cr ); } } SalesforceInputMeta(); SalesforceInputField[] getInputFields(); void setInputFields( SalesforceInputField[] inputFields ); String getQuery(); void setQuery( String query ); boolean isSpecifyQuery(); void setSpecifyQuery( boolean specifyQuery ); boolean isQueryAll(); void setQueryAll( boolean value ); String getCondition(); void setCondition( String condition ); void setTargetURLField( String TargetURLField ); void setSQLField( String sqlField ); void setTimestampField( String timestampField ); void setModuleField( String module_field ); int getRecordsFilter(); void setRecordsFilter( int recordsFilter ); boolean includeTargetURL(); boolean includeSQL(); void setIncludeSQL( boolean includeSQL ); boolean includeTimestamp(); void setIncludeTimestamp( boolean includeTimestamp ); boolean includeModule(); void setIncludeTargetURL( boolean includeTargetURL ); void setIncludeModule( boolean includemodule ); boolean includeRowNumber(); void setIncludeRowNumber( boolean includeRowNumber ); boolean includeDeletionDate(); void setIncludeDeletionDate( boolean includeDeletionDate ); String getRowLimit(); void setRowLimit( String rowLimit ); String getRowNumberField(); String getDeletionDateField(); void setDeletionDateField( String value ); String getTargetURLField(); String getReadFrom(); void setReadFrom( String readFrom ); String getReadTo(); void setReadTo( String readTo ); String getSQLField(); String getTimestampField(); String getModuleField(); void setRowNumberField( String rowNumberField ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); Object clone(); String getXML(); void allocate( int nrfields ); int getNrFields(); void setDefault(); void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep,
    VariableSpace space, Repository repository, IMetaStore metaStore ); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space,
    Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr,
    TransMeta transMeta, Trans trans ); StepDataInterface getStepData(); }
SalesforceInputMeta extends SalesforceStepMeta { public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { super.check( remarks, transMeta, stepMeta, prev, input, output, info, space, repository, metaStore ); CheckResult cr; if ( input != null && input.length > 0 ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoInputExpected" ), stepMeta ); } else { cr = new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoInput" ), stepMeta ); } remarks.add( cr ); if ( getInputFields().length == 0 ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoFields" ), stepMeta ); } else { cr = new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.FieldsOk" ), stepMeta ); } remarks.add( cr ); if ( includeTargetURL() && Utils.isEmpty( getTargetURLField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoTargetURLField" ), stepMeta ); remarks.add( cr ); } if ( includeSQL() && Utils.isEmpty( getSQLField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoSQLField" ), stepMeta ); remarks.add( cr ); } if ( includeModule() && Utils.isEmpty( moduleField ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoModuleField" ), stepMeta ); remarks.add( cr ); } if ( includeTimestamp() && Utils.isEmpty( getTimestampField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoTimestampField" ), stepMeta ); remarks.add( cr ); } if ( includeRowNumber() && Utils.isEmpty( getRowNumberField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoRowNumberField" ), stepMeta ); remarks.add( cr ); } if ( includeDeletionDate() && Utils.isEmpty( getDeletionDateField() ) ) { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "SalesforceInputMeta.CheckResult.NoDeletionDateField" ), stepMeta ); remarks.add( cr ); } } SalesforceInputMeta(); SalesforceInputField[] getInputFields(); void setInputFields( SalesforceInputField[] inputFields ); String getQuery(); void setQuery( String query ); boolean isSpecifyQuery(); void setSpecifyQuery( boolean specifyQuery ); boolean isQueryAll(); void setQueryAll( boolean value ); String getCondition(); void setCondition( String condition ); void setTargetURLField( String TargetURLField ); void setSQLField( String sqlField ); void setTimestampField( String timestampField ); void setModuleField( String module_field ); int getRecordsFilter(); void setRecordsFilter( int recordsFilter ); boolean includeTargetURL(); boolean includeSQL(); void setIncludeSQL( boolean includeSQL ); boolean includeTimestamp(); void setIncludeTimestamp( boolean includeTimestamp ); boolean includeModule(); void setIncludeTargetURL( boolean includeTargetURL ); void setIncludeModule( boolean includemodule ); boolean includeRowNumber(); void setIncludeRowNumber( boolean includeRowNumber ); boolean includeDeletionDate(); void setIncludeDeletionDate( boolean includeDeletionDate ); String getRowLimit(); void setRowLimit( String rowLimit ); String getRowNumberField(); String getDeletionDateField(); void setDeletionDateField( String value ); String getTargetURLField(); String getReadFrom(); void setReadFrom( String readFrom ); String getReadTo(); void setReadTo( String readTo ); String getSQLField(); String getTimestampField(); String getModuleField(); void setRowNumberField( String rowNumberField ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); Object clone(); String getXML(); void allocate( int nrfields ); int getNrFields(); void setDefault(); void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep,
    VariableSpace space, Repository repository, IMetaStore metaStore ); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space,
    Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr,
    TransMeta transMeta, Trans trans ); StepDataInterface getStepData(); static String DATE_TIME_FORMAT; }