Skip to content

Commit

Permalink
fix: list type
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolife999 committed Oct 6, 2023
1 parent f9e8cf2 commit 3f57fc4
Show file tree
Hide file tree
Showing 38 changed files with 329 additions and 290 deletions.
10 changes: 5 additions & 5 deletions arc-batch/src/main/java/fr/insee/arc/batch/BatchARC.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ class BatchARC implements IReturnCode {
private boolean dejaEnCours;

// Array of phases
private ArrayList<TraitementPhase> phases = new ArrayList<>();
private List<TraitementPhase> phases = new ArrayList<>();
// Map of thread by phase
private HashMap<TraitementPhase, ArrayList<PhaseThreadFactory>> pool = new HashMap<>();
private Map<TraitementPhase, List<PhaseThreadFactory>> pool = new HashMap<>();
// delay between phase start
private int delay;

Expand Down Expand Up @@ -457,8 +457,8 @@ private void resetWorkDirectory() throws ArcException, IOException {
* @param pool
* @return
*/
private void initializeBatchLoop(ArrayList<TraitementPhase> phases,
HashMap<TraitementPhase, ArrayList<PhaseThreadFactory>> pool) {
private void initializeBatchLoop(List<TraitementPhase> phases,
Map<TraitementPhase, List<PhaseThreadFactory>> pool) {
int stepNumber = (TraitementPhase.MAPPING.getOrdre() - TraitementPhase.CHARGEMENT.getOrdre()) + 2;
this.delay = poolingDelay / stepNumber;

Expand Down Expand Up @@ -535,7 +535,7 @@ private void updateProductionOn() throws ArcException {
// updtate the thread pool by phase by deleting the dead and finished thread
private void updateThreadPoolStatus() {
// delete dead thread i.e. keep only living thread in the pool
HashMap<TraitementPhase, ArrayList<PhaseThreadFactory>> poolToKeep = new HashMap<>();
Map<TraitementPhase, List<PhaseThreadFactory>> poolToKeep = new HashMap<>();
for (TraitementPhase phase : phases) {
poolToKeep.put(phase, new ArrayList<>());
if (!pool.get(phase).isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public static TraitementPhase getPhase(String s)
*
* @return
*/
public ArrayList<TraitementPhase> nextPhases() {
ArrayList<TraitementPhase> listPhase = new ArrayList<>();
public List<TraitementPhase> nextPhases() {
List<TraitementPhase> listPhase = new ArrayList<>();
for (TraitementPhase phase : TraitementPhase.values()) {
if (phase.getOrdre() > ordre) {
listPhase.add(phase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand All @@ -23,7 +24,7 @@ public class JeuDeRegle {
private Date validiteSup;
private String version;

private ArrayList<RegleControleEntity> listRegleControle;
private List<RegleControleEntity> listRegleControle;

private String etat;

Expand Down Expand Up @@ -106,11 +107,11 @@ public void setValiditeSupString(String validiteSup, String format) {
}
}

public ArrayList<RegleControleEntity> getListRegleControle() {
public List<RegleControleEntity> getListRegleControle() {
return this.listRegleControle;
}

public void setListRegleControle(ArrayList<RegleControleEntity> listRegleControle) {
public void setListRegleControle(List<RegleControleEntity> listRegleControle) {
this.listRegleControle = listRegleControle;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

Expand All @@ -17,7 +16,6 @@
import fr.insee.arc.utils.exception.ArcException;
import fr.insee.arc.utils.exception.ArcExceptionMessage;
import fr.insee.arc.utils.structure.GenericBean;
import fr.insee.arc.utils.utils.LoggerHelper;
public class JeuDeRegleDao {

private static final Logger LOGGER = LogManager.getLogger(JeuDeRegleDao.class);
Expand All @@ -35,7 +33,7 @@ private JeuDeRegleDao() {
* @return
* @throws ArcException
*/
public static ArrayList<JeuDeRegle> recupJeuDeRegle(Connection connexion, String tableJeuDeRegle) throws ArcException {
public static List<JeuDeRegle> recupJeuDeRegle(Connection connexion, String tableJeuDeRegle) throws ArcException {
StaticLoggerDispatcher.info(LOGGER, "Recherche des jeux de règles à appliquer");

StringBuilder requete = new StringBuilder();
Expand All @@ -56,7 +54,7 @@ public static ArrayList<JeuDeRegle> recupJeuDeRegle(Connection connexion, String
* @return
* @throws ArcException
*/
public static ArrayList<JeuDeRegle> recupJeuDeRegle(Connection connexion, String nomTableATraiter, String tableJeuDeRegle) throws ArcException {
public static List<JeuDeRegle> recupJeuDeRegle(Connection connexion, String nomTableATraiter, String tableJeuDeRegle) throws ArcException {
StaticLoggerDispatcher.info(LOGGER, "Recherche des jeux de règles à appliquer");

StringBuilder requete = new StringBuilder();
Expand All @@ -72,15 +70,15 @@ public static ArrayList<JeuDeRegle> recupJeuDeRegle(Connection connexion, String

Map<String,List<String>> g=new GenericBean(UtilitaireDao.get(0).executeRequest(connexion, new ArcPreparedStatementBuilder(requete))).mapContent();

ArrayList<JeuDeRegle> listJdr = extractRuleSetObjects(g);
List<JeuDeRegle> listJdr = extractRuleSetObjects(g);

StaticLoggerDispatcher.info(LOGGER, "J'ai trouvé " + listJdr.size() + " jeux de règle, utiles pour controler");
return listJdr;
}

private static ArrayList<JeuDeRegle> extractRuleSetObjects(Map<String, List<String>> g) throws ArcException {
private static List<JeuDeRegle> extractRuleSetObjects(Map<String, List<String>> g) throws ArcException {
SimpleDateFormat formatDate = new SimpleDateFormat(ArcDateFormat.DATE_FORMAT_CONVERSION.getApplicationFormat());
ArrayList<JeuDeRegle> listJdr = new ArrayList<>();
List<JeuDeRegle> listJdr = new ArrayList<>();
if (!g.isEmpty())
{
for (int i=0;i<g.get("id_norme").size();i++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ private RegleDao() {

private static final Logger logger = LogManager.getLogger(RegleDao.class);

public static ArrayList<RegleControleEntity> getRegle(Connection connexion, String tableRegle, String tableIn)
public static List<RegleControleEntity> getRegle(Connection connexion, String tableRegle, String tableIn)
throws ArcException {
StaticLoggerDispatcher.debug(logger, "getRegle");

ArrayList<RegleControleEntity> listRegle = new ArrayList<>();
List<RegleControleEntity> listRegle = new ArrayList<>();

ArcPreparedStatementBuilder sb = new ArcPreparedStatementBuilder();
sb.append("SELECT id_regle, id_classe, ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ protected static Map<Integer, List<Integer>> dispatchFilesByNodId(List<String> l
*/
private static List<ScalableConnection> prepareThreads(int executorNodTarget, int parallelDegree,
String anEnvExecution, String restrictedUsername) {
ArrayList<ScalableConnection> connexionList = new ArrayList<>();
List<ScalableConnection> connexionList = new ArrayList<>();
try {

// add thread connexions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private void applyExpressions() throws ArcException {

// Checks expression validity
ExpressionService expressionService = new ExpressionService();
ArrayList<JeuDeRegle> allRuleSets = JeuDeRegleDao.recupJeuDeRegle(connexion, ViewEnum.JEUDEREGLE.getFullName(anExecutionEnvironment));
List<JeuDeRegle> allRuleSets = JeuDeRegleDao.recupJeuDeRegle(connexion, ViewEnum.JEUDEREGLE.getFullName(anExecutionEnvironment));
for (JeuDeRegle ruleSet : allRuleSets) {
// Check
GenericBean expressions = expressionService.fetchExpressions(connexion, anExecutionEnvironment, ruleSet);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private FilesDescriber findDuplicates(FilesDescriber fileList) throws ArcExcepti
dao.execQueryInsertCorruptedArchiveInPilotage(content);

List<String> listContainerDoublons = new ArrayList<>();
ArrayList<String> listVersionContainerDoublons = new ArrayList<>();
List<String> listVersionContainerDoublons = new ArrayList<>();

dao.execQueryVersionDuplicateArchives(listContainerDoublons, listVersionContainerDoublons);

Expand All @@ -118,7 +118,7 @@ private FilesDescriber findDuplicates(FilesDescriber fileList) throws ArcExcepti
}

private void markArchivesVersion(FilesDescriber content, List<String> listContainerDoublons,
ArrayList<String> listVersionContainerDoublons) {
List<String> listVersionContainerDoublons) {

// set the num

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private void clefValeurToXml(Map<String, String> arbreFormat, InputStream tmpInx
* @throws IOException
* @throws ArcException
*/
private ArrayList<String> initialisationOutputStream(Map<String, String> arbreFormat, Map<String, List<String>> mapRubriquesFilles,
private List<String> initialisationOutputStream(Map<String, String> arbreFormat, Map<String, List<String>> mapRubriquesFilles,
String ligne) throws ArcException {
// ecriture de l'entete du fichier

Expand All @@ -190,7 +190,7 @@ private ArrayList<String> initialisationOutputStream(Map<String, String> arbreFo
if (!arbreFormat.containsKey(rubrique)) {
throw new ArcException(ArcExceptionMessage.LOAD_KEYVALUE_VAR_NOT_EXISTS_IN_FORMAT_RULES, rubrique);
}
ArrayList<String> listePeresRubriqueCourante = new ArrayList<>();
List<String> listePeresRubriqueCourante = new ArrayList<>();
// On remonte dans l'arbre des pères jusqu'à la racine
while (rubrique != null) {
listePeresRubriqueCourante.add(rubrique);
Expand Down Expand Up @@ -227,7 +227,7 @@ private ArrayList<String> initialisationOutputStream(Map<String, String> arbreFo
* @throws IOException
* @throws ArcException
*/
private ArrayList<String> lectureLigne(Map<String, String> arbreFormat,
private List<String> lectureLigne(Map<String, String> arbreFormat,
List<String> listePeresRubriquePrecedante, Map<String, List<String>> mapRubriquesFilles, String ligne)
throws ArcException
{
Expand All @@ -252,7 +252,7 @@ private ArrayList<String> lectureLigne(Map<String, String> arbreFormat,
if (!arbreFormat.containsKey(pere)) {
throw new ArcException(ArcExceptionMessage.LOAD_KEYVALUE_VAR_NOT_EXISTS_IN_FORMAT_RULES, rubrique);
}
ArrayList<String> listePeresRubriqueCourante = new ArrayList<>();
List<String> listePeresRubriqueCourante = new ArrayList<>();
while (pere != null) {
listePeresRubriqueCourante.add(pere);
pere = arbreFormat.get(pere);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,8 @@ public void execution() throws ArcException {
java.util.Date beginDate = new java.util.Date();

// Création de la table de stockage
XMLComplexeHandlerCharger handler = new XMLComplexeHandlerCharger();
handler.fileName = fileName;
handler.connexion = connexion;
handler.tempTableA = this.tableTempA;
handler.normeCourante = norme;
handler.validite = validite;
handler.tempTableAColumnsLongName = this.tempTableAColumnsLongName;
handler.tempTableAColumnsShortName = this.tempTableAColumnsShortName;
handler.format = this.format;

XMLComplexeHandlerCharger handler = new XMLComplexeHandlerCharger(connexion, fileName, norme, validite, this.tableTempA,
this.tempTableAColumnsLongName, this.tempTableAColumnsShortName, format);
// appel du parser et gestion d'erreur
try {
SAXParser saxParser = SecuredSaxParser.buildSecuredSaxParser();
Expand All @@ -189,7 +181,7 @@ public void execution() throws ArcException {
throw businessException;
}

this.jointure = handler.jointure;
this.jointure = handler.getJointure();

java.util.Date endDate = new java.util.Date();
StaticLoggerDispatcher.info(LOGGER, "** execution temps" + (endDate.getTime() - beginDate.getTime()) + " ms");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import javax.xml.parsers.ParserConfigurationException;
Expand Down Expand Up @@ -35,10 +36,10 @@ public class ArbreFormat {
private Map<String, String> arbreHierachieDuFichier;

//éléments terminaux
private ArrayList<String> feuilles = new ArrayList<>();
private List<String> feuilles = new ArrayList<>();

//éléments intermédiaire
private ArrayList<String> branches = new ArrayList<>();
private List<String> branches = new ArrayList<>();

public ArbreFormat(Norme aNorme) throws ArcException {
super();
Expand Down Expand Up @@ -81,8 +82,8 @@ private void calculerFeuilles(){
/*
* Retourne la liste des pères d'un élément
*/
public ArrayList<String> getPeres (String fils){
ArrayList<String> listePere = new ArrayList<String>();
public List<String> getPeres (String fils){
List<String> listePere = new ArrayList<>();
listePere.add(fils);
String pere = this.arbreHierachieDuFichier.get(fils);

Expand Down Expand Up @@ -112,28 +113,28 @@ public void setArbreFormat(Map<String, String> arbreFormat) {
/**
* @return the feuilles
*/
public ArrayList<String> getFeuilles() {
public List<String> getFeuilles() {
return feuilles;
}

/**
* @param feuilles the feuilles to set
*/
public void setFeuilles(ArrayList<String> feuilles) {
public void setFeuilles(List<String> feuilles) {
this.feuilles = feuilles;
}

/**
* @return the branches
*/
public ArrayList<String> getBranches() {
public List<String> getBranches() {
return branches;
}

/**
* @param feuilles the feuilles to set
*/
public void setBranches(ArrayList<String> branches) {
public void setBranches(List<String> branches) {
this.branches = branches;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.xml.sax.Attributes;
Expand All @@ -27,7 +28,7 @@ public class FormatFichierHandler extends DefaultHandler {
private Map<String, String> arbre = new HashMap<>();

//la liste des pères de l'éléments courant
private ArrayList<String> listePere = new ArrayList<>();
private List<String> listePere = new ArrayList<>();

@Override
public void startDocument() throws SAXException {
Expand Down
Loading

0 comments on commit 3f57fc4

Please sign in to comment.