OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 180 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 180 Rev 182
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
3
 * 
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
4
 * Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
5
 * 
5
 * 
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
9
 * language governing permissions and limitations under the License.
10
 * 
10
 * 
11
 * When distributing the software, include this License Header Notice in each file.
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
12
 */
13
 
13
 
14
 package org.openconcerto.erp.config;
14
 package org.openconcerto.erp.config;
15
 
15
 
16
import org.openconcerto.erp.config.DsnBrutCode.DsnTypeCodeBrut;
16
import org.openconcerto.erp.config.DsnBrutCode.DsnTypeCodeBrut;
17
import org.openconcerto.sql.model.DBRoot;
17
import org.openconcerto.sql.model.DBRoot;
18
import org.openconcerto.sql.model.SQLBase;
18
import org.openconcerto.sql.model.SQLBase;
19
import org.openconcerto.sql.model.SQLName;
19
import org.openconcerto.sql.model.SQLName;
20
import org.openconcerto.sql.model.SQLRow;
20
import org.openconcerto.sql.model.SQLRow;
21
import org.openconcerto.sql.model.SQLRowListRSH;
21
import org.openconcerto.sql.model.SQLRowListRSH;
22
import org.openconcerto.sql.model.SQLRowValues;
22
import org.openconcerto.sql.model.SQLRowValues;
23
import org.openconcerto.sql.model.SQLSelect;
23
import org.openconcerto.sql.model.SQLSelect;
24
import org.openconcerto.sql.model.SQLSyntax;
24
import org.openconcerto.sql.model.SQLSyntax;
25
import org.openconcerto.sql.model.SQLTable;
25
import org.openconcerto.sql.model.SQLTable;
26
import org.openconcerto.sql.model.Where;
26
import org.openconcerto.sql.model.Where;
27
import org.openconcerto.sql.request.Inserter;
27
import org.openconcerto.sql.request.Inserter;
28
import org.openconcerto.sql.request.Inserter.Insertion;
28
import org.openconcerto.sql.request.Inserter.Insertion;
29
import org.openconcerto.sql.request.UpdateBuilder;
29
import org.openconcerto.sql.request.UpdateBuilder;
30
import org.openconcerto.sql.utils.AlterTable;
30
import org.openconcerto.sql.utils.AlterTable;
31
import org.openconcerto.sql.utils.ReOrder;
31
import org.openconcerto.sql.utils.ReOrder;
32
import org.openconcerto.sql.utils.SQLCreateTable;
32
import org.openconcerto.sql.utils.SQLCreateTable;
33
import org.openconcerto.utils.Tuple2;
33
import org.openconcerto.utils.Tuple2;
34
import org.openconcerto.utils.Tuple3;
34
import org.openconcerto.utils.Tuple3;
35
 
35
 
36
import java.sql.SQLException;
36
import java.sql.SQLException;
37
import java.util.ArrayList;
37
import java.util.ArrayList;
38
import java.util.Arrays;
38
import java.util.Arrays;
39
import java.util.HashMap;
39
import java.util.HashMap;
40
import java.util.List;
40
import java.util.List;
41
import java.util.Map;
41
import java.util.Map;
42
 
42
 
43
public class DSNInstallationUtils {
43
public class DSNInstallationUtils {
44
 
44
 
45
    private void insertUndef(final SQLCreateTable ct) throws SQLException {
45
    private void insertUndef(final SQLCreateTable ct) throws SQLException {
46
        // check that we can use insertReturnFirstField()
46
        // check that we can use insertReturnFirstField()
47
        if (ct.getPrimaryKey().size() != 1)
47
        if (ct.getPrimaryKey().size() != 1)
48
            throw new IllegalStateException("Not one and only one field in the PK : " + ct.getPrimaryKey());
48
            throw new IllegalStateException("Not one and only one field in the PK : " + ct.getPrimaryKey());
49
        final Insertion<?> insertion = new Inserter(ct).insertReturnFirstField("(" + SQLBase.quoteIdentifier(SQLSyntax.ORDER_NAME) + ") VALUES(" + ReOrder.MIN_ORDER + ")", false);
49
        final Insertion<?> insertion = new Inserter(ct).insertReturnFirstField("(" + SQLBase.quoteIdentifier(SQLSyntax.ORDER_NAME) + ") VALUES(" + ReOrder.MIN_ORDER + ")", false);
50
        assert insertion.getCount() == 1;
50
        assert insertion.getCount() == 1;
51
        if (insertion.getRows().size() != 1)
51
        if (insertion.getRows().size() != 1)
52
            throw new IllegalStateException("Missing ID " + insertion.getRows());
52
            throw new IllegalStateException("Missing ID " + insertion.getRows());
53
        SQLTable.setUndefID(ct.getRoot().getSchema(), ct.getName(), ((Number) insertion.getRows().get(0)).intValue());
53
        SQLTable.setUndefID(ct.getRoot().getSchema(), ct.getName(), ((Number) insertion.getRows().get(0)).intValue());
54
    }
54
    }
55
 
55
 
56
    private void insertValues(List<Tuple2<String, String>> values, SQLTable table) throws SQLException {
56
    private void insertValues(List<Tuple2<String, String>> values, SQLTable table) throws SQLException {
57
        SQLSelect sel = new SQLSelect();
57
        SQLSelect sel = new SQLSelect();
58
        sel.addSelect(table.getField("CODE"));
58
        sel.addSelect(table.getField("CODE"));
59
        List<String> codes = (List<String>) table.getDBSystemRoot().getDataSource().executeA(sel.asString());
59
        List<String> codes = (List<String>) table.getDBSystemRoot().getDataSource().executeCol(sel.asString());
60
        for (Tuple2<String, String> tuple2 : values) {
60
        for (Tuple2<String, String> tuple2 : values) {
61
            if (!codes.contains(tuple2.get0())) {
61
            if (!codes.contains(tuple2.get0())) {
62
                SQLRowValues rowVals = new SQLRowValues(table);
62
                SQLRowValues rowVals = new SQLRowValues(table);
63
                rowVals.put("CODE", tuple2.get0());
63
                rowVals.put("CODE", tuple2.get0());
64
                rowVals.put("NOM", tuple2.get1());
64
                rowVals.put("NOM", tuple2.get1());
65
                rowVals.commit();
65
                rowVals.commit();
66
            }
66
            }
67
        }
67
        }
68
    }
68
    }
69
 
69
 
70
    public void updateDSNCommonTable(final DBRoot root) throws SQLException {
70
    public void updateDSNCommonTable(final DBRoot root) throws SQLException {
71
 
71
 
72
        SQLTable societeCommonT = root.getTable("SOCIETE_COMMON");
72
        SQLTable societeCommonT = root.getTable("SOCIETE_COMMON");
73
        if (!societeCommonT.contains("IBAN")) {
73
        if (!societeCommonT.contains("IBAN")) {
74
            AlterTable t = new AlterTable(societeCommonT);
74
            AlterTable t = new AlterTable(societeCommonT);
75
            t.addVarCharColumn("IBAN", 256);
75
            t.addVarCharColumn("IBAN", 256);
76
            t.addVarCharColumn("BIC", 256);
76
            t.addVarCharColumn("BIC", 256);
77
            root.getBase().getDataSource().execute(t.asString());
77
            root.getBase().getDataSource().execute(t.asString());
78
            root.refetchTable("SOCIETE_COMMON");
78
            root.refetchTable("SOCIETE_COMMON");
79
            root.getSchema().updateVersion();
79
            root.getSchema().updateVersion();
80
        }
80
        }
81
        if (!societeCommonT.contains("ORG_PROTECTION_SOCIAL_ID")) {
81
        if (!societeCommonT.contains("ORG_PROTECTION_SOCIAL_ID")) {
82
            AlterTable t = new AlterTable(societeCommonT);
82
            AlterTable t = new AlterTable(societeCommonT);
83
            t.addVarCharColumn("ORG_PROTECTION_SOCIAL_ID", 256);
83
            t.addVarCharColumn("ORG_PROTECTION_SOCIAL_ID", 256);
84
            root.getBase().getDataSource().execute(t.asString());
84
            root.getBase().getDataSource().execute(t.asString());
85
            root.refetchTable("SOCIETE_COMMON");
85
            root.refetchTable("SOCIETE_COMMON");
86
            root.getSchema().updateVersion();
86
            root.getSchema().updateVersion();
87
        }
87
        }
88
 
88
 
-
 
89
        if (!societeCommonT.contains("ORG_PROTECTION_SOCIAL_ID")) {
-
 
90
            AlterTable t = new AlterTable(societeCommonT);
-
 
91
            t.addVarCharColumn("ORG_PROTECTION_SOCIAL_ID", 256);
-
 
92
            root.getBase().getDataSource().execute(t.asString());
-
 
93
            root.refetchTable("SOCIETE_COMMON");
-
 
94
            root.getSchema().updateVersion();
-
 
95
        }
-
 
96
 
89
        SQLTable tableRubCot = root.getTable("RUBRIQUE_COTISATION");
97
        SQLTable tableRubCot = root.getTable("RUBRIQUE_COTISATION");
90
        if (!tableRubCot.contains("ASSIETTE_PLAFONNEE")) {
98
        if (!tableRubCot.contains("ASSIETTE_PLAFONNEE")) {
91
            AlterTable tableRub = new AlterTable(tableRubCot);
99
            AlterTable tableRub = new AlterTable(tableRubCot);
92
            tableRub.addBooleanColumn("ASSIETTE_PLAFONNEE", false, false);
100
            tableRub.addBooleanColumn("ASSIETTE_PLAFONNEE", false, false);
93
            root.getBase().getDataSource().execute(tableRub.asString());
101
            root.getBase().getDataSource().execute(tableRub.asString());
94
            root.refetchTable("RUBRIQUE_COTISATION");
102
            root.refetchTable("RUBRIQUE_COTISATION");
95
            root.getSchema().updateVersion();
103
            root.getSchema().updateVersion();
96
        }
104
        }
97
 
105
 
98
        if (!tableRubCot.contains("TAXABLE_CM")) {
106
        if (!tableRubCot.contains("TAXABLE_CM")) {
99
            AlterTable tableRub = new AlterTable(tableRubCot);
107
            AlterTable tableRub = new AlterTable(tableRubCot);
100
            tableRub.addBooleanColumn("TAXABLE_CM", Boolean.FALSE, false);
108
            tableRub.addBooleanColumn("TAXABLE_CM", Boolean.FALSE, false);
101
            root.getBase().getDataSource().execute(tableRub.asString());
109
            root.getBase().getDataSource().execute(tableRub.asString());
102
            root.refetchTable("RUBRIQUE_COTISATION");
110
            root.refetchTable("RUBRIQUE_COTISATION");
103
            root.getSchema().updateVersion();
111
            root.getSchema().updateVersion();
104
        }
112
        }
105
 
113
 
106
        if (!root.contains("CODE_CAISSE_TYPE_RUBRIQUE")) {
114
        if (!root.contains("CODE_CAISSE_TYPE_RUBRIQUE")) {
107
            final SQLCreateTable createTableCode = new SQLCreateTable(root, "CODE_CAISSE_TYPE_RUBRIQUE");
115
            final SQLCreateTable createTableCode = new SQLCreateTable(root, "CODE_CAISSE_TYPE_RUBRIQUE");
108
            createTableCode.addVarCharColumn("CODE", 25);
116
            createTableCode.addVarCharColumn("CODE", 25);
109
            createTableCode.addVarCharColumn("NOM", 512);
117
            createTableCode.addVarCharColumn("NOM", 512);
110
            createTableCode.addVarCharColumn("CAISSE_COTISATION", 512);
118
            createTableCode.addVarCharColumn("CAISSE_COTISATION", 512);
111
 
119
 
112
            try {
120
            try {
113
                root.getBase().getDataSource().execute(createTableCode.asString());
121
                root.getBase().getDataSource().execute(createTableCode.asString());
114
                insertUndef(createTableCode);
122
                insertUndef(createTableCode);
115
                root.refetchTable("CODE_CAISSE_TYPE_RUBRIQUE");
123
                root.refetchTable("CODE_CAISSE_TYPE_RUBRIQUE");
116
 
124
 
117
                final SQLTable table = root.getTable("CODE_CAISSE_TYPE_RUBRIQUE");
125
                final SQLTable table = root.getTable("CODE_CAISSE_TYPE_RUBRIQUE");
118
 
126
 
119
                DsnUrssafCode codeUrssaf = new DsnUrssafCode();
127
                DsnUrssafCode codeUrssaf = new DsnUrssafCode();
120
                codeUrssaf.insertCode(table);
128
                codeUrssaf.insertCode(table);
121
 
129
 
122
                List<String> tableRubName = Arrays.asList("RUBRIQUE_BRUT", "RUBRIQUE_COTISATION", "RUBRIQUE_NET");
130
                List<String> tableRubName = Arrays.asList("RUBRIQUE_BRUT", "RUBRIQUE_COTISATION", "RUBRIQUE_NET");
123
                for (String t : tableRubName) {
131
                for (String t : tableRubName) {
124
                    AlterTable tableRub = new AlterTable(root.getTable(t));
132
                    AlterTable tableRub = new AlterTable(root.getTable(t));
125
                    tableRub.addForeignColumn("ID_CODE_CAISSE_TYPE_RUBRIQUE", table);
133
                    tableRub.addForeignColumn("ID_CODE_CAISSE_TYPE_RUBRIQUE", table);
126
                    root.getBase().getDataSource().execute(tableRub.asString());
134
                    root.getBase().getDataSource().execute(tableRub.asString());
127
                    root.refetchTable(t);
135
                    root.refetchTable(t);
128
                }
136
                }
129
                root.getSchema().updateVersion();
137
                root.getSchema().updateVersion();
130
 
138
 
131
            } catch (SQLException ex) {
139
            } catch (SQLException ex) {
132
                throw new IllegalStateException("Erreur lors de la création de la table " + "CODE_CAISSE_TYPE_RUBRIQUE", ex);
140
                throw new IllegalStateException("Erreur lors de la création de la table " + "CODE_CAISSE_TYPE_RUBRIQUE", ex);
133
            }
141
            }
134
        }
142
        }
135
 
143
 
136
        if (!root.contains("MOTIF_ARRET_TRAVAIL")) {
144
        if (!root.contains("MOTIF_ARRET_TRAVAIL")) {
137
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "MOTIF_ARRET_TRAVAIL");
145
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "MOTIF_ARRET_TRAVAIL");
138
            createTableMotif.addVarCharColumn("CODE", 25);
146
            createTableMotif.addVarCharColumn("CODE", 25);
139
            createTableMotif.addVarCharColumn("NOM", 512);
147
            createTableMotif.addVarCharColumn("NOM", 512);
140
 
148
 
141
            try {
149
            try {
142
                root.getBase().getDataSource().execute(createTableMotif.asString());
150
                root.getBase().getDataSource().execute(createTableMotif.asString());
143
                insertUndef(createTableMotif);
151
                insertUndef(createTableMotif);
144
                root.refetchTable("MOTIF_ARRET_TRAVAIL");
152
                root.refetchTable("MOTIF_ARRET_TRAVAIL");
145
                root.getSchema().updateVersion();
153
                root.getSchema().updateVersion();
146
 
154
 
147
                final SQLTable table = root.getTable("MOTIF_ARRET_TRAVAIL");
155
                final SQLTable table = root.getTable("MOTIF_ARRET_TRAVAIL");
148
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
156
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
149
                v.add(Tuple2.create("01", "maladie"));
157
                v.add(Tuple2.create("01", "maladie"));
150
                v.add(Tuple2.create("02", "maternité /adoption"));
158
                v.add(Tuple2.create("02", "maternité /adoption"));
151
                v.add(Tuple2.create("03", "paternité / accueil de l’enfant"));
159
                v.add(Tuple2.create("03", "paternité / accueil de l’enfant"));
152
                v.add(Tuple2.create("04", "congé suite à un accident de trajet"));
160
                v.add(Tuple2.create("04", "congé suite à un accident de trajet"));
153
                v.add(Tuple2.create("05", "congé suite à maladie professionnelle"));
161
                v.add(Tuple2.create("05", "congé suite à maladie professionnelle"));
154
                v.add(Tuple2.create("06", "congé suite à accident de travail ou de service"));
162
                v.add(Tuple2.create("06", "congé suite à accident de travail ou de service"));
155
                v.add(Tuple2.create("07", "femme enceinte dispensée de travail"));
163
                v.add(Tuple2.create("07", "femme enceinte dispensée de travail"));
156
                v.add(Tuple2.create("99", "annulation"));
164
                v.add(Tuple2.create("99", "annulation"));
157
 
165
 
158
                insertValues(v, table);
166
                insertValues(v, table);
159
            } catch (SQLException ex) {
167
            } catch (SQLException ex) {
160
                throw new IllegalStateException("Erreur lors de la création de la table " + "MOTIF_ARRET_TRAVAIL", ex);
168
                throw new IllegalStateException("Erreur lors de la création de la table " + "MOTIF_ARRET_TRAVAIL", ex);
161
            }
169
            }
162
        }
170
        }
163
        
171
 
164
        if (!root.contains("DIPLOME_PREPARE")) {
172
        if (!root.contains("DIPLOME_PREPARE")) {
165
            final SQLCreateTable createTableDiplome = new SQLCreateTable(root, "DIPLOME_PREPARE");
173
            final SQLCreateTable createTableDiplome = new SQLCreateTable(root, "DIPLOME_PREPARE");
166
            createTableDiplome.addVarCharColumn("CODE", 25);
174
            createTableDiplome.addVarCharColumn("CODE", 25);
167
            createTableDiplome.addVarCharColumn("NOM", 512);
175
            createTableDiplome.addVarCharColumn("NOM", 512);
168
 
176
 
169
            try {
177
            try {
170
                root.getBase().getDataSource().execute(createTableDiplome.asString());
178
                root.getBase().getDataSource().execute(createTableDiplome.asString());
171
                insertUndef(createTableDiplome);
179
                insertUndef(createTableDiplome);
172
                root.refetchTable("DIPLOME_PREPARE");
180
                root.refetchTable("DIPLOME_PREPARE");
173
                root.getSchema().updateVersion();
181
                root.getSchema().updateVersion();
174
 
182
 
175
                final SQLTable table = root.getTable("DIPLOME_PREPARE");
183
                final SQLTable table = root.getTable("DIPLOME_PREPARE");
176
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
184
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
177
                v.add(Tuple2.create("03", "Niveau de formation équivalent au CAP (certificat d'aptitude professionnelle) ou au BEP (brevet d'études professionnelles)"));
185
                v.add(Tuple2.create("03", "Niveau de formation équivalent au CAP (certificat d'aptitude professionnelle) ou au BEP (brevet d'études professionnelles)"));
178
                v.add(Tuple2.create("04", "Formation de niveau du bac (général, technologique ou professionnel), du brevet de technicien (BT) ou du brevet professionnel"));
186
                v.add(Tuple2.create("04", "Formation de niveau du bac (général, technologique ou professionnel), du brevet de technicien (BT) ou du brevet professionnel"));
179
                v.add(Tuple2.create("05", "Formation de niveau bac+2 : licence 2, BTS (brevet de technicien supérieur), DUT (diplôme universitaire de technologie), etc."));
187
                v.add(Tuple2.create("05", "Formation de niveau bac+2 : licence 2, BTS (brevet de technicien supérieur), DUT (diplôme universitaire de technologie), etc."));
180
                v.add(Tuple2.create("06", "Formation de niveau bac+3 et bac+4 : licence 3, licence professionnelle, master 1, etc."));
188
                v.add(Tuple2.create("06", "Formation de niveau bac+3 et bac+4 : licence 3, licence professionnelle, master 1, etc."));
181
                v.add(Tuple2.create("07", "Formation de niveau bac+5 : master 2, diplôme d'études approfondies, diplôme d'études supérieures spécialisées, diplôme d'ingénieur, etc."));
189
                v.add(Tuple2.create("07", "Formation de niveau bac+5 : master 2, diplôme d'études approfondies, diplôme d'études supérieures spécialisées, diplôme d'ingénieur, etc."));
182
                v.add(Tuple2.create("08", "Formation de niveau bac+8 : doctorat, habilitation à diriger des recherches, etc. "));
190
                v.add(Tuple2.create("08", "Formation de niveau bac+8 : doctorat, habilitation à diriger des recherches, etc. "));
183
 
191
 
184
                insertValues(v, table);
192
                insertValues(v, table);
185
            } catch (SQLException ex) {
193
            } catch (SQLException ex) {
186
                throw new IllegalStateException("Erreur lors de la création de la table " + "DIPLOME_PREPARE", ex);
194
                throw new IllegalStateException("Erreur lors de la création de la table " + "DIPLOME_PREPARE", ex);
187
            }
195
            }
188
        }
196
        }
189
 
197
 
190
 
-
 
191
        if (!root.contains("TYPE_PREAVIS")) {
198
        if (!root.contains("TYPE_PREAVIS")) {
192
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "TYPE_PREAVIS");
199
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "TYPE_PREAVIS");
193
            createTableMotif.addVarCharColumn("CODE", 25);
200
            createTableMotif.addVarCharColumn("CODE", 25);
194
            createTableMotif.addVarCharColumn("NOM", 512);
201
            createTableMotif.addVarCharColumn("NOM", 512);
195
 
202
 
196
            try {
203
            try {
197
                root.getBase().getDataSource().execute(createTableMotif.asString());
204
                root.getBase().getDataSource().execute(createTableMotif.asString());
198
                insertUndef(createTableMotif);
205
                insertUndef(createTableMotif);
199
                root.refetchTable("TYPE_PREAVIS");
206
                root.refetchTable("TYPE_PREAVIS");
200
                root.getSchema().updateVersion();
207
                root.getSchema().updateVersion();
201
 
208
 
202
                final SQLTable table = root.getTable("TYPE_PREAVIS");
209
                final SQLTable table = root.getTable("TYPE_PREAVIS");
203
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
210
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
204
                v.add(Tuple2.create("01", "préavis effectué et payé"));
211
                v.add(Tuple2.create("01", "préavis effectué et payé"));
205
                v.add(Tuple2.create("02", "préavis non effectué et payé"));
212
                v.add(Tuple2.create("02", "préavis non effectué et payé"));
206
                v.add(Tuple2.create("03", "préavis non effectué et non payé"));
213
                v.add(Tuple2.create("03", "préavis non effectué et non payé"));
207
                v.add(Tuple2.create("10", "préavis non effectué non payé dans le cadre d’un contrat de sécurisation professionnelle (CSP)"));
214
                v.add(Tuple2.create("10", "préavis non effectué non payé dans le cadre d’un contrat de sécurisation professionnelle (CSP)"));
208
                v.add(Tuple2.create("50", "préavis non effectué et payé dans le cadre d’un congé de reclassement"));
215
                v.add(Tuple2.create("50", "préavis non effectué et payé dans le cadre d’un congé de reclassement"));
209
                v.add(Tuple2.create("51", "préavis non effectué et payé dans le cadre d’un congé de mobilité"));
216
                v.add(Tuple2.create("51", "préavis non effectué et payé dans le cadre d’un congé de mobilité"));
210
                v.add(Tuple2.create("60", "Délai de prévenance"));
217
                v.add(Tuple2.create("60", "Délai de prévenance"));
211
                v.add(Tuple2.create("90", "pas de clause de préavis applicable"));
218
                v.add(Tuple2.create("90", "pas de clause de préavis applicable"));
212
 
219
 
213
                insertValues(v, table);
220
                insertValues(v, table);
214
            } catch (SQLException ex) {
221
            } catch (SQLException ex) {
215
                throw new IllegalStateException("Erreur lors de la création de la table " + "TYPE_PREAVIS", ex);
222
                throw new IllegalStateException("Erreur lors de la création de la table " + "TYPE_PREAVIS", ex);
216
            }
223
            }
217
        }
224
        }
218
 
225
 
219
        if (!root.contains("CODE_BASE_ASSUJETTIE")) {
226
        if (!root.contains("CODE_BASE_ASSUJETTIE")) {
220
            final SQLCreateTable createTableCodeBase = new SQLCreateTable(root, "CODE_BASE_ASSUJETTIE");
227
            final SQLCreateTable createTableCodeBase = new SQLCreateTable(root, "CODE_BASE_ASSUJETTIE");
221
            createTableCodeBase.addVarCharColumn("CODE", 25);
228
            createTableCodeBase.addVarCharColumn("CODE", 25);
222
            createTableCodeBase.addVarCharColumn("NOM", 512);
229
            createTableCodeBase.addVarCharColumn("NOM", 512);
223
 
230
 
224
            try {
231
            try {
225
                root.getBase().getDataSource().execute(createTableCodeBase.asString());
232
                root.getBase().getDataSource().execute(createTableCodeBase.asString());
226
                insertUndef(createTableCodeBase);
233
                insertUndef(createTableCodeBase);
227
                root.refetchTable("CODE_BASE_ASSUJETTIE");
234
                root.refetchTable("CODE_BASE_ASSUJETTIE");
228
                root.getSchema().updateVersion();
235
                root.getSchema().updateVersion();
229
 
236
 
230
                final SQLTable table = root.getTable("CODE_BASE_ASSUJETTIE");
237
                final SQLTable table = root.getTable("CODE_BASE_ASSUJETTIE");
231
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
238
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
232
 
239
 
233
                v.add(Tuple2.create("02", "Assiette brute plafonnée"));
240
                v.add(Tuple2.create("02", "Assiette brute plafonnée"));
234
                v.add(Tuple2.create("03", "Assiette brute déplafonnée"));
241
                v.add(Tuple2.create("03", "Assiette brute déplafonnée"));
235
                v.add(Tuple2.create("04", "Assiette de la contribution sociale généralisée"));
242
                v.add(Tuple2.create("04", "Assiette de la contribution sociale généralisée"));
236
                v.add(Tuple2.create("07", "Assiette des contributions d'Assurance Chômage"));
243
                v.add(Tuple2.create("07", "Assiette des contributions d'Assurance Chômage"));
237
                v.add(Tuple2.create("08", "Assiette retraite CPRP SNCF"));
244
                v.add(Tuple2.create("08", "Assiette retraite CPRP SNCF"));
238
                v.add(Tuple2.create("09", "Assiette de compensation bilatérale maladie CPRP SNCF"));
245
                v.add(Tuple2.create("09", "Assiette de compensation bilatérale maladie CPRP SNCF"));
239
                v.add(Tuple2.create("10", "Base brute fiscale"));
246
                v.add(Tuple2.create("10", "Base brute fiscale"));
240
                v.add(Tuple2.create("11", "Base forfaitaire soumise aux cotisations de Sécurité Sociale"));
247
                v.add(Tuple2.create("11", "Base forfaitaire soumise aux cotisations de Sécurité Sociale"));
241
                v.add(Tuple2.create("12", "Assiette du crédit d'impôt compétitivité-emploi"));
248
                v.add(Tuple2.create("12", "Assiette du crédit d'impôt compétitivité-emploi"));
242
                v.add(Tuple2.create("13", "Assiette du forfait social à 8%"));
249
                v.add(Tuple2.create("13", "Assiette du forfait social à 8%"));
243
                v.add(Tuple2.create("14", "Assiette du forfait social à 20%"));
250
                v.add(Tuple2.create("14", "Assiette du forfait social à 20%"));
244
 
251
 
245
                insertValues(v, table);
252
                insertValues(v, table);
246
            } catch (SQLException ex) {
253
            } catch (SQLException ex) {
247
                throw new IllegalStateException("Erreur lors de la création de la table " + "CODE_BASE_ASSUJETTIE", ex);
254
                throw new IllegalStateException("Erreur lors de la création de la table " + "CODE_BASE_ASSUJETTIE", ex);
248
            }
255
            }
249
        }
256
        }
250
        if (!tableRubCot.contains("ID_CODE_BASE_ASSUJETTIE")) {
257
        if (!tableRubCot.contains("ID_CODE_BASE_ASSUJETTIE")) {
251
            AlterTable alterTableCot = new AlterTable(tableRubCot);
258
            AlterTable alterTableCot = new AlterTable(tableRubCot);
252
            alterTableCot.addForeignColumn("ID_CODE_BASE_ASSUJETTIE", root.getTable("CODE_BASE_ASSUJETTIE"));
259
            alterTableCot.addForeignColumn("ID_CODE_BASE_ASSUJETTIE", root.getTable("CODE_BASE_ASSUJETTIE"));
253
            root.getBase().getDataSource().execute(alterTableCot.asString());
260
            root.getBase().getDataSource().execute(alterTableCot.asString());
254
            root.refetchTable("RUBRIQUE_COTISATION");
261
            root.refetchTable("RUBRIQUE_COTISATION");
255
            root.getSchema().updateVersion();
262
            root.getSchema().updateVersion();
256
        }
263
        }
257
 
264
 
258
        if (!root.contains("CODE_TYPE_RUBRIQUE_BRUT")) {
265
        if (!root.contains("CODE_TYPE_RUBRIQUE_BRUT")) {
259
            final SQLCreateTable createTableCodeBase = new SQLCreateTable(root, "CODE_TYPE_RUBRIQUE_BRUT");
266
            final SQLCreateTable createTableCodeBase = new SQLCreateTable(root, "CODE_TYPE_RUBRIQUE_BRUT");
260
            createTableCodeBase.addVarCharColumn("CODE", 25);
267
            createTableCodeBase.addVarCharColumn("CODE", 25);
261
            createTableCodeBase.addVarCharColumn("NOM", 512);
268
            createTableCodeBase.addVarCharColumn("NOM", 512);
262
            createTableCodeBase.addVarCharColumn("TYPE", 512);
269
            createTableCodeBase.addVarCharColumn("TYPE", 512);
263
 
270
 
264
            try {
271
            try {
265
                root.getBase().getDataSource().execute(createTableCodeBase.asString());
272
                root.getBase().getDataSource().execute(createTableCodeBase.asString());
266
                insertUndef(createTableCodeBase);
273
                insertUndef(createTableCodeBase);
267
                root.refetchTable("CODE_TYPE_RUBRIQUE_BRUT");
274
                root.refetchTable("CODE_TYPE_RUBRIQUE_BRUT");
268
                root.getSchema().updateVersion();
275
                root.getSchema().updateVersion();
269
 
276
 
270
                DsnBrutCode brutCode = new DsnBrutCode();
277
                DsnBrutCode brutCode = new DsnBrutCode();
271
                brutCode.insertCode(root.getTable("CODE_TYPE_RUBRIQUE_BRUT"));
278
                brutCode.insertCode(root.getTable("CODE_TYPE_RUBRIQUE_BRUT"));
272
            } catch (SQLException ex) {
279
            } catch (SQLException ex) {
273
                throw new IllegalStateException("Erreur lors de la création de la table " + "CODE_BASE_ASSUJETTIE", ex);
280
                throw new IllegalStateException("Erreur lors de la création de la table " + "CODE_BASE_ASSUJETTIE", ex);
274
            }
281
            }
275
        }
282
        }
276
 
283
 
277
        SQLTable tableRubBrut = root.getTable("RUBRIQUE_BRUT");
284
        SQLTable tableRubBrut = root.getTable("RUBRIQUE_BRUT");
278
        if (!tableRubBrut.contains("ID_CODE_TYPE_RUBRIQUE_BRUT")) {
285
        if (!tableRubBrut.contains("ID_CODE_TYPE_RUBRIQUE_BRUT")) {
279
            AlterTable alterTableBrut = new AlterTable(tableRubBrut);
286
            AlterTable alterTableBrut = new AlterTable(tableRubBrut);
280
            alterTableBrut.addForeignColumn("ID_CODE_TYPE_RUBRIQUE_BRUT", root.getTable("CODE_TYPE_RUBRIQUE_BRUT"));
287
            alterTableBrut.addForeignColumn("ID_CODE_TYPE_RUBRIQUE_BRUT", root.getTable("CODE_TYPE_RUBRIQUE_BRUT"));
281
            root.getBase().getDataSource().execute(alterTableBrut.asString());
288
            root.getBase().getDataSource().execute(alterTableBrut.asString());
282
            root.refetchTable("RUBRIQUE_BRUT");
289
            root.refetchTable("RUBRIQUE_BRUT");
283
            root.getSchema().updateVersion();
290
            root.getSchema().updateVersion();
284
        }
291
        }
285
 
292
 
286
        if (!tableRubBrut.contains("COTISABLE")) {
293
        if (!tableRubBrut.contains("COTISABLE")) {
287
            AlterTable alterTableBrut = new AlterTable(tableRubBrut);
294
            AlterTable alterTableBrut = new AlterTable(tableRubBrut);
288
            alterTableBrut.addBooleanColumn("COTISABLE", Boolean.TRUE, false);
295
            alterTableBrut.addBooleanColumn("COTISABLE", Boolean.TRUE, false);
289
            root.getBase().getDataSource().execute(alterTableBrut.asString());
296
            root.getBase().getDataSource().execute(alterTableBrut.asString());
290
            root.refetchTable("RUBRIQUE_BRUT");
297
            root.refetchTable("RUBRIQUE_BRUT");
291
            root.getSchema().updateVersion();
298
            root.getSchema().updateVersion();
292
        }
299
        }
293
 
300
 
294
        if (!tableRubBrut.contains("TAXABLE_CM")) {
301
        if (!tableRubBrut.contains("TAXABLE_CM")) {
295
            AlterTable alterTableBrut = new AlterTable(tableRubBrut);
302
            AlterTable alterTableBrut = new AlterTable(tableRubBrut);
296
            alterTableBrut.addBooleanColumn("TAXABLE_CM", Boolean.TRUE, false);
303
            alterTableBrut.addBooleanColumn("TAXABLE_CM", Boolean.TRUE, false);
297
            root.getBase().getDataSource().execute(alterTableBrut.asString());
304
            root.getBase().getDataSource().execute(alterTableBrut.asString());
298
            root.refetchTable("RUBRIQUE_BRUT");
305
            root.refetchTable("RUBRIQUE_BRUT");
299
            root.getSchema().updateVersion();
306
            root.getSchema().updateVersion();
300
        }
307
        }
301
 
308
 
302
        if (!tableRubBrut.contains("CSG_NORMAL")) {
309
        if (!tableRubBrut.contains("CSG_NORMAL")) {
303
            AlterTable alterTableBrut = new AlterTable(tableRubBrut);
310
            AlterTable alterTableBrut = new AlterTable(tableRubBrut);
304
            alterTableBrut.addBooleanColumn("CSG_NORMAL", Boolean.TRUE, false);
311
            alterTableBrut.addBooleanColumn("CSG_NORMAL", Boolean.TRUE, false);
305
            root.getBase().getDataSource().execute(alterTableBrut.asString());
312
            root.getBase().getDataSource().execute(alterTableBrut.asString());
306
            root.refetchTable("RUBRIQUE_BRUT");
313
            root.refetchTable("RUBRIQUE_BRUT");
307
            root.getSchema().updateVersion();
314
            root.getSchema().updateVersion();
308
        }
315
        }
