All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fi.evolver.basics.spring.job.entity.JobStatus Maven / Gradle / Ivy

package fi.evolver.basics.spring.job.entity;

import java.io.Serializable;
import java.time.LocalDateTime;

import jakarta.persistence.*;


@Entity
@Table(name="job_status")
public class JobStatus implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private long id;

	@Column(name="failure_duration_ht")
	private double failureDurationHt;

	@Column(name="last_actual_activity")
	private LocalDateTime lastActualActivity;

	@Column(name="last_failure_duration_ms")
	private Long lastFailureDurationMs;

	@Column(name="last_failure_start")
	private LocalDateTime lastFailureStart;

	@Column(name="last_success_duration_ms")
	private Long lastSuccessDurationMs;

	@Column(name="last_success_start")
	private LocalDateTime lastSuccessStart;

	@Column(name="success_message")
	private String successMessage;

	@Column(name="error_message")
	private String errorMessage;

	@Column(name="name")
	private String name;

	@Column(name="success_duration_ht")
	private double successDurationHt;

	@Column(name="success_rate")
	private double successRate;


	public JobStatus() { }

	public JobStatus(String name) {
		this.name = name;
		this.successRate = 1.0;
	}


	public long getId() {
		return this.id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public double getFailureDurationHt() {
		return this.failureDurationHt;
	}

	public void setFailureDurationHt(double failureDurationHt) {
		if (failureDurationHt < 1.0e-110)
			failureDurationHt = 0.0;
		this.failureDurationHt = failureDurationHt;
	}

	public LocalDateTime getLastActualActivity() {
		return this.lastActualActivity;
	}

	public void setLastActualActivity(LocalDateTime lastActualActivity) {
		this.lastActualActivity = lastActualActivity;
	}

	public Long getLastFailureDurationMs() {
		return this.lastFailureDurationMs;
	}

	public void setLastFailureDurationMs(Long lastFailureDurationMs) {
		this.lastFailureDurationMs = lastFailureDurationMs;
	}

	public LocalDateTime getLastFailureStart() {
		return this.lastFailureStart;
	}

	public void setLastFailureStart(LocalDateTime lastFailureStart) {
		this.lastFailureStart = lastFailureStart;
	}

	public Long getLastSuccessDurationMs() {
		return this.lastSuccessDurationMs;
	}

	public void setLastSuccessDurationMs(Long lastSuccessDurationMs) {
		this.lastSuccessDurationMs = lastSuccessDurationMs;
	}

	public LocalDateTime getLastSuccessStart() {
		return this.lastSuccessStart;
	}

	public void setLastSuccessStart(LocalDateTime lastSuccessStart) {
		this.lastSuccessStart = lastSuccessStart;
	}

	public String getSuccessMessage() {
		return this.successMessage;
	}

	public String getErrorMessage() {
		return this.errorMessage;
	}

	public void setSuccessMessage(String message) {
		if (message != null && message.length() > 512)
			message = message.substring(0, 509) + "...";
		this.successMessage = message;
	}

	public void setErrorMessage(String message) {
		if (message != null && message.length() > 512)
			message = message.substring(0, 509) + "...";
		this.errorMessage = message;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public double getSuccessDurationHt() {
		return this.successDurationHt;
	}

	public void setSuccessDurationHt(double successDurationHt) {
		if (successDurationHt < 1.0e-110)
			successDurationHt = 0.0;
		this.successDurationHt = successDurationHt;
	}

	public double getSuccessRate() {
		return this.successRate;
	}

	public void setSuccessRate(double successRate) {
		if (successRate < 1.0e-110)
			successRate = 0.0;
		else if (successRate > 1.0)
			successRate = 1.0;
		this.successRate = successRate;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy