本文整理汇总了Java中org.pentaho.di.core.Result.setEntryNr方法的典型用法代码示例。如果您正苦于以下问题:Java Result.setEntryNr方法的具体用法?Java Result.setEntryNr怎么用?Java Result.setEntryNr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.Result
的用法示例。
在下文中一共展示了Result.setEntryNr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.pentaho.di.core.Result; //导入方法依赖的package包/类
public Result execute(Result previousResult, int nr, Repository rep, Job parentJob)
{
LogWriter log = LogWriter.getInstance();
Result result = previousResult;
result.setResult(false);
result.setNrErrors(1);
int nrexistcolums=0;
int nrnotexistcolums=0;
if(Const.isEmpty(tablename))
{
log.logError(toString(), Messages.getString("JobEntryColumnsExist.Error.TablenameEmpty"));
return result;
}
if(arguments == null)
{
log.logError(toString(), Messages.getString("JobEntryColumnsExist.Error.ColumnameEmpty"));
return result;
}
if (connection!=null)
{
Database db = new Database(connection);
try
{
String realSchemaname = environmentSubstitute(schemaname);
String realTablename = environmentSubstitute(tablename);
if(!Const.isEmpty(realSchemaname))
realTablename = db.getDatabaseMeta().getQuotedSchemaTableCombination(realSchemaname, realTablename);
else
realTablename = db.getDatabaseMeta().quoteField(realTablename);
db.connect();
if (db.checkTableExists(realTablename))
{
if(log.isDetailed()) log.logDetailed(toString(), Messages.getString("JobEntryColumnsExist.Log.TableExists",realTablename));
for (int i = 0; i < arguments.length && !parentJob.isStopped(); i++)
{
String realColumnname = environmentSubstitute(arguments[i]);
realColumnname=db.getDatabaseMeta().quoteField(realColumnname);
if (db.checkColumnExists(realColumnname,realTablename))
{
if(log.isDetailed()) log.logDetailed(toString(), Messages.getString("JobEntryColumnsExist.Log.ColumnExists",realColumnname,realTablename));
nrexistcolums++;
}else
{
log.logError(toString(), Messages.getString("JobEntryColumnsExist.Log.ColumnNotExists",realColumnname,realTablename));
nrnotexistcolums++;
}
}
}
else
{
log.logError(toString(), Messages.getString("JobEntryColumnsExist.Log.TableNotExists",realTablename));
}
}
catch(KettleDatabaseException dbe)
{
log.logError(toString(), Messages.getString("JobEntryColumnsExist.Error.UnexpectedError",dbe.getMessage()));
}finally
{
if(db!=null) try{db.disconnect();}catch(Exception e){};
}
}
else
{
log.logError(toString(), Messages.getString("JobEntryColumnsExist.Error.NoDbConnection"));
}
result.setEntryNr(nrnotexistcolums);
result.setNrLinesWritten(nrexistcolums);
if(nrnotexistcolums==0) result.setResult(true);
return result;
}
示例2: execute
import org.pentaho.di.core.Result; //导入方法依赖的package包/类
public Result execute(Result previousResult, int nr)
{
Result result = previousResult;
result.setResult(false);
result.setNrErrors(1);
int nrexistcolums=0;
int nrnotexistcolums=0;
if(Const.isEmpty(tablename))
{
logError(BaseMessages.getString(PKG, "JobEntryColumnsExist.Error.TablenameEmpty"));
return result;
}
if(arguments == null)
{
logError(BaseMessages.getString(PKG, "JobEntryColumnsExist.Error.ColumnameEmpty"));
return result;
}
if (connection!=null)
{
Database db = new Database(this, connection);
db.shareVariablesWith(this);
try
{
String realSchemaname = environmentSubstitute(schemaname);
String realTablename = environmentSubstitute(tablename);
if(!Const.isEmpty(realSchemaname))
realTablename = db.getDatabaseMeta().getQuotedSchemaTableCombination(realSchemaname, realTablename);
else
realTablename = db.getDatabaseMeta().quoteField(realTablename);
db.connect();
if (db.checkTableExists(realTablename))
{
if(log.isDetailed()) logDetailed(BaseMessages.getString(PKG, "JobEntryColumnsExist.Log.TableExists",realTablename));
for (int i = 0; i < arguments.length && !parentJob.isStopped(); i++)
{
String realColumnname = environmentSubstitute(arguments[i]);
realColumnname=db.getDatabaseMeta().quoteField(realColumnname);
if (db.checkColumnExists(realColumnname,realTablename))
{
if(log.isDetailed()) logDetailed(BaseMessages.getString(PKG, "JobEntryColumnsExist.Log.ColumnExists",realColumnname,realTablename));
nrexistcolums++;
}else
{
logError(BaseMessages.getString(PKG, "JobEntryColumnsExist.Log.ColumnNotExists",realColumnname,realTablename));
nrnotexistcolums++;
}
}
}
else
{
logError(BaseMessages.getString(PKG, "JobEntryColumnsExist.Log.TableNotExists",realTablename));
}
}
catch(KettleDatabaseException dbe)
{
logError(BaseMessages.getString(PKG, "JobEntryColumnsExist.Error.UnexpectedError",dbe.getMessage()));
}finally
{
if(db!=null) try{db.disconnect();}catch(Exception e){};
}
}
else
{
logError(BaseMessages.getString(PKG, "JobEntryColumnsExist.Error.NoDbConnection"));
}
result.setEntryNr(nrnotexistcolums);
result.setNrLinesWritten(nrexistcolums);
if(nrnotexistcolums==0) result.setResult(true);
return result;
}