View Javadoc
1   package fr.ifremer.quadrige3.synchro.intercept.data;
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.ImmutableSet;
27  import fr.ifremer.common.synchro.meta.SynchroDatabaseMetadata;
28  import fr.ifremer.quadrige3.synchro.intercept.AbstractSynchroInterceptor;
29  import fr.ifremer.quadrige3.synchro.service.SynchroDirection;
30  import fr.ifremer.quadrige3.synchro.service.data.DataSynchroDatabaseConfiguration;
31  import org.hibernate.tool.hbm2ddl.TableMetadata;
32  
33  import java.util.Set;
34  
35  /**
36   * Created by blavenie on 15/09/15.
37   */
38  public abstract class AbstractDataInterceptor extends AbstractSynchroInterceptor<DataSynchroDatabaseConfiguration> {
39  
40  	/**
41  	 * <p>
42  	 * Constructor for AbstractDataInterceptor.
43  	 * </p>
44  	 */
45  	public AbstractDataInterceptor() {
46  		super();
47  	}
48  
49  	/**
50  	 * <p>
51  	 * Constructor for AbstractDataInterceptor.
52  	 * </p>
53  	 * 
54  	 * @param directions
55  	 *            a {@link fr.ifremer.quadrige3.synchro.service.SynchroDirection} object.
56  	 */
57  	public AbstractDataInterceptor(SynchroDirection... directions) {
58  		super(directions);
59  	}
60  
61  	/**
62  	 * <p>
63  	 * Constructor for AbstractDataInterceptor.
64  	 * </p>
65  	 * 
66  	 * @param tableNames
67  	 *            a {@link java.util.Set} object.
68  	 */
69  	public AbstractDataInterceptor(Set<String> tableNames) {
70  		super(tableNames);
71  	}
72  
73  	/**
74  	 * <p>
75  	 * Constructor for AbstractDataInterceptor.
76  	 * </p>
77  	 * 
78  	 * @param tableNames
79  	 *            a {@link java.util.Set} object.
80  	 * @param directions
81  	 *            a {@link fr.ifremer.quadrige3.synchro.service.SynchroDirection} object.
82  	 */
83  	public AbstractDataInterceptor(Set<String> tableNames, SynchroDirection... directions) {
84  		super(tableNames, directions);
85  	}
86  
87  	/**
88  	 * <p>
89  	 * Constructor for AbstractDataInterceptor.
90  	 * </p>
91  	 * 
92  	 * @param tableName
93  	 *            a {@link java.lang.String} object.
94  	 * @param directions
95  	 *            a {@link fr.ifremer.quadrige3.synchro.service.SynchroDirection} object.
96  	 */
97  	public AbstractDataInterceptor(String tableName, SynchroDirection... directions) {
98  		this(ImmutableSet.of(tableName), directions);
99  	}
100 
101 	/**
102 	 * <p>
103 	 * Constructor for AbstractDataInterceptor.
104 	 * </p>
105 	 * 
106 	 * @param tableName
107 	 *            a {@link java.lang.String} object.
108 	 */
109 	public AbstractDataInterceptor(String tableName) {
110 		this(ImmutableSet.of(tableName));
111 	}
112 
113 	/** {@inheritDoc} */
114 	@Override
115 	protected Class<DataSynchroDatabaseConfiguration> getConfigClass() {
116 		return DataSynchroDatabaseConfiguration.class;
117 	}
118 
119 	/** {@inheritDoc} */
120 	@Override
121 	public boolean doApply(SynchroDatabaseMetadata meta, TableMetadata table) {
122 		return true;
123 	}
124 }