/** * Assert state, value not null. * * @throws IllegalStateException * if this.value is null. */ public void assertValueNotNull() throws IllegalStateException { if ( this.getValue() == null ) { throw new IllegalStateException( "Value is null" ); } }
/** * {@inheritDoc} * * @see at.aschauer.commons.pentaho.plugin.PluginProperty#evaluate() */ public boolean evaluate() { return CollectionPredicates.NOT_NULL_OR_EMPTY_COLLECTION.evaluate( this.getValue() ); }
/** * @return true if list is empty . */ public boolean isEmpty() { this.assertValueNotNull(); return this.getValue().isEmpty(); }
/** * {@inheritDoc} * * @see java.lang.Iterable#iterator() */ public Iterator<String> iterator() throws IllegalStateException { this.assertValueNotNull(); return this.getValue().iterator(); }
/** * @return size * @throws IllegalStateException * if value is null. */ public int size() throws IllegalStateException { this.assertValueNotNull(); return this.getValue().size(); }
/** * {@inheritDoc} * * @see at.aschauer.commons.pentaho.plugin.PluginProperty#saveToPreferences(java.util.prefs.Preferences) */ public void saveToPreferences( final Preferences node ) { node.put( this.getKey(), asString( this.getValue() ) ); }
/** * {@inheritDoc} * * @see at.aschauer.commons.pentaho.plugin.PluginProperty#appendXml(java.lang.StringBuilder) */ public void appendXml( final StringBuilder builder ) { if ( !this.evaluate() ) { return; } final String value = asString( this.getValue() ); builder.append( XMLHandler.addTagValue( this.getKey(), value ) ); }
/** * {@inheritDoc} * * @see at.aschauer.commons.pentaho.plugin.PluginProperty#readFromPreferences(java.util.prefs.Preferences) */ public void readFromPreferences( final Preferences node ) { final String stringValue = node.get( this.getKey(), asString( this.getValue() ) ); this.setValue( fromString( stringValue ) ); }
/** * {@inheritDoc} * * @see at.aschauer.commons.pentaho.plugin.PluginProperty#saveToRepositoryStep(org.pentaho.di.repository.Repository, * long, long) */ public void saveToRepositoryStep( final Repository repository, final IMetaStore metaStore, final ObjectId transformationId, final ObjectId stepId ) throws KettleException { final String stringValue = asString( this.getValue() ); repository.saveStepAttribute( transformationId, stepId, this.getKey(), stringValue ); }
for ( int i = 0; i < targetTableFields.size(); i++ ) { ValueMetaInterface value = targetTableFields.getValueMeta( i ); int tableIndex = tableFieldList.getValue().indexOf( value.getName() ); if ( tableIndex >= 0 ) { this.builder.append( value.getName() );
/** * @param targetTableFields * ... * @param tableFieldList * @param tableName * ... * @return ... */ public FastloadControlBuilder insert( final RowMetaInterface targetTableFields, StringListPluginProperty tableFieldList, final String tableName ) { Assert.assertNotNull( targetTableFields, "targetTableFields cannot be null." ); Assert.assertNotNull( tableName, "TableName cannot be null." ); this.builder.append( "INSERT INTO " + tableName + "(" ); for ( int i = 0; i < targetTableFields.size(); i++ ) { int tableIndex = tableFieldList.getValue().indexOf( targetTableFields.getValueMeta( i ).getName() ); if ( tableIndex >= 0 ) { this.builder.append( ":" + targetTableFields.getValueMeta( i ).getName() ); if ( targetTableFields.getValueMeta( i ).getType() == ValueMetaInterface.TYPE_DATE ) { this.builder.append( "(DATE, FORMAT '" ); this.builder.append( DEFAULT_DATE_FORMAT ); this.builder.append( "')" ); } if ( i < tableFieldList.size() - 1 ) { this.builder.append( "," ); } } } this.builder.append( ")" ); return this.newline(); }
this.wVariableSubstitution.setSelection( this.meta.getVariableSubstitution().getValue() ); if ( this.meta.getTableFieldList().getValue().size() == this.meta.getStreamFieldList().getValue().size() ) { for ( int i = 0; i < this.meta.getTableFieldList().getValue().size(); i++ ) { TableItem item = this.wReturn.table.getItem( i ); item.setText( 1, this.meta.getTableFieldList().getValue().get( i ) ); item.setText( 2, this.meta.getStreamFieldList().getValue().get( i ) );
/** * Ok clicked. */ public void ok() { this.stepname = this.wStepname.getText(); // return value this.meta.getUseControlFile().setValue( this.wUseControlFile.getSelection() ); this.meta.getVariableSubstitution().setValue( this.wVariableSubstitution.getSelection() ); this.meta.getControlFile().setValue( this.wControlFile.getText() ); this.meta.getFastloadPath().setValue( this.wFastLoadPath.getText() ); this.meta.getDataFile().setValue( this.wDataFile.getText() ); this.meta.getLogFile().setValue( this.wLogFile.getText() ); this.meta.getErrorLimit().setValue( Const.toInt( this.wErrLimit.getText(), TeraFastMeta.DEFAULT_ERROR_LIMIT ) ); this.meta.getSessions().setValue( Const.toInt( this.wSessions.getText(), TeraFastMeta.DEFAULT_SESSIONS ) ); this.meta.getTargetTable().setValue( this.wTable.getText() ); this.meta.getConnectionName().setValue( this.wConnection.getText() ); this.meta.getTruncateTable().setValue( this.wbTruncateTable.getSelection() && this.wbTruncateTable.getEnabled() ); this.meta.setDbMeta( this.transMeta.findDatabase( this.wConnection.getText() ) ); this.meta.getTableFieldList().getValue().clear(); this.meta.getStreamFieldList().getValue().clear(); int nrfields = this.wReturn.nrNonEmpty(); for ( int i = 0; i < nrfields; i++ ) { TableItem item = this.wReturn.getNonEmpty( i ); this.meta.getTableFieldList().getValue().add( item.getText( 1 ) ); this.meta.getStreamFieldList().getValue().add( item.getText( 2 ) ); } dispose(); }
for ( int i = 0; i < this.tableRowMeta.size(); i++ ) { ValueMetaInterface column = this.tableRowMeta.getValueMeta( i ); int tableIndex = this.meta.getTableFieldList().getValue().indexOf( column.getName() ); if ( tableIndex >= 0 ) { String streamField = this.meta.getStreamFieldList().getValue().get( tableIndex ); this.columnSortOrder.add( streamRowMeta.indexOfValue( streamField ) );