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