309
        if (!tableRubBrut.contains("CSG_REDUIT")) {
316
        if (!tableRubBrut.contains("CSG_REDUIT")) {
310
            AlterTable alterTableBrut = new AlterTable(tableRubBrut);
317
            AlterTable alterTableBrut = new AlterTable(tableRubBrut);
311
            alterTableBrut.addBooleanColumn("CSG_REDUIT", Boolean.FALSE, false);
318
            alterTableBrut.addBooleanColumn("CSG_REDUIT", Boolean.FALSE, false);
312
            root.getBase().getDataSource().execute(alterTableBrut.asString());
319
            root.getBase().getDataSource().execute(alterTableBrut.asString());
313
            root.refetchTable("RUBRIQUE_BRUT");
320
            root.refetchTable("RUBRIQUE_BRUT");
314
            root.getSchema().updateVersion();
321
            root.getSchema().updateVersion();
315
        }
322
        }
316
 
323
 
317
        SQLTable tableRubNet = root.getTable("RUBRIQUE_NET");
324
        SQLTable tableRubNet = root.getTable("RUBRIQUE_NET");
318
        if (!tableRubNet.contains("ID_CODE_TYPE_RUBRIQUE_BRUT")) {
325
        if (!tableRubNet.contains("ID_CODE_TYPE_RUBRIQUE_BRUT")) {
319
 
326
 
320
            AlterTable alterTableNet = new AlterTable(tableRubNet);
327
            AlterTable alterTableNet = new AlterTable(tableRubNet);
321
            alterTableNet.addForeignColumn("ID_CODE_TYPE_RUBRIQUE_BRUT", root.getTable("CODE_TYPE_RUBRIQUE_BRUT"));
328
            alterTableNet.addForeignColumn("ID_CODE_TYPE_RUBRIQUE_BRUT", root.getTable("CODE_TYPE_RUBRIQUE_BRUT"));
322
            root.getBase().getDataSource().execute(alterTableNet.asString());
329
            root.getBase().getDataSource().execute(alterTableNet.asString());
323
            root.refetchTable("RUBRIQUE_NET");
330
            root.refetchTable("RUBRIQUE_NET");
324
            root.getSchema().updateVersion();
331
            root.getSchema().updateVersion();
325
        }
332
        }
326
 
333
 
327
        if (!root.contains("DSN_REGIME_LOCAL")) {
334
        if (!root.contains("DSN_REGIME_LOCAL")) {
328
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "DSN_REGIME_LOCAL");
335
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "DSN_REGIME_LOCAL");
329
            createTableMotif.addVarCharColumn("CODE", 25);
336
            createTableMotif.addVarCharColumn("CODE", 25);
330
            createTableMotif.addVarCharColumn("NOM", 512);
337
            createTableMotif.addVarCharColumn("NOM", 512);
331
 
338
 
332
            try {
339
            try {
333
                root.getBase().getDataSource().execute(createTableMotif.asString());
340
                root.getBase().getDataSource().execute(createTableMotif.asString());
334
                insertUndef(createTableMotif);
341
                insertUndef(createTableMotif);
335
                root.refetchTable("DSN_REGIME_LOCAL");
342
                root.refetchTable("DSN_REGIME_LOCAL");
336
                root.getSchema().updateVersion();
343
                root.getSchema().updateVersion();
337
 
344
 
338
                final SQLTable table = root.getTable("DSN_REGIME_LOCAL");
345
                final SQLTable table = root.getTable("DSN_REGIME_LOCAL");
339
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
346
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
340
                v.add(Tuple2.create("99", "non applicable"));
347
                v.add(Tuple2.create("99", "non applicable"));
341
                v.add(Tuple2.create("01", "régime local Alsace Moselle"));
348
                v.add(Tuple2.create("01", "régime local Alsace Moselle"));
342
                insertValues(v, table);
349
                insertValues(v, table);
343
            } catch (SQLException ex) {
350
            } catch (SQLException ex) {
344
                throw new IllegalStateException("Erreur lors de la création de la table " + "DSN_REGIME_LOCAL", ex);
351
                throw new IllegalStateException("Erreur lors de la création de la table " + "DSN_REGIME_LOCAL", ex);
345
            }
352
            }
346
        }
353
        }
347
 
354
 
348
        if (!root.contains("CONTRAT_MODALITE_TEMPS")) {
355
        if (!root.contains("CONTRAT_MODALITE_TEMPS")) {
349
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "CONTRAT_MODALITE_TEMPS");
356
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "CONTRAT_MODALITE_TEMPS");
350
            createTableMotif.addVarCharColumn("CODE", 25);
357
            createTableMotif.addVarCharColumn("CODE", 25);
351
            createTableMotif.addVarCharColumn("NOM", 512);
358
            createTableMotif.addVarCharColumn("NOM", 512);
352
 
359
 
353
            try {
360
            try {
354
                root.getBase().getDataSource().execute(createTableMotif.asString());
361
                root.getBase().getDataSource().execute(createTableMotif.asString());
355
                insertUndef(createTableMotif);
362
                insertUndef(createTableMotif);
356
                root.refetchTable("CONTRAT_MODALITE_TEMPS");
363
                root.refetchTable("CONTRAT_MODALITE_TEMPS");
357
                root.getSchema().updateVersion();
364
                root.getSchema().updateVersion();
358
 
365
 
359
                final SQLTable table = root.getTable("CONTRAT_MODALITE_TEMPS");
366
                final SQLTable table = root.getTable("CONTRAT_MODALITE_TEMPS");
360
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
367
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
361
                v.add(Tuple2.create("10", "temps plein"));
368
                v.add(Tuple2.create("10", "temps plein"));
362
                v.add(Tuple2.create("20", "temps partiel"));
369
                v.add(Tuple2.create("20", "temps partiel"));
363
                v.add(Tuple2.create("21", "temps partiel thérapeutique"));
370
                v.add(Tuple2.create("21", "temps partiel thérapeutique"));
364
                v.add(Tuple2.create("99", "salarié non concerné"));
371
                v.add(Tuple2.create("99", "salarié non concerné"));
365
                insertValues(v, table);
372
                insertValues(v, table);
366
            } catch (SQLException ex) {
373
            } catch (SQLException ex) {
367
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_MODALITE_TEMPS", ex);
374
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_MODALITE_TEMPS", ex);
368
            }
375
            }
369
        }
376
        }
370
 
377
 
371
        if (!root.contains("CONTRAT_REGIME_MALADIE")) {
378
        if (!root.contains("CONTRAT_REGIME_MALADIE")) {
372
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "CONTRAT_REGIME_MALADIE");
379
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "CONTRAT_REGIME_MALADIE");
373
            createTableMotif.addVarCharColumn("CODE", 25);
380
            createTableMotif.addVarCharColumn("CODE", 25);
374
            createTableMotif.addVarCharColumn("NOM", 512);
381
            createTableMotif.addVarCharColumn("NOM", 512);
375
 
382
 
376
            try {
383
            try {
377
                root.getBase().getDataSource().execute(createTableMotif.asString());
384
                root.getBase().getDataSource().execute(createTableMotif.asString());
378
                insertUndef(createTableMotif);
385
                insertUndef(createTableMotif);
379
                root.refetchTable("CONTRAT_REGIME_MALADIE");
386
                root.refetchTable("CONTRAT_REGIME_MALADIE");
380
                root.getSchema().updateVersion();
387
                root.getSchema().updateVersion();
381
 
388
 
382
                final SQLTable table = root.getTable("CONTRAT_REGIME_MALADIE");
389
                final SQLTable table = root.getTable("CONTRAT_REGIME_MALADIE");
383
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
390
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
384
                v.add(Tuple2.create("134", "régime spécial de la SNCF"));
391
                v.add(Tuple2.create("134", "régime spécial de la SNCF"));
385
                v.add(Tuple2.create("135", "régime spécial de la RATP"));
392
                v.add(Tuple2.create("135", "régime spécial de la RATP"));
386
                v.add(Tuple2.create("136", "établissement des invalides de la marine (ENIM)"));
393
                v.add(Tuple2.create("136", "établissement des invalides de la marine (ENIM)"));
387
                v.add(Tuple2.create("137", "mineurs ou assimilés (CANMSS)"));
394
                v.add(Tuple2.create("137", "mineurs ou assimilés (CANMSS)"));
388
                v.add(Tuple2.create("138", "militaires de carrière (CNMSS)"));
395
                v.add(Tuple2.create("138", "militaires de carrière (CNMSS)"));
389
                v.add(Tuple2.create("140", "clercs et employés de notaires (CRPCEN)"));
396
                v.add(Tuple2.create("140", "clercs et employés de notaires (CRPCEN)"));
390
                v.add(Tuple2.create("141", "chambre de commerce et d'industrie de Paris"));
397
                v.add(Tuple2.create("141", "chambre de commerce et d'industrie de Paris"));
391
                v.add(Tuple2.create("144", "Assemblée Nationale"));
398
                v.add(Tuple2.create("144", "Assemblée Nationale"));
392
                v.add(Tuple2.create("145", "Sénat"));
399
                v.add(Tuple2.create("145", "Sénat"));
393
                v.add(Tuple2.create("146", "port autonome de Bordeaux"));
400
                v.add(Tuple2.create("146", "port autonome de Bordeaux"));
394
                v.add(Tuple2.create("147", "industries électriques et gazières (CAMIEG)"));
401
                v.add(Tuple2.create("147", "industries électriques et gazières (CAMIEG)"));
395
                v.add(Tuple2.create("149", "régimes des cultes (CAVIMAC)"));
402
                v.add(Tuple2.create("149", "régimes des cultes (CAVIMAC)"));
396
                v.add(Tuple2.create("200", "régime général (CNAM)"));
403
                v.add(Tuple2.create("200", "régime général (CNAM)"));
397
                v.add(Tuple2.create("300", "régime agricole (MSA)"));
404
                v.add(Tuple2.create("300", "régime agricole (MSA)"));
398
                v.add(Tuple2.create("400", "régime spécial Banque de France"));
405
                v.add(Tuple2.create("400", "régime spécial Banque de France"));
399
                v.add(Tuple2.create("900", "autre régime (réservé Polynésie Française, Nouvelle Calédonie)"));
406
                v.add(Tuple2.create("900", "autre régime (réservé Polynésie Française, Nouvelle Calédonie)"));
400
                v.add(Tuple2.create("999", "autre"));
407
                v.add(Tuple2.create("999", "autre"));
401
 
408
 
402
                insertValues(v, table);
409
                insertValues(v, table);
403
            } catch (SQLException ex) {
410
            } catch (SQLException ex) {
404
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_REGIME_MALADIE", ex);
411
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_REGIME_MALADIE", ex);
405
            }
412
            }
406
        }
413
        }
407
 
414
 
408
        if (!root.contains("CONTRAT_REGIME_VIEILLESSE")) {
415
        if (!root.contains("CONTRAT_REGIME_VIEILLESSE")) {
409
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "CONTRAT_REGIME_VIEILLESSE");
416
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "CONTRAT_REGIME_VIEILLESSE");
410
            createTableMotif.addVarCharColumn("CODE", 25);
417
            createTableMotif.addVarCharColumn("CODE", 25);
411
            createTableMotif.addVarCharColumn("NOM", 512);
418
            createTableMotif.addVarCharColumn("NOM", 512);
412
 
419
 
413
            try {
420
            try {
414
                root.getBase().getDataSource().execute(createTableMotif.asString());
421
                root.getBase().getDataSource().execute(createTableMotif.asString());
415
                insertUndef(createTableMotif);
422
                insertUndef(createTableMotif);
416
                root.refetchTable("CONTRAT_REGIME_VIEILLESSE");
423
                root.refetchTable("CONTRAT_REGIME_VIEILLESSE");
417
                root.getSchema().updateVersion();
424
                root.getSchema().updateVersion();
418
 
425
 
419
                final SQLTable table = root.getTable("CONTRAT_REGIME_VIEILLESSE");
426
                final SQLTable table = root.getTable("CONTRAT_REGIME_VIEILLESSE");
420
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
427
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
421
                v.add(Tuple2.create("120", "retraite des agents des collectivités locales (CNRACL)"));
428
                v.add(Tuple2.create("120", "retraite des agents des collectivités locales (CNRACL)"));
422
                v.add(Tuple2.create("121", "pensions des ouvriers des établissements industriels de l'Etat (FSPOEIE)"));
429
                v.add(Tuple2.create("121", "pensions des ouvriers des établissements industriels de l'Etat (FSPOEIE)"));
423
                v.add(Tuple2.create("122", "pensions civiles et militaires de retraite de l'Etat (SRE)"));
430
                v.add(Tuple2.create("122", "pensions civiles et militaires de retraite de l'Etat (SRE)"));
424
                v.add(Tuple2.create("134", "régime spécial de la SNCF"));
431
                v.add(Tuple2.create("134", "régime spécial de la SNCF"));
425
                v.add(Tuple2.create("135", "régime spécial de la RATP"));
432
                v.add(Tuple2.create("135", "régime spécial de la RATP"));
426
                v.add(Tuple2.create("136", "établissement des invalides de la marine (ENIM)"));
433
                v.add(Tuple2.create("136", "établissement des invalides de la marine (ENIM)"));
427
                v.add(Tuple2.create("137", "mineurs ou assimilés (fonds Caisse des Dépôts)"));
434
                v.add(Tuple2.create("137", "mineurs ou assimilés (fonds Caisse des Dépôts)"));
428
                v.add(Tuple2.create("139", "Banque de France"));
435
                v.add(Tuple2.create("139", "Banque de France"));
429
                v.add(Tuple2.create("140", "clercs et employés de notaires (CRPCEN)"));
436
                v.add(Tuple2.create("140", "clercs et employés de notaires (CRPCEN)"));
430
                v.add(Tuple2.create("141", "chambre de commerce et d'industrie de Paris"));
437
                v.add(Tuple2.create("141", "chambre de commerce et d'industrie de Paris"));
431
                v.add(Tuple2.create("144", "Assemblée Nationale"));
438
                v.add(Tuple2.create("144", "Assemblée Nationale"));
432
                v.add(Tuple2.create("145", "Sénat"));
439
                v.add(Tuple2.create("145", "Sénat"));
433
                v.add(Tuple2.create("147", "industries électriques et gazières (CNIEG)"));
440
                v.add(Tuple2.create("147", "industries électriques et gazières (CNIEG)"));
434
                v.add(Tuple2.create("149", "régime des cultes (CAVIMAC)"));
441
                v.add(Tuple2.create("149", "régime des cultes (CAVIMAC)"));
435
                v.add(Tuple2.create("157", "régime de retraite des avocats (CNBF)"));
442
                v.add(Tuple2.create("157", "régime de retraite des avocats (CNBF)"));
436
                v.add(Tuple2.create("158", "SEITA"));
443
                v.add(Tuple2.create("158", "SEITA"));
437
                v.add(Tuple2.create("159", "Comédie Française"));
444
                v.add(Tuple2.create("159", "Comédie Française"));
438
                v.add(Tuple2.create("160", "Opéra de Paris"));
445
                v.add(Tuple2.create("160", "Opéra de Paris"));
439
                v.add(Tuple2.create("200", "régime général (CNAV)"));
446
                v.add(Tuple2.create("200", "régime général (CNAV)"));
440
                v.add(Tuple2.create("300", "régime agricole (MSA)"));
447
                v.add(Tuple2.create("300", "régime agricole (MSA)"));
441
                v.add(Tuple2.create("900", "autre régime (réservé Polynésie Française, Nouvelle Calédonie, Principauté de Monaco)"));
448
                v.add(Tuple2.create("900", "autre régime (réservé Polynésie Française, Nouvelle Calédonie, Principauté de Monaco)"));
442
                v.add(Tuple2.create("903", "salariés étrangers exemptés d'affiliation pour le risque vieillesse"));
449
                v.add(Tuple2.create("903", "salariés étrangers exemptés d'affiliation pour le risque vieillesse"));
443
                v.add(Tuple2.create("999", "cas particuliers d'affiliation"));
450
                v.add(Tuple2.create("999", "cas particuliers d'affiliation"));
444
 
451
 
445
                insertValues(v, table);
452
                insertValues(v, table);
446
            } catch (SQLException ex) {
453
            } catch (SQLException ex) {
447
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_REGIME_VIEILLESSE", ex);
454
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_REGIME_VIEILLESSE", ex);
448
            }
455
            }
449
        }
456
        }
450
 
457
 
451
        if (!root.contains("CONTRAT_MOTIF_RECOURS")) {
458
        if (!root.contains("CONTRAT_MOTIF_RECOURS")) {
452
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "CONTRAT_MOTIF_RECOURS");
459
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "CONTRAT_MOTIF_RECOURS");
453
            createTableMotif.addVarCharColumn("CODE", 25);
460
            createTableMotif.addVarCharColumn("CODE", 25);
454
            createTableMotif.addVarCharColumn("NOM", 512);
461
            createTableMotif.addVarCharColumn("NOM", 512);
455
 
462
 
456
            try {
463
            try {
457
                root.getBase().getDataSource().execute(createTableMotif.asString());
464
                root.getBase().getDataSource().execute(createTableMotif.asString());
458
                insertUndef(createTableMotif);
465
                insertUndef(createTableMotif);
459
                root.refetchTable("CONTRAT_MOTIF_RECOURS");
466
                root.refetchTable("CONTRAT_MOTIF_RECOURS");
460
                root.getSchema().updateVersion();
467
                root.getSchema().updateVersion();
461
 
468
 
462
                final SQLTable table = root.getTable("CONTRAT_MOTIF_RECOURS");
469
                final SQLTable table = root.getTable("CONTRAT_MOTIF_RECOURS");
463
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
470
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
464
                v.add(Tuple2.create("01", "Remplacement d'un salarié"));
471
                v.add(Tuple2.create("01", "Remplacement d'un salarié"));
465
                v.add(Tuple2.create("02", "Accroissement temporaire de l'activité de l'entreprise"));
472
                v.add(Tuple2.create("02", "Accroissement temporaire de l'activité de l'entreprise"));
466
                v.add(Tuple2.create("03", "Emplois à caractère saisonnier"));
473
                v.add(Tuple2.create("03", "Emplois à caractère saisonnier"));
467
                v.add(Tuple2.create("04", "Contrat vendanges"));
474
                v.add(Tuple2.create("04", "Contrat vendanges"));
468
                v.add(Tuple2.create("05", "Contrat à durée déterminée d’usage"));
475
                v.add(Tuple2.create("05", "Contrat à durée déterminée d’usage"));
469
                v.add(Tuple2.create("06", "Contrat à durée déterminée à objet défini"));
476
                v.add(Tuple2.create("06", "Contrat à durée déterminée à objet défini"));
470
                v.add(Tuple2.create("07", "Remplacement d'un chef d'entreprise"));
477
                v.add(Tuple2.create("07", "Remplacement d'un chef d'entreprise"));
471
                v.add(Tuple2.create("08", "Remplacement du chef d'une exploitation agricole"));
478
                v.add(Tuple2.create("08", "Remplacement du chef d'une exploitation agricole"));
472
                v.add(Tuple2.create("09", "Recrutement de personnes sans emploi rencontrant des difficultés sociales et professionnelles particulières"));
479
                v.add(Tuple2.create("09", "Recrutement de personnes sans emploi rencontrant des difficultés sociales et professionnelles particulières"));
473
                v.add(Tuple2.create("10", "Complément de formation professionnelle au salarié"));
480
                v.add(Tuple2.create("10", "Complément de formation professionnelle au salarié"));
474
                v.add(Tuple2.create("11",
481
                v.add(Tuple2.create("11",
475
                        "Formation professionnelle au salarié par la voie de l'apprentissage, en vue de l'obtention d'une qualification professionnelle sanctionnée par un diplôme ou un titre à finalité professionnelle enregistré au répertoire national des certifications professionnelles"));
482
                        "Formation professionnelle au salarié par la voie de l'apprentissage, en vue de l'obtention d'une qualification professionnelle sanctionnée par un diplôme ou un titre à finalité professionnelle enregistré au répertoire national des certifications professionnelles"));
476
                v.add(Tuple2.create("12", "Remplacement d’un salarié passé provisoirement à temps partiel"));
483
                v.add(Tuple2.create("12", "Remplacement d’un salarié passé provisoirement à temps partiel"));
477
                v.add(Tuple2.create("13", "Attente de la suppression définitive du poste du salarié ayant quitté définitivement l’entreprise"));
484
                v.add(Tuple2.create("13", "Attente de la suppression définitive du poste du salarié ayant quitté définitivement l’entreprise"));
478
                insertValues(v, table);
485
                insertValues(v, table);
479
            } catch (SQLException ex) {
486
            } catch (SQLException ex) {
480
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_MOTIF_RECOURS", ex);
487
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_MOTIF_RECOURS", ex);
481
            }
488
            }
482
        }
489
        }
483
 
490
 
484
        if (!root.contains("CONTRAT_DETACHE_EXPATRIE")) {
491
        if (!root.contains("CONTRAT_DETACHE_EXPATRIE")) {
485
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "CONTRAT_DETACHE_EXPATRIE");
492
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "CONTRAT_DETACHE_EXPATRIE");
486
            createTableMotif.addVarCharColumn("CODE", 25);
493
            createTableMotif.addVarCharColumn("CODE", 25);
487
            createTableMotif.addVarCharColumn("NOM", 512);
494
            createTableMotif.addVarCharColumn("NOM", 512);
488
 
495
 
489
            try {
496
            try {
490
                root.getBase().getDataSource().execute(createTableMotif.asString());
497
                root.getBase().getDataSource().execute(createTableMotif.asString());
491
                insertUndef(createTableMotif);
498
                insertUndef(createTableMotif);
492
                root.refetchTable("CONTRAT_DETACHE_EXPATRIE");
499
                root.refetchTable("CONTRAT_DETACHE_EXPATRIE");
493
                root.getSchema().updateVersion();
500
                root.getSchema().updateVersion();
494
 
501
 
495
                final SQLTable table = root.getTable("CONTRAT_DETACHE_EXPATRIE");
502
                final SQLTable table = root.getTable("CONTRAT_DETACHE_EXPATRIE");
496
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
503
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
497
                v.add(Tuple2.create("01", "Détaché"));
504
                v.add(Tuple2.create("01", "Détaché"));
498
                v.add(Tuple2.create("02", "Expatrié"));
505
                v.add(Tuple2.create("02", "Expatrié"));
499
                v.add(Tuple2.create("03", "Frontalier"));
506
                v.add(Tuple2.create("03", "Frontalier"));
500
                v.add(Tuple2.create("99", "Salarié non concerné"));
507
                v.add(Tuple2.create("99", "Salarié non concerné"));
501
                insertValues(v, table);
508
                insertValues(v, table);
502
            } catch (SQLException ex) {
509
            } catch (SQLException ex) {
503
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_DETACHE_EXPATRIE", ex);
510
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_DETACHE_EXPATRIE", ex);
504
            }
511
            }
505
        }
512
        }
506
 
513
 
507
        if (!root.contains("DSN_NATURE")) {
514
        if (!root.contains("DSN_NATURE")) {
508
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "DSN_NATURE");
515
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "DSN_NATURE");
509
            createTableMotif.addVarCharColumn("CODE", 25);
516
            createTableMotif.addVarCharColumn("CODE", 25);
510
            createTableMotif.addVarCharColumn("NOM", 512);
517
            createTableMotif.addVarCharColumn("NOM", 512);
511
 
518
 
512
            try {
519
            try {
513
                root.getBase().getDataSource().execute(createTableMotif.asString());
520
                root.getBase().getDataSource().execute(createTableMotif.asString());
514
                insertUndef(createTableMotif);
521
                insertUndef(createTableMotif);
515
                root.refetchTable("DSN_NATURE");
522
                root.refetchTable("DSN_NATURE");
516
                root.getSchema().updateVersion();
523
                root.getSchema().updateVersion();
517
 
524
 
518
                final SQLTable table = root.getTable("DSN_NATURE");
525
                final SQLTable table = root.getTable("DSN_NATURE");
519
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
526
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
520
                v.add(Tuple2.create("01", "DSN Mensuelle"));
527
                v.add(Tuple2.create("01", "DSN Mensuelle"));
521
                v.add(Tuple2.create("02", "Signalement Fin du contrat de travail"));
528
                v.add(Tuple2.create("02", "Signalement Fin du contrat de travail"));
522
                v.add(Tuple2.create("04", "Signalement Arrêt de travail"));
529
                v.add(Tuple2.create("04", "Signalement Arrêt de travail"));
523
                v.add(Tuple2.create("05", "Signalement Reprise suite à arrêt de travail"));
530
                v.add(Tuple2.create("05", "Signalement Reprise suite à arrêt de travail"));
524
                v.add(Tuple2.create("06", "DSN reprise d'historique"));
531
                v.add(Tuple2.create("06", "DSN reprise d'historique"));
525
                insertValues(v, table);
532
                insertValues(v, table);
526
            } catch (SQLException ex) {
533
            } catch (SQLException ex) {
527
                throw new IllegalStateException("Erreur lors de la création de la table " + "DSN_NATURE", ex);
534
                throw new IllegalStateException("Erreur lors de la création de la table " + "DSN_NATURE", ex);
528
            }
535
            }
529
        }
536
        }
530
 
537
 
531
        if (!root.contains("DSN_TYPE")) {
538
        if (!root.contains("DSN_TYPE")) {
532
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "DSN_TYPE");
539
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "DSN_TYPE");
533
            createTableMotif.addVarCharColumn("CODE", 25);
540
            createTableMotif.addVarCharColumn("CODE", 25);
534
            createTableMotif.addVarCharColumn("NOM", 512);
541
            createTableMotif.addVarCharColumn("NOM", 512);
535
 
542
 
536
            try {
543
            try {
537
                root.getBase().getDataSource().execute(createTableMotif.asString());
544
                root.getBase().getDataSource().execute(createTableMotif.asString());
538
                insertUndef(createTableMotif);
545
                insertUndef(createTableMotif);
539
                root.refetchTable("DSN_TYPE");
546
                root.refetchTable("DSN_TYPE");
540
                root.getSchema().updateVersion();
547
                root.getSchema().updateVersion();
541
 
548
 
542
                final SQLTable table = root.getTable("DSN_TYPE");
549
                final SQLTable table = root.getTable("DSN_TYPE");
543
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
550
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
544
                v.add(Tuple2.create("01", "déclaration normale"));
551
                v.add(Tuple2.create("01", "déclaration normale"));
545
                v.add(Tuple2.create("02", "déclaration normale néant"));
552
                v.add(Tuple2.create("02", "déclaration normale néant"));
546
                v.add(Tuple2.create("03", "déclaration annule et remplace intégral"));
553
                v.add(Tuple2.create("03", "déclaration annule et remplace intégral"));
547
                v.add(Tuple2.create("04", "déclaration annule"));
554
                v.add(Tuple2.create("04", "déclaration annule"));
548
                v.add(Tuple2.create("05", "annule et remplace néant"));
555
                v.add(Tuple2.create("05", "annule et remplace néant"));
549
                insertValues(v, table);
556
                insertValues(v, table);
550
            } catch (SQLException ex) {
557
            } catch (SQLException ex) {
551
                throw new IllegalStateException("Erreur lors de la création de la table " + "DSN_TYPE", ex);
558
                throw new IllegalStateException("Erreur lors de la création de la table " + "DSN_TYPE", ex);
552
            }
559
            }
553
        }
560
        }
554
 
561
 
555
        if (!root.contains("CONTRAT_DISPOSITIF_POLITIQUE")) {
562
        if (!root.contains("CONTRAT_DISPOSITIF_POLITIQUE")) {
556
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "CONTRAT_DISPOSITIF_POLITIQUE");
563
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "CONTRAT_DISPOSITIF_POLITIQUE");
557
            createTableMotif.addVarCharColumn("CODE", 25);
564
            createTableMotif.addVarCharColumn("CODE", 25);
558
            createTableMotif.addVarCharColumn("NOM", 512);
565
            createTableMotif.addVarCharColumn("NOM", 512);
559
 
566
 
560
            try {
567
            try {
561
                root.getBase().getDataSource().execute(createTableMotif.asString());
568
                root.getBase().getDataSource().execute(createTableMotif.asString());
562
                insertUndef(createTableMotif);
569
                insertUndef(createTableMotif);
563
                root.refetchTable("CONTRAT_DISPOSITIF_POLITIQUE");
570
                root.refetchTable("CONTRAT_DISPOSITIF_POLITIQUE");
564
                root.getSchema().updateVersion();
571
                root.getSchema().updateVersion();
565
 
572
 
566
                final SQLTable table = root.getTable("CONTRAT_DISPOSITIF_POLITIQUE");
573
                final SQLTable table = root.getTable("CONTRAT_DISPOSITIF_POLITIQUE");
567
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
574
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
568
                v.add(Tuple2.create("21", "CUI - Contrat Initiative Emploi"));
575
                v.add(Tuple2.create("21", "CUI - Contrat Initiative Emploi"));
569
                v.add(Tuple2.create("41", "CUI - Contrat d'Accompagnement dans l'Emploi"));
576
                v.add(Tuple2.create("41", "CUI - Contrat d'Accompagnement dans l'Emploi"));
570
                v.add(Tuple2.create("42", "CUI - Contrat d'accès à l'emploi - DOM"));
577
                v.add(Tuple2.create("42", "CUI - Contrat d'accès à l'emploi - DOM"));
571
                v.add(Tuple2.create("50", "Emploi d'avenir secteur marchand"));
578
                v.add(Tuple2.create("50", "Emploi d'avenir secteur marchand"));
572
                v.add(Tuple2.create("51", "Emploi d'avenir secteur non marchand"));
579
                v.add(Tuple2.create("51", "Emploi d'avenir secteur non marchand"));
573
                v.add(Tuple2.create("61", "Contrat de Professionnalisation"));
580
                v.add(Tuple2.create("61", "Contrat de Professionnalisation"));
574
                v.add(Tuple2.create("64", "Contrat d'apprentissage entreprises artisanales ou de moins de 11 salariés (loi du 3 janvier 1979)"));
581
                v.add(Tuple2.create("64", "Contrat d'apprentissage entreprises artisanales ou de moins de 11 salariés (loi du 3 janvier 1979)"));
575
                v.add(Tuple2.create("65", "Contrat d’apprentissage entreprises non inscrites au répertoire des métiers d’au moins 11 salariés (loi de 1987)"));
582
                v.add(Tuple2.create("65", "Contrat d’apprentissage entreprises non inscrites au répertoire des métiers d’au moins 11 salariés (loi de 1987)"));
576
                v.add(Tuple2.create("70", "Contrat à durée déterminée pour les séniors"));
583
                v.add(Tuple2.create("70", "Contrat à durée déterminée pour les séniors"));
577
                v.add(Tuple2.create("71", "Contrat à durée déterminée d’insertion"));
584
                v.add(Tuple2.create("71", "Contrat à durée déterminée d’insertion"));
578
                v.add(Tuple2.create("80", "Contrat de génération"));
585
                v.add(Tuple2.create("80", "Contrat de génération"));
579
                v.add(Tuple2.create("81", "Contrat d'apprentissage secteur public (Loi de 1992)"));
586
                v.add(Tuple2.create("81", "Contrat d'apprentissage secteur public (Loi de 1992)"));
580
                v.add(Tuple2.create("82", "Contrat à durée indéterminée intérimaire"));
587
                v.add(Tuple2.create("82", "Contrat à durée indéterminée intérimaire"));
581
                v.add(Tuple2.create("99", "Non concerné"));
588
                v.add(Tuple2.create("99", "Non concerné"));
582
                insertValues(v, table);
589
                insertValues(v, table);
583
            } catch (SQLException ex) {
590
            } catch (SQLException ex) {
584
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_DISPOSITIF_POLITIQUE", ex);
591
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_DISPOSITIF_POLITIQUE", ex);
585
            }
592
            }
586
        }
593
        }
587
 
594
 
588
        if (!root.contains("CODE_AMENAGEMENT_PARTIEL")) {
595
        if (!root.contains("CODE_AMENAGEMENT_PARTIEL")) {
589
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "CODE_AMENAGEMENT_PARTIEL");
596
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "CODE_AMENAGEMENT_PARTIEL");
590
            createTableMotif.addVarCharColumn("CODE", 25);
597
            createTableMotif.addVarCharColumn("CODE", 25);
591
            createTableMotif.addVarCharColumn("NOM", 512);
598
            createTableMotif.addVarCharColumn("NOM", 512);
592
 
599
 
593
            try {
600
            try {
594
                root.getBase().getDataSource().execute(createTableMotif.asString());
601
                root.getBase().getDataSource().execute(createTableMotif.asString());
595
                insertUndef(createTableMotif);
602
                insertUndef(createTableMotif);
596
                root.refetchTable("CODE_AMENAGEMENT_PARTIEL");
603
                root.refetchTable("CODE_AMENAGEMENT_PARTIEL");
597
                root.getSchema().updateVersion();
604
                root.getSchema().updateVersion();
598
 
605
 
599
                final SQLTable table = root.getTable("CODE_AMENAGEMENT_PARTIEL");
606
                final SQLTable table = root.getTable("CODE_AMENAGEMENT_PARTIEL");
600
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
607
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
601
 
608
 
602
                v.add(Tuple2.create("01", "Forfait hebdomadaire"));
609
                v.add(Tuple2.create("01", "Forfait hebdomadaire"));
603
                v.add(Tuple2.create("02", "Autre temps de travail hebdomadaire"));
610
                v.add(Tuple2.create("02", "Autre temps de travail hebdomadaire"));
604
                v.add(Tuple2.create("03", "Equivalent à 35h - 39h (Mayotte)"));
611
                v.add(Tuple2.create("03", "Equivalent à 35h - 39h (Mayotte)"));
605
                v.add(Tuple2.create("04", "Forfait mensuel"));
612
                v.add(Tuple2.create("04", "Forfait mensuel"));
606
                v.add(Tuple2.create("05", "Forfait annuel en jour"));
613
                v.add(Tuple2.create("05", "Forfait annuel en jour"));
607
                v.add(Tuple2.create("06", "Forfait annuel en heures"));
614
                v.add(Tuple2.create("06", "Forfait annuel en heures"));
608
                v.add(Tuple2.create("07", "Cycle"));
615
                v.add(Tuple2.create("07", "Cycle"));
609
                v.add(Tuple2.create("08", "Modulation"));
616
                v.add(Tuple2.create("08", "Modulation"));
610
                v.add(Tuple2.create("09", "Aménagement du temps de travail (Loi du 20 août 2008)"));
617
                v.add(Tuple2.create("09", "Aménagement du temps de travail (Loi du 20 août 2008)"));
611
                v.add(Tuple2.create("10", "Personnel navigant ou autres"));
618
                v.add(Tuple2.create("10", "Personnel navigant ou autres"));
612
 
619
 
613
                insertValues(v, table);
620
                insertValues(v, table);
614
            } catch (SQLException ex) {
621
            } catch (SQLException ex) {
615
                throw new IllegalStateException("Erreur lors de la création de la table " + "CODE_AMENAGEMENT_PARTIEL", ex);
622
                throw new IllegalStateException("Erreur lors de la création de la table " + "CODE_AMENAGEMENT_PARTIEL", ex);
616
            }
623
            }
