本文整理汇总了Java中org.pentaho.di.core.Result.setResult方法的典型用法代码示例。如果您正苦于以下问题:Java Result.setResult方法的具体用法?Java Result.setResult怎么用?Java Result.setResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.Result
的用法示例。
在下文中一共展示了Result.setResult方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.pentaho.di.core.Result; //导入方法依赖的package包/类
/**
* Execute this job entry and return the result. In this case it means, just
* set the result boolean in the Result class.
*
* @param prev_result
* The result of the previous execution
* @return The Result of the execution.
*/
public Result execute(Result prev_result, int nr) {
boolean result = true;
if(StringUtils.isNotBlank(className)){
try {
//实例化配置的类
JobEntryEasyExpandRunBase kui = (JobEntryEasyExpandRunBase) Class.forName(
environmentSubstitute(className)).newInstance();
kui.setJeku(this);
result = kui.run();
} catch (Exception e) {
prev_result.setNrErrors(1);
result = false;
logError("运行失败,"+className+","+environmentSubstitute(configInfo), e);
}
}
prev_result.setResult(result);
return prev_result;
}
示例2: execute
import org.pentaho.di.core.Result; //导入方法依赖的package包/类
public Result execute(Result prev_result, int nr) {
Result result = new Result(nr);
result.setResult(false);
logDetailed(toString(), "Start of processing");
// String substitution..
IvyLoader proc = new IvyLoader(this);
try {
proc.resolveArtifact();
result.setResult(true);
} catch (Exception e) {
result.setNrErrors(1);
e.printStackTrace();
logError(toString(), "Error processing DummyJob : " + e.getMessage());
}
return result;
}
示例3: getResult
import org.pentaho.di.core.Result; //导入方法依赖的package包/类
public Result getResult(TransMeta transMeta)
{
Result result = new Result();
for (StepStatus stepStatus : stepStatusList) {
result.setNrErrors(result.getNrErrors()+stepStatus.getErrors()+(result.isStopped()?1:0)); // If the remote trans is stopped, count as an error
if (transMeta.getReadStep() !=null && stepStatus.getStepname().equals(transMeta.getReadStep().getName())) {
result.setNrLinesRead(result.getNrLinesRead()+ stepStatus.getLinesRead());
}
if (transMeta.getInputStep() !=null && stepStatus.getStepname().equals(transMeta.getInputStep().getName())) {
result.setNrLinesInput(result.getNrLinesInput() + stepStatus.getLinesInput());
}
if (transMeta.getWriteStep() !=null && stepStatus.getStepname().equals(transMeta.getWriteStep().getName())) {
result.setNrLinesWritten(result.getNrLinesWritten()+stepStatus.getLinesWritten());
}
if (transMeta.getOutputStep() !=null && stepStatus.getStepname().equals(transMeta.getOutputStep().getName())) {
result.setNrLinesOutput(result.getNrLinesOutput()+stepStatus.getLinesOutput());
}
if (transMeta.getUpdateStep() !=null && stepStatus.getStepname().equals(transMeta.getUpdateStep().getName())) {
result.setNrLinesUpdated(result.getNrLinesUpdated()+stepStatus.getLinesUpdated());
}
if (transMeta.getRejectedStep()!=null && stepStatus.getStepname().equals(transMeta.getRejectedStep().getName())) {
result.setNrLinesRejected(result.getNrLinesRejected()+stepStatus.getLinesRejected());
}
if (stepStatus.isStopped()) {
result.setStopped(true);
result.setResult(false);
}
}
return result;
}
示例4: execute
import org.pentaho.di.core.Result; //导入方法依赖的package包/类
/**
* Execute this job entry and return the result.
* In this case it means, just set the result boolean in the Result class.
* @param previousResult The result of the previous execution
* @return The Result of the execution.
*/
public Result execute(Result previousResult, int nr) {
previousResult.setResult(evaluate(previousResult));
// we fail so stop
// job execution
parentJob.stopAll();
return previousResult;
}
示例5: 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 );
if (filename!=null)
{
String realFilename = getRealFilename();
try
{
FileObject file = KettleVFS.getFileObject(realFilename);
if (file.exists() && file.isReadable())
{
log.logDetailed(toString(), Messages.getString("JobEntryFileExists.File_Exists", realFilename)); //$NON-NLS-1$
result.setResult( true );
}
else
{
log.logDetailed(toString(), Messages.getString("JobEntryFileExists.File_Does_Not_Exist", realFilename)); //$NON-NLS-1$
}
}
catch (IOException e)
{
result.setNrErrors(1);
log.logError(toString(), Messages.getString("JobEntryFileExists.ERROR_0004_IO_Exception", e.toString())); //$NON-NLS-1$
}
}
else
{
result.setNrErrors(1);
log.logError(toString(), Messages.getString("JobEntryFileExists.ERROR_0005_No_Filename_Defined")); //$NON-NLS-1$
}
return result;
}
示例6: getResult
import org.pentaho.di.core.Result; //导入方法依赖的package包/类
public Result getResult(TransMeta transMeta)
{
Result result = new Result();
for (StepStatus stepStatus : stepStatusList) {
result.setNrErrors(result.getNrErrors()+stepStatus.getErrors()+(result.isStopped()?1:0)); // If the remote trans is stopped, count as an error
if (stepStatus.getStepname().equals(transMeta.getTransLogTable().getStepnameRead())) {
result.increaseLinesRead(stepStatus.getLinesRead());
}
if (stepStatus.getStepname().equals(transMeta.getTransLogTable().getStepnameInput())) {
result.increaseLinesInput(stepStatus.getLinesInput());
}
if (stepStatus.getStepname().equals(transMeta.getTransLogTable().getStepnameWritten())) {
result.increaseLinesWritten(stepStatus.getLinesWritten());
}
if (stepStatus.getStepname().equals(transMeta.getTransLogTable().getStepnameOutput())) {
result.increaseLinesOutput(stepStatus.getLinesOutput());
}
if (stepStatus.getStepname().equals(transMeta.getTransLogTable().getStepnameUpdated())) {
result.increaseLinesUpdated(stepStatus.getLinesUpdated());
}
if (stepStatus.getStepname().equals(transMeta.getTransLogTable().getStepnameRejected())) {
result.increaseLinesRejected(stepStatus.getLinesRejected());
}
if (stepStatus.isStopped()) {
result.setStopped(true);
result.setResult(false);
}
}
return result;
}
示例7: execute
import org.pentaho.di.core.Result; //导入方法依赖的package包/类
public Result execute(Result previousResult, int nr) throws KettleJobException
{
Result result = previousResult;
if (isStart())
{
try {
long sleepTime = getNextExecutionTime();
if (sleepTime>0) {
parentJob.getLogChannel().logBasic(parentJob.getJobname(), "Sleeping: " + (sleepTime/1000/60) + " minutes (sleep time="+sleepTime+")");
long totalSleep = 0L;
while (totalSleep<sleepTime && !parentJob.isStopped()) {
Thread.sleep(1000L);
totalSleep+=1000L;
}
}
} catch (InterruptedException e) {
throw new KettleJobException(e);
}
result = previousResult;
result.setResult( true );
}
else
if (isDummy()) {
result = previousResult;
}
return result;
}
示例8: execute
import org.pentaho.di.core.Result; //导入方法依赖的package包/类
public Result execute(Result previousResult, int nr)
{
Result result = previousResult;
result.setResult( false );
if (filename!=null)
{
String realFilename = getRealFilename();
try
{
FileObject file = KettleVFS.getFileObject(realFilename, this);
if (file.exists() && file.isReadable())
{
logDetailed(BaseMessages.getString(PKG, "JobEntryFileExists.File_Exists", realFilename)); //$NON-NLS-1$
result.setResult( true );
}
else
{
logDetailed(BaseMessages.getString(PKG, "JobEntryFileExists.File_Does_Not_Exist", realFilename)); //$NON-NLS-1$
}
}
catch (Exception e)
{
result.setNrErrors(1);
logError(BaseMessages.getString(PKG, "JobEntryFileExists.ERROR_0004_IO_Exception", e.getMessage()), e); //$NON-NLS-1$
}
}
else
{
result.setNrErrors(1);
logError(BaseMessages.getString(PKG, "JobEntryFileExists.ERROR_0005_No_Filename_Defined")); //$NON-NLS-1$
}
return result;
}
示例9: execute
import org.pentaho.di.core.Result; //导入方法依赖的package包/类
/**
* Execute this job entry and return the result.
* In this case it means, just set the result boolean in the Result class.
* @param previousResult The result of the previous execution
* @return The Result of the execution.
*/
public Result execute(Result previousResult, int nr, Repository rep, Job parentJob) {
previousResult.setResult(evaluate(previousResult));
// we fail so stop
// job execution
parentJob.stopAll();
return previousResult;
}
示例10: execute
import org.pentaho.di.core.Result; //导入方法依赖的package包/类
public Result execute(Result previousResult, int nr)
{
Result result = previousResult;
result.setNrErrors(1);
result.setResult(false);
String hostname = getRealHostname();
int timeoutInt = Const.toInt(getRealTimeOut(), 300);
int packets = Const.toInt(getRealNbrPackets(), 2);
boolean status =false;
if (Const.isEmpty(hostname))
{
// No Host was specified
logError(BaseMessages.getString(PKG, "JobPing.SpecifyHost.Label"));
return result;
}
try
{
if(ipingtype==isystemPing || ipingtype==ibothPings)
{
// Perform a system (Java) ping ...
status=systemPing(hostname, timeoutInt);
if(status)
{
if(log.isDetailed())
log.logDetailed(BaseMessages.getString(PKG, "JobPing.SystemPing"), BaseMessages.getString(PKG, "JobPing.OK.Label",hostname));
}else
log.logError(BaseMessages.getString(PKG, "JobPing.SystemPing"),BaseMessages.getString(PKG, "JobPing.NOK.Label",hostname));
}
if((ipingtype==iclassicPing) || (ipingtype==ibothPings && !status))
{
// Perform a classic ping ..
status=classicPing(hostname, packets);
if(status)
{
if(log.isDetailed())
log.logDetailed(BaseMessages.getString(PKG, "JobPing.ClassicPing"), BaseMessages.getString(PKG, "JobPing.OK.Label",hostname));
}else
log.logError(BaseMessages.getString(PKG, "JobPing.ClassicPing"),BaseMessages.getString(PKG, "JobPing.NOK.Label",hostname));
}
}
catch (Exception ex)
{
logError(BaseMessages.getString(PKG, "JobPing.Error.Label") + ex.getMessage());
}
if (status)
{
if(log.isDetailed())
logDetailed(BaseMessages.getString(PKG, "JobPing.OK.Label",hostname));
result.setNrErrors(0);
result.setResult(true);
}else
logError(BaseMessages.getString(PKG, "JobPing.NOK.Label",hostname));
return result;
}
示例11: 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);
filescount=0;
folderscount=0;
pattern = null;
if (!Const.isEmpty(getWildcard())) pattern = Pattern.compile(getRealWildcard());
if (foldername!=null)
{
String realFoldername = getRealFoldername();
FileObject FolderObject = null;
try {
FolderObject = KettleVFS.getFileObject(realFoldername);
if ( FolderObject.exists() )
{
//Check if it's a folder
if(FolderObject.getType() == FileType.FOLDER)
{
// File provided is a folder, so we can process ...
FolderObject.findFiles(new TextFileSelector(FolderObject.toString()));
if(log.isBasic()) log.logBasic("Total files", "We found : "+filescount + " file(s)");
if(filescount==0)
{
result.setResult(true);
result.setNrErrors(0);
}
}
else
{
// Not a folder, fail
log.logError("Found files", "[" + realFoldername+"] is not a folder, failing.");
}
}
else
{
// No Folder found
if(log.isBasic()) log.logBasic(toString(), "we can not find ["+realFoldername+"] !");
}
} catch (IOException e) {
log.logError(toString(), "Could not create Folder ["+realFoldername+"], exception: " + e.getMessage());
result.setResult( false );
result.setNrErrors(1);
}
finally {
if ( FolderObject != null )
{
try {
FolderObject.close();
}
catch ( IOException ex ) {};
}
}
}
else
{
log.logError(toString(), "No Foldername is defined.");
}
return result;
}
示例12: 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;
}
示例13: execute
import org.pentaho.di.core.Result; //导入方法依赖的package包/类
/**
* Execute this job entry and return the result.
* In this case it means, just set the result boolean in the Result class.
* @param previousResult The result of the previous execution
* @return The Result of the execution.
*/
public Result execute(Result previousResult, int nr)
{
Result result = previousResult;
result.setNrErrors(1);
result.setResult(false);
String realEmailAddress=environmentSubstitute(emailAddress);
if(Const.isEmpty(realEmailAddress))
{
logError(BaseMessages.getString(PKG, "JobEntryMailValidator.Error.EmailEmpty"));
return result;
}
String realSender=environmentSubstitute(emailSender);
if(smtpCheck)
{
// check sender
if(Const.isEmpty(realSender))
{
logError(BaseMessages.getString(PKG, "JobEntryMailValidator.Error.EmailSenderEmpty"));
return result;
}
}
String realDefaultSMTP=environmentSubstitute(defaultSMTP);
int timeOut=Const.toInt(environmentSubstitute(timeout), 0);
// Split the mail-address: separated by space
String mailsCheck[] = realEmailAddress.split(" ");
boolean exitloop=false;
boolean mailIsValid=false;
String MailError=null;
for (int i = 0; i < mailsCheck.length && !exitloop; i++)
{
String email = mailsCheck[i];
if(log.isDetailed())
logDetailed(BaseMessages.getString(PKG, "JobEntryMailValidator.CheckingMail",email));
// Check if address is valid
MailValidationResult resultValidator=MailValidation.isAddressValid(log, email, realSender, realDefaultSMTP,timeOut,smtpCheck);
mailIsValid=resultValidator.isValide();
MailError=resultValidator.getErrorMessage();
if(log.isDetailed())
{
if(mailIsValid)
logDetailed(BaseMessages.getString(PKG, "JobEntryMailValidator.MailValid",email));
else
{
logDetailed(BaseMessages.getString(PKG, "JobEntryMailValidator.MailNotValid",email));
logDetailed(MailError);
}
}
// invalid mail? exit loop
if(!resultValidator.isValide()) exitloop=true;
}
result.setResult(mailIsValid);
if(mailIsValid) result.setNrErrors(0);
// return result
return result;
}
示例14: 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.setNrErrors(1);
result.setResult(false);
String hostname = getRealHostname();
int timeoutInt = Const.toInt(getRealTimeOut(), 300);
int packets = Const.toInt(getRealNbrPackets(), 2);
boolean status =false;
if (Const.isEmpty(hostname))
{
// No Host was specified
log.logError(toString(), Messages.getString("JobPing.SpecifyHost.Label"));
return result;
}
try
{
if(ipingtype==isystemPing || ipingtype==ibothPings)
{
// Perform a system (Java) ping ...
status=systemPing(hostname, timeoutInt,log);
if(status)
{
if(log.isDetailed())
log.logDetailed(Messages.getString("JobPing.SystemPing"), Messages.getString("JobPing.OK.Label",hostname));
}else
log.logError(Messages.getString("JobPing.SystemPing"),Messages.getString("JobPing.NOK.Label",hostname));
}
if((ipingtype==iclassicPing) || (ipingtype==ibothPings && !status))
{
// Perform a classic ping ..
status=classicPing(hostname, packets,log);
if(status)
{
if(log.isDetailed())
log.logDetailed(Messages.getString("JobPing.ClassicPing"), Messages.getString("JobPing.OK.Label",hostname));
}else
log.logError(Messages.getString("JobPing.ClassicPing"),Messages.getString("JobPing.NOK.Label",hostname));
}
}
catch (Exception ex)
{
log.logError(toString(), Messages.getString("JobPing.Error.Label") + ex.getMessage());
}
if (status)
{
if(log.isDetailed())
log.logDetailed(toString(), Messages.getString("JobPing.OK.Label",hostname));
result.setNrErrors(0);
result.setResult(true);
}else
log.logError(toString(), Messages.getString("JobPing.NOK.Label",hostname));
return result;
}
示例15: execute
import org.pentaho.di.core.Result; //导入方法依赖的package包/类
/**
* Execute this job entry and return the result.
* In this case it means, just set the result boolean in the Result class.
* @param previousResult The result of the previous execution
* @return The Result of the execution.
*/
public Result execute(Result previousResult, int nr, Repository rep, Job parentJob)
{
Result result = previousResult;
result.setNrErrors(1);
result.setResult(false);
LogWriter log = LogWriter.getInstance();
if(rep==null)
{
log.logError(toString(), Messages.getString("JobEntryConnectedToRepository.Log.NotConnected"));
return result;
}
if(isspecificrep)
{
if(Const.isEmpty(repname))
{
log.logError(toString(), Messages.getString("JobEntryConnectedToRepository.Error.NoRep"));
return result;
}
String Reponame=environmentSubstitute(repname);
if(!Reponame.equals(rep.getName()))
{
log.logError(toString(), Messages.getString("JobEntryConnectedToRepository.Error.DiffRep",rep.getName(),Reponame));
return result;
}
}
if(isspecificuser)
{
if(Const.isEmpty(username))
{
log.logError(toString(), Messages.getString("JobEntryConnectedToRepository.Error.NoUser"));
return result;
}
String Username=environmentSubstitute(username);
if(!Username.equals(rep.getUserInfo().getLogin()))
{
log.logError(toString(), Messages.getString("JobEntryConnectedToRepository.Error.DiffUser",rep.getUserInfo().getLogin(),Username));
return result;
}
}
if(log.isDetailed()) log.logDetailed(toString(), Messages.getString("JobEntryConnectedToRepository.Log.Connected",rep.getName(),rep.getUserInfo().getLogin()));
result.setResult(true);
result.setNrErrors(0);
return result;
}