//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package org.springframework.batch.core;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.lang.Nullable;

public class JobExecution extends Entity {
    private final JobParameters jobParameters;
    private JobInstance jobInstance;
    private volatile Collection<StepExecution> stepExecutions;
    private volatile BatchStatus status;
    private volatile LocalDateTime startTime;
    private volatile LocalDateTime createTime;
    private volatile LocalDateTime endTime;
    private volatile LocalDateTime lastUpdated;
    private volatile ExitStatus exitStatus;
    private volatile ExecutionContext executionContext;
    private transient volatile List<Throwable> failureExceptions;

    public JobExecution(JobExecution original) {
        this.stepExecutions = Collections.synchronizedSet(new LinkedHashSet());
        this.status = BatchStatus.STARTING;
        this.startTime = null;
        this.createTime = LocalDateTime.now();
        this.endTime = null;
        this.lastUpdated = null;
        this.exitStatus = ExitStatus.UNKNOWN;
        this.executionContext = new ExecutionContext();
        this.failureExceptions = new CopyOnWriteArrayList();
        this.jobParameters = original.getJobParameters();
        this.jobInstance = original.getJobInstance();
        this.stepExecutions = original.getStepExecutions();
        this.status = original.getStatus();
        this.startTime = original.getStartTime();
        this.createTime = original.getCreateTime();
        this.endTime = original.getEndTime();
        this.lastUpdated = original.getLastUpdated();
        this.exitStatus = original.getExitStatus();
        this.executionContext = original.getExecutionContext();
        this.failureExceptions = original.getFailureExceptions();
        this.setId(original.getId());
        this.setVersion(original.getVersion());
    }

    public JobExecution(JobInstance job, Long id, @Nullable JobParameters jobParameters) {
        super(id);
        this.stepExecutions = Collections.synchronizedSet(new LinkedHashSet());
        this.status = BatchStatus.STARTING;
        this.startTime = null;
        this.createTime = LocalDateTime.now();
        this.endTime = null;
        this.lastUpdated = null;
        this.exitStatus = ExitStatus.UNKNOWN;
        this.executionContext = new ExecutionContext();
        this.failureExceptions = new CopyOnWriteArrayList();
        this.jobInstance = job;
        this.jobParameters = jobParameters == null ? new JobParameters() : jobParameters;
    }

    public JobExecution(JobInstance job, JobParameters jobParameters) {
        this(job, (Long)null, jobParameters);
    }

    public JobExecution(Long id, JobParameters jobParameters) {
        this((JobInstance)null, id, jobParameters);
    }

    public JobExecution(Long id) {
        this((JobInstance)null, id, (JobParameters)null);
    }

    public JobParameters getJobParameters() {
        return this.jobParameters;
    }

    @Nullable
    public LocalDateTime getEndTime() {
        return this.endTime;
    }

    public void setJobInstance(JobInstance jobInstance) {
        this.jobInstance = jobInstance;
    }

    public void setEndTime(LocalDateTime endTime) {
        this.endTime = endTime;
    }

    @Nullable
    public LocalDateTime getStartTime() {
        return this.startTime;
    }

    public void setStartTime(LocalDateTime startTime) {
        this.startTime = startTime;
    }

    public BatchStatus getStatus() {
        return this.status;
    }

    public void setStatus(BatchStatus status) {
        this.status = status;
    }

    public void upgradeStatus(BatchStatus status) {
        this.status = this.status.upgradeTo(status);
    }

    public Long getJobId() {
        return this.jobInstance != null ? this.jobInstance.getId() : null;
    }

    public void setExitStatus(ExitStatus exitStatus) {
        this.exitStatus = exitStatus;
    }

    public ExitStatus getExitStatus() {
        return this.exitStatus;
    }

    public JobInstance getJobInstance() {
        return this.jobInstance;
    }

    public Collection<StepExecution> getStepExecutions() {
        return List.copyOf(this.stepExecutions);
    }

    public StepExecution createStepExecution(String stepName) {
        StepExecution stepExecution = new StepExecution(stepName, this);
        this.stepExecutions.add(stepExecution);
        return stepExecution;
    }

    public boolean isRunning() {
        return this.status.isRunning();
    }

    public boolean isStopping() {
        return this.status == BatchStatus.STOPPING;
    }

    public void setExecutionContext(ExecutionContext executionContext) {
        this.executionContext = executionContext;
    }

    public ExecutionContext getExecutionContext() {
        return this.executionContext;
    }

    public LocalDateTime getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    void addStepExecution(StepExecution stepExecution) {
        this.stepExecutions.add(stepExecution);
    }

    @Nullable
    public LocalDateTime getLastUpdated() {
        return this.lastUpdated;
    }

    public void setLastUpdated(LocalDateTime lastUpdated) {
        this.lastUpdated = lastUpdated;
    }

    public List<Throwable> getFailureExceptions() {
        return this.failureExceptions;
    }

    public synchronized void addFailureException(Throwable t) {
        this.failureExceptions.add(t);
    }

    public synchronized List<Throwable> getAllFailureExceptions() {
        Set<Throwable> allExceptions = new HashSet(this.failureExceptions);
        Iterator var2 = this.stepExecutions.iterator();

        while(var2.hasNext()) {
            StepExecution stepExecution = (StepExecution)var2.next();
            allExceptions.addAll(stepExecution.getFailureExceptions());
        }

        return new ArrayList(allExceptions);
    }

    private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
        stream.defaultReadObject();
        this.failureExceptions = new ArrayList();
    }

    public String toString() {
        String var10000 = super.toString();
        return var10000 + String.format(", startTime=%s, endTime=%s, lastUpdated=%s, status=%s, exitStatus=%s, job=[%s], jobParameters=[%s]", this.startTime, this.endTime, this.lastUpdated, this.status, this.exitStatus, this.jobInstance, this.jobParameters);
    }

    public void addStepExecutions(List<StepExecution> stepExecutions) {
        if (stepExecutions != null) {
            this.stepExecutions.removeAll(stepExecutions);
            this.stepExecutions.addAll(stepExecutions);
        }

    }
}.....................package com.mns.oms.batch.domain;

import java.time.LocalDateTime;
import java.util.List;

import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.mongodb.core.mapping.Document;

import com.mns.oms.batch.model.JobStepDetails;

import lombok.Data;

/**
 * @author Mrinmoy Mandal
 * 
 *         Module: WISMR
 *
 */

@Data
@Document(collection = "job-statistics")
public class JobStatistics {
	@Id
	private String id;
	private Long jobId;
	private String jobName;
	private String jobStatus;
	private String jobExitStatus;
	private String jobExitDescription;
	private List<JobStepDetails> stepDetails;
	private List<String> fileList;
	private LocalDateTime startTime;
	private LocalDateTime endTime;
	@CreatedDate
	private LocalDateTime createdDate;
	@LastModifiedDate
	private LocalDateTime lastModifieDate;

}
.........jobStats.setStartTime(jobExecution.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());.....giving compile time issue.....fix it