617
        }
624
        }
618
 
625
 
619
        if (!root.contains("CODE_SUSPENSION")) {
626
        if (!root.contains("CODE_SUSPENSION")) {
620
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "CODE_SUSPENSION");
627
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "CODE_SUSPENSION");
621
            createTableMotif.addVarCharColumn("CODE", 25);
628
            createTableMotif.addVarCharColumn("CODE", 25);
622
            createTableMotif.addVarCharColumn("NOM", 512);
629
            createTableMotif.addVarCharColumn("NOM", 512);
623
 
630
 
624
            try {
631
            try {
625
                root.getBase().getDataSource().execute(createTableMotif.asString());
632
                root.getBase().getDataSource().execute(createTableMotif.asString());
626
                insertUndef(createTableMotif);
633
                insertUndef(createTableMotif);
627
                root.refetchTable("CODE_SUSPENSION");
634
                root.refetchTable("CODE_SUSPENSION");
628
                root.getSchema().updateVersion();
635
                root.getSchema().updateVersion();
629
 
636
 
630
                final SQLTable table = root.getTable("CODE_SUSPENSION");
637
                final SQLTable table = root.getTable("CODE_SUSPENSION");
631
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
638
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
632
 
639
 
633
                v.add(Tuple2.create("112", "Invalidité catégorie 1"));
640
                v.add(Tuple2.create("112", "Invalidité catégorie 1"));
634
                v.add(Tuple2.create("114", "Invalidité catégorie 2"));
641
                v.add(Tuple2.create("114", "Invalidité catégorie 2"));
635
                v.add(Tuple2.create("116", "Invalidité catégorie 3"));
642
                v.add(Tuple2.create("116", "Invalidité catégorie 3"));
636
                v.add(Tuple2.create("200", "COP (Congés payés)"));
643
                v.add(Tuple2.create("200", "COP (Congés payés)"));
637
                v.add(Tuple2.create("301", "Congé de Formation Professionnelle"));
644
                v.add(Tuple2.create("301", "Congé de Formation Professionnelle"));
638
                v.add(Tuple2.create("501", "Congé divers non rémunéré"));
645
                v.add(Tuple2.create("501", "Congé divers non rémunéré"));
639
                v.add(Tuple2.create("507", "Chômage intempéries"));
646
                v.add(Tuple2.create("507", "Chômage intempéries"));
640
                v.add(Tuple2.create("601", "Mobilité volontaire sécurisée"));
647
                v.add(Tuple2.create("601", "Mobilité volontaire sécurisée"));
641
                v.add(Tuple2.create("602", "Chômage sans rupture de contrat"));
648
                v.add(Tuple2.create("602", "Chômage sans rupture de contrat"));
642
                v.add(Tuple2.create("603", "Détention provisoire"));
649
                v.add(Tuple2.create("603", "Détention provisoire"));
643
                v.add(Tuple2.create("604", "Journée de perception de l'allocation journalière de présence parentale"));
650
                v.add(Tuple2.create("604", "Journée de perception de l'allocation journalière de présence parentale"));
644
                v.add(Tuple2.create("605", "Congé statutaire"));
651
                v.add(Tuple2.create("605", "Congé statutaire"));
645
                v.add(Tuple2.create("606", "Détachement d'un salarié IEG en France"));
652
                v.add(Tuple2.create("606", "Détachement d'un salarié IEG en France"));
646
                v.add(Tuple2.create("607", "Congé de présence parentale"));
653
                v.add(Tuple2.create("607", "Congé de présence parentale"));
647
                v.add(Tuple2.create("608", "CASA"));
654
                v.add(Tuple2.create("608", "CASA"));
648
                v.add(Tuple2.create("609", "CIF (Congé Individuel de Formation)"));
655
                v.add(Tuple2.create("609", "CIF (Congé Individuel de Formation)"));
649
                v.add(Tuple2.create("611", "Congé de bilan de compétences"));
656
                v.add(Tuple2.create("611", "Congé de bilan de compétences"));
650
                v.add(Tuple2.create("612", "Congé de candidat parlementaire ou élu à un mandat local"));
657
                v.add(Tuple2.create("612", "Congé de candidat parlementaire ou élu à un mandat local"));
651
                v.add(Tuple2.create("615", "Congé de formation de cadres et d'animateurs pour la jeunesse"));
658
                v.add(Tuple2.create("615", "Congé de formation de cadres et d'animateurs pour la jeunesse"));
652
                v.add(Tuple2.create("617", "Congé de formation pour les salariés de moins de 25 ans"));
659
                v.add(Tuple2.create("617", "Congé de formation pour les salariés de moins de 25 ans"));
653
                v.add(Tuple2.create("618", "Congé de formation économique, sociale et syndicale"));
660
                v.add(Tuple2.create("618", "Congé de formation économique, sociale et syndicale"));
654
                v.add(Tuple2.create("620", "Congé de mobilité"));
661
                v.add(Tuple2.create("620", "Congé de mobilité"));
655
                v.add(Tuple2.create("621", "Congé de participation aux instances d'emploi ou de formation professionnelle"));
662
                v.add(Tuple2.create("621", "Congé de participation aux instances d'emploi ou de formation professionnelle"));
656
                v.add(Tuple2.create("625", "Congé de reclassement"));
663
                v.add(Tuple2.create("625", "Congé de reclassement"));
657
                v.add(Tuple2.create("626", "Congé de représentation"));
664
                v.add(Tuple2.create("626", "Congé de représentation"));
658
                v.add(Tuple2.create("627", "Congé de solidarité familiale"));
665
                v.add(Tuple2.create("627", "Congé de solidarité familiale"));
659
                v.add(Tuple2.create("628", "Congé de solidarité internationale"));
666
                v.add(Tuple2.create("628", "Congé de solidarité internationale"));
660
                v.add(Tuple2.create("630", "Congé d'enseignement ou de recherche"));
667
                v.add(Tuple2.create("630", "Congé d'enseignement ou de recherche"));
661
                v.add(Tuple2.create("631", "Congé mutualiste de formation"));
668
                v.add(Tuple2.create("631", "Congé mutualiste de formation"));
662
                v.add(Tuple2.create("632", "Congé parental d'éducation"));
669
                v.add(Tuple2.create("632", "Congé parental d'éducation"));
663
                v.add(Tuple2.create("633", "Congé pour acquisition de la nationalité"));
670
                v.add(Tuple2.create("633", "Congé pour acquisition de la nationalité"));
664
                v.add(Tuple2.create("634", "Congé pour catastrophe naturelle"));
671
                v.add(Tuple2.create("634", "Congé pour catastrophe naturelle"));
665
                v.add(Tuple2.create("635", "Congé pour création ou reprise d'entreprise"));
672
                v.add(Tuple2.create("635", "Congé pour création ou reprise d'entreprise"));
666
                v.add(Tuple2.create("636", "Congé pour enfant malade"));
673
                v.add(Tuple2.create("636", "Congé pour enfant malade"));
667
                v.add(Tuple2.create("637", "Congé pour évènement familial"));
674
                v.add(Tuple2.create("637", "Congé pour évènement familial"));
668
                v.add(Tuple2.create("638", "Congé pour validation des acquis de l'expérience"));
675
                v.add(Tuple2.create("638", "Congé pour validation des acquis de l'expérience"));
669
                v.add(Tuple2.create("639", "Congé sabbatique"));
676
                v.add(Tuple2.create("639", "Congé sabbatique"));
670
                v.add(Tuple2.create("642", "Convention FNE d'aide au passage à temps partiel"));
677
                v.add(Tuple2.create("642", "Convention FNE d'aide au passage à temps partiel"));
671
                v.add(Tuple2.create("643", "Congé de conversion avec prise en charge par l'Etat"));
678
                v.add(Tuple2.create("643", "Congé de conversion avec prise en charge par l'Etat"));
672
                v.add(Tuple2.create("644", "Congé de conversion sans prise en charge par l'Etat"));
679
                v.add(Tuple2.create("644", "Congé de conversion sans prise en charge par l'Etat"));
673
                v.add(Tuple2.create("645", "Préretraite progressive"));
680
                v.add(Tuple2.create("645", "Préretraite progressive"));
674
                v.add(Tuple2.create("646", "Préretraite d'entreprise sans rupture de contrat de travail"));
681
                v.add(Tuple2.create("646", "Préretraite d'entreprise sans rupture de contrat de travail"));
675
                v.add(Tuple2.create("647", "Réduction temps d'emploi"));
682
                v.add(Tuple2.create("647", "Réduction temps d'emploi"));
676
                v.add(Tuple2.create("648", "Conventions d'Allocations Spéciales du FNE (ASFNE)"));
683
                v.add(Tuple2.create("648", "Conventions d'Allocations Spéciales du FNE (ASFNE)"));
677
                v.add(Tuple2.create("650", "Congé de proche aidant"));
684
                v.add(Tuple2.create("650", "Congé de proche aidant"));
678
                v.add(Tuple2.create("651", "Congé pour mandat parlementaire"));
685
                v.add(Tuple2.create("651", "Congé pour mandat parlementaire"));
679
                v.add(Tuple2.create("652", "Inaptitude temporaire liée à la grossesse"));
686
                v.add(Tuple2.create("652", "Inaptitude temporaire liée à la grossesse"));
680
                v.add(Tuple2.create("653", "Maintien de salaire – personnel navigant de l’aéronautique civile"));
687
                v.add(Tuple2.create("653", "Maintien de salaire – personnel navigant de l’aéronautique civile"));
681
                v.add(Tuple2.create("654", "Inactivité temps alterné – personnel navigant de l’aéronautique civile"));
688
                v.add(Tuple2.create("654", "Inactivité temps alterné – personnel navigant de l’aéronautique civile"));
682
                v.add(Tuple2.create("655", "[FP] Détachement conduisant à pension (ECP)"));
689
                v.add(Tuple2.create("655", "[FP] Détachement conduisant à pension (ECP)"));
683
                v.add(Tuple2.create("656", "[FP] Congé pour cessation anticipée d’activité du fait d’une maladie professionnelle provoquée par l’amiante"));
690
                v.add(Tuple2.create("656", "[FP] Congé pour cessation anticipée d’activité du fait d’une maladie professionnelle provoquée par l’amiante"));
684
                v.add(Tuple2.create("657", "[FP] Absence concertée de travail"));
691
                v.add(Tuple2.create("657", "[FP] Absence concertée de travail"));
685
                v.add(Tuple2.create("658", "[FP] Congé spécial"));
692
                v.add(Tuple2.create("658", "[FP] Congé spécial"));
686
                v.add(Tuple2.create("659", "[FP] Période d'instruction militaire ou réserve opérationnelle"));
693
                v.add(Tuple2.create("659", "[FP] Période d'instruction militaire ou réserve opérationnelle"));
687
                v.add(Tuple2.create("660", "[FP] Congé avec traitement période d'instruction militaire obligatoire"));
694
                v.add(Tuple2.create("660", "[FP] Congé avec traitement période d'instruction militaire obligatoire"));
688
                v.add(Tuple2.create("661", "[FP] Congé organisations de jeunesse"));
695
                v.add(Tuple2.create("661", "[FP] Congé organisations de jeunesse"));
689
                v.add(Tuple2.create("662", "[FP] Congé pour siéger auprès d’une association, d’une mutuelle, d’une instance de l’Etat ou d’une collectivité territoriale"));
696
                v.add(Tuple2.create("662", "[FP] Congé pour siéger auprès d’une association, d’une mutuelle, d’une instance de l’Etat ou d’une collectivité territoriale"));
690
                v.add(Tuple2.create("663", "[FP] Congé non rémunéré de 18 jours pour mandats municipaux ou départementaux ou régionaux"));
697
                v.add(Tuple2.create("663", "[FP] Congé non rémunéré de 18 jours pour mandats municipaux ou départementaux ou régionaux"));
691
                v.add(Tuple2.create("664", "[FP] Congé avec traitement pour période d'activité dans la réserve de sécurité civile"));
698
                v.add(Tuple2.create("664", "[FP] Congé avec traitement pour période d'activité dans la réserve de sécurité civile"));
692
                v.add(Tuple2.create("665", "[FP] Congé pour période d'activité dans la réserve sanitaire"));
699
                v.add(Tuple2.create("665", "[FP] Congé pour période d'activité dans la réserve sanitaire"));
693
                v.add(Tuple2.create("666", "[FP] Congé pour recherches ou conversions thématiques"));
700
                v.add(Tuple2.create("666", "[FP] Congé pour recherches ou conversions thématiques"));
694
                v.add(Tuple2.create("667", "[FP] Congé pour raisons opérationnelles et activités privées des sapeurs"));
701
                v.add(Tuple2.create("667", "[FP] Congé pour raisons opérationnelles et activités privées des sapeurs"));
695
                v.add(Tuple2.create("668", "[FP] Congé pour raisons opérationnelles cotisé des sapeurs"));
702
                v.add(Tuple2.create("668", "[FP] Congé pour raisons opérationnelles cotisé des sapeurs"));
696
                v.add(Tuple2.create("669", "[FP] Congé pour difficultés opérationnelles des sapeurs"));
703
                v.add(Tuple2.create("669", "[FP] Congé pour difficultés opérationnelles des sapeurs"));
697
                v.add(Tuple2.create("670", "[FP] Congé pour période d'activité dans la réserve civile de la police"));
704
                v.add(Tuple2.create("670", "[FP] Congé pour période d'activité dans la réserve civile de la police"));
698
                v.add(Tuple2.create("671", "[FP] Exclusion temporaire de fonctions"));
705
                v.add(Tuple2.create("671", "[FP] Exclusion temporaire de fonctions"));
699
                v.add(Tuple2.create("672", "[FP] Suspension"));
706
                v.add(Tuple2.create("672", "[FP] Suspension"));
700
                v.add(Tuple2.create("673", "[FP] Absences irrégulières (service non fait)"));
707
                v.add(Tuple2.create("673", "[FP] Absences irrégulières (service non fait)"));
701
                v.add(Tuple2.create("674", "[FP] Détachement ne conduisant pas à pension (ENCP)"));
708
                v.add(Tuple2.create("674", "[FP] Détachement ne conduisant pas à pension (ENCP)"));
702
                v.add(Tuple2.create("675", "[FP] Disponibilité"));
709
                v.add(Tuple2.create("675", "[FP] Disponibilité"));
703
                v.add(Tuple2.create("676", "[FP] Disponibilité pour maladie"));
710
                v.add(Tuple2.create("676", "[FP] Disponibilité pour maladie"));
704
                v.add(Tuple2.create("677", "[FP] Disponibilité pour élever un enfant âgé de moins de 8 ans"));
711
                v.add(Tuple2.create("677", "[FP] Disponibilité pour élever un enfant âgé de moins de 8 ans"));
705
                v.add(Tuple2.create("678", "[FP] Position hors cadres"));
712
                v.add(Tuple2.create("678", "[FP] Position hors cadres"));
706
                v.add(Tuple2.create("680", "Congé sans solde cotisés"));
713
                v.add(Tuple2.create("680", "Congé sans solde cotisés"));
707
                v.add(Tuple2.create("681", "Détachement hors IEG"));
714
                v.add(Tuple2.create("681", "Détachement hors IEG"));
708
                v.add(Tuple2.create("998", "Annulation"));
715
                v.add(Tuple2.create("998", "Annulation"));
709
 
716
 
710
                insertValues(v, table);
717
                insertValues(v, table);
711
            } catch (SQLException ex) {
718
            } catch (SQLException ex) {
712
                throw new IllegalStateException("Erreur lors de la création de la table " + "CODE_SUSPENSION", ex);
719
                throw new IllegalStateException("Erreur lors de la création de la table " + "CODE_SUSPENSION", ex);
713
            }
720
            }
714
        }
721
        }
715
 
722
 
716
        if (!root.contains("MOTIF_REPRISE_ARRET_TRAVAIL")) {
723
        if (!root.contains("MOTIF_REPRISE_ARRET_TRAVAIL")) {
717
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "MOTIF_REPRISE_ARRET_TRAVAIL");
724
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "MOTIF_REPRISE_ARRET_TRAVAIL");
718
            createTableMotif.addVarCharColumn("CODE", 25);
725
            createTableMotif.addVarCharColumn("CODE", 25);
719
            createTableMotif.addVarCharColumn("NOM", 512);
726
            createTableMotif.addVarCharColumn("NOM", 512);
720
 
727
 
721
            try {
728
            try {
722
                root.getBase().getDataSource().execute(createTableMotif.asString());
729
                root.getBase().getDataSource().execute(createTableMotif.asString());
723
                insertUndef(createTableMotif);
730
                insertUndef(createTableMotif);
724
                root.refetchTable("MOTIF_REPRISE_ARRET_TRAVAIL");
731
                root.refetchTable("MOTIF_REPRISE_ARRET_TRAVAIL");
725
                root.getSchema().updateVersion();
732
                root.getSchema().updateVersion();
726
 
733
 
727
                final SQLTable table = root.getTable("MOTIF_REPRISE_ARRET_TRAVAIL");
734
                final SQLTable table = root.getTable("MOTIF_REPRISE_ARRET_TRAVAIL");
728
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
735
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
729
                v.add(Tuple2.create("01", "reprise normale"));
736
                v.add(Tuple2.create("01", "reprise normale"));
730
                v.add(Tuple2.create("02", "reprise temps partiel thérapeutique"));
737
                v.add(Tuple2.create("02", "reprise temps partiel thérapeutique"));
731
                v.add(Tuple2.create("03", "reprise temps partiel raison personnelle"));
738
                v.add(Tuple2.create("03", "reprise temps partiel raison personnelle"));
732
                insertValues(v, table);
739
                insertValues(v, table);
733
            } catch (SQLException ex) {
740
            } catch (SQLException ex) {
734
                throw new IllegalStateException("Erreur lors de la création de la table " + "MOTIF_REPRISE_ARRET_TRAVAIL", ex);
741
                throw new IllegalStateException("Erreur lors de la création de la table " + "MOTIF_REPRISE_ARRET_TRAVAIL", ex);
735
            }
742
            }
736
        }
743
        }
737
 
744
 
738
        if (!root.contains("MOTIF_FIN_CONTRAT")) {
745
        if (!root.contains("MOTIF_FIN_CONTRAT")) {
739
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "MOTIF_FIN_CONTRAT");
746
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "MOTIF_FIN_CONTRAT");
740
            createTableMotif.addVarCharColumn("CODE", 25);
747
            createTableMotif.addVarCharColumn("CODE", 25);
741
            createTableMotif.addVarCharColumn("NOM", 512);
748
            createTableMotif.addVarCharColumn("NOM", 512);
742
 
749
 
743
            try {
750
            try {
744
                root.getBase().getDataSource().execute(createTableMotif.asString());
751
                root.getBase().getDataSource().execute(createTableMotif.asString());
745
                insertUndef(createTableMotif);
752
                insertUndef(createTableMotif);
746
                root.refetchTable("MOTIF_FIN_CONTRAT");
753
                root.refetchTable("MOTIF_FIN_CONTRAT");
747
                root.getSchema().updateVersion();
754
                root.getSchema().updateVersion();
748
 
755
 
749
                final SQLTable table = root.getTable("MOTIF_FIN_CONTRAT");
756
                final SQLTable table = root.getTable("MOTIF_FIN_CONTRAT");
750
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
757
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
751
                v.add(Tuple2.create("011", "licenciement suite à liquidation judiciaire ou à redressement judiciaire"));
758
                v.add(Tuple2.create("011", "licenciement suite à liquidation judiciaire ou à redressement judiciaire"));
752
                v.add(Tuple2.create("012", "licenciement suite à fermeture définitive de l'établissement"));
759
                v.add(Tuple2.create("012", "licenciement suite à fermeture définitive de l'établissement"));
753
                v.add(Tuple2.create("014", "licenciement pour motif économique"));
760
                v.add(Tuple2.create("014", "licenciement pour motif économique"));
754
                v.add(Tuple2.create("015", "licenciement pour fin de chantier"));
761
                v.add(Tuple2.create("015", "licenciement pour fin de chantier"));
755
                v.add(Tuple2.create("020", "licenciement pour autre motif"));
762
                v.add(Tuple2.create("020", "licenciement pour autre motif"));
756
                v.add(Tuple2.create("025", "autre fin de contrat pour motif économique"));
763
                v.add(Tuple2.create("025", "autre fin de contrat pour motif économique"));
757
                v.add(Tuple2.create("026", "rupture pour motif économique dans le cadre d’un contrat de sécurisation professionnelle CSP"));
764
                v.add(Tuple2.create("026", "rupture pour motif économique dans le cadre d’un contrat de sécurisation professionnelle CSP"));
758
                v.add(Tuple2.create("031", "fin de contrat à durée déterminée ou fin d'accueil occasionnel"));
765
                v.add(Tuple2.create("031", "fin de contrat à durée déterminée ou fin d'accueil occasionnel"));
759
                v.add(Tuple2.create("032", "fin de mission d'intérim"));
766
                v.add(Tuple2.create("032", "fin de mission d'intérim"));
760
                v.add(Tuple2.create("033", "rupture anticipée d’un CDD ou d’un contrat de mission en cas d’inaptitude physique constatée par le médecin du travail"));
767
                v.add(Tuple2.create("033", "rupture anticipée d’un CDD ou d’un contrat de mission en cas d’inaptitude physique constatée par le médecin du travail"));
761
                v.add(Tuple2.create("034", "fin de période d'essai à l'initiative de l'employeur"));
768
                v.add(Tuple2.create("034", "fin de période d'essai à l'initiative de l'employeur"));
762
                v.add(Tuple2.create("035", "fin de période d'essai à l'initiative du salarié"));
769
                v.add(Tuple2.create("035", "fin de période d'essai à l'initiative du salarié"));
763
                v.add(Tuple2.create("036", " rupture anticipée d'un CDD, d'un contrat d'apprentissage ou d’un contrat de mission à l'initiative de l'employeur"));
770
                v.add(Tuple2.create("036", " rupture anticipée d'un CDD, d'un contrat d'apprentissage ou d’un contrat de mission à l'initiative de l'employeur"));
764
                v.add(Tuple2.create("037", "rupture anticipée d'un CDD, d'un contrat d'apprentissage ou d’un contrat de mission à l'initiative du salarié"));
771
                v.add(Tuple2.create("037", "rupture anticipée d'un CDD, d'un contrat d'apprentissage ou d’un contrat de mission à l'initiative du salarié"));
765
                v.add(Tuple2.create("038", "mise à la retraite par l'employeur"));
772
                v.add(Tuple2.create("038", "mise à la retraite par l'employeur"));
766
                v.add(Tuple2.create("039", "départ à la retraite à l'initiative du salarié"));
773
                v.add(Tuple2.create("039", "départ à la retraite à l'initiative du salarié"));
767
                v.add(Tuple2.create("043", "rupture conventionnelle"));
774
                v.add(Tuple2.create("043", "rupture conventionnelle"));
768
                v.add(Tuple2.create("058", "prise d'acte de la rupture de contrat de travail"));
775
                v.add(Tuple2.create("058", "prise d'acte de la rupture de contrat de travail"));
769
                v.add(Tuple2.create("059", "démission"));
776
                v.add(Tuple2.create("059", "démission"));
770
                v.add(Tuple2.create("065", "décès de l'employeur ou internement / conduit à un licenciement autre motif"));
777
                v.add(Tuple2.create("065", "décès de l'employeur ou internement / conduit à un licenciement autre motif"));
771
                v.add(Tuple2.create("066", "décès du salarié / rupture force majeure"));
778
                v.add(Tuple2.create("066", "décès du salarié / rupture force majeure"));
772
                v.add(Tuple2.create("081", "fin de contrat d'apprentissage"));
779
                v.add(Tuple2.create("081", "fin de contrat d'apprentissage"));
773
                v.add(Tuple2.create("082", "résiliation judiciaire du contrat de travail"));
780
                v.add(Tuple2.create("082", "résiliation judiciaire du contrat de travail"));
774
                v.add(Tuple2.create("083", "rupture de contrat de travail ou d’un contrat de mission pour force majeure"));
781
                v.add(Tuple2.create("083", "rupture de contrat de travail ou d’un contrat de mission pour force majeure"));
775
                v.add(Tuple2.create("084", "rupture d'un commun accord du CDD, du contrat d'apprentissage ou d’un contrat de mission"));
782
                v.add(Tuple2.create("084", "rupture d'un commun accord du CDD, du contrat d'apprentissage ou d’un contrat de mission"));
776
                v.add(Tuple2.create("085", "fin de mandat"));
783
                v.add(Tuple2.create("085", "fin de mandat"));
777
                v.add(Tuple2.create("086", "licenciement convention CATS"));
784
                v.add(Tuple2.create("086", "licenciement convention CATS"));
778
                v.add(Tuple2.create("087", "licenciement pour faute grave"));
785
                v.add(Tuple2.create("087", "licenciement pour faute grave"));
779
                v.add(Tuple2.create("088", "licenciement pour faute lourde"));
786
                v.add(Tuple2.create("088", "licenciement pour faute lourde"));
780
                v.add(Tuple2.create("089", "licenciement pour force majeure"));
787
                v.add(Tuple2.create("089", "licenciement pour force majeure"));
781
                v.add(Tuple2.create("091", "licenciement pour inaptitude physique d'origine non professionnelle"));
788
                v.add(Tuple2.create("091", "licenciement pour inaptitude physique d'origine non professionnelle"));
782
                v.add(Tuple2.create("092", "licenciement pour inaptitude physique d'origine professionnelle"));
789
                v.add(Tuple2.create("092", "licenciement pour inaptitude physique d'origine professionnelle"));
783
                v.add(Tuple2.create("093", "licenciement suite à décision d'une autorité administrative"));
790
                v.add(Tuple2.create("093", "licenciement suite à décision d'une autorité administrative"));
784
                v.add(Tuple2.create("094", "rupture anticipée du contrat de travail pour arrêt de tournage"));
791
                v.add(Tuple2.create("094", "rupture anticipée du contrat de travail pour arrêt de tournage"));
785
                v.add(Tuple2.create("095", "rupture anticipée du contrat de travail ou d’un contrat de mission pour faute grave"));
792
                v.add(Tuple2.create("095", "rupture anticipée du contrat de travail ou d’un contrat de mission pour faute grave"));
786
                v.add(Tuple2.create("096", "rupture anticipée du contrat de travail ou d’un contrat de mission pour faute lourde"));
793
                v.add(Tuple2.create("096", "rupture anticipée du contrat de travail ou d’un contrat de mission pour faute lourde"));
787
                v.add(Tuple2.create("097", "rupture anticipée d’un contrat de travail ou d’un contrat de mission suite à fermeture de l'établissement"));
794
                v.add(Tuple2.create("097", "rupture anticipée d’un contrat de travail ou d’un contrat de mission suite à fermeture de l'établissement"));
788
                v.add(Tuple2.create("098", "retrait d'enfant"));
795
                v.add(Tuple2.create("098", "retrait d'enfant"));
789
                v.add(Tuple2.create("998", "transfert du contrat de travail sans rupture du contrat vers un autre établissement n'effectuant pas encore de DSN"));
796
                v.add(Tuple2.create("998", "transfert du contrat de travail sans rupture du contrat vers un autre établissement n'effectuant pas encore de DSN"));
790
                v.add(Tuple2.create("999", "fin de relation avec l’employeur (autres que contrat de travail) pour les cas ne portant aucun impact sur l’Assurance chômage"));
797
                v.add(Tuple2.create("999", "fin de relation avec l’employeur (autres que contrat de travail) pour les cas ne portant aucun impact sur l’Assurance chômage"));
791
                insertValues(v, table);
798
                insertValues(v, table);
792
            } catch (SQLException ex) {
799
            } catch (SQLException ex) {
793
                throw new IllegalStateException("Erreur lors de la création de la table " + "MOTIF_FIN_CONTRAT", ex);
800
                throw new IllegalStateException("Erreur lors de la création de la table " + "MOTIF_FIN_CONTRAT", ex);
794
            }
801
            }
795
        }
802
        }
796
 
803
 
797
        DSNUpdateRubrique dsnUpdateRubrique = new DSNUpdateRubrique(root);
804
        DSNUpdateRubrique dsnUpdateRubrique = new DSNUpdateRubrique(root);
798
        dsnUpdateRubrique.updateRubriqueCotisation();
805
        dsnUpdateRubrique.updateRubriqueCotisation();
799
 
806
 
800
        // PHASE 3
807
        // PHASE 3
801
        final SQLTable caisseCot = root.getTable("CAISSE_COTISATION");
808
        final SQLTable caisseCot = root.getTable("CAISSE_COTISATION");
802
        {
809
        {
803
            SQLTable tableCaisseCotisation = root.findTable("CAISSE_COTISATION");
810
            SQLTable tableCaisseCotisation = root.findTable("CAISSE_COTISATION");
804
            if (!tableCaisseCotisation.contains("ORG_PROTECTION_SOCIALE")) {
811
            if (!tableCaisseCotisation.contains("ORG_PROTECTION_SOCIALE")) {
805
                final AlterTable alterCaisse = new AlterTable(tableCaisseCotisation);
812
                final AlterTable alterCaisse = new AlterTable(tableCaisseCotisation);
806
                alterCaisse.addBooleanColumn("ORG_PROTECTION_SOCIALE", Boolean.FALSE, false);
813
                alterCaisse.addBooleanColumn("ORG_PROTECTION_SOCIALE", Boolean.FALSE, false);
807
                alterCaisse.addBooleanColumn("URSSAF", Boolean.FALSE, false);
814
                alterCaisse.addBooleanColumn("URSSAF", Boolean.FALSE, false);
808
 
815
 
809
                root.getBase().getDataSource().execute(alterCaisse.asString());
816
                root.getBase().getDataSource().execute(alterCaisse.asString());
810
                root.refetchTable("CAISSE_COTISATION");
817
                root.refetchTable("CAISSE_COTISATION");
811
                root.getSchema().updateVersion();
818
                root.getSchema().updateVersion();
812
 
819
 
813
                {
820
                {
814
                    UpdateBuilder upCaisse = new UpdateBuilder(tableCaisseCotisation);
821
                    UpdateBuilder upCaisse = new UpdateBuilder(tableCaisseCotisation);
815
                    upCaisse.setObject("ORG_PROTECTION_SOCIALE", Boolean.TRUE);
822
                    upCaisse.setObject("ORG_PROTECTION_SOCIALE", Boolean.TRUE);
816
                    upCaisse.setWhere(new Where(tableCaisseCotisation.getField("NOM"), Arrays.asList("URSSAF", "AGIRC", "ARRCO")));
823
                    upCaisse.setWhere(new Where(tableCaisseCotisation.getField("NOM"), Arrays.asList("URSSAF", "AGIRC", "ARRCO")));
817
                    root.getBase().getDataSource().execute(upCaisse.asString());
824
                    root.getBase().getDataSource().execute(upCaisse.asString());
818
                }
825
                }
819
                {
826
                {
820
                    UpdateBuilder upCaisse = new UpdateBuilder(tableCaisseCotisation);
827
                    UpdateBuilder upCaisse = new UpdateBuilder(tableCaisseCotisation);
821
                    upCaisse.setObject("URSSAF", Boolean.TRUE);
828
                    upCaisse.setObject("URSSAF", Boolean.TRUE);
822
                    upCaisse.setWhere(new Where(tableCaisseCotisation.getField("NOM"), Arrays.asList("URSSAF")));
829
                    upCaisse.setWhere(new Where(tableCaisseCotisation.getField("NOM"), Arrays.asList("URSSAF")));
823
                    root.getBase().getDataSource().execute(upCaisse.asString());
830
                    root.getBase().getDataSource().execute(upCaisse.asString());
824
                }
831
                }
825
            }
832
            }
826
            if (!root.contains("CAISSE_MODE_PAIEMENT")) {
833
            if (!root.contains("CAISSE_MODE_PAIEMENT")) {
827
                final SQLCreateTable createCaisseMode = new SQLCreateTable(root, "CAISSE_MODE_PAIEMENT");
834
                final SQLCreateTable createCaisseMode = new SQLCreateTable(root, "CAISSE_MODE_PAIEMENT");
828
                createCaisseMode.addVarCharColumn("CODE", 25);
835
                createCaisseMode.addVarCharColumn("CODE", 25);
829
                createCaisseMode.addVarCharColumn("NOM", 512);
836
                createCaisseMode.addVarCharColumn("NOM", 512);
830
 
837
 
831
                try {
838
                try {
832
                    root.getBase().getDataSource().execute(createCaisseMode.asString());
839
                    root.getBase().getDataSource().execute(createCaisseMode.asString());
833
                    insertUndef(createCaisseMode);
840
                    insertUndef(createCaisseMode);
834
                    root.refetchTable("CAISSE_MODE_PAIEMENT");
841
                    root.refetchTable("CAISSE_MODE_PAIEMENT");
835
                    root.getSchema().updateVersion();
842
                    root.getSchema().updateVersion();
836
 
843
 
837
                    final SQLTable table = root.getTable("CAISSE_MODE_PAIEMENT");
844
                    final SQLTable table = root.getTable("CAISSE_MODE_PAIEMENT");
838
                    List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
845
                    List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
839
                    v.add(Tuple2.create("01", "chèque"));
846
                    v.add(Tuple2.create("01", "chèque"));
840
                    v.add(Tuple2.create("02", "virement"));
847
                    v.add(Tuple2.create("02", "virement"));
841
                    v.add(Tuple2.create("03", "prélèvement"));
848
                    v.add(Tuple2.create("03", "prélèvement"));
842
                    v.add(Tuple2.create("04", "titre inter-bancaire de paiement"));
849
                    v.add(Tuple2.create("04", "titre inter-bancaire de paiement"));
843
                    v.add(Tuple2.create("05", "prélèvement SEPA"));
850
                    v.add(Tuple2.create("05", "prélèvement SEPA"));
844
                    v.add(Tuple2.create("06", "versement réalisé par un autre établissement"));
851
                    v.add(Tuple2.create("06", "versement réalisé par un autre établissement"));
845
 
852
 
846
                    insertValues(v, table);
853
                    insertValues(v, table);
847
                } catch (SQLException ex) {
854
                } catch (SQLException ex) {
848
                    throw new IllegalStateException("Erreur lors de la création de la table " + "CAISSE_MODE_PAIEMENT", ex);
855
                    throw new IllegalStateException("Erreur lors de la création de la table " + "CAISSE_MODE_PAIEMENT", ex);
849
                }
856
                }
850
 
857
 
851
                final SQLCreateTable createCaisseREnseignement = new SQLCreateTable(root, "CAISSE_COTISATION_RENSEIGNEMENT");
858
                final SQLCreateTable createCaisseREnseignement = new SQLCreateTable(root, "CAISSE_COTISATION_RENSEIGNEMENT");
852
                createCaisseREnseignement.addVarCharColumn("IDENTIFIANT", 256);
859
                createCaisseREnseignement.addVarCharColumn("IDENTIFIANT", 256);
853
                createCaisseREnseignement.addVarCharColumn("SIRET", 256);
860
                createCaisseREnseignement.addVarCharColumn("SIRET", 256);
854
                createCaisseREnseignement.addVarCharColumn("BIC", 256);
861
                createCaisseREnseignement.addVarCharColumn("BIC", 256);
855
                createCaisseREnseignement.addVarCharColumn("IBAN", 256);
862
                createCaisseREnseignement.addVarCharColumn("IBAN", 256);
856
                createCaisseREnseignement.addVarCharColumn("ENTITE_AFFECTATION", 256);
863
                createCaisseREnseignement.addVarCharColumn("ENTITE_AFFECTATION", 256);
857
                createCaisseREnseignement.addBooleanColumn("ORGANISME_COMPLEMENTAIRE", Boolean.FALSE, false);
864
                createCaisseREnseignement.addBooleanColumn("ORGANISME_COMPLEMENTAIRE", Boolean.FALSE, false);
858
                createCaisseREnseignement.addBooleanColumn("PAIEMENT_TRIMESTRIEL", Boolean.FALSE, false);
865
                createCaisseREnseignement.addBooleanColumn("PAIEMENT_TRIMESTRIEL", Boolean.FALSE, false);
859
                createCaisseREnseignement.addVarCharColumn("CODE_DELEGATAIRE", 256);
866
                createCaisseREnseignement.addVarCharColumn("CODE_DELEGATAIRE", 256);
860
                createCaisseREnseignement.addForeignColumn("ID_CAISSE_MODE_PAIEMENT", root.getTable("CAISSE_MODE_PAIEMENT"));
867
                createCaisseREnseignement.addForeignColumn("ID_CAISSE_MODE_PAIEMENT", root.getTable("CAISSE_MODE_PAIEMENT"));
861
                createCaisseREnseignement.addForeignColumn("ID_CAISSE_COTISATION", caisseCot);
868
                createCaisseREnseignement.addForeignColumn("ID_CAISSE_COTISATION", caisseCot);
862
                createCaisseREnseignement.addForeignColumn("ID_SOCIETE_COMMON", root.getTable("SOCIETE_COMMON"));
869
                createCaisseREnseignement.addForeignColumn("ID_SOCIETE_COMMON", root.getTable("SOCIETE_COMMON"));
863
                root.getBase().getDataSource().execute(createCaisseREnseignement.asString());
870
                root.getBase().getDataSource().execute(createCaisseREnseignement.asString());
864
                insertUndef(createCaisseREnseignement);
871
                insertUndef(createCaisseREnseignement);
865
                root.refetchTable("CAISSE_COTISATION_RENSEIGNEMENT");
872
                root.refetchTable("CAISSE_COTISATION_RENSEIGNEMENT");
866
                root.getSchema().updateVersion();
873
                root.getSchema().updateVersion();
867
            }
874
            }
868
            SQLTable tableCR = root.getTable("CAISSE_COTISATION_RENSEIGNEMENT");
875
            SQLTable tableCR = root.getTable("CAISSE_COTISATION_RENSEIGNEMENT");
869
            if (!tableCR.contains("PAIEMENT_TRIMESTRIEL")) {
876
            if (!tableCR.contains("PAIEMENT_TRIMESTRIEL")) {
870
                AlterTable alter = new AlterTable(tableCR);
877
                AlterTable alter = new AlterTable(tableCR);
871
                alter.addBooleanColumn("PAIEMENT_TRIMESTRIEL", Boolean.FALSE, false);
878
                alter.addBooleanColumn("PAIEMENT_TRIMESTRIEL", Boolean.FALSE, false);
872
                root.getBase().getDataSource().execute(alter.asString());
879
                root.getBase().getDataSource().execute(alter.asString());
873
                root.refetchTable("CAISSE_COTISATION_RENSEIGNEMENT");
880
                root.refetchTable("CAISSE_COTISATION_RENSEIGNEMENT");
874
                root.getSchema().updateVersion();
881
                root.getSchema().updateVersion();
875
            }
882
            }
876
 
883
 
877
            if (!tableCR.contains("JOUR_PAIEMENT")) {
884
            if (!tableCR.contains("JOUR_PAIEMENT")) {
878
                AlterTable alter = new AlterTable(tableCR);
885
                AlterTable alter = new AlterTable(tableCR);
879
                alter.addIntegerColumn("JOUR_PAIEMENT", 0);
886
                alter.addIntegerColumn("JOUR_PAIEMENT", 0);
880
                root.getBase().getDataSource().execute(alter.asString());
887
                root.getBase().getDataSource().execute(alter.asString());
881
                root.refetchTable("CAISSE_COTISATION_RENSEIGNEMENT");
888
                root.refetchTable("CAISSE_COTISATION_RENSEIGNEMENT");
882
                root.getSchema().updateVersion();
889
                root.getSchema().updateVersion();
883
            }
890
            }
884
        }
891
        }
