Skip to content

Commit

Permalink
feat: refactor createFamilyMappingTables
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolife999 committed Sep 6, 2024
1 parent 869e916 commit 8a8e55c
Showing 1 changed file with 23 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void execute(SendResponse resp) throws ArcException {
createWsTables();

// create tables to retrieve family data table
createMetaFamilyTables();
createFamilyMappingTables();

// create data table in an asynchronous parallel thread
startTableCreationInParallel();
Expand All @@ -72,22 +72,28 @@ public void execute(SendResponse resp) throws ArcException {
* 3. return the list of family data table to retrieve
* @throws ArcException
*/
private void createMetaFamilyTables() throws ArcException {
if (!arcClientIdentifier.getEnvironnement().equalsIgnoreCase(SchemaEnum.ARC_METADATA.getSchemaName())) {

if (!clientDao.verificationClientFamille()) {
throw new ArcException(ArcExceptionMessage.WS_RETRIEVE_DATA_FAMILY_FORBIDDEN);
}

clientDao.createTableOfIdSource();
tablesMetierNames = clientDao.selectBusinessDataTables();

// filter Mapping tables if any filter declared
if (!arcClientIdentifier.getMappingTablesFilter().isEmpty())
{
tablesMetierNames.retainAll(arcClientIdentifier.getMappingTablesFilter());
}

private void createFamilyMappingTables() throws ArcException {

// mapping tables can only be requested on sandbox environments
if (arcClientIdentifier.getEnvironnement().equalsIgnoreCase(SchemaEnum.ARC_METADATA.getSchemaName())) {
return;
}

// check if client is allowed to retrieve family data
if (!clientDao.verificationClientFamille()) {
throw new ArcException(ArcExceptionMessage.WS_RETRIEVE_DATA_FAMILY_FORBIDDEN);
}

// create the table that contains the list of files to be retrieved
clientDao.createTableOfIdSource();

// get the family mapping tables name to be retrieved
tablesMetierNames = clientDao.selectBusinessDataTables();

// filter the mapping tables if any filter declared
if (!arcClientIdentifier.getMappingTablesFilter().isEmpty())
{
tablesMetierNames.retainAll(arcClientIdentifier.getMappingTablesFilter());
}
}

Expand Down

0 comments on commit 8a8e55c

Please sign in to comment.