Skip to content

Commit

Permalink
feat: ext_etat_jeuderegle in data retrieval webservice
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolife999 committed Dec 13, 2024
1 parent 1e9fb9f commit da0ef31
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ public enum ArcExceptionMessage {

PARQUET_EXPORT_FAILED("L'export en parquet a échoué"),

HOST_NOT_RESOLVED("Hôte non résolu")
HOST_NOT_RESOLVED("Hôte non résolu"),
CONNEXION_NOT_SECURE("La connection n'est pas sécurisée")

;

private String message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ public void run() {
executeIfSourceDeclared(ExportSource.MAPPING, () -> tablesToExport.addAll(createImages(tablesMetierNames)));
executeIfSourceDeclared(ExportSource.METADATA, () -> tablesToExport.addAll(clientDao.createTableMetier()));
executeIfSourceDeclared(ExportSource.METADATA, () -> tablesToExport.addAll(clientDao.createTableVarMetier()));
executeIfSourceDeclared(ExportSource.METADATA, () -> tablesToExport.addAll(clientDao.createTableExtEtatJeuDeRegle()));
}

executeIfSourceDeclared(ExportSource.NOMENCLATURE, () -> tablesToExport.addAll(clientDao.createTableNmcl()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import fr.insee.arc.utils.database.TableToRetrieve;
import fr.insee.arc.utils.exception.ArcException;
import fr.insee.arc.utils.exception.ArcExceptionMessage;
import fr.insee.arc.utils.utils.LoggerHelper;
import fr.insee.arc.ws.services.importServlet.actions.SendResponse;
import fr.insee.arc.ws.services.importServlet.bo.ArcClientIdentifier;
import fr.insee.arc.ws.services.importServlet.bo.ExportTrackingType;
Expand Down Expand Up @@ -44,6 +45,8 @@ public void execute(SendResponse resp) throws ArcException {
TableToRetrieve table = this.clientDao.getAClientTableByType(ExportTrackingType.DATA);

if (table.getTableName() != null) {

LoggerHelper.info(LOGGER, "Table " + table.getTableName() + " had been required by the client.");

StringBuilder type = new StringBuilder();

Expand All @@ -60,23 +63,31 @@ public void execute(SendResponse resp) throws ArcException {
}
}

LoggerHelper.info(LOGGER, "Table metadata is " + type + ".");


String output = table.getTableName() + " " + type;

// renvoie un nom de table du client si il en reste une
resp.send(output);
resp.endSending();

return;
}

// if no data table found, get source table to register
table = this.clientDao.getAClientTableByType(ExportTrackingType.ID_SOURCE);

if (table.getTableName() != null) {

LoggerHelper.info(LOGGER, "Table ID_SOURCE : " + table.getTableName() + " had been required by the client.");

if (!reprise) {
this.clientDao.updatePilotage(table.getTableName());
}

this.clientDao.dropTable(table);

}

table = this.clientDao.getAClientTableByType(ExportTrackingType.TRACK);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,27 @@ public List<TableToRetrieve> createTableVarMetier() throws ArcException {
registerTableToBeRetrieved(ExportTrackingType.DATA, ArcDatabase.COORDINATOR, nomTableImage);

return Arrays.asList(new TableToRetrieve(ArcDatabase.COORDINATOR, nomTableImage));
}

/**
* Create image of model tables
* @throws ArcException
*/
public List<TableToRetrieve> createTableExtEtatJeuDeRegle() throws ArcException {
LoggerHelper.debugAsComment(LOGGER, "ClientDaoImpl.createExtEtatJeuDeRegle()");

String nomTableImage = TableNaming.buildTableNameWithTokens(environnement, ViewEnum.EXT_ETAT_JEUDEREGLE, client,
timestamp);

ArcPreparedStatementBuilder requete = new ArcPreparedStatementBuilder();
requete.append("CREATE TABLE " + nomTableImage + FormatSQL.WITH_NO_VACUUM + " AS");
requete.append("\n SELECT * FROM " + ViewEnum.EXT_ETAT_JEUDEREGLE.getFullName(environnement));
requete.append(";");
UtilitaireDao.get(0).executeRequest(connection, requete);

registerTableToBeRetrieved(ExportTrackingType.DATA, ArcDatabase.COORDINATOR, nomTableImage);

return Arrays.asList(new TableToRetrieve(ArcDatabase.COORDINATOR, nomTableImage));


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static void securityAccessAndTracing(String familyName, String clientReal
// forbidden
if (hostDeclaredAsSecured && !requestSecured) {
LoggerHelper.error(LOGGER, hostName + " connexion is not secured. Abort.");
throw new ArcException(ArcExceptionMessage.HOST_NOT_RESOLVED);
throw new ArcException(ArcExceptionMessage.CONNEXION_NOT_SECURE);
}

// log the access
Expand Down

0 comments on commit da0ef31

Please sign in to comment.