/** * @param key * key to set. * @return new boolean property. * @throws IllegalArgumentException * if key is invalid. */ public BooleanPluginProperty createBoolean( final String key ) throws IllegalArgumentException { final BooleanPluginProperty property = new BooleanPluginProperty( key ); this.properties.add( property ); return property; }
/** * {@inheritDoc} * * @see at.aschauer.commons.pentaho.plugin.PluginProperty#evaluate() */ public boolean evaluate() { return Boolean.TRUE.equals( this.getValue() ); }
/** * {@inheritDoc} * * @see org.pentaho.di.trans.step.StepMetaInterface#setDefault() */ public void setDefault() { this.fastloadPath.setValue( DEFAULT_FASTLOAD_PATH ); this.dataFile.setValue( DEFAULT_DATA_FILE ); this.sessions.setValue( DEFAULT_SESSIONS ); this.errorLimit.setValue( DEFAULT_ERROR_LIMIT ); this.truncateTable.setValue( DEFAULT_TRUNCATETABLE ); this.variableSubstitution.setValue( DEFAULT_VARIABLE_SUBSTITUTION ); this.targetTable.setValue( DEFAULT_TARGET_TABLE ); this.useControlFile.setValue( true ); }
/** * {@inheritDoc} * * @see at.aschauer.commons.pentaho.plugin.PluginProperty#saveToRepositoryStep() */ public void saveToRepositoryStep( final Repository repository, final IMetaStore metaStore, final ObjectId transformationId, final ObjectId stepId ) throws KettleException { repository.saveStepAttribute( transformationId, stepId, this.getKey(), this.getValue() ); }
/** * {@inheritDoc} * * @see at.aschauer.commons.pentaho.plugin.PluginProperty#readFromRepositoryStep(org.pentaho.di.repository.Repository, * long) */ public void readFromRepositoryStep( final Repository repository, final IMetaStore metaStore, final ObjectId stepId ) throws KettleException { final boolean value = repository.getStepAttributeBoolean( stepId, this.getKey() ); this.setValue( value ); }
/** * Execute fastload. * * @throws KettleException * ... */ public void execute() throws KettleException { if ( this.meta.getTruncateTable().getValue() ) { Database db = new Database( this, this.meta.getDbMeta() ); db.connect(); db.truncateTable( this.meta.getTargetTable().getValue() ); db.commit(); db.disconnect(); } startFastLoad(); if ( this.meta.getUseControlFile().getValue() ) { this.invokeLoadingControlFile(); } else { this.invokeLoadingCommand(); } }
/** * 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(); }
setTextIfPropertyValue( this.meta.getSessions(), this.wSessions ); setTextIfPropertyValue( this.meta.getConnectionName(), this.wConnection ); this.wbTruncateTable.setSelection( this.meta.getTruncateTable().getValue() ); this.wUseControlFile.setSelection( this.meta.getUseControlFile().getValue() ); this.wVariableSubstitution.setSelection( this.meta.getVariableSubstitution().getValue() );
/** * {@inheritDoc} * * @see org.pentaho.di.trans.step.BaseStepMeta#getRequiredFields(org.pentaho.di.core.variables.VariableSpace) */ @Override public RowMetaInterface getRequiredFields( final VariableSpace space ) throws KettleException { if ( !this.useControlFile.getValue() ) { final Database database = connectToDatabase(); database.shareVariablesWith( space ); RowMetaInterface fields = database.getTableFieldsMeta( StringUtils.EMPTY, space.environmentSubstitute( this.targetTable.getValue() ) ); database.disconnect(); if ( fields == null ) { throw new KettleException( MESSAGES.getString( "TeraFastMeta.Exception.TableNotFound" ) ); } return fields; } return null; }