本文整理了Java中org.pentaho.di.core.Const.toLong()
方法的一些代码示例,展示了Const.toLong()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Const.toLong()
方法的具体详情如下:
包路径:org.pentaho.di.core.Const
类名称:Const
方法名:toLong
[英]Convert a String into a long integer. If the conversion fails, assign a default value.
[中]将字符串转换为长整数。如果转换失败,请指定默认值。
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public void setString( String string ) {
this.number = Const.toLong( string, 0L );
}
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public long getInteger() {
return Const.toLong( Const.ltrim( string ), 0L ); // Remove the leading space to make "int to string to int"
// conversion possible.
}
代码示例来源:origin: pentaho/pentaho-kettle
private void getInfo( GetSubFoldersMeta in ) {
stepname = wStepname.getText(); // return value
int nrfiles = wFoldernameList.getItemCount();
in.allocate( nrfiles );
in.setFolderName( wFoldernameList.getItems( 0 ) );
in.setFolderRequired( wFoldernameList.getItems( 1 ) );
in.setIncludeRowNumber( wInclRownum.getSelection() );
in.setDynamicFoldernameField( wFoldernameField.getText() );
in.setFolderField( wFolderField.getSelection() );
in.setRowNumberField( wInclRownumField.getText() );
in.setRowLimit( Const.toLong( wLimit.getText(), 0L ) );
}
代码示例来源:origin: pentaho/pentaho-kettle
public ServerStatus( Node statusNode ) throws KettleException {
this();
statusDescription = XMLHandler.getTagValue( statusNode, "statusdesc" );
memoryFree = Const.toLong( XMLHandler.getTagValue( statusNode, "memory_free" ), -1L );
memoryTotal = Const.toLong( XMLHandler.getTagValue( statusNode, "memory_total" ), -1L );
String cpuCoresStr = XMLHandler.getTagValue( statusNode, "cpu_cores" );
cpuCores = Const.toInt( cpuCoresStr, -1 );
String cpuProcessTimeStr = XMLHandler.getTagValue( statusNode, "cpu_process_time" );
cpuProcessTime = Utils.isEmpty( cpuProcessTimeStr ) ? 0L : Long.valueOf( cpuProcessTimeStr );
uptime = Const.toLong( XMLHandler.getTagValue( statusNode, "uptime" ), -1 );
threadCount = Const.toInt( XMLHandler.getTagValue( statusNode, "thread_count" ), -1 );
loadAvg = Const.toDouble( XMLHandler.getTagValue( statusNode, "load_avg" ), -1.0 );
osName = XMLHandler.getTagValue( statusNode, "os_name" );
osVersion = XMLHandler.getTagValue( statusNode, "os_version" );
osArchitecture = XMLHandler.getTagValue( statusNode, "os_arch" );
}
代码示例来源:origin: pentaho/pentaho-kettle
data.rowLimit = Const.toLong( environmentSubstitute( meta.getRowLimit() ), -1L );
data.rowsWritten = 0L;
data.delay = Const.toLong( environmentSubstitute( meta.getIntervalInMs() ), -1L );
代码示例来源:origin: pentaho/pentaho-kettle
if ( Const.toLong( strLimit, -1L ) <= 0 ) {
cr =
new CheckResult( CheckResultInterface.TYPE_RESULT_WARNING, BaseMessages.getString(
代码示例来源:origin: pentaho/pentaho-kettle
public SlaveServerStatus( Node statusNode ) throws KettleException {
this();
statusDescription = XMLHandler.getTagValue( statusNode, "statusdesc" );
memoryFree = Const.toLong( XMLHandler.getTagValue( statusNode, "memory_free" ), -1L );
memoryTotal = Const.toLong( XMLHandler.getTagValue( statusNode, "memory_total" ), -1L );
String cpuCoresStr = XMLHandler.getTagValue( statusNode, "cpu_cores" );
cpuCores = Const.toInt( cpuCoresStr, -1 );
String cpuProcessTimeStr = XMLHandler.getTagValue( statusNode, "cpu_process_time" );
cpuProcessTime = Utils.isEmpty( cpuProcessTimeStr ) ? 0L : Long.valueOf( cpuProcessTimeStr );
uptime = Const.toLong( XMLHandler.getTagValue( statusNode, "uptime" ), -1 );
threadCount = Const.toInt( XMLHandler.getTagValue( statusNode, "thread_count" ), -1 );
loadAvg = Const.toDouble( XMLHandler.getTagValue( statusNode, "load_avg" ), -1.0 );
osName = XMLHandler.getTagValue( statusNode, "os_name" );
osVersion = XMLHandler.getTagValue( statusNode, "os_version" );
osArchitecture = XMLHandler.getTagValue( statusNode, "os_arch" );
Node listTransNode = XMLHandler.getSubNode( statusNode, "transstatuslist" );
Node listJobsNode = XMLHandler.getSubNode( statusNode, "jobstatuslist" );
int nrTrans = XMLHandler.countNodes( listTransNode, SlaveServerTransStatus.XML_TAG );
int nrJobs = XMLHandler.countNodes( listJobsNode, SlaveServerJobStatus.XML_TAG );
for ( int i = 0; i < nrTrans; i++ ) {
Node transStatusNode = XMLHandler.getSubNodeByNr( listTransNode, SlaveServerTransStatus.XML_TAG, i );
transStatusList.add( new SlaveServerTransStatus( transStatusNode ) );
}
for ( int i = 0; i < nrJobs; i++ ) {
Node jobStatusNode = XMLHandler.getSubNodeByNr( listJobsNode, SlaveServerJobStatus.XML_TAG, i );
jobStatusList.add( new SlaveServerJobStatus( jobStatusNode ) );
}
}
代码示例来源:origin: pentaho/pentaho-kettle
private void getInfo( GetFileNamesMeta in ) {
stepname = wStepname.getText(); // return value
int nrfiles = wFilenameList.getItemCount();
in.allocate( nrfiles );
in.setFileName( wFilenameList.getItems( 0 ) );
in.setFileMask( wFilenameList.getItems( 1 ) );
in.setExcludeFileMask( wFilenameList.getItems( 2 ) );
in.setFileRequired( wFilenameList.getItems( 3 ) );
in.setIncludeSubFolders( wFilenameList.getItems( 4 ) );
in.setFilterFileType( FileInputList.FileTypeFilter.getByOrdinal( wFilterFileType.getSelectionIndex() ) );
in.setIncludeRowNumber( wInclRownum.getSelection() );
in.setAddResultFile( wAddResult.getSelection() );
in.setDynamicFilenameField( wFilenameField.getText() );
in.setDynamicWildcardField( wWildcardField.getText() );
in.setDynamicExcludeWildcardField( wExcludeWildcardField.getText() );
in.setFileField( wFileField.getSelection() );
in.setRowNumberField( wInclRownumField.getText() );
in.setRowLimit( Const.toLong( wLimit.getText(), 0L ) );
in.setDynamicIncludeSubFolders( wIncludeSubFolder.getSelection() );
in.setdoNotFailIfNoFile( wdoNotFailIfNoFile.getSelection() );
}
代码示例来源:origin: pentaho/pentaho-kettle
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) {
meta = (GetSlaveSequenceMeta) smi;
data = (GetSlaveSequenceData) sdi;
if ( super.init( smi, sdi ) ) {
data.increment = Const.toLong( environmentSubstitute( meta.getIncrement() ), 1000 );
data.slaveServer = getTransMeta().findSlaveServer( environmentSubstitute( meta.getSlaveServerName() ) );
data.sequenceName = environmentSubstitute( meta.getSequenceName() );
data.value = -1;
return true;
}
return false;
}
}
代码示例来源:origin: pentaho/pentaho-kettle
private void readData( Node stepnode ) throws KettleXMLException {
try {
includeRowNumber = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "rownum" ) );
isFoldernameDynamic = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "foldername_dynamic" ) );
rowNumberField = XMLHandler.getTagValue( stepnode, "rownum_field" );
dynamicFoldernameField = XMLHandler.getTagValue( stepnode, "foldername_field" );
// Is there a limit on the number of rows we process?
rowLimit = Const.toLong( XMLHandler.getTagValue( stepnode, "limit" ), 0L );
Node filenode = XMLHandler.getSubNode( stepnode, "file" );
int nrfiles = XMLHandler.countNodes( filenode, "name" );
allocate( nrfiles );
for ( int i = 0; i < nrfiles; i++ ) {
Node folderNamenode = XMLHandler.getSubNodeByNr( filenode, "name", i );
Node folderRequirednode = XMLHandler.getSubNodeByNr( filenode, "file_required", i );
folderName[i] = XMLHandler.getNodeValue( folderNamenode );
folderRequired[i] = XMLHandler.getNodeValue( folderRequirednode );
}
} catch ( Exception e ) {
throw new KettleXMLException( "Unable to load step info from XML", e );
}
}
代码示例来源:origin: pentaho/pentaho-kettle
rowLimit = Const.toLong( XMLHandler.getTagValue( stepnode, "limit" ), 0L );
inFields = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "IsInFields" ) );
IsAFile = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "IsAFile" ) );
代码示例来源:origin: pentaho/pentaho-kettle
public long getNextSlaveSequenceValue( String slaveSequenceName, long incrementValue ) throws KettleException {
try {
String xml =
execService( NextSequenceValueServlet.CONTEXT_PATH + "/" + "?" + NextSequenceValueServlet.PARAM_NAME + "="
+ URLEncoder.encode( slaveSequenceName, "UTF-8" ) + "&" + NextSequenceValueServlet.PARAM_INCREMENT + "="
+ Long.toString( incrementValue ) );
Document doc = XMLHandler.loadXMLString( xml );
Node seqNode = XMLHandler.getSubNode( doc, NextSequenceValueServlet.XML_TAG );
String nextValueString = XMLHandler.getTagValue( seqNode, NextSequenceValueServlet.XML_TAG_VALUE );
String errorString = XMLHandler.getTagValue( seqNode, NextSequenceValueServlet.XML_TAG_ERROR );
if ( !Utils.isEmpty( errorString ) ) {
throw new KettleException( errorString );
}
if ( Utils.isEmpty( nextValueString ) ) {
throw new KettleException( "No value retrieved from slave sequence '" + slaveSequenceName + "' on slave "
+ toString() );
}
long nextValue = Const.toLong( nextValueString, Long.MIN_VALUE );
if ( nextValue == Long.MIN_VALUE ) {
throw new KettleException( "Incorrect value '" + nextValueString + "' retrieved from slave sequence '"
+ slaveSequenceName + "' on slave " + toString() );
}
return nextValue;
} catch ( Exception e ) {
throw new KettleException( "There was a problem retrieving a next sequence value from slave sequence '"
+ slaveSequenceName + "' on slave " + toString(), e );
}
}
代码示例来源:origin: pentaho/pentaho-kettle
private void readData( Node stepnode ) throws KettleXMLException {
try {
urlInField = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "url_in_field" ) );
urlFieldname = XMLHandler.getTagValue( stepnode, "url_field_name" );
includeRowNumber = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "rownum" ) );
rowNumberField = XMLHandler.getTagValue( stepnode, "rownum_field" );
includeUrl = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "include_url" ) );
urlField = XMLHandler.getTagValue( stepnode, "url_Field" );
readfrom = XMLHandler.getTagValue( stepnode, "read_from" );
Node fields = XMLHandler.getSubNode( stepnode, "fields" );
int nrFields = XMLHandler.countNodes( fields, "field" );
Node urlnode = XMLHandler.getSubNode( stepnode, "urls" );
int nrUrls = XMLHandler.countNodes( urlnode, "url" );
allocate( nrUrls, nrFields );
for ( int i = 0; i < nrUrls; i++ ) {
Node urlnamenode = XMLHandler.getSubNodeByNr( urlnode, "url", i );
url[i] = XMLHandler.getNodeValue( urlnamenode );
}
for ( int i = 0; i < nrFields; i++ ) {
Node fnode = XMLHandler.getSubNodeByNr( fields, "field", i );
RssInputField field = new RssInputField( fnode );
inputFields[i] = field;
}
// Is there a limit on the number of rows we process?
rowLimit = Const.toLong( XMLHandler.getTagValue( stepnode, "limit" ), 0L );
} catch ( Exception e ) {
throw new KettleXMLException( "Unable to load step info from XML", e );
}
}
代码示例来源:origin: pentaho/pentaho-kettle
rowLimit = Const.toLong( XMLHandler.getTagValue( stepnode, "limit" ), 0L );
代码示例来源:origin: pentaho/pentaho-kettle
in.setRowLimit( Const.toLong( wLimit.getText(), 0L ) );
in.setFilenameField( wInclFilenameField.getText() );
in.setRowNumberField( wInclRownumField.getText() );
代码示例来源:origin: pentaho/pentaho-kettle
data.bulkNumberMeta.setStringEncoding( realEncoding );
data.bulkSize = Const.toLong( environmentSubstitute( meta.getBulkSize() ), -1L );
代码示例来源:origin: pentaho/pentaho-kettle
in.setRowLimit( Const.toLong( wLimit.getText(), 0L ) );
in.setIncludeRowNumber( wInclRownum.getSelection() );
in.setRowNumberField( wInclRownumField.getText() );
代码示例来源:origin: pentaho/pentaho-kettle
in.setRowLimit( Const.toLong( wLimit.getText(), 0L ) );
in.setTableName( wTable.getText() );
in.setIncludeFilename( wInclFilename.getSelection() );
代码示例来源:origin: pentaho/pentaho-kettle
data.nrRowsToSkip = Const.toLong( this.environmentSubstitute( meta.getNrRowsToSkip() ), 0 );
data.rowLimit = Const.toLong( this.environmentSubstitute( meta.getRowLimit() ), 0 );
data.encoding = this.environmentSubstitute( meta.getEncoding() );
代码示例来源:origin: pentaho/pentaho-kettle
table.addValue(
new ValueMetaInteger( KettleDatabaseRepository.FIELD_DATABASE_PORT ), Long.valueOf(
Const.toLong( port, -1 ) ) );
table.addValue( new ValueMetaString(
KettleDatabaseRepository.FIELD_DATABASE_USERNAME ), user );
内容来源于网络,如有侵权,请联系作者删除!