當前位置: 首頁>>代碼示例>>Java>>正文


Java JobExecution.getId方法代碼示例

本文整理匯總了Java中org.springframework.batch.core.JobExecution.getId方法的典型用法代碼示例。如果您正苦於以下問題:Java JobExecution.getId方法的具體用法?Java JobExecution.getId怎麽用?Java JobExecution.getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.batch.core.JobExecution的用法示例。


在下文中一共展示了JobExecution.getId方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: JobExecutionInfo

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
public JobExecutionInfo(JobExecution jobExecution, String baseUrl) {
	resourceIdentifier = jobExecution.getJobInstance().getJobParameters().getString("resource.identifier");
	DateTime sTime = new DateTime(jobExecution.getStartTime());
	DateTime eTime = new DateTime(jobExecution.getEndTime());
	duration = eTime.minus(sTime.getMillis());
	startTime = sTime;
	exitDescription = jobExecution.getExitStatus().getExitDescription();
	exitCode = jobExecution.getExitStatus().getExitCode();
	id = jobExecution.getId();
	jobInstance = baseUrl + "/jobs/"	+ jobExecution.getJobInstance().getJobName() + "/"	+ jobExecution.getJobInstance().getId();
	resource = baseUrl + "/jobs/executions/"	+ jobExecution.getId();
	this.baseUrl = baseUrl;
	status = jobExecution.getStatus();

	Integer writeSkip = 0;
	for (StepExecution stepExecution : jobExecution.getStepExecutions()) {
		recordsRead += stepExecution.getReadCount();
		readSkip += stepExecution.getReadSkipCount();
		processSkip += stepExecution.getProcessSkipCount();
		written += stepExecution.getWriteCount();
		writeSkip += stepExecution.getWriteSkipCount();
	}
}
 
開發者ID:RBGKew,項目名稱:eMonocot,代碼行數:24,代碼來源:JobExecutionInfo.java

示例2: getStepExecution

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
@Override
public StepExecution getStepExecution(JobExecution jobExecution, Long stepExecutionId) {
    XMLDocumentManager docMgr = databaseClient.newXMLDocumentManager();
    String uri = properties.getJobRepositoryDirectory() + "/" +
            jobExecution.getJobInstance().getId() + "/" +
            jobExecution.getId() + "/" +
            stepExecutionId + ".xml";
    JAXBHandle<AdaptedStepExecution> jaxbHandle = new JAXBHandle<AdaptedStepExecution>(jaxbContext());
    DocumentPage page = docMgr.read(uri);
    if (page.getTotalSize() == 0) {
        return null;
    } else {
        AdaptedStepExecution ase = page.next().getContent(jaxbHandle).get();
        StepExecution stepExecution = null;
        try {
            stepExecution = adapter.unmarshal(ase);
        } catch (Exception ex) {
            logger.error(ex.getMessage());
            throw new RuntimeException(ex);
        }
        return stepExecution;
    }
}
 
開發者ID:marklogic-community,項目名稱:marklogic-spring-batch,代碼行數:24,代碼來源:MarkLogicStepExecutionDao.java

示例3: AdaptedJobExecution

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
public AdaptedJobExecution(JobExecution jobExecution) {
    this.id = jobExecution.getId();
    if (jobExecution.getVersion() == null) {
        jobExecution.setVersion(0);
    } else {
        this.version = jobExecution.getVersion();
    }
    this.jobInstance = jobExecution.getJobInstance();
    this.jobParameters = jobExecution.getJobParameters();
    this.createDateTime = jobExecution.getCreateTime();
    this.endDateTime = jobExecution.getEndTime();
    this.lastUpdatedDateTime = jobExecution.getLastUpdated();
    this.startDateTime = jobExecution.getStartTime();
    if (jobExecution.getStatus() == null) {
        this.status = BatchStatus.STARTING.toString();
    } else {
        this.status = jobExecution.getStatus().toString();
    }
    this.exitStatus = jobExecution.getExitStatus().toString();
    for (StepExecution step : jobExecution.getStepExecutions()) {
        stepExecutions.add(step);
    }
    this.executionContext = jobExecution.getExecutionContext();
}
 