885
 
892
 
886
        if (!root.contains("TYPE_COMPOSANT_BASE_ASSUJETTIE")) {
893
        if (!root.contains("TYPE_COMPOSANT_BASE_ASSUJETTIE")) {
887
            final SQLCreateTable createTableTypeComposant = new SQLCreateTable(root, "TYPE_COMPOSANT_BASE_ASSUJETTIE");
894
            final SQLCreateTable createTableTypeComposant = new SQLCreateTable(root, "TYPE_COMPOSANT_BASE_ASSUJETTIE");
888
            createTableTypeComposant.addVarCharColumn("CODE", 25);
895
            createTableTypeComposant.addVarCharColumn("CODE", 25);
889
            createTableTypeComposant.addVarCharColumn("NOM", 512);
896
            createTableTypeComposant.addVarCharColumn("NOM", 512);
890
 
897
 
891
            try {
898
            try {
892
                root.getBase().getDataSource().execute(createTableTypeComposant.asString());
899
                root.getBase().getDataSource().execute(createTableTypeComposant.asString());
893
                insertUndef(createTableTypeComposant);
900
                insertUndef(createTableTypeComposant);
894
                root.refetchTable("TYPE_COMPOSANT_BASE_ASSUJETTIE");
901
                root.refetchTable("TYPE_COMPOSANT_BASE_ASSUJETTIE");
895
                root.getSchema().updateVersion();
902
                root.getSchema().updateVersion();
896
 
903
 
897
                final SQLTable table = root.getTable("TYPE_COMPOSANT_BASE_ASSUJETTIE");
904
                final SQLTable table = root.getTable("TYPE_COMPOSANT_BASE_ASSUJETTIE");
898
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
905
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
899
 
906
 
900
                v.add(Tuple2.create("01", "Montant du SMIC retenu pour le calcul de la Réduction générale des cotisations patronales de sécurité sociale"));
907
                v.add(Tuple2.create("01", "Montant du SMIC retenu pour le calcul de la Réduction générale des cotisations patronales de sécurité sociale"));
901
                v.add(Tuple2.create("02", "Montant du SMIC retenu pour le calcul du crédit d'impôt compétitivité-emploi"));
908
                v.add(Tuple2.create("02", "Montant du SMIC retenu pour le calcul du crédit d'impôt compétitivité-emploi"));
902
                v.add(Tuple2.create("03", "Contributions patronales à des régimes complémentaires de retraite"));
909
                v.add(Tuple2.create("03", "Contributions patronales à des régimes complémentaires de retraite"));
903
                v.add(Tuple2.create("04", "Contributions patronales destinées au financement des prestations de prévoyance complémentaire"));
910
                v.add(Tuple2.create("04", "Contributions patronales destinées au financement des prestations de prévoyance complémentaire"));
904
                v.add(Tuple2.create("05", "Contributions patronales destinées au financement des prestations de retraite supplémentaire"));
911
                v.add(Tuple2.create("05", "Contributions patronales destinées au financement des prestations de retraite supplémentaire"));
905
                v.add(Tuple2.create("06", "Plafond calculé pour salarié poly-employeurs"));
912
                v.add(Tuple2.create("06", "Plafond calculé pour salarié poly-employeurs"));
906
                v.add(Tuple2.create("10", "Salaire brut Prévoyance"));
913
                v.add(Tuple2.create("10", "Salaire brut Prévoyance"));
907
                v.add(Tuple2.create("11", "Tranche A Prévoyance"));
914
                v.add(Tuple2.create("11", "Tranche A Prévoyance"));
908
                v.add(Tuple2.create("12", "Tranche 2 Prévoyance"));
915
                v.add(Tuple2.create("12", "Tranche 2 Prévoyance"));
909
                v.add(Tuple2.create("13", "Tranche B Prévoyance"));
916
                v.add(Tuple2.create("13", "Tranche B Prévoyance"));
910
                v.add(Tuple2.create("14", "Tranche C Prévoyance"));
917
                v.add(Tuple2.create("14", "Tranche C Prévoyance"));
911
                v.add(Tuple2.create("15", "Tranche D Prévoyance"));
918
                v.add(Tuple2.create("15", "Tranche D Prévoyance"));
912
                v.add(Tuple2.create("16", "Tranche D1 Prévoyance"));
919
                v.add(Tuple2.create("16", "Tranche D1 Prévoyance"));
913
                v.add(Tuple2.create("17", "Base spécifique Prévoyance"));
920
                v.add(Tuple2.create("17", "Base spécifique Prévoyance"));
914
                v.add(Tuple2.create("18", "Base forfaitaire Prévoyance"));
921
                v.add(Tuple2.create("18", "Base forfaitaire Prévoyance"));
915
                v.add(Tuple2.create("19", "Base fictive Prévoyance reconstituée"));
922
                v.add(Tuple2.create("19", "Base fictive Prévoyance reconstituée"));
916
                v.add(Tuple2.create("20", "Montant forfaitaire Prévoyance"));
923
                v.add(Tuple2.create("20", "Montant forfaitaire Prévoyance"));
917
                v.add(Tuple2.create("21", "Montant Prévoyance libre ou exceptionnel"));
924
                v.add(Tuple2.create("21", "Montant Prévoyance libre ou exceptionnel"));
918
                v.add(Tuple2.create("22", "Montant des indemnités journalières CRPCEN"));
925
                v.add(Tuple2.create("22", "Montant des indemnités journalières CRPCEN"));
919
                v.add(Tuple2.create("90", "Retenue sur salaire"));
926
                v.add(Tuple2.create("90", "Retenue sur salaire"));
920
                v.add(Tuple2.create("91", "Base de taxe sur les salaires au taux normal"));
927
                v.add(Tuple2.create("91", "Base de taxe sur les salaires au taux normal"));
921
 
928
 
922
                insertValues(v, table);
929
                insertValues(v, table);
923
 
930
 
924
                AlterTable tableRubCotis = new AlterTable(tableRubCot);
931
                AlterTable tableRubCotis = new AlterTable(tableRubCot);
925
                tableRubCotis.addForeignColumn("ID_TYPE_COMPOSANT_BASE_ASSUJETTIE", root.getTable("TYPE_COMPOSANT_BASE_ASSUJETTIE"));
932
                tableRubCotis.addForeignColumn("ID_TYPE_COMPOSANT_BASE_ASSUJETTIE", root.getTable("TYPE_COMPOSANT_BASE_ASSUJETTIE"));
926
                root.getBase().getDataSource().execute(tableRubCotis.asString());
933
                root.getBase().getDataSource().execute(tableRubCotis.asString());
927
                root.refetchTable(tableRubCot.getName());
934
                root.refetchTable(tableRubCot.getName());
928
                root.getSchema().updateVersion();
935
                root.getSchema().updateVersion();
929
            } catch (SQLException ex) {
936
            } catch (SQLException ex) {
930
                throw new IllegalStateException("Erreur lors de la création de la table " + "TYPE_COMPOSANT_BASE_ASSUJETTIE", ex);
937
                throw new IllegalStateException("Erreur lors de la création de la table " + "TYPE_COMPOSANT_BASE_ASSUJETTIE", ex);
931
            }
938
            }
932
        }
939
        }
933
        if (!root.contains("CODE_COTISATION_INDIVIDUELLE")) {
940
        if (!root.contains("CODE_COTISATION_INDIVIDUELLE")) {
934
            final SQLCreateTable createTableTypeComposant = new SQLCreateTable(root, "CODE_COTISATION_INDIVIDUELLE");
941
            final SQLCreateTable createTableTypeComposant = new SQLCreateTable(root, "CODE_COTISATION_INDIVIDUELLE");
935
            createTableTypeComposant.addVarCharColumn("CODE", 25);
942
            createTableTypeComposant.addVarCharColumn("CODE", 25);
936
            createTableTypeComposant.addVarCharColumn("NOM", 512);
943
            createTableTypeComposant.addVarCharColumn("NOM", 512);
937
 
944
 
938
            try {
945
            try {
939
                root.getBase().getDataSource().execute(createTableTypeComposant.asString());
946
                root.getBase().getDataSource().execute(createTableTypeComposant.asString());
940
                insertUndef(createTableTypeComposant);
947
                insertUndef(createTableTypeComposant);
941
                root.refetchTable("CODE_COTISATION_INDIVIDUELLE");
948
                root.refetchTable("CODE_COTISATION_INDIVIDUELLE");
942
                root.getSchema().updateVersion();
949
                root.getSchema().updateVersion();
943
 
950
 
944
                final SQLTable table = root.getTable("CODE_COTISATION_INDIVIDUELLE");
951
                final SQLTable table = root.getTable("CODE_COTISATION_INDIVIDUELLE");
945
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
952
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
946
 
953
 
947
                v.add(Tuple2.create("001", "Exonération de cotisations au titre de l'emploi d'un apprenti (loi de 1979)"));
954
                v.add(Tuple2.create("001", "Exonération de cotisations au titre de l'emploi d'un apprenti (loi de 1979)"));
948
                v.add(Tuple2.create("002", "Exonération de cotisations au titre de l'emploi d'un apprenti (loi de 1987)"));
955
                v.add(Tuple2.create("002", "Exonération de cotisations au titre de l'emploi d'un apprenti (loi de 1987)"));
949
                v.add(Tuple2.create("003", "Exonération de cotisations au titre de l'emploi d'un apprenti (loi de 1992)"));
956
                v.add(Tuple2.create("003", "Exonération de cotisations au titre de l'emploi d'un apprenti (loi de 1992)"));
950
                v.add(Tuple2.create("004", "Exonération de cotisations au titre de l'emploi d'un salarié en contrat d'accès à l'emploi"));
957
                v.add(Tuple2.create("004", "Exonération de cotisations au titre de l'emploi d'un salarié en contrat d'accès à l'emploi"));
951
                v.add(Tuple2.create("006", "Exonération de cotisations au titre de l'emploi d'un salarié en contrat d'accompagnement dans l'emploi"));
958
                v.add(Tuple2.create("006", "Exonération de cotisations au titre de l'emploi d'un salarié en contrat d'accompagnement dans l'emploi"));
952
                v.add(Tuple2.create("008", "Exonération de cotisations au titre de l'emploi d'un salarié en contrat de professionnalisation"));
959
                v.add(Tuple2.create("008", "Exonération de cotisations au titre de l'emploi d'un salarié en contrat de professionnalisation"));
953
                v.add(Tuple2.create("009", "Exonération de cotisations applicable aux associations intermédiaires"));
960
                v.add(Tuple2.create("009", "Exonération de cotisations applicable aux associations intermédiaires"));
954
                v.add(Tuple2.create("010", "Exonération de cotisations applicable aux entreprises des bassins d'emploi à redynamiser"));
961
                v.add(Tuple2.create("010", "Exonération de cotisations applicable aux entreprises des bassins d'emploi à redynamiser"));
955
                v.add(Tuple2.create("011", "Exonération de cotisations applicable au créateur ou repreneur d'entreprise"));
962
                v.add(Tuple2.create("011", "Exonération de cotisations applicable au créateur ou repreneur d'entreprise"));
956
                v.add(Tuple2.create("012", "Exonération de cotisations applicable dans les DOM"));
963
                v.add(Tuple2.create("012", "Exonération de cotisations applicable dans les DOM"));
957
                v.add(Tuple2.create("013", "Exonération de cotisations applicable aux entreprises et associations d'aide à domicile"));
964
                v.add(Tuple2.create("013", "Exonération de cotisations applicable aux entreprises et associations d'aide à domicile"));
958
                v.add(Tuple2.create("014", "Exonérations de cotisations applicable aux entreprises innovantes ou universitaires"));
965
                v.add(Tuple2.create("014", "Exonérations de cotisations applicable aux entreprises innovantes ou universitaires"));
959
                v.add(Tuple2.create("015", "Exonération de cotisations applicable aux entreprises en zones franches urbaines"));
966
                v.add(Tuple2.create("015", "Exonération de cotisations applicable aux entreprises en zones franches urbaines"));
960
                v.add(Tuple2.create("016", "Exonération de cotisations applicable aux organismes d'intérêt général en zones de revitalisation rurale"));
967
                v.add(Tuple2.create("016", "Exonération de cotisations applicable aux organismes d'intérêt général en zones de revitalisation rurale"));
961
                v.add(Tuple2.create("017", "Exonération de cotisations applicable aux structures agréées de l'aide sociale"));
968
                v.add(Tuple2.create("017", "Exonération de cotisations applicable aux structures agréées de l'aide sociale"));
962
                v.add(Tuple2.create("018", "Réduction générale des cotisations patronales de sécurité sociale"));
969
                v.add(Tuple2.create("018", "Réduction générale des cotisations patronales de sécurité sociale"));
963
                v.add(Tuple2.create("019", "Réduction de cotisations applicable aux entreprises des zones de restructuration de la défense"));
970
                v.add(Tuple2.create("019", "Réduction de cotisations applicable aux entreprises des zones de restructuration de la défense"));
964
                v.add(Tuple2.create("020", "Réduction de cotisations au titre de l'embauche du 1er au 50ème salarié en zones de revitalisation rurale"));
971
                v.add(Tuple2.create("020", "Réduction de cotisations au titre de l'embauche du 1er au 50ème salarié en zones de revitalisation rurale"));
965
                v.add(Tuple2.create("021", "Déduction patronale au titre des heures supplémentaires"));
972
                v.add(Tuple2.create("021", "Déduction patronale au titre des heures supplémentaires"));
966
                v.add(Tuple2.create("022", "Exonération de cotisations applicable à une gratification de stage"));
973
                v.add(Tuple2.create("022", "Exonération de cotisations applicable à une gratification de stage"));
967
                v.add(Tuple2.create("023", "Exonération de cotisation des sommes provenant d'un CET et réaffectées à un PERCO ou à un régime de retraite supplémentaire"));
974
                v.add(Tuple2.create("023", "Exonération de cotisation des sommes provenant d'un CET et réaffectées à un PERCO ou à un régime de retraite supplémentaire"));
968
                v.add(Tuple2.create("025", "Exonération de cotisations au titre de l’emploi d’un salarié en chantier et atelier d'insertion"));
975
                v.add(Tuple2.create("025", "Exonération de cotisations au titre de l’emploi d’un salarié en chantier et atelier d'insertion"));
969
                v.add(Tuple2.create("027", "Exonération Personnel technique CUMA, hors ateliers"));
976
                v.add(Tuple2.create("027", "Exonération Personnel technique CUMA, hors ateliers"));
970
                v.add(Tuple2.create("028", "Réduction Travailleur Occasionnel"));
977
                v.add(Tuple2.create("028", "Réduction Travailleur Occasionnel"));
971
                v.add(Tuple2.create("029", "CNIEG Réduction employeurs petit pool"));
978
                v.add(Tuple2.create("029", "CNIEG Réduction employeurs petit pool"));
972
                v.add(Tuple2.create("030", "Camieg Cotisation employeurs Régime spécial Complémentaire"));
979
                v.add(Tuple2.create("030", "Camieg Cotisation employeurs Régime spécial Complémentaire"));
973
                v.add(Tuple2.create("031", "Camieg Cotisation salariés Régime spécial Complémentaire"));
980
                v.add(Tuple2.create("031", "Camieg Cotisation salariés Régime spécial Complémentaire"));
974
                v.add(Tuple2.create("032", "Camieg Cotisation salariés Régime spécial Solidarité"));
981
                v.add(Tuple2.create("032", "Camieg Cotisation salariés Régime spécial Solidarité"));
975
                v.add(Tuple2.create("033", "CNIEG Cotisation employeurs complément d'invalidité"));
982
                v.add(Tuple2.create("033", "CNIEG Cotisation employeurs complément d'invalidité"));
976
                v.add(Tuple2.create("034", "CNIEG Cotisation employeurs régime de droit commun (population adossée)"));
983
                v.add(Tuple2.create("034", "CNIEG Cotisation employeurs régime de droit commun (population adossée)"));
977
                v.add(Tuple2.create("035", "CNIEG Cotisation employeurs Régime spécial (population adossée)"));
984
                v.add(Tuple2.create("035", "CNIEG Cotisation employeurs Régime spécial (population adossée)"));
978
                v.add(Tuple2.create("036", "CNIEG Cotisation employeurs régime spécial (population non adossée)"));
985
                v.add(Tuple2.create("036", "CNIEG Cotisation employeurs régime spécial (population non adossée)"));
979
                v.add(Tuple2.create("037", "CNIEG Cotisation salariés régime de droit commun (population adossée)"));
986
                v.add(Tuple2.create("037", "CNIEG Cotisation salariés régime de droit commun (population adossée)"));
980
                v.add(Tuple2.create("038", "CNIEG Cotisation salariés régime spécial (population non adossée)"));
987
                v.add(Tuple2.create("038", "CNIEG Cotisation salariés régime spécial (population non adossée)"));
981
                v.add(Tuple2.create("039", "CNIEG Cotisations employeurs petit pool"));
988
                v.add(Tuple2.create("039", "CNIEG Cotisations employeurs petit pool"));
982
                v.add(Tuple2.create("040", "Cotisation AC : assurance chômage sur rémunérations brutes après déduction, limitées à 4 fois le plafond de la SS"));
989
                v.add(Tuple2.create("040", "Cotisation AC : assurance chômage sur rémunérations brutes après déduction, limitées à 4 fois le plafond de la SS"));
983
                v.add(Tuple2.create("041", "Cotisation AC majorée 1 : application d’une majoration AC + 0,5% sur les contrats d’usage inférieurs ou égaux à 3 mois"));
990
                v.add(Tuple2.create("041", "Cotisation AC majorée 1 : application d’une majoration AC + 0,5% sur les contrats d’usage inférieurs ou égaux à 3 mois"));
984
                v.add(Tuple2.create("042", "Cotisation AC majorée 2 : application d’une majoration AC + 3% sur les contrats d’accroissement temporaire d’activité inférieurs ou égaux à 1 mois"));
991
                v.add(Tuple2.create("042", "Cotisation AC majorée 2 : application d’une majoration AC + 3% sur les contrats d’accroissement temporaire d’activité inférieurs ou égaux à 1 mois"));
985
                v.add(Tuple2.create("043",
992
                v.add(Tuple2.create("043",
986
                        "Cotisation AC majorée 3 : application d’une majoration AC + 1,5% sur les contrats d’accroissement temporaire d’activité supérieurs à 1 mois mais inférieurs ou égaux à 3 mois"));
993
                        "Cotisation AC majorée 3 : application d’une majoration AC + 1,5% sur les contrats d’accroissement temporaire d’activité supérieurs à 1 mois mais inférieurs ou égaux à 3 mois"));
987
                v.add(Tuple2.create("044", "Exonération de cotisation chômage pour les moins de 26 ans"));
994
                v.add(Tuple2.create("044", "Exonération de cotisation chômage pour les moins de 26 ans"));
988
                v.add(Tuple2.create("045", "Cotisation Accident du travail"));
995
                v.add(Tuple2.create("045", "Cotisation Accident du travail"));
989
                v.add(Tuple2.create("046", "Cotisation AEF Bourse de l'emploi"));
996
                v.add(Tuple2.create("046", "Cotisation AEF Bourse de l'emploi"));
990
                v.add(Tuple2.create("047", "Cotisation AEF CESA"));
997
                v.add(Tuple2.create("047", "Cotisation AEF CESA"));
991
                v.add(Tuple2.create("048", "Cotisation AGS : assurance garantie des salaires sur rémunérations brutes après déduction, limitées à 4 fois le plafond de la sécurité sociale"));
998
                v.add(Tuple2.create("048", "Cotisation AGS : assurance garantie des salaires sur rémunérations brutes après déduction, limitées à 4 fois le plafond de la sécurité sociale"));
992
                v.add(Tuple2.create("049", "Cotisation Allocation de logement (FNAL)"));
999
                v.add(Tuple2.create("049", "Cotisation Allocation de logement (FNAL)"));
993
                v.add(Tuple2.create("051", "Cotisation Formation professionnelle ADEFA"));
1000
                v.add(Tuple2.create("051", "Cotisation Formation professionnelle ADEFA"));
994
                v.add(Tuple2.create("052", "Cotisation AFNCA, ANEFA, PROVEA, ASCPA"));
1001
                v.add(Tuple2.create("052", "Cotisation AFNCA, ANEFA, PROVEA, ASCPA"));
995
                v.add(Tuple2.create("053", "Cotisation Formation professionnelle additionnelle FAFSEA"));
1002
                v.add(Tuple2.create("053", "Cotisation Formation professionnelle additionnelle FAFSEA"));
996
                v.add(Tuple2.create("054", "Cotisation Formation professionnelle AREFA"));
1003
                v.add(Tuple2.create("054", "Cotisation Formation professionnelle AREFA"));
997
                v.add(Tuple2.create("055", "Cotisation Formation professionnelle CEREFAR"));
1004
                v.add(Tuple2.create("055", "Cotisation Formation professionnelle CEREFAR"));
998
                v.add(Tuple2.create("056", "Cotisation Formation professionnelle FAFSEA"));
1005
                v.add(Tuple2.create("056", "Cotisation Formation professionnelle FAFSEA"));
999
                v.add(Tuple2.create("057", "Cotisation Formation professionnelle FAFSEA CDD"));
1006
                v.add(Tuple2.create("057", "Cotisation Formation professionnelle FAFSEA CDD"));
1000
                v.add(Tuple2.create("058", "Cotisation Formation professionnelle FAFSEA des communes forestières"));
1007
                v.add(Tuple2.create("058", "Cotisation Formation professionnelle FAFSEA des communes forestières"));
1001
                v.add(Tuple2.create("059", "Cotisation individuelle Prévoyance-Assurance-Mutuelle pour la période et l'affiliation concernées"));
1008
                v.add(Tuple2.create("059", "Cotisation individuelle Prévoyance-Assurance-Mutuelle pour la période et l'affiliation concernées"));
1002
                v.add(Tuple2.create("060", "Cotisation IRCANTEC Tranche A"));
1009
                v.add(Tuple2.create("060", "Cotisation IRCANTEC Tranche A"));
1003
                v.add(Tuple2.create("061", "Cotisation IRCANTEC Tranche B"));
1010
                v.add(Tuple2.create("061", "Cotisation IRCANTEC Tranche B"));
1004
                v.add(Tuple2.create("063", "RETA Montant de cotisation Arrco"));
1011
                v.add(Tuple2.create("063", "RETA Montant de cotisation Arrco"));
1005
                v.add(Tuple2.create("064", "RETC Montant de cotisation Agirc"));
1012
                v.add(Tuple2.create("064", "RETC Montant de cotisation Agirc"));
1006
                v.add(Tuple2.create("065", "Cotisation CRPCEN"));
1013
                v.add(Tuple2.create("065", "Cotisation CRPCEN"));
1007
                v.add(Tuple2.create("066", "Cotisation caisse de congés spectacles"));
1014
                v.add(Tuple2.create("066", "Cotisation caisse de congés spectacles"));
1008
                v.add(Tuple2.create("068", "Contribution solidarité autonomie"));
1015
                v.add(Tuple2.create("068", "Contribution solidarité autonomie"));
1009
                v.add(Tuple2.create("069", "Contribution sur avantage de pré-retraite entreprise à dater du 11/10/2007 (CAPE)"));
1016
                v.add(Tuple2.create("069", "Contribution sur avantage de pré-retraite entreprise à dater du 11/10/2007 (CAPE)"));
1010
                v.add(Tuple2.create("070", "Contribution sur avantage de pré-retraite entreprise aux taux normal (CAPE)"));
1017
                v.add(Tuple2.create("070", "Contribution sur avantage de pré-retraite entreprise aux taux normal (CAPE)"));
1011
                v.add(Tuple2.create("071", "Contribution forfait social"));
1018
                v.add(Tuple2.create("071", "Contribution forfait social"));
1012
                v.add(Tuple2.create("072", "Contribution sociale généralisée/salaires partiellement déductibles"));
1019
                v.add(Tuple2.create("072", "Contribution sociale généralisée/salaires partiellement déductibles"));
1013
                v.add(Tuple2.create("073", "CSG/CRDS sur participation intéressement épargne salariale"));
1020
                v.add(Tuple2.create("073", "CSG/CRDS sur participation intéressement épargne salariale"));
1014
                v.add(Tuple2.create("074", "Cotisation Allocation familiale taux normal  "));
1021
                v.add(Tuple2.create("074", "Cotisation Allocation familiale taux normal  "));
1015
                v.add(Tuple2.create("075", "Cotisation Assurance Maladie"));
1022
                v.add(Tuple2.create("075", "Cotisation Assurance Maladie"));
1016
                v.add(Tuple2.create("076", "Cotisation Assurance Vieillesse"));
1023
                v.add(Tuple2.create("076", "Cotisation Assurance Vieillesse"));
1017
                v.add(Tuple2.create("077", "Montant de la retenue à la source effectuée sur les salaires versés aux personnes domiciliées hors de France"));
1024
                v.add(Tuple2.create("077", "Montant de la retenue à la source effectuée sur les salaires versés aux personnes domiciliées hors de France"));
1018
                v.add(Tuple2.create("078", "Pénalité de 1% emploi sénior"));
1025
                v.add(Tuple2.create("078", "Pénalité de 1% emploi sénior"));
1019
                v.add(Tuple2.create("079", "Remboursement de la dette sociale"));
1026
                v.add(Tuple2.create("079", "Remboursement de la dette sociale"));
1020
                v.add(Tuple2.create("081", "Versement transport"));
1027
                v.add(Tuple2.create("081", "Versement transport"));
1021
                v.add(Tuple2.create("082", "Versement transport additionnel"));
1028
                v.add(Tuple2.create("082", "Versement transport additionnel"));
1022
                v.add(Tuple2.create("086", "Cotisation pénibilité mono exposition"));
1029
                v.add(Tuple2.create("086", "Cotisation pénibilité mono exposition"));
1023
                v.add(Tuple2.create("087", "Cotisation pénibilité multi exposition"));
1030
                v.add(Tuple2.create("087", "Cotisation pénibilité multi exposition"));
1024
                v.add(Tuple2.create("088", "Exonération versement transport"));
1031
                v.add(Tuple2.create("088", "Exonération versement transport"));
1025
                v.add(Tuple2.create("089", "Exonération Contrat Initiative Emploi"));
1032
                v.add(Tuple2.create("089", "Exonération Contrat Initiative Emploi"));
1026
                v.add(Tuple2.create("090", "Exonération accueillants familiaux"));
1033
                v.add(Tuple2.create("090", "Exonération accueillants familiaux"));
1027
                v.add(Tuple2.create("091", "Cotisation Service de santé au travail"));
1034
                v.add(Tuple2.create("091", "Cotisation Service de santé au travail"));
1028
                v.add(Tuple2.create("092", "Cotisation Association pour l'emploi des cadres ingénieurs et techniciens de l'agriculture (APECITA)"));
1035
                v.add(Tuple2.create("092", "Cotisation Association pour l'emploi des cadres ingénieurs et techniciens de l'agriculture (APECITA)"));
1029
                v.add(Tuple2.create("093", "Contribution sur indemnités de mise à la retraite"));
1036
                v.add(Tuple2.create("093", "Contribution sur indemnités de mise à la retraite"));
1030
                v.add(Tuple2.create("094", "Exonération cotisations Allocations familiales (SICAE)"));
1037
                v.add(Tuple2.create("094", "Exonération cotisations Allocations familiales (SICAE)"));
1031
                v.add(Tuple2.create("096", "Cotisation CRPNPAC au fonds de retraite"));
1038
                v.add(Tuple2.create("096", "Cotisation CRPNPAC au fonds de retraite"));
1032
                v.add(Tuple2.create("097", "Cotisation CRPNPAC au fonds d'assurance"));
1039
                v.add(Tuple2.create("097", "Cotisation CRPNPAC au fonds d'assurance"));
1033
                v.add(Tuple2.create("098", "Cotisation CRPNPAC au fonds de majoration"));
1040
                v.add(Tuple2.create("098", "Cotisation CRPNPAC au fonds de majoration"));
1034
                v.add(Tuple2.create("099", "Contribution stock options"));
1041
                v.add(Tuple2.create("099", "Contribution stock options"));
1035
                v.add(Tuple2.create("100", "Contribution pour le financement des organisations syndicales de salariés et organisations professionnelles d'employeurs"));
1042
                v.add(Tuple2.create("100", "Contribution pour le financement des organisations syndicales de salariés et organisations professionnelles d'employeurs"));
1036
                v.add(Tuple2.create("101", "Association Mutualisation du Coût Inaptitude"));
1043
                v.add(Tuple2.create("101", "Association Mutualisation du Coût Inaptitude"));
1037
                v.add(Tuple2.create("102", "Cotisation Allocation Familiale - taux réduit"));
1044
                v.add(Tuple2.create("102", "Cotisation Allocation Familiale - taux réduit"));
1038
                v.add(Tuple2.create("103", "Contribution actions gratuites"));
1045
                v.add(Tuple2.create("103", "Contribution actions gratuites"));
1039
                v.add(Tuple2.create("226", "Assiette du Versement Transport"));
1046
                v.add(Tuple2.create("226", "Assiette du Versement Transport"));
-
 
1047
 
1040
                v.add(Tuple2.create("901", "Cotisation épargne retraite"));
1048
                v.add(Tuple2.create("901", "Cotisation épargne retraite"));
1041
 
1049
 
1042
                insertValues(v, table);
1050
                insertValues(v, table);
1043
 
1051
 
1044
                List<Tuple2<String, String>> vCodeBase = new ArrayList<Tuple2<String, String>>();
1052
                List<Tuple2<String, String>> vCodeBase = new ArrayList<Tuple2<String, String>>();
1045
                vCodeBase.add(Tuple2.create("15", "CNIEG-Assiette brute du régime spécial"));
1053
                vCodeBase.add(Tuple2.create("15", "CNIEG-Assiette brute du régime spécial"));
1046
                vCodeBase.add(Tuple2.create("16", "CNIEG-Assiette brute du complément invalidité"));
1054
                vCodeBase.add(Tuple2.create("16", "CNIEG-Assiette brute du complément invalidité"));
1047
                vCodeBase.add(Tuple2.create("17", "CNIEG - Assiette brute du petit pool"));
1055
                vCodeBase.add(Tuple2.create("17", "CNIEG - Assiette brute du petit pool"));
1048
                vCodeBase.add(Tuple2.create("18", "Camieg - assiette brute plafonnée"));
1056
                vCodeBase.add(Tuple2.create("18", "Camieg - assiette brute plafonnée"));
1049
                vCodeBase.add(Tuple2.create("19", "Assiette CRPCEN"));
1057
                vCodeBase.add(Tuple2.create("19", "Assiette CRPCEN"));
1050
                vCodeBase.add(Tuple2.create("20", "CIBTP - Base brute de cotisations congés payés"));
1058
                vCodeBase.add(Tuple2.create("20", "CIBTP - Base brute de cotisations congés payés"));
1051
                vCodeBase.add(Tuple2.create("21", "CIBTP - Base brute de cotisations OPPBTP permanents"));
1059
                vCodeBase.add(Tuple2.create("21", "CIBTP - Base brute de cotisations OPPBTP permanents"));
1052
                vCodeBase.add(Tuple2.create("22", "Base brute spécifique"));
1060
                vCodeBase.add(Tuple2.create("22", "Base brute spécifique"));
1053
                vCodeBase.add(Tuple2.create("23", "Base exceptionnelle (Agirc Arrco)"));
1061
                vCodeBase.add(Tuple2.create("23", "Base exceptionnelle (Agirc Arrco)"));
1054
                vCodeBase.add(Tuple2.create("24", "Base plafonnée spécifique"));
1062
                vCodeBase.add(Tuple2.create("24", "Base plafonnée spécifique"));
1055
                vCodeBase.add(Tuple2.create("25", "Assiette de contribution libératoire"));
1063
                vCodeBase.add(Tuple2.create("25", "Assiette de contribution libératoire"));
1056
                vCodeBase.add(Tuple2.create("27", "Assiette Caisse de congés spectacles"));
1064
                vCodeBase.add(Tuple2.create("27", "Assiette Caisse de congés spectacles"));
1057
                vCodeBase.add(Tuple2.create("28", "Base IRCANTEC cotisée"));
1065
                vCodeBase.add(Tuple2.create("28", "Base IRCANTEC cotisée"));
1058
                vCodeBase.add(Tuple2.create("29", "Base IRCANTEC non cotisée (arrêt de travail)"));
1066
                vCodeBase.add(Tuple2.create("29", "Base IRCANTEC non cotisée (arrêt de travail)"));
1059
                vCodeBase.add(Tuple2.create("31", "Eléments de cotisation Prévoyance, Santé, retraite supplémentaire"));
1067
                vCodeBase.add(Tuple2.create("31", "Eléments de cotisation Prévoyance, Santé, retraite supplémentaire"));
1060
                vCodeBase.add(Tuple2.create("33", "Assiette Contribution sur les avantages de préretraite entreprise"));
1068
                vCodeBase.add(Tuple2.create("33", "Assiette Contribution sur les avantages de préretraite entreprise"));
1061
                vCodeBase.add(Tuple2.create("34", "CIBTP -Base plafonnée de cotisations intempéries gros oeuvre travaux publics"));
1069
                vCodeBase.add(Tuple2.create("34", "CIBTP -Base plafonnée de cotisations intempéries gros oeuvre travaux publics"));
1062
                vCodeBase.add(Tuple2.create("35", "CIBTP -Base plafonnée de cotisations intempéries second oeuvre"));
1070
                vCodeBase.add(Tuple2.create("35", "CIBTP -Base plafonnée de cotisations intempéries second oeuvre"));
1063
                vCodeBase.add(Tuple2.create("36", "CIBTP -Base \"A\" de cotisations organisme professionnel BTP"));
1071
                vCodeBase.add(Tuple2.create("36", "CIBTP -Base \"A\" de cotisations organisme professionnel BTP"));
1064
                vCodeBase.add(Tuple2.create("37", "Assiette de pénibilité"));
1072
                vCodeBase.add(Tuple2.create("37", "Assiette de pénibilité"));
1065
                vCodeBase.add(Tuple2.create("38", "Rémunération pour le calcul de la réduction Travailleur Occasionnel"));
1073
                vCodeBase.add(Tuple2.create("38", "Rémunération pour le calcul de la réduction Travailleur Occasionnel"));
1066
                vCodeBase.add(Tuple2.create("39", "CIBTP -Base \"B\" de cotisations organisme professionnel BTP"));
1074
                vCodeBase.add(Tuple2.create("39", "CIBTP -Base \"B\" de cotisations organisme professionnel BTP"));
1067
                vCodeBase.add(Tuple2.create("40", "CIBTP -Base \"C\" de cotisations organisme professionnel BTP"));
1075
                vCodeBase.add(Tuple2.create("40", "CIBTP -Base \"C\" de cotisations organisme professionnel BTP"));
1068
                vCodeBase.add(Tuple2.create("41", "CRPNPAC-Assiette soumise au taux normal (non-plafonnée)"));
1076
                vCodeBase.add(Tuple2.create("41", "CRPNPAC-Assiette soumise au taux normal (non-plafonnée)"));
1069
                vCodeBase.add(Tuple2.create("42", "CRPNPAC-Assiette soumise au taux majoré (non-plafonnée)"));
1077
                vCodeBase.add(Tuple2.create("42", "CRPNPAC-Assiette soumise au taux majoré (non-plafonnée)"));
1070
                vCodeBase.add(Tuple2.create("43", "Base plafonnée exceptionnelle Agirc Arrco"));
1078
                vCodeBase.add(Tuple2.create("43", "Base plafonnée exceptionnelle Agirc Arrco"));
1071
                vCodeBase.add(Tuple2.create("44", "Assiette du forfait social à 16%"));
1079
                vCodeBase.add(Tuple2.create("44", "Assiette du forfait social à 16%"));
1072
                vCodeBase.add(Tuple2.create("45", "Base plafonnée ICP Agirc-Arrco"));
1080
                vCodeBase.add(Tuple2.create("45", "Base plafonnée ICP Agirc-Arrco"));
1073
                vCodeBase.add(Tuple2.create("90", "Autre revenu net imposable"));
1081
                vCodeBase.add(Tuple2.create("90", "Autre revenu net imposable"));
1074
                insertValues(vCodeBase, root.getTable("CODE_BASE_ASSUJETTIE"));
1082
                insertValues(vCodeBase, root.getTable("CODE_BASE_ASSUJETTIE"));
1075
 
1083
 
1076
                AlterTable tableRubCotis = new AlterTable(tableRubCot);
1084
                AlterTable tableRubCotis = new AlterTable(tableRubCot);
1077
                tableRubCotis.addForeignColumn("ID_CODE_COTISATION_INDIVIDUELLE", root.getTable("CODE_COTISATION_INDIVIDUELLE"));
1085
                tableRubCotis.addForeignColumn("ID_CODE_COTISATION_INDIVIDUELLE", root.getTable("CODE_COTISATION_INDIVIDUELLE"));
1078
                root.getBase().getDataSource().execute(tableRubCotis.asString());
1086
                root.getBase().getDataSource().execute(tableRubCotis.asString());
1079
                root.refetchTable(tableRubCot.getName());
1087
                root.refetchTable(tableRubCot.getName());
1080
                root.getSchema().updateVersion();
1088
                root.getSchema().updateVersion();
1081
            } catch (SQLException ex) {
1089
            } catch (SQLException ex) {
1082
                throw new IllegalStateException("Erreur lors de la création de la table " + "CODE_COTISATION_INDIVIDUELLE", ex);
1090
                throw new IllegalStateException("Erreur lors de la création de la table " + "CODE_COTISATION_INDIVIDUELLE", ex);
1083
            }
1091
            }
1084
            {
1092
            {
1085
                final SQLTable tableCodeBase = root.getTable("CODE_BASE_ASSUJETTIE");
1093
                final SQLTable tableCodeBase = root.getTable("CODE_BASE_ASSUJETTIE");
1086
                SQLSelect selCodeBase = new SQLSelect();
1094
                SQLSelect selCodeBase = new SQLSelect();
1087
                selCodeBase.addSelectStar(tableCodeBase);
1095
                selCodeBase.addSelectStar(tableCodeBase);
1088
                List<SQLRow> rowsCodeBase = SQLRowListRSH.execute(selCodeBase);
1096
                List<SQLRow> rowsCodeBase = SQLRowListRSH.execute(selCodeBase);
1089
                Map<String, SQLRow> mapCodeBase = new HashMap<String, SQLRow>();
1097
                Map<String, SQLRow> mapCodeBase = new HashMap<String, SQLRow>();
1090
                for (SQLRow sqlRow : rowsCodeBase) {
1098
                for (SQLRow sqlRow : rowsCodeBase) {
1091
 
1099
 
1092
                    final String string = sqlRow.getString("CODE");
1100
                    final String string = sqlRow.getString("CODE");
1093
                    mapCodeBase.put(string, sqlRow);
1101
                    mapCodeBase.put(string, sqlRow);
1094
                }
1102
                }
1095
                final SQLTable tableCodeTypeComp = root.getTable("TYPE_COMPOSANT_BASE_ASSUJETTIE");
1103
                final SQLTable tableCodeTypeComp = root.getTable("TYPE_COMPOSANT_BASE_ASSUJETTIE");
1096
                SQLSelect selCodeTypeComp = new SQLSelect();
1104
                SQLSelect selCodeTypeComp = new SQLSelect();
1097
                selCodeTypeComp.addSelectStar(tableCodeTypeComp);
1105
                selCodeTypeComp.addSelectStar(tableCodeTypeComp);
1098
                List<SQLRow> rowsTypeComp = SQLRowListRSH.execute(selCodeTypeComp);
1106
                List<SQLRow> rowsTypeComp = SQLRowListRSH.execute(selCodeTypeComp);
1099
                Map<String, SQLRow> mapTypeComp = new HashMap<String, SQLRow>();
1107
                Map<String, SQLRow> mapTypeComp = new HashMap<String, SQLRow>();
1100
                for (SQLRow sqlRow : rowsTypeComp) {
1108
                for (SQLRow sqlRow : rowsTypeComp) {
1101
                    final String string = sqlRow.getString("CODE");
1109
                    final String string = sqlRow.getString("CODE");
1102
                    mapTypeComp.put(string, sqlRow);
1110
                    mapTypeComp.put(string, sqlRow);
1103
                }
1111
                }
1104
                final SQLTable tableCodeCotInd = root.getTable("CODE_COTISATION_INDIVIDUELLE");
1112
                final SQLTable tableCodeCotInd = root.getTable("CODE_COTISATION_INDIVIDUELLE");
1105
                SQLSelect selCodeCodeInd = new SQLSelect();
1113
                SQLSelect selCodeCodeInd = new SQLSelect();
1106
                selCodeCodeInd.addSelectStar(tableCodeCotInd);
1114
                selCodeCodeInd.addSelectStar(tableCodeCotInd);
1107
                List<SQLRow> rowsCodeInd = SQLRowListRSH.execute(selCodeCodeInd);
1115
                List<SQLRow> rowsCodeInd = SQLRowListRSH.execute(selCodeCodeInd);
1108
                Map<String, SQLRow> mapCodeInd = new HashMap<String, SQLRow>();
1116
                Map<String, SQLRow> mapCodeInd = new HashMap<String, SQLRow>();
1109
                for (SQLRow sqlRow : rowsCodeInd) {
1117
                for (SQLRow sqlRow : rowsCodeInd) {
1110
                    final String string = sqlRow.getString("CODE");
1118
                    final String string = sqlRow.getString("CODE");
1111
                    mapCodeInd.put(string, sqlRow);
1119
                    mapCodeInd.put(string, sqlRow);
1112
                }
1120
                }
1113
                final SQLTable tableCaisse = caisseCot;
1121
                final SQLTable tableCaisse = caisseCot;
1114
                SQLSelect selCodeCodeCaisse = new SQLSelect();
1122
                SQLSelect selCodeCodeCaisse = new SQLSelect();
1115
                selCodeCodeCaisse.addSelectStar(tableCaisse);
1123
                selCodeCodeCaisse.addSelectStar(tableCaisse);
1116
                List<SQLRow> rowsCodeCaisse = SQLRowListRSH.execute(selCodeCodeCaisse);
1124
                List<SQLRow> rowsCodeCaisse = SQLRowListRSH.execute(selCodeCodeCaisse);
1117
                Map<String, SQLRow> mapCodeCaisse = new HashMap<String, SQLRow>();
1125
                Map<String, SQLRow> mapCodeCaisse = new HashMap<String, SQLRow>();
1118
                for (SQLRow sqlRow : rowsCodeCaisse) {
1126
                for (SQLRow sqlRow : rowsCodeCaisse) {
1119
                    final String string = sqlRow.getString("NOM");
1127
                    final String string = sqlRow.getString("NOM");
1120
                    mapCodeCaisse.put(string, sqlRow);
1128
                    mapCodeCaisse.put(string, sqlRow);
1121
                }
1129
                }
1122
                if (mapCodeCaisse.containsKey("ARRCO")) {
1130
                if (mapCodeCaisse.containsKey("ARRCO")) {
1123
                    UpdateBuilder updaterRubCot = new UpdateBuilder(tableRubCot);
1131
                    UpdateBuilder updaterRubCot = new UpdateBuilder(tableRubCot);
1124
                    updaterRubCot.setObject("ID_CODE_BASE_ASSUJETTIE", mapCodeBase.get("02").getID());
1132
                    updaterRubCot.setObject("ID_CODE_BASE_ASSUJETTIE", mapCodeBase.get("02").getID());
1125
                    updaterRubCot.setObject("ID_CODE_COTISATION_INDIVIDUELLE", mapCodeInd.get("063").getID());
1133
                    updaterRubCot.setObject("ID_CODE_COTISATION_INDIVIDUELLE", mapCodeInd.get("063").getID());
1126
                    // updaterRubCot.setObject("ID_TYPE_COMPOSANT_BASE_ASSUJETTIE",
1134
                    // updaterRubCot.setObject("ID_TYPE_COMPOSANT_BASE_ASSUJETTIE",
1127
                    // mapTypeComp.get("03").getID());
1135
                    // mapTypeComp.get("03").getID());
1128
                    updaterRubCot.setWhere(new Where(tableRubCot.getField("ID_CAISSE_COTISATION"), "=", mapCodeCaisse.get("ARRCO").getID()));
1136
                    updaterRubCot.setWhere(new Where(tableRubCot.getField("ID_CAISSE_COTISATION"), "=", mapCodeCaisse.get("ARRCO").getID()));
1129
                    root.getBase().getDataSource().execute(updaterRubCot.asString());
1137
                    root.getBase().getDataSource().execute(updaterRubCot.asString());
1130
                }
1138
                }
1131
                if (mapCodeCaisse.containsKey("AGIRC")) {
1139
                if (mapCodeCaisse.containsKey("AGIRC")) {
1132
                    UpdateBuilder updaterRubCot = new UpdateBuilder(tableRubCot);
1140
                    UpdateBuilder updaterRubCot = new UpdateBuilder(tableRubCot);
1133
                    updaterRubCot.setObject("ID_CODE_BASE_ASSUJETTIE", mapCodeBase.get("03").getID());
1141
                    updaterRubCot.setObject("ID_CODE_BASE_ASSUJETTIE", mapCodeBase.get("03").getID());
1134
                    updaterRubCot.setObject("ID_CODE_COTISATION_INDIVIDUELLE", mapCodeInd.get("064").getID());
1142
                    updaterRubCot.setObject("ID_CODE_COTISATION_INDIVIDUELLE", mapCodeInd.get("064").getID());
1135
                    // updaterRubCot.setObject("ID_TYPE_COMPOSANT_BASE_ASSUJETTIE",
1143
                    // updaterRubCot.setObject("ID_TYPE_COMPOSANT_BASE_ASSUJETTIE",
1136
                    // mapTypeComp.get("03").getID());
1144
                    // mapTypeComp.get("03").getID());
1137
                    updaterRubCot.setWhere(new Where(tableRubCot.getField("ID_CAISSE_COTISATION"), "=", mapCodeCaisse.get("AGIRC").getID()));
1145
                    updaterRubCot.setWhere(new Where(tableRubCot.getField("ID_CAISSE_COTISATION"), "=", mapCodeCaisse.get("AGIRC").getID()));
1138
                    root.getBase().getDataSource().execute(updaterRubCot.asString());
1146
                    root.getBase().getDataSource().execute(updaterRubCot.asString());
1139
                }
1147
                }
1140
            }
1148
            }
1141
        }
1149
        }
