Line 1... |
Line 1... |
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.
|
Line 378... |
Line 378... |
378 |
listMvtWithoutIDs.get(i).setId(mvtId);
|
378 |
listMvtWithoutIDs.get(i).setId(mvtId);
|
379 |
}
|
379 |
}
|
380 |
|
380 |
|
381 |
SQLUpdate.executeMultipleWithBatch(sysRoot, mvtUpdate);
|
381 |
SQLUpdate.executeMultipleWithBatch(sysRoot, mvtUpdate);
|
382 |
|
382 |
|
- |
|
383 |
final List<SQLInsert> insertsURL = new ArrayList<>(insertsMouvement.size());
|
- |
|
384 |
for (int i = 0; i < pieces.size(); i++) {
|
- |
|
385 |
Piece piece = pieces.get(i);
|
- |
|
386 |
piece.setId(idsPieces.get(i));
|
- |
|
387 |
for (Mouvement m : piece.getMouvements()) {
|
- |
|
388 |
if (m.hasURLs()) {
|
- |
|
389 |
List<MouvementGED> urLs = m.getURLs();
|
- |
|
390 |
for (MouvementGED urls : urLs) {
|
- |
|
391 |
insertsURL.add(urls.createInsert(root, user));
|
- |
|
392 |
}
|
- |
|
393 |
}
|
- |
|
394 |
}
|
- |
|
395 |
}
|
- |
|
396 |
if (!insertsURL.isEmpty()) {
|
- |
|
397 |
SQLInsert.executeSimilarInserts(sysRoot, insertsURL, false);
|
- |
|
398 |
}
|
- |
|
399 |
|
383 |
// Creation des inserts des écritures sans analytique
|
400 |
// Creation des inserts des écritures sans liens ( analytique)
|
384 |
final List<SQLInsert> insertsEcrituresSansAnalytique = new ArrayList<>(insertsMouvement.size() * 2);
|
401 |
final List<SQLInsert> insertsEcrituresSansLiens = new ArrayList<>(insertsMouvement.size() * 2);
|
385 |
final List<SQLInsert> insertsEcrituresAvecAnalytique = new ArrayList<>(insertsMouvement.size() * 2);
|
402 |
final List<SQLInsert> insertsEcrituresAvecLiens = new ArrayList<>(insertsMouvement.size() * 2);
|
386 |
final List<Ecriture> ecrituresAvecAnalytique = new ArrayList<>(insertsEcrituresAvecAnalytique.size());
|
403 |
final List<Ecriture> ecrituresAvecLiens = new ArrayList<>(insertsEcrituresAvecLiens.size());
|
387 |
for (Piece p : pieces) {
|
404 |
for (Piece p : pieces) {
|
388 |
final List<Mouvement> mouvements = p.getMouvements();
|
405 |
final List<Mouvement> mouvements = p.getMouvements();
|
389 |
final int stop = mouvements.size();
|
406 |
final int stop = mouvements.size();
|
390 |
for (int i = 0; i < stop; i++) {
|
407 |
for (int i = 0; i < stop; i++) {
|
391 |
final Mouvement m = mouvements.get(i);
|
408 |
final Mouvement m = mouvements.get(i);
|
392 |
for (Ecriture e : m.getEcritures()) {
|
409 |
for (Ecriture e : m.getEcritures()) {
|
393 |
if (e.hasAnalytique()) {
|
410 |
if (e.hasAnalytique()) {
|
394 |
insertsEcrituresAvecAnalytique.add(e.createInsert(root, user));
|
411 |
insertsEcrituresAvecLiens.add(e.createInsert(root, user));
|
395 |
ecrituresAvecAnalytique.add(e);
|
412 |
ecrituresAvecLiens.add(e);
|
396 |
} else {
|
413 |
} else {
|
397 |
insertsEcrituresSansAnalytique.add(e.createInsert(root, user));
|
414 |
insertsEcrituresSansLiens.add(e.createInsert(root, user));
|
398 |
}
|
415 |
}
|
399 |
}
|
416 |
}
|
400 |
|
417 |
|
401 |
}
|
418 |
}
|
402 |
}
|
419 |
}
|
- |
|
420 |
if (!insertsEcrituresSansLiens.isEmpty()) {
|
403 |
// Insertions des écritures des mouvements
|
421 |
// Insertions des écritures des mouvements
|
404 |
SQLInsert.executeSimilarInserts(sysRoot, insertsEcrituresSansAnalytique, false);
|
422 |
SQLInsert.executeSimilarInserts(sysRoot, insertsEcrituresSansLiens, false);
|
- |
|
423 |
}
|
405 |
// Insertions des écritures avec analytique
|
424 |
// Insertions des écritures avec analytique
|
406 |
if (!ecrituresAvecAnalytique.isEmpty()) {
|
425 |
if (!ecrituresAvecLiens.isEmpty()) {
|
407 |
final List<Number> idsEcritues = SQLInsert.executeSimilarInserts(sysRoot, insertsEcrituresAvecAnalytique, true);
|
426 |
final List<Number> idsEcritues = SQLInsert.executeSimilarInserts(sysRoot, insertsEcrituresAvecLiens, true);
|
408 |
// Analytique
|
427 |
// Analytique
|
409 |
final List<SQLInsert> insertsAssociationAnalytique = new ArrayList<>(insertsEcrituresAvecAnalytique.size());
|
428 |
final List<SQLInsert> insertsAssociationAnalytique = new ArrayList<>(insertsEcrituresAvecLiens.size());
|
- |
|
429 |
final List<SQLInsert> insertsURLs = new ArrayList<>(insertsEcrituresAvecLiens.size());
|
410 |
final int size = ecrituresAvecAnalytique.size();
|
430 |
final int size = ecrituresAvecLiens.size();
|
411 |
for (int i = 0; i < size; i++) {
|
431 |
for (int i = 0; i < size; i++) {
|
412 |
final Ecriture e = ecrituresAvecAnalytique.get(i);
|
432 |
final Ecriture e = ecrituresAvecLiens.get(i);
|
413 |
e.setId(idsEcritues.get(i));
|
433 |
e.setId(idsEcritues.get(i));
|
- |
|
434 |
if (e.hasAnalytique()) {
|
414 |
for (AssociationAnalytique a : e.getAssociationsAnalytiques()) {
|
435 |
for (AssociationAnalytique a : e.getAssociationsAnalytiques()) {
|
415 |
insertsAssociationAnalytique.add(a.createInsert(root, user));
|
436 |
insertsAssociationAnalytique.add(a.createInsert(root, user));
|
416 |
}
|
437 |
}
|
417 |
}
|
438 |
}
|
- |
|
439 |
|
- |
|
440 |
}
|
- |
|
441 |
if (!insertsAssociationAnalytique.isEmpty()) {
|
418 |
SQLInsert.executeSimilarInserts(sysRoot, insertsAssociationAnalytique, false);
|
442 |
SQLInsert.executeSimilarInserts(sysRoot, insertsAssociationAnalytique, false);
|
419 |
}
|
443 |
}
|
- |
|
444 |
if (!insertsURLs.isEmpty()) {
|
- |
|
445 |
SQLInsert.executeSimilarInserts(sysRoot, insertsURLs, false);
|
- |
|
446 |
}
|
- |
|
447 |
}
|
420 |
for (Piece p : pieces) {
|
448 |
for (Piece p : pieces) {
|
421 |
final List<Mouvement> mouvements = p.getMouvements();
|
449 |
final List<Mouvement> mouvements = p.getMouvements();
|
422 |
for (Mouvement m : mouvements) {
|
450 |
for (Mouvement m : mouvements) {
|
423 |
if (m.getPostInsertionAction() != null) {
|
451 |
if (m.getPostInsertionAction() != null) {
|
424 |
m.getPostInsertionAction().afterInsert(m);
|
452 |
m.getPostInsertionAction().afterInsert(m);
|