開發者ID:marklogic-community,項目名稱:marklogic-spring-batch,代碼行數:25,代碼來源:AdaptedJobExecution.java

示例4: JobExecutionInfo

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
public JobExecutionInfo(JobExecution jobExecution) {
	DateTime sTime = new DateTime(jobExecution.getStartTime());
	DateTime eTime = new DateTime(jobExecution.getEndTime());
	duration = eTime.minus(sTime.getMillis());
	startTime = sTime;
	exitDescription = jobExecution.getExitStatus().getExitDescription();
	exitCode = jobExecution.getExitStatus().getExitCode();
	id = jobExecution.getId();
	status = jobExecution.getStatus();
	jobConfigurationId = jobExecution.getJobParameters().getString("job.configuration.id");

	Integer writeSkip = 0;
	for (StepExecution stepExecution : jobExecution.getStepExecutions()) {
		recordsRead += stepExecution.getReadCount();
		readSkip += stepExecution.getReadSkipCount();
		processSkip += stepExecution.getProcessSkipCount();
		written += stepExecution.getWriteCount();
		writeSkip += stepExecution.getWriteSkipCount();
	}
}
 
開發者ID:RBGKew,項目名稱:powop,代碼行數:21,代碼來源:JobExecutionInfo.java

示例5: createJobExecution

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
private void createJobExecution(String name, BatchStatus status) {
	TaskExecution taskExecution = this.dao.createTaskExecution(name, new Date(), new ArrayList<>(), null);
	JobExecution jobExecution = this.jobRepository.createJobExecution(this.jobRepository.createJobInstance(name, new JobParameters()), new JobParameters(), null);
	StepExecution stepExecution = new StepExecution(name + "_STEP", jobExecution, jobExecution.getId());
	stepExecution.setId(null);
	jobRepository.add(stepExecution);
	this.taskBatchDao.saveRelationship(taskExecution, jobExecution);
	jobExecution.setStatus(status);
	jobExecution.setStartTime(new Date());
	this.jobRepository.update(jobExecution);
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-dataflow,代碼行數:12,代碼來源:JobStepExecutionsDocumentation.java

示例6: addStepExecutions

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
@Override
public void addStepExecutions(JobExecution jobExecution) {
    List<StepExecution> stepExecutionList = new ArrayList<StepExecution>();
    StructuredQueryBuilder qb = new StructuredQueryBuilder(properties.getSearchOptions());
    String directoryUri = properties.getJobRepositoryDirectory() + "/" +
            jobExecution.getJobInstance().getId() + "/" +
            jobExecution.getId() + "/";
    StructuredQueryDefinition querydef = qb.and(
            qb.collection(properties.getStepExecutionCollection()),
            qb.directory(true, directoryUri)
    );
    QueryManager queryMgr = databaseClient.newQueryManager();
    SearchHandle results = queryMgr.search(querydef, new SearchHandle());
    if (results.getTotalResults() > 0L) {
        MatchDocumentSummary[] summaries = results.getMatchResults();
        JAXBHandle<AdaptedStepExecution> handle = new JAXBHandle<AdaptedStepExecution>(jaxbContext());
        AdaptedStepExecution ase = summaries[0].getFirstSnippet(handle).get();
        StepExecution stepExecution = null;
        try {
            stepExecution = adapter.unmarshal(ase);
        } catch (Exception ex) {
            logger.error(ex.getMessage());
            throw new RuntimeException(ex);
        }
        stepExecutionList.add(stepExecution);
    }
    jobExecution.addStepExecutions(stepExecutionList);
}
 
開發者ID:marklogic-community,項目名稱:marklogic-spring-batch,代碼行數:29,代碼來源:MarkLogicStepExecutionDao.java

示例7: saveJobExecution

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
@Override
public void saveJobExecution(JobExecution jobExecution) {
    validateJobExecution(jobExecution);

    if (jobExecution.getId() == null) {
        jobExecution.setId(ThreadLocalRandom.current().nextLong(Long.MAX_VALUE));
    }
    AdaptedJobExecution aJobInstance;
    try {
        aJobInstance = adapter.marshal(jobExecution);
    } catch (Exception ex) {
        logger.error(ex.getMessage());
        throw new RuntimeException(ex);
    }

    XMLDocumentManager xmlDocMgr = databaseClient.newXMLDocumentManager();
    String uri = getUri(jobExecution);

    //Set document metadata
    DocumentMetadataHandle jobInstanceMetadata = new DocumentMetadataHandle();
    jobInstanceMetadata.withCollections(properties.getCollection(), properties.getJobExecutionCollection());
    JAXBHandle<AdaptedJobExecution> handle = new JAXBHandle<AdaptedJobExecution>(jaxbContext());
    handle.set(aJobInstance);

    xmlDocMgr.write(uri, jobInstanceMetadata, handle);
    DocumentDescriptor desc = xmlDocMgr.exists(uri);
    jobExecution.setVersion((int) desc.getVersion());
}
 
開發者ID:marklogic-community,項目名稱:marklogic-spring-batch,代碼行數:29,代碼來源:MarkLogicJobExecutionDao.java

示例8: updateJobExecution

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
@Override
public void updateJobExecution(JobExecution jobExecution) {
    validateJobExecution(jobExecution);
    Assert.notNull(jobExecution.getId(),
            "JobExecution ID cannot be null. JobExecution must be saved before it can be updated");

    Assert.notNull(jobExecution.getVersion(),
            "JobExecution version cannot be null. JobExecution must be saved before it can be updated");

    JobExecution je = getJobExecution(jobExecution.getId());

    if (je == null) {
        throw new NoSuchObjectException("JobExecution " + jobExecution.getJobInstance().getJobName() + " " + jobExecution.getId() + " not found");
    }
    synchronized (jobExecution) {
        AdaptedJobExecution aJobExecution;
        try {
            aJobExecution = adapter.marshal(jobExecution);
        } catch (Exception ex) {
            logger.error(ex.getMessage());
            throw new RuntimeException(ex);
        }

        XMLDocumentManager docMgr = databaseClient.newXMLDocumentManager();
        String uri = getUri(jobExecution);
        DocumentDescriptor desc = docMgr.exists(uri);
        if (jobExecution.getVersion() != (int) desc.getVersion()) {
            throw new OptimisticLockingFailureException(uri);
        }

        //Set document metadata
        DocumentMetadataHandle metadata = new DocumentMetadataHandle();
        metadata.withCollections(properties.getCollection(), properties.getJobExecutionCollection());
        JAXBHandle<AdaptedJobExecution> handle = new JAXBHandle<AdaptedJobExecution>(jaxbContext());
        handle.set(aJobExecution);
        docMgr.write(desc, metadata, handle);
        desc = docMgr.exists(uri);
        jobExecution.setVersion((int) desc.getVersion());
    }
}
 
開發者ID:marklogic-community,項目名稱:marklogic-spring-batch,代碼行數:41,代碼來源:MarkLogicJobExecutionDao.java

示例9: getUri

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
private String getUri(JobExecution jobExecution) {
    return properties.getJobRepositoryDirectory() + "/" +
            jobExecution.getJobInstance().getInstanceId() + "/" +
            jobExecution.getId() + ".xml";
}
 
開發者ID:marklogic-community,項目名稱:marklogic-spring-batch,代碼行數:6,代碼來源:MarkLogicJobExecutionDao.java

示例10: getUri

import org.springframework.batch.core.JobExecution; //導入方法依賴的package包/類
private String getUri(JobExecution jobExecution) {
    return properties.getJobRepositoryDirectory() + "/" +
            jobExecution.getJobInstance().getId() + "/" +
            jobExecution.getId() + "/execution-context.xml";
}
 
開發者ID:marklogic-community,項目名稱:marklogic-spring-batch,代碼行數:6,代碼來源:MarkLogicExecutionContextDao.java


注:本文中的org.springframework.batch.core.JobExecution.getId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。