Skip to content

Commit

Permalink
feat: naming convention to add archunit
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolife999 committed Oct 11, 2023
1 parent 1e515a4 commit bb53013
Show file tree
Hide file tree
Showing 69 changed files with 1,964 additions and 1,463 deletions.
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ All notable changes to this project will be documented in this file.

## version-93.1.10b
- tablebucket fix for webservice for data retrieval

## version-93.1.8b
- the webservice for data retrieval now delete the client pending data tables at the start of a new invoke
- handshake implementation during the creation of client data table to avoid timeout

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package fr.insee.arc.core.service.p2chargement.bo;
package fr.insee.arc.core.service.global.bo;

import java.util.Date;

import fr.insee.arc.core.service.global.dao.DateConversion;
import fr.insee.arc.core.service.p2chargement.bo.IdCardChargement;

public class FileIdCard {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,50 @@ public GenericQueryDao(Connection connection) {
private Connection connection;
private ArcPreparedStatementBuilder query;

public void initialize()
public GenericQueryDao initialize()
{
query = new ArcPreparedStatementBuilder();
return this;
}

public void addOperation(ArcPreparedStatementBuilder newQuery)
public GenericQueryDao addOperation(ArcPreparedStatementBuilder newQuery)
{
query.append(newQuery);
return this;
}

public void addOperation(String newQuery)
public GenericQueryDao addOperation(String newQuery)
{
query.append(new ArcPreparedStatementBuilder(newQuery));
query.append(newQuery);
return this;
}

public void addOperation(StringBuilder newQuery)
public GenericQueryDao addOperation(StringBuilder newQuery)
{
query.append(new ArcPreparedStatementBuilder(newQuery));
query.append(newQuery);
return this;
}

public void executeWithParameters() throws ArcException {
UtilitaireDao.get(0).executeRequest(connection, query);
}

public void executeAsTransaction() throws ArcException
{
UtilitaireDao.get(0).executeBlock(this.connection, query.getQueryWithParameters());
initialize();
UtilitaireDao.get(0).executeImmediate(this.connection, query.asTransaction().getQueryWithParameters());
}

public void executeNoParameters() throws ArcException {
UtilitaireDao.get(0).executeImmediate(connection, query);
}

public ArcPreparedStatementBuilder getQuery() {
return query;
}

public void setQuery(ArcPreparedStatementBuilder query) {
this.query = query;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import fr.insee.arc.core.dataobjects.ViewEnum;
import fr.insee.arc.core.model.TraitementPhase;
import fr.insee.arc.core.service.global.bo.ArcDateFormat;
import fr.insee.arc.core.service.p2chargement.bo.FileIdCard;
import fr.insee.arc.core.service.global.bo.FileIdCard;
import fr.insee.arc.utils.dao.UtilitaireDao;
import fr.insee.arc.utils.exception.ArcException;
import fr.insee.arc.utils.structure.GenericBean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ public static String createTableInherit(String tableIn, String tableIdSource) {
*/
public static String createTableTravailIdSource(String tableIn, String tableOut, String idSource,
String extraCols) throws ArcException {

return createTableTravail(HashFileNameConversion.tableOfIdSource(tableIn, idSource), tableOut, extraCols);

}

/**
* This query created a work table containing the copy of a data of an input table input provided output table
* @param tableIn : the input table
* @param tableOut : the output table
* @param extraCols : sql syntax for extracols to be created
* sql syntax : defaultvalue_col1 as my_col1, defaultvalue_col2 as my_col2,, ...
* @return
* @throws ArcException
*/
public static String createTableTravail(String tableIn, String tableOut, String extraCols) {
StringBuilder requete = new StringBuilder();
requete.append("\n CREATE ");
if (!tableOut.contains(".")) {
Expand All @@ -71,11 +86,12 @@ public static String createTableTravailIdSource(String tableIn, String tableOut,
requete.append(", " + extraCols);
}

requete.append("\n FROM " + HashFileNameConversion.tableOfIdSource(tableIn, idSource) + "; ");
requete.append("\n FROM " + tableIn + "; ");

return requete.toString();
}



/**
* This query created a work table containing the copy of a data of an input table for a given file identifier
* @param tableIn
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.insee.arc.core.service.p2chargement.engine;
package fr.insee.arc.core.service.p2chargement.bo;

import fr.insee.arc.utils.exception.ArcException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
import fr.insee.arc.core.model.TraitementEtat;
import fr.insee.arc.core.model.TraitementPhase;
import fr.insee.arc.core.service.global.ApiService;
import fr.insee.arc.core.service.global.bo.FileIdCard;
import fr.insee.arc.core.service.global.bo.Sandbox;
import fr.insee.arc.core.service.p2chargement.bo.CSVFileAttributes;
import fr.insee.arc.core.service.p2chargement.bo.CSVFormatRules;
import fr.insee.arc.core.service.p2chargement.bo.FileIdCard;
import fr.insee.arc.core.service.p2chargement.engine.ParseFormatRulesOperation;
import fr.insee.arc.core.service.p2chargement.operation.ParseFormatRulesOperation;
import fr.insee.arc.utils.dao.SQL;
import fr.insee.arc.utils.dao.UtilitaireDao;
import fr.insee.arc.utils.exception.ArcException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import fr.insee.arc.core.model.TraitementEtat;
import fr.insee.arc.core.model.TraitementPhase;
import fr.insee.arc.core.service.global.ApiService;
import fr.insee.arc.core.service.global.bo.FileIdCard;
import fr.insee.arc.core.service.global.bo.Sandbox;
import fr.insee.arc.core.service.p2chargement.bo.FileIdCard;
import fr.insee.arc.core.service.p2chargement.bo.XMLColumns;
import fr.insee.arc.core.util.StaticLoggerDispatcher;
import fr.insee.arc.utils.dao.UtilitaireDao;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.xml.sax.SAXParseException;

import fr.insee.arc.core.dataobjects.ColumnEnum;
import fr.insee.arc.core.service.p2chargement.bo.FileIdCard;
import fr.insee.arc.core.service.global.bo.FileIdCard;
import fr.insee.arc.core.service.p2chargement.bo.XMLColumns;
import fr.insee.arc.core.service.p2chargement.xmlhandler.ParallelInsert;
import fr.insee.arc.core.service.p2chargement.xmlhandler.TreeFunctions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import fr.insee.arc.core.service.p2chargement.engine.ChargeurCSV;
import fr.insee.arc.core.service.p2chargement.engine.ChargeurClefValeur;
import fr.insee.arc.core.service.p2chargement.engine.ChargeurXml;
import fr.insee.arc.core.service.p2chargement.engine.ChargeurXmlComplexe;
import fr.insee.arc.core.service.p2chargement.engine.IChargeur;
import fr.insee.arc.core.service.p2chargement.bo.IChargeur;
import fr.insee.arc.core.service.p2chargement.operation.ChargeurCSV;
import fr.insee.arc.core.service.p2chargement.operation.ChargeurClefValeur;
import fr.insee.arc.core.service.p2chargement.operation.ChargeurXml;
import fr.insee.arc.core.service.p2chargement.operation.ChargeurXmlComplexe;
import fr.insee.arc.core.service.p2chargement.thread.ThreadChargementService;
import fr.insee.arc.core.util.StaticLoggerDispatcher;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
package fr.insee.arc.core.service.p2chargement.engine;
package fr.insee.arc.core.service.p2chargement.operation;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import fr.insee.arc.core.dataobjects.ArcPreparedStatementBuilder;
import fr.insee.arc.core.dataobjects.ColumnEnum;
import fr.insee.arc.core.service.p2chargement.bo.FileIdCard;
import fr.insee.arc.core.service.global.bo.FileIdCard;
import fr.insee.arc.core.service.p2chargement.bo.NormeRules;
import fr.insee.arc.core.util.StaticLoggerDispatcher;
import fr.insee.arc.utils.dao.UtilitaireDao;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.insee.arc.core.service.p2chargement.engine;
package fr.insee.arc.core.service.p2chargement.operation;

import java.io.BufferedReader;
import java.io.IOException;
Expand All @@ -13,10 +13,11 @@

import fr.insee.arc.core.model.Delimiters;
import fr.insee.arc.core.model.TraitementPhase;
import fr.insee.arc.core.service.global.bo.FileIdCard;
import fr.insee.arc.core.service.global.bo.Sandbox;
import fr.insee.arc.core.service.p2chargement.bo.CSVFileAttributes;
import fr.insee.arc.core.service.p2chargement.bo.CSVFormatRules;
import fr.insee.arc.core.service.p2chargement.bo.FileIdCard;
import fr.insee.arc.core.service.p2chargement.bo.IChargeur;
import fr.insee.arc.core.service.p2chargement.dao.ChargeurCsvDao;
import fr.insee.arc.core.service.p2chargement.thread.ThreadChargementService;
import fr.insee.arc.core.util.StaticLoggerDispatcher;
Expand Down Expand Up @@ -55,15 +56,15 @@ public ChargeurCSV(ThreadChargementService threadChargementService) {

this.sandbox = new Sandbox(threadChargementService.getConnexion().getExecutorConnection(),
threadChargementService.getEnvExecution());
this.fileIdCard = threadChargementService.fileIdCard;
this.fileIdCard = threadChargementService.getFileIdCard();
this.fileAttributes = new CSVFileAttributes();
this.parser = new ParseFormatRulesOperation<>(fileIdCard, CSVFormatRules.class);
this.dao = new ChargeurCsvDao(this.sandbox, this.fileAttributes, this.fileIdCard, this.parser);

this.tableChargementPilTemp = threadChargementService.getTableChargementPilTemp();
this.currentPhase = threadChargementService.getCurrentPhase();
this.streamContent = threadChargementService.filesInputStreamLoad.getTmpInxCSV();
this.streamHeader = threadChargementService.filesInputStreamLoad.getTmpInxChargement();
this.streamContent = threadChargementService.getFilesInputStreamLoad().getTmpInxCSV();
this.streamHeader = threadChargementService.getFilesInputStreamLoad().getTmpInxChargement();

}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.insee.arc.core.service.p2chargement.engine;
package fr.insee.arc.core.service.p2chargement.operation;

import java.io.BufferedReader;
import java.io.IOException;
Expand All @@ -17,7 +17,8 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import fr.insee.arc.core.service.p2chargement.bo.FileIdCard;
import fr.insee.arc.core.service.global.bo.FileIdCard;
import fr.insee.arc.core.service.p2chargement.bo.IChargeur;
import fr.insee.arc.core.service.p2chargement.thread.ThreadChargementService;
import fr.insee.arc.core.service.p2chargement.xmlhandler.ArbreFormat;
import fr.insee.arc.core.util.StaticLoggerDispatcher;
Expand Down Expand Up @@ -46,8 +47,8 @@ public class ChargeurClefValeur implements IChargeur {
public ChargeurClefValeur(ThreadChargementService threadChargementService) {
super();

this.tmpInxChargement = threadChargementService.filesInputStreamLoad.getTmpInxChargement();
this.fileIdCard = threadChargementService.fileIdCard;
this.tmpInxChargement = threadChargementService.getFilesInputStreamLoad().getTmpInxChargement();
this.fileIdCard = threadChargementService.getFileIdCard();
this.chargeurXml = new ChargeurXml(threadChargementService);
this.envExecution = threadChargementService.getEnvExecution();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.insee.arc.core.service.p2chargement.engine;
package fr.insee.arc.core.service.p2chargement.operation;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -11,8 +11,9 @@
import org.xml.sax.SAXException;

import fr.insee.arc.core.model.TraitementPhase;
import fr.insee.arc.core.service.global.bo.FileIdCard;
import fr.insee.arc.core.service.global.bo.Sandbox;
import fr.insee.arc.core.service.p2chargement.bo.FileIdCard;
import fr.insee.arc.core.service.p2chargement.bo.IChargeur;
import fr.insee.arc.core.service.p2chargement.dao.ChargeurXMLDao;
import fr.insee.arc.core.service.p2chargement.thread.ThreadChargementService;
import fr.insee.arc.core.service.p2chargement.xmlhandler.XMLHandlerCharger4;
Expand Down Expand Up @@ -56,12 +57,12 @@ public class ChargeurXml implements IChargeur {
public ChargeurXml(ThreadChargementService threadChargementService) {
this.sandbox = new Sandbox(threadChargementService.getConnexion().getExecutorConnection(),
threadChargementService.getEnvExecution());
this.fileIdCard = threadChargementService.fileIdCard;
this.fileIdCard = threadChargementService.getFileIdCard();
this.tableTempA = threadChargementService.getTableTempA();

this.tableChargementPilTemp = threadChargementService.getTableChargementPilTemp();
this.currentPhase = threadChargementService.getCurrentPhase();
this.f = threadChargementService.filesInputStreamLoad.getTmpInxChargement();
this.f = threadChargementService.getFilesInputStreamLoad().getTmpInxChargement();
dao = new ChargeurXMLDao(sandbox, fileIdCard);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.insee.arc.core.service.p2chargement.engine;
package fr.insee.arc.core.service.p2chargement.operation;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -15,8 +15,9 @@

import fr.insee.arc.core.model.Delimiters;
import fr.insee.arc.core.model.TraitementPhase;
import fr.insee.arc.core.service.global.bo.FileIdCard;
import fr.insee.arc.core.service.global.bo.Sandbox;
import fr.insee.arc.core.service.p2chargement.bo.FileIdCard;
import fr.insee.arc.core.service.p2chargement.bo.IChargeur;
import fr.insee.arc.core.service.p2chargement.dao.ChargeurXMLDao;
import fr.insee.arc.core.service.p2chargement.thread.ThreadChargementService;
import fr.insee.arc.core.service.p2chargement.xmlhandler.XMLComplexeHandlerCharger;
Expand Down Expand Up @@ -60,8 +61,8 @@ public ChargeurXmlComplexe(ThreadChargementService threadChargementService) {
this.tableTempA = threadChargementService.getTableTempA();
this.tableChargementPilTemp = threadChargementService.getTableChargementPilTemp();
this.currentPhase = threadChargementService.getCurrentPhase();
this.f = threadChargementService.filesInputStreamLoad.getTmpInxChargement();
this.fileIdCard = threadChargementService.fileIdCard;
this.f = threadChargementService.getFilesInputStreamLoad().getTmpInxChargement();
this.fileIdCard = threadChargementService.getFileIdCard();

dao = new ChargeurXMLDao(sandbox, fileIdCard);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package fr.insee.arc.core.service.p2chargement.engine;
package fr.insee.arc.core.service.p2chargement.operation;

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

import fr.insee.arc.core.service.p2chargement.bo.FileIdCard;
import fr.insee.arc.core.service.global.bo.FileIdCard;
import fr.insee.arc.core.service.p2chargement.bo.IParseFormatRules;
import fr.insee.arc.utils.utils.ManipString;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import fr.insee.arc.core.dataobjects.ViewEnum;
import fr.insee.arc.core.model.TraitementEtat;
import fr.insee.arc.core.model.TraitementRapport;
import fr.insee.arc.core.service.global.bo.FileIdCard;
import fr.insee.arc.core.service.global.dao.DatabaseConnexionConfiguration;
import fr.insee.arc.core.service.global.dao.HashFileNameConversion;
import fr.insee.arc.core.service.global.dao.PilotageOperations;
Expand All @@ -26,18 +27,15 @@
import fr.insee.arc.core.service.p2chargement.archiveloader.ArchiveChargerFactory;
import fr.insee.arc.core.service.p2chargement.archiveloader.FilesInputStreamLoad;
import fr.insee.arc.core.service.p2chargement.archiveloader.IArchiveFileLoader;
import fr.insee.arc.core.service.p2chargement.bo.FileIdCard;
import fr.insee.arc.core.service.p2chargement.bo.NormeRules;
import fr.insee.arc.core.service.p2chargement.bo.IChargeur;
import fr.insee.arc.core.service.p2chargement.bo.IdCardChargement;
import fr.insee.arc.core.service.p2chargement.engine.ChargementBrut;
import fr.insee.arc.core.service.p2chargement.engine.IChargeur;
import fr.insee.arc.core.service.p2chargement.factory.ChargeurFactory;
import fr.insee.arc.core.service.p2chargement.factory.TypeChargement;
import fr.insee.arc.core.service.p2chargement.operation.ChargementBrut;
import fr.insee.arc.core.util.StaticLoggerDispatcher;
import fr.insee.arc.utils.dao.UtilitaireDao;
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.FormatSQL;
import fr.insee.arc.utils.utils.LoggerHelper;
import fr.insee.arc.utils.utils.Sleep;
Expand All @@ -59,9 +57,9 @@ public class ThreadChargementService extends ApiChargementService implements Run

private ThreadOperations arcThreadGenericDao;

public FilesInputStreamLoad filesInputStreamLoad;
private FilesInputStreamLoad filesInputStreamLoad;

public FileIdCard fileIdCard;
private FileIdCard fileIdCard;

protected String tableChargementOK;

Expand Down Expand Up @@ -405,6 +403,14 @@ public FileIdCard getFileIdCard() {
public void setFileIdCard(FileIdCard fileIdCard) {
this.fileIdCard = fileIdCard;
}

public FilesInputStreamLoad getFilesInputStreamLoad() {
return filesInputStreamLoad;
}

public void setFilesInputStreamLoad(FilesInputStreamLoad filesInputStreamLoad) {
this.filesInputStreamLoad = filesInputStreamLoad;
}



Expand Down
Loading

0 comments on commit bb53013

Please sign in to comment.