List of usage examples for org.springframework.batch.core StepExecution getExitStatus
public ExitStatus getExitStatus()
From source file:de.langmi.spring.batch.examples.complex.skip.simple.SkipJobListener.java
@Override public ExitStatus afterStep(StepExecution stepExecution) { LOG.debug("after step"); return stepExecution.getExitStatus(); }
From source file:de.langmi.spring.batch.examples.complex.aggregating.AggregatedItemWriter.java
@Override public ExitStatus afterStep(StepExecution stepExecution) { LOG.debug("afterStep"); stepExecution.getExecutionContext().put("real.write.count", count); return stepExecution.getExitStatus(); }
From source file:org.obiba.onyx.core.etl.participant.impl.AppointmentListUpdateListener.java
/** * Called after the step of the AppointmentUpdateList job. Persists the job resuming data. * @param stepExecution//from www .j a v a2s . c o m * @return */ @AfterStep public ExitStatus afterUpdateCompleted(StepExecution stepExecution) { ExitStatus status = stepExecution.getExitStatus(); if (status.getExitCode().equals("COMPLETED")) { AppointmentUpdateStats appointmentUpdateStats = new AppointmentUpdateStats( stepExecution.getJobParameters().getDate("date"), getAddedParticipants(), getUpdatedParticipants(), getIgnoredParticipants(), getUnreadableParticipants()); appointmentUpdateStats.setFileName(stepExecution.getExecutionContext().get("fileName").toString()); appointmentManagementService.saveAppointmentUpdateStats(appointmentUpdateStats); } AppointmentUpdateLog.addErrorLog(stepExecution.getExecutionContext(), new AppointmentUpdateLog(new Date(), AppointmentUpdateLog.Level.INFO, "End updating appointments")); return status; }
From source file:com.springdeveloper.data.jdbc.batch.JdbcTasklet.java
/** * Execute the {@link #setSql(String) SQL query} provided. If the query * starts with "select" (case insensitive) the result is a list of maps, * which is logged and added to the step execution exit status. Otherwise * the query is executed and the result is an indication, also in the exit * status, of the number of rows updated. *//*from ww w.ja v a 2 s . c o m*/ public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { StepExecution stepExecution = chunkContext.getStepContext().getStepExecution(); ExitStatus exitStatus = stepExecution.getExitStatus(); if (sql.trim().toUpperCase().startsWith("SELECT")) { logger.debug("Executing: " + sql); List<Map<String, Object>> result = jdbcTemplate.queryForList(sql, new BeanPropertySqlParameterSource(chunkContext.getStepContext())); String msg = "Result: " + result; logger.debug(msg); stepExecution.setExitStatus(exitStatus.addExitDescription(msg)); } else { logger.debug("Updating : " + sql); int updated = jdbcTemplate.update(sql, new BeanPropertySqlParameterSource(chunkContext.getStepContext())); String msg = "Updated: " + updated + " rows"; logger.debug(msg); stepExecution.setExitStatus(exitStatus.addExitDescription(msg)); } return RepeatStatus.FINISHED; }
From source file:org.cloudfoundry.identity.uaa.scim.job.ItemWriterSkipListener.java
@Override public ExitStatus afterStep(StepExecution stepExecution) { if (counter.count > 0) { logger.warn("Skipped " + counter.count + " records with no recovery"); }// ww w. j ava 2 s . c o m return stepExecution.getExitStatus(); }
From source file:admin.jmx.SimpleStepExecutionMetrics.java
public String getLatestExitDescription() { StepExecution stepExecution = getLatestStepExecution(stepName); return stepExecution == null ? "" : stepExecution.getExitStatus().getExitDescription(); }
From source file:admin.jmx.SimpleStepExecutionMetrics.java
public String getLatestExitCode() { StepExecution stepExecution = getLatestStepExecution(stepName); return stepExecution == null ? "NONE" : stepExecution.getExitStatus().getExitCode(); }
From source file:com.gopivotal.spring.xd.module.jdbc.JdbcTasklet.java
/** * Execute the {@link #setSql(String) SQL query} provided. If the query starts with "select" (case insensitive) the * result is a list of maps, which is logged and added to the step execution exit status. Otherwise the query is * executed and the result is an indication, also in the exit status, of the number of rows updated. *//* w w w . j a v a 2 s.co m*/ public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { StepExecution stepExecution = chunkContext.getStepContext().getStepExecution(); ExitStatus exitStatus = stepExecution.getExitStatus(); String msg = ""; if (StringUtils.hasText(sql)) { msg = runCommand(chunkContext.getStepContext(), sql); } else if (!CollectionUtils.isEmpty(scripts)) { msg = runScripts(chunkContext, scripts, null); } stepExecution.setExitStatus(exitStatus.addExitDescription(msg)); return RepeatStatus.FINISHED; }
From source file:uk.ac.ebi.intact.editor.batch.admin.MailNotifierStepExecutionListener.java
public ExitStatus afterStep(StepExecution stepExecution) { SimpleMailMessage message = newSimpleMessage(); message.setSubject("[Editor_import] Finished step: " + stepExecution.getStepName() + " Exit status: " + stepExecution.getExitStatus().getExitCode()); message.setText(stepExecution.toString() + "\n" + stepExecution.getExecutionContext()); message.setText(stepExecution.toString() + "\n" + stepExecution.getSummary() + "\n" + stepExecution.getJobExecution()); message.setTo(stepExecution.getJobParameters().getString("email.recipient")); try {/*from w w w .j a v a 2 s. c o m*/ mailSender.send(message); } catch (MailException e) { log.error("Impossible to send e-mail", e); } return stepExecution.getExitStatus(); }
From source file:admin.jmx.SimpleJobExecutionMetrics.java
public String getLatestStepExitDescription() { JobExecution jobExecution = getLatestJobExecution(jobName); StepExecution stepExecution = getLatestStepExecution(jobExecution); return stepExecution == null ? "" : stepExecution.getExitStatus().getExitDescription(); }