1142
 
1150
 
1143
        if (!tableRubNet.contains("ID_CODE_COTISATION_INDIVIDUELLE")) {
1151
        if (!tableRubNet.contains("ID_CODE_COTISATION_INDIVIDUELLE")) {
1144
            AlterTable alterRubNet = new AlterTable(tableRubNet);
1152
            AlterTable alterRubNet = new AlterTable(tableRubNet);
1145
            alterRubNet.addForeignColumn("ID_CODE_COTISATION_INDIVIDUELLE", root.getTable("CODE_COTISATION_INDIVIDUELLE"));
1153
            alterRubNet.addForeignColumn("ID_CODE_COTISATION_INDIVIDUELLE", root.getTable("CODE_COTISATION_INDIVIDUELLE"));
1146
            root.getBase().getDataSource().execute(alterRubNet.asString());
1154
            root.getBase().getDataSource().execute(alterRubNet.asString());
1147
            root.refetchTable(tableRubNet.getName());
1155
            root.refetchTable(tableRubNet.getName());
1148
            root.getSchema().updateVersion();
1156
            root.getSchema().updateVersion();
1149
        }
1157
        }
1150
        if (!tableRubNet.contains("ID_TYPE_COMPOSANT_BASE_ASSUJETTIE")) {
1158
        if (!tableRubNet.contains("ID_TYPE_COMPOSANT_BASE_ASSUJETTIE")) {
1151
            AlterTable alterRubNet = new AlterTable(tableRubNet);
1159
            AlterTable alterRubNet = new AlterTable(tableRubNet);
1152
            alterRubNet.addForeignColumn("ID_TYPE_COMPOSANT_BASE_ASSUJETTIE", root.getTable("TYPE_COMPOSANT_BASE_ASSUJETTIE"));
1160
            alterRubNet.addForeignColumn("ID_TYPE_COMPOSANT_BASE_ASSUJETTIE", root.getTable("TYPE_COMPOSANT_BASE_ASSUJETTIE"));
1153
            root.getBase().getDataSource().execute(alterRubNet.asString());
1161
            root.getBase().getDataSource().execute(alterRubNet.asString());
1154
            root.refetchTable(tableRubNet.getName());
1162
            root.refetchTable(tableRubNet.getName());
1155
            root.getSchema().updateVersion();
1163
            root.getSchema().updateVersion();
1156
        }
1164
        }
1157
        if (!tableRubNet.contains("ID_CODE_BASE_ASSUJETTIE")) {
1165
        if (!tableRubNet.contains("ID_CODE_BASE_ASSUJETTIE")) {
1158
            AlterTable alterRubNet = new AlterTable(tableRubNet);
1166
            AlterTable alterRubNet = new AlterTable(tableRubNet);
1159
            alterRubNet.addForeignColumn("ID_CODE_BASE_ASSUJETTIE", root.getTable("CODE_BASE_ASSUJETTIE"));
1167
            alterRubNet.addForeignColumn("ID_CODE_BASE_ASSUJETTIE", root.getTable("CODE_BASE_ASSUJETTIE"));
1160
            root.getBase().getDataSource().execute(alterRubNet.asString());
1168
            root.getBase().getDataSource().execute(alterRubNet.asString());
1161
            root.refetchTable(tableRubNet.getName());
1169
            root.refetchTable(tableRubNet.getName());
1162
            root.getSchema().updateVersion();
1170
            root.getSchema().updateVersion();
1163
        }
1171
        }
1164
 
1172
 
1165
        if (!tableRubNet.contains("ID_CAISSE_COTISATION")) {
1173
        if (!tableRubNet.contains("ID_CAISSE_COTISATION")) {
1166
            AlterTable alterRubNet = new AlterTable(tableRubNet);
1174
            AlterTable alterRubNet = new AlterTable(tableRubNet);
1167
            alterRubNet.addForeignColumn("ID_CAISSE_COTISATION", caisseCot);
1175
            alterRubNet.addForeignColumn("ID_CAISSE_COTISATION", caisseCot);
1168
            root.getBase().getDataSource().execute(alterRubNet.asString());
1176
            root.getBase().getDataSource().execute(alterRubNet.asString());
1169
            root.refetchTable(tableRubNet.getName());
1177
            root.refetchTable(tableRubNet.getName());
1170
            root.getSchema().updateVersion();
1178
            root.getSchema().updateVersion();
1171
        }
1179
        }
1172
 
1180
 
1173
        if (!root.contains("CODE_COTISATION_ETABLISSEMENT")) {
1181
        if (!root.contains("CODE_COTISATION_ETABLISSEMENT")) {
1174
            final SQLCreateTable createTableTypeComposant = new SQLCreateTable(root, "CODE_COTISATION_ETABLISSEMENT");
1182
            final SQLCreateTable createTableTypeComposant = new SQLCreateTable(root, "CODE_COTISATION_ETABLISSEMENT");
1175
            createTableTypeComposant.addVarCharColumn("CODE", 25);
1183
            createTableTypeComposant.addVarCharColumn("CODE", 25);
1176
            createTableTypeComposant.addVarCharColumn("NOM", 512);
1184
            createTableTypeComposant.addVarCharColumn("NOM", 512);
1177
 
1185
 
1178
            try {
1186
            try {
1179
                root.getBase().getDataSource().execute(createTableTypeComposant.asString());
1187
                root.getBase().getDataSource().execute(createTableTypeComposant.asString());
1180
                insertUndef(createTableTypeComposant);
1188
                insertUndef(createTableTypeComposant);
1181
                root.refetchTable("CODE_COTISATION_ETABLISSEMENT");
1189
                root.refetchTable("CODE_COTISATION_ETABLISSEMENT");
1182
                root.getSchema().updateVersion();
1190
                root.getSchema().updateVersion();
1183
 
1191
 
1184
                final SQLTable table = root.getTable("CODE_COTISATION_ETABLISSEMENT");
1192
                final SQLTable table = root.getTable("CODE_COTISATION_ETABLISSEMENT");
1185
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
1193
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
1186
 
1194
 
1187
                v.add(Tuple2.create("001", "Cotisation ADPFA (Association pour le Développement du Paritarisme des Fleuristes et Animaliers)"));
1195
                v.add(Tuple2.create("001", "Cotisation ADPFA (Association pour le Développement du Paritarisme des Fleuristes et Animaliers)"));
1188
                v.add(Tuple2.create("002", "Cotisation APNAB (Association Paritaire Nationale pour le développement de la négociation collective dans l'Artisanat du Bâtiment)"));
1196
                v.add(Tuple2.create("002", "Cotisation APNAB (Association Paritaire Nationale pour le développement de la négociation collective dans l'Artisanat du Bâtiment)"));
1189
                v.add(Tuple2.create("003 ", "Cotisation sur assiette avec congés payés CCCA-BTP (Comité de Concertation et de Coordination de l'apprentissage du Bâtiment et des Travaux Publics)"));
1197
                v.add(Tuple2.create("003 ", "Cotisation sur assiette avec congés payés CCCA-BTP (Comité de Concertation et de Coordination de l'apprentissage du Bâtiment et des Travaux Publics)"));
1190
                v.add(Tuple2.create("004 ", "Cotisation CPPNTT (Commission Paritaire Professionnelle Nationale du Travail Temporaire)"));
1198
                v.add(Tuple2.create("004 ", "Cotisation CPPNTT (Commission Paritaire Professionnelle Nationale du Travail Temporaire)"));
1191
                v.add(Tuple2.create("005 ", "Cotisation Développement du paritarisme"));
1199
                v.add(Tuple2.create("005 ", "Cotisation Développement du paritarisme"));
1192
                v.add(Tuple2.create("006 ", "Cotisation Dialogue social"));
1200
                v.add(Tuple2.create("006 ", "Cotisation Dialogue social"));
1193
                v.add(Tuple2.create("007 ", "Cotisation FAF (Fonds d'Assurance formation)"));
1201
                v.add(Tuple2.create("007 ", "Cotisation FAF (Fonds d'Assurance formation)"));
1194
                v.add(Tuple2.create("009 ", "Cotisation FAPS (Fonds d'action professionnelle et sociale)"));
1202
                v.add(Tuple2.create("009 ", "Cotisation FAPS (Fonds d'action professionnelle et sociale)"));
1195
                v.add(Tuple2.create("010 ", "Cotisation FASTT (Fonds d'Action Sociale du Travail Temporaire)"));
1203
                v.add(Tuple2.create("010 ", "Cotisation FASTT (Fonds d'Action Sociale du Travail Temporaire)"));
1196
                v.add(Tuple2.create("011 ", "Cotisation Fonds de péréquation"));
1204
                v.add(Tuple2.create("011 ", "Cotisation Fonds de péréquation"));
1197
                v.add(Tuple2.create("012 ", "Cotisation IFC (Indemnités de fin de carrière)"));
1205
                v.add(Tuple2.create("012 ", "Cotisation IFC (Indemnités de fin de carrière)"));
1198
                v.add(Tuple2.create("017 ", "Cotisation ORGA (Organisations Syndicales  du Travail Temporaire)"));
1206
                v.add(Tuple2.create("017 ", "Cotisation ORGA (Organisations Syndicales  du Travail Temporaire)"));
1199
                v.add(Tuple2.create("018 ", "Cotisation Promotion et recrutement"));
1207
                v.add(Tuple2.create("018 ", "Cotisation Promotion et recrutement"));
1200
                v.add(Tuple2.create("019 ", "Cotisations attachées à une population de non salariés ayants"));
1208
                v.add(Tuple2.create("019 ", "Cotisations attachées à une population de non salariés ayants"));
1201
                v.add(Tuple2.create("020 ", "Cotisations attachées à une population de non salariés retraités"));
1209
                v.add(Tuple2.create("020 ", "Cotisations attachées à une population de non salariés retraités"));
1202
                v.add(Tuple2.create("021 ", "Cotisations FMSE (Fond national agricole de mutualisation des risques sanitaires et environnementaux)"));
1210
                v.add(Tuple2.create("021 ", "Cotisations FMSE (Fond national agricole de mutualisation des risques sanitaires et environnementaux)"));
1203
                v.add(Tuple2.create("022 ", "Cotisations VAL'HOR (association française pour la valorisation des produits et métiers de l'horticulture et du paysage)"));
1211
                v.add(Tuple2.create("022 ", "Cotisations VAL'HOR (association française pour la valorisation des produits et métiers de l'horticulture et du paysage)"));
1204
                v.add(Tuple2.create("023 ", "Chiffre d'affaire"));
1212
                v.add(Tuple2.create("023 ", "Chiffre d'affaire"));
1205
                v.add(Tuple2.create("024 ", "Nombre d'heures d'intérim"));
1213
                v.add(Tuple2.create("024 ", "Nombre d'heures d'intérim"));
1206
                v.add(Tuple2.create("025 ", "Contribution aux régimes supplémentaires de retraite à prestations définies - Rente"));
1214
                v.add(Tuple2.create("025 ", "Contribution aux régimes supplémentaires de retraite à prestations définies - Rente"));
1207
                v.add(Tuple2.create("026 ", "Contribution aux régimes supplémentaires de retraite à prestations définies - Prime"));
1215
                v.add(Tuple2.create("026 ", "Contribution aux régimes supplémentaires de retraite à prestations définies - Prime"));
1208
                v.add(Tuple2.create("027 ", "Contribution aux régimes supplémentaires de retraite à prestations définies - Dotations"));
1216
                v.add(Tuple2.create("027 ", "Contribution aux régimes supplémentaires de retraite à prestations définies - Dotations"));
1209
                v.add(Tuple2.create("028 ", "Contribution additionnelle sur les rentes liquidées"));
1217
                v.add(Tuple2.create("028 ", "Contribution additionnelle sur les rentes liquidées"));
1210
                v.add(Tuple2.create("029 ", "Contribution aux régimes supplémentaires de retraite à prestations définies. Rente à taux 7%"));
1218
                v.add(Tuple2.create("029 ", "Contribution aux régimes supplémentaires de retraite à prestations définies. Rente à taux 7%"));
1211
                v.add(Tuple2.create("030 ", "Contribution aux régimes supplémentaires de retraite à prestations définies. Rente à taux 14%"));
1219
                v.add(Tuple2.create("030 ", "Contribution aux régimes supplémentaires de retraite à prestations définies. Rente à taux 14%"));
1212
                v.add(Tuple2.create("031 ", "Contribution additionnelle de solidarité pour l'autonomie"));
1220
                v.add(Tuple2.create("031 ", "Contribution additionnelle de solidarité pour l'autonomie"));
1213
                v.add(Tuple2.create("032 ", "Contribution Sociale généralisée au taux de 3,80% + RDS sur revenu de remplacement "));
1221
                v.add(Tuple2.create("032 ", "Contribution Sociale généralisée au taux de 3,80% + RDS sur revenu de remplacement "));
1214
                v.add(Tuple2.create("033 ", "Contribution Sociale généralisée au taux de 6,20% + RDS sur revenu de remplacement "));
1222
                v.add(Tuple2.create("033 ", "Contribution Sociale généralisée au taux de 6,20% + RDS sur revenu de remplacement "));
1215
                v.add(Tuple2.create("034 ", "Contribution Sociale généralisée au taux de 6,60% + RDS sur revenu de remplacement "));
1223
                v.add(Tuple2.create("034 ", "Contribution Sociale généralisée au taux de 6,60% + RDS sur revenu de remplacement "));
1216
                v.add(Tuple2.create("035 ", "Contribution Sociale généralisée au taux de 7,50% + RDS sur revenu de remplacement "));
1224
                v.add(Tuple2.create("035 ", "Contribution Sociale généralisée au taux de 7,50% + RDS sur revenu de remplacement "));
1217
                v.add(Tuple2.create("036 ", "Cotisation TTC sur assiette CDD avec congés payés pour le secteur du BTP (Constructys Organisme Paritaire Collecteur Agréé pour le BTP)"));
1225
                v.add(Tuple2.create("036 ", "Cotisation TTC sur assiette CDD avec congés payés pour le secteur du BTP (Constructys Organisme Paritaire Collecteur Agréé pour le BTP)"));
1218
                v.add(Tuple2.create("037 ", "Cotisation TTC sur assiette avec congés payés pour le secteur du BTP (Constructys Organisme Paritaire Collecteur Agréé pour le BTP)"));
1226
                v.add(Tuple2.create("037 ", "Cotisation TTC sur assiette avec congés payés pour le secteur du BTP (Constructys Organisme Paritaire Collecteur Agréé pour le BTP)"));
1219
                v.add(Tuple2.create("038 ", "Cotisation TTC  sur assiette sans  congés payés (Constructys Organisme Paritaire Collecteur Agréé pour le BTP)"));
1227
                v.add(Tuple2.create("038 ", "Cotisation TTC  sur assiette sans  congés payés (Constructys Organisme Paritaire Collecteur Agréé pour le BTP)"));
1220
                v.add(Tuple2.create("039 ",
1228
                v.add(Tuple2.create("039 ",
1221
                        "Cotisation TTC  sur assiette avec congés payés pour les salariés non soumis à la cotisation CCCA-BTP (Constructys Organisme Paritaire Collecteur Agréé pour le BTP)"));
1229
                        "Cotisation TTC  sur assiette avec congés payés pour les salariés non soumis à la cotisation CCCA-BTP (Constructys Organisme Paritaire Collecteur Agréé pour le BTP)"));
1222
                v.add(Tuple2.create("040 ",
1230
                v.add(Tuple2.create("040 ",
1223
                        "Cotisation TTC  sur assiette hors congés payés pour les salariés non soumis à la cotisation CCCA-BTP (Constructys Organisme Paritaire Collecteur Agréé pour le BTP)"));
1231
                        "Cotisation TTC  sur assiette hors congés payés pour les salariés non soumis à la cotisation CCCA-BTP (Constructys Organisme Paritaire Collecteur Agréé pour le BTP)"));
1224
                v.add(Tuple2.create("041 ", "Cotisation maladie sur les avantages de préretraite"));
1232
                v.add(Tuple2.create("041 ", "Cotisation maladie sur les avantages de préretraite"));
1225
                v.add(Tuple2.create("042 ", "Cotisation maladie sur les avantages de retraite"));
1233
                v.add(Tuple2.create("042 ", "Cotisation maladie sur les avantages de retraite"));
1226
                v.add(Tuple2.create("043 ", "Cotisation maladie Alsace-Moselle sur les avantages de retraite"));
1234
                v.add(Tuple2.create("043 ", "Cotisation maladie Alsace-Moselle sur les avantages de retraite"));
1227
                v.add(Tuple2.create("044 ", "Cotisation forfait social à 8%"));
1235
                v.add(Tuple2.create("044 ", "Cotisation forfait social à 8%"));
1228
                v.add(Tuple2.create("045 ", "Cotisation forfait social à 20%"));
1236
                v.add(Tuple2.create("045 ", "Cotisation forfait social à 20%"));
1229
                v.add(Tuple2.create("090 ", "Cotisation spécifique Prévoyance"));
1237
                v.add(Tuple2.create("090 ", "Cotisation spécifique Prévoyance"));
1230
 
1238
 
1231
                insertValues(v, table);
1239
                insertValues(v, table);
1232
 
1240
 
1233
                AlterTable tableRubCotis = new AlterTable(tableRubCot);
1241
                AlterTable tableRubCotis = new AlterTable(tableRubCot);
1234
                tableRubCotis.addForeignColumn("ID_CODE_COTISATION_ETABLISSEMENT", root.getTable("CODE_COTISATION_ETABLISSEMENT"));
1242
                tableRubCotis.addForeignColumn("ID_CODE_COTISATION_ETABLISSEMENT", root.getTable("CODE_COTISATION_ETABLISSEMENT"));
1235
                root.getBase().getDataSource().execute(tableRubCotis.asString());
1243
                root.getBase().getDataSource().execute(tableRubCotis.asString());
1236
                root.refetchTable(tableRubCot.getName());
1244
                root.refetchTable(tableRubCot.getName());
1237
                root.getSchema().updateVersion();
1245
                root.getSchema().updateVersion();
1238
            } catch (SQLException ex) {
1246
            } catch (SQLException ex) {
1239
                throw new IllegalStateException("Erreur lors de la création de la table " + "CODE_COTISATION_ETABLISSEMENT", ex);
1247
                throw new IllegalStateException("Erreur lors de la création de la table " + "CODE_COTISATION_ETABLISSEMENT", ex);
1240
            }
1248
            }
1241
        }
1249
        }
