Skip to content

Commit

Permalink
Merge pull request #37 from abes-esr/develop
Browse files Browse the repository at this point in the history
merge dev to test
  • Loading branch information
pierre-maraval authored Sep 10, 2024
2 parents b9e2ce0 + 3ee5fb4 commit 624e24e
Show file tree
Hide file tree
Showing 33 changed files with 251 additions and 927 deletions.
5 changes: 3 additions & 2 deletions batch/pom.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>itembackoffice</artifactId>
<groupId>fr.abes.item</groupId>
<version>2.4.12-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
Expand Down
120 changes: 55 additions & 65 deletions batch/src/main/java/fr/abes/item/batch/JobConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import fr.abes.item.batch.webstats.VerifierParamsTasklet;
import fr.abes.item.core.configuration.factory.StrategyFactory;
import fr.abes.item.core.constant.Constant;
import fr.abes.item.core.service.FileSystemStorageService;
import fr.abes.item.core.constant.TYPE_DEMANDE;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobParametersIncrementer;
Expand Down Expand Up @@ -52,7 +52,6 @@ public class JobConfiguration {

private final ProxyRetry proxyRetry;

private final FileSystemStorageService storageService;

@Value("${batch.min.hour}")
int minHour;
Expand All @@ -68,10 +67,9 @@ public class JobConfiguration {
@Value("${batch.nbPpnInFileResult}")
private Integer nbPpnInFileResult;

public JobConfiguration(StrategyFactory strategyFactory, ProxyRetry proxyRetry, FileSystemStorageService storageService) {
public JobConfiguration(StrategyFactory strategyFactory, ProxyRetry proxyRetry) {
this.strategyFactory = strategyFactory;
this.proxyRetry = proxyRetry;
this.storageService = storageService;
}

@Bean
Expand All @@ -95,13 +93,13 @@ public LignesFichierWriter writer() {

// ------------- TASKLETS -----------------------
@Bean
public Tasklet getNextDemandeModifTasklet() { return new GetNextDemandeModifTasklet(strategyFactory, minHour, maxHour); }
public Tasklet getNextDemandeModifTasklet() { return new GetNextDemandeTasklet(strategyFactory, minHour, maxHour, TYPE_DEMANDE.MODIF); }
@Bean
public Tasklet getNextDemandeExempTasklet() { return new GetNextDemandeExempTasklet(strategyFactory, minHour, maxHour); }
public Tasklet getNextDemandeExempTasklet() { return new GetNextDemandeTasklet(strategyFactory, minHour, maxHour, TYPE_DEMANDE.EXEMP); }
@Bean
public Tasklet getNextDemandeRecouvTasklet() { return new GetNextDemandeRecouvTasklet(strategyFactory, minHour, maxHour); }
public Tasklet getNextDemandeRecouvTasklet() { return new GetNextDemandeTasklet(strategyFactory, minHour, maxHour, TYPE_DEMANDE.RECOUV); }
@Bean
public Tasklet getNextDemandeSuppTasklet() { return new GetNextDemandeSuppTasklet(strategyFactory, minHour, maxHour); }
public Tasklet getNextDemandeSuppTasklet() { return new GetNextDemandeTasklet(strategyFactory, minHour, maxHour, TYPE_DEMANDE.SUPP); }
@Bean
public Tasklet lireLigneFichierTasklet() { return new LireLigneFichierTasklet(strategyFactory, mailAdmin); }
@Bean
Expand All @@ -121,44 +119,40 @@ public Tasklet authentifierSurSudocTasklet()

//Archivage automatique des demandes
@Bean
Tasklet archiveDemandesExempTakslet(){
return new ArchiveDemandesExempTakslet(strategyFactory);
}
Tasklet archiveDemandesExempTakslet(){ return new ArchiveDemandesTakslet(strategyFactory, TYPE_DEMANDE.EXEMP); }
@Bean
Tasklet archiveDemandesModifTasklet(){
return new ArchiveDemandesModifTasklet(strategyFactory);
}
Tasklet archiveDemandesModifTasklet(){ return new ArchiveDemandesTakslet(strategyFactory, TYPE_DEMANDE.MODIF); }
@Bean
Tasklet archiveDemandesRecouvTasklet(){
return new ArchiveDemandesRecouvTasklet(strategyFactory);
}
Tasklet archiveDemandesRecouvTasklet(){ return new ArchiveDemandesTakslet(strategyFactory, TYPE_DEMANDE.RECOUV); }
@Bean
Tasklet archiveDemandesSuppTasklet(){ return new ArchiveDemandesTakslet(strategyFactory, TYPE_DEMANDE.SUPP); }

//Passage en statut supprimé automatique des demandes
@Bean
Tasklet deleteStatusDemandesExempTasklet(){
return new DeleteStatusDemandesExempTasklet(strategyFactory);
}
Tasklet deleteStatusDemandesExempTasklet(){ return new DeleteStatusDemandesTasklet(strategyFactory, TYPE_DEMANDE.EXEMP); }
@Bean
Tasklet deleteStatusDemandesModifTasklet(){
return new DeleteStatusDemandesModifTasklet(strategyFactory);
}
Tasklet deleteStatusDemandesModifTasklet(){ return new DeleteStatusDemandesTasklet(strategyFactory, TYPE_DEMANDE.MODIF); }
@Bean
Tasklet deleteStatusDemandesRecouvTasklet(){
return new DeleteStatusDemandesRecouvTasklet(strategyFactory);
}
Tasklet deleteStatusDemandesRecouvTasklet(){ return new DeleteStatusDemandesTasklet(strategyFactory, TYPE_DEMANDE.RECOUV); }
@Bean
Tasklet deleteStatusDemandesSuppTasklet() { return new DeleteStatusDemandesTasklet(strategyFactory, TYPE_DEMANDE.SUPP); }

//Suppression définitive des demandes
@Bean
Tasklet deleteDemandesExempTasklet(){
return new DeleteDemandesExempTasklet(strategyFactory, storageService, uploadPath);
return new DeleteDemandesTasklet(strategyFactory, TYPE_DEMANDE.EXEMP);
}
@Bean
Tasklet deleteDemandesModifTasklet(){
return new DeleteDemandesModifTasklet(strategyFactory, storageService, uploadPath);
return new DeleteDemandesTasklet(strategyFactory, TYPE_DEMANDE.MODIF);
}
@Bean
Tasklet deleteDemandesRecouvTasklet(){
return new DeleteDemandesRecouvTasklet(strategyFactory, storageService, uploadPath);
return new DeleteDemandesTasklet(strategyFactory, TYPE_DEMANDE.RECOUV);
}
@Bean
Tasklet deleteDemandesSuppTasklet() {
return new DeleteDemandesTasklet(strategyFactory, TYPE_DEMANDE.SUPP);
}

// ---------- STEP --------------------------------------------
Expand Down Expand Up @@ -250,6 +244,12 @@ public Step stepArchivageAutomatiqueDemandesRecouv(JobRepository jobRepository,
.tasklet(tasklet, transactionManager)
.build();
}
@Bean
public Step stepArchivageAutomatiqueDemandesSupp(JobRepository jobRepository, @Qualifier("archiveDemandesSuppTasklet")Tasklet tasklet, PlatformTransactionManager transactionManager) {
return new StepBuilder("stepArchivageAutomatiqueDemandesSupp", jobRepository).allowStartIfComplete(true)
.tasklet(tasklet, transactionManager)
.build();
}

//Steps de placement en statut supprimé automatique des demandes
@Bean
Expand All @@ -271,6 +271,13 @@ public Step stepChangementStatutSupprimeDemandesRecouv(JobRepository jobReposito
.build();
}

@Bean
public Step stepChangementStatutSupprimeDemandesSupp(JobRepository jobRepository, @Qualifier("deleteStatusDemandesSuppTasklet")Tasklet tasklet, PlatformTransactionManager transactionManager) {
return new StepBuilder("stepChangementStatutSupprimeDemandesSupp", jobRepository).allowStartIfComplete(true)
.tasklet(tasklet, transactionManager)
.build();
}

//Steps de destruction en base de donnée des demandes
@Bean
public Step stepSuppresionDemandesExemp(JobRepository jobRepository, @Qualifier("deleteDemandesExempTasklet")Tasklet tasklet, PlatformTransactionManager transactionManager) {
Expand All @@ -291,6 +298,13 @@ public Step stepSuppresionDemandesRecouv(JobRepository jobRepository, @Qualifier
.build();
}

@Bean
public Step stepSuppressionDemandesSupp(JobRepository jobRepository, @Qualifier("deleteDemandesSuppTasklet")Tasklet tasklet, PlatformTransactionManager transactionManager) {
return new StepBuilder("stepSuppressionDemandesSupp", jobRepository).allowStartIfComplete(true)
.tasklet(tasklet, transactionManager)
.build();
}


// ---------- JOB ---------------------------------------------

Expand Down Expand Up @@ -369,50 +383,26 @@ public Job jobExportStatistiques(JobRepository jobRepository, @Qualifier("stepVe

//Job d'archivage automatique de toutes les demandes en statut terminé dont la dernière modification à plus de trois mois
@Bean
public Job jobArchivageDemandes(JobRepository jobRepository, @Qualifier("stepArchivageAutomatiqueDemandesExemp") Step step1, @Qualifier("stepArchivageAutomatiqueDemandesModif") Step step2, @Qualifier("stepArchivageAutomatiqueDemandesRecouv") Step step3) {
return new JobBuilder("archiverDemandesPlusDeTroisMois", jobRepository).incrementer(incrementer())
.start(step1).on(Constant.FAILED).end()
.from(step1).on(Constant.AUCUNE_DEMANDE).end()
.from(step1).on(Constant.COMPLETED).end()
.from(step2).on(Constant.FAILED).end()
.from(step2).on(Constant.AUCUNE_DEMANDE).end()
.from(step2).on(Constant.COMPLETED).end()
.from(step3).on(Constant.FAILED).end()
.from(step3).on(Constant.AUCUNE_DEMANDE).end()
.from(step3).on(Constant.COMPLETED).end()
.build().build();
public Job jobArchivageDemandes(JobRepository jobRepository, @Qualifier("stepArchivageAutomatiqueDemandesExemp") Step step1, @Qualifier("stepArchivageAutomatiqueDemandesModif") Step step2, @Qualifier("stepArchivageAutomatiqueDemandesRecouv") Step step3, @Qualifier("stepArchivageAutomatiqueDemandesSupp") Step step4) {
return new JobBuilder("archivageDemandes", jobRepository).incrementer(incrementer())
.start(step1).next(step2).next(step3).next(step4)
.build();
}

//Job de placement en statut supprimé de toutes les demandes en statut archivé dont ce statut à plus de trois mois
@Bean
public Job jobSuppressionMaisConservationEnBaseDemandes(JobRepository jobRepository, @Qualifier("stepChangementStatutSupprimeDemandesExemp") Step step1, @Qualifier("stepChangementStatutSupprimeDemandesModif") Step step2, @Qualifier("stepChangementStatutSupprimeDemandesRecouv") Step step3) {
return new JobBuilder("statutSupprimeDemandesPlusDeTroisMois", jobRepository).incrementer(incrementer())
.start(step1).on(Constant.FAILED).end()
.from(step1).on(Constant.AUCUNE_DEMANDE).end()
.from(step1).on(Constant.COMPLETED).end()
.from(step2).on(Constant.FAILED).end()
.from(step2).on(Constant.AUCUNE_DEMANDE).end()
.from(step2).on(Constant.COMPLETED).end()
.from(step3).on(Constant.FAILED).end()
.from(step3).on(Constant.AUCUNE_DEMANDE).end()
.from(step3).on(Constant.COMPLETED).end()
.build().build();
public Job jobSuppressionMaisConservationEnBaseDemandes(JobRepository jobRepository, @Qualifier("stepChangementStatutSupprimeDemandesExemp") Step step1, @Qualifier("stepChangementStatutSupprimeDemandesModif") Step step2, @Qualifier("stepChangementStatutSupprimeDemandesRecouv") Step step3, @Qualifier("stepChangementStatutSupprimeDemandesSupp") Step step4) {
return new JobBuilder("suppressionDemandesPlusDeTroisMois", jobRepository).incrementer(incrementer())
.start(step1).next(step2).next(step3).next(step4)
.build();
}

//Job de suppression définitive en base de donnée de toutes les demandes en statut supprimé, dont ce statut à plus de trois mois
@Bean
public Job jobSuppressionDefinitiveDemandes(JobRepository jobRepository, @Qualifier("stepSuppresionDemandesExemp") Step step1, @Qualifier("stepSuppresionDemandesModif") Step step2, @Qualifier("stepSuppresionDemandesRecouv") Step step3) {
return new JobBuilder("suppressionDemandesPlusDeTroisMois", jobRepository).incrementer(incrementer())
.start(step1).on(Constant.FAILED).end()
.from(step1).on(Constant.AUCUNE_DEMANDE).end()
.from(step1).on(Constant.COMPLETED).end()
.from(step2).on(Constant.FAILED).end()
.from(step2).on(Constant.AUCUNE_DEMANDE).end()
.from(step2).on(Constant.COMPLETED).end()
.from(step3).on(Constant.FAILED).end()
.from(step3).on(Constant.AUCUNE_DEMANDE).end()
.from(step3).on(Constant.COMPLETED).end()
.build().build();
public Job jobSuppressionDefinitiveDemandes(JobRepository jobRepository, @Qualifier("stepSuppresionDemandesExemp") Step step1, @Qualifier("stepSuppresionDemandesModif") Step step2, @Qualifier("stepSuppresionDemandesRecouv") Step step3, @Qualifier("stepSuppressionDemandesSupp") Step step4) {
return new JobBuilder("suppressionDefinitiveDemandes", jobRepository).incrementer(incrementer())
.start(step1).next(step2).next(step3).next(step4)
.build();
}


Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 624e24e

Please sign in to comment.