1 package fr.ifremer.quadrige2.synchro.vo;
2
3 /*-
4 * #%L
5 * Quadrige2 Core :: Quadrige2 Synchro Core
6 * $Id:$
7 * $HeadURL:$
8 * %%
9 * Copyright (C) 2017 Ifremer
10 * %%
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Affero General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU Affero General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 * #L%
24 */
25
26 import com.google.common.base.Preconditions;
27
28 import java.io.File;
29 import java.io.Serializable;
30
31 /**
32 * <p>
33 * SynchroProgressionVO class.
34 * </p>
35 *
36 * @author Benoit Lavenier <benoit.lavenier@e-is.pro>
37 * @since 3.7.0
38 */
39 public class SynchroProgressionVO implements Serializable {
40
41 private static final long serialVersionUID = 64396395159800607L;
42
43 private final String jobId;
44 private final int increment;
45 private final String message;
46 private final String status;
47 private String fileName;
48
49 /**
50 * <p>
51 * Constructor for SynchroProgressionVO.
52 * </p>
53 *
54 * @param jobId
55 * a {@link java.lang.String} object.
56 * @param fileName
57 * a {@link java.lang.String} object.
58 * @param progressionModel
59 * a {@link fr.ifremer.quadrige2.synchro.vo.SynchroProgressionModel} object.
60 */
61 public SynchroProgressionVO(String jobId, String fileName, SynchroProgressionModel progressionModel) {
62 Preconditions.checkNotNull(jobId);
63 Preconditions.checkNotNull(fileName);
64 Preconditions.checkNotNull(progressionModel);
65 this.jobId = jobId;
66 this.fileName = fileName;
67 this.increment = progressionModel.getCurrent();
68 this.message = progressionModel.getMessage();
69 this.status = progressionModel.getStatus().toString();
70 }
71
72 /**
73 * <p>
74 * Constructor for SynchroProgressionVO.
75 * </p>
76 *
77 * @param jobId
78 * a {@link java.lang.String} object.
79 * @param outputFile
80 * a {@link java.io.File} object.
81 * @param progressionModel
82 * a {@link fr.ifremer.quadrige2.synchro.vo.SynchroProgressionModel} object.
83 */
84 public SynchroProgressionVO(String jobId, File outputFile, SynchroProgressionModel progressionModel) {
85 Preconditions.checkNotNull(jobId);
86 Preconditions.checkNotNull(outputFile);
87 Preconditions.checkNotNull(progressionModel);
88 this.jobId = jobId;
89 this.fileName = outputFile.getName();
90 this.increment = progressionModel.getCurrent();
91 this.message = progressionModel.getMessage();
92 this.status = progressionModel.getStatus().toString();
93 }
94
95 /**
96 * <p>
97 * Getter for the field <code>increment</code>.
98 * </p>
99 *
100 * @return a int.
101 */
102 public int getIncrement() {
103 return increment;
104 }
105
106 /**
107 * <p>
108 * Getter for the field <code>jobId</code>.
109 * </p>
110 *
111 * @return a {@link java.lang.String} object.
112 */
113 public String getJobId() {
114 return jobId;
115 }
116
117 /**
118 * <p>
119 * Getter for the field <code>message</code>.
120 * </p>
121 *
122 * @return a {@link java.lang.String} object.
123 */
124 public String getMessage() {
125 return message;
126 }
127
128 /**
129 * <p>
130 * Getter for the field <code>status</code>.
131 * </p>
132 *
133 * @return a {@link java.lang.String} object.
134 */
135 public String getStatus() {
136 return status;
137 }
138
139 /**
140 * <p>
141 * Getter for the field <code>fileName</code>.
142 * </p>
143 *
144 * @return a {@link java.lang.String} object.
145 */
146 public String getFileName() {
147 return fileName;
148 }
149
150 /**
151 * <p>
152 * Setter for the field <code>fileName</code>.
153 * </p>
154 *
155 * @param fileName
156 * a {@link java.lang.String} object.
157 */
158 public void setFileName(String fileName) {
159 this.fileName = fileName;
160 }
161
162 }