Package org.springframework.yarn.batch.repository.bindings.repo

Examples of org.springframework.yarn.batch.repository.bindings.repo.GetLastJobExecutionRes


  }

  @Override
  public JobExecution getLastJobExecution(String jobName, JobParameters jobParameters) {
    GetLastJobExecutionReq request = JobRepositoryRpcFactory.buildGetLastJobExecutionReq(jobName, jobParameters);
    GetLastJobExecutionRes response = (GetLastJobExecutionRes) getAppmasterScOperations().doMindRequest(request);
    return JobRepositoryRpcFactory.convertJobExecutionType(response.jobExecution);
  }
View Full Code Here


    response.version = stepExecution.getVersion();
    return response;
  }

  private BaseResponseObject handleGetLastJobExecutionReq(GetLastJobExecutionReq request) {
    GetLastJobExecutionRes response = null;

    String jobName = request.jobName;

    Map<String, JobParameter> map = new HashMap<String, JobParameter>();
    for(Entry<String, JobParameterType> entry : request.jobParameters.entrySet()) {
      ParameterType parameterType = entry.getValue().parameterType;
      if(parameterType == ParameterType.DATE) {
        if(entry.getValue().parameter instanceof Integer) {
          map.put(entry.getKey(), new JobParameter(new Date((Integer)entry.getValue().parameter)));
        } else if(entry.getValue().parameter instanceof Date) {
          map.put(entry.getKey(), new JobParameter(((Date)entry.getValue().parameter)));
        }
      } else if(parameterType == ParameterType.DOUBLE) {
        map.put(entry.getKey(), new JobParameter((Double)entry.getValue().parameter));
      } else if(parameterType == ParameterType.LONG) {
        if(entry.getValue().parameter instanceof Long) {
          map.put(entry.getKey(), new JobParameter((Long)entry.getValue().parameter));
        } else if(entry.getValue().parameter instanceof Integer) {
          Long tmp = new Long((Integer)entry.getValue().parameter);
          map.put(entry.getKey(), new JobParameter(tmp));
        }
      } else if(parameterType == ParameterType.STRING) {
        map.put(entry.getKey(), new JobParameter((String)entry.getValue().parameter));
      }
    }
    JobParameters jobParameters = new JobParameters(map);

    JobExecution lastJobExecution = jobRepository.getLastJobExecution(jobName, jobParameters);

    response = new GetLastJobExecutionRes();
    response.jobExecution = JobRepositoryRpcFactory.convertJobExecutionType(lastJobExecution);

    return response;
  }
View Full Code Here

TOP

Related Classes of org.springframework.yarn.batch.repository.bindings.repo.GetLastJobExecutionRes

Copyright © 2018 www.massapicom. 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.