View Javadoc
1   package fr.ifremer.quadrige3.synchro.vo;
2   
3   /*-
4    * #%L
5    * Quadrige3 Core :: Quadrige3 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.collect.Multimap;
27  
28  import java.beans.PropertyChangeListener;
29  import java.beans.PropertyChangeSupport;
30  import java.io.Serializable;
31  import java.util.Date;
32  import java.util.Set;
33  
34  /**
35   * <p>
36   * SynchroImportContextVO class.
37   * </p>
38   * 
39   * @author Ludovic Pecquot <ludovic.pecquot@e-is.pro>
40   * @since 1.0
41   */
42  public class SynchroImportContextVO implements Serializable, Cloneable {
43  
44  	private static final long serialVersionUID = 2375804877480968569L;
45  
46  	/** Constant <code>PROPERTY_JOB_ID="jobId"</code> */
47  	public static final String PROPERTY_JOB_ID = "jobId";
48  	/** Constant <code>PROPERTY_REFERENTIAL_UPDATE_DATE="referentialUpdateDate"</code> */
49  	public static final String PROPERTY_REFERENTIAL_UPDATE_DATE = "referentialUpdateDate";
50  	/** Constant <code>PROPERTY_DATA_UPDATE_DATE="dataUpdateDate"</code> */
51  	public static final String PROPERTY_DATA_UPDATE_DATE = "dataUpdateDate";
52  	/** Constant <code>PROPERTY_DATA_START_DATE="dataStartDate"</code> */
53  	public static final String PROPERTY_DATA_START_DATE = "dataStartDate";
54  	/** Constant <code>PROPERTY_DATA_END_DATE="dataEndDate"</code> */
55  	public static final String PROPERTY_DATA_END_DATE = "dataEndDate";
56  	/** Constant <code>PROPERTY_WITH_REFERENTIAL="withReferential"</code> */
57  	public static final String PROPERTY_WITH_REFERENTIAL = "withReferential";
58  	/** Constant <code>PROPERTY_WITH_DATA="withData"</code> */
59  	public static final String PROPERTY_WITH_DATA = "withData";
60  	public static final String PROPERTY_WITH_PHOTO = "withPhoto";
61  	/** Constant <code>PROPERTY_REFERENTIAL_PK_INCLUDES="referentialPkIncludes"</code> */
62  	public static final String PROPERTY_REFERENTIAL_PK_INCLUDES = "referentialPkIncludes";
63  	/** Constant <code>PROPERTY_DATA_PK_INCLUDES="dataPkIncludes"</code> */
64  	public static final String PROPERTY_DATA_PK_INCLUDES = "dataPkIncludes";
65  	/** Constant <code>PROPERTY_FORCE_DUPLICATION="forceDuplication"</code> */
66  	public static final String PROPERTY_FORCE_DUPLICATION = "forceDuplication";
67  	/** Constant <code>PROPERTY_DATA_PROGRAM_CODES="dataProgramCodes"</code> */
68  	public static final String PROPERTY_DATA_PROGRAM_CODES = "dataProgramCodes";
69  	/** Constant <code>PROPERTY_REFERENTIAL_PROGRAM_CODES="referentialProgramCodes"</code> */
70  	public static final String PROPERTY_REFERENTIAL_PROGRAM_CODES = "referentialProgramCodes";
71  	/** Constant <code>PROPERTY_DATA_FORCE_EDITED_ROW_OVERRIDE="dataForceEditedRowOverride"</code> */
72  	public static final String PROPERTY_DATA_FORCE_EDITED_ROW_OVERRIDE = "dataForceEditedRowOverride";
73  
74  	private String jobId;
75  	private Date referentialUpdateDate;
76  	private Date dataUpdateDate;
77  	private Date dataStartDate;
78  	private Date dataEndDate;
79  	private Multimap<String, String> referentialPkIncludes;
80  	private Multimap<String, String> dataPkIncludes;
81  	private boolean forceDuplication = false;
82  	private Set<String> dataProgramCodes;
83  	private Set<String> referentialProgramCodes;
84  	private boolean dataForceEditedRowOverride = false;
85  	private boolean withReferential = false;
86  	private boolean withData = false;
87  	private boolean withPhoto = false;
88  	private int estimatedPhotoCount;
89  	private boolean referentialProgramsForceImport = false;
90  
91  	private final transient PropertyChangeSupport pcs = new PropertyChangeSupport(this);
92  
93  	/**
94  	 * <p>
95  	 * Constructor for SynchroImportContextVO.
96  	 * </p>
97  	 */
98  	public SynchroImportContextVO() {
99  	}
100 
101 	/**
102 	 * <p>
103 	 * Constructor for SynchroImportContextVO.
104 	 * </p>
105 	 * 
106 	 * @param otherBean
107 	 *            a {@link fr.ifremer.quadrige3.synchro.vo.SynchroImportContextVO} object.
108 	 */
109 	protected SynchroImportContextVO(SynchroImportContextVO otherBean) {
110 		this();
111 		copy(otherBean);
112 	}
113 
114 	/**
115 	 * <p>
116 	 * addPropertyChangeListener.
117 	 * </p>
118 	 * 
119 	 * @param listener
120 	 *            a {@link java.beans.PropertyChangeListener} object.
121 	 */
122 	public void addPropertyChangeListener(PropertyChangeListener listener) {
123 		this.pcs.addPropertyChangeListener(listener);
124 	}
125 
126 	/**
127 	 * <p>
128 	 * removePropertyChangeListener.
129 	 * </p>
130 	 * 
131 	 * @param listener
132 	 *            a {@link java.beans.PropertyChangeListener} object.
133 	 */
134 	public void removePropertyChangeListener(PropertyChangeListener listener) {
135 		this.pcs.removePropertyChangeListener(listener);
136 	}
137 
138 	/** {@inheritDoc} */
139 	@Override
140 	public Object clone() {
141 		return new SynchroImportContextVO().copy(this);
142 	}
143 
144 	/**
145 	 * <p>
146 	 * Getter for the field <code>jobId</code>.
147 	 * </p>
148 	 * 
149 	 * @return a {@link java.lang.String} object.
150 	 */
151 	public String getJobId() {
152 		return jobId;
153 	}
154 
155 	/**
156 	 * <p>
157 	 * Setter for the field <code>jobId</code>.
158 	 * </p>
159 	 * 
160 	 * @param jobId
161 	 *            a {@link java.lang.String} object.
162 	 */
163 	public void setJobId(String jobId) {
164 		this.jobId = jobId;
165 		this.pcs.firePropertyChange(PROPERTY_JOB_ID, null, jobId);
166 	}
167 
168 	/**
169 	 * <p>
170 	 * Getter for the field <code>referentialUpdateDate</code>.
171 	 * </p>
172 	 * 
173 	 * @return a {@link java.util.Date} object.
174 	 */
175 	public Date getReferentialUpdateDate() {
176 		return referentialUpdateDate;
177 	}
178 
179 	/**
180 	 * <p>
181 	 * Setter for the field <code>referentialUpdateDate</code>.
182 	 * </p>
183 	 * 
184 	 * @param referentialUpdateDate
185 	 *            a {@link java.util.Date} object.
186 	 */
187 	public void setReferentialUpdateDate(Date referentialUpdateDate) {
188 		this.referentialUpdateDate = referentialUpdateDate;
189 	}
190 
191 	/**
192 	 * <p>
193 	 * Getter for the field <code>dataUpdateDate</code>.
194 	 * </p>
195 	 * 
196 	 * @return a {@link java.util.Date} object.
197 	 */
198 	public Date getDataUpdateDate() {
199 		return dataUpdateDate;
200 	}
201 
202 	/**
203 	 * <p>
204 	 * Setter for the field <code>dataUpdateDate</code>.
205 	 * </p>
206 	 * 
207 	 * @param dataUpdateDate
208 	 *            a {@link java.util.Date} object.
209 	 */
210 	public void setDataUpdateDate(Date dataUpdateDate) {
211 		this.dataUpdateDate = dataUpdateDate;
212 	}
213 
214 	/**
215 	 * <p>
216 	 * Getter for the field <code>dataStartDate</code>.
217 	 * </p>
218 	 * 
219 	 * @return a {@link java.util.Date} object.
220 	 */
221 	public Date getDataStartDate() {
222 		return dataStartDate;
223 	}
224 
225 	/**
226 	 * <p>
227 	 * Setter for the field <code>dataStartDate</code>.
228 	 * </p>
229 	 * 
230 	 * @param dataStartDate
231 	 *            a {@link java.util.Date} object.
232 	 */
233 	public void setDataStartDate(Date dataStartDate) {
234 		this.dataStartDate = dataStartDate;
235 	}
236 
237 	/**
238 	 * <p>
239 	 * Getter for the field <code>dataEndDate</code>.
240 	 * </p>
241 	 * 
242 	 * @return a {@link java.util.Date} object.
243 	 */
244 	public Date getDataEndDate() {
245 		return dataEndDate;
246 	}
247 
248 	/**
249 	 * <p>
250 	 * Setter for the field <code>dataEndDate</code>.
251 	 * </p>
252 	 * 
253 	 * @param dataEndDate
254 	 *            a {@link java.util.Date} object.
255 	 */
256 	public void setDataEndDate(Date dataEndDate) {
257 		this.dataEndDate = dataEndDate;
258 	}
259 
260 	/**
261 	 * <p>
262 	 * Getter for the field <code>referentialPkIncludes</code>.
263 	 * </p>
264 	 * 
265 	 * @return a {@link com.google.common.collect.Multimap} object.
266 	 */
267 	public Multimap<String, String> getReferentialPkIncludes() {
268 		return referentialPkIncludes;
269 	}
270 
271 	/**
272 	 * <p>
273 	 * Setter for the field <code>referentialPkIncludes</code>.
274 	 * </p>
275 	 * 
276 	 * @param referentialPkIncludes
277 	 *            a {@link com.google.common.collect.Multimap} object.
278 	 */
279 	public void setReferentialPkIncludes(Multimap<String, String> referentialPkIncludes) {
280 		this.referentialPkIncludes = referentialPkIncludes;
281 	}
282 
283 	/**
284 	 * <p>
285 	 * Getter for the field <code>dataPkIncludes</code>.
286 	 * </p>
287 	 * 
288 	 * @return a {@link com.google.common.collect.Multimap} object.
289 	 */
290 	public Multimap<String, String> getDataPkIncludes() {
291 		return dataPkIncludes;
292 	}
293 
294 	/**
295 	 * <p>
296 	 * Setter for the field <code>dataPkIncludes</code>.
297 	 * </p>
298 	 * 
299 	 * @param dataPkIncludes
300 	 *            a {@link com.google.common.collect.Multimap} object.
301 	 */
302 	public void setDataPkIncludes(Multimap<String, String> dataPkIncludes) {
303 		this.dataPkIncludes = dataPkIncludes;
304 	}
305 
306 	/**
307 	 * <p>
308 	 * isForceDuplication.
309 	 * </p>
310 	 * 
311 	 * @return a boolean.
312 	 */
313 	public boolean isForceDuplication() {
314 		return forceDuplication;
315 	}
316 
317 	/**
318 	 * <p>
319 	 * Setter for the field <code>forceDuplication</code>.
320 	 * </p>
321 	 * 
322 	 * @param forceDuplication
323 	 *            a boolean.
324 	 */
325 	public void setForceDuplication(boolean forceDuplication) {
326 		this.forceDuplication = forceDuplication;
327 	}
328 
329 	/**
330 	 * <p>
331 	 * isWithReferential.
332 	 * </p>
333 	 * 
334 	 * @return a boolean.
335 	 */
336 	public boolean isWithReferential() {
337 		return withReferential;
338 	}
339 
340 	/**
341 	 * <p>
342 	 * Setter for the field <code>withReferential</code>.
343 	 * </p>
344 	 * 
345 	 * @param referential
346 	 *            a boolean.
347 	 */
348 	public void setWithReferential(boolean referential) {
349 		this.withReferential = referential;
350 	}
351 
352 	/**
353 	 * <p>
354 	 * isWithData.
355 	 * </p>
356 	 * 
357 	 * @return a boolean.
358 	 */
359 	public boolean isWithData() {
360 		return withData;
361 	}
362 
363 	/**
364 	 * <p>
365 	 * Setter for the field <code>withData</code>.
366 	 * </p>
367 	 * 
368 	 * @param data
369 	 *            a boolean.
370 	 */
371 	public void setWithData(boolean data) {
372 		this.withData = data;
373 	}
374 
375 	public boolean isWithPhoto() {
376 		return withPhoto;
377 	}
378 
379 	public void setWithPhoto(boolean withPhoto) {
380 		this.withPhoto = withPhoto;
381 	}
382 
383 	public int getEstimatedPhotoCount() {
384 		return estimatedPhotoCount;
385 	}
386 
387 	public void setEstimatedPhotoCount(int estimatedPhotoCount) {
388 		this.estimatedPhotoCount = estimatedPhotoCount;
389 	}
390 
391 	/**
392 	 * <p>
393 	 * isDataForceEditedRowOverride.
394 	 * </p>
395 	 * 
396 	 * @return a boolean.
397 	 */
398 	public boolean isDataForceEditedRowOverride() {
399 		return dataForceEditedRowOverride;
400 	}
401 
402 	/**
403 	 * <p>
404 	 * Setter for the field <code>dataForceEditedRowOverride</code>.
405 	 * </p>
406 	 * 
407 	 * @param dataForceEditedRowOverride
408 	 *            a boolean.
409 	 */
410 	public void setDataForceEditedRowOverride(boolean dataForceEditedRowOverride) {
411 		this.dataForceEditedRowOverride = dataForceEditedRowOverride;
412 	}
413 
414 	/**
415 	 * <p>
416 	 * Getter for the field <code>dataProgramCodes</code>.
417 	 * </p>
418 	 * 
419 	 * @return a {@link java.util.Set} object.
420 	 */
421 	public Set<String> getDataProgramCodes() {
422 		return dataProgramCodes;
423 	}
424 
425 	/**
426 	 * <p>
427 	 * Setter for the field <code>dataProgramCodes</code>.
428 	 * </p>
429 	 * 
430 	 * @param dataProgramCodes
431 	 *            a {@link java.util.Set} object.
432 	 */
433 	public void setDataProgramCodes(Set<String> dataProgramCodes) {
434 		this.dataProgramCodes = dataProgramCodes;
435 	}
436 
437 	/**
438 	 * <p>
439 	 * Getter for the field <code>referentialProgramCodes</code>.
440 	 * </p>
441 	 * 
442 	 * @return a {@link java.util.Set} object.
443 	 */
444 	public Set<String> getReferentialProgramCodes() {
445 		return referentialProgramCodes;
446 	}
447 
448 	/**
449 	 * <p>
450 	 * Setter for the field <code>referentialProgramCodes</code>.
451 	 * </p>
452 	 * 
453 	 * @param referentialProgramCodes
454 	 *            a {@link java.util.Set} object.
455 	 */
456 	public void setReferentialProgramCodes(Set<String> referentialProgramCodes) {
457 		this.referentialProgramCodes = referentialProgramCodes;
458 	}
459 
460 	/**
461 	 * <p>
462 	 * Setter for the field <code>referentialProgramsForceImport</code>.
463 	 * </p>
464 	 * 
465 	 * @param referentialProgramsForceImport
466 	 *            a boolean.
467 	 */
468 	public void setReferentialProgramsForceImport(boolean referentialProgramsForceImport) {
469 		this.referentialProgramsForceImport = referentialProgramsForceImport;
470 	}
471 
472 	/**
473 	 * <p>
474 	 * Getter for the field <code>referentialProgramsForceImport</code>.
475 	 * </p>
476 	 * 
477 	 * @return a boolean.
478 	 */
479 	public boolean getReferentialProgramsForceImport() {
480 		return this.referentialProgramsForceImport;
481 	}
482 
483 	/* -- protected methods -- */
484 
485 	/**
486 	 * <p>
487 	 * copy.
488 	 * </p>
489 	 * 
490 	 * @param other
491 	 *            a {@link fr.ifremer.quadrige3.synchro.vo.SynchroImportContextVO} object.
492 	 * @return a {@link fr.ifremer.quadrige3.synchro.vo.SynchroImportContextVO} object.
493 	 */
494 	protected SynchroImportContextVO copy(SynchroImportContextVO other) {
495 		this.jobId = other.jobId;
496 		this.referentialUpdateDate = other.referentialUpdateDate;
497 		this.dataUpdateDate = other.dataUpdateDate;
498 		this.dataStartDate = other.dataStartDate;
499 		this.dataEndDate = other.dataEndDate;
500 		this.dataPkIncludes = other.dataPkIncludes;
501 		this.dataProgramCodes = other.dataProgramCodes;
502 		this.dataForceEditedRowOverride = other.dataForceEditedRowOverride;
503 		this.withReferential = other.withReferential;
504 		this.withData = other.withData;
505 		this.withPhoto = other.withPhoto;
506 		this.referentialProgramCodes = other.referentialProgramCodes;
507 		this.referentialProgramsForceImport = other.referentialProgramsForceImport;
508 		return this;
509 	}
510 }