Package org.springframework.batch.item

Examples of org.springframework.batch.item.ExecutionContext.containsKey()


  @Override
  protected void doExecute(StepExecution stepExecution) throws Exception {
    ExecutionContext executionContext = stepExecution.getJobExecution().getExecutionContext();
    List<javax.batch.runtime.StepExecution> stepExecutions = new ArrayList<javax.batch.runtime.StepExecution>();

    if(executionContext.containsKey("batch.lastSteps")) {
      List<String> stepNames = (List<String>) executionContext.get("batch.lastSteps");

      for (String stepName : stepNames) {
        StepExecution curStepExecution = getJobRepository().getLastStepExecution(stepExecution.getJobExecution().getJobInstance(), stepName);
        stepExecutions.add(new JsrStepExecution(curStepExecution));
View Full Code Here


      ExitStatus exitStatus = new ExitStatus(decider.decide(stepExecutions.toArray(new javax.batch.runtime.StepExecution[0])));

      stepExecution.getJobExecution().setExitStatus(exitStatus);
      stepExecution.setExitStatus(exitStatus);

      if(executionContext.containsKey("batch.lastSteps")) {
        executionContext.remove("batch.lastSteps");
      }
    } catch (Exception e) {
      stepExecution.setTerminateOnly();
      stepExecution.addFailureException(e);
View Full Code Here

    ExecutionContext executionContext = stepExecution.getExecutionContext();

    executionContext.put(STEP_TYPE_KEY, this.getClass().getName());

    JobParameters jobParameters;
    if (executionContext.containsKey(JOB_PARAMETERS_KEY)) {
      jobParameters = (JobParameters) executionContext.get(JOB_PARAMETERS_KEY);
    }
    else {
      jobParameters = jobParametersExtractor.getJobParameters(job, stepExecution);
      executionContext.put(JOB_PARAMETERS_KEY, jobParameters);
View Full Code Here

      }
    }
    for (String key : keys) {
      if (key.endsWith("(long)")) {
        key = key.replace("(long)", "");
        if (executionContext.containsKey(key)) {
          builder.addLong(key, executionContext.getLong(key));
        }
        else if (jobParameters.containsKey(key)) {
          builder.addLong(key, (Long) jobParameters.get(key).getValue());
        }
View Full Code Here

          builder.addLong(key, (Long) jobParameters.get(key).getValue());
        }
      }
      else if (key.endsWith("(int)")) {
        key = key.replace("(int)", "");
        if (executionContext.containsKey(key)) {
          builder.addLong(key, (long) executionContext.getInt(key));
        }
        else if (jobParameters.containsKey(key)) {
          builder.addLong(key, (Long) jobParameters.get(key).getValue());
        }
View Full Code Here

          builder.addLong(key, (Long) jobParameters.get(key).getValue());
        }
      }
      else if (key.endsWith("(double)")) {
        key = key.replace("(double)", "");
        if (executionContext.containsKey(key)) {
          builder.addDouble(key, executionContext.getDouble(key));
        }
        else if (jobParameters.containsKey(key)) {
          builder.addDouble(key, (Double) jobParameters.get(key).getValue());
        }
View Full Code Here

          builder.addDouble(key, (Double) jobParameters.get(key).getValue());
        }
      }
      else if (key.endsWith("(string)")) {
        key = key.replace("(string)", "");
        if (executionContext.containsKey(key)) {
          builder.addString(key, executionContext.getString(key));
        }
        else if (jobParameters.containsKey(key)) {
          builder.addString(key, (String) jobParameters.get(key).getValue());
        }
View Full Code Here

          builder.addString(key, (String) jobParameters.get(key).getValue());
        }
      }
      else if (key.endsWith("(date)")) {
        key = key.replace("(date)", "");
        if (executionContext.containsKey(key)) {
          builder.addDate(key, (Date) executionContext.get(key));
        }
        else if (jobParameters.containsKey(key)) {
          builder.addDate(key, (Date) jobParameters.get(key).getValue());
        }
View Full Code Here

        else if (jobParameters.containsKey(key)) {
          builder.addDate(key, (Date) jobParameters.get(key).getValue());
        }
      }
      else {
        if (executionContext.containsKey(key)) {
          builder.addString(key, executionContext.get(key).toString());
        }
        else if (jobParameters.containsKey(key)) {
          builder.addString(key, jobParameters.get(key).getValue().toString());
        }
View Full Code Here

    Collection<String> keys = this.keys;
    if (keys == null) {
      keys = jobParameters.getParameters().keySet();
    }
    for (String key : keys) {
      if (!stepContext.containsKey(key)) {
        stepContext.put(key, jobParameters.getParameters().get(key).getValue());
      }
    }
  }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.