1242
 
1250
 
1243
        if (!root.contains("CODE_PENIBILITE")) {
1251
        if (!root.contains("CODE_PENIBILITE")) {
1244
            final SQLCreateTable createTableTypeComposant = new SQLCreateTable(root, "CODE_PENIBILITE");
1252
            final SQLCreateTable createTableTypeComposant = new SQLCreateTable(root, "CODE_PENIBILITE");
1245
            createTableTypeComposant.addVarCharColumn("CODE", 25);
1253
            createTableTypeComposant.addVarCharColumn("CODE", 25);
1246
            createTableTypeComposant.addVarCharColumn("NOM", 512);
1254
            createTableTypeComposant.addVarCharColumn("NOM", 512);
1247
 
1255
 
1248
            try {
1256
            try {
1249
                root.getBase().getDataSource().execute(createTableTypeComposant.asString());
1257
                root.getBase().getDataSource().execute(createTableTypeComposant.asString());
1250
                insertUndef(createTableTypeComposant);
1258
                insertUndef(createTableTypeComposant);
1251
                root.refetchTable("CODE_PENIBILITE");
1259
                root.refetchTable("CODE_PENIBILITE");
1252
                root.getSchema().updateVersion();
1260
                root.getSchema().updateVersion();
1253
 
1261
 
1254
                final SQLTable table = root.getTable("CODE_PENIBILITE");
1262
                final SQLTable table = root.getTable("CODE_PENIBILITE");
1255
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
1263
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
1256
 
1264
 
1257
                v.add(Tuple2.create("01", "les manutentions manuelles de charges"));
1265
                v.add(Tuple2.create("01", "les manutentions manuelles de charges"));
1258
                v.add(Tuple2.create("02", "les postures pénibles (positions forcées des articulations)"));
1266
                v.add(Tuple2.create("02", "les postures pénibles (positions forcées des articulations)"));
1259
                v.add(Tuple2.create("03", "les vibrations mécaniques"));
1267
                v.add(Tuple2.create("03", "les vibrations mécaniques"));
1260
                v.add(Tuple2.create("04", "les agents chimiques dangereux"));
1268
                v.add(Tuple2.create("04", "les agents chimiques dangereux"));
1261
                v.add(Tuple2.create("05", "les activités exercées en milieu hyperbare"));
1269
                v.add(Tuple2.create("05", "les activités exercées en milieu hyperbare"));
1262
                v.add(Tuple2.create("06", "les températures extrêmes"));
1270
                v.add(Tuple2.create("06", "les températures extrêmes"));
1263
                v.add(Tuple2.create("07", "le bruit"));
1271
                v.add(Tuple2.create("07", "le bruit"));
1264
                v.add(Tuple2.create("08", "le travail de nuit"));
1272
                v.add(Tuple2.create("08", "le travail de nuit"));
1265
                v.add(Tuple2.create("09", "le travail en équipes successives alternantes"));
1273
                v.add(Tuple2.create("09", "le travail en équipes successives alternantes"));
1266
                v.add(Tuple2.create("10", "le travail répétitif (répétition d'un même geste, à une cadence contrainte avec un temps de cycle défini)"));
1274
                v.add(Tuple2.create("10", "le travail répétitif (répétition d'un même geste, à une cadence contrainte avec un temps de cycle défini)"));
1267
                v.add(Tuple2.create("99", "annulation"));
1275
                v.add(Tuple2.create("99", "annulation"));
1268
 
1276
 
1269
                insertValues(v, table);
1277
                insertValues(v, table);
1270
 
1278
 
1271
            } catch (SQLException ex) {
1279
            } catch (SQLException ex) {
1272
                throw new IllegalStateException("Erreur lors de la création de la table " + "CODE_PENIBILITE", ex);
1280
                throw new IllegalStateException("Erreur lors de la création de la table " + "CODE_PENIBILITE", ex);
1273
            }
1281
            }
1274
        }
1282
        }
1275
 
1283
 
1276
        if (!root.contains("AYANT_DROIT_TYPE")) {
1284
        if (!root.contains("AYANT_DROIT_TYPE")) {
1277
            final SQLCreateTable createTableTypeAyantDroit = new SQLCreateTable(root, "AYANT_DROIT_TYPE");
1285
            final SQLCreateTable createTableTypeAyantDroit = new SQLCreateTable(root, "AYANT_DROIT_TYPE");
1278
            createTableTypeAyantDroit.addVarCharColumn("CODE", 25);
1286
            createTableTypeAyantDroit.addVarCharColumn("CODE", 25);
1279
            createTableTypeAyantDroit.addVarCharColumn("NOM", 512);
1287
            createTableTypeAyantDroit.addVarCharColumn("NOM", 512);
1280
 
1288
 
1281
            try {
1289
            try {
1282
                root.getBase().getDataSource().execute(createTableTypeAyantDroit.asString());
1290
                root.getBase().getDataSource().execute(createTableTypeAyantDroit.asString());
1283
                insertUndef(createTableTypeAyantDroit);
1291
                insertUndef(createTableTypeAyantDroit);
1284
                root.refetchTable("AYANT_DROIT_TYPE");
1292
                root.refetchTable("AYANT_DROIT_TYPE");
1285
                root.getSchema().updateVersion();
1293
                root.getSchema().updateVersion();
1286
 
1294
 
1287
                final SQLTable table = root.getTable("AYANT_DROIT_TYPE");
1295
                final SQLTable table = root.getTable("AYANT_DROIT_TYPE");
1288
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
1296
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
1289
 
1297
 
1290
                v.add(Tuple2.create("01", "Adultes (conjoint, concubin, pacs)"));
1298
                v.add(Tuple2.create("01", "Adultes (conjoint, concubin, pacs)"));
1291
                v.add(Tuple2.create("02", "Enfant"));
1299
                v.add(Tuple2.create("02", "Enfant"));
1292
                v.add(Tuple2.create("03", "Autre (ascendant, collatéraux, ...)"));
1300
                v.add(Tuple2.create("03", "Autre (ascendant, collatéraux, ...)"));
1293
 
1301
 
1294
                insertValues(v, table);
1302
                insertValues(v, table);
1295
 
1303
 
1296
            } catch (SQLException ex) {
1304
            } catch (SQLException ex) {
1297
                throw new IllegalStateException("Erreur lors de la création de la table " + "AYANT_DROIT_TYPE", ex);
1305
                throw new IllegalStateException("Erreur lors de la création de la table " + "AYANT_DROIT_TYPE", ex);
1298
            }
1306
            }
1299
        }
1307
        }
1300
 
1308
 
1301
        if (!root.contains("TYPE_TAUX_PAS")) {
1309
        if (!root.contains("TYPE_TAUX_PAS")) {
1302
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "TYPE_TAUX_PAS");
1310
            final SQLCreateTable createTableMotif = new SQLCreateTable(root, "TYPE_TAUX_PAS");
1303
            createTableMotif.addVarCharColumn("CODE", 25);
1311
            createTableMotif.addVarCharColumn("CODE", 25);
1304
            createTableMotif.addVarCharColumn("NOM", 512);
1312
            createTableMotif.addVarCharColumn("NOM", 512);
1305
 
1313
 
1306
            try {
1314
            try {
1307
                root.getBase().getDataSource().execute(createTableMotif.asString());
1315
                root.getBase().getDataSource().execute(createTableMotif.asString());
1308
                insertUndef(createTableMotif);
1316
                insertUndef(createTableMotif);
1309
                root.refetchTable("TYPE_TAUX_PAS");
1317
                root.refetchTable("TYPE_TAUX_PAS");
1310
                root.getSchema().updateVersion();
1318
                root.getSchema().updateVersion();
1311
 
1319
 
1312
                final SQLTable table = root.getTable("TYPE_TAUX_PAS");
1320
                final SQLTable table = root.getTable("TYPE_TAUX_PAS");
1313
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
1321
                List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
1314
                v.add(Tuple2.create("01", " Taux transmis par la DGFIP"));
1322
                v.add(Tuple2.create("01", " Taux transmis par la DGFIP"));
1315
                v.add(Tuple2.create("10", " Barème horaire métropole"));
1323
                v.add(Tuple2.create("10", " Barème horaire métropole"));
1316
                v.add(Tuple2.create("11", " Barème quotidien métropole"));
1324
                v.add(Tuple2.create("11", " Barème quotidien métropole"));
1317
                v.add(Tuple2.create("12", " Barème hebdomadaire métropole"));
1325
                v.add(Tuple2.create("12", " Barème hebdomadaire métropole"));
1318
                v.add(Tuple2.create("13", " Barème mensuel métropole"));
1326
                v.add(Tuple2.create("13", " Barème mensuel métropole"));
1319
                v.add(Tuple2.create("14", " Barème trimestriel métropole"));
1327
                v.add(Tuple2.create("14", " Barème trimestriel métropole"));
1320
                v.add(Tuple2.create("15", " Barème semestriel métropole"));
1328
                v.add(Tuple2.create("15", " Barème semestriel métropole"));
1321
                v.add(Tuple2.create("16", " Barème annuel métropole"));
1329
                v.add(Tuple2.create("16", " Barème annuel métropole"));
1322
                v.add(Tuple2.create("17", " Barème mathématique sur base mensuelle métropole"));
1330
                v.add(Tuple2.create("17", " Barème mathématique sur base mensuelle métropole"));
1323
                v.add(Tuple2.create("18", " Barème mathématique sur base annuelle métropole"));
1331
                v.add(Tuple2.create("18", " Barème mathématique sur base annuelle métropole"));
1324
                v.add(Tuple2.create("20", " Barème horaire Guadeloupe, Réunion et Martinique"));
1332
                v.add(Tuple2.create("20", " Barème horaire Guadeloupe, Réunion et Martinique"));
1325
                v.add(Tuple2.create("21", " Barème quotidien Guadeloupe, Réunion et Martinique"));
1333
                v.add(Tuple2.create("21", " Barème quotidien Guadeloupe, Réunion et Martinique"));
1326
                v.add(Tuple2.create("22", " Barème hebdomadaire Guadeloupe, Réunion et Martinique"));
1334
                v.add(Tuple2.create("22", " Barème hebdomadaire Guadeloupe, Réunion et Martinique"));
1327
                v.add(Tuple2.create("23", " Barème mensuel Guadeloupe, Réunion et Martinique"));
1335
                v.add(Tuple2.create("23", " Barème mensuel Guadeloupe, Réunion et Martinique"));
1328
                v.add(Tuple2.create("24", " Barème trimestriel Guadeloupe, Réunion et Martinique"));
1336
                v.add(Tuple2.create("24", " Barème trimestriel Guadeloupe, Réunion et Martinique"));
1329
                v.add(Tuple2.create("25", " Barème semestriel Guadeloupe, Réunion et Martinique"));
1337
                v.add(Tuple2.create("25", " Barème semestriel Guadeloupe, Réunion et Martinique"));
1330
                v.add(Tuple2.create("26", " Barème annuel Guadeloupe, Réunion et Martinique"));
1338
                v.add(Tuple2.create("26", " Barème annuel Guadeloupe, Réunion et Martinique"));
1331
                v.add(Tuple2.create("27", " Barème mathématique sur base mensuelle Guadeloupe, Réunion et Martinique"));
1339
                v.add(Tuple2.create("27", " Barème mathématique sur base mensuelle Guadeloupe, Réunion et Martinique"));
1332
                v.add(Tuple2.create("28", " Barème mathématique sur base annuelle Guadeloupe, Réunion et Martinique"));
1340
                v.add(Tuple2.create("28", " Barème mathématique sur base annuelle Guadeloupe, Réunion et Martinique"));
1333
                v.add(Tuple2.create("30", " Barème horaire Guyane et Mayotte"));
1341
                v.add(Tuple2.create("30", " Barème horaire Guyane et Mayotte"));
1334
                v.add(Tuple2.create("31", " Barème quotidien Guyane et Mayotte"));
1342
                v.add(Tuple2.create("31", " Barème quotidien Guyane et Mayotte"));
1335
                v.add(Tuple2.create("32", " Barème hebdomadaire Guyane et Mayotte"));
1343
                v.add(Tuple2.create("32", " Barème hebdomadaire Guyane et Mayotte"));
1336
                v.add(Tuple2.create("33", " Barème mensuel Guyane et Mayotte"));
1344
                v.add(Tuple2.create("33", " Barème mensuel Guyane et Mayotte"));
1337
                v.add(Tuple2.create("34", " Barème trimestriel Guyane et Mayotte"));
1345
                v.add(Tuple2.create("34", " Barème trimestriel Guyane et Mayotte"));
1338
                v.add(Tuple2.create("35", " Barème semestriel Guyane et Mayotte"));
1346
                v.add(Tuple2.create("35", " Barème semestriel Guyane et Mayotte"));
1339
                v.add(Tuple2.create("36", " Barème annuel Guyane et Mayotte"));
1347
                v.add(Tuple2.create("36", " Barème annuel Guyane et Mayotte"));
1340
                v.add(Tuple2.create("37", " Barème mathématique sur base mensuelle Guyane et Mayotte"));
1348
                v.add(Tuple2.create("37", " Barème mathématique sur base mensuelle Guyane et Mayotte"));
1341
                v.add(Tuple2.create("38", " Barème mathématique sur base annuelle Guyane et Mayotte"));
1349
                v.add(Tuple2.create("38", " Barème mathématique sur base annuelle Guyane et Mayotte"));
1342
                v.add(Tuple2.create("99", " Indu relatif à un exercice antérieur – pas de taux de PAS"));
1350
                v.add(Tuple2.create("99", " Indu relatif à un exercice antérieur – pas de taux de PAS"));
1343
 
1351
 
1344
                insertValues(v, table);
1352
                insertValues(v, table);
1345
            } catch (SQLException ex) {
1353
            } catch (SQLException ex) {
1346
                throw new IllegalStateException("Erreur lors de la création de la table " + "TYPE_TAUX_PAS", ex);
1354
                throw new IllegalStateException("Erreur lors de la création de la table " + "TYPE_TAUX_PAS", ex);
1347
            }
1355
            }
1348
        }
1356
        }
1349
 
1357
 
1350
        // P19V01.2
1358
        // P19V01.2
1351
        final SQLTable tableCotInd = root.getTable("CODE_COTISATION_INDIVIDUELLE");
1359
        final SQLTable tableCotInd = root.getTable("CODE_COTISATION_INDIVIDUELLE");
1352
        List<Tuple2<String, String>> vCodeIndiv = new ArrayList<>();
1360
        List<Tuple2<String, String>> vCodeIndiv = new ArrayList<>();
1353
        vCodeIndiv.add(Tuple2.create("104", "Pénibilité Cotisation de base"));
1361
        vCodeIndiv.add(Tuple2.create("104", " Pénibilité Cotisation de base"));
1354
        vCodeIndiv.add(Tuple2.create("105", "Montant de cotisation Régime Unifié Agirc-Arrco y compris Apec"));
1362
        vCodeIndiv.add(Tuple2.create("105", " Montant de cotisation Régime Unifié Agirc Arrco, y compris Apec"));
1355
        vCodeIndiv.add(Tuple2.create("106", "Réduction générale des cotisations patronales Agirc-Arrco"));
1363
        vCodeIndiv.add(Tuple2.create("106", " Réduction générale des cotisations patronales de retraite complémentaire"));
-
 
1364
        vCodeIndiv.add(Tuple2.create("107", " Forfait marin"));
-
 
1365
        vCodeIndiv.add(Tuple2.create("108", " Demi rôle marin"));
-
 
1366
        vCodeIndiv.add(Tuple2.create("109", " Exonération de cotisations salariales de retraite complémentaire au titre de l'emploi d'un apprenti"));
-
 
1367
        vCodeIndiv.add(Tuple2.create("110", " Exonération de cotisations patronales de retraite complémentaire applicable dans les DOM (LODEOM) SMIC 130% à 220%"));
-
 
1368
        vCodeIndiv.add(Tuple2.create("111", " Exonération de cotisations de retraite complémentaire applicable aux entreprises et associations d'aide à domicile"));
-
 
1369
        vCodeIndiv.add(Tuple2.create("112", " Exonération de cotisations patronales de retraite complémentaire applicable dans les DOM (LODEOM) SMIC 170% à 270%"));
-
 
1370
        vCodeIndiv.add(Tuple2.create("113", " Exonération de cotisations patronales de retraite complémentaire applicable dans les DOM (LODEOM) SMIC 170% à 350%"));
-
 
1371
        vCodeIndiv.add(Tuple2.create("114", " Montant de réduction des heures supplémentaires/complémentaires"));
-
 
1372
        vCodeIndiv.add(Tuple2.create("115", " Cotisation Assurance Maladie pour le Régime Local Alsace Moselle"));
-
 
1373
        vCodeIndiv.add(Tuple2.create("116", " Cotisation absente de la norme en cas de régularisation prud'homale"));
-
 
1374
        vCodeIndiv.add(Tuple2.create("128", " Contribution à la formation professionnelle (CFP)"));
-
 
1375
        vCodeIndiv.add(Tuple2.create("129", " Contribution dédiée au financement du Compte Professionnel de Formation pour les titulaires de CDD (CPFCDD)"));
-
 
1376
        vCodeIndiv.add(Tuple2.create("130", " Part principale de la taxe d'apprentissage"));
-
 
1377
        vCodeIndiv.add(Tuple2.create("131", " Cotisation régime unifié Agirc Arrco"));
-
 
1378
        vCodeIndiv.add(Tuple2.create("132", " Cotisation Apec"));
-
 
1379
        vCodeIndiv.add(Tuple2.create("133", " Contribution maladie spécifique Mayotte"));
-
 
1380
        vCodeIndiv.add(Tuple2.create("902", " Contribution à la formation professionnelle des Artisans assimilés salariés"));
-
 
1381
        vCodeIndiv.add(Tuple2.create("903", " Cotisation AFNCA"));
-
 
1382
        vCodeIndiv.add(Tuple2.create("904", " Cotisation ANEFA"));
-
 
1383
        vCodeIndiv.add(Tuple2.create("905", " Cotisation ASCPA"));
-
 
1384
        vCodeIndiv.add(Tuple2.create("906", " Cotisation PROVEA"));
-
 
1385
        vCodeIndiv.add(Tuple2.create("907", " Complément de cotisation Assurance Maladie"));
-
 
1386
        vCodeIndiv.add(Tuple2.create("908", " Taxe forfaitaire CDDU Assurance Chômage"));
-
 
1387
        vCodeIndiv.add(Tuple2.create("909", " Cotisation au titre du financement des régimes de retraites supplémentaires à prestation définies"));
-
 
1388
        vCodeIndiv.add(Tuple2.create("910", " Exonération de cotisations patronales pour les entreprises affectées par la crise sanitaire"));
-
 
1389
        vCodeIndiv.add(Tuple2.create("911", " Réduction de cotisations patronales pour les entreprises du secteur de la vigne affectées par la crise sanitaire"));
-
 
1390
        vCodeIndiv.add(Tuple2.create("912", " Exonération du forfait social à 10%"));
-
 
1391
        vCodeIndiv.add(Tuple2.create("913", " Potentielle nouvelle cotisation C"));
-
 
1392
        vCodeIndiv.add(Tuple2.create("914", " Potentielle nouvelle cotisation A"));
-
 
1393
        vCodeIndiv.add(Tuple2.create("915", " Potentielle nouvelle cotisation B"));
-
 
1394
 
1356
        insertValues(vCodeIndiv, tableCotInd);
1395
        insertValues(vCodeIndiv, tableCotInd);
1357
 
1396
 
1358
        final SQLTable tableCTP = root.getTable("CODE_CAISSE_TYPE_RUBRIQUE");
1397
        final SQLTable tableCTP = root.getTable("CODE_CAISSE_TYPE_RUBRIQUE");
1359
        List<Tuple2<String, String>> vCTP = new ArrayList<>();
1398
        List<Tuple2<String, String>> vCTP = new ArrayList<>();
1360
        vCTP.add(Tuple2.create("003", "Réduction cotisations salariale heures supplémentaires"));
1399
        vCTP.add(Tuple2.create("003", "Réduction cotisations salariale heures supplémentaires"));
1361
        vCTP.add(Tuple2.create("510", "Prime exceptionnelle de pouvoir d’achat"));
1400
        vCTP.add(Tuple2.create("510", "Prime exceptionnelle de pouvoir d’achat"));
1362
        vCTP.add(Tuple2.create("060", "RR Chômage CSG-CRDS taux plein"));
1401
        vCTP.add(Tuple2.create("060", "RR Chômage CSG-CRDS taux plein"));
-
 
1402
        vCTP.add(Tuple2.create("917", "MOBILITE ADD JOURNALISTE TX MINO 20%"));
-
 
1403
        vCTP.add(Tuple2.create("920", "EMPL AGRIC (1500 TONNES CANNE) RMI OM"));
-
 
1404
        vCTP.add(Tuple2.create("921", "MOBILITE ARTISTES TX MINORE 30%"));
-
 
1405
        vCTP.add(Tuple2.create("922", "ENTR.DE PRODUCTION D ELECTRICITE"));
-
 
1406
        vCTP.add(Tuple2.create("922", "ENTR.DE PRODUCTION D ELECTRICITE"));
-
 
1407
        vCTP.add(Tuple2.create("926", "AT SEULEMENT - GESTION TOTALE"));
-
 
1408
        vCTP.add(Tuple2.create("927", "MOBILITE ADD ARTISTES TX MINO 30%"));
-
 
1409
        vCTP.add(Tuple2.create("936", "CNIEG PRESTATION COMPL. INVALIDITE"));
-
 
1410
        vCTP.add(Tuple2.create("937", "COTISATIONS AGS CAS GENERAL U2"));
-
 
1411
        vCTP.add(Tuple2.create("938", "CONTRATS AIDES ATELIER INSERTION"));
-
 
1412
        vCTP.add(Tuple2.create("939", "ATELIER INSERTION MAYOTTE"));
-
 
1413
        vCTP.add(Tuple2.create("939", "ATELIER INSERTION MAYOTTE"));
-
 
1414
        vCTP.add(Tuple2.create("940", "CNIEG DROITS SPE. PASSES NON REGULES"));
-
 
1415
        vCTP.add(Tuple2.create("948", "CONTRAT EMPLOI SOLIDARITE"));
-
 
1416
        vCTP.add(Tuple2.create("950", "CONTRAT EMPLOI SOLIDARITE CAS PART"));
-
 
1417
        vCTP.add(Tuple2.create("951", "CONTRATS EMPLOI SOLIDARITE CAS PART"));
-
 
1418
        vCTP.add(Tuple2.create("952", "CONTRAT EMPLOI CONSOLIDE CAS GENERAL"));
-
 
1419
        vCTP.add(Tuple2.create("954", "CONTRAT EMPLOI CONSOLIDE CAS PART"));
-
 
1420
        vCTP.add(Tuple2.create("955", "CNIEG PETIT POOL"));
-
 
1421
        vCTP.add(Tuple2.create("959", "CFP ENTREPRISE < 11 SALARIES"));
-
 
1422
        vCTP.add(Tuple2.create("967", "CONTR.ROYALTIES ART.ET MANNEQUINS"));
-
 
1423
        vCTP.add(Tuple2.create("969", "COT.MAL.ROYALTIES ART.ETRANGER"));
-
 
1424
        vCTP.add(Tuple2.create("971", "CFP ENTREPRISE >= 11 SALARIES"));
-
 
1425
        vCTP.add(Tuple2.create("983", "CFP INTERMITTENTS DU SPECTACLE"));
-
 
1426
        vCTP.add(Tuple2.create("985", "PENALITE PENIBILITE"));
-
 
1427
        vCTP.add(Tuple2.create("987", "CONTRIBUTION CPF CDD "));
-
 
1428
        vCTP.add(Tuple2.create("992", "TA PRINCIPALE HORS ALSACE MOSELLE"));
-
 
1429
        vCTP.add(Tuple2.create("993", "TA ALSACE MOSELLE"));
-
 
1430
        vCTP.add(Tuple2.create("994", "TA DEDUCTION CFA ET OFFRE NOUVELLE"));
-
 
1431
        vCTP.add(Tuple2.create("995", "TA - SOLDE VERSEMENT LIBERATOIRE"));
-
 
1432
        vCTP.add(Tuple2.create("995", "TA - SOLDE VERSEMENT LIBERATOIRE"));
-
 
1433
        vCTP.add(Tuple2.create("996", "TA - DEDUCTION AU SOLDE CFA"));
-
 
1434
        vCTP.add(Tuple2.create("997", "TA - DEDUCTION SOLDE CREANCE ALTERN"));
-
 
1435
        vCTP.add(Tuple2.create("998", "CSA CONTRIBUTION ANNUELLE"));
1363
        insertValues(vCTP, tableCTP);
1436
        insertValues(vCTP, tableCTP);
1364
 
1437
 
1365
        final SQLTable tableTypeBrut = root.getTable("CODE_TYPE_RUBRIQUE_BRUT");
1438
        final SQLTable tableTypeBrut = root.getTable("CODE_TYPE_RUBRIQUE_BRUT");
1366
        List<Tuple3<String, String, String>> vbrutType = new ArrayList<>();
1439
        List<Tuple3<String, String, String>> vbrutType = new ArrayList<>();
1367
        vbrutType.add(Tuple3.create("016", "[FP] Heures affectées à un travail d’aide à domicile", DsnTypeCodeBrut.REMUNERATION.getName()));
1440
        vbrutType.add(Tuple3.create("016", "[FP] Heures affectées à un travail d’aide à domicile", DsnTypeCodeBrut.REMUNERATION.getName()));
1368
        vbrutType.add(Tuple3.create("017", "Heures supplémentaires ou complémentaires aléatoires", DsnTypeCodeBrut.REMUNERATION.getName()));
1441
        vbrutType.add(Tuple3.create("017", "Heures supplémentaires ou complémentaires aléatoires", DsnTypeCodeBrut.REMUNERATION.getName()));
1369
        vbrutType.add(Tuple3.create("018", "Heures supplémentaires structurelles", DsnTypeCodeBrut.REMUNERATION.getName()));
1442
        vbrutType.add(Tuple3.create("018", "Heures supplémentaires structurelles", DsnTypeCodeBrut.REMUNERATION.getName()));
1370
        vbrutType.add(Tuple3.create("019", "Heures d'activité partielle", DsnTypeCodeBrut.REMUNERATION.getName()));
1443
        vbrutType.add(Tuple3.create("019", "Heures d'activité partielle", DsnTypeCodeBrut.REMUNERATION.getName()));
1371
        vbrutType.add(Tuple3.create("020", "Heures affectées à un travail d’aide à domicile de publics fragiles", DsnTypeCodeBrut.REMUNERATION.getName()));
1444
        vbrutType.add(Tuple3.create("020", "Heures affectées à un travail d’aide à domicile de publics fragiles", DsnTypeCodeBrut.REMUNERATION.getName()));
-
 
1445
 
-
 
1446
        vbrutType.add(Tuple3.create("021", "[FP] Taux de rémunération de la situation administrative", DsnTypeCodeBrut.REMUNERATION.getName()));
-
 
1447
        vbrutType.add(Tuple3.create("022", "Potentiel nouveau type de rémunération B", DsnTypeCodeBrut.REMUNERATION.getName()));
-
 
1448
        vbrutType.add(Tuple3.create("023", "Potentiel nouveau type de rémunération C", DsnTypeCodeBrut.REMUNERATION.getName()));
-
 
1449
        vbrutType.add(Tuple3.create("025", "Heures correspondant à du chômage intempéries", DsnTypeCodeBrut.REMUNERATION.getName()));
-
 
1450
        vbrutType.add(Tuple3.create("026", "Heures supplémentaires exonérées", DsnTypeCodeBrut.REMUNERATION.getName()));
-
 
1451
        vbrutType.add(Tuple3.create("027", "Potentiel nouveau type de rémunération A", DsnTypeCodeBrut.REMUNERATION.getName()));
-
 
1452
 
1372
        DsnBrutCode dsnBurCode = new DsnBrutCode();
1453
        DsnBrutCode dsnBurCode = new DsnBrutCode();
1373
        dsnBurCode.updateTable(vbrutType, tableTypeBrut);
1454
        dsnBurCode.updateTable(vbrutType, tableTypeBrut);
1374
 
1455
 
-
 
1456
        // P21
-
 
1457
        final SQLTable tableArret = root.getTable("MOTIF_ARRET_TRAVAIL");
-
 
1458
        List<Tuple2<String, String>> vArret = new ArrayList<Tuple2<String, String>>();
-
 
1459
        vArret.add(Tuple2.create("09", "adoption"));
-
 
1460
        vArret.add(Tuple2.create("15", "temps partiel thérapeutique (risque maladie)"));
-
 
1461
        vArret.add(Tuple2.create("16", "temps partiel thérapeutique (risque accident de travail)"));
-
 
1462
        vArret.add(Tuple2.create("17", "temps partiel thérapeutique (risque accident de trajet)"));
-
 
1463
        vArret.add(Tuple2.create("18", "temps partiel thérapeutique (risque maladie professionnelle)"));
-
 
1464
        insertValues(vArret, tableArret);
-
 
1465
 
-
 
1466
        if (!root.contains("CODE_CAISSE_CONGES_PAYES")) {
-
 
1467
            final SQLCreateTable createTableCode = new SQLCreateTable(root, "CODE_CAISSE_CONGES_PAYES");
-
 
1468
            createTableCode.addVarCharColumn("CODE", 25);
-
 
1469
            createTableCode.addVarCharColumn("NOM", 512);
-
 
1470
 
-
 
1471
            try {
-
 
1472
                root.getBase().getDataSource().execute(createTableCode.asString());
-
 
1473
                insertUndef(createTableCode);
-
 
1474
                root.refetchTable("CODE_CAISSE_CONGES_PAYES");
-
 
1475
                root.getSchema().updateVersion();
-
 
1476
 
-
 
1477
            } catch (SQLException ex) {
-
 
1478
                throw new IllegalStateException("Erreur lors de la création de la table " + "CODE_CAISSE_CONGES_PAYES", ex);
-
 
1479
            }
-
 
1480
        }
-
 
1481
 
-
 
1482
        if (!root.contains("MOTIF_NON_ASSUJETIS_TA")) {
-
 
1483
            final SQLCreateTable createTableCode = new SQLCreateTable(root, "MOTIF_NON_ASSUJETIS_TA");
-
 
1484
            createTableCode.addVarCharColumn("CODE", 25);
-
 
1485
            createTableCode.addVarCharColumn("NOM", 512);
-
 
1486
 
-
 
1487
            try {
-
 
1488
                root.getBase().getDataSource().execute(createTableCode.asString());
-
 
1489
                insertUndef(createTableCode);
-
 
1490
                root.refetchTable("MOTIF_NON_ASSUJETIS_TA");
-
 
1491
                root.getSchema().updateVersion();
-
 
1492
 
-
 
1493
                final SQLTable tableMotif = root.getTable("MOTIF_NON_ASSUJETIS_TA");
-
 
1494
                List<Tuple2<String, String>> vMotif = new ArrayList<Tuple2<String, String>>();
-
 
1495
                vMotif.add(Tuple2.create("001", "Non assujetti par choix du régime fiscal (option IR en catégorie BNC)"));
-
 
1496
                vMotif.add(Tuple2.create("002", "Collectivités publiques"));
-
 
1497
                vMotif.add(Tuple2.create("003", "Etablissements publics de recherche et les établissements publics d'enseignement supérieurs"));
-
 
1498
                vMotif.add(Tuple2.create("004", "Personnes morales créées pour la gestion d'un pôle de recherche et d'enseignement supérieur ou d'un réseau thématique de recherche avancée"));
-
 
1499
                vMotif.add(Tuple2.create("005", "Fondations reconnues d'utilité public du secteur de la recherche"));
-
 
1500
                vMotif.add(Tuple2.create("006", "Sociétés et personnes morales ayant pour objet exclusif l'enseignement"));
-
 
1501
                vMotif.add(Tuple2.create("007", "Associations sans but lucratif"));
-
 
1502
                vMotif.add(Tuple2.create("008", "Syndicats professionnels"));
-
 
1503
                vMotif.add(Tuple2.create("009", "Entreprises sans établissement en France (ESEF)"));
-
 
1504
                vMotif.add(Tuple2.create("010", "Sociétés civiles de moyens (SCM) non commerciale"));
-
 
1505
                vMotif.add(Tuple2.create("011", "Personnes physiques ou morales assujetties aux BNC ou BA"));
-
 
1506
                vMotif.add(Tuple2.create("012", "Les coopératives agricoles"));
-
 
1507
                vMotif.add(Tuple2.create("013", "Les coopératives artisanales, transport (y compris fluvial et maritime) et leurs unions"));
-
 
1508
                vMotif.add(Tuple2.create("014", "Les groupements d'employeurs dont agricoles"));
-
 
1509
                vMotif.add(Tuple2.create("015", "Les sociétés civiles agricoles"));
-
 
1510
                vMotif.add(Tuple2.create("016", "Les mutuelles et organismes mutualistes"));
-
 
1511
                vMotif.add(Tuple2.create("017",
-
 
1512
                        "Les organismes HLM, SA de crédit immobilier (I et au II de l'article L. 422-4 du code de la construction et de l'habitation ) et unions d'économie sociale"));
-
 
1513
                vMotif.add(Tuple2.create("018", "Les sociétés coopératives de construction désignées à l'article L. 432-2 du code de la construction et de l'habitation."));
-
 
1514
                vMotif.add(Tuple2.create("019", "Organismes chargés de l'organisation en France d'une compétition sportive internationale en France (Article L6131-1 du code du travail)"));
-
 
1515
 
-
 
1516
                insertValues(vMotif, tableMotif);
-
 
1517
            } catch (SQLException ex) {
-
 
1518
                throw new IllegalStateException("Erreur lors de la création de la table " + "MOTIF_NON_ASSUJETIS_TA", ex);
-
 
1519
            }
-
 
1520
        }
-
 
1521
        if (!societeCommonT.contains("ASSUJETTISSEMENT_TA")) {
-
 
1522
            AlterTable alterSoc = new AlterTable(societeCommonT);
-
 
1523
            alterSoc.addBooleanColumn("ASSUJETTISSEMENT_TA", Boolean.TRUE, false);
-
 
1524
            alterSoc.addBooleanColumn("ASSUJETTISSEMENT_CFP", Boolean.TRUE, false);
-
 
1525
            alterSoc.addBooleanColumn("ASSUJETTISSEMENT_CFP_CDD", Boolean.TRUE, false);
-
 
1526
            alterSoc.addForeignColumn("ID_MOTIF_NON_ASSUJETIS_TA", root.findTable("MOTIF_NON_ASSUJETIS_TA"));
-
 
1527
 
-
 
1528
            root.getBase().getDataSource().execute(alterSoc.asString());
-
 
1529
            root.getSchema().updateVersion();
-
 
1530
        }
