本文整理汇总了Java中org.pentaho.di.core.Result.getNrLinesUpdated方法的典型用法代码示例。如果您正苦于以下问题:Java Result.getNrLinesUpdated方法的具体用法?Java Result.getNrLinesUpdated怎么用?Java Result.getNrLinesUpdated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.Result
的用法示例。
在下文中一共展示了Result.getNrLinesUpdated方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: endProcessing
import org.pentaho.di.core.Result; //导入方法依赖的package包/类
public boolean endProcessing(String status, Result res) throws KettleJobException
{
try
{
long read=res.getNrLinesRead();
long written=res.getNrLinesWritten();
long updated=res.getNrLinesUpdated();
long errors=res.getNrErrors();
long input=res.getNrLinesInput();
long output=res.getNrLinesOutput();
if (errors==0 && !res.getResult()) errors=1;
logDate = new Date();
// Change the logging back to stream...
String log_string = null;
if (jobMeta.isLogfieldUsed())
{
log_string = stringAppender.getBuffer().append(Const.CR+"END"+Const.CR).toString();
log.removeAppender(stringAppender);
}
/*
* Sums errors, read, written, etc.
*/
DatabaseMeta logcon = jobMeta.getLogConnection();
if (logcon!=null)
{
Database ldb = new Database(logcon);
ldb.shareVariablesWith(this);
try
{
ldb.connect();
ldb.writeLogRecord(jobMeta.getLogTable(), jobMeta.isBatchIdUsed(), getBatchId(), true, jobMeta.getName(), status,
read,written,updated,input,output,errors,
startDate, endDate, logDate, depDate, currentDate,
log_string
);
}
catch(KettleDatabaseException dbe)
{
addErrors(1);
throw new KettleJobException("Unable to end processing by writing log record to table "+jobMeta.getLogTable(), dbe);
}
finally
{
ldb.disconnect();
}
}
return true;
}
catch(Exception e)
{
throw new KettleJobException(e); // In case something else goes wrong.
}
}
示例2: getLogRecord
import org.pentaho.di.core.Result; //导入方法依赖的package包/类
/**
* This method calculates all the values that are required
* @param id the id to use or -1 if no id is needed
* @param status the log status to use
*/
public RowMetaAndData getLogRecord(LogStatus status, Object subject, Object parent) {
if (subject==null || subject instanceof Job) {
Job job = (Job) subject;
Result result = null;
if (job!=null) result = job.getResult();
RowMetaAndData row = new RowMetaAndData();
for (LogTableField field : fields) {
if (field.isEnabled()) {
Object value = null;
if (job!=null) {
switch(ID.valueOf(field.getId())){
case ID_JOB : value = new Long(job.getBatchId()); break;
case CHANNEL_ID : value = job.getLogChannelId(); break;
case JOBNAME : value = job.getJobname(); break;
case STATUS : value = status.getStatus(); break;
case LINES_READ : value = result==null ? null : new Long(result.getNrLinesRead()); break;
case LINES_WRITTEN : value = result==null ? null : new Long(result.getNrLinesWritten()); break;
case LINES_INPUT : value = result==null ? null : new Long(result.getNrLinesInput()); break;
case LINES_OUTPUT : value = result==null ? null : new Long(result.getNrLinesOutput()); break;
case LINES_UPDATED : value = result==null ? null : new Long(result.getNrLinesUpdated()); break;
case LINES_REJECTED : value = result==null ? null : new Long(result.getNrLinesRejected()); break;
case ERRORS: value = result==null ? null : new Long(result.getNrErrors()); break;
case STARTDATE: value = job.getStartDate(); break;
case LOGDATE: value = job.getLogDate(); break;
case ENDDATE: value = job.getEndDate(); break;
case DEPDATE: value = job.getDepDate(); break;
case REPLAYDATE: value = job.getCurrentDate(); break;
case LOG_FIELD:
value = getLogBuffer(job, job.getLogChannelId(), status, logSizeLimit);
break;
}
}
row.addValue(field.getFieldName(), field.getDataType(), value);
row.getRowMeta().getValueMeta(row.size()-1).setLength(field.getLength());
}
}
return row;
}
else {
return null;
}
}
示例3: getLogRecord
import org.pentaho.di.core.Result; //导入方法依赖的package包/类
/**
* This method calculates all the values that are required
* @param id the id to use or -1 if no id is needed
* @param status the log status to use
* @param subject the object to log
* @param parent the parent to which the object belongs
*/
public RowMetaAndData getLogRecord(LogStatus status, Object subject, Object parent) {
if (subject==null || subject instanceof JobEntryCopy) {
JobEntryCopy jobEntryCopy = (JobEntryCopy) subject;
Job parentJob = (Job) parent;
RowMetaAndData row = new RowMetaAndData();
for (LogTableField field : fields) {
if (field.isEnabled()) {
Object value = null;
if (subject!=null) {
JobEntryInterface jobEntry = jobEntryCopy.getEntry();
JobTracker jobTracker = parentJob.getJobTracker();
JobTracker entryTracker = jobTracker.findJobTracker(jobEntryCopy);
JobEntryResult jobEntryResult = null;
if (entryTracker!=null) {
jobEntryResult = entryTracker.getJobEntryResult();
}
Result result = null;
if (jobEntryResult!=null) {
result = jobEntryResult.getResult();
}
switch(ID.valueOf(field.getId())){
case ID_BATCH : value = new Long(parentJob.getBatchId()); break;
case CHANNEL_ID : value = jobEntry.getLogChannel().getLogChannelId(); break;
case LOG_DATE : value = new Date(); break;
case JOBNAME : value = parentJob.getJobname(); break;
case JOBENTRYNAME : value = jobEntry.getName(); break;
case LINES_READ : value = new Long(result!=null ? result.getNrLinesRead() : 0); break;
case LINES_WRITTEN : value = new Long(result!=null ? result.getNrLinesWritten() : 0); break;
case LINES_UPDATED : value = new Long(result!=null ? result.getNrLinesUpdated() : 0); break;
case LINES_INPUT : value = new Long(result!=null ? result.getNrLinesInput() : 0); break;
case LINES_OUTPUT : value = new Long(result!=null ? result.getNrLinesOutput() : 0); break;
case LINES_REJECTED : value = new Long(result!=null ? result.getNrLinesRejected() : 0); break;
case ERRORS : value = new Long(result!=null ? result.getNrErrors() : 0); break;
case RESULT : value = new Boolean(result!=null ? result.getResult() : false); break;
case NR_RESULT_FILES : value = new Long(result!=null && result.getResultFiles()!=null ? result.getResultFiles().size() : 0); break;
case NR_RESULT_ROWS : value = new Long(result!=null && result.getRows()!=null ? result.getRows().size() : 0); break;
case LOG_FIELD :
if (result!=null) {
value = result.getLogText();
}
break;
case COPY_NR : value = new Long(jobEntryCopy.getNr()); break;
}
}
row.addValue(field.getFieldName(), field.getDataType(), value);
row.getRowMeta().getValueMeta(row.size()-1).setLength(field.getLength());
}
}
return row;
}
else {
return null;
}
}
示例4: getLogRecord
import org.pentaho.di.core.Result; //导入方法依赖的package包/类
/**
* This method calculates all the values that are required
* @param id the id to use or -1 if no id is needed
* @param status the log status to use
* @param subject the subject to query, in this case a Trans object
*/
public RowMetaAndData getLogRecord(LogStatus status, Object subject, Object parent) {
if (subject==null || subject instanceof Trans) {
Trans trans = (Trans) subject;
Result result = null;
if (trans!=null) result = trans.getResult();
RowMetaAndData row = new RowMetaAndData();
for (LogTableField field : fields) {
if (field.isEnabled()) {
Object value = null;
if (trans!=null) {
switch(ID.valueOf(field.getId())){
case ID_BATCH : value = new Long(trans.getBatchId()); break;
case CHANNEL_ID : value = trans.getLogChannelId(); break;
case TRANSNAME : value = trans.getName(); break;
case STATUS : value = status.getStatus(); break;
case LINES_READ : value = new Long(result.getNrLinesRead()); break;
case LINES_WRITTEN : value = new Long(result.getNrLinesWritten()); break;
case LINES_INPUT : value = new Long(result.getNrLinesInput()); break;
case LINES_OUTPUT : value = new Long(result.getNrLinesOutput()); break;
case LINES_UPDATED : value = new Long(result.getNrLinesUpdated()); break;
case LINES_REJECTED : value = new Long(result.getNrLinesRejected()); break;
case ERRORS: value = new Long(result.getNrErrors()); break;
case STARTDATE: value = trans.getStartDate(); break;
case LOGDATE: value = trans.getLogDate(); break;
case ENDDATE: value = trans.getEndDate(); break;
case DEPDATE: value = trans.getDepDate(); break;
case REPLAYDATE: value = trans.getCurrentDate(); break;
case LOG_FIELD:
value = getLogBuffer(trans, trans.getLogChannelId(), status, logSizeLimit);
break;
}
}
row.addValue(field.getFieldName(), field.getDataType(), value);
row.getRowMeta().getValueMeta(row.size()-1).setLength(field.getLength());
}
}
return row;
}
else {
return null;
}
}