001package com.thed.zblast.scheduler;
002
003import java.io.Serializable;
004
005public class JobProgressDTO implements Serializable {
006
007        private static final long serialVersionUID = 1L;
008
009        private Long schedulerId;
010
011        private String jobName;
012
013        private int executedCount;
014
015        private int failedCount;
016
017        private int errorCount;
018
019        private int skippedCount;
020
021        public JobProgressDTO() {
022                super();
023        }
024
025        public JobProgressDTO(Long andIncrement, String string) {
026                this.schedulerId = andIncrement;
027                this.jobName = string;
028        }
029
030        public Long getSchedulerId() {
031                return schedulerId;
032        }
033
034        public void setSchedulerId(Long schedulerId) {
035                this.schedulerId = schedulerId;
036        }
037
038        public String getJobName() {
039                return jobName;
040        }
041
042        public void setJobName(String jobName) {
043                this.jobName = jobName;
044        }
045
046        public int getExecutedCount() {
047                return executedCount;
048        }
049
050        public void setExecutedCount(int executedCount) {
051                this.executedCount = executedCount;
052        }
053
054        public int getFailedCount() {
055                return failedCount;
056        }
057
058        public void setFailedCount(int failedCount) {
059                this.failedCount = failedCount;
060        }
061
062        public int getErrorCount() {
063                return errorCount;
064        }
065
066        public void setErrorCount(int errorCount) {
067                this.errorCount = errorCount;
068        }
069
070        public int getSkippedCount() {
071                return skippedCount;
072        }
073
074        public void setSkippedCount(int skippedCount) {
075                this.skippedCount = skippedCount;
076        }
077
078        public void handle() {
079                System.out.println("""
080                                Serving event with schedulerId:job Name %s:%s""".formatted(schedulerId, jobName));
081                try {
082                        Thread.sleep(500);
083                } catch (InterruptedException e) {
084                        e.printStackTrace();
085                }
086        }
087
088        @Override
089        public String toString() {
090                return """
091                                JobProgressDTO [schedulerId=%s, jobName=%s, executedCount=%d, failedCount=%d, errorCount=%d, skippedCount=%d]""".formatted(schedulerId, jobName, executedCount, failedCount, errorCount, skippedCount);
092        }
093
094}