1375
    }
1531
    }
1376
 
1532
 
1377
    public void updateDSN(final DBRoot root) throws SQLException {
1533
    public void updateDSN(final DBRoot root) throws SQLException {
1378
        final SQLTable tableCodeStatutCat = root.getTable("CODE_STATUT_CATEGORIEL");
1534
        final SQLTable tableCodeStatutCat = root.getTable("CODE_STATUT_CATEGORIEL");
1379
        SQLRow rowNonCadre = tableCodeStatutCat.getRow(4);
1535
        SQLRow rowNonCadre = tableCodeStatutCat.getRow(4);
1380
        if (rowNonCadre != null) {
1536
        if (rowNonCadre != null) {
1381
            rowNonCadre.createEmptyUpdateRow().put("CODE", "04").commit();
1537
            rowNonCadre.createEmptyUpdateRow().put("CODE", "04").commit();
1382
        }
1538
        }
1383
        SQLRow rowSansStatut = tableCodeStatutCat.getRow(4);
1539
        SQLRow rowSansStatut = tableCodeStatutCat.getRow(4);
1384
        if (rowSansStatut != null) {
1540
        if (rowSansStatut != null) {
1385
            rowSansStatut.createEmptyUpdateRow().put("CODE", "99").commit();
1541
            rowSansStatut.createEmptyUpdateRow().put("CODE", "99").commit();
1386
        }
1542
        }
1387
        // 04 non cadre
1543
        // 04 non cadre
1388
        UpdateBuilder up04 = new UpdateBuilder(tableCodeStatutCat);
1544
        UpdateBuilder up04 = new UpdateBuilder(tableCodeStatutCat);
1389
        up04.setObject("NOM", "Non cadre");
1545
        up04.setObject("NOM", "Non cadre");
1390
        up04.setWhere(new Where(tableCodeStatutCat.getField("CODE"), "=", "04"));
1546
        up04.setWhere(new Where(tableCodeStatutCat.getField("CODE"), "=", "04"));
1391
        root.getBase().getDataSource().execute(up04.asString());
1547
        root.getBase().getDataSource().execute(up04.asString());
1392
 
1548
 
1393
        // 99 - pas de retraite complémentaire
1549
        // 99 - pas de retraite complémentaire
1394
        UpdateBuilder up99 = new UpdateBuilder(tableCodeStatutCat);
1550
        UpdateBuilder up99 = new UpdateBuilder(tableCodeStatutCat);
1395
        up99.setObject("NOM", "Pas de retraite complémentaire");
1551
        up99.setObject("NOM", "Pas de retraite complémentaire");
1396
        up99.setWhere(new Where(tableCodeStatutCat.getField("CODE"), "=", "99"));
1552
        up99.setWhere(new Where(tableCodeStatutCat.getField("CODE"), "=", "99"));
1397
        root.getBase().getDataSource().execute(up99.asString());
1553
        root.getBase().getDataSource().execute(up99.asString());
1398
 
1554
 
1399
        if (!root.contains("ARRET_TRAVAIL")) {
1555
        if (!root.contains("ARRET_TRAVAIL")) {
1400
 
1556
 
1401
            final SQLCreateTable createTable = new SQLCreateTable(root, "ARRET_TRAVAIL");
1557
            final SQLCreateTable createTable = new SQLCreateTable(root, "ARRET_TRAVAIL");
1402
            createTable.addForeignColumn("SALARIE");
1558
            createTable.addForeignColumn("SALARIE");
1403
            createTable.addDateAndTimeColumn("DATE_DERNIER_JOUR_TRAV");
1559
            createTable.addDateAndTimeColumn("DATE_DERNIER_JOUR_TRAV");
1404
            createTable.addDateAndTimeColumn("DATE_FIN_PREV");
1560
            createTable.addDateAndTimeColumn("DATE_FIN_PREV");
1405
            createTable.addBooleanColumn("SUBROGATION", Boolean.FALSE, false);
1561
            createTable.addBooleanColumn("SUBROGATION", Boolean.FALSE, false);
1406
            createTable.addDateAndTimeColumn("DATE_DEBUT_SUBROGATION");
1562
            createTable.addDateAndTimeColumn("DATE_DEBUT_SUBROGATION");
1407
            createTable.addDateAndTimeColumn("DATE_FIN_SUBROGATION");
1563
            createTable.addDateAndTimeColumn("DATE_FIN_SUBROGATION");
1408
            createTable.addForeignColumn("ID_MOTIF_ARRET_TRAVAIL", root.findTable("MOTIF_ARRET_TRAVAIL"));
1564
            createTable.addForeignColumn("ID_MOTIF_ARRET_TRAVAIL", root.findTable("MOTIF_ARRET_TRAVAIL"));
1409
            createTable.addForeignColumn("ID_MOTIF_REPRISE_ARRET_TRAVAIL", root.findTable("MOTIF_REPRISE_ARRET_TRAVAIL"));
1565
            createTable.addForeignColumn("ID_MOTIF_REPRISE_ARRET_TRAVAIL", root.findTable("MOTIF_REPRISE_ARRET_TRAVAIL"));
1410
            createTable.addDateAndTimeColumn("DATE_REPRISE");
1566
            createTable.addDateAndTimeColumn("DATE_REPRISE");
1411
            createTable.addDateAndTimeColumn("DATE_ACCIDENT");
1567
            createTable.addDateAndTimeColumn("DATE_ACCIDENT");
1412
 
1568
 
1413
            try {
1569
            try {
1414
                root.getBase().getDataSource().execute(createTable.asString());
1570
                root.getBase().getDataSource().execute(createTable.asString());
1415
                insertUndef(createTable);
1571
                insertUndef(createTable);
1416
                root.refetchTable("ARRET_TRAVAIL");
1572
                root.refetchTable("ARRET_TRAVAIL");
1417
                root.getSchema().updateVersion();
1573
                root.getSchema().updateVersion();
1418
            } catch (SQLException ex) {
1574
            } catch (SQLException ex) {
1419
                throw new IllegalStateException("Erreur lors de la création de la table " + "ARRET_TRAVAIL", ex);
1575
                throw new IllegalStateException("Erreur lors de la création de la table " + "ARRET_TRAVAIL", ex);
1420
            }
1576
            }
1421
        }
1577
        }
1422
 
1578
 
1423
        if (!root.contains("FIN_CONTRAT")) {
1579
        if (!root.contains("FIN_CONTRAT")) {
1424
 
1580
 
1425
            final SQLCreateTable createTable = new SQLCreateTable(root, "FIN_CONTRAT");
1581
            final SQLCreateTable createTable = new SQLCreateTable(root, "FIN_CONTRAT");
1426
            createTable.addForeignColumn("FICHE_PAYE");
1582
            createTable.addForeignColumn("FICHE_PAYE");
1427
            createTable.addForeignColumn("ID_MOTIF_FIN_CONTRAT", root.findTable("MOTIF_FIN_CONTRAT"));
1583
            createTable.addForeignColumn("ID_MOTIF_FIN_CONTRAT", root.findTable("MOTIF_FIN_CONTRAT"));
1428
            createTable.addDateAndTimeColumn("DATE_FIN");
1584
            createTable.addDateAndTimeColumn("DATE_FIN");
1429
            createTable.addDateAndTimeColumn("DATE_NOTIFICATION");
1585
            createTable.addDateAndTimeColumn("DATE_NOTIFICATION");
1430
            createTable.addDateAndTimeColumn("DATE_SIGNATURE_CONVENTION");
1586
            createTable.addDateAndTimeColumn("DATE_SIGNATURE_CONVENTION");
1431
            createTable.addDateAndTimeColumn("DATE_ENGAGEMENT_PROCEDURE");
1587
            createTable.addDateAndTimeColumn("DATE_ENGAGEMENT_PROCEDURE");
1432
            createTable.addDateAndTimeColumn("DERNIER_JOUR_TRAV_PAYE");
1588
            createTable.addDateAndTimeColumn("DERNIER_JOUR_TRAV_PAYE");
1433
            createTable.addBooleanColumn("TRANSACTION_EN_COURS", Boolean.FALSE, false);
1589
            createTable.addBooleanColumn("TRANSACTION_EN_COURS", Boolean.FALSE, false);
1434
            createTable.addBooleanColumn("PORTABILITE_PREVOYANCE", Boolean.FALSE, false);
1590
            createTable.addBooleanColumn("PORTABILITE_PREVOYANCE", Boolean.FALSE, false);
1435
            createTable.addIntegerColumn("NB_DIF_RESTANT", null, true);
1591
            createTable.addIntegerColumn("NB_DIF_RESTANT", null, true);
1436
            createTable.addIntegerColumn("NB_MOIS_CSP", null, true);
1592
            createTable.addIntegerColumn("NB_MOIS_CSP", null, true);
1437
            createTable.addDecimalColumn("SALAIRE_NET_HORAIRE", 16, 8, null, true);
1593
            createTable.addDecimalColumn("SALAIRE_NET_HORAIRE", 16, 8, null, true);
1438
            createTable.addDecimalColumn("INDEMNITE_VERSE", 16, 8, null, true);
1594
            createTable.addDecimalColumn("INDEMNITE_VERSE", 16, 8, null, true);
1439
            createTable.addForeignColumn("ID_TYPE_PREAVIS", root.findTable("TYPE_PREAVIS"));
1595
            createTable.addForeignColumn("ID_TYPE_PREAVIS", root.findTable("TYPE_PREAVIS"));
1440
            createTable.addDateAndTimeColumn("DATE_DEBUT_PREAVIS");
1596
            createTable.addDateAndTimeColumn("DATE_DEBUT_PREAVIS");
1441
            createTable.addDateAndTimeColumn("DATE_FIN_PREAVIS");
1597
            createTable.addDateAndTimeColumn("DATE_FIN_PREAVIS");
1442
            createTable.addVarCharColumn("INFOS", 2048);
1598
            createTable.addVarCharColumn("INFOS", 2048);
1443
 
1599
 
1444
            try {
1600
            try {
1445
                root.getBase().getDataSource().execute(createTable.asString());
1601
                root.getBase().getDataSource().execute(createTable.asString());
1446
                insertUndef(createTable);
1602
                insertUndef(createTable);
1447
                root.refetchTable("FIN_CONTRAT");
1603
                root.refetchTable("FIN_CONTRAT");
1448
                root.getSchema().updateVersion();
1604
                root.getSchema().updateVersion();
1449
            } catch (SQLException ex) {
1605
            } catch (SQLException ex) {
1450
                throw new IllegalStateException("Erreur lors de la création de la table " + "FIN_CONTRAT", ex);
1606
                throw new IllegalStateException("Erreur lors de la création de la table " + "FIN_CONTRAT", ex);
1451
            }
1607
            }
1452
        }
1608
        }
1453
 
1609
 
1454
        if (!root.contains("REPRISE_TRAVAIL")) {
1610
        if (!root.contains("REPRISE_TRAVAIL")) {
1455
 
1611
 
1456
            final SQLCreateTable createTable = new SQLCreateTable(root, "REPRISE_TRAVAIL");
1612
            final SQLCreateTable createTable = new SQLCreateTable(root, "REPRISE_TRAVAIL");
1457
            createTable.addForeignColumn("SALARIE");
1613
            createTable.addForeignColumn("SALARIE");
1458
            createTable.addDateAndTimeColumn("DATE_DERNIER_JOUR_TRAV");
1614
            createTable.addDateAndTimeColumn("DATE_DERNIER_JOUR_TRAV");
1459
            createTable.addDateAndTimeColumn("DATE_FIN_PREV");
1615
            createTable.addDateAndTimeColumn("DATE_FIN_PREV");
1460
            createTable.addBooleanColumn("SUBROGATION", Boolean.FALSE, false);
1616
            createTable.addBooleanColumn("SUBROGATION", Boolean.FALSE, false);
1461
            createTable.addDateAndTimeColumn("DATE_DEBUT_SUBROGATION");
1617
            createTable.addDateAndTimeColumn("DATE_DEBUT_SUBROGATION");
1462
            createTable.addDateAndTimeColumn("DATE_FIN_SUBROGATION");
1618
            createTable.addDateAndTimeColumn("DATE_FIN_SUBROGATION");
1463
            createTable.addForeignColumn("ID_MOTIF_ARRET_TRAVAIL", root.findTable("MOTIF_ARRET_TRAVAIL"));
1619
            createTable.addForeignColumn("ID_MOTIF_ARRET_TRAVAIL", root.findTable("MOTIF_ARRET_TRAVAIL"));
1464
            createTable.addForeignColumn("ID_MOTIF_REPRISE_ARRET_TRAVAIL", root.findTable("MOTIF_REPRISE_ARRET_TRAVAIL"));
1620
            createTable.addForeignColumn("ID_MOTIF_REPRISE_ARRET_TRAVAIL", root.findTable("MOTIF_REPRISE_ARRET_TRAVAIL"));
1465
            createTable.addDateAndTimeColumn("DATE_REPRISE");
1621
            createTable.addDateAndTimeColumn("DATE_REPRISE");
1466
            createTable.addDateAndTimeColumn("DATE_ACCIDENT");
1622
            createTable.addDateAndTimeColumn("DATE_ACCIDENT");
1467
            createTable.addDateAndTimeColumn("DATE");
1623
            createTable.addDateAndTimeColumn("DATE");
1468
            createTable.addVarCharColumn("COMMENTAIRES", 2048);
1624
            createTable.addVarCharColumn("COMMENTAIRES", 2048);
1469
 
1625
 
1470
            try {
1626
            try {
1471
                root.getBase().getDataSource().execute(createTable.asString());
1627
                root.getBase().getDataSource().execute(createTable.asString());
1472
                insertUndef(createTable);
1628
                insertUndef(createTable);
1473
                root.refetchTable("REPRISE_TRAVAIL");
1629
                root.refetchTable("REPRISE_TRAVAIL");
1474
                root.getSchema().updateVersion();
1630
                root.getSchema().updateVersion();
1475
            } catch (SQLException ex) {
1631
            } catch (SQLException ex) {
1476
                throw new IllegalStateException("Erreur lors de la création de la table " + "REPRISE_TRAVAIL", ex);
1632
                throw new IllegalStateException("Erreur lors de la création de la table " + "REPRISE_TRAVAIL", ex);
1477
            }
1633
            }
1478
        }
1634
        }
1479
 
1635
 
1480
        if (!root.contains("DECLARATION_DSN")) {
1636
        if (!root.contains("DECLARATION_DSN")) {
1481
 
1637
 
1482
            final SQLCreateTable createTable = new SQLCreateTable(root, "DECLARATION_DSN");
1638
            final SQLCreateTable createTable = new SQLCreateTable(root, "DECLARATION_DSN");
1483
            createTable.addForeignColumn("ID_DSN_NATURE", root.findTable("DSN_NATURE"));
1639
            createTable.addForeignColumn("ID_DSN_NATURE", root.findTable("DSN_NATURE"));
1484
 
1640
 
1485
            createTable.addDateAndTimeColumn("DATE");
1641
            createTable.addDateAndTimeColumn("DATE");
1486
            createTable.addDateAndTimeColumn("DATE_ENVOI");
1642
            createTable.addDateAndTimeColumn("DATE_ENVOI");
1487
            createTable.addBooleanColumn("TEST", Boolean.FALSE, false);
1643
            createTable.addBooleanColumn("TEST", Boolean.FALSE, false);
1488
            createTable.addBooleanColumn("ENVOYE", Boolean.FALSE, false);
1644
            createTable.addBooleanColumn("ENVOYE", Boolean.FALSE, false);
1489
            createTable.addVarCharColumn("COMMENTAIRE", 1024);
1645
            createTable.addVarCharColumn("COMMENTAIRE", 1024);
1490
            createTable.addVarCharColumn("DSN_FILE", 75000);
1646
            createTable.addVarCharColumn("DSN_FILE", 75000);
1491
            createTable.addIntegerColumn("NUMERO", 1);
1647
            createTable.addIntegerColumn("NUMERO", 1);
1492
            createTable.addIntegerColumn("ANNEE", 2016);
1648
            createTable.addIntegerColumn("ANNEE", 2016);
1493
            createTable.addForeignColumn("MOIS");
1649
            createTable.addForeignColumn("MOIS");
1494
 
1650
 
1495
            try {
1651
            try {
1496
                root.getBase().getDataSource().execute(createTable.asString());
1652
                root.getBase().getDataSource().execute(createTable.asString());
1497
                insertUndef(createTable);
1653
                insertUndef(createTable);
1498
                root.refetchTable("DECLARATION_DSN");
1654
                root.refetchTable("DECLARATION_DSN");
1499
                root.getSchema().updateVersion();
1655
                root.getSchema().updateVersion();
1500
            } catch (SQLException ex) {
1656
            } catch (SQLException ex) {
1501
                throw new IllegalStateException("Erreur lors de la création de la table " + "DECLARATION_DSN", ex);
1657
                throw new IllegalStateException("Erreur lors de la création de la table " + "DECLARATION_DSN", ex);
1502
            }
1658
            }
1503
        }
1659
        }
1504
 
1660
 
1505
        SQLTable tableArret = root.getTable("ARRET_TRAVAIL");
1661
        SQLTable tableArret = root.getTable("ARRET_TRAVAIL");
1506
        if (!tableArret.contains("DATE")) {
1662
        if (!tableArret.contains("DATE")) {
1507
            AlterTable alter = new AlterTable(tableArret);
1663
            AlterTable alter = new AlterTable(tableArret);
1508
            alter.addDateAndTimeColumn("DATE");
1664
            alter.addDateAndTimeColumn("DATE");
1509
            alter.addVarCharColumn("COMMENTAIRES", 2048);
1665
            alter.addVarCharColumn("COMMENTAIRES", 2048);
1510
            root.getBase().getDataSource().execute(alter.asString());
1666
            root.getBase().getDataSource().execute(alter.asString());
1511
            root.refetchTable("ARRET_TRAVAIL");
1667
            root.refetchTable("ARRET_TRAVAIL");
1512
            root.getSchema().updateVersion();
1668
            root.getSchema().updateVersion();
1513
        }
1669
        }
1514
 
1670
 
1515
        SQLTable tableDsn = root.getTable("DECLARATION_DSN");
1671
        SQLTable tableDsn = root.getTable("DECLARATION_DSN");
1516
        if (!tableDsn.contains("ID_ARRET_TRAVAIL")) {
1672
        if (!tableDsn.contains("ID_ARRET_TRAVAIL")) {
1517
            AlterTable alter = new AlterTable(tableDsn);
1673
            AlterTable alter = new AlterTable(tableDsn);
1518
            alter.addForeignColumn("ID_ARRET_TRAVAIL", root.findTable("ARRET_TRAVAIL"));
1674
            alter.addForeignColumn("ID_ARRET_TRAVAIL", root.findTable("ARRET_TRAVAIL"));
1519
            root.getBase().getDataSource().execute(alter.asString());
1675
            root.getBase().getDataSource().execute(alter.asString());
1520
            root.getSchema().updateVersion();
1676
            root.getSchema().updateVersion();
1521
        }
1677
        }
1522
        if (!tableDsn.contains("ID_FIN_CONTRAT")) {
1678
        if (!tableDsn.contains("ID_FIN_CONTRAT")) {
1523
            AlterTable alter = new AlterTable(tableDsn);
1679
            AlterTable alter = new AlterTable(tableDsn);
1524
            alter.addForeignColumn("ID_FIN_CONTRAT", root.findTable("FIN_CONTRAT"));
1680
            alter.addForeignColumn("ID_FIN_CONTRAT", root.findTable("FIN_CONTRAT"));
1525
            root.getBase().getDataSource().execute(alter.asString());
1681
            root.getBase().getDataSource().execute(alter.asString());
1526
            root.getSchema().updateVersion();
1682
            root.getSchema().updateVersion();
1527
        }
1683
        }
1528
 
1684
 
1529
        if (!tableDsn.contains("ID_REPRISE_TRAVAIL")) {
1685
        if (!tableDsn.contains("ID_REPRISE_TRAVAIL")) {
1530
            AlterTable alter = new AlterTable(tableDsn);
1686
            AlterTable alter = new AlterTable(tableDsn);
1531
            alter.addForeignColumn("ID_REPRISE_TRAVAIL", root.findTable("REPRISE_TRAVAIL"));
1687
            alter.addForeignColumn("ID_REPRISE_TRAVAIL", root.findTable("REPRISE_TRAVAIL"));
1532
            root.getBase().getDataSource().execute(alter.asString());
1688
            root.getBase().getDataSource().execute(alter.asString());
1533
            root.getSchema().updateVersion();
1689
            root.getSchema().updateVersion();
1534
        }
1690
        }
1535
        if (!tableDsn.contains("ID_MOIS_REGUL")) {
1691
        if (!tableDsn.contains("ID_MOIS_REGUL")) {
1536
            AlterTable alter = new AlterTable(tableDsn);
1692
            AlterTable alter = new AlterTable(tableDsn);
1537
            alter.addForeignColumn("ID_MOIS_REGUL", root.findTable("MOIS"));
1693
            alter.addForeignColumn("ID_MOIS_REGUL", root.findTable("MOIS"));
1538
            root.getBase().getDataSource().execute(alter.asString());
1694
            root.getBase().getDataSource().execute(alter.asString());
1539
            root.getSchema().updateVersion();
1695
            root.getSchema().updateVersion();
1540
        }
1696
        }
1541
 
1697
 
1542
        if (!tableDsn.contains("ANNULE_REMPLACE")) {
1698
        if (!tableDsn.contains("ANNULE_REMPLACE")) {
1543
            AlterTable alter = new AlterTable(tableDsn);
1699
            AlterTable alter = new AlterTable(tableDsn);
1544
            alter.addBooleanColumn("ANNULE_REMPLACE", Boolean.FALSE, false);
1700
            alter.addBooleanColumn("ANNULE_REMPLACE", Boolean.FALSE, false);
1545
            root.getBase().getDataSource().execute(alter.asString());
1701
            root.getBase().getDataSource().execute(alter.asString());
1546
            root.getSchema().updateVersion();
1702
            root.getSchema().updateVersion();
1547
        }
1703
        }
1548
        if (!tableDsn.contains("NUMERO_REFERENCE")) {
1704
        if (!tableDsn.contains("NUMERO_REFERENCE")) {
1549
            AlterTable alter = new AlterTable(tableDsn);
1705
            AlterTable alter = new AlterTable(tableDsn);
1550
            alter.addVarCharColumn("NUMERO_REFERENCE", 256);
1706
            alter.addVarCharColumn("NUMERO_REFERENCE", 256);
1551
            root.getBase().getDataSource().execute(alter.asString());
1707
            root.getBase().getDataSource().execute(alter.asString());
1552
            root.getSchema().updateVersion();
1708
            root.getSchema().updateVersion();
1553
        }
1709
        }
1554
        if (!tableDsn.contains("ID_DECLARATION_DSN_ANNULATION")) {
1710
        if (!tableDsn.contains("ID_DECLARATION_DSN_ANNULATION")) {
1555
            AlterTable alter = new AlterTable(tableDsn);
1711
            AlterTable alter = new AlterTable(tableDsn);
1556
            alter.addForeignColumn("ID_DECLARATION_DSN_ANNULATION", tableDsn);
1712
            alter.addForeignColumn("ID_DECLARATION_DSN_ANNULATION", tableDsn);
1557
            root.getBase().getDataSource().execute(alter.asString());
1713
            root.getBase().getDataSource().execute(alter.asString());
1558
            root.getSchema().updateVersion();
1714
            root.getSchema().updateVersion();
1559
        }
1715
        }
1560
        if (!tableDsn.contains("EFFECTIF_CVAE")) {
1716
        if (!tableDsn.contains("EFFECTIF_CVAE")) {
1561
            AlterTable alter = new AlterTable(tableDsn);
1717
            AlterTable alter = new AlterTable(tableDsn);
1562
            alter.addIntegerColumn("EFFECTIF_CVAE", null, true);
1718
            alter.addIntegerColumn("EFFECTIF_CVAE", null, true);
1563
            alter.addVarCharColumn("CODE_INSEE_CVAE", 32);
1719
            alter.addVarCharColumn("CODE_INSEE_CVAE", 32);
1564
            root.getBase().getDataSource().execute(alter.asString());
1720
            root.getBase().getDataSource().execute(alter.asString());
1565
            root.getSchema().updateVersion();
1721
            root.getSchema().updateVersion();
1566
            root.refetchTable(tableDsn.getName());
1722
            root.refetchTable(tableDsn.getName());
1567
        }
1723
        }
1568
 
1724
 
1569
        if (!tableDsn.contains("PERIODE_CVAE_DEBUT")) {
1725
        if (!tableDsn.contains("PERIODE_CVAE_DEBUT")) {
1570
            AlterTable alter = new AlterTable(tableDsn);
1726
            AlterTable alter = new AlterTable(tableDsn);
1571
            alter.addColumn("PERIODE_CVAE_DEBUT", "date");
1727
            alter.addColumn("PERIODE_CVAE_DEBUT", "date");
1572
            alter.addColumn("PERIODE_CVAE_FIN", "date");
1728
            alter.addColumn("PERIODE_CVAE_FIN", "date");
1573
            root.getBase().getDataSource().execute(alter.asString());
1729
            root.getBase().getDataSource().execute(alter.asString());
1574
            root.getSchema().updateVersion();
1730
            root.getSchema().updateVersion();
1575
        }
1731
        }
1576
 
1732
 
1577
        // if (!root.contains("FIN_CONTRAT")) {
1733
        // if (!root.contains("FIN_CONTRAT")) {
1578
        //
1734
        //
1579
        // final SQLCreateTable createTable = new SQLCreateTable(root, "FIN_CONTRAT");
1735
        // final SQLCreateTable createTable = new SQLCreateTable(root, "FIN_CONTRAT");
1580
        // createTable.addForeignColumn("SALARIE");
1736
        // createTable.addForeignColumn("SALARIE");
1581
        // createTable.addDateAndTimeColumn("DATE_FIN");
1737
        // createTable.addDateAndTimeColumn("DATE_FIN");
1582
        // createTable.addDateAndTimeColumn("DATE_FIN_PREV");
1738
        // createTable.addDateAndTimeColumn("DATE_FIN_PREV");
1583
        // createTable.addBooleanColumn("SUBROGATION", Boolean.FALSE, false);
1739
        // createTable.addBooleanColumn("SUBROGATION", Boolean.FALSE, false);
1584
        // createTable.addDateAndTimeColumn("DATE_DEBUT_SUBROGATION");
1740
        // createTable.addDateAndTimeColumn("DATE_DEBUT_SUBROGATION");
1585
        // createTable.addDateAndTimeColumn("DATE_FIN_SUBROGATION");
1741
        // createTable.addDateAndTimeColumn("DATE_FIN_SUBROGATION");
1586
        // createTable.addForeignColumn("ID_MOTIF_ARRET_TRAVAIL",
1742
        // createTable.addForeignColumn("ID_MOTIF_ARRET_TRAVAIL",
1587
        // root.findTable("MOTIF_ARRET_TRAVAIL"));
1743
        // root.findTable("MOTIF_ARRET_TRAVAIL"));
1588
        // createTable.addForeignColumn("ID_MOTIF_REPRISE_ARRET_TRAVAIL",
1744
        // createTable.addForeignColumn("ID_MOTIF_REPRISE_ARRET_TRAVAIL",
1589
        // root.findTable("MOTIF_REPRISE_ARRET_TRAVAIL"));
1745
        // root.findTable("MOTIF_REPRISE_ARRET_TRAVAIL"));
1590
        // createTable.addDateAndTimeColumn("DATE_REPRISE");
1746
        // createTable.addDateAndTimeColumn("DATE_REPRISE");
1591
        // createTable.addDateAndTimeColumn("DATE_ACCIDENT");
1747
        // createTable.addDateAndTimeColumn("DATE_ACCIDENT");
1592
        //
1748
        //
1593
        // try {
1749
        // try {
1594
        // root.getBase().getDataSource().execute(createTable.asString());
1750
        // root.getBase().getDataSource().execute(createTable.asString());
1595
        // insertUndef(createTable);
1751
        // insertUndef(createTable);
1596
        // root.refetchTable("FIN_CONTRAT");
1752
        // root.refetchTable("FIN_CONTRAT");
1597
        // root.getSchema().updateVersion();
1753
        // root.getSchema().updateVersion();
1598
        // } catch (SQLException ex) {
1754
        // } catch (SQLException ex) {
1599
        // throw new IllegalStateException("Erreur lors de la création de la table " +
1755
        // throw new IllegalStateException("Erreur lors de la création de la table " +
1600
        // "FIN_CONTRAT", ex);
1756
        // "FIN_CONTRAT", ex);
1601
        // }
1757
        // }
1602
        // }
1758
        // }
1603
 
1759
 
1604
        SQLTable tableContrat = root.getTable("CONTRAT_SALARIE");
1760
        SQLTable tableContrat = root.getTable("CONTRAT_SALARIE");
1605
        if (!tableContrat.contains("NUMERO")) {
1761
        if (!tableContrat.contains("NUMERO")) {
1606
            AlterTable alter = new AlterTable(tableContrat);
1762
            AlterTable alter = new AlterTable(tableContrat);
1607
            alter.addColumn("NUMERO", "varchar(" + 128 + ") default '00000' NOT NULL");
1763
            alter.addColumn("NUMERO", "varchar(" + 128 + ") default '00000' NOT NULL");
1608
            root.getBase().getDataSource().execute(alter.asString());
1764
            root.getBase().getDataSource().execute(alter.asString());
1609
            root.getSchema().updateVersion();
1765
            root.getSchema().updateVersion();
1610
        }
1766
        }
1611
 
1767
 
1612
        if (!tableContrat.contains("CODE_REGIME_RETRAITE_DSN")) {
1768
        if (!tableContrat.contains("CODE_REGIME_RETRAITE_DSN")) {
1613
            AlterTable alter = new AlterTable(tableContrat);
1769
            AlterTable alter = new AlterTable(tableContrat);
1614
            alter.addColumn("CODE_REGIME_RETRAITE_DSN", "varchar(" + 128 + ") default '00000' NOT NULL");
1770
            alter.addColumn("CODE_REGIME_RETRAITE_DSN", "varchar(" + 128 + ") default '00000' NOT NULL");
1615
            root.getBase().getDataSource().execute(alter.asString());
1771
            root.getBase().getDataSource().execute(alter.asString());
1616
            root.getSchema().updateVersion();
1772
            root.getSchema().updateVersion();
1617
        }
1773
        }
1618
 
1774
 
1619
        if (!tableContrat.contains("DATE_PREV_FIN")) {
1775
        if (!tableContrat.contains("DATE_PREV_FIN")) {
1620
            AlterTable alter = new AlterTable(tableContrat);
1776
            AlterTable alter = new AlterTable(tableContrat);
1621
            alter.addDateAndTimeColumn("DATE_PREV_FIN");
1777
            alter.addDateAndTimeColumn("DATE_PREV_FIN");
1622
            root.getBase().getDataSource().execute(alter.asString());
1778
            root.getBase().getDataSource().execute(alter.asString());
1623
            root.getSchema().updateVersion();
1779
            root.getSchema().updateVersion();
1624
        }
1780
        }
1625
 
1781
 
1626
        boolean updateContrat = false;
1782
        boolean updateContrat = false;
1627
        if (!tableContrat.contains("ID_CONTRAT_MODALITE_TEMPS")) {
1783
        if (!tableContrat.contains("ID_CONTRAT_MODALITE_TEMPS")) {
1628
            updateContrat = true;
1784
            updateContrat = true;
1629
            AlterTable alter = new AlterTable(tableContrat);
1785
            AlterTable alter = new AlterTable(tableContrat);
1630
            alter.addForeignColumn("ID_CONTRAT_MODALITE_TEMPS", root.findTable("CONTRAT_MODALITE_TEMPS"));
1786
            alter.addForeignColumn("ID_CONTRAT_MODALITE_TEMPS", root.findTable("CONTRAT_MODALITE_TEMPS"));
1631
            root.getBase().getDataSource().execute(alter.asString());
1787
            root.getBase().getDataSource().execute(alter.asString());
1632
            root.getSchema().updateVersion();
1788
            root.getSchema().updateVersion();
1633
        }
1789
        }
1634
        if (!tableContrat.contains("ID_CONTRAT_REGIME_MALADIE")) {
1790
        if (!tableContrat.contains("ID_CONTRAT_REGIME_MALADIE")) {
1635
            AlterTable alter = new AlterTable(tableContrat);
1791
            AlterTable alter = new AlterTable(tableContrat);
1636
            alter.addForeignColumn("ID_CONTRAT_REGIME_MALADIE", root.findTable("CONTRAT_REGIME_MALADIE"));
1792
            alter.addForeignColumn("ID_CONTRAT_REGIME_MALADIE", root.findTable("CONTRAT_REGIME_MALADIE"));
1637
            root.getBase().getDataSource().execute(alter.asString());
1793
            root.getBase().getDataSource().execute(alter.asString());
1638
            root.getSchema().updateVersion();
1794
            root.getSchema().updateVersion();
1639
        }
1795
        }
1640
        if (!tableContrat.contains("ID_CONTRAT_REGIME_VIEILLESSE")) {
1796
        if (!tableContrat.contains("ID_CONTRAT_REGIME_VIEILLESSE")) {
1641
            AlterTable alter = new AlterTable(tableContrat);
1797
            AlterTable alter = new AlterTable(tableContrat);
1642
            alter.addForeignColumn("ID_CONTRAT_REGIME_VIEILLESSE", root.findTable("CONTRAT_REGIME_VIEILLESSE"));
1798
            alter.addForeignColumn("ID_CONTRAT_REGIME_VIEILLESSE", root.findTable("CONTRAT_REGIME_VIEILLESSE"));
1643
            root.getBase().getDataSource().execute(alter.asString());
1799
            root.getBase().getDataSource().execute(alter.asString());
1644
            root.getSchema().updateVersion();
1800
            root.getSchema().updateVersion();
1645
        }
1801
        }
1646
        if (!tableContrat.contains("ID_CONTRAT_MOTIF_RECOURS")) {
1802
        if (!tableContrat.contains("ID_CONTRAT_MOTIF_RECOURS")) {
1647
            AlterTable alter = new AlterTable(tableContrat);
1803
            AlterTable alter = new AlterTable(tableContrat);
1648
            alter.addForeignColumn("ID_CONTRAT_MOTIF_RECOURS", root.findTable("CONTRAT_MOTIF_RECOURS"));
1804
            alter.addForeignColumn("ID_CONTRAT_MOTIF_RECOURS", root.findTable("CONTRAT_MOTIF_RECOURS"));
1649
            root.getBase().getDataSource().execute(alter.asString());
1805
            root.getBase().getDataSource().execute(alter.asString());
1650
            root.getSchema().updateVersion();
1806
            root.getSchema().updateVersion();
1651
        }
1807
        }
1652
        if (!tableContrat.contains("ID_CONTRAT_DETACHE_EXPATRIE")) {
1808
        if (!tableContrat.contains("ID_CONTRAT_DETACHE_EXPATRIE")) {
1653
            AlterTable alter = new AlterTable(tableContrat);
1809
            AlterTable alter = new AlterTable(tableContrat);
1654
            alter.addForeignColumn("ID_CONTRAT_DETACHE_EXPATRIE", root.findTable("CONTRAT_DETACHE_EXPATRIE"));
1810
            alter.addForeignColumn("ID_CONTRAT_DETACHE_EXPATRIE", root.findTable("CONTRAT_DETACHE_EXPATRIE"));
1655
            root.getBase().getDataSource().execute(alter.asString());
1811
            root.getBase().getDataSource().execute(alter.asString());
1656
            root.getSchema().updateVersion();
1812
            root.getSchema().updateVersion();
1657
        }
1813
        }
1658
        if (!tableContrat.contains("ID_CONTRAT_DISPOSITIF_POLITIQUE")) {
1814
        if (!tableContrat.contains("ID_CONTRAT_DISPOSITIF_POLITIQUE")) {
1659
            AlterTable alter = new AlterTable(tableContrat);
1815
            AlterTable alter = new AlterTable(tableContrat);
1660
            alter.addForeignColumn("ID_CONTRAT_DISPOSITIF_POLITIQUE", root.findTable("CONTRAT_DISPOSITIF_POLITIQUE"));
1816
            alter.addForeignColumn("ID_CONTRAT_DISPOSITIF_POLITIQUE", root.findTable("CONTRAT_DISPOSITIF_POLITIQUE"));
1661
            root.getBase().getDataSource().execute(alter.asString());
1817
            root.getBase().getDataSource().execute(alter.asString());
1662
            root.getSchema().updateVersion();
1818
            root.getSchema().updateVersion();
1663
        }
1819
        }
1664
        if (!tableContrat.contains("ID_CODE_AMENAGEMENT_PARTIEL")) {
1820
        if (!tableContrat.contains("ID_CODE_AMENAGEMENT_PARTIEL")) {
1665
            updateContrat = true;
1821
            updateContrat = true;
1666
            AlterTable alter = new AlterTable(tableContrat);
1822
            AlterTable alter = new AlterTable(tableContrat);
1667
            alter.addForeignColumn("ID_CODE_AMENAGEMENT_PARTIEL", root.findTable("CODE_AMENAGEMENT_PARTIEL"));
1823
            alter.addForeignColumn("ID_CODE_AMENAGEMENT_PARTIEL", root.findTable("CODE_AMENAGEMENT_PARTIEL"));
1668
            alter.addColumn("DATE_DEBUT_SUSPENSION", "date");
1824
            alter.addColumn("DATE_DEBUT_SUSPENSION", "date");
1669
            alter.addColumn("DATE_FIN_SUSPENSION", "date");
1825
            alter.addColumn("DATE_FIN_SUSPENSION", "date");
1670
            root.getBase().getDataSource().execute(alter.asString());
1826
            root.getBase().getDataSource().execute(alter.asString());
1671
            root.getSchema().updateVersion();
1827
            root.getSchema().updateVersion();
1672
        }
1828
        }
1673
 
1829
 
1674
        if (!tableContrat.contains("ID_CODE_SUSPENSION")) {
1830
        if (!tableContrat.contains("ID_CODE_SUSPENSION")) {
1675
            updateContrat = true;
1831
            updateContrat = true;
1676
            AlterTable alter = new AlterTable(tableContrat);
1832
            AlterTable alter = new AlterTable(tableContrat);
1677
            alter.addForeignColumn("ID_CODE_SUSPENSION", root.findTable("CODE_SUSPENSION"));
1833
            alter.addForeignColumn("ID_CODE_SUSPENSION", root.findTable("CODE_SUSPENSION"));
1678
            root.getBase().getDataSource().execute(alter.asString());
1834
            root.getBase().getDataSource().execute(alter.asString());
1679
            root.getSchema().updateVersion();
1835
            root.getSchema().updateVersion();
1680
        }
1836
        }
1681
        
1837
 
1682
        if (!tableContrat.contains("ID_DIPLOME_PREPARE")) {
1838
        if (!tableContrat.contains("ID_DIPLOME_PREPARE")) {
1683
            updateContrat = true;
1839
            updateContrat = true;
1684
            AlterTable alter = new AlterTable(tableContrat);
1840
            AlterTable alter = new AlterTable(tableContrat);
1685
            alter.addForeignColumn("ID_DIPLOME_PREPARE", root.findTable("DIPLOME_PREPARE"));
1841
            alter.addForeignColumn("ID_DIPLOME_PREPARE", root.findTable("DIPLOME_PREPARE"));
1686
            root.getBase().getDataSource().execute(alter.asString());
1842
            root.getBase().getDataSource().execute(alter.asString());
1687
            root.getSchema().updateVersion();
1843
            root.getSchema().updateVersion();
1688
        }
1844
        }
1689
 
1845
 
1690
        if (updateContrat) {
1846
        if (updateContrat) {
1691
            root.refetchTable("CONTRAT_SALARIE");
1847
            root.refetchTable("CONTRAT_SALARIE");
1692
            tableContrat = root.findTable("CONTRAT_SALARIE");
1848
            tableContrat = root.findTable("CONTRAT_SALARIE");
1693
            SQLSelect sel = new SQLSelect();
1849
            SQLSelect sel = new SQLSelect();
1694
            sel.addSelectStar(tableContrat);
1850
            sel.addSelectStar(tableContrat);
1695
            List<SQLRow> contrats = SQLRowListRSH.execute(sel);
1851
            List<SQLRow> contrats = SQLRowListRSH.execute(sel);
1696
 
1852
 
1697
            SQLSelect selModal = new SQLSelect();
1853
            SQLSelect selModal = new SQLSelect();
1698
            final SQLTable tableModaliteTemps = root.findTable("CONTRAT_MODALITE_TEMPS");
1854
            final SQLTable tableModaliteTemps = root.findTable("CONTRAT_MODALITE_TEMPS");
1699
            selModal.addSelectStar(tableModaliteTemps);
1855
            selModal.addSelectStar(tableModaliteTemps);
1700
            selModal.setWhere(new Where(tableModaliteTemps.getField("CODE"), "=", "10"));
1856
            selModal.setWhere(new Where(tableModaliteTemps.getField("CODE"), "=", "10"));
1701
            SQLRow contratModalite = SQLRowListRSH.execute(selModal).get(0);
1857
            SQLRow contratModalite = SQLRowListRSH.execute(selModal).get(0);
1702
 
1858
 
1703
            SQLSelect selMaladie = new SQLSelect();
1859
            SQLSelect selMaladie = new SQLSelect();
1704
            final SQLTable tableMaladie = root.findTable("CONTRAT_REGIME_MALADIE");
1860
            final SQLTable tableMaladie = root.findTable("CONTRAT_REGIME_MALADIE");
1705
            selMaladie.addSelectStar(tableMaladie);
1861
            selMaladie.addSelectStar(tableMaladie);
1706
            selMaladie.setWhere(new Where(tableMaladie.getField("CODE"), "=", "200"));
1862
            selMaladie.setWhere(new Where(tableMaladie.getField("CODE"), "=", "200"));
1707
            SQLRow contratMaladie = SQLRowListRSH.execute(selMaladie).get(0);
1863
            SQLRow contratMaladie = SQLRowListRSH.execute(selMaladie).get(0);
1708
 
1864
 
1709
            SQLSelect selViel = new SQLSelect();
1865
            SQLSelect selViel = new SQLSelect();
1710
            final SQLTable tableViel = root.findTable("CONTRAT_REGIME_VIEILLESSE");
1866
            final SQLTable tableViel = root.findTable("CONTRAT_REGIME_VIEILLESSE");
1711
            selViel.addSelectStar(tableViel);
1867
            selViel.addSelectStar(tableViel);
1712
            selViel.setWhere(new Where(tableViel.getField("CODE"), "=", "200"));
1868
            selViel.setWhere(new Where(tableViel.getField("CODE"), "=", "200"));
1713
            SQLRow contratViel = SQLRowListRSH.execute(selViel).get(0);
1869
            SQLRow contratViel = SQLRowListRSH.execute(selViel).get(0);
1714
 
1870
 
1715
            SQLSelect selDetacheExp = new SQLSelect();
1871
            SQLSelect selDetacheExp = new SQLSelect();
1716
            final SQLTable tableDetacheExp = root.findTable("CONTRAT_DETACHE_EXPATRIE");
1872
            final SQLTable tableDetacheExp = root.findTable("CONTRAT_DETACHE_EXPATRIE");
1717
            selDetacheExp.addSelectStar(tableDetacheExp);
1873
            selDetacheExp.addSelectStar(tableDetacheExp);
1718
            selDetacheExp.setWhere(new Where(tableDetacheExp.getField("CODE"), "=", "99"));
1874
            selDetacheExp.setWhere(new Where(tableDetacheExp.getField("CODE"), "=", "99"));
1719
            SQLRow contratDetacheExp = SQLRowListRSH.execute(selDetacheExp).get(0);
1875
            SQLRow contratDetacheExp = SQLRowListRSH.execute(selDetacheExp).get(0);
1720
 
1876
 
1721
            SQLSelect selDispoPolitique = new SQLSelect();
1877
            SQLSelect selDispoPolitique = new SQLSelect();
1722
            final SQLTable tableDispoPol = root.findTable("CONTRAT_DISPOSITIF_POLITIQUE");
1878
            final SQLTable tableDispoPol = root.findTable("CONTRAT_DISPOSITIF_POLITIQUE");
1723
            selDispoPolitique.addSelectStar(tableDispoPol);
1879
            selDispoPolitique.addSelectStar(tableDispoPol);
1724
            selDispoPolitique.setWhere(new Where(tableDispoPol.getField("CODE"), "=", "99"));
1880
            selDispoPolitique.setWhere(new Where(tableDispoPol.getField("CODE"), "=", "99"));
1725
            SQLRow contratDispoPol = SQLRowListRSH.execute(selDispoPolitique).get(0);
1881
            SQLRow contratDispoPol = SQLRowListRSH.execute(selDispoPolitique).get(0);
1726
 
1882
 
1727
            for (SQLRow contrat : contrats) {
1883
            for (SQLRow contrat : contrats) {
1728
 
1884
 
1729
                final SQLRowValues createEmptyUpdateRow = contrat.createEmptyUpdateRow();
1885
                final SQLRowValues createEmptyUpdateRow = contrat.createEmptyUpdateRow();
1730
                createEmptyUpdateRow.put("ID_CONTRAT_MODALITE_TEMPS", contratModalite.getID());
1886
                createEmptyUpdateRow.put("ID_CONTRAT_MODALITE_TEMPS", contratModalite.getID());
1731
                createEmptyUpdateRow.put("ID_CONTRAT_REGIME_MALADIE", contratMaladie.getID());
1887
                createEmptyUpdateRow.put("ID_CONTRAT_REGIME_MALADIE", contratMaladie.getID());
1732
                createEmptyUpdateRow.put("ID_CONTRAT_REGIME_VIEILLESSE", contratViel.getID());
1888
                createEmptyUpdateRow.put("ID_CONTRAT_REGIME_VIEILLESSE", contratViel.getID());
1733
                createEmptyUpdateRow.put("ID_CONTRAT_DETACHE_EXPATRIE", contratDetacheExp.getID());
1889
                createEmptyUpdateRow.put("ID_CONTRAT_DETACHE_EXPATRIE", contratDetacheExp.getID());
1734
                createEmptyUpdateRow.put("ID_CONTRAT_DISPOSITIF_POLITIQUE", contratDispoPol.getID());
1890
                createEmptyUpdateRow.put("ID_CONTRAT_DISPOSITIF_POLITIQUE", contratDispoPol.getID());
1735
                createEmptyUpdateRow.commit();
1891
                createEmptyUpdateRow.commit();
1736
            }
1892
            }
1737
        }
1893
        }
1738
        if (!root.contains("CONTRAT_PREVOYANCE")) {
1894
        if (!root.contains("CONTRAT_PREVOYANCE")) {
1739
 
1895
 
1740
            final SQLCreateTable createTable = new SQLCreateTable(root, "CONTRAT_PREVOYANCE");
1896
            final SQLCreateTable createTable = new SQLCreateTable(root, "CONTRAT_PREVOYANCE");
1741
            createTable.addVarCharColumn("REFERENCE", 256);
1897
            createTable.addVarCharColumn("REFERENCE", 256);
1742
            createTable.addDateAndTimeColumn("DATE_DEBUT");
1898
            createTable.addDateAndTimeColumn("DATE_DEBUT");
1743
            createTable.addDateAndTimeColumn("DATE_FIN");
1899
            createTable.addDateAndTimeColumn("DATE_FIN");
1744
            createTable.addVarCharColumn("CODE_ORGANISME", 256);
1900
            createTable.addVarCharColumn("CODE_ORGANISME", 256);
1745
            createTable.addVarCharColumn("CODE_DELEGATAIRE", 256);
1901
            createTable.addVarCharColumn("CODE_DELEGATAIRE", 256);
1746
            createTable.addVarCharColumn("CODE_UNIQUE", 256);
1902
            createTable.addVarCharColumn("CODE_UNIQUE", 256);
1747
            createTable.addVarCharColumn("NOM", 256);
1903
            createTable.addVarCharColumn("NOM", 256);
1748
            try {
1904
            try {
1749
                root.getBase().getDataSource().execute(createTable.asString());
1905
                root.getBase().getDataSource().execute(createTable.asString());
1750
                insertUndef(createTable);
1906
                insertUndef(createTable);
1751
                root.refetchTable("CONTRAT_PREVOYANCE");
1907
                root.refetchTable("CONTRAT_PREVOYANCE");
1752
                root.getSchema().updateVersion();
1908
                root.getSchema().updateVersion();
1753
            } catch (SQLException ex) {
1909
            } catch (SQLException ex) {
1754
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_PREVOYANCE", ex);
1910
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_PREVOYANCE", ex);
1755
            }
1911
            }
1756
        }
1912
        }
1757
        if (!root.getTable("CONTRAT_PREVOYANCE").contains("COTISATION_ETABLISSEMENT")) {
1913
        if (!root.getTable("CONTRAT_PREVOYANCE").contains("COTISATION_ETABLISSEMENT")) {
1758
            AlterTable tableContratP = new AlterTable(root.getTable("CONTRAT_PREVOYANCE"));
1914
            AlterTable tableContratP = new AlterTable(root.getTable("CONTRAT_PREVOYANCE"));
1759
            tableContratP.addBooleanColumn("COTISATION_ETABLISSEMENT", Boolean.FALSE, false);
1915
            tableContratP.addBooleanColumn("COTISATION_ETABLISSEMENT", Boolean.FALSE, false);
1760
            root.getBase().getDataSource().execute(tableContratP.asString());
1916
            root.getBase().getDataSource().execute(tableContratP.asString());
1761
            root.refetchTable("CONTRAT_PREVOYANCE");
1917
            root.refetchTable("CONTRAT_PREVOYANCE");
1762
            root.getSchema().updateVersion();
1918
            root.getSchema().updateVersion();
1763
        }
1919
        }
1764
 
1920
 
1765
        if (!root.contains("CONTRAT_PREVOYANCE_CONTRAT_SALARIE")) {
1921
        if (!root.contains("CONTRAT_PREVOYANCE_CONTRAT_SALARIE")) {
1766
 
1922
 
1767
            final SQLCreateTable createTableSal = new SQLCreateTable(root, "CONTRAT_PREVOYANCE_CONTRAT_SALARIE");
1923
            final SQLCreateTable createTableSal = new SQLCreateTable(root, "CONTRAT_PREVOYANCE_CONTRAT_SALARIE");
1768
            final SQLTable tableInfosSalarie = root.getTable("INFOS_SALARIE_PAYE");
1924
            final SQLTable tableInfosSalarie = root.getTable("INFOS_SALARIE_PAYE");
1769
            createTableSal.addForeignColumn("ID_INFOS_SALARIE_PAYE", tableInfosSalarie);
1925
            createTableSal.addForeignColumn("ID_INFOS_SALARIE_PAYE", tableInfosSalarie);
1770
            createTableSal.addForeignColumn("ID_CONTRAT_PREVOYANCE", root.getTable("CONTRAT_PREVOYANCE"));
1926
            createTableSal.addForeignColumn("ID_CONTRAT_PREVOYANCE", root.getTable("CONTRAT_PREVOYANCE"));
1771
            createTableSal.addVarCharColumn("CODE_OPTION", 256);
1927
            createTableSal.addVarCharColumn("CODE_OPTION", 256);
1772
            createTableSal.addVarCharColumn("CODE_POPULATION", 256);
1928
            createTableSal.addVarCharColumn("CODE_POPULATION", 256);
1773
            createTableSal.addIntegerColumn("NB_ENFANT_CHARGE", null, true);
1929
            createTableSal.addIntegerColumn("NB_ENFANT_CHARGE", null, true);
1774
            createTableSal.addIntegerColumn("NB_ADULTE_AYANT_DROIT", null, true);
1930
            createTableSal.addIntegerColumn("NB_ADULTE_AYANT_DROIT", null, true);
1775
            createTableSal.addIntegerColumn("NB_AYANT_DROIT", null, true);
1931
            createTableSal.addIntegerColumn("NB_AYANT_DROIT", null, true);
1776
            createTableSal.addIntegerColumn("NB_AYANT_DROIT_AUTRE", null, true);
1932
            createTableSal.addIntegerColumn("NB_AYANT_DROIT_AUTRE", null, true);
1777
            createTableSal.addIntegerColumn("NB_ENFANT_AYANT_DROIT", null, true);
1933
            createTableSal.addIntegerColumn("NB_ENFANT_AYANT_DROIT", null, true);
1778
 
1934
 
1779
            try {
1935
            try {
1780
                root.getBase().getDataSource().execute(createTableSal.asString());
1936
                root.getBase().getDataSource().execute(createTableSal.asString());
1781
                insertUndef(createTableSal);
1937
                insertUndef(createTableSal);
1782
                root.refetchTable("CONTRAT_PREVOYANCE_CONTRAT_SALARIE");
1938
                root.refetchTable("CONTRAT_PREVOYANCE_CONTRAT_SALARIE");
1783
                root.getSchema().updateVersion();
1939
                root.getSchema().updateVersion();
1784
 
1940
 
1785
                String up = "UPDATE " + new SQLName(root.getName(), tableInfosSalarie.getName()).quote() + " i SET \"ID_SALARIE\" = (SELECT s.\"ID\" FROM "
1941
                String up = "UPDATE " + new SQLName(root.getName(), tableInfosSalarie.getName()).quote() + " i SET \"ID_SALARIE\" = (SELECT s.\"ID\" FROM "
1786
                        + new SQLName(root.getName(), tableInfosSalarie.getForeignTable("ID_SALARIE").getName()).quote() + " s WHERE s.\"ID_INFOS_SALARIE_PAYE\"=i.\"ID\" and s.\"ARCHIVE\"=0)"
1942
                        + new SQLName(root.getName(), tableInfosSalarie.getForeignTable("ID_SALARIE").getName()).quote() + " s WHERE s.\"ID_INFOS_SALARIE_PAYE\"=i.\"ID\" and s.\"ARCHIVE\"=0)"
1787
                        + " WHERE i.\"ID\" IN (SELECT i2.\"ID_INFOS_SALARIE_PAYE\" FROM " + new SQLName(root.getName(), tableInfosSalarie.getForeignTable("ID_SALARIE").getName()).quote();
1943
                        + " WHERE i.\"ID\" IN (SELECT i2.\"ID_INFOS_SALARIE_PAYE\" FROM " + new SQLName(root.getName(), tableInfosSalarie.getForeignTable("ID_SALARIE").getName()).quote();
1788
                up += " i2 WHERE i2.\"ARCHIVE\"=0)";
1944
                up += " i2 WHERE i2.\"ARCHIVE\"=0)";
1789
 
1945
 
1790
                root.getBase().getDataSource().execute(up);
1946
                root.getBase().getDataSource().execute(up);
1791
 
1947
 
1792
            } catch (SQLException ex) {
1948
            } catch (SQLException ex) {
1793
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_PREVOYANCE_SALARIE", ex);
1949
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_PREVOYANCE_SALARIE", ex);
1794
            }
1950
            }
1795
        }
1951
        }
1796
        if (!root.contains("CONTRAT_PREVOYANCE_RUBRIQUE"))
1952
        if (!root.contains("CONTRAT_PREVOYANCE_RUBRIQUE"))
1797
 
1953
 
1798
        {
1954
        {
1799
 
1955
 
1800
            final SQLCreateTable createTableRub = new SQLCreateTable(root, "CONTRAT_PREVOYANCE_RUBRIQUE");
1956
            final SQLCreateTable createTableRub = new SQLCreateTable(root, "CONTRAT_PREVOYANCE_RUBRIQUE");
1801
            createTableRub.addForeignColumn("ID_RUBRIQUE_COTISATION", root.findTable("RUBRIQUE_COTISATION"));
1957
            createTableRub.addForeignColumn("ID_RUBRIQUE_COTISATION", root.findTable("RUBRIQUE_COTISATION"));
1802
            createTableRub.addForeignColumn("ID_CONTRAT_PREVOYANCE", root.getTable("CONTRAT_PREVOYANCE"));
1958
            createTableRub.addForeignColumn("ID_CONTRAT_PREVOYANCE", root.getTable("CONTRAT_PREVOYANCE"));
1803
 
1959
 
1804
            try {
1960
            try {
1805
                root.getBase().getDataSource().execute(createTableRub.asString());
1961
                root.getBase().getDataSource().execute(createTableRub.asString());
1806
                insertUndef(createTableRub);
1962
                insertUndef(createTableRub);
1807
                root.refetchTable("CONTRAT_PREVOYANCE_RUBRIQUE");
1963
                root.refetchTable("CONTRAT_PREVOYANCE_RUBRIQUE");
1808
                root.getSchema().updateVersion();
1964
                root.getSchema().updateVersion();
1809
            } catch (SQLException ex) {
1965
            } catch (SQLException ex) {
1810
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_PREVOYANCE_RUBRIQUE", ex);
1966
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_PREVOYANCE_RUBRIQUE", ex);
1811
            }
1967
            }
1812
        }
1968
        }
1813
 
1969
 
1814
        if (!root.contains("CONTRAT_PREVOYANCE_RUBRIQUE_NET"))
1970
        if (!root.contains("CONTRAT_PREVOYANCE_RUBRIQUE_NET"))
1815
 
1971
 
1816
        {
1972
        {
1817
 
1973
 
1818
            final SQLCreateTable createTableRub = new SQLCreateTable(root, "CONTRAT_PREVOYANCE_RUBRIQUE_NET");
1974
            final SQLCreateTable createTableRub = new SQLCreateTable(root, "CONTRAT_PREVOYANCE_RUBRIQUE_NET");
1819
            createTableRub.addForeignColumn("ID_RUBRIQUE_NET", root.findTable("RUBRIQUE_NET"));
1975
            createTableRub.addForeignColumn("ID_RUBRIQUE_NET", root.findTable("RUBRIQUE_NET"));
1820
            createTableRub.addForeignColumn("ID_CONTRAT_PREVOYANCE", root.getTable("CONTRAT_PREVOYANCE"));
1976
            createTableRub.addForeignColumn("ID_CONTRAT_PREVOYANCE", root.getTable("CONTRAT_PREVOYANCE"));
1821
 
1977
 
1822
            try {
1978
            try {
1823
                root.getBase().getDataSource().execute(createTableRub.asString());
1979
                root.getBase().getDataSource().execute(createTableRub.asString());
1824
                insertUndef(createTableRub);
1980
                insertUndef(createTableRub);
1825
                root.refetchTable("CONTRAT_PREVOYANCE_RUBRIQUE_NET");
1981
                root.refetchTable("CONTRAT_PREVOYANCE_RUBRIQUE_NET");
1826
                root.getSchema().updateVersion();
1982
                root.getSchema().updateVersion();
1827
            } catch (SQLException ex) {
1983
            } catch (SQLException ex) {
1828
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_PREVOYANCE_RUBRIQUE_NET", ex);
1984
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_PREVOYANCE_RUBRIQUE_NET", ex);
1829
            }
1985
            }
1830
        }
1986
        }
1831
        if (!root.contains("AYANT_DROIT")) {
1987
        if (!root.contains("AYANT_DROIT")) {
1832
 
1988
 
1833
            final SQLCreateTable createTableAyantDroit = new SQLCreateTable(root, "AYANT_DROIT");
1989
            final SQLCreateTable createTableAyantDroit = new SQLCreateTable(root, "AYANT_DROIT");
1834
            createTableAyantDroit.addVarCharColumn("NOM", 256);
1990
            createTableAyantDroit.addVarCharColumn("NOM", 256);
1835
            createTableAyantDroit.addForeignColumn("ID_SALARIE", root.findTable("SALARIE"));
1991
            createTableAyantDroit.addForeignColumn("ID_SALARIE", root.findTable("SALARIE"));
1836
            createTableAyantDroit.addForeignColumn("ID_AYANT_DROIT_TYPE", root.findTable("AYANT_DROIT_TYPE"));
1992
            createTableAyantDroit.addForeignColumn("ID_AYANT_DROIT_TYPE", root.findTable("AYANT_DROIT_TYPE"));
1837
            createTableAyantDroit.addBooleanColumn("REGIME_ALSACE", Boolean.FALSE, false);
1993
            createTableAyantDroit.addBooleanColumn("REGIME_ALSACE", Boolean.FALSE, false);
1838
            createTableAyantDroit.addVarCharColumn("NIR", 256);
1994
            createTableAyantDroit.addVarCharColumn("NIR", 256);
1839
            createTableAyantDroit.addVarCharColumn("PRENOMS", 256);
1995
            createTableAyantDroit.addVarCharColumn("PRENOMS", 256);
1840
            createTableAyantDroit.addVarCharColumn("CODE_ORGANISME_AFFILIATION", 256);
1996
            createTableAyantDroit.addVarCharColumn("CODE_ORGANISME_AFFILIATION", 256);
1841
            createTableAyantDroit.addVarCharColumn("CODE_OPTION", 256);
1997
            createTableAyantDroit.addVarCharColumn("CODE_OPTION", 256);
1842
            createTableAyantDroit.addVarCharColumn("NIR_OUVRANT_DROIT", 256);
1998
            createTableAyantDroit.addVarCharColumn("NIR_OUVRANT_DROIT", 256);
1843
            createTableAyantDroit.addDateAndTimeColumn("DATE_DEBUT_RATTACHEMENT");
1999
            createTableAyantDroit.addDateAndTimeColumn("DATE_DEBUT_RATTACHEMENT");
1844
            createTableAyantDroit.addDateAndTimeColumn("DATE_FIN_RATTACHEMENT");
2000
            createTableAyantDroit.addDateAndTimeColumn("DATE_FIN_RATTACHEMENT");
1845
            createTableAyantDroit.addDateAndTimeColumn("DATE_NAISSANCE");
2001
            createTableAyantDroit.addDateAndTimeColumn("DATE_NAISSANCE");
1846
            try {
2002
            try {
1847
                root.getBase().getDataSource().execute(createTableAyantDroit.asString());
2003
                root.getBase().getDataSource().execute(createTableAyantDroit.asString());
1848
                insertUndef(createTableAyantDroit);
2004
                insertUndef(createTableAyantDroit);
1849
                root.refetchTable("AYANT_DROIT");
2005
                root.refetchTable("AYANT_DROIT");
1850
                root.getSchema().updateVersion();
2006
                root.getSchema().updateVersion();
1851
            } catch (SQLException ex) {
2007
            } catch (SQLException ex) {
1852
                throw new IllegalStateException("Erreur lors de la création de la table " + "AYANT_DROIT", ex);
2008
                throw new IllegalStateException("Erreur lors de la création de la table " + "AYANT_DROIT", ex);
1853
            }
2009
            }
1854
 
2010
 
1855
            final SQLCreateTable createTablePrevAyant = new SQLCreateTable(root, "CONTRAT_PREVOYANCE_AYANT_DROIT");
2011
            final SQLCreateTable createTablePrevAyant = new SQLCreateTable(root, "CONTRAT_PREVOYANCE_AYANT_DROIT");
1856
            createTablePrevAyant.addForeignColumn("ID_AYANT_DROIT", root.getTable("AYANT_DROIT"));
2012
            createTablePrevAyant.addForeignColumn("ID_AYANT_DROIT", root.getTable("AYANT_DROIT"));
1857
            createTablePrevAyant.addForeignColumn("ID_CONTRAT_PREVOYANCE", root.getTable("CONTRAT_PREVOYANCE"));
2013
            createTablePrevAyant.addForeignColumn("ID_CONTRAT_PREVOYANCE", root.getTable("CONTRAT_PREVOYANCE"));
1858
 
2014
 
1859
            try {
2015
            try {
1860
                root.getBase().getDataSource().execute(createTablePrevAyant.asString());
2016
                root.getBase().getDataSource().execute(createTablePrevAyant.asString());
1861
                insertUndef(createTablePrevAyant);
2017
                insertUndef(createTablePrevAyant);
1862
                root.refetchTable("CONTRAT_PREVOYANCE_AYANT_DROIT");
2018
                root.refetchTable("CONTRAT_PREVOYANCE_AYANT_DROIT");
1863
                root.getSchema().updateVersion();
2019
                root.getSchema().updateVersion();
1864
            } catch (SQLException ex) {
2020
            } catch (SQLException ex) {
1865
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_PREVOYANCE_AYANT_DROIT", ex);
2021
                throw new IllegalStateException("Erreur lors de la création de la table " + "CONTRAT_PREVOYANCE_AYANT_DROIT", ex);
1866
            }
2022
            }
1867
        }
2023
        }
1868
        if (!root.contains("CODE_PENIBILITE_CONTRAT_SALARIE")) {
2024
        if (!root.contains("CODE_PENIBILITE_CONTRAT_SALARIE")) {
1869
 
2025
 
1870
            final SQLCreateTable createTableSal = new SQLCreateTable(root, "CODE_PENIBILITE_CONTRAT_SALARIE");
2026
            final SQLCreateTable createTableSal = new SQLCreateTable(root, "CODE_PENIBILITE_CONTRAT_SALARIE");
1871
            final SQLTable tableInfosSalarie = root.getTable("INFOS_SALARIE_PAYE");
2027
            final SQLTable tableInfosSalarie = root.getTable("INFOS_SALARIE_PAYE");
1872
            createTableSal.addForeignColumn("ID_INFOS_SALARIE_PAYE", tableInfosSalarie);
2028
            createTableSal.addForeignColumn("ID_INFOS_SALARIE_PAYE", tableInfosSalarie);
1873
            createTableSal.addForeignColumn("ID_CODE_PENIBILITE", root.findTable("CODE_PENIBILITE"));
2029
            createTableSal.addForeignColumn("ID_CODE_PENIBILITE", root.findTable("CODE_PENIBILITE"));
1874
 
2030
 
1875
            try {
2031
            try {
1876
                root.getBase().getDataSource().execute(createTableSal.asString());
2032
                root.getBase().getDataSource().execute(createTableSal.asString());
1877
                insertUndef(createTableSal);
2033
                insertUndef(createTableSal);
1878
                root.refetchTable("CODE_PENIBILITE_CONTRAT_SALARIE");
2034
                root.refetchTable("CODE_PENIBILITE_CONTRAT_SALARIE");
1879
                root.getSchema().updateVersion();
2035
                root.getSchema().updateVersion();
1880
 
2036
 
1881
            } catch (SQLException ex) {
2037
            } catch (SQLException ex) {
1882
                throw new IllegalStateException("Erreur lors de la création de la table " + "CODE_PENIBILITE_CONTRAT_SALARIE", ex);
2038
                throw new IllegalStateException("Erreur lors de la création de la table " + "CODE_PENIBILITE_CONTRAT_SALARIE", ex);
1883
            }
2039
            }
1884
        }
2040
        }
-
 
2041
 
-
 
2042
        if (!root.contains("ARRET_CHOMAGE_INTEMPERIE")) {
-
 
2043
 
-
 
2044
            final SQLCreateTable createTableSal = new SQLCreateTable(root, "ARRET_CHOMAGE_INTEMPERIE");
-
 
2045
            final SQLTable tableInfosSalarie = root.getTable("INFOS_SALARIE_PAYE");
-
 
2046
            createTableSal.addForeignColumn("ID_INFOS_SALARIE_PAYE", tableInfosSalarie);
-
 
2047
            createTableSal.addForeignColumn("ID_CODE_AMENAGEMENT_PARTIEL", root.findTable("CODE_AMENAGEMENT_PARTIEL"));
-
 
2048
            createTableSal.addForeignColumn("ID_CODE_SUSPENSION", root.findTable("CODE_SUSPENSION"));
-
 
2049
            createTableSal.addColumn("DATE_DEBUT_SUSPENSION", "date");
-
 
2050
            createTableSal.addColumn("DATE_FIN_SUSPENSION", "date");
-
 
2051
 
-
 
2052
            try {
-
 
2053
                root.getBase().getDataSource().execute(createTableSal.asString());
-
 
2054
                insertUndef(createTableSal);
-
 
2055
                root.refetchTable("ARRET_CHOMAGE_INTEMPERIE");
-
 
2056
                root.getSchema().updateVersion();
-
 
2057
            } catch (SQLException ex) {
-
 
2058
                throw new IllegalStateException("Erreur lors de la création de la table " + "ARRET_CHOMAGE_INTEMPERIE", ex);
-
 
2059
            }
-
 
2060
        }
-
 
2061
 
-
 
2062
        if (!tableContrat.contains("ID_CODE_CAISSE_CONGES_PAYES")) {
-
 
2063
            AlterTable alterContrat = new AlterTable(tableContrat);
-
 
2064
            alterContrat.addForeignColumn("ID_CODE_CAISSE_CONGES_PAYES", root.findTable("CODE_CAISSE_CONGES_PAYES"));
-
 
2065
            alterContrat.addDecimalColumn("TAUX_FRAIS_PROFESSIONNELS", 16, 4, null, true);
-
 
2066
            root.getBase().getDataSource().execute(alterContrat.asString());
-
 
2067
            root.getSchema().updateVersion();
-
 
2068
        }
-
 
2069
 
1885
    }
2070
    }
1886
 
2071
 
1887
}
2072
}