//
// 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.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
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 Date startTime;
    private volatile Date createTime;
    private volatile Date endTime;
    private volatile Date lastUpdated;
    private volatile ExitStatus exitStatus;
    private volatile ExecutionContext executionContext;
    private transient volatile List<Throwable> failureExceptions;
    private final String jobConfigurationName;

    public JobExecution(JobExecution original) {
        this.stepExecutions = Collections.synchronizedSet(new LinkedHashSet());
        this.status = BatchStatus.STARTING;
        this.startTime = null;
        this.createTime = new Date(System.currentTimeMillis());
        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.jobConfigurationName = original.getJobConfigurationName();
        this.setId(original.getId());
        this.setVersion(original.getVersion());
    }

    public JobExecution(JobInstance job, Long id, @Nullable JobParameters jobParameters, String jobConfigurationName) {
        super(id);
        this.stepExecutions = Collections.synchronizedSet(new LinkedHashSet());
        this.status = BatchStatus.STARTING;
        this.startTime = null;
        this.createTime = new Date(System.currentTimeMillis());
        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;
        this.jobConfigurationName = jobConfigurationName;
    }

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

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

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

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

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

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

    public Date getEndTime() {
        return this.endTime;
    }

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

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

    public Date getStartTime() {
        return this.startTime;
    }

    public void setStartTime(Date 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 Collections.unmodifiableList(new ArrayList(this.stepExecutions));
    }

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

    public boolean isRunning() {
        return this.startTime != null && this.endTime == null;
    }

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

    /** @deprecated */
    @Deprecated
    public void stop() {
        Iterator var1 = this.stepExecutions.iterator();

        while(var1.hasNext()) {
            StepExecution stepExecution = (StepExecution)var1.next();
            stepExecution.setTerminateOnly();
        }

        this.status = BatchStatus.STOPPING;
    }

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

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

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

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

    public String getJobConfigurationName() {
        return this.jobConfigurationName;
    }

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

    public Date getLastUpdated() {
        return this.lastUpdated;
    }

    public void setLastUpdated(Date 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() {
        return super.toString() + 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.Date;
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 Date testStartTime;
	private LocalDateTime endTime;
	@CreatedDate
	private LocalDateTime createdDate;
	@LastModifiedDate
	private LocalDateTime lastModifieDate;

}


below here ......jobStats.setTestStartTime(inn);.....is working 
but this code is giving jobStats.setTestStartTime(jobExecution.getStartTime());....incompatible types: java.time.LocalDateTime cannot be converted to java.util.Date
Date inn = new Date();
jobStats.setTestStartTime(inn);
jobStats.setTestStartTime(jobExecution.getStartTime());


how to fix this issue in jobStats.setTestStartTime(jobExecution.getStartTime());