1
2
3
4 package nl.b3p.brmo.test.util.database.dbunit;
5
6 import java.sql.SQLException;
7 import org.dbunit.DatabaseUnitException;
8 import org.dbunit.database.IDatabaseConnection;
9 import org.dbunit.dataset.DefaultDataSet;
10 import org.dbunit.dataset.DefaultTable;
11 import org.dbunit.operation.DatabaseOperation;
12
13
14
15
16
17
18 public final class CleanUtil {
19
20
21 private CleanUtil() {}
22
23
24
25
26
27
28
29
30
31 public static void cleanRSGB_BRK2(final IDatabaseConnection rsgbbrk)
32 throws DatabaseUnitException, SQLException {
33
34 DatabaseOperation.DELETE_ALL.execute(
35 rsgbbrk,
36 new DefaultDataSet(
37 new DefaultTable[] {
38
39 new DefaultTable("onroerendezaak"),
40 new DefaultTable("nietnatuurlijkpersoon"),
41 new DefaultTable("adres"),
42 new DefaultTable("natuurlijkpersoon"),
43 new DefaultTable("stuk"),
44 new DefaultTable("stukdeel"),
45 new DefaultTable("persoon"),
46 new DefaultTable("recht"),
47 new DefaultTable("publiekrechtelijkebeperking"),
48 new DefaultTable("onroerendezaakbeperking_archief"),
49 new DefaultTable("onroerendezaakfiliatie"),
50 new DefaultTable("recht_isbeperkttot"),
51 new DefaultTable("objectlocatie"),
52 new DefaultTable("onroerendezaakbeperking"),
53 new DefaultTable("recht_aantekeningrecht"),
54 new DefaultTable("recht_archief"),
55 new DefaultTable("recht_isbelastmet"),
56 new DefaultTable("appartementsrecht"),
57 new DefaultTable("appartementsrecht_archief"),
58 new DefaultTable("objectlocatie_archief"),
59 new DefaultTable("onroerendezaak_archief"),
60 new DefaultTable("perceel"),
61 new DefaultTable("perceel_archief"),
62 new DefaultTable("recht_aantekeningrecht_archief"),
63 new DefaultTable("recht_isbelastmet_archief"),
64 new DefaultTable("recht_isbeperkttot_archief"),
65 }));
66 }
67
68
69
70
71
72
73
74
75 public static void cleanRSGB_BRP(final IDatabaseConnection rsgb)
76 throws DatabaseUnitException, SQLException {
77 CleanUtil.cleanRSGB_BRP(rsgb, true);
78 }
79
80
81
82
83
84
85
86
87
88
89 public static void cleanRSGB_BRP(final IDatabaseConnection rsgb, final boolean deleteBrondocument)
90 throws DatabaseUnitException, SQLException {
91 if (deleteBrondocument) {
92 DatabaseOperation.DELETE_ALL.execute(
93 rsgb, new DefaultDataSet(new DefaultTable[] {new DefaultTable("brondocument")}));
94 }
95
96
97
98
99
100
101
102 DatabaseOperation.DELETE_ALL.execute(
103 rsgb,
104 new DefaultDataSet(
105 new DefaultTable[] {
106 new DefaultTable("subject"),
107 new DefaultTable("prs"),
108 new DefaultTable("nat_prs"),
109 new DefaultTable("ingeschr_nat_prs"),
110 new DefaultTable("niet_ingezetene"),
111 new DefaultTable("ander_nat_prs"),
112 new DefaultTable("niet_nat_prs"),
113 new DefaultTable("ingeschr_niet_nat_prs"),
114 new DefaultTable("ouder_kind_rel"),
115 new DefaultTable("huw_ger_partn"),
116 new DefaultTable("herkomst_metadata")
117 }));
118 }
119
120
121
122
123
124
125
126
127 public static void cleanRSGB_NHR(final IDatabaseConnection rsgb)
128 throws DatabaseUnitException, SQLException {
129 cleanRSGB_NHR(rsgb, true);
130 }
131
132
133
134
135
136
137
138
139
140
141 public static void cleanRSGB_NHR(final IDatabaseConnection rsgb, final boolean deleteBrondocument)
142 throws DatabaseUnitException, SQLException {
143
144 DatabaseOperation.DELETE_ALL.execute(
145 rsgb,
146 new DefaultDataSet(
147 new DefaultTable[] {
148 new DefaultTable("sbi_activiteit"),
149 new DefaultTable("functionaris"),
150 new DefaultTable("ondrnmng"),
151 new DefaultTable("maatschapp_activiteit"),
152 new DefaultTable("vestg"),
153 new DefaultTable("vestg_activiteit"),
154 new DefaultTable("vestg_naam"),
155 new DefaultTable("ander_btnlnds_niet_nat_prs"),
156 }));
157 cleanRSGB_BRP(rsgb, deleteBrondocument);
158 }
159
160
161
162
163
164
165
166
167
168
169 public static void cleanRSGB_WOZ(final IDatabaseConnection rsgb, final boolean deleteBrondocument)
170 throws DatabaseUnitException, SQLException {
171
172 DatabaseOperation.DELETE_ALL.execute(
173 rsgb,
174 new DefaultDataSet(
175 new DefaultTable[] {
176 new DefaultTable("woz_obj"),
177 new DefaultTable("woz_deelobj"),
178 new DefaultTable("woz_waarde"),
179 new DefaultTable("woz_omvat"),
180 new DefaultTable("woz_belang"),
181 new DefaultTable("woz_deelobj_archief"),
182 new DefaultTable("woz_obj_archief"),
183 new DefaultTable("woz_waarde_archief"),
184 new DefaultTable("locaand_adres"),
185 new DefaultTable("locaand_openb_rmte"),
186 }));
187
188 cleanRSGB_NHR(rsgb, deleteBrondocument);
189 }
190
191
192
193
194
195
196
197
198
199
200
201 public static void cleanSTAGING(final IDatabaseConnection staging, final boolean includeProcessen)
202 throws DatabaseUnitException, SQLException {
203 if (includeProcessen) {
204 DatabaseOperation.DELETE_ALL.execute(
205 staging,
206 new DefaultDataSet(
207 new DefaultTable[] {
208 new DefaultTable("automatisch_proces"),
209 new DefaultTable("automatisch_proces_config")
210 }));
211 }
212 DatabaseOperation.DELETE_ALL.execute(
213 staging,
214 new DefaultDataSet(
215 new DefaultTable[] {
216 new DefaultTable("laadproces"), new DefaultTable("bericht"), new DefaultTable("job")
217 }));
218 }
219 }