deal with Xls, Xlxs files and externalize broker properties
| New file |
| | |
| | | |
| | | # Back-end Projet MGT.FS |
| | | |
| | | ## Tools : |
| | | 1. OS: Windows 10 ; |
| | | 2. IDE: NetBeans 12.0 ; |
| | | 3. Language: Java 8.0 ; |
| | | 4. Maven 3.1 ; |
| | | 5. WildFly 17 ; |
| | | 6. Git 2.41 ; |
| | | 7. EJB 3.0 |
| | | 8. L'API JPA 2.1 |
| | | 9. provider: Hibernate |
| | | 10. Transaction-type: JTA |
| | | 11. Data-Source |
| | | 12. Postgres SQL 14.3 |
| | | 13. PostMan |
| | | 14. PowerAMC |
| | | 15. Bitbucket |
| | | |
| | | ## prérequis : |
| | | 1. Installation du Serveur d'application WildFly ; |
| | | 2. Installation du SGBD ; |
| | | 3. Installation du JDK ; |
| | | 4. Installation de Maven ; |
| | | |
| | | |
| | | |
| | | ## Lancement: |
| | | 1. Creation d'une Base de donnée sur postgres si vous utilisé postgres ; |
| | | 2. Creation d'une Datasource nomé fileDS dans WildFly ; |
| | | 3. Build du module parent ; |
| | | 4. deploiment du War (source_file_service-impl-1.0-SNAPSHOT.war) dans WildFly ; |
| | | |
| | | |
| | | |
| | | ## Lien de Test de L'API (Collection Du Projet) |
| | | |
| | | |
| | | |
| | | ## Team Dev |
| | | Victor E... |
| | | Leonel F... |
| New file |
| | |
| | | # These are some examples of commonly ignored file patterns. |
| | | # You should customize this list as applicable to your project. |
| | | # Learn more about .gitignore: |
| | | # https://www.atlassian.com/git/tutorials/saving-changes/gitignore |
| | | |
| | | # Node artifact files |
| | | node_modules/ |
| | | dist/ |
| | | |
| | | # Compiled Java class files |
| | | *.class |
| | | |
| | | # Compiled Python bytecode |
| | | *.py[cod] |
| | | |
| | | # Log files |
| | | *.log |
| | | |
| | | # Package files |
| | | *.jar |
| | | |
| | | # Maven |
| | | target/ |
| | | dist/ |
| | | |
| | | # JetBrains IDE |
| | | .idea/ |
| | | |
| | | # Unit test reports |
| | | TEST*.xml |
| | | |
| | | # Generated by MacOS |
| | | .DS_Store |
| | | |
| | | # Generated by Windows |
| | | Thumbs.db |
| | | |
| | | # Applications |
| | | *.app |
| | | *.exe |
| | | *.war |
| | | |
| | | # Large media files |
| | | *.mp4 |
| | | *.tiff |
| | | *.avi |
| | | *.flv |
| | | *.mov |
| | | *.wmv |
| | | |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project-shared-configuration> |
| | | <!-- |
| | | This file contains additional configuration written by modules in the NetBeans IDE. |
| | | The configuration is intended to be shared among all the users of project and |
| | | therefore it is assumed to be part of version control checkout. |
| | | Without this configuration present, some functionality in the IDE may be limited or fail altogether. |
| | | --> |
| | | <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1"> |
| | | <!-- |
| | | Properties that influence various parts of the IDE, especially code formatting and the like. |
| | | You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up. |
| | | That way multiple projects can share the same settings (useful for formatting rules for example). |
| | | Any value defined here will override the pom.xml file value but is only applicable to the current project. |
| | | --> |
| | | <netbeans.hint.jdkPlatform>JDK_1.8</netbeans.hint.jdkPlatform> |
| | | </properties> |
| | | </project-shared-configuration> |
| New file |
| | |
| | | <?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"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <parent> |
| | | <groupId>com.megatim.apifdxweb</groupId> |
| | | <artifactId>apifdxweb</artifactId> |
| | | <version>1.0</version> |
| | | </parent> |
| | | |
| | | <groupId>com.megatim.apifdxweb.core.ifaces</groupId> |
| | | <artifactId>apifdxweb-core-ifaces</artifactId> |
| | | <packaging>jar</packaging> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>1.8</maven.compiler.source> |
| | | <maven.compiler.target>1.8</maven.compiler.target> |
| | | <jakartaee>8.0</jakartaee> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.megatim.apifdxweb.dao.ifaces</groupId> |
| | | <artifactId>apifdxweb-dao-ifaces</artifactId> |
| | | <version>${project.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>javax</groupId> |
| | | <artifactId>javaee-api</artifactId> |
| | | <version>${jakartaee}</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.bekosoftware</groupId> |
| | | <artifactId>genericDAOLayer</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.bekosoftware</groupId> |
| | | <artifactId>genericManagerLayer</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatimgroup</groupId> |
| | | <artifactId>mgt-commons-tools</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | <name>apifdxweb-core-ifaces</name> |
| | | </project> |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.ifaces.administration; |
| | | |
| | | import com.bekosoftware.genericmanagerlayer.core.ifaces.GenericManager; |
| | | import com.megatim.apifdxweb.model.administration.Action; |
| | | |
| | | /** |
| | | * Interface etendue par les interfaces locale et remote du manager |
| | | * @since Tue Jan 09 15:21:42 WAT 2018 |
| | | * |
| | | */ |
| | | public interface ActionManager extends GenericManager<Action, Long> { |
| | | |
| | | /** |
| | | * Nom du service |
| | | * |
| | | */ |
| | | public final static String SERVICE_NAME = "ActionManager"; |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.ifaces.administration; |
| | | |
| | | import com.bekosoftware.genericmanagerlayer.core.ifaces.GenericManager; |
| | | import com.megatim.apifdxweb.model.administration.Role; |
| | | |
| | | |
| | | /** |
| | | * Interface etendue par les interfaces locale et remote du manager |
| | | * @since Tue Jan 09 15:21:42 WAT 2018 |
| | | * |
| | | */ |
| | | public interface RoleManager extends GenericManager<Role, Long> { |
| | | |
| | | /** |
| | | * Nom du service |
| | | * |
| | | */ |
| | | public final static String SERVICE_NAME = "RoleManager"; |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.ifaces.administration; |
| | | |
| | | import com.bekosoftware.genericmanagerlayer.core.ifaces.GenericManager; |
| | | import com.megatim.apifdxweb.model.administration.TokenGeneration; |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import javax.transaction.Transactional; |
| | | |
| | | /** |
| | | * Interface etendue par les interfaces locale et remote du manager |
| | | * |
| | | * @since Tue Jan 09 15:21:42 WAT 2018 |
| | | * |
| | | */ |
| | | public interface TokenGenerationManager extends GenericManager<TokenGeneration, Long> { |
| | | |
| | | public final static String SERVICE_NAME = "TokenGenerationManager"; |
| | | |
| | | @Transactional |
| | | void createTokenGeneration(User user, String token, int validite); |
| | | |
| | | boolean isTokenCorrect(String codeParticipant, String token); |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.ifaces.administration; |
| | | |
| | | import com.bekosoftware.genericmanagerlayer.core.ifaces.GenericManager; |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.dtos.EditPasswordDto; |
| | | import com.megatim.fdxcommons.model.referentiel.Participant; |
| | | import javax.transaction.Transactional; |
| | | |
| | | /** |
| | | * Interface etendue par les interfaces locale et remote du manager |
| | | * |
| | | * @since Tue Jan 09 15:21:42 WAT 2018 |
| | | * |
| | | */ |
| | | public interface UserManager extends GenericManager<User, Long> { |
| | | |
| | | public final static String SERVICE_NAME = "UserManager"; |
| | | |
| | | /** |
| | | * Permet de recuperer un utilisateur via ces informations de connexion |
| | | * |
| | | * @param username |
| | | * @param motDePasse |
| | | * @return |
| | | */ |
| | | User recuperUtilisateur(String username, String motDePasse); |
| | | |
| | | /** |
| | | * Permet de recuperer un utilisateur via ces informations de connexion |
| | | * |
| | | * @param username |
| | | * @return |
| | | */ |
| | | @Transactional |
| | | User recuperUtilisateur(String username); |
| | | |
| | | @Transactional |
| | | void lockUser(Participant participant); |
| | | |
| | | @Transactional |
| | | void unLockUser(Participant participant); |
| | | |
| | | @Transactional |
| | | void addUser(Participant participant, String token); |
| | | |
| | | @Transactional |
| | | void updateUser(Participant participant, String token); |
| | | |
| | | void editPassword(String username, EditPasswordDto editPasswordDto); |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.ifaces.camel.historique; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.camel.historique.ConsumedFilesHistory; |
| | | import com.megatim.apifdxweb.model.camel.historique.ConsumedFileType; |
| | | import com.megatim.fdxcommons.core.ifaces.abstracts.CustomManagerIFaces; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ConsumedFilesHistoryManager extends CustomManagerIFaces<ConsumedFilesHistory, Long, ConsumedFilesHistory, User> { |
| | | |
| | | List<ConsumedFilesHistory> notDeleted(); |
| | | |
| | | ConsumedFilesHistory findByTypeFileName(ConsumedFileType typeDonneeReferentiel, String fileName); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.ifaces.dataproduction; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.fdxcommons.core.ifaces.abstracts.CustomManagerIFaces; |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProduction; |
| | | import com.megatim.fdxcommons.model.searchentities.DataProductionSearch; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface DataProductionManager extends CustomManagerIFaces<DataProduction,Long, DataProductionSearch, User>{ |
| | | DataProduction lastProduction(String referentielVersion, String codeTypeFichier); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.ifaces.dataproduction; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.fdxcommons.core.ifaces.abstracts.CustomManagerIFaces; |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProductionHistorique; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface LoggedDataManager extends CustomManagerIFaces<DataProductionHistorique, Long, DataProductionHistorique, User> { |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.ifaces.exceptions; |
| | | |
| | | import javax.ws.rs.WebApplicationException; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class TokenExpiredException extends WebApplicationException { |
| | | |
| | | private String message; |
| | | |
| | | public TokenExpiredException(String message) { |
| | | super(); |
| | | this.message = message; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.ifaces.helper; |
| | | |
| | | import com.megatim.fdxcommons.tools.integration.FdxConsultationIntegrationData; |
| | | import java.io.File; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ApiRequestDataExporter { |
| | | |
| | | public File exportAll(String codeTypeFichier, String exportDirectory); |
| | | |
| | | File export(FdxConsultationIntegrationData fileIntegrationData, String exportDirectory); |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.ifaces.helper; |
| | | |
| | | import com.megatim.fdxcommons.model.pojo.CriteriaEntityFromView; |
| | | import com.megatim.fdxcommons.model.pojo.PageData; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public interface DataConsumptionOperations { |
| | | |
| | | List<Map<String, Object>> loadAll(String codeTypeFichier, String codeParticipant); |
| | | |
| | | List<Map<String, Object>> findByCriterias(String codeTypeFichier, CriteriaEntityFromView criterion, String codeParticipant); |
| | | |
| | | List<Map<String, Object>> loadAllAddedAndUpdated(String codeTypeFichier, String codeParticipant); |
| | | |
| | | // List<Map<String, Object>> loadAllUpdated(String codeTypeFichier, String codeParticipant); |
| | | |
| | | long countAll(String codeTypeFichier, String codeParticipant); |
| | | |
| | | long countAllLoadedOrUpdated(String codeTypeFichier, String codeParticipant); |
| | | |
| | | PageData loadAllWithPagination(String codeTypeFichier, String codeParticipant, int pageNumber, int pageSize); |
| | | |
| | | PageData findByCriteriaWithPagination(String codeTypeFichier, CriteriaEntityFromView criterias, String codeParticipant, int pageNumber, int pageSize); |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.ifaces.helper; |
| | | |
| | | import com.megatim.apifdxweb.model.request.UpdateRequest; |
| | | import com.megatim.fdxcommons.model.pojo.CriteriaEntityFromView; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public interface DataProductionOperations { |
| | | |
| | | void saveAll(String codeTypeFichier, List<LinkedHashMap<String, Object>> datas, String codeParticipant); |
| | | |
| | | void saveOne(String codeTypeFichier, LinkedHashMap<String, Object> data, String codeParticipant); |
| | | |
| | | void updateAll(String codeTypeFichier, UpdateRequest updateRequest, String codeParticipant); |
| | | |
| | | void updateOne(String codeTypeFichier, UpdateRequest updateRequest, String codeParticipant); |
| | | |
| | | void deleteAll(String codeTypeFichier, CriteriaEntityFromView criterion, String codeParticipant); |
| | | |
| | | void deleteOne(String codeTypeFichier, CriteriaEntityFromView criterion, String codeParticipant); |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.ifaces.helper; |
| | | |
| | | import java.io.File; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public interface FileDataReader { |
| | | |
| | | List<LinkedHashMap<String, Object>> getDatas(String referentielVersion, String codeTypeFichier, File dataFile) throws Exception; |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.ifaces.helper; |
| | | |
| | | import com.megatim.fdxcommons.model.pojo.DataInMemory; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public interface RoutingChecker { |
| | | |
| | | void stopIfNotProducer(String codeTypeFichier, DataInMemory dataInMemory, String codeParticipant); |
| | | |
| | | void stopIfNotConsumer(String codeTypeFichier, DataInMemory dataInMemory, String codeParticipant); |
| | | |
| | | void stopIfNatureProductionIsNotCumulative(String codeTypeFichier, String referentielEncours); |
| | | |
| | | void stopIfTypeFichierNotExists(String codeTypeFichier, DataInMemory dataInMemory); |
| | | |
| | | void stopIfCurrentReferentielNotExists(DataInMemory data); |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.ifaces.helper.referentiel; |
| | | |
| | | import com.megatim.fdxcommons.model.pojo.ReferentielToImportData; |
| | | import java.io.File; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public interface ReferentielToImportDataReader { |
| | | |
| | | public ReferentielToImportData getData(File referentielDirectory) throws Exception; |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.ifaces.helper.referentiel; |
| | | |
| | | import com.megatim.fdxcommons.model.pojo.ReferentielToImportData; |
| | | import java.io.File; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public interface ReferentielXmlDataReader { |
| | | |
| | | void readData(File referentielXmlFileDirectory, ReferentielToImportData referentielToImportData) throws Exception; |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.ifaces.helper.referentiel; |
| | | |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ValidateurTypeFichierParser { |
| | | |
| | | public List<ColumnDefinition> parseToColumnDefinition(String validatorPath, String codeTypeFichier, String referentielVersion) throws Exception; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.ifaces.integration; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.fdxcommons.core.ifaces.abstracts.CustomManagerIFaces; |
| | | import com.megatim.fdxcommons.model.searchentities.ColumnDefinitionSearch; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinitionId; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ColumnDefinitionManager extends CustomManagerIFaces<ColumnDefinition, ColumnDefinitionId, ColumnDefinitionSearch, User> { |
| | | |
| | | public List<ColumnDefinition> getAll(String referentielVersion, String codeTypeFichier); |
| | | |
| | | List<ColumnDefinition> findByReferentielAndTypeFichier(String referentielVersion, String codeTypeFichier); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.ifaces.log; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.fdxcommons.core.ifaces.abstracts.CustomManagerIFaces; |
| | | import com.megatim.fdxcommons.model.log.UserActionLog; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface UserActionLogManager extends CustomManagerIFaces<UserActionLog, Long, UserActionLog, User>{ |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.searchentities.ApplicationSourceSearch; |
| | | import com.megatim.fdxcommons.core.ifaces.abstracts.CustomManagerIFaces; |
| | | import com.megatim.fdxcommons.model.referentiel.ApplicationSource; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ApplicationSourceManager extends CustomManagerIFaces<ApplicationSource, String, ApplicationSourceSearch, User>{ |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.searchentities.ExtensionFichierSearch; |
| | | import com.megatim.fdxcommons.core.ifaces.abstracts.CustomManagerIFaces; |
| | | import com.megatim.fdxcommons.model.referentiel.ExtensionFichier; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ExtensionFichierManager extends CustomManagerIFaces<ExtensionFichier, String, ExtensionFichierSearch, User>{ |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.searchentities.GroupeNoeudSearch; |
| | | import com.megatim.fdxcommons.core.ifaces.abstracts.CustomManagerIFaces; |
| | | import com.megatim.fdxcommons.model.referentiel.GroupeNoeud; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface GroupeNoeudManager extends CustomManagerIFaces<GroupeNoeud, String, GroupeNoeudSearch, User> { |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.searchentities.GroupeParticipantSearch; |
| | | import com.megatim.fdxcommons.core.ifaces.abstracts.CustomManagerIFaces; |
| | | import com.megatim.fdxcommons.model.referentiel.GroupeParticipant; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface GroupeParticipantManager extends CustomManagerIFaces<GroupeParticipant, String, GroupeParticipantSearch, User>{ |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.searchentities.NoeudSearch; |
| | | import com.megatim.fdxcommons.core.ifaces.abstracts.CustomManagerIFaces; |
| | | import com.megatim.fdxcommons.model.referentiel.Noeud; |
| | | |
| | | /** |
| | | * Interface etendue par les interfaces locale et remote du manager |
| | | * |
| | | * @since Tue Jan 09 15:21:42 WAT 2018 |
| | | * |
| | | */ |
| | | public interface NoeudManager extends CustomManagerIFaces<Noeud, String,NoeudSearch, User> { |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.searchentities.ParticipantSearch; |
| | | import com.megatim.fdxcommons.core.ifaces.abstracts.CustomManagerIFaces; |
| | | import com.megatim.fdxcommons.model.referentiel.Participant; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ParticipantManager extends CustomManagerIFaces<Participant, String, ParticipantSearch, User>{ |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.searchentities.PaysSearch; |
| | | import com.megatim.fdxcommons.core.ifaces.abstracts.CustomManagerIFaces; |
| | | import com.megatim.fdxcommons.model.referentiel.Pays; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface PaysManager extends CustomManagerIFaces<Pays, String, PaysSearch, User> { |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.searchentities.ReferentielSearch; |
| | | import com.megatim.fdxcommons.core.ifaces.abstracts.CustomManagerIFaces; |
| | | import com.megatim.fdxcommons.model.referentiel.Referentiel; |
| | | import com.megatim.fdxcommons.model.enumeration.StatutReferentiel; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ReferentielManager extends CustomManagerIFaces<Referentiel, String, ReferentielSearch, User> { |
| | | |
| | | Referentiel findByStatutReferentiel(StatutReferentiel statutReferentiel); |
| | | |
| | | public Referentiel getReferentielEnCours(); |
| | | |
| | | public void archiverReferentielEncours(); |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.searchentities.RoutageSearch; |
| | | import com.megatim.fdxcommons.core.ifaces.abstracts.CustomManagerIFaces; |
| | | import com.megatim.fdxcommons.model.referentiel.Participant; |
| | | import com.megatim.fdxcommons.model.referentiel.Routage; |
| | | import com.megatim.fdxcommons.model.referentiel.RoutageId; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface RoutageManager extends CustomManagerIFaces<Routage, RoutageId, RoutageSearch, User> { |
| | | |
| | | Long countRoutageByReferentielTypeFichierForParticipantForReceive(String versionReferentiel, String codeTypeFichier, Participant participant); |
| | | |
| | | Long countRoutageByReferentielTypeFichierForParticipantForSend(String versionReferentiel, String codeTypeFichier, Participant participant); |
| | | |
| | | List<Participant> getParticipantsForSend(String versionReferentiel, String codeTypeFichier); |
| | | |
| | | List<Participant> getParticipantsForReceive(String versionReferentiel, String codeTypeFichier); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.searchentities.StructureLigneSearch; |
| | | import com.megatim.fdxcommons.core.ifaces.abstracts.CustomManagerIFaces; |
| | | import com.megatim.fdxcommons.model.referentiel.StructureLigne; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface StructureLigneManager extends CustomManagerIFaces<StructureLigne, String, StructureLigneSearch, User>{ |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.searchentities.TypeFichierSearch; |
| | | import com.megatim.fdxcommons.core.ifaces.abstracts.CustomManagerIFaces; |
| | | import com.megatim.fdxcommons.model.referentiel.TypeFichier; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface TypeFichierManager extends CustomManagerIFaces<TypeFichier, String, TypeFichierSearch, User> { |
| | | |
| | | List<TypeFichier> getByReferentiel(String referentielVersion); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/ValidateurFichierConfigurationemplates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/ValidateurFichierConfigurationemplates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.searchentities.ValidateurFichierConfigurationSearch; |
| | | import com.megatim.fdxcommons.core.ifaces.abstracts.CustomManagerIFaces; |
| | | import com.megatim.fdxcommons.model.referentiel.ValidateurFichierConfiguration; |
| | | import com.megatim.fdxcommons.model.referentiel.ValidateurFichierConfigurationId; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ValidateurFichierConfigurationManager extends CustomManagerIFaces<ValidateurFichierConfiguration, ValidateurFichierConfigurationId, ValidateurFichierConfigurationSearch, User> { |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.searchentities.ValidateurFichierSearch; |
| | | import com.megatim.fdxcommons.core.ifaces.abstracts.CustomManagerIFaces; |
| | | import com.megatim.fdxcommons.model.referentiel.ValidateurFichier; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ValidateurFichierManager extends CustomManagerIFaces<ValidateurFichier, String, ValidateurFichierSearch, User> { |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.ifaces.referentiel.natureproduction; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.fdxcommons.core.ifaces.abstracts.CustomManagerIFaces; |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProduction; |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProductionFichier; |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProductionFichierId; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface NatureProductionFichierManager extends CustomManagerIFaces<NatureProductionFichier, NatureProductionFichierId, NatureProductionFichier, User> { |
| | | |
| | | List<NatureProductionFichier> getByReferentiel(String referentielVersion); |
| | | |
| | | NatureProduction getNatureProduction(String codeTypeFichier, String referentiel); |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.ifaces.tmp; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.searchentities.tmp.TokenTmpSearch; |
| | | import com.megatim.apifdxweb.model.tmp.StatutTmp; |
| | | import com.megatim.apifdxweb.model.tmp.TokenTmp; |
| | | import com.megatim.fdxcommons.core.ifaces.abstracts.CustomManagerIFaces; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface TokenTmpManager extends CustomManagerIFaces<TokenTmp, String, TokenTmpSearch, User> { |
| | | |
| | | TokenTmp saveEntity(TokenTmp entity, String connectedParticipant); |
| | | |
| | | List<TokenTmp> getByStatutTmp(StatutTmp statut); |
| | | |
| | | List<TokenTmp> getExpiredToken(); |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.ifaces.tmp; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.dtos.tmp.DataTmpDto; |
| | | import com.megatim.apifdxweb.model.searchentities.tmp.TypeFichierDataTmpSearch; |
| | | import com.megatim.apifdxweb.model.tmp.TypeFichierDataTmp; |
| | | import com.megatim.fdxcommons.core.ifaces.abstracts.CustomManagerIFaces; |
| | | import com.megatim.fdxcommons.tools.database.exceptions.BadDataValueException; |
| | | import com.megatim.fdxcommons.tools.database.exceptions.ColumnNotFoundException; |
| | | import com.megatim.fdxcommons.tools.database.exceptions.LocalDateTimeValueParseError; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface TypeFichierDataTmpManager extends CustomManagerIFaces<TypeFichierDataTmp, Long, TypeFichierDataTmpSearch, User> { |
| | | |
| | | void saveData(String connectedParticipant, DataTmpDto dto); |
| | | |
| | | List<TypeFichierDataTmp> getByToken(String token); |
| | | |
| | | List<TypeFichierDataTmp> getByTokenAndByNumeroLigne(String token, int minNumeroLigne, int maxNumeroLigne); |
| | | |
| | | List<LinkedHashMap<String, Object>> getByStructuredLines(String token, String codeTypeFichier); |
| | | |
| | | } |
| New file |
| | |
| | | # These are some examples of commonly ignored file patterns. |
| | | # You should customize this list as applicable to your project. |
| | | # Learn more about .gitignore: |
| | | # https://www.atlassian.com/git/tutorials/saving-changes/gitignore |
| | | |
| | | # Node artifact files |
| | | node_modules/ |
| | | dist/ |
| | | |
| | | # Compiled Java class files |
| | | *.class |
| | | |
| | | # Compiled Python bytecode |
| | | *.py[cod] |
| | | |
| | | # Log files |
| | | *.log |
| | | |
| | | # Package files |
| | | *.jar |
| | | |
| | | # Maven |
| | | target/ |
| | | dist/ |
| | | |
| | | # JetBrains IDE |
| | | .idea/ |
| | | |
| | | # Unit test reports |
| | | TEST*.xml |
| | | |
| | | # Generated by MacOS |
| | | .DS_Store |
| | | |
| | | # Generated by Windows |
| | | Thumbs.db |
| | | |
| | | # Applications |
| | | *.app |
| | | *.exe |
| | | *.war |
| | | |
| | | # Large media files |
| | | *.mp4 |
| | | *.tiff |
| | | *.avi |
| | | *.flv |
| | | *.mov |
| | | *.wmv |
| | | |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project-shared-configuration> |
| | | <!-- |
| | | This file contains additional configuration written by modules in the NetBeans IDE. |
| | | The configuration is intended to be shared among all the users of project and |
| | | therefore it is assumed to be part of version control checkout. |
| | | Without this configuration present, some functionality in the IDE may be limited or fail altogether. |
| | | --> |
| | | <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1"> |
| | | <!-- |
| | | Properties that influence various parts of the IDE, especially code formatting and the like. |
| | | You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up. |
| | | That way multiple projects can share the same settings (useful for formatting rules for example). |
| | | Any value defined here will override the pom.xml file value but is only applicable to the current project. |
| | | --> |
| | | <netbeans.hint.jdkPlatform>JDK_1.8</netbeans.hint.jdkPlatform> |
| | | </properties> |
| | | </project-shared-configuration> |
| New file |
| | |
| | | <?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"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <parent> |
| | | <groupId>com.megatim.apifdxweb</groupId> |
| | | <artifactId>apifdxweb</artifactId> |
| | | <version>1.0</version> |
| | | </parent> |
| | | |
| | | <groupId>com.megatim.apifdxweb.core.impl</groupId> |
| | | <artifactId>apifdxweb-core-impl</artifactId> |
| | | <packaging>jar</packaging> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>1.8</maven.compiler.source> |
| | | <maven.compiler.target>1.8</maven.compiler.target> |
| | | <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir> |
| | | <jakartaee>8.0</jakartaee> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.megatim.apifdxweb.dao.impl</groupId> |
| | | <artifactId>apifdxweb-dao-impl</artifactId> |
| | | <version>${project.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatim.apifdxweb.core.ifaces</groupId> |
| | | <artifactId>apifdxweb-core-ifaces</artifactId> |
| | | <version>${project.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatim.apifdxweb.tools</groupId> |
| | | <artifactId>apifdxweb-tools</artifactId> |
| | | <version>${project.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>javax</groupId> |
| | | <artifactId>javaee-api</artifactId> |
| | | <version>${jakartaee}</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.bekosoftware</groupId> |
| | | <artifactId>genericManagerLayer</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatimgroup</groupId> |
| | | <artifactId>mgt-commons-tools</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ibm.icu</groupId> |
| | | <artifactId>icu4j</artifactId> |
| | | <version>61.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>commons-validator</groupId> |
| | | <artifactId>commons-validator</artifactId> |
| | | <version>1.6</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>commons-io</groupId> |
| | | <artifactId>commons-io</artifactId> |
| | | <version>2.11.0</version> |
| | | </dependency> |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>javax.transaction</groupId> |
| | | <artifactId>javax.transaction-api</artifactId> |
| | | <version>1.3</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <version>3.1</version> |
| | | <configuration> |
| | | <source>1.8</source> |
| | | <target>1.8</target> |
| | | <compilerArguments> |
| | | <endorseddirs>${endorsed.dir}</endorseddirs> |
| | | </compilerArguments> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-war-plugin</artifactId> |
| | | <version>2.3</version> |
| | | <configuration> |
| | | <failOnMissingWebXml>false</failOnMissingWebXml> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-dependency-plugin</artifactId> |
| | | <version>2.6</version> |
| | | <executions> |
| | | <execution> |
| | | <phase>validate</phase> |
| | | <goals> |
| | | <goal>copy</goal> |
| | | </goals> |
| | | <configuration> |
| | | <outputDirectory>${endorsed.dir}</outputDirectory> |
| | | <silent>true</silent> |
| | | <artifactItems> |
| | | <artifactItem> |
| | | <groupId>javax</groupId> |
| | | <artifactId>javaee-api</artifactId> |
| | | <version>${jakartaee}</version> |
| | | <type>jar</type> |
| | | </artifactItem> |
| | | </artifactItems> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | <name>apifdxweb-core-impl</name> |
| | | </project> |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.impl.administration; |
| | | |
| | | |
| | | import com.bekosoftware.genericdaolayer.dao.ifaces.GenericDAO; |
| | | import com.bekosoftware.genericmanagerlayer.core.impl.AbstractGenericManager; |
| | | import com.megatim.apifdxweb.core.ifaces.administration.ActionManager; |
| | | import com.megatim.apifdxweb.dao.ifaces.administration.ActionDAO; |
| | | import com.megatim.apifdxweb.model.administration.Action; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | |
| | | @Dependent |
| | | public class ActionManagerImpl extends AbstractGenericManager<Action, Long> implements ActionManager { |
| | | |
| | | @Inject |
| | | protected ActionDAO dao; |
| | | |
| | | public ActionManagerImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public GenericDAO<Action, Long> getDao() { |
| | | return dao; |
| | | } |
| | | |
| | | @Override |
| | | public String getEntityIdName() { |
| | | return "id"; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.impl.administration; |
| | | |
| | | |
| | | import com.bekosoftware.genericdaolayer.dao.ifaces.GenericDAO; |
| | | import com.bekosoftware.genericmanagerlayer.core.impl.AbstractGenericManager; |
| | | import com.megatim.apifdxweb.core.ifaces.administration.RoleManager; |
| | | import com.megatim.apifdxweb.dao.ifaces.administration.RoleDAO; |
| | | import com.megatim.apifdxweb.model.administration.Role; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | |
| | | @Dependent |
| | | public class RoleManagerImpl extends AbstractGenericManager<Role, Long> implements RoleManager { |
| | | |
| | | @Inject |
| | | protected RoleDAO dao; |
| | | |
| | | public RoleManagerImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public GenericDAO<Role, Long> getDao() { |
| | | return dao; |
| | | } |
| | | |
| | | @Override |
| | | public String getEntityIdName() { |
| | | return "id"; |
| | | } |
| | | |
| | | public Role getCurrentElement() { |
| | | return dao.getCurrentRole(); |
| | | } |
| | | |
| | | public Role saveOrUpdateCurrentElement(Role entityToSave) { |
| | | return dao.save(entityToSave); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.impl.administration; |
| | | |
| | | import com.bekosoftware.genericdaolayer.dao.ifaces.GenericDAO; |
| | | import com.bekosoftware.genericmanagerlayer.core.impl.AbstractGenericManager; |
| | | import com.google.common.hash.Hashing; |
| | | import com.megatim.apifdxweb.core.ifaces.administration.TokenGenerationManager; |
| | | import com.megatim.apifdxweb.dao.ifaces.administration.TokenGenerationDAO; |
| | | import com.megatim.apifdxweb.model.administration.TokenGeneration; |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.administration.enums.StatutTokenGeneration; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.time.LocalDateTime; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | import javax.transaction.Transactional; |
| | | |
| | | @Dependent |
| | | public class TokenGenerationManagerImpl extends AbstractGenericManager<TokenGeneration, Long> implements TokenGenerationManager { |
| | | |
| | | @Inject |
| | | protected TokenGenerationDAO dao; |
| | | |
| | | public TokenGenerationManagerImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public GenericDAO<TokenGeneration, Long> getDao() { |
| | | return dao; |
| | | } |
| | | |
| | | @Override |
| | | public String getEntityIdName() { |
| | | return "id"; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void createTokenGeneration(User user, String token, int validite) { |
| | | TokenGeneration currentTokenGeneration = dao.getCurrentGeneration(user.getUserName()); |
| | | if (currentTokenGeneration != null) { |
| | | currentTokenGeneration.setStatutTokenGeneration(StatutTokenGeneration.ARCHIVE); |
| | | dao.update(currentTokenGeneration.getId(), currentTokenGeneration); |
| | | } |
| | | |
| | | TokenGeneration tokenGeneration = new TokenGeneration(); |
| | | tokenGeneration.setDateGeneration(LocalDateTime.now()); |
| | | tokenGeneration.setUser(user); |
| | | tokenGeneration.setToken(getHash(token)); |
| | | tokenGeneration.setValidite(validite); |
| | | tokenGeneration.setStatutTokenGeneration(StatutTokenGeneration.EN_COURS); |
| | | |
| | | dao.save(tokenGeneration); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isTokenCorrect(String codeParticipant, String token) { |
| | | TokenGeneration currentTokenGeneration = dao.getCurrentGeneration(codeParticipant); |
| | | return currentTokenGeneration != null && currentTokenGeneration.getToken().equals(getHash(token)); |
| | | } |
| | | |
| | | private String getHash(String value) { |
| | | return Hashing.sha256().hashString(value, StandardCharsets.UTF_8).toString(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.impl.administration; |
| | | |
| | | import com.bekosoftware.genericdaolayer.dao.ifaces.GenericDAO; |
| | | import com.bekosoftware.genericmanagerlayer.core.impl.AbstractGenericManager; |
| | | import com.google.common.hash.Hashing; |
| | | import com.megatim.apifdxweb.core.ifaces.administration.RoleManager; |
| | | import com.megatim.apifdxweb.core.ifaces.administration.UserManager; |
| | | import com.megatim.apifdxweb.dao.ifaces.administration.UserDAO; |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.dtos.EditPasswordDto; |
| | | import com.megatim.fdxcommons.model.enumeration.EtatOperation; |
| | | import com.megatim.fdxcommons.model.enumeration.TypeOperation; |
| | | import com.megatim.fdxcommons.model.referentiel.Participant; |
| | | import com.megatim.fdxcommons.tools.exceptions.CommonApplicationValidationException; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.Date; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | |
| | | @Dependent |
| | | public class UserManagerImpl extends AbstractGenericManager<User, Long> implements UserManager { |
| | | |
| | | @Inject |
| | | protected UserDAO dao; |
| | | |
| | | @Inject |
| | | protected RoleManager roleManager; |
| | | |
| | | public UserManagerImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public GenericDAO<User, Long> getDao() { |
| | | return dao; |
| | | } |
| | | |
| | | @Override |
| | | public String getEntityIdName() { |
| | | return "id"; |
| | | } |
| | | |
| | | @Override |
| | | public User recuperUtilisateur(String username, String motDePasse) { |
| | | return dao.recuperUtilisateur(username, motDePasse); |
| | | } |
| | | |
| | | @Override |
| | | public User recuperUtilisateur(String username) { |
| | | return dao.recuperUtilisateur(username); |
| | | } |
| | | |
| | | @Override |
| | | public void addUser(Participant participant, String token) { |
| | | |
| | | User user = dao.getUser(participant.getCode()); |
| | | if (user == null) { |
| | | user = new User(); |
| | | user.setUserName(participant.getCode()); |
| | | user.setFirstName(participant.getLibelle()); |
| | | user.setLastName(participant.getCode()); |
| | | user.setEtatOperation(EtatOperation.ACTIF); |
| | | user.setTypeOperation(TypeOperation.AJOUTER); |
| | | user.setDateCreation(new Date()); |
| | | |
| | | user.setPwd(token); |
| | | user.setParticipant(participant); |
| | | |
| | | dao.save(user); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void updateUser(Participant participant, String token) { |
| | | User user = dao.getUser(participant.getCode()); |
| | | if (user != null) { |
| | | user.setDateDerniereModification(new Date()); |
| | | user.setPwd(token); |
| | | dao.save(user); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void lockUser(Participant participant) { |
| | | User user = dao.getUser(participant.getCode()); |
| | | if (user != null) { |
| | | user.setLocked(true); |
| | | dao.save(user); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void unLockUser(Participant participant) { |
| | | User user = dao.getUser(participant.getCode()); |
| | | if (user != null) { |
| | | user.setLocked(false); |
| | | dao.save(user); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void editPassword(String username, EditPasswordDto editPasswordDto) { |
| | | |
| | | if (!editPasswordDto.getNewPassword().equals(editPasswordDto.getNewPasswordConfirm())) { |
| | | throw new CommonApplicationValidationException("Le nouveau mot de passe et le mote de passe de confirmation ne sont pas identiques."); |
| | | } |
| | | |
| | | User user = recuperUtilisateur(username); |
| | | if (user == null) { |
| | | throw new CommonApplicationValidationException("Imposssible d'effectuer l'action: utilisateur non reconnu"); |
| | | } |
| | | |
| | | if (!Hashing.sha256().hashString(editPasswordDto.getActualPassword(), StandardCharsets.UTF_8).toString().equals(user.getPwd())) { |
| | | throw new CommonApplicationValidationException("Le mot de passe actuel est incorrect"); |
| | | } |
| | | |
| | | user.setPwd(Hashing.sha256().hashString(editPasswordDto.getNewPassword(), StandardCharsets.UTF_8).toString()); |
| | | update(user.getId(), user); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.camel.historique; |
| | | |
| | | import com.megatim.apifdxweb.model.camel.historique.ConsumedFilesHistory; |
| | | import javax.ejb.EJB; |
| | | import javax.enterprise.context.Dependent; |
| | | import com.megatim.apifdxweb.model.camel.historique.ConsumedFileType; |
| | | import java.util.List; |
| | | import com.megatim.apifdxweb.dao.ifaces.camel.historique.ConsumedFilesHistoryDAO; |
| | | import com.megatim.apifdxweb.core.ifaces.camel.historique.ConsumedFilesHistoryManager; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class ConsumedFilesHistoryManagerImpl implements ConsumedFilesHistoryManager { |
| | | |
| | | @EJB |
| | | ConsumedFilesHistoryDAO dao; |
| | | |
| | | @Override |
| | | public List<ConsumedFilesHistory> notDeleted() { |
| | | return dao.notDeleted(); |
| | | } |
| | | |
| | | @Override |
| | | public ConsumedFilesHistoryDAO getDao() { |
| | | return dao; |
| | | } |
| | | |
| | | @Override |
| | | public ConsumedFilesHistory findByTypeFileName(ConsumedFileType typeDonneeReferentiel, String fileName) { |
| | | return dao.findByTypeFileName(typeDonneeReferentiel, fileName); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.dataproduction; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.dataproduction.DataProductionManager; |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProduction; |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProductionSource; |
| | | import java.time.LocalDateTime; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | import com.megatim.fdxcommons.core.ifaces.dataproduction.DataProductionHandler; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class DataProductionHandlerImpl implements DataProductionHandler { |
| | | |
| | | @Inject |
| | | private DataProductionManager dataProductionManager; |
| | | |
| | | @Override |
| | | public DataProduction handle(String codeTypeFichier, String connectedParticipant, String referentielVersion, String fileName) { |
| | | DataProduction dataProduction = new DataProduction(); |
| | | dataProduction.setDateProduction(LocalDateTime.now()); |
| | | dataProduction.setReferentielVersion(referentielVersion); |
| | | dataProduction.setCodeTypeFichier(codeTypeFichier); |
| | | dataProduction.setCodeParticipant(connectedParticipant); |
| | | dataProduction.setSource(fileName != null ? DataProductionSource.FICHIER : DataProductionSource.API); |
| | | dataProduction.setFileName(fileName); |
| | | |
| | | return dataProductionManager.save(dataProduction); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.dataproduction; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.dataproduction.DataProductionManager; |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.dataproduction.DataProductionDAO; |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProduction; |
| | | import javax.ejb.EJB; |
| | | import javax.enterprise.context.Dependent; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class DataProductionManagerImpl implements DataProductionManager { |
| | | |
| | | @EJB |
| | | private DataProductionDAO dao; |
| | | |
| | | @Override |
| | | public DataProductionDAO getDao() { |
| | | return dao; |
| | | } |
| | | |
| | | @Override |
| | | public DataProduction lastProduction(String referentielVersion, String codeTypeFichier) { |
| | | return dao.lastProduction(referentielVersion, codeTypeFichier); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.impl.db; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.RoutageManager; |
| | | import com.megatim.fdxcommons.core.ifaces.db.ReferentielDataSaver; |
| | | import com.megatim.apifdxweb.core.ifaces.integration.ColumnDefinitionManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ApplicationSourceManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ExtensionFichierManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.GroupeNoeudManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.GroupeParticipantManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.NoeudManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ParticipantManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.PaysManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ReferentielManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.StructureLigneManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.TypeFichierManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ValidateurFichierConfigurationManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ValidateurFichierManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.natureproduction.NatureProductionFichierManager; |
| | | import com.megatim.apifdxweb.model.camel.historique.ConsumedFilesHistory; |
| | | import com.megatim.apifdxweb.model.camel.historique.ConsumedFileType; |
| | | import com.megatim.fdxcommons.model.enumeration.CategorieFichier; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.model.pojo.ReferentielToImportData; |
| | | import com.megatim.fdxcommons.model.pojo.TableDefinition; |
| | | import com.megatim.fdxcommons.model.referentiel.ApplicationSource; |
| | | import com.megatim.fdxcommons.model.referentiel.ExtensionFichier; |
| | | import com.megatim.fdxcommons.model.referentiel.GroupeNoeud; |
| | | import com.megatim.fdxcommons.model.referentiel.GroupeParticipant; |
| | | import com.megatim.fdxcommons.model.referentiel.Noeud; |
| | | import com.megatim.fdxcommons.model.referentiel.Participant; |
| | | import com.megatim.fdxcommons.model.referentiel.Pays; |
| | | import com.megatim.fdxcommons.model.referentiel.Referentiel; |
| | | import com.megatim.fdxcommons.model.referentiel.Routage; |
| | | import com.megatim.fdxcommons.model.referentiel.StructureLigne; |
| | | import com.megatim.fdxcommons.model.referentiel.TypeFichier; |
| | | import com.megatim.fdxcommons.model.referentiel.ValidateurFichier; |
| | | import com.megatim.fdxcommons.model.referentiel.ValidateurFichierConfiguration; |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProductionFichier; |
| | | import com.megatim.fdxcommons.tools.exceptions.FileTypeNotExistException; |
| | | import com.megatim.fdxcommons.tools.exceptions.CommonRessourceNotFoundException; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | import com.megatim.apifdxweb.core.ifaces.camel.historique.ConsumedFilesHistoryManager; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class ReferentielDataSaverImpl implements ReferentielDataSaver { |
| | | |
| | | @Inject |
| | | ReferentielManager refManager; |
| | | |
| | | @Inject |
| | | ApplicationSourceManager appSourceManager; |
| | | |
| | | @Inject |
| | | ExtensionFichierManager extFichierManager; |
| | | |
| | | @Inject |
| | | GroupeNoeudManager groupeNoeudManager; |
| | | |
| | | @Inject |
| | | GroupeParticipantManager groupePartManager; |
| | | |
| | | @Inject |
| | | NoeudManager noeudManager; |
| | | |
| | | @Inject |
| | | ParticipantManager participantManager; |
| | | |
| | | @Inject |
| | | PaysManager paysManager; |
| | | |
| | | @Inject |
| | | RoutageManager routageManager; |
| | | |
| | | @Inject |
| | | TypeFichierManager typeFichierManager; |
| | | |
| | | @Inject |
| | | StructureLigneManager structLigneManager; |
| | | |
| | | @Inject |
| | | ValidateurFichierManager valFichManager; |
| | | |
| | | @Inject |
| | | ValidateurFichierConfigurationManager valFichConfManager; |
| | | |
| | | @Inject |
| | | ColumnDefinitionManager columnDefinitionManager; |
| | | |
| | | @Inject |
| | | NatureProductionFichierManager natureProdFichManager; |
| | | |
| | | @Inject |
| | | ConsumedFilesHistoryManager refHistManager; |
| | | |
| | | private Map<String, Referentiel> referentielsMap; |
| | | private Map<String, TypeFichier> typeFichiersMap; |
| | | private Map<String, Pays> paysMap; |
| | | private Map<String, Participant> participantsMap; |
| | | private Map<String, ApplicationSource> appSourcesMap; |
| | | private Map<String, ExtensionFichier> extensionFichiersMap; |
| | | private Map<String, ValidateurFichier> validateurFichiersMap; |
| | | private Map<String, ValidateurFichierConfiguration> validateurFichierConfsMap; |
| | | private Map<String, StructureLigne> structLignesMap; |
| | | private Map<String, Noeud> noeudsMap; |
| | | private Map<String, GroupeNoeud> groupeNoeudsMap; |
| | | private Map<String, GroupeParticipant> groupeParticipantsMap; |
| | | private Map<String, Routage> routagesMap; |
| | | private Map<String, ColumnDefinition> columnDefinitionsMap; |
| | | private Map<String, NatureProductionFichier> natureProdFichsMap; |
| | | |
| | | @Override |
| | | public void persist(ReferentielToImportData referentielToImportData) throws Exception { |
| | | refManager.archiverReferentielEncours(); |
| | | |
| | | persistReferentiels(referentielToImportData.getReferentiels()); |
| | | |
| | | persistApplicationSources(referentielToImportData.getApplicationSources()); |
| | | |
| | | persistPayss(referentielToImportData.getPays()); |
| | | |
| | | persistExtensionFichiers(referentielToImportData.getExtensionFichiers()); |
| | | |
| | | persistParticipants(referentielToImportData.getParticipants()); |
| | | |
| | | persistTypeFichiers(referentielToImportData.getTypeFichiers()); |
| | | |
| | | persistValidateurFichiers(referentielToImportData.getValidateurFichiers()); |
| | | |
| | | persistValidateurFichierConfigurations(referentielToImportData.getValidateurFichierConfigurations()); |
| | | |
| | | persitStructuresLignes(referentielToImportData.getStructureLignes()); |
| | | |
| | | persistNoeuds(referentielToImportData.getNoeuds()); |
| | | |
| | | persistGroupeNoeuds(referentielToImportData.getGroupeNoeuds()); |
| | | |
| | | persistGroupeParticipants(referentielToImportData.getGroupeParticipants()); |
| | | |
| | | persistRoutages(referentielToImportData.getRoutages()); |
| | | |
| | | persistColumnsDefinition(referentielToImportData.getTableDefinitions()); |
| | | |
| | | persistNatureProductionFichiers(referentielToImportData.getNatureProductionFichiers()); |
| | | |
| | | persistReferentielHistorique(referentielToImportData.getFileName()); |
| | | } |
| | | |
| | | private void persistReferentielHistorique(String fileName) { |
| | | ConsumedFilesHistory consumedFilesHistory = new ConsumedFilesHistory(); |
| | | consumedFilesHistory.setFileName(fileName); |
| | | consumedFilesHistory.setDateCreation(LocalDateTime.now()); |
| | | consumedFilesHistory.setConsumedFileType(ConsumedFileType.REFERENTIEL); |
| | | |
| | | refHistManager.save(consumedFilesHistory); |
| | | } |
| | | |
| | | private void persistReferentiels(List<Referentiel> referentiels) { |
| | | referentielsMap = refManager.getAll(null).stream().collect(Collectors.toMap(Referentiel::getVersion, Function.identity())); |
| | | |
| | | if (referentiels != null) { |
| | | |
| | | for (Referentiel ref : referentiels) { |
| | | Referentiel referentielFound = referentielsMap.get(ref.getVersion()); |
| | | |
| | | if (referentielFound == null) { |
| | | refManager.save(ref); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void persistApplicationSources(List<ApplicationSource> appSources) { |
| | | referentielsMap = refManager.getAll(null).stream().collect(Collectors.toMap(Referentiel::getVersion, Function.identity())); |
| | | appSourcesMap = appSourceManager.getAll(null).stream().collect(Collectors.toMap(ApplicationSource::getLibelle, Function.identity())); |
| | | |
| | | if (appSources != null) { |
| | | |
| | | for (ApplicationSource appSource : appSources) { |
| | | String referentielVersion = appSource.getReferentiel().getVersion(); |
| | | Referentiel referentielFound = referentielsMap.get(referentielVersion); |
| | | |
| | | if (referentielFound == null) { |
| | | throw new CommonRessourceNotFoundException("Le referentiel suivant est introuvable : " + referentielVersion); |
| | | } |
| | | |
| | | ApplicationSource appSourceFound = appSourcesMap.get(appSource.getLibelle()); |
| | | if (appSourceFound == null) { |
| | | appSource.setReferentiel(referentielFound); |
| | | appSourceManager.save(appSource); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | private void persistPayss(List<Pays> payss) { |
| | | paysMap = paysManager.getAll(null).stream().collect(Collectors.toMap(Pays::getCode, Function.identity())); |
| | | |
| | | if (payss != null) { |
| | | |
| | | for (Pays p : payss) { |
| | | String referentielVersion = p.getReferentiel().getVersion(); |
| | | Referentiel referentielFound = referentielsMap.get(referentielVersion); |
| | | |
| | | if (referentielFound == null) { |
| | | throw new CommonRessourceNotFoundException("La ressource Referentiel suivante est introuvable : " + referentielVersion); |
| | | } |
| | | Pays paysFound = paysMap.get(p.getCode()); |
| | | |
| | | if (paysFound == null) { |
| | | p.setReferentiel(referentielFound); |
| | | paysManager.save(p); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void persistExtensionFichiers(List<ExtensionFichier> extFichiers) { |
| | | referentielsMap = refManager.getAll(null).stream().collect(Collectors.toMap(Referentiel::getVersion, Function.identity())); |
| | | extensionFichiersMap = extFichierManager.getAll(null).stream().collect(Collectors.toMap(ExtensionFichier::getExtension, Function.identity())); |
| | | |
| | | if (extFichiers != null) { |
| | | |
| | | for (ExtensionFichier e : extFichiers) { |
| | | String referentielVersion = e.getReferentiel().getVersion(); |
| | | Referentiel referentielFound = referentielsMap.get(referentielVersion); |
| | | |
| | | if (referentielFound == null) { |
| | | throw new CommonRessourceNotFoundException("Le referentiel suivant est introuvable : " + referentielVersion); |
| | | } |
| | | |
| | | ExtensionFichier extFichierFound = extensionFichiersMap.get(e.getExtension()); |
| | | if (extFichierFound == null) { |
| | | e.setReferentiel(referentielFound); |
| | | extFichierManager.save(e); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void persistParticipants(List<Participant> participants) { |
| | | paysMap = paysManager.getAll(null).stream().collect(Collectors.toMap(Pays::getCode, Function.identity())); |
| | | participantsMap = participantManager.getAll(null).stream().collect(Collectors.toMap(Participant::getCode, Function.identity())); |
| | | |
| | | if (participants != null) { |
| | | |
| | | for (Participant p : participants) { |
| | | String referentielVersion = p.getReferentiel().getVersion(); |
| | | String codePays = p.getPays().getCode(); |
| | | Referentiel referentielFound = referentielsMap.get(referentielVersion); |
| | | |
| | | if (referentielFound == null) { |
| | | throw new CommonRessourceNotFoundException("La ressource Referentiel suivante est introuvable : " + referentielVersion); |
| | | } |
| | | Pays paysFound = paysMap.get(codePays); |
| | | |
| | | if (paysFound == null) { |
| | | throw new CommonRessourceNotFoundException("La ressource Pays suivante est introuvable : " + codePays); |
| | | } |
| | | Participant participantFound = participantsMap.get(p.getCode()); |
| | | |
| | | if (participantFound == null) { |
| | | p.setPays(paysFound); |
| | | p.setReferentiel(referentielFound); |
| | | |
| | | participantManager.save(p); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void persistTypeFichiers(List<TypeFichier> typeFichiers) { |
| | | participantsMap = participantManager.getAll(null).stream().collect(Collectors.toMap(Participant::getCode, Function.identity())); |
| | | typeFichiersMap = typeFichierManager.getAll(null).stream().collect(Collectors.toMap(TypeFichier::getCode, Function.identity())); |
| | | |
| | | if (typeFichiers != null) { |
| | | |
| | | for (TypeFichier typeFich : typeFichiers) { |
| | | |
| | | if (typeFich.getCategorieFichier().equals(CategorieFichier.STRUCTURE)) { |
| | | |
| | | String referentielVersion = typeFich.getReferentiel().getVersion(); |
| | | String codeParticipant = typeFich.getParticipant().getCode(); |
| | | |
| | | Referentiel referentielFound = referentielsMap.get(referentielVersion); |
| | | if (referentielFound == null) { |
| | | throw new CommonRessourceNotFoundException("La ressource Referentiel suivante est introuvable : " + referentielVersion); |
| | | } |
| | | |
| | | Participant participantFound = participantsMap.get(codeParticipant); |
| | | if (participantFound == null) { |
| | | throw new CommonRessourceNotFoundException("La ressource Participant suivante est introuvable : " + codeParticipant); |
| | | } |
| | | TypeFichier typeFichierFound = typeFichiersMap.get(typeFich.getCode()); |
| | | |
| | | if (typeFichierFound == null) { |
| | | typeFich.setReferentiel(referentielFound); |
| | | typeFich.setParticipant(participantFound); |
| | | |
| | | typeFichierManager.save(typeFich); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void persistValidateurFichiers(List<ValidateurFichier> validateurFichiers) throws FileTypeNotExistException { |
| | | validateurFichiersMap = valFichManager.getAll(null).stream().collect(Collectors.toMap(ValidateurFichier::getId, Function.identity())); |
| | | typeFichiersMap = typeFichierManager.getAll(null).stream().collect(Collectors.toMap(TypeFichier::getCode, Function.identity())); |
| | | |
| | | if (validateurFichiers != null) { |
| | | |
| | | for (ValidateurFichier val : validateurFichiers) { |
| | | String codeTypeFichier = val.getTypeFichier().getCode(); |
| | | TypeFichier typeFichierFound = typeFichiersMap.get(codeTypeFichier); |
| | | |
| | | if (typeFichierFound == null) { |
| | | throw new FileTypeNotExistException(codeTypeFichier); |
| | | } |
| | | ValidateurFichier valFichFound = validateurFichiersMap.get(val.getId()); |
| | | |
| | | if (valFichFound == null) { |
| | | val.setTypeFichier(typeFichierFound); |
| | | valFichManager.save(val); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void persistValidateurFichierConfigurations(List<ValidateurFichierConfiguration> valFichConfs) throws FileTypeNotExistException { |
| | | validateurFichierConfsMap = valFichConfManager.getAll(null) |
| | | .stream() |
| | | .collect(Collectors.toMap(x -> x.getReferentiel().getVersion() + "-" + x.getTypeFichier().getCode(), |
| | | Function.identity())); |
| | | |
| | | if (valFichConfs != null) { |
| | | |
| | | for (ValidateurFichierConfiguration valFichConf : valFichConfs) { |
| | | String codeTypeFichier = valFichConf.getTypeFichier().getCode(); |
| | | String referentielVersion = valFichConf.getReferentiel().getVersion(); |
| | | |
| | | Referentiel referentielFound = referentielsMap.get(referentielVersion); |
| | | if (referentielFound == null) { |
| | | throw new CommonRessourceNotFoundException("Le referentiel suivant est introuvable : " + referentielVersion); |
| | | } |
| | | |
| | | TypeFichier typeFichierFound = typeFichiersMap.get(codeTypeFichier); |
| | | if (typeFichierFound == null) { |
| | | throw new FileTypeNotExistException(codeTypeFichier); |
| | | } |
| | | |
| | | ValidateurFichierConfiguration ValFichConfFound = validateurFichierConfsMap.get(valFichConf.getReferentiel().getVersion() + "-" + valFichConf.getTypeFichier().getCode()); |
| | | |
| | | if (ValFichConfFound == null) { |
| | | valFichConf.setTypeFichier(typeFichierFound); |
| | | valFichConf.setReferentiel(referentielFound); |
| | | |
| | | valFichConfManager.save(valFichConf); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void persitStructuresLignes(List<StructureLigne> structLignes) { |
| | | validateurFichiersMap = valFichManager.getAll(null).stream().collect(Collectors.toMap(ValidateurFichier::getId, Function.identity())); |
| | | appSourcesMap = appSourceManager.getAll(null).stream().collect(Collectors.toMap(ApplicationSource::getLibelle, Function.identity())); |
| | | structLignesMap = structLigneManager.getAll(null).stream().collect(Collectors.toMap(StructureLigne::getId, Function.identity())); |
| | | |
| | | if (structLignes != null) { |
| | | |
| | | for (StructureLigne s : structLignes) { |
| | | String valFichierId = s.getValidateurFichier().getId(); |
| | | String libelleAppSource = s.getApplicationSource().getLibelle(); |
| | | |
| | | ApplicationSource appSourceFound = appSourcesMap.get(libelleAppSource); |
| | | if (appSourceFound == null) { |
| | | throw new CommonRessourceNotFoundException("La ressource ApplicationSource suivante est introuvable : " + libelleAppSource); |
| | | } |
| | | |
| | | ValidateurFichier valFichFound = validateurFichiersMap.get(valFichierId); |
| | | if (valFichFound == null) { |
| | | throw new CommonRessourceNotFoundException("La ressource ValidateurFichier suivante est introuvable : " + valFichierId); |
| | | } |
| | | StructureLigne structureLigneFound = structLignesMap.get(s.getId()); |
| | | |
| | | if (structureLigneFound == null) { |
| | | s.setValidateurFichier(valFichFound); |
| | | s.setApplicationSource(appSourceFound); |
| | | |
| | | structLigneManager.save(s); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void persistNoeuds(List<Noeud> noeuds) { |
| | | noeudsMap = noeudManager.getAll(null).stream().collect(Collectors.toMap(Noeud::getCode, Function.identity())); |
| | | List<Noeud> savedNoeuds = new ArrayList<>(); |
| | | |
| | | if (noeuds != null) { |
| | | |
| | | for (Noeud n : noeuds) { |
| | | String referentielVersion = n.getReferentiel().getVersion(); |
| | | String codeParticipant = n.getParticipant().getCode(); |
| | | |
| | | Referentiel referentielFound = referentielsMap.get(referentielVersion); |
| | | if (referentielFound == null) { |
| | | throw new CommonRessourceNotFoundException("La ressource Referentiel suivante est introuvable : " + referentielVersion); |
| | | } |
| | | |
| | | Participant participantFound = participantsMap.get(codeParticipant); |
| | | if (participantFound == null) { |
| | | throw new CommonRessourceNotFoundException("La ressource Participant suivante est introuvable : " + codeParticipant); |
| | | } |
| | | Noeud noeudFound = noeudsMap.get(n.getCode()); |
| | | |
| | | if (noeudFound == null) { |
| | | n.setReferentiel(referentielFound); |
| | | n.setParticipant(participantFound); |
| | | |
| | | savedNoeuds.add(noeudManager.save(n)); |
| | | } |
| | | |
| | | } |
| | | } |
| | | // return savedNoeuds; |
| | | } |
| | | |
| | | private void persistGroupeNoeuds(List<GroupeNoeud> groupeNoeuds) { |
| | | groupeNoeudsMap = groupeNoeudManager.getAll(null).stream().collect(Collectors.toMap(GroupeNoeud::getCode, Function.identity())); |
| | | |
| | | if (groupeNoeuds != null) { |
| | | |
| | | for (GroupeNoeud gn : groupeNoeuds) { |
| | | String referentielVersion = gn.getReferentiel().getVersion(); |
| | | Referentiel referentielFound = referentielsMap.get(referentielVersion); |
| | | |
| | | if (referentielFound == null) { |
| | | throw new CommonRessourceNotFoundException("La ressource Referentiel suivante est introuvable : " + referentielVersion); |
| | | } |
| | | GroupeNoeud grpNoeudFound = groupeNoeudsMap.get(gn.getCode()); |
| | | |
| | | if (grpNoeudFound == null) { |
| | | gn.setReferentiel(referentielFound); |
| | | groupeNoeudManager.save(gn); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void persistGroupeParticipants(List<GroupeParticipant> groupeParticipants) { |
| | | groupeParticipantsMap = groupePartManager.getAll(null).stream().collect(Collectors.toMap(GroupeParticipant::getCode, Function.identity())); |
| | | |
| | | if (groupeParticipants != null) { |
| | | |
| | | for (GroupeParticipant gp : groupeParticipants) { |
| | | String referentielVersion = gp.getReferentiel().getVersion(); |
| | | Referentiel referentielFound = referentielsMap.get(referentielVersion); |
| | | |
| | | if (referentielFound == null) { |
| | | throw new CommonRessourceNotFoundException("La ressource Referentiel suivante est introuvable : " + referentielVersion); |
| | | } |
| | | GroupeParticipant grpParticipantFound = groupeParticipantsMap.get(gp.getCode()); |
| | | |
| | | if (grpParticipantFound == null) { |
| | | gp.setReferentiel(referentielFound); |
| | | groupePartManager.save(gp); |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void persistRoutages(List<Routage> routages) throws FileTypeNotExistException { |
| | | routagesMap = routageManager.getAll(null) |
| | | .stream() |
| | | .collect(Collectors.toMap(x -> x.getReferentiel().getVersion() + "-" + x.getTypeFichier().getCode(), |
| | | Function.identity())); |
| | | |
| | | if (routages != null) { |
| | | |
| | | for (Routage r : routages) { |
| | | String referentielVersion = r.getReferentiel().getVersion(); |
| | | String codeTypeFichier = r.getTypeFichier().getCode(); |
| | | |
| | | Referentiel referentielFound = referentielsMap.get(referentielVersion); |
| | | if (referentielFound == null) { |
| | | throw new CommonRessourceNotFoundException("Le referentiel suivant est introuvable : " + referentielVersion); |
| | | } |
| | | |
| | | TypeFichier typeFichierFound = typeFichiersMap.get(codeTypeFichier); |
| | | if (typeFichierFound == null) { |
| | | throw new FileTypeNotExistException(codeTypeFichier); |
| | | } |
| | | Routage routageFound = routagesMap.get(r.getReferentiel().getVersion() + "-" + r.getTypeFichier().getCode()); |
| | | |
| | | if (routageFound == null) { |
| | | r.setReferentiel(referentielFound); |
| | | r.setTypeFichier(typeFichierFound); |
| | | |
| | | routageManager.save(r); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void persistColumnsDefinition(List<TableDefinition> tablesDefinition) { |
| | | columnDefinitionsMap = columnDefinitionManager.getAll(null) |
| | | .stream() |
| | | .collect(Collectors.toMap(x -> x.getName() + "-" + x.getReferentielVersion() + "-" + x.getCodeTypeFichier(), |
| | | Function.identity() |
| | | )); |
| | | |
| | | if (tablesDefinition != null) { |
| | | |
| | | for (TableDefinition t : tablesDefinition) { |
| | | |
| | | for (ColumnDefinition c : t.getColumnDefinitions()) { |
| | | ColumnDefinition colDefFound = columnDefinitionsMap.get(c.getName() + "-" + c.getReferentielVersion() + "-" + c.getCodeTypeFichier()); |
| | | |
| | | if (colDefFound == null) { |
| | | columnDefinitionManager.save(c); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void persistNatureProductionFichiers(List<NatureProductionFichier> natureProductionFichs) throws FileTypeNotExistException { |
| | | natureProdFichsMap = natureProdFichManager.getAll(null) |
| | | .stream() |
| | | .collect(Collectors.toMap(x -> x.getReferentiel().getVersion() + "-" + x.getTypeFichier().getCode(), |
| | | Function.identity())); |
| | | |
| | | if (natureProductionFichs != null) { |
| | | |
| | | for (NatureProductionFichier n : natureProductionFichs) { |
| | | String referentielVersion = n.getReferentiel().getVersion(); |
| | | String codeTypeFichier = n.getTypeFichier().getCode(); |
| | | |
| | | Referentiel referentielFound = referentielsMap.get(referentielVersion); |
| | | if (referentielFound == null) { |
| | | throw new CommonRessourceNotFoundException("Le referentiel suivant est introuvable : " + referentielVersion); |
| | | } |
| | | |
| | | TypeFichier typeFichierFound = typeFichiersMap.get(codeTypeFichier); |
| | | if (typeFichierFound == null) { |
| | | throw new FileTypeNotExistException(codeTypeFichier); |
| | | } |
| | | NatureProductionFichier natureProdFichFound = natureProdFichsMap.get(n.getReferentiel().getVersion() + "-" + n.getTypeFichier().getCode()); |
| | | |
| | | if (natureProdFichFound == null) { |
| | | n.setReferentiel(referentielFound); |
| | | n.setTypeFichier(typeFichierFound); |
| | | |
| | | natureProdFichManager.save(n); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.impl.helper; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.helper.ApiRequestDataExporter; |
| | | import com.megatim.apifdxweb.tools.exceptions.ApplicationServerException; |
| | | import com.megatim.fdxcommons.core.ifaces.helper.DataInMemoryHandler; |
| | | import com.megatim.fdxcommons.tools.integration.FdxConsultationIntegrationData; |
| | | import com.megatim.fdxcommons.model.enumeration.TypeDonnee; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import java.io.BufferedWriter; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Path; |
| | | import java.nio.file.Paths; |
| | | import java.nio.file.StandardOpenOption; |
| | | import java.sql.Timestamp; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.logging.Level; |
| | | import java.util.logging.Logger; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.SelectQueryResult; |
| | | import com.megatim.fdxcommons.tools.database.tables.FdxApiTable; |
| | | import com.megatim.fdxcommons.tools.database.tables.dto.FdxTableRowDto; |
| | | import com.megatim.fdxcommons.tools.mappers.FdxTableMapper; |
| | | import java.util.Collections; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class ApiRequestDataExporterImpl implements ApiRequestDataExporter { |
| | | |
| | | @Inject |
| | | private DataInMemoryHandler dataInMemoryHandler; |
| | | |
| | | @Inject |
| | | private FdxTableMapper fdxTableMapper; |
| | | |
| | | @Override |
| | | public File export(FdxConsultationIntegrationData fileIntegrationData, String exportDirectory) { |
| | | Path path = constructFileName(fileIntegrationData.getDataProduction().getCodeTypeFichier(), |
| | | exportDirectory); |
| | | |
| | | try { |
| | | List<ColumnDefinition> columnsDefinition = new ArrayList(dataInMemoryHandler |
| | | .getDataInMemory() |
| | | .getTypeFichierToColumnDefinitions() |
| | | .get(fileIntegrationData.getDataProduction() |
| | | .getCodeTypeFichier()) |
| | | .values()); |
| | | |
| | | saveToFile(fileIntegrationData.getRows(), path, columnsDefinition); |
| | | } catch (IOException ex) { |
| | | Logger.getLogger(ApiRequestDataExporterImpl.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); |
| | | throw new ApplicationServerException(); |
| | | } |
| | | return path.toFile(); |
| | | } |
| | | |
| | | @Override |
| | | public File exportAll(String codeTypeFichier, String exportDirectory) { |
| | | Path path = constructFileName(codeTypeFichier, exportDirectory); |
| | | |
| | | try { |
| | | SelectQueryResult result = new FdxApiTable( |
| | | codeTypeFichier, |
| | | dataInMemoryHandler.getDataInMemory().getReferentielEnCours().getVersion(), |
| | | null |
| | | ).selectResult(null); |
| | | |
| | | List<ColumnDefinition> columnsDefinition = new ArrayList(dataInMemoryHandler.getDataInMemory().getTypeFichierToColumnDefinitions().get(codeTypeFichier).values()); |
| | | |
| | | saveToFile(fdxTableMapper.fdxTableRowListToFdxTableRowDtoList(result.rows()), path, columnsDefinition); |
| | | |
| | | } catch (Exception ex) { |
| | | Logger.getLogger(ApiRequestDataExporterImpl.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); |
| | | throw new ApplicationServerException(); |
| | | } |
| | | |
| | | return path.toFile(); |
| | | } |
| | | |
| | | private void saveToFile(List<FdxTableRowDto> rows, Path path, List<ColumnDefinition> columnsDefinition) throws IOException { |
| | | Collections.sort(columnsDefinition, (ColumnDefinition c1, ColumnDefinition c2) -> Integer.valueOf(c1.getPosition()).compareTo(c2.getPosition())); |
| | | |
| | | try ( BufferedWriter bufferWriter = Files.newBufferedWriter(path, StandardCharsets.UTF_8, StandardOpenOption.APPEND, StandardOpenOption.CREATE, StandardOpenOption.SYNC)) { |
| | | |
| | | for (FdxTableRowDto fdxTableRow : rows) { |
| | | String line = getLineFromColumnData(fdxTableRow, columnsDefinition); |
| | | bufferWriter.write(line + System.lineSeparator()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private String getLineFromColumnData(FdxTableRowDto fdxTableRow, List<ColumnDefinition> columnsDefinition) { |
| | | StringBuilder line = new StringBuilder(""); |
| | | |
| | | for (ColumnDefinition columnDefinition : columnsDefinition) { |
| | | fdxTableRow.getDataColumns().stream().filter(p -> p.getName().trim().equalsIgnoreCase(columnDefinition.getName().trim())).findFirst().ifPresent(c -> { |
| | | line.append(normalizeValue(c.getValue(), columnDefinition)); |
| | | }); |
| | | } |
| | | return line.toString(); |
| | | |
| | | } |
| | | |
| | | private String normalizeValue(Object value, ColumnDefinition columnDefinition) { |
| | | String stringValue = value != null ? value.toString() : ""; |
| | | |
| | | if (columnDefinition.getTypeDonnee().equals(TypeDonnee.DATE.getValue())) { |
| | | if (stringValue.isEmpty()) { |
| | | stringValue = generateUnknown(columnDefinition.getTaille(), " "); |
| | | } else { |
| | | Timestamp timestamp = null; |
| | | if (value instanceof Timestamp) { |
| | | timestamp = (Timestamp) value; |
| | | } else { |
| | | timestamp = new Timestamp((long) value); |
| | | } |
| | | stringValue = formatDateToString(timestamp, columnDefinition); |
| | | } |
| | | } |
| | | if (stringValue.length() < columnDefinition.getTaille()) { |
| | | stringValue = formatData(TypeDonnee.fromValeur(columnDefinition.getTypeDonnee()), stringValue, columnDefinition.getTaille()); |
| | | } |
| | | return stringValue; |
| | | } |
| | | |
| | | private String generateUnknown(int nbOfCharacter, String character) { |
| | | StringBuilder str = new StringBuilder(""); |
| | | |
| | | for (int i = 0; i < nbOfCharacter; i++) { |
| | | str.append(character); |
| | | } |
| | | return str.toString(); |
| | | } |
| | | |
| | | private String formatData(TypeDonnee typeDonnee, String data, int columnSize) { |
| | | |
| | | if (typeDonnee != null) { |
| | | |
| | | switch (typeDonnee) { |
| | | |
| | | case NUMERIQUE: |
| | | |
| | | case DECIMAL: |
| | | return generateUnknown(columnSize - data.length(), "0") + data; |
| | | |
| | | case ALPHANUMERIQUE: |
| | | |
| | | case DATE: |
| | | |
| | | default: |
| | | return data + generateUnknown(columnSize - data.length(), " "); |
| | | } |
| | | } else { |
| | | throw new IllegalArgumentException(); |
| | | } |
| | | } |
| | | |
| | | private Path constructFileName(String codeTypeFichier, String exportDirectory) { |
| | | LocalDateTime date = LocalDateTime.now(); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); |
| | | Path path = Paths.get(exportDirectory, codeTypeFichier.toUpperCase() + date.format(formatter) + ".txt"); |
| | | |
| | | return path; |
| | | } |
| | | |
| | | private String formatDateToString(Object obj, ColumnDefinition columnDefinition) { |
| | | if (obj == null) { |
| | | return generateUnknown(columnDefinition.getTaille(), " "); |
| | | } |
| | | Timestamp data = (Timestamp) obj; |
| | | LocalDateTime localDateTime = data.toLocalDateTime(); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern(columnDefinition.getFormatDate()); |
| | | |
| | | if (formatter == null) { |
| | | return localDateTime.toString().substring(0, columnDefinition.getTaille()); |
| | | } else { |
| | | return localDateTime.format(formatter); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.impl.helper; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.helper.DataConsumptionOperations; |
| | | import com.megatim.apifdxweb.core.ifaces.helper.RoutingChecker; |
| | | import com.megatim.apifdxweb.dao.impl.audit.AuditActionsParticicipantsQuery; |
| | | import com.megatim.apifdxweb.dao.impl.audit.AuditActionsParticipantRepository; |
| | | import com.megatim.apifdxweb.model.audit.AuditActionsParticipant; |
| | | import com.megatim.apifdxweb.tools.AppContext; |
| | | import com.megatim.commons.tools.exceptions.ApplicationServerException; |
| | | import com.megatim.fdxcommons.core.ifaces.helper.DataInMemoryHandler; |
| | | import com.megatim.fdxcommons.model.enumeration.CriteriaLogicConnector; |
| | | import com.megatim.fdxcommons.model.enumeration.Operateur; |
| | | import com.megatim.fdxcommons.model.pojo.CriteriaEntityFromView; |
| | | import com.megatim.fdxcommons.model.pojo.PageData; |
| | | import com.megatim.fdxcommons.tools.database.connection.DBConnection; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryCriterion; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.SelectQueryResult; |
| | | import com.megatim.fdxcommons.tools.database.tables.DateActionColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.FdxApiTable; |
| | | import com.megatim.fdxcommons.tools.database.tables.FdxTableRow; |
| | | import com.megatim.fdxcommons.tools.database.tables.IndexColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.exceptions.CommonApplicationServerException; |
| | | import com.megatim.fdxcommons.tools.exceptions.CommonRessourceNotFoundException; |
| | | import com.megatim.fdxcommons.tools.utils.CriteriaEntityFromViewToQueryCriterion; |
| | | import java.sql.Connection; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.logging.Level; |
| | | import java.util.logging.Logger; |
| | | import java.util.stream.Collectors; |
| | | import javax.annotation.Resource; |
| | | import javax.ejb.EJB; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | import javax.sql.DataSource; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | @Dependent |
| | | public class DataConsumptionOperationsImpl implements DataConsumptionOperations { |
| | | |
| | | @Resource(lookup = AppContext.JNDI_NAME) |
| | | private DataSource dataSource; |
| | | |
| | | @Inject |
| | | private DataInMemoryHandler dataInMemoryHandler; |
| | | |
| | | @Inject |
| | | private RoutingChecker routingChecker; |
| | | |
| | | @EJB |
| | | private AuditActionsParticipantRepository auditActionsParticipantRepository; |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> loadAll(String codeTypeFichier, String codeParticipant) { |
| | | stopIfNotConsumer(codeTypeFichier, codeParticipant); |
| | | |
| | | try ( Connection connection = new DBConnection(dataSource).connection()) { |
| | | |
| | | connection.setAutoCommit(false); |
| | | |
| | | SelectQueryResult result = selectResult(connection, codeTypeFichier, null); |
| | | performAudit(connection, codeParticipant, codeTypeFichier, result.lastIndexRead()); |
| | | |
| | | connection.commit(); |
| | | |
| | | return selectedData(result.rows()); |
| | | } catch (Exception ex) { |
| | | Logger.getLogger(DataConsumptionOperationsImpl.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); |
| | | throw new CommonApplicationServerException(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> findByCriterias(String codeTypeFichier, CriteriaEntityFromView criterion, String codeParticipant) { |
| | | stopIfNotConsumer(codeTypeFichier, codeParticipant); |
| | | |
| | | try ( Connection connection = new DBConnection(dataSource).connection()) { |
| | | |
| | | SelectQueryResult result = selectResult(connection, codeTypeFichier, new CriteriaEntityFromViewToQueryCriterion(criterion).queryCriterion()); |
| | | return selectedData(result.rows()); |
| | | |
| | | } catch (Exception ex) { |
| | | Logger.getLogger(DataConsumptionOperationsImpl.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); |
| | | throw new CommonApplicationServerException(); |
| | | } |
| | | } |
| | | |
| | | // @Override |
| | | // public List<Map<String, Object>> loadAllUpdated(String codeTypeFichier, String codeParticipant) { |
| | | // stopIfNotConsumer(codeTypeFichier, codeParticipant); |
| | | // |
| | | // try ( Connection connection = new DBConnection(dataSource).connection()) { |
| | | // |
| | | // connection.setAutoCommit(false); |
| | | // |
| | | // SelectQueryResult result = selectResult(connection, codeTypeFichier, updatedCriterion(codeTypeFichier, codeParticipant)); |
| | | // |
| | | // if (!result.rows().isEmpty()) { |
| | | // performAudit(connection, codeParticipant, codeTypeFichier, result.lastIndexRead()); |
| | | // } |
| | | // connection.commit(); |
| | | // return selectedData(result.rows()); |
| | | // } catch (Exception ex) { |
| | | // Logger.getLogger(DataConsumptionOperationsImpl.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); |
| | | // throw new CommonApplicationServerException(); |
| | | // } |
| | | // } |
| | | @Override |
| | | public List<Map<String, Object>> loadAllAddedAndUpdated(String codeTypeFichier, String codeParticipant) { |
| | | stopIfNotConsumer(codeTypeFichier, codeParticipant); |
| | | |
| | | try ( Connection connection = new DBConnection(dataSource).connection()) { |
| | | |
| | | connection.setAutoCommit(false); |
| | | |
| | | SelectQueryResult result = selectResult(connection, codeTypeFichier, loadedAndUpdatedCriterion(codeTypeFichier, codeParticipant)); |
| | | |
| | | if (!result.rows().isEmpty()) { |
| | | performAudit(connection, codeParticipant, codeTypeFichier, result.lastIndexRead()); |
| | | } |
| | | connection.commit(); |
| | | return selectedData(result.rows()); |
| | | } catch (Exception ex) { |
| | | Logger.getLogger(DataConsumptionOperationsImpl.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); |
| | | throw new CommonApplicationServerException(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public PageData loadAllWithPagination(String codeTypeFichier, String codeParticipant, int pageNumber, int pageSize) { |
| | | stopIfNotConsumer(codeTypeFichier, codeParticipant); |
| | | |
| | | try ( Connection connection = new DBConnection(dataSource).connection()) { |
| | | return getPageData(connection, codeTypeFichier, null, pageNumber, pageSize); |
| | | |
| | | } catch (Exception ex) { |
| | | Logger.getLogger(DataConsumptionOperationsImpl.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); |
| | | throw new CommonApplicationServerException(); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public PageData findByCriteriaWithPagination(String codeTypeFichier, CriteriaEntityFromView criterion, String codeParticipant, int pageNumber, int pageSize) { |
| | | stopIfNotConsumer(codeTypeFichier, codeParticipant); |
| | | |
| | | try ( Connection connection = new DBConnection(dataSource).connection()) { |
| | | return getPageData(connection, codeTypeFichier, new CriteriaEntityFromViewToQueryCriterion(criterion).queryCriterion(), pageNumber, pageSize); |
| | | |
| | | } catch (Exception ex) { |
| | | Logger.getLogger(DataConsumptionOperationsImpl.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); |
| | | throw new CommonApplicationServerException(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public long countAll(String codeTypeFichier, String codeParticipant) { |
| | | stopIfNotConsumer(codeTypeFichier, codeParticipant); |
| | | |
| | | try ( Connection connection = new DBConnection(dataSource).connection()) { |
| | | return count(connection, codeTypeFichier, null); |
| | | |
| | | } catch (Exception ex) { |
| | | Logger.getLogger(DataConsumptionOperationsImpl.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); |
| | | throw new CommonApplicationServerException(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public long countAllLoadedOrUpdated(String codeTypeFichier, String codeParticipant) { |
| | | stopIfNotConsumer(codeTypeFichier, codeParticipant); |
| | | |
| | | try ( Connection connection = new DBConnection(dataSource).connection()) { |
| | | return count(connection, codeTypeFichier, loadedAndUpdatedCriterion(codeTypeFichier, codeParticipant)); |
| | | } catch (Exception ex) { |
| | | Logger.getLogger(DataConsumptionOperationsImpl.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); |
| | | throw new CommonApplicationServerException(); |
| | | } |
| | | } |
| | | |
| | | private void performAudit(Connection connection, String participantDemandeur, String typeFichierConsulte, int lastReadIndex) throws Exception { |
| | | AuditActionsParticipant auditAction = lastAudit(participantDemandeur, typeFichierConsulte); |
| | | LocalDateTime dateAction = LocalDateTime.now(); |
| | | |
| | | if (auditAction == null) { |
| | | auditAction = new AuditActionsParticipant(); |
| | | auditAction.setParticipantDemandeur(participantDemandeur); |
| | | auditAction.setTypeFichierConsulte(typeFichierConsulte); |
| | | auditAction.setLastIndexRead(lastReadIndex); |
| | | auditAction.setDateAction(dateAction); |
| | | |
| | | new AuditActionsParticicipantsQuery(connection, auditAction).insert(); |
| | | |
| | | } else { |
| | | auditAction.setDateAction(dateAction); |
| | | |
| | | if (lastReadIndex > auditAction.getLastIndexRead()) { |
| | | auditAction.setLastIndexRead(lastReadIndex); |
| | | } |
| | | |
| | | new AuditActionsParticicipantsQuery(connection, auditAction).update(); |
| | | } |
| | | } |
| | | |
| | | private AuditActionsParticipant lastAudit(String codeParticipant, String codeTypeFichier) { |
| | | return auditActionsParticipantRepository.lastAudit(codeParticipant, codeTypeFichier); |
| | | } |
| | | |
| | | private long count(Connection connection, String codeTypeFichier, QueryCriterion criterion) { |
| | | try { |
| | | |
| | | return table(connection, codeTypeFichier).count(criterion); |
| | | } catch (Exception ex) { |
| | | throw new ApplicationServerException(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | private SelectQueryResult selectResult(Connection connection, String codeTypeFichier, QueryCriterion queryCriterion) { |
| | | try { |
| | | return table(connection, codeTypeFichier).selectResult(queryCriterion); |
| | | } catch (Exception ex) { |
| | | throw new ApplicationServerException(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | private SelectQueryResult selectResult(Connection connection, String codeTypeFichier, QueryCriterion queryCriterion, int pageNumber, int pageSize) { |
| | | try { |
| | | int offset = (pageNumber - 1) * pageSize; |
| | | return table(connection, codeTypeFichier).selectResult(queryCriterion, pageSize, offset); |
| | | } catch (Exception ex) { |
| | | throw new ApplicationServerException(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | private List<Map<String, Object>> selectedData(List<FdxTableRow> rows) { |
| | | return rows |
| | | .stream() |
| | | .map(r -> { |
| | | Map<String, Object> result = new HashMap<>(); |
| | | r.getDataColumns().forEach(column -> result.put(column.getName(), column.getValue())); |
| | | return result; |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | private FdxApiTable table(Connection connection, String codeTypeFichier) { |
| | | return new FdxApiTable(codeTypeFichier, versionReferentiel(), connection); |
| | | } |
| | | |
| | | private String versionReferentiel() { |
| | | return dataInMemoryHandler.getDataInMemory().getReferentielEnCours().getVersion(); |
| | | } |
| | | |
| | | private void stopIfNotConsumer(String codeTypeFichier, String connectedParticipant) { |
| | | if (dataInMemoryHandler.getDataInMemory().getReferentielEnCours() == null) { |
| | | throw new CommonRessourceNotFoundException("Aucun référentiel en cours"); |
| | | } |
| | | routingChecker.stopIfTypeFichierNotExists(codeTypeFichier, dataInMemoryHandler.getDataInMemory()); |
| | | routingChecker.stopIfNotConsumer(codeTypeFichier, dataInMemoryHandler.getDataInMemory(), connectedParticipant); |
| | | } |
| | | |
| | | private PageData getPageData(Connection connection, String codeTypeFichier, QueryCriterion queryCriterion, int pageNumber, int pageSize) { |
| | | |
| | | try { |
| | | |
| | | SelectQueryResult result = selectResult(connection, codeTypeFichier, queryCriterion, pageNumber, pageSize); |
| | | |
| | | List<Map<String, Object>> loadedData = selectedData(result.rows()); |
| | | long totalNumberOfElements = table(connection, codeTypeFichier).count(queryCriterion); |
| | | |
| | | PageData pageData = new PageData(); |
| | | pageData.setLoadedData(loadedData); |
| | | pageData.setPageNumber(pageNumber); |
| | | pageData.setPageSize(pageSize); |
| | | pageData.setTotalNumberOfElements(totalNumberOfElements); |
| | | |
| | | return pageData; |
| | | |
| | | } catch (Exception ex) { |
| | | throw new ApplicationServerException(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | private QueryCriterion updatedCriterion(String codeTypeFichier, String codeParticipant) { |
| | | AuditActionsParticipant lastAudit = lastAudit(codeParticipant, codeTypeFichier); |
| | | if (lastAudit != null) { |
| | | |
| | | String dateActionColonne = new DateActionColumnDefinition().name(); |
| | | |
| | | return new QueryCriterion( |
| | | dateActionColonne, |
| | | lastAudit.getDateAction(), |
| | | Operateur.GREATER_THAN, |
| | | null, |
| | | Arrays.asList() |
| | | ); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | private QueryCriterion loadedAndUpdatedCriterion(String codeTypeFichier, String codeParticipant) { |
| | | AuditActionsParticipant lastAudit = lastAudit(codeParticipant, codeTypeFichier); |
| | | if (lastAudit != null) { |
| | | |
| | | String indexColonne = new IndexColumnDefinition().name(); |
| | | String dateActionColonne = new DateActionColumnDefinition().name(); |
| | | |
| | | return new QueryCriterion( |
| | | null, |
| | | null, |
| | | null, |
| | | CriteriaLogicConnector.OR, |
| | | Arrays.asList( |
| | | new QueryCriterion( |
| | | indexColonne, |
| | | lastAudit.getLastIndexRead(), |
| | | Operateur.GREATER_THAN, |
| | | null, |
| | | Arrays.asList() |
| | | ), |
| | | new QueryCriterion( |
| | | dateActionColonne, |
| | | lastAudit.getDateAction(), |
| | | Operateur.GREATER_THAN, |
| | | null, |
| | | Arrays.asList() |
| | | ) |
| | | ) |
| | | ); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.helper; |
| | | |
| | | import com.megatim.fdxcommons.core.ifaces.helper.DataInMemoryHandler; |
| | | import com.megatim.apifdxweb.core.ifaces.integration.ColumnDefinitionManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ReferentielManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.RoutageManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.TypeFichierManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.natureproduction.NatureProductionFichierManager; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.model.pojo.DataInMemory; |
| | | import com.megatim.fdxcommons.model.referentiel.Referentiel; |
| | | import com.megatim.fdxcommons.model.referentiel.TypeFichier; |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProductionFichier; |
| | | import com.megatim.fdxcommons.model.searchentities.ColumnDefinitionSearch; |
| | | import groovy.transform.Synchronized; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | import javax.enterprise.context.ApplicationScoped; |
| | | import javax.inject.Inject; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @ApplicationScoped |
| | | public class DataInMemoryHandlerImpl implements DataInMemoryHandler { |
| | | |
| | | private DataInMemory dataInMemory; |
| | | |
| | | @Inject |
| | | ColumnDefinitionManager columnDefinitionManager; |
| | | |
| | | @Inject |
| | | private TypeFichierManager typeFichierManager; |
| | | |
| | | @Inject |
| | | private ReferentielManager referentielManager; |
| | | |
| | | @Inject |
| | | private NatureProductionFichierManager natureProdManager; |
| | | |
| | | @Inject |
| | | private RoutageManager routageManager; |
| | | |
| | | @Override |
| | | @Synchronized |
| | | public void initializeDataInMemory() { |
| | | dataInMemory = new DataInMemory(); |
| | | Referentiel referentielEncours = referentielManager.getReferentielEnCours(); |
| | | |
| | | if (referentielEncours != null) { |
| | | dataInMemory.setReferentielEnCours(referentielEncours); |
| | | dataInMemory.setCodeTypeFichierToTypeFichiers(getTypeFichiers()); |
| | | dataInMemory.setTypeFichierToColumnDefinitions(getColumnsDefinitions(referentielEncours.getVersion())); |
| | | dataInMemory.setTypeFichierToNatureProductionsFichiers(getNatureProductionFichiers(referentielEncours.getVersion())); |
| | | getParticipantsForRoutages(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public DataInMemory getDataInMemory() { |
| | | return this.dataInMemory; |
| | | } |
| | | |
| | | private void getParticipantsForRoutages() { |
| | | dataInMemory.getCodeTypeFichierToTypeFichiers().values().stream().forEach(t -> { |
| | | dataInMemory.getTypeFichierToParticipantsEnvoi() |
| | | .put(t.getCode(), |
| | | routageManager |
| | | .getParticipantsForSend(dataInMemory.getReferentielEnCours().getVersion(), t.getCode()) |
| | | .stream() |
| | | .map(p -> p.getCode()) |
| | | .collect(Collectors.toSet()) |
| | | ); |
| | | |
| | | dataInMemory.getTypeFichierToParticipantsReception() |
| | | .put(t.getCode(), |
| | | routageManager |
| | | .getParticipantsForReceive(dataInMemory.getReferentielEnCours().getVersion(), t.getCode()) |
| | | .stream() |
| | | .map(p -> p.getCode()) |
| | | .collect(Collectors.toSet()) |
| | | ); |
| | | |
| | | }); |
| | | |
| | | } |
| | | |
| | | private Map<String, Map<String, ColumnDefinition>> getColumnsDefinitions(String referentielVersion) { |
| | | Map<String, Map<String, ColumnDefinition>> columnsDefinitionMap = new HashMap<>(); |
| | | ColumnDefinitionSearch searchEntity = new ColumnDefinitionSearch(); |
| | | searchEntity.setReferentielVersion(referentielVersion); |
| | | |
| | | List<ColumnDefinition> columnsDefinition = columnDefinitionManager.getAll(searchEntity); |
| | | columnsDefinition.stream().forEach(c -> { |
| | | if (columnsDefinitionMap.containsKey(c.getCodeTypeFichier())) { |
| | | Map<String, ColumnDefinition> map = columnsDefinitionMap.get(c.getCodeTypeFichier()); |
| | | map.put(c.getName(), c); |
| | | columnsDefinitionMap.put(c.getCodeTypeFichier(), map); |
| | | } else { |
| | | Map<String, ColumnDefinition> map = new HashMap<>(); |
| | | map.put(c.getName(), c); |
| | | columnsDefinitionMap.put(c.getCodeTypeFichier(), map); |
| | | } |
| | | }); |
| | | return columnsDefinitionMap; |
| | | } |
| | | |
| | | private Map<String, TypeFichier> getTypeFichiers() { |
| | | return typeFichierManager.getAll().stream().collect(Collectors.toMap(TypeFichier::getCode, Function.identity())); |
| | | } |
| | | |
| | | private Map<String, NatureProductionFichier> getNatureProductionFichiers(String referentielVersion) { |
| | | return natureProdManager.getByReferentiel(referentielVersion) |
| | | .stream() |
| | | .collect(Collectors.toMap(x -> x.getTypeFichier().getCode(), Function.identity())); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.impl.helper; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.helper.DataProductionOperations; |
| | | import com.megatim.apifdxweb.core.ifaces.helper.RoutingChecker; |
| | | import com.megatim.apifdxweb.model.request.UpdateRequest; |
| | | import com.megatim.apifdxweb.tools.AppContext; |
| | | import com.megatim.commons.tools.exceptions.ApplicationServerException; |
| | | import com.megatim.fdxcommons.core.ifaces.helper.DataInMemoryHandler; |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProduction; |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProductionSource; |
| | | import com.megatim.fdxcommons.model.pojo.CriteriaEntityFromView; |
| | | import com.megatim.fdxcommons.tools.database.connection.DBConnection; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryCriterion; |
| | | import com.megatim.fdxcommons.tools.database.tables.FdxApiTable; |
| | | import com.megatim.fdxcommons.tools.exceptions.CommonRessourceNotFoundException; |
| | | import com.megatim.fdxcommons.tools.utils.CriteriaEntityFromViewToQueryCriterion; |
| | | import java.sql.Connection; |
| | | import java.time.LocalDateTime; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | import javax.sql.DataSource; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | @Dependent |
| | | public class DataProductionOperationsImpl implements DataProductionOperations { |
| | | |
| | | @Resource(lookup = AppContext.JNDI_NAME) |
| | | private DataSource dataSource; |
| | | |
| | | @Inject |
| | | private DataInMemoryHandler dataInMemoryHandler; |
| | | |
| | | @Inject |
| | | private RoutingChecker routingChecker; |
| | | |
| | | @Override |
| | | public void saveAll(String codeTypeFichier, List<LinkedHashMap<String, Object>> datas, String connectedParticipant) { |
| | | |
| | | stopIfProductionNotPermitted(codeTypeFichier, connectedParticipant); |
| | | |
| | | try ( Connection connection = new DBConnection(dataSource).connection()) { |
| | | connection.setAutoCommit(false); |
| | | |
| | | DataProduction dataProduction = newDataProduction(codeTypeFichier, connectedParticipant); |
| | | table(connection, codeTypeFichier).insert((List<LinkedHashMap<String, Object>>) datas, dataProduction); |
| | | |
| | | connection.commit(); |
| | | } catch (Exception ex) { |
| | | throw new ApplicationServerException(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void saveOne(String codeTypeFichier, LinkedHashMap<String, Object> data, String connectedParticipant) { |
| | | |
| | | stopIfProductionNotPermitted(codeTypeFichier, connectedParticipant); |
| | | |
| | | try ( Connection connection = new DBConnection(dataSource).connection()) { |
| | | connection.setAutoCommit(false); |
| | | |
| | | DataProduction dataProduction = newDataProduction(codeTypeFichier, connectedParticipant); |
| | | table(connection, codeTypeFichier).insert(data, dataProduction); |
| | | |
| | | connection.commit(); |
| | | } catch (Exception ex) { |
| | | throw new ApplicationServerException(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void updateAll(String codeTypeFichier, UpdateRequest updateRequest, String connectedParticipant) { |
| | | |
| | | stopIfProductionNotPermitted(codeTypeFichier, connectedParticipant); |
| | | |
| | | try ( Connection connection = new DBConnection(dataSource).connection()) { |
| | | connection.setAutoCommit(false); |
| | | |
| | | QueryCriterion queryCriterion = new CriteriaEntityFromViewToQueryCriterion(updateRequest.getCriteriaEntityFromView()).queryCriterion(); |
| | | table(connection, codeTypeFichier).update(updateRequest.getDataToUpdate(), queryCriterion); |
| | | |
| | | connection.commit(); |
| | | } catch (Exception ex) { |
| | | throw new ApplicationServerException(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void updateOne(String codeTypeFichier, UpdateRequest updateRequest, String connectedParticipant) { |
| | | |
| | | stopIfProductionNotPermitted(codeTypeFichier, connectedParticipant); |
| | | |
| | | try ( Connection connection = new DBConnection(dataSource).connection()) { |
| | | connection.setAutoCommit(false); |
| | | |
| | | QueryCriterion queryCriterion = new CriteriaEntityFromViewToQueryCriterion(updateRequest.getCriteriaEntityFromView()).queryCriterion(); |
| | | table(connection, codeTypeFichier).updateOne(updateRequest.getDataToUpdate(), queryCriterion); |
| | | |
| | | connection.commit(); |
| | | } catch (Exception ex) { |
| | | throw new ApplicationServerException(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(String codeTypeFichier, CriteriaEntityFromView criterionFromView, String connectedParticipant) { |
| | | |
| | | stopIfProductionNotPermitted(codeTypeFichier, connectedParticipant); |
| | | |
| | | try ( Connection connection = new DBConnection(dataSource).connection()) { |
| | | connection.setAutoCommit(false); |
| | | |
| | | QueryCriterion queryCriterion = new CriteriaEntityFromViewToQueryCriterion(criterionFromView).queryCriterion(); |
| | | table(connection, codeTypeFichier).delete(queryCriterion); |
| | | |
| | | connection.commit(); |
| | | } catch (Exception ex) { |
| | | throw new ApplicationServerException(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void deleteOne(String codeTypeFichier, CriteriaEntityFromView criterionFromView, String connectedParticipant) { |
| | | |
| | | stopIfProductionNotPermitted(codeTypeFichier, connectedParticipant); |
| | | |
| | | try ( Connection connection = new DBConnection(dataSource).connection()) { |
| | | connection.setAutoCommit(false); |
| | | |
| | | QueryCriterion queryCriterion = new CriteriaEntityFromViewToQueryCriterion(criterionFromView).queryCriterion(); |
| | | table(connection, codeTypeFichier).deleteOne(queryCriterion); |
| | | |
| | | connection.commit(); |
| | | } catch (Exception ex) { |
| | | throw new ApplicationServerException(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | private FdxApiTable table(Connection connection, String codeTypeFichier) { |
| | | return new FdxApiTable(codeTypeFichier, versionReferentiel(), connection); |
| | | } |
| | | |
| | | private DataProduction newDataProduction(String codeTypeFichier, String codeParticipant) { |
| | | DataProduction dataProduction = new DataProduction(); |
| | | dataProduction.setDateProduction(LocalDateTime.now()); |
| | | dataProduction.setReferentielVersion(versionReferentiel()); |
| | | dataProduction.setCodeTypeFichier(codeTypeFichier); |
| | | dataProduction.setCodeParticipant(codeParticipant); |
| | | dataProduction.setSource(DataProductionSource.API); |
| | | |
| | | return dataProduction; |
| | | } |
| | | |
| | | private String versionReferentiel() { |
| | | return dataInMemoryHandler.getDataInMemory().getReferentielEnCours().getVersion(); |
| | | } |
| | | |
| | | private void stopIfProductionNotPermitted(String codeTypeFichier, String connectedParticipant) { |
| | | if (dataInMemoryHandler.getDataInMemory().getReferentielEnCours() == null) { |
| | | throw new CommonRessourceNotFoundException("Aucun référentiel en cours"); |
| | | } |
| | | routingChecker.stopIfTypeFichierNotExists(codeTypeFichier, dataInMemoryHandler.getDataInMemory()); |
| | | routingChecker.stopIfNotProducer(codeTypeFichier, dataInMemoryHandler.getDataInMemory(), connectedParticipant); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.impl.helper; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.helper.FileDataReader; |
| | | import com.megatim.apifdxweb.core.ifaces.integration.ColumnDefinitionManager; |
| | | import com.megatim.fdxcommons.core.impl.tools.CommonUtilities; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | import java.nio.charset.Charset; |
| | | import java.util.LinkedHashMap; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | @Dependent |
| | | public class FileDataReaderImpl implements FileDataReader { |
| | | |
| | | @Inject |
| | | private ColumnDefinitionManager columnDefinitionManager; |
| | | |
| | | @Override |
| | | public List<LinkedHashMap<String, Object>> getDatas(String referentielVersion, String codeTypeFichier, File dataFile) throws Exception { |
| | | List<LinkedHashMap<String, Object>> datas = new ArrayList<>(); |
| | | List<ColumnDefinition> columnsDefinition = columnDefinitionManager.findByReferentielAndTypeFichier(referentielVersion, codeTypeFichier); |
| | | |
| | | //Ranger les olonnes par ordre croissant de position |
| | | Collections.sort(columnsDefinition, (ColumnDefinition c1, ColumnDefinition c2) -> Integer.valueOf(c1.getPosition()).compareTo(c2.getPosition())); |
| | | |
| | | //On détermine l'encodage du fichier |
| | | Charset charset = CommonUtilities.getCharset(dataFile); |
| | | |
| | | try ( FileInputStream fis = new FileInputStream(dataFile); InputStreamReader isr = new InputStreamReader(fis, charset); BufferedReader reader = new BufferedReader(isr)) { |
| | | String line; |
| | | while ((line = reader.readLine()) != null) { |
| | | LinkedHashMap<String, Object> dataLine = getLine(line, columnsDefinition); |
| | | datas.add(dataLine); |
| | | } |
| | | } |
| | | |
| | | return datas; |
| | | } |
| | | |
| | | private LinkedHashMap<String, Object> getLine(final String line, final List<ColumnDefinition> columnsDefinition) { |
| | | LinkedHashMap<String, Object> dataLine = new LinkedHashMap<>(); |
| | | int index = 0; |
| | | |
| | | for (ColumnDefinition c : columnsDefinition) { |
| | | |
| | | //traitement des colonnes du type fichier |
| | | String data = line.substring(index, index + c.getTaille()); |
| | | dataLine.put(c.getName(), data); |
| | | |
| | | index += c.getTaille(); |
| | | } |
| | | |
| | | return dataLine; |
| | | |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.helper; |
| | | |
| | | import com.megatim.fdxcommons.model.pojo.ColumnData; |
| | | import com.megatim.fdxcommons.model.pojo.DbColumn; |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class HelperUtils { |
| | | |
| | | private HelperUtils() { |
| | | |
| | | } |
| | | |
| | | // public static List<ColumnData> getRow(Map<String, DbColumn> tableColumns, LinkedHashMap data, String tableName, Long dataProductionId) throws SQLException { |
| | | // |
| | | // Map<String, ColumnData> row = new HashMap<>(); |
| | | // |
| | | // data.forEach((k, v) -> { |
| | | // |
| | | // ColumnData columnData = new ColumnData(); |
| | | // DbColumn dbColumn = tableColumns.get(k.toString().trim().toLowerCase()); |
| | | // |
| | | // columnData.setName(dbColumn.getColumnName()); |
| | | // columnData.setPosition(dbColumn.getOrdinalPosition()); |
| | | // columnData.setValue(v); |
| | | // columnData.setSqlDataType(dbColumn.getDataType()); |
| | | // columnData.setTaille(dbColumn.getSize()); |
| | | // |
| | | // row.put(columnData.getName(), columnData); |
| | | // |
| | | // }); |
| | | // |
| | | // //Ajout des colonnes du typeficier absentes avec leurs valeurs par défaut |
| | | // tableColumns.forEach((k, v) -> { |
| | | // |
| | | // if (!row.containsKey(k)) { |
| | | // ColumnData columnData = new ColumnData(); |
| | | // columnData.setName(v.getColumnName()); |
| | | // columnData.setPosition(v.getOrdinalPosition()); |
| | | // columnData.setSqlDataType(v.getDataType()); |
| | | // columnData.setTaille(v.getSize()); |
| | | // columnData.setValue(v.getDefaultValue()); |
| | | // |
| | | // row.put(k, columnData); |
| | | // } |
| | | // }); |
| | | // |
| | | // List<ColumnData> liste = new ArrayList<>(row.values()); |
| | | // liste.addAll(customColumnsData(tableName, dataProductionId)); |
| | | // |
| | | // return liste; |
| | | // } |
| | | |
| | | // public static List<ColumnData> customColumnsData(String tableName, Long dataProductionId) throws SQLException { |
| | | // Map<String, DbColumn> allCustomColumns = SqlUtilities.customColumnsToMap(tableName, AppContext.JNDI_NAME); |
| | | // DbColumn dbColumn = allCustomColumns.get(CustomColumns.DATA_PRODUCTION_ID_COLUMN); |
| | | // |
| | | // List<ColumnData> data = new ArrayList<>(); |
| | | // |
| | | // ColumnData columnData = new ColumnData(); |
| | | // columnData.setName(dbColumn.getColumnName()); |
| | | // columnData.setPosition(dbColumn.getOrdinalPosition()); |
| | | // columnData.setSqlDataType(dbColumn.getDataType()); |
| | | // columnData.setTaille(dbColumn.getSize()); |
| | | // columnData.setValue(dataProductionId); |
| | | // data.add(columnData); |
| | | // |
| | | // return data; |
| | | // } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.impl.helper; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ReferentielManager; |
| | | import com.megatim.apifdxweb.tools.AppContext; |
| | | import com.megatim.fdxcommons.core.ifaces.db.ReferentielDataSaver; |
| | | import com.megatim.fdxcommons.core.ifaces.helper.DataInMemoryHandler; |
| | | import com.megatim.fdxcommons.core.ifaces.helper.ReferentielConsumptionHelper; |
| | | import com.megatim.fdxcommons.core.ifaces.helper.referentiel.DynamicTableCreator; |
| | | import com.megatim.fdxcommons.model.pojo.ReferentielToImportData; |
| | | import com.megatim.fdxcommons.model.referentiel.Referentiel; |
| | | import com.megatim.fdxcommons.tools.exceptions.ImportReferentielException; |
| | | import javax.annotation.Resource; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | import javax.sql.DataSource; |
| | | import javax.transaction.Transactional; |
| | | import com.megatim.fdxcommons.core.ifaces.dataproduction.DataMigration; |
| | | import com.megatim.fdxcommons.core.ifaces.referentiel.historique.ReferentielIntegrationHistoriqueManager; |
| | | import com.megatim.fdxcommons.model.pojo.TableDefinition; |
| | | import com.megatim.fdxcommons.model.referentiel.historique.ReferentielIntegrationHistorique; |
| | | import com.megatim.fdxcommons.model.referentiel.historique.ReferentielIntegrationHistoriqueId; |
| | | import com.megatim.fdxcommons.model.referentiel.historique.pojo.FilteredTypeFichier; |
| | | import java.util.Arrays; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class ReferentielConsumptionHelperImpl implements ReferentielConsumptionHelper { |
| | | |
| | | @Inject |
| | | private ReferentielDataSaver referentielDataSaver; |
| | | |
| | | @Inject |
| | | ReferentielManager referentielManager; |
| | | |
| | | @Inject |
| | | private DataInMemoryHandler dataInMemoryHandler; |
| | | |
| | | @Inject |
| | | private DynamicTableCreator dynamicTableCreator; |
| | | |
| | | @Resource(lookup = AppContext.JNDI_NAME) |
| | | private DataSource dataSource; |
| | | |
| | | @Inject |
| | | private DataMigration dataMigration; |
| | | |
| | | @Inject |
| | | private ReferentielIntegrationHistoriqueManager refIntegrationHistoriqueManager; |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void consume(ReferentielToImportData referentielToImportData) throws Exception { |
| | | Referentiel refInDB = referentielManager.getReferentielEnCours(); |
| | | |
| | | if (refInDB != null && Long.valueOf(refInDB.getVersion()) >= Long.valueOf(referentielToImportData.getReferentielEnCours().getVersion())) { |
| | | throw new ImportReferentielException("Version du référentiel 'en cours' est antérieure à la version existante dans le système"); |
| | | } |
| | | referentielDataSaver.persist(referentielToImportData); |
| | | |
| | | if (refInDB != null) { |
| | | FilteredTypeFichier filteredTypeFichiers = dataMigration.filterTypeFichiers(referentielToImportData.getTableDefinitions(), |
| | | refInDB.getVersion(), |
| | | referentielToImportData.getReferentielEnCours().getVersion()); |
| | | |
| | | //On creé uniquement les tables dont le typefichier est absent dans le ref précédent ou la structure de ses colonnes a changé |
| | | createTables(filteredTypeFichiers.getChangedOrNewTypeFichiers(), referentielToImportData.getTableDefinitions()); |
| | | |
| | | saveReferentielIntegrationHistorique(filteredTypeFichiers, referentielToImportData.getReferentielEnCours().getVersion()); |
| | | } else { |
| | | //On creé les tables |
| | | dynamicTableCreator.createDynamicTables(referentielToImportData.getTableDefinitions()); |
| | | |
| | | saveHistoriqueChangedOrNewTypeFichiers(referentielToImportData); |
| | | } |
| | | |
| | | //Charger les nouvelles informations du référentiel dans un objet en mémoire |
| | | dataInMemoryHandler.initializeDataInMemory(); |
| | | } |
| | | |
| | | private void createTables(Set<String> changedOrNewTypeFichiers, List<TableDefinition> tableDefs) throws Exception { |
| | | dynamicTableCreator |
| | | .createDynamicTables(tableDefs |
| | | .stream() |
| | | .filter(t -> changedOrNewTypeFichiers.contains(t.getCodeTypeFichier())) |
| | | .collect(Collectors.toList())); |
| | | } |
| | | |
| | | private void saveReferentielIntegrationHistorique(FilteredTypeFichier filteredTypeFichiers, String newRef) { |
| | | saveHistoriqueChangedOrNewTypeFichiers(filteredTypeFichiers.getChangedOrNewTypeFichiers(), newRef); |
| | | saveHistoriqueUnChangedTypeFichiers(filteredTypeFichiers.getUnChangedTypeFichiers(), newRef); |
| | | } |
| | | |
| | | private void saveHistoriqueChangedOrNewTypeFichiers(Set<String> changedOrNewTypeFichiers, String newRef) { |
| | | for (String codeTypeFichier : changedOrNewTypeFichiers) { |
| | | refIntegrationHistoriqueManager.save(new ReferentielIntegrationHistorique(codeTypeFichier, newRef, new HashSet<>(Arrays.asList(newRef)))); |
| | | } |
| | | } |
| | | |
| | | private void saveHistoriqueChangedOrNewTypeFichiers(ReferentielToImportData referentielToImportData) { |
| | | Set<String> changedOrNewTypeFichiers = referentielToImportData.getTypeFichiers().stream().map(t -> t.getCode()).collect(Collectors.toSet()); |
| | | saveHistoriqueChangedOrNewTypeFichiers(changedOrNewTypeFichiers, referentielToImportData.getReferentielEnCours().getVersion()); |
| | | } |
| | | |
| | | private void saveHistoriqueUnChangedTypeFichiers(Set<String> unChangedOrNewTypeFichiers, String newRef) { |
| | | |
| | | for (String codeTypeFichier : unChangedOrNewTypeFichiers) { |
| | | ReferentielIntegrationHistorique refInt = refIntegrationHistoriqueManager |
| | | .getById(new ReferentielIntegrationHistoriqueId(codeTypeFichier, newRef)); |
| | | |
| | | if (refInt == null) { |
| | | refIntegrationHistoriqueManager.save(new ReferentielIntegrationHistorique(codeTypeFichier, newRef, new HashSet<>(Arrays.asList(newRef)))); |
| | | } else { |
| | | refInt.getDependingReferentiels().add(newRef); |
| | | refIntegrationHistoriqueManager.save(refInt); |
| | | } |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.impl.helper; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.helper.RoutingChecker; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ParticipantManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.RoutageManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.natureproduction.NatureProductionFichierManager; |
| | | import com.megatim.apifdxweb.tools.exceptions.ApplicationForbidenException; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.model.pojo.DataInMemory; |
| | | import com.megatim.fdxcommons.model.referentiel.TypeFichier; |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProduction; |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProductionFichier; |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProductionFichierId; |
| | | import com.megatim.fdxcommons.tools.exceptions.CommonRessourceNotFoundException; |
| | | import java.util.Map; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | @Dependent |
| | | public class RoutingCheckerImpl implements RoutingChecker { |
| | | |
| | | @Inject |
| | | protected ParticipantManager participantManager; |
| | | |
| | | @Inject |
| | | private RoutageManager routageManager; |
| | | |
| | | @Inject |
| | | private NatureProductionFichierManager natureProdFichManager; |
| | | |
| | | @Override |
| | | public void stopIfNatureProductionIsNotCumulative(String codeTypeFichier, String referentielEncours) { |
| | | NatureProductionFichierId id = new NatureProductionFichierId(codeTypeFichier, referentielEncours); |
| | | NatureProductionFichier natureProdFich = natureProdFichManager.getById(id); |
| | | |
| | | if (natureProdFich == null || !natureProdFich.getNatureProduction().equals(NatureProduction.CUMMULATIVE)) { |
| | | throw new ApplicationForbidenException("Cette opération n'est pas accessible pour ce type de fichier"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void stopIfNotProducer(String codeTypeFichier, DataInMemory dataInMemory, String codeParticipant) { |
| | | if (!dataInMemory.getTypeFichierToParticipantsEnvoi().get(codeTypeFichier).contains(codeParticipant)) { |
| | | throw new ApplicationForbidenException("Impossible de continuer la requête car le participant " + codeParticipant + " n'est pas producteur du type de fichier " + codeTypeFichier); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void stopIfNotConsumer(String codeTypeFichier, DataInMemory dataInMemory, String codeParticipant) { |
| | | if (!dataInMemory.getTypeFichierToParticipantsReception().get(codeTypeFichier).contains(codeParticipant)) { |
| | | throw new ApplicationForbidenException("Impossible de continuer la requête car le participant " + codeParticipant + " n'est pas consommateur du type de fichier " + codeTypeFichier); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void stopIfCurrentReferentielNotExists(DataInMemory data) { |
| | | if (data.getReferentielEnCours() == null) { |
| | | throw new CommonRessourceNotFoundException("Aucun référentiel en cours"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Check whether there is a current ref in database |
| | | * |
| | | * @param codeTypeFichier |
| | | * @param dataInMemory |
| | | */ |
| | | @Override |
| | | public void stopIfTypeFichierNotExists(String codeTypeFichier, DataInMemory dataInMemory) { |
| | | TypeFichier typeFich = dataInMemory.getCodeTypeFichierToTypeFichiers().get(codeTypeFichier); |
| | | |
| | | if (typeFich == null) { |
| | | throw new CommonRessourceNotFoundException("TypeFichier '" + codeTypeFichier + "' inexistant"); |
| | | } |
| | | |
| | | Map<String, ColumnDefinition> columnsDefinitionMap = dataInMemory.getTypeFichierToColumnDefinitions().get(codeTypeFichier); |
| | | if (columnsDefinitionMap == null || columnsDefinitionMap.isEmpty()) { |
| | | throw new CommonRessourceNotFoundException("La structure du typeFichier '" + codeTypeFichier + "' est introuvable"); |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.integration; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.integration.ColumnDefinitionManager; |
| | | import com.megatim.fdxcommons.dao.ifaces.integration.ColumnDefinitionDAO; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinitionId; |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.fdxcommons.model.searchentities.ColumnDefinitionSearch; |
| | | import java.util.List; |
| | | import javax.ejb.EJB; |
| | | import javax.enterprise.context.Dependent; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class ColumnDefinitionManagerImpl implements ColumnDefinitionManager { |
| | | |
| | | @EJB |
| | | ColumnDefinitionDAO dao; |
| | | |
| | | @Override |
| | | public ColumnDefinition getById(ColumnDefinitionId id, User connectedUser) { |
| | | return getDao().getById(id); |
| | | } |
| | | |
| | | @Override |
| | | public ColumnDefinitionDAO getDao() { |
| | | return dao; |
| | | } |
| | | |
| | | @Override |
| | | public List<ColumnDefinition> getAll(String referentielVersion, String codeTypeFichier) { |
| | | ColumnDefinitionSearch searchEntity = new ColumnDefinitionSearch(); |
| | | searchEntity.setCodeTypeFichier(codeTypeFichier); |
| | | searchEntity.setReferentielVersion(referentielVersion); |
| | | |
| | | return getAll(searchEntity); |
| | | } |
| | | |
| | | @Override |
| | | public List<ColumnDefinition> findByReferentielAndTypeFichier(String referentielVersion, String codeTypeFichier) { |
| | | return getDao().findByReferentielAndTypeFichier(referentielVersion, codeTypeFichier); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.impl.integration; |
| | | |
| | | import com.megatim.apifdxweb.tools.AppContext; |
| | | import com.megatim.fdxcommons.core.ifaces.helper.referentiel.DynamicTableCreator; |
| | | import com.megatim.fdxcommons.model.pojo.TableDefinition; |
| | | import com.megatim.fdxcommons.tools.database.connection.DBConnection; |
| | | import com.megatim.fdxcommons.tools.database.tables.FdxApiTable; |
| | | import java.sql.Connection; |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.sql.DataSource; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | @Dependent |
| | | public class DynamicTableCreatorImpl implements DynamicTableCreator { |
| | | |
| | | @Resource(lookup = AppContext.JNDI_NAME) |
| | | private DataSource dataSource; |
| | | |
| | | @Override |
| | | public void createDynamicTables(List<TableDefinition> tableDefinitions) throws Exception { |
| | | |
| | | try ( Connection connection = new DBConnection(dataSource).connection()) { |
| | | for (TableDefinition tableDefinition : tableDefinitions) { |
| | | new FdxApiTable(tableDefinition.getCodeTypeFichier(), |
| | | tableDefinition.getReferentielVersion(), |
| | | connection) |
| | | .createTable(tableDefinition.getColumnDefinitions()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.log; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.log.UserActionLogManager; |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.log.UserActionLogDAO; |
| | | import javax.ejb.EJB; |
| | | import javax.enterprise.context.Dependent; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class UserActionLogManagerImpl implements UserActionLogManager { |
| | | |
| | | @EJB |
| | | private UserActionLogDAO dao; |
| | | |
| | | @Override |
| | | public UserActionLogDAO getDao() { |
| | | return dao; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ApplicationSourceManager; |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.ApplicationSourceDAO; |
| | | import javax.ejb.EJB; |
| | | import javax.enterprise.context.Dependent; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class ApplicationSourceManagerImpl implements ApplicationSourceManager { |
| | | |
| | | @EJB |
| | | private ApplicationSourceDAO dao; |
| | | |
| | | @Override |
| | | public ApplicationSourceDAO getDao() { |
| | | return dao; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ExtensionFichierManager; |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.ExtensionFichierDAO; |
| | | import javax.ejb.EJB; |
| | | import javax.enterprise.context.Dependent; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class ExtensionFichierManagerImpl implements ExtensionFichierManager { |
| | | |
| | | @EJB |
| | | private ExtensionFichierDAO dao; |
| | | |
| | | @Override |
| | | public ExtensionFichierDAO getDao() { |
| | | return dao; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.GroupeNoeudManager; |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.GroupeNoeudDAO; |
| | | import javax.ejb.EJB; |
| | | import javax.enterprise.context.Dependent; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class GroupeNoeudManagerImpl implements GroupeNoeudManager { |
| | | |
| | | @EJB |
| | | private GroupeNoeudDAO dao; |
| | | |
| | | @Override |
| | | public GroupeNoeudDAO getDao() { |
| | | return dao; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.GroupeParticipantManager; |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.GroupeParticipantDAO; |
| | | import javax.ejb.EJB; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.transaction.Transactional; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | @Transactional |
| | | public class GroupeParticipantManagerImpl implements GroupeParticipantManager { |
| | | |
| | | @EJB |
| | | private GroupeParticipantDAO dao; |
| | | |
| | | @Override |
| | | public GroupeParticipantDAO getDao() { |
| | | return dao; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.NoeudManager; |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.NoeudDAO; |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.NoeudDto; |
| | | import com.megatim.fdxcommons.model.mappers.MapStructMapper; |
| | | import com.megatim.fdxcommons.model.referentiel.Noeud; |
| | | import javax.ejb.EJB; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | |
| | | @Dependent |
| | | public class NoeudManagerImpl implements NoeudManager { |
| | | |
| | | @EJB |
| | | protected NoeudDAO dao; |
| | | |
| | | @Inject |
| | | private MapStructMapper mapstructMapper; |
| | | |
| | | /** |
| | | * |
| | | */ |
| | | public NoeudManagerImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public NoeudDAO getDao() { |
| | | return dao; |
| | | } |
| | | |
| | | public Noeud saveOrUpdateCurrentElement(Noeud entityToSave) { |
| | | return dao.save(entityToSave); |
| | | } |
| | | |
| | | @Override |
| | | public Noeud getById(String id, User connectedUser) { |
| | | Noeud noeud = dao.getById(id); |
| | | return noeud; |
| | | } |
| | | |
| | | @Override |
| | | public Noeud getById(String id) { |
| | | return dao.getById(id); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ParticipantManager; |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.ParticipantDAO; |
| | | import javax.ejb.EJB; |
| | | import javax.enterprise.context.Dependent; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class ParticipantManagerImpl implements ParticipantManager { |
| | | |
| | | @EJB |
| | | private ParticipantDAO dao; |
| | | |
| | | @Override |
| | | public ParticipantDAO getDao() { |
| | | return dao; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.PaysManager; |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.PaysDAO; |
| | | import javax.ejb.EJB; |
| | | import javax.enterprise.context.Dependent; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class PaysManagerImpl implements PaysManager { |
| | | |
| | | @EJB |
| | | private PaysDAO dao; |
| | | |
| | | @Override |
| | | public PaysDAO getDao() { |
| | | return dao; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ReferentielManager; |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.ReferentielDAO; |
| | | import com.megatim.fdxcommons.model.enumeration.StatutReferentiel; |
| | | import com.megatim.fdxcommons.model.referentiel.Referentiel; |
| | | import javax.ejb.EJB; |
| | | import javax.enterprise.context.Dependent; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class ReferentielManagerImpl implements ReferentielManager { |
| | | |
| | | @EJB |
| | | ReferentielDAO dao; |
| | | |
| | | @Override |
| | | public ReferentielDAO getDao() { |
| | | return dao; |
| | | } |
| | | |
| | | @Override |
| | | public Referentiel findByStatutReferentiel(StatutReferentiel statutReferentiel) { |
| | | return getDao().findByStatutReferentiel(statutReferentiel); |
| | | } |
| | | |
| | | @Override |
| | | public Referentiel getReferentielEnCours() { |
| | | return getDao().getReferentielEnCours(); |
| | | } |
| | | |
| | | @Override |
| | | public void archiverReferentielEncours() { |
| | | dao.archiverReferentielEncours(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.core.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.RoutageManager; |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.RoutageDAO; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.RoutageDto; |
| | | import com.megatim.fdxcommons.model.mappers.MapStructMapper; |
| | | import com.megatim.fdxcommons.model.referentiel.Participant; |
| | | import com.megatim.fdxcommons.model.referentiel.Routage; |
| | | import java.util.List; |
| | | import javax.ejb.EJB; |
| | | import javax.ejb.Stateless; |
| | | import javax.ejb.TransactionAttribute; |
| | | import javax.inject.Inject; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | @TransactionAttribute |
| | | @Stateless |
| | | public class RoutageManagerImpl implements RoutageManager { |
| | | |
| | | @EJB |
| | | private RoutageDAO routageDAO; |
| | | |
| | | @Inject |
| | | private MapStructMapper mapstructMapper; |
| | | |
| | | @Override |
| | | public RoutageDAO getDao() { |
| | | return routageDAO; |
| | | } |
| | | |
| | | @Override |
| | | public Long countRoutageByReferentielTypeFichierForParticipantForReceive(String versionReferentiel, String codeTypeFichier, Participant participant) { |
| | | return routageDAO.countRoutageByReferentielTypeFichierForParticipantForReceive(versionReferentiel, codeTypeFichier, participant); |
| | | } |
| | | |
| | | @Override |
| | | public Long countRoutageByReferentielTypeFichierForParticipantForSend(String versionReferentiel, String codeTypeFichier, Participant participant) { |
| | | return routageDAO.countRoutageByReferentielTypeFichierForParticipantForSend(versionReferentiel, codeTypeFichier, participant); |
| | | } |
| | | |
| | | public RoutageDto mapToDto(Routage entity) { |
| | | RoutageDto dto = null; |
| | | try { |
| | | dto = mapstructMapper.routageToRoutageDto(entity); |
| | | dto.setTypeFichier(mapstructMapper.typeFichierToTypeFichierSlimDto(entity.getTypeFichier())); |
| | | dto.setReferentiel(mapstructMapper.referentielToReferentielSlimDto(entity.getReferentiel())); |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | | } |
| | | return dto; |
| | | } |
| | | |
| | | @Override |
| | | public List<Participant> getParticipantsForSend(String versionReferentiel, String codeTypeFichier) { |
| | | return getDao().getParticipantsForSend(versionReferentiel, codeTypeFichier); |
| | | } |
| | | |
| | | @Override |
| | | public List<Participant> getParticipantsForReceive(String versionReferentiel, String codeTypeFichier) { |
| | | return getDao().getParticipantForReceive(versionReferentiel, codeTypeFichier); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.StructureLigneManager; |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.StructureLigneDAO; |
| | | import javax.ejb.EJB; |
| | | import javax.enterprise.context.Dependent; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class StructureLigneManagerImpl implements StructureLigneManager { |
| | | |
| | | @EJB |
| | | private StructureLigneDAO dao; |
| | | |
| | | @Override |
| | | public StructureLigneDAO getDao() { |
| | | return dao; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.TypeFichierManager; |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.TypeFichierDAO; |
| | | import com.megatim.fdxcommons.model.referentiel.TypeFichier; |
| | | import java.util.List; |
| | | import javax.ejb.EJB; |
| | | import javax.enterprise.context.Dependent; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class TypeFichierManagerImpl implements TypeFichierManager { |
| | | |
| | | @EJB |
| | | private TypeFichierDAO dao; |
| | | |
| | | @Override |
| | | public TypeFichierDAO getDao() { |
| | | return dao; |
| | | } |
| | | |
| | | @Override |
| | | public List<TypeFichier> getByReferentiel(String referentielVersion) { |
| | | return dao.getByReferentiel(referentielVersion); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ValidateurFichierConfigurationManager; |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.ValidateurFichierConfigurationDAO; |
| | | import javax.ejb.EJB; |
| | | import javax.enterprise.context.Dependent; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class ValidateurFichierConfigurationManagerImpl implements ValidateurFichierConfigurationManager { |
| | | |
| | | @EJB |
| | | private ValidateurFichierConfigurationDAO dao; |
| | | |
| | | @Override |
| | | public ValidateurFichierConfigurationDAO getDao() { |
| | | return dao; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ValidateurFichierManager; |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.ValidateurFichierDAO; |
| | | import javax.ejb.EJB; |
| | | import javax.enterprise.context.Dependent; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class ValidateurFichierManagerImpl implements ValidateurFichierManager { |
| | | |
| | | @EJB |
| | | private ValidateurFichierDAO dao; |
| | | |
| | | @Override |
| | | public ValidateurFichierDAO getDao() { |
| | | return dao; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.referentiel.historique; |
| | | |
| | | import com.megatim.fdxcommons.core.ifaces.referentiel.historique.ReferentielIntegrationHistoriqueManager; |
| | | import com.megatim.fdxcommons.dao.ifaces.referentiel.historique.ReferentielIntegrationHistoriqueDAO; |
| | | import javax.ejb.EJB; |
| | | import javax.enterprise.context.Dependent; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class ReferentielIntegrationHistoriqueManagerImpl implements ReferentielIntegrationHistoriqueManager { |
| | | |
| | | @EJB |
| | | private ReferentielIntegrationHistoriqueDAO dao; |
| | | |
| | | @Override |
| | | public ReferentielIntegrationHistoriqueDAO getDao() { |
| | | return dao; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.referentiel.natureproduction; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.natureproduction.NatureProductionFichierManager; |
| | | import com.megatim.fdxcommons.dao.ifaces.natureproduction.NatureProductionFichierDAO; |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProduction; |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProductionFichier; |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProductionFichierId; |
| | | import java.util.List; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class NatureProductionFichierManagerImpl implements NatureProductionFichierManager { |
| | | |
| | | @Inject |
| | | private NatureProductionFichierDAO dao; |
| | | |
| | | @Override |
| | | public NatureProductionFichierDAO getDao() { |
| | | return dao; |
| | | } |
| | | |
| | | @Override |
| | | public List<NatureProductionFichier> getByReferentiel(String referentielVersion) { |
| | | return dao.getByReferentiel(referentielVersion); |
| | | } |
| | | |
| | | @Override |
| | | public NatureProduction getNatureProduction(String codeTypeFichier, String referentiel) { |
| | | NatureProductionFichierId id = new NatureProductionFichierId(); |
| | | id.setReferentiel(referentiel); |
| | | id.setTypeFichier(codeTypeFichier); |
| | | NatureProductionFichier natureProductionFichier = getById(id); |
| | | |
| | | return natureProductionFichier != null ? natureProductionFichier.getNatureProduction() : NatureProduction.REFERENTIELLE; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.tmp; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.helper.RoutingChecker; |
| | | import com.megatim.apifdxweb.core.ifaces.tmp.TokenTmpManager; |
| | | import com.megatim.apifdxweb.dao.ifaces.tmp.TokenTmpDAO; |
| | | import com.megatim.apifdxweb.model.tmp.StatutTmp; |
| | | import com.megatim.apifdxweb.model.tmp.TokenTmp; |
| | | import com.megatim.fdxcommons.core.ifaces.helper.DataInMemoryHandler; |
| | | import com.mgt.rs.security.core.service.AuthenticationTokenService; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | import javax.ejb.EJB; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | import javax.transaction.Transactional; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class TokenTmpManagerImpl implements TokenTmpManager { |
| | | |
| | | @EJB |
| | | private TokenTmpDAO dao; |
| | | |
| | | @Inject |
| | | private AuthenticationTokenService authenticationTokenService; |
| | | |
| | | @Inject |
| | | private DataInMemoryHandler dataInMemoryHandler; |
| | | |
| | | @Inject |
| | | private RoutingChecker routingChecker; |
| | | |
| | | @Override |
| | | public TokenTmpDAO getDao() { |
| | | return this.dao; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public TokenTmp saveEntity(TokenTmp entity, String connectedParticipant) { |
| | | |
| | | stopIfProductionNotPermitted(entity.getCodeTypeFichier(), connectedParticipant); |
| | | |
| | | TokenTmp foundToken = dao.getByParticipantAndTypeFichier(connectedParticipant, entity.getCodeTypeFichier()); |
| | | if (foundToken != null) { |
| | | foundToken.setStatutTmp(StatutTmp.EXPIRE); |
| | | save(foundToken); |
| | | } |
| | | |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); |
| | | String str = LocalDateTime.now().format(formatter); |
| | | UUID uuid = UUID.nameUUIDFromBytes((str + entity.toString()).getBytes()); |
| | | |
| | | entity.setToken(uuid.toString()); |
| | | entity.setCodeParticipant(connectedParticipant); |
| | | entity.setDateExpiration(entity.getDateCreation().plusMinutes(entity.getValidite())); |
| | | |
| | | return save(entity); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public List<TokenTmp> getByStatutTmp(StatutTmp statut) { |
| | | return dao.getByStatutTmp(statut); |
| | | } |
| | | |
| | | @Override |
| | | public List<TokenTmp> getExpiredToken() { |
| | | return dao.getExpiredToken(); |
| | | } |
| | | |
| | | private void stopIfProductionNotPermitted(String codeTypeFichier, String connectedParticipant) { |
| | | |
| | | routingChecker.stopIfCurrentReferentielNotExists(dataInMemoryHandler.getDataInMemory()); |
| | | routingChecker.stopIfTypeFichierNotExists(codeTypeFichier, dataInMemoryHandler.getDataInMemory()); |
| | | routingChecker.stopIfNotProducer(codeTypeFichier, dataInMemoryHandler.getDataInMemory(), connectedParticipant); |
| | | |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.core.impl.tmp; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.integration.ColumnDefinitionManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ReferentielManager; |
| | | import com.megatim.apifdxweb.core.ifaces.tmp.TokenTmpManager; |
| | | import com.megatim.apifdxweb.core.ifaces.tmp.TypeFichierDataTmpManager; |
| | | import com.megatim.apifdxweb.dao.ifaces.tmp.TypeFichierDataTmpDAO; |
| | | import com.megatim.apifdxweb.model.dtos.tmp.DataTmpDto; |
| | | import com.megatim.apifdxweb.model.tmp.StatutTmp; |
| | | import com.megatim.apifdxweb.model.tmp.TokenTmp; |
| | | import com.megatim.apifdxweb.model.tmp.TypeFichierDataTmp; |
| | | import com.megatim.fdxcommons.core.ifaces.helper.DataInMemoryHandler; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.exceptions.BadDataValueException; |
| | | import com.megatim.fdxcommons.tools.database.exceptions.ColumnNotFoundException; |
| | | import com.megatim.fdxcommons.tools.database.exceptions.LocalDateTimeValueParseError; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.FdxParsedData; |
| | | import com.megatim.fdxcommons.tools.exceptions.CommonApplicationValidationException; |
| | | import java.time.LocalDateTime; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | import java.util.stream.Collectors; |
| | | import javax.ejb.EJB; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | import javax.transaction.Transactional; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class TypeFichierDataTmpManagerImpl implements TypeFichierDataTmpManager { |
| | | |
| | | @EJB |
| | | private TypeFichierDataTmpDAO dao; |
| | | |
| | | @Inject |
| | | TokenTmpManager tokenTmpManager; |
| | | |
| | | @Inject |
| | | private DataInMemoryHandler dataInMemoryHandler; |
| | | |
| | | @Inject |
| | | private ColumnDefinitionManager colDefManager; |
| | | |
| | | @Inject |
| | | private ReferentielManager refManager; |
| | | |
| | | @Override |
| | | public TypeFichierDataTmpDAO getDao() { |
| | | return dao; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void saveData(String connectedParticipant, DataTmpDto dto) { |
| | | try { |
| | | TokenTmp token = tokenTmpManager.getById(dto.getToken()); |
| | | doSomeChecks(dto, token); |
| | | |
| | | AtomicInteger numLigne = new AtomicInteger((dto.getBatchNumber() - 1) * token.getNbEltsPerBatch() + 1); |
| | | |
| | | for (LinkedHashMap l : dto.getData()) { |
| | | |
| | | l.forEach((k, v) -> { |
| | | TypeFichierDataTmp tmp = constructTypeFichierDataTmp(k.toString().toLowerCase(), v.toString(), token.getToken(), numLigne.get(), dto.getBatchNumber()); |
| | | save(tmp); |
| | | }); |
| | | numLigne.incrementAndGet(); |
| | | } |
| | | token.setNbOfBatchsReceived(token.getNbOfBatchsReceived() + 1); |
| | | |
| | | if (token.getNbOfBatchsReceived() == token.getNbBatchs()) { |
| | | token.setStatutTmp(StatutTmp.ACHEVE); |
| | | } |
| | | tokenTmpManager.save(token); |
| | | } catch (BadDataValueException | LocalDateTimeValueParseError | ColumnNotFoundException ex) { |
| | | throw new CommonApplicationValidationException(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | private TypeFichierDataTmp constructTypeFichierDataTmp(String key, String value, String token, int numLigne, int batchNumber) { |
| | | TypeFichierDataTmp tmp = new TypeFichierDataTmp(); |
| | | tmp.setColonne(key); |
| | | tmp.setDatum(value); |
| | | tmp.setToken(token); |
| | | tmp.setNumeroLigne(numLigne); |
| | | tmp.setBatchNumber(batchNumber); |
| | | |
| | | return tmp; |
| | | } |
| | | |
| | | @Override |
| | | public List<TypeFichierDataTmp> getByToken(String token) { |
| | | return dao.getByToken(token); |
| | | } |
| | | |
| | | @Override |
| | | public List<LinkedHashMap<String, Object>> getByStructuredLines(String token, String codeTypeFichier) { |
| | | List<ColumnDefinition> colDefs = colDefManager.getAll(refManager.getReferentielEnCours().getVersion(), codeTypeFichier); |
| | | return dao.getByStructuredLines(token, colDefs); |
| | | } |
| | | |
| | | @Override |
| | | public List<TypeFichierDataTmp> getByTokenAndByNumeroLigne(String token, int minNumeroLigne, int maxNumeroLigne) { |
| | | return dao.getByTokenAndByNumeroLigne(token, minNumeroLigne, maxNumeroLigne); |
| | | } |
| | | |
| | | private void doSomeChecks(DataTmpDto dto, TokenTmp token) throws BadDataValueException, LocalDateTimeValueParseError, ColumnNotFoundException { |
| | | if (token == null) { |
| | | throw new CommonApplicationValidationException("Token invalide"); |
| | | } |
| | | |
| | | if (LocalDateTime.now().isAfter(token.getDateExpiration())) { |
| | | throw new CommonApplicationValidationException("Token expiré"); |
| | | } |
| | | if (token.getStatutTmp().equals(StatutTmp.ACHEVE)) { |
| | | throw new CommonApplicationValidationException("Nombre de lots maximum atteint"); |
| | | } |
| | | if (dto.getBatchNumber() > token.getNbBatchs()) { |
| | | throw new CommonApplicationValidationException("Le numéro de lot ne peut être supérieure au nombre total de lots"); |
| | | } |
| | | if (dao.hasBatchAlreadyBeenReceived(dto.getToken(), dto.getBatchNumber())) { |
| | | throw new CommonApplicationValidationException("Le lot N°" + dto.getBatchNumber() + " a déjà été reçu"); |
| | | } |
| | | if (dto.getData() == null || dto.getData().isEmpty()) { |
| | | throw new CommonApplicationValidationException("Aucune donnée trouvée. Veuillez renseigner les données à enregistrer"); |
| | | } |
| | | if (dto.getData().size() > token.getNbEltsPerBatch()) { |
| | | throw new CommonApplicationValidationException("Maximum " + token.getNbEltsPerBatch() + " éléments sont attendus par lot"); |
| | | } |
| | | if (dto.getBatchNumber() < token.getNbBatchs() && dto.getData().size() < token.getNbEltsPerBatch()) { |
| | | throw new CommonApplicationValidationException("Exactement " + token.getNbEltsPerBatch() + " éléments sont attendus pour ce lot"); |
| | | } |
| | | |
| | | checkDatas(dto, token); |
| | | } |
| | | |
| | | private void checkDatas(DataTmpDto dto, TokenTmp token) throws BadDataValueException, LocalDateTimeValueParseError, ColumnNotFoundException { |
| | | List<ColumnDefinition> colDefs = dataInMemoryHandler.getDataInMemory().getTypeFichierToColumnDefinitions() |
| | | .get(token.getCodeTypeFichier()).values().stream().collect(Collectors.toList()); |
| | | new FdxParsedData(dto.getData(), colDefs).data(); |
| | | } |
| | | } |
| New file |
| | |
| | | # These are some examples of commonly ignored file patterns. |
| | | # You should customize this list as applicable to your project. |
| | | # Learn more about .gitignore: |
| | | # https://www.atlassian.com/git/tutorials/saving-changes/gitignore |
| | | |
| | | # Node artifact files |
| | | node_modules/ |
| | | dist/ |
| | | |
| | | # Compiled Java class files |
| | | *.class |
| | | |
| | | # Compiled Python bytecode |
| | | *.py[cod] |
| | | |
| | | # Log files |
| | | *.log |
| | | |
| | | # Package files |
| | | *.jar |
| | | |
| | | # Maven |
| | | target/ |
| | | dist/ |
| | | |
| | | # JetBrains IDE |
| | | .idea/ |
| | | |
| | | # Unit test reports |
| | | TEST*.xml |
| | | |
| | | # Generated by MacOS |
| | | .DS_Store |
| | | |
| | | # Generated by Windows |
| | | Thumbs.db |
| | | |
| | | # Applications |
| | | *.app |
| | | *.exe |
| | | *.war |
| | | |
| | | # Large media files |
| | | *.mp4 |
| | | *.tiff |
| | | *.avi |
| | | *.flv |
| | | *.mov |
| | | *.wmv |
| | | |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project-shared-configuration> |
| | | <!-- |
| | | This file contains additional configuration written by modules in the NetBeans IDE. |
| | | The configuration is intended to be shared among all the users of project and |
| | | therefore it is assumed to be part of version control checkout. |
| | | Without this configuration present, some functionality in the IDE may be limited or fail altogether. |
| | | --> |
| | | <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1"> |
| | | <!-- |
| | | Properties that influence various parts of the IDE, especially code formatting and the like. |
| | | You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up. |
| | | That way multiple projects can share the same settings (useful for formatting rules for example). |
| | | Any value defined here will override the pom.xml file value but is only applicable to the current project. |
| | | --> |
| | | <netbeans.hint.jdkPlatform>JDK_1.8</netbeans.hint.jdkPlatform> |
| | | </properties> |
| | | </project-shared-configuration> |
| New file |
| | |
| | | <?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"> |
| | | |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <parent> |
| | | <groupId>com.megatim.apifdxweb</groupId> |
| | | <artifactId>apifdxweb</artifactId> |
| | | <version>1.0</version> |
| | | </parent> |
| | | |
| | | <groupId>com.megatim.apifdxweb.dao.ifaces</groupId> |
| | | <artifactId>apifdxweb-dao-ifaces</artifactId> |
| | | <packaging>jar</packaging> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>1.8</maven.compiler.source> |
| | | <maven.compiler.target>1.8</maven.compiler.target> |
| | | <jakartaee>8.0</jakartaee> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.megatim.apifdxweb.model</groupId> |
| | | <artifactId>apifdxweb-model</artifactId> |
| | | <version>${project.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>javax</groupId> |
| | | <artifactId>javaee-api</artifactId> |
| | | <version>${jakartaee}</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.bekosoftware</groupId> |
| | | <artifactId>genericDAOLayer</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatimgroup</groupId> |
| | | <artifactId>mgt-commons-tools</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | <name>apifdxweb-dao-ifaces</name> |
| | | </project> |
| New file |
| | |
| | | package com.megatim.apifdxweb.dao.ifaces.administration; |
| | | |
| | | import com.bekosoftware.genericdaolayer.dao.ifaces.GenericDAO; |
| | | import com.megatim.apifdxweb.model.administration.Action; |
| | | |
| | | /** |
| | | * Interface etendue par les interfaces locale et remote de la DAO |
| | | * @since Tue Jan 09 15:21:42 WAT 2018 |
| | | * |
| | | */ |
| | | public interface ActionDAO extends GenericDAO<Action, Long> { |
| | | |
| | | /** |
| | | * Nom du service |
| | | * |
| | | */ |
| | | public final static String SERVICE_NAME = "ActionDAO"; |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.dao.ifaces.administration; |
| | | |
| | | import com.bekosoftware.genericdaolayer.dao.ifaces.GenericDAO; |
| | | import com.megatim.apifdxweb.model.administration.Role; |
| | | |
| | | /** |
| | | * Interface etendue par les interfaces locale et remote de la DAO |
| | | * @since Tue Jan 09 15:21:42 WAT 2018 |
| | | * |
| | | */ |
| | | public interface RoleDAO extends GenericDAO<Role, Long> { |
| | | |
| | | /** |
| | | * Nom du service |
| | | * |
| | | */ |
| | | public final static String SERVICE_NAME = "RoleDAO"; |
| | | |
| | | Role getCurrentRole(); |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.dao.ifaces.administration; |
| | | |
| | | import com.bekosoftware.genericdaolayer.dao.ifaces.GenericDAO; |
| | | import com.megatim.apifdxweb.model.administration.TokenGeneration; |
| | | |
| | | /** |
| | | * Interface etendue par les interfaces locale et remote de la DAO |
| | | * |
| | | * @since Tue Jan 09 15:21:42 WAT 2018 |
| | | * |
| | | */ |
| | | public interface TokenGenerationDAO extends GenericDAO<TokenGeneration, Long> { |
| | | |
| | | /** |
| | | * Nom du service |
| | | * |
| | | */ |
| | | public final static String SERVICE_NAME = "TokenGenerationDAO"; |
| | | |
| | | TokenGeneration getCurrentGeneration(String userName); |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.dao.ifaces.administration; |
| | | |
| | | import com.bekosoftware.genericdaolayer.dao.ifaces.GenericDAO; |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import javax.transaction.Transactional; |
| | | |
| | | /** |
| | | * Interface etendue par les interfaces locale et remote de la DAO |
| | | * |
| | | * @since Tue Jan 09 15:21:42 WAT 2018 |
| | | * |
| | | */ |
| | | public interface UserDAO extends GenericDAO<User, Long> { |
| | | |
| | | /** |
| | | * Nom du service |
| | | * |
| | | */ |
| | | public final static String SERVICE_NAME = "UserDAO"; |
| | | |
| | | /** |
| | | * Permet de recuperer un utilisateur via ces informations de connexion |
| | | * |
| | | * @param username |
| | | * @param motDePasse |
| | | * @return |
| | | */ |
| | | User recuperUtilisateur(String username, String motDePasse); |
| | | |
| | | /** |
| | | * Permet de recuperer un utilisateur via ces informations de connexion |
| | | * |
| | | * @param username |
| | | * @return |
| | | */ |
| | | User recuperUtilisateur(String username); |
| | | |
| | | @Transactional |
| | | User getUser(String username); |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.ifaces.camel.historique; |
| | | |
| | | import com.megatim.apifdxweb.model.camel.historique.ConsumedFilesHistory; |
| | | import com.megatim.apifdxweb.model.camel.historique.ConsumedFileType; |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ConsumedFilesHistoryDAO extends CustomDAOIfaces<ConsumedFilesHistory, Long, ConsumedFilesHistory> { |
| | | |
| | | List<ConsumedFilesHistory> notDeleted(); |
| | | |
| | | ConsumedFilesHistory findByTypeFileName(ConsumedFileType typeDonneeReferentiel, String fileName); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.searchentities.ApplicationSourceSearch; |
| | | import com.megatim.fdxcommons.model.referentiel.ApplicationSource; |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ApplicationSourceDAO extends CustomDAOIfaces<ApplicationSource, String, ApplicationSourceSearch>{ |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.searchentities.ExtensionFichierSearch; |
| | | import com.megatim.fdxcommons.model.referentiel.ExtensionFichier; |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ExtensionFichierDAO extends CustomDAOIfaces<ExtensionFichier, String, ExtensionFichierSearch>{ |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.searchentities.GroupeNoeudSearch; |
| | | import com.megatim.fdxcommons.model.referentiel.GroupeNoeud; |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface GroupeNoeudDAO extends CustomDAOIfaces<GroupeNoeud, String, GroupeNoeudSearch> { |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.searchentities.GroupeParticipantSearch; |
| | | import com.megatim.fdxcommons.model.referentiel.GroupeParticipant; |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface GroupeParticipantDAO extends CustomDAOIfaces<GroupeParticipant, String, GroupeParticipantSearch>{ |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.searchentities.NoeudSearch; |
| | | import com.megatim.fdxcommons.model.referentiel.Noeud; |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | import java.util.Optional; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface NoeudDAO extends CustomDAOIfaces<Noeud, String, NoeudSearch> { |
| | | |
| | | @Override |
| | | EntityManager getEntityManager(); |
| | | |
| | | @Override |
| | | public default Class<Noeud> getManagedEntityClass() { |
| | | return (Noeud.class); |
| | | } |
| | | |
| | | @Override |
| | | public default Noeud getById(String id) { |
| | | Query query = getEntityManager().createQuery("SELECT n from Noeud n" |
| | | + " LEFT JOIN FETCH n.groupeNoeuds LEFT JOIN FETCH n.routageEnvois LEFT JOIN FETCH n.routageReceptions" |
| | | + " WHERE n.code = :code"); |
| | | query.setParameter("code", id); |
| | | |
| | | Optional<Noeud> optionalNoeud = query.getResultList().stream().findFirst(); |
| | | return optionalNoeud.isPresent() ? optionalNoeud.get() : null; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.searchentities.ParticipantSearch; |
| | | import com.megatim.fdxcommons.model.referentiel.Participant; |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ParticipantDAO extends CustomDAOIfaces<Participant, String, ParticipantSearch> { |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.searchentities.PaysSearch; |
| | | import com.megatim.fdxcommons.model.referentiel.Pays; |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface PaysDAO extends CustomDAOIfaces<Pays, String, PaysSearch>{ |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.searchentities.ReferentielSearch; |
| | | import com.megatim.fdxcommons.model.enumeration.StatutReferentiel; |
| | | import com.megatim.fdxcommons.model.referentiel.Referentiel; |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ReferentielDAO extends CustomDAOIfaces<Referentiel, String, ReferentielSearch> { |
| | | |
| | | public Referentiel findByStatutReferentiel(StatutReferentiel statutReferentiel); |
| | | |
| | | public Referentiel getReferentielEnCours(); |
| | | |
| | | public void archiverReferentielEncours(); |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.dao.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.searchentities.RoutageSearch; |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | import com.megatim.fdxcommons.model.referentiel.Participant; |
| | | import com.megatim.fdxcommons.model.referentiel.Routage; |
| | | import com.megatim.fdxcommons.model.referentiel.RoutageId; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface RoutageDAO extends CustomDAOIfaces<Routage, RoutageId, RoutageSearch> { |
| | | |
| | | @Override |
| | | EntityManager getEntityManager(); |
| | | |
| | | @Override |
| | | public default Class<Routage> getManagedEntityClass() { |
| | | return (Routage.class); |
| | | } |
| | | |
| | | @Override |
| | | public default Routage getById(RoutageId id) { |
| | | Query query = getEntityManager().createQuery("SELECT r FROM Routage r" |
| | | + " LEFT JOIN FETCH r.groupeNoeudsEnvoi LEFT JOIN FETCH r.groupeNoeudsReception" |
| | | + " LEFT JOIN FETCH r.groupeParticipantsEnvoi LEFT JOIN FETCH r.groupeParticipantsReception" |
| | | + " LEFT JOIN FETCH r.noeudsEnvoi LEFT JOIN FETCH r.noeudsReception" |
| | | + " LEFT JOIN FETCH r.groupeNoeudsReception LEFT JOIN FETCH r.participantsReception" |
| | | + " LEFT JOIN FETCH r.groupeParticipantsReception LEFT JOIN FETCH r.participantsEnvoi" |
| | | + " WHERE r.referentiel.version = :referentielVersion AND r.typeFichier.code = :codeTypeFichier"); |
| | | |
| | | query.setParameter("codeTypeFichier", id.getTypeFichier()); |
| | | query.setParameter("referentielVersion", id.getReferentiel()); |
| | | |
| | | Optional<Routage> optionalRoutage = query.getResultList().stream().findFirst(); |
| | | |
| | | if (optionalRoutage.isPresent()) { |
| | | return optionalRoutage.get(); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public default List<Participant> getParticipantsForSend(String versionReferentiel, String codeTypeFichier) { |
| | | List<Participant> participantsEnvoi = new ArrayList<>(); |
| | | Optional<Routage> optRoutage = getEntityManager().createQuery("SELECT r FROM Routage r " |
| | | + "LEFT JOIN r.participantsEnvoi p " |
| | | + "LEFT JOIN r.noeudsEnvoi n " |
| | | + "LEFT JOIN r.groupeParticipantsEnvoi gp LEFT JOIN gp.participants pa " |
| | | + "LEFT JOIN r.groupeNoeudsEnvoi gn LEFT JOIN gn.noeuds no " |
| | | + "WHERE r.referentiel.version = :versionReferentiel AND r.typeFichier.code = :codeTypeFichier ") |
| | | .setParameter("versionReferentiel", versionReferentiel) |
| | | .setParameter("codeTypeFichier", codeTypeFichier) |
| | | .getResultList().stream().findFirst(); |
| | | |
| | | if (optRoutage.isPresent()) { |
| | | Routage routage = optRoutage.get(); |
| | | participantsEnvoi.addAll(routage.getParticipantsEnvoi()); |
| | | routage.getNoeudsEnvoi().stream().forEach(n -> { |
| | | participantsEnvoi.add(n.getParticipant()); |
| | | }); |
| | | routage.getGroupeNoeudsEnvoi().stream().forEach(gn -> gn.getNoeuds().stream().forEach(n -> participantsEnvoi.add(n.getParticipant()))); |
| | | routage.getGroupeParticipantsEnvoi().stream().forEach(gp -> participantsEnvoi.addAll(gp.getParticipants())); |
| | | } |
| | | |
| | | return participantsEnvoi; |
| | | } |
| | | |
| | | default List<Participant> getParticipantForReceive(String versionReferentiel, String codeTypeFichier) { |
| | | List<Participant> participantsReception = new ArrayList<>(); |
| | | Optional<Routage> optRoutage = getEntityManager().createQuery("SELECT r FROM Routage r " |
| | | + "LEFT JOIN r.participantsReception p " |
| | | + "LEFT JOIN r.noeudsReception n " |
| | | + "LEFT JOIN r.groupeParticipantsReception gp LEFT JOIN gp.participants pa " |
| | | + "LEFT JOIN r.groupeNoeudsReception gn LEFT JOIN gn.noeuds no " |
| | | + "WHERE r.referentiel.version = :versionReferentiel AND r.typeFichier.code = :codeTypeFichier ") |
| | | .setParameter("versionReferentiel", versionReferentiel) |
| | | .setParameter("codeTypeFichier", codeTypeFichier) |
| | | .getResultList().stream().findFirst(); |
| | | |
| | | if (optRoutage.isPresent()) { |
| | | Routage routage = optRoutage.get(); |
| | | participantsReception.addAll(routage.getParticipantsReception()); |
| | | routage.getNoeudsReception().stream().forEach(n -> { |
| | | participantsReception.add(n.getParticipant()); |
| | | }); |
| | | routage.getGroupeNoeudsReception().stream().forEach(gn -> gn.getNoeuds().stream().forEach(n -> participantsReception.add(n.getParticipant()))); |
| | | routage.getGroupeParticipantsReception().stream().forEach(gp -> participantsReception.addAll(gp.getParticipants())); |
| | | } |
| | | |
| | | return participantsReception; |
| | | } |
| | | |
| | | Long countRoutageByReferentielTypeFichierForParticipantForReceive(String versionReferentiel, String codeTypeFichier, Participant participant); |
| | | |
| | | Long countRoutageByReferentielTypeFichierForParticipantForSend(String versionReferentiel, String codeTypeFichier, Participant participant); |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.searchentities.StructureLigneSearch; |
| | | import com.megatim.fdxcommons.model.referentiel.StructureLigne; |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface StructureLigneDAO extends CustomDAOIfaces<StructureLigne, String, StructureLigneSearch>{ |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.dao.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.searchentities.TypeFichierSearch; |
| | | import com.megatim.fdxcommons.model.referentiel.TypeFichier; |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface TypeFichierDAO extends CustomDAOIfaces<TypeFichier, String, TypeFichierSearch> { |
| | | |
| | | List<TypeFichier> getByReferentiel(String referentielVersion); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.searchentities.ValidateurFichierConfigurationSearch; |
| | | import com.megatim.fdxcommons.model.referentiel.ValidateurFichierConfiguration; |
| | | import com.megatim.fdxcommons.model.referentiel.ValidateurFichierConfigurationId; |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ValidateurFichierConfigurationDAO extends CustomDAOIfaces<ValidateurFichierConfiguration, ValidateurFichierConfigurationId, ValidateurFichierConfigurationSearch> { |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.searchentities.ValidateurFichierSearch; |
| | | import com.megatim.fdxcommons.model.referentiel.ValidateurFichier; |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ValidateurFichierDAO extends CustomDAOIfaces<ValidateurFichier, String, ValidateurFichierSearch>{ |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.ifaces.referentiel.dataproduction; |
| | | |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProduction; |
| | | import com.megatim.fdxcommons.model.searchentities.DataProductionSearch; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface DataProductionDAO extends CustomDAOIfaces<DataProduction, Long, DataProductionSearch> { |
| | | |
| | | DataProduction lastProduction(String referentiel, String codeTypeFichier); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.ifaces.referentiel.log; |
| | | |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | import com.megatim.fdxcommons.model.log.UserActionLog; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface UserActionLogDAO extends CustomDAOIfaces<UserActionLog, Long, UserActionLog>{ |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.ifaces.tmp; |
| | | |
| | | import com.megatim.apifdxweb.model.searchentities.tmp.TokenTmpSearch; |
| | | import com.megatim.apifdxweb.model.tmp.StatutTmp; |
| | | import com.megatim.apifdxweb.model.tmp.TokenTmp; |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface TokenTmpDAO extends CustomDAOIfaces<TokenTmp, String, TokenTmpSearch> { |
| | | |
| | | List<TokenTmp> getByStatutTmp(StatutTmp statutTmp); |
| | | |
| | | List<TokenTmp> getExpiredToken(); |
| | | |
| | | TokenTmp getByParticipantAndTypeFichier(String codeParticipant, String codeTypeFichier); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.ifaces.tmp; |
| | | |
| | | import com.megatim.apifdxweb.model.searchentities.tmp.TypeFichierDataTmpSearch; |
| | | import com.megatim.apifdxweb.model.tmp.TypeFichierDataTmp; |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface TypeFichierDataTmpDAO extends CustomDAOIfaces<TypeFichierDataTmp, Long, TypeFichierDataTmpSearch> { |
| | | |
| | | void deleteByToken(String token); |
| | | |
| | | List<TypeFichierDataTmp> getByToken(String token); |
| | | |
| | | boolean hasBatchAlreadyBeenReceived(String token, int batchNumber); |
| | | |
| | | List<TypeFichierDataTmp> getByTokenAndByNumeroLigne(String token, int minNumeroLigne, int maxNumeroLigne); |
| | | |
| | | List<LinkedHashMap<String, Object>> getByStructuredLines(String token, List<ColumnDefinition> columnsDef); |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project-shared-configuration> |
| | | <!-- |
| | | This file contains additional configuration written by modules in the NetBeans IDE. |
| | | The configuration is intended to be shared among all the users of project and |
| | | therefore it is assumed to be part of version control checkout. |
| | | Without this configuration present, some functionality in the IDE may be limited or fail altogether. |
| | | --> |
| | | <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1"> |
| | | <!-- |
| | | Properties that influence various parts of the IDE, especially code formatting and the like. |
| | | You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up. |
| | | That way multiple projects can share the same settings (useful for formatting rules for example). |
| | | Any value defined here will override the pom.xml file value but is only applicable to the current project. |
| | | --> |
| | | <netbeans.hint.jdkPlatform>JDK_1.8</netbeans.hint.jdkPlatform> |
| | | </properties> |
| | | </project-shared-configuration> |
| New file |
| | |
| | | <?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"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <parent> |
| | | <groupId>com.megatim.apifdxweb</groupId> |
| | | <artifactId>apifdxweb</artifactId> |
| | | <version>1.0</version> |
| | | </parent> |
| | | |
| | | <groupId>com.megatim.apifdxweb.dao.impl</groupId> |
| | | <artifactId>apifdxweb-dao-impl</artifactId> |
| | | <packaging>jar</packaging> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>1.8</maven.compiler.source> |
| | | <maven.compiler.target>1.8</maven.compiler.target> |
| | | <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir> |
| | | <jakartaee>8.0</jakartaee> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.megatim.apifdxweb.dao.ifaces</groupId> |
| | | <artifactId>apifdxweb-dao-ifaces</artifactId> |
| | | <version>${project.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatim.apifdxweb.tools</groupId> |
| | | <artifactId>apifdxweb-tools</artifactId> |
| | | <version>1.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>javax</groupId> |
| | | <artifactId>javaee-api</artifactId> |
| | | <version>${jakartaee}</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>junit</groupId> |
| | | <artifactId>junit</artifactId> |
| | | <version>4.12</version> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatimgroup</groupId> |
| | | <artifactId>mgt-commons-tools</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.hibernate.validator</groupId> |
| | | <artifactId>hibernate-validator</artifactId> |
| | | <version>6.0.13.Final</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.hibernate</groupId> |
| | | <artifactId>hibernate-core</artifactId> |
| | | <version>5.4.2.Final</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.postgresql</groupId> |
| | | <artifactId>postgresql</artifactId> |
| | | <version>42.7.3</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <version>3.1</version> |
| | | <configuration> |
| | | <source>1.8</source> |
| | | <target>1.8</target> |
| | | <compilerArguments> |
| | | <endorseddirs>${endorsed.dir}</endorseddirs> |
| | | </compilerArguments> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-war-plugin</artifactId> |
| | | <version>2.3</version> |
| | | <configuration> |
| | | <failOnMissingWebXml>false</failOnMissingWebXml> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-dependency-plugin</artifactId> |
| | | <version>2.6</version> |
| | | <executions> |
| | | <execution> |
| | | <phase>validate</phase> |
| | | <goals> |
| | | <goal>copy</goal> |
| | | </goals> |
| | | <configuration> |
| | | <outputDirectory>${endorsed.dir}</outputDirectory> |
| | | <silent>true</silent> |
| | | <artifactItems> |
| | | <artifactItem> |
| | | <groupId>javax</groupId> |
| | | <artifactId>javaee-api</artifactId> |
| | | <version>${jakartaee}</version> |
| | | <type>jar</type> |
| | | </artifactItem> |
| | | </artifactItems> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | <name>apifdxweb-dao-impl</name> |
| | | </project> |
| New file |
| | |
| | | package com.megatim.apifdxweb.dao.impl.administration; |
| | | |
| | | import com.bekosoftware.genericdaolayer.dao.exceptions.GenericDAOException; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | |
| | | import com.bekosoftware.genericdaolayer.dao.impl.AbstractGenericDAO; |
| | | import com.megatim.apifdxweb.dao.ifaces.administration.ActionDAO; |
| | | import com.megatim.apifdxweb.model.administration.Action; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.persistence.TransactionRequiredException; |
| | | |
| | | /** |
| | | * |
| | | * @author DYNABOOK |
| | | */ |
| | | @Dependent |
| | | public class ActionDAOImpl extends AbstractGenericDAO<Action, Long> implements ActionDAO { |
| | | |
| | | @PersistenceContext(unitName = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | public ActionDAOImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public Class<Action> getManagedEntityClass() { |
| | | return (Action.class); |
| | | } |
| | | |
| | | /** |
| | | * Remove the parameter t in the data base |
| | | * |
| | | * @param entityID : id of the entity to delete |
| | | * @throws GenericDAOException if any problems |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Action delete(Object entityID) { |
| | | |
| | | //Verification de la validite de entityID |
| | | if (entityID == null) { |
| | | throw new GenericDAOException("genericentitymanager.delete.entityID.null"); |
| | | } |
| | | try { |
| | | //chargement de l'netite en memoire |
| | | Action entity = getEntityManager().find(entityClass, entityID); |
| | | //Execution action de pre-delete |
| | | processBeforeDelete(entity); |
| | | //Suppression de entity en BD |
| | | getEntityManager().createNativeQuery("delete from FS_ACTION where id="+entityID).executeUpdate(); |
| | | //Execution action de post-delete |
| | | processAfterDelete(entity); |
| | | return entity; |
| | | } catch (IllegalArgumentException e) { |
| | | //e.printStackTrace(); |
| | | throw new GenericDAOException("genericentitymanager.delete.illegalargumentexception", e); |
| | | } catch (TransactionRequiredException e) { |
| | | throw new GenericDAOException("genericentitymanager.delete.transactionrequiredexception", e); |
| | | } catch (Exception e) { |
| | | throw new GenericDAOException("genericentitymanager.delete.error", e); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.dao.impl.administration; |
| | | |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import com.bekosoftware.genericdaolayer.dao.impl.AbstractGenericDAO; |
| | | import com.bekosoftware.genericdaolayer.dao.tools.RestrictionsContainer; |
| | | import com.megatim.apifdxweb.dao.ifaces.administration.RoleDAO; |
| | | import com.megatim.apifdxweb.model.administration.Role; |
| | | import com.megatim.fdxcommons.model.enumeration.TypeOperation; |
| | | import javax.enterprise.context.Dependent; |
| | | |
| | | /** |
| | | * |
| | | * @author DYNABOOK |
| | | */ |
| | | @Dependent |
| | | public class RoleDAOImpl extends AbstractGenericDAO<Role, Long> implements RoleDAO { |
| | | |
| | | @PersistenceContext(unitName = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | |
| | | public RoleDAOImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public Class<Role> getManagedEntityClass() { |
| | | return (Role.class); |
| | | } |
| | | |
| | | @Override |
| | | public Role getCurrentRole() { |
| | | RestrictionsContainer requeteur = RestrictionsContainer.newInstance(); |
| | | |
| | | requeteur.addEq("typeOperation", TypeOperation.AJOUTER); |
| | | |
| | | return filter(requeteur.getPredicats(), null, null, 0, 1).stream().findAny().orElse(null); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.dao.impl.administration; |
| | | |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import com.bekosoftware.genericdaolayer.dao.impl.AbstractGenericDAO; |
| | | import com.megatim.apifdxweb.dao.ifaces.administration.TokenGenerationDAO; |
| | | import com.megatim.apifdxweb.model.administration.TokenGeneration; |
| | | import com.megatim.apifdxweb.model.administration.enums.StatutTokenGeneration; |
| | | import java.util.List; |
| | | import javax.enterprise.context.Dependent; |
| | | |
| | | @Dependent |
| | | public class TokenGenerationDAOImpl extends AbstractGenericDAO<TokenGeneration, Long> implements TokenGenerationDAO { |
| | | |
| | | @PersistenceContext(unitName = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | public TokenGenerationDAOImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public Class<TokenGeneration> getManagedEntityClass() { |
| | | return (TokenGeneration.class); |
| | | } |
| | | |
| | | @Override |
| | | public TokenGeneration getCurrentGeneration(String userName) { |
| | | List<TokenGeneration> liste = em.createQuery("SELECT t FROM TokenGeneration t " |
| | | + "WHERE t.user.userName = :userName AND t.statutTokenGeneration = :statutTokenGeneration") |
| | | .setParameter("statutTokenGeneration", StatutTokenGeneration.EN_COURS) |
| | | .setParameter("userName", userName) |
| | | .getResultList(); |
| | | return liste != null && !liste.isEmpty() ? liste.stream().findFirst().get() : null; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.dao.impl.administration; |
| | | |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import com.bekosoftware.genericdaolayer.dao.impl.AbstractGenericDAO; |
| | | import com.bekosoftware.genericdaolayer.dao.tools.RestrictionsContainer; |
| | | import com.google.common.hash.HashCode; |
| | | import com.google.common.hash.Hashing; |
| | | import com.megatim.apifdxweb.dao.ifaces.administration.UserDAO; |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.fdxcommons.model.enumeration.TypeOperation; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.List; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.transaction.Transactional; |
| | | |
| | | @Dependent |
| | | public class UserDAOImpl extends AbstractGenericDAO<User, Long> implements UserDAO { |
| | | |
| | | @PersistenceContext(unitName = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | public UserDAOImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public Class<User> getManagedEntityClass() { |
| | | return (User.class); |
| | | } |
| | | |
| | | @Override |
| | | public User recuperUtilisateur(String username, String motDePasse) { |
| | | |
| | | RestrictionsContainer requeteur = RestrictionsContainer.newInstance(); |
| | | requeteur.addEq("userName", username); |
| | | requeteur.addEq("typeOperation", TypeOperation.AJOUTER); |
| | | requeteur.addEq("locked", false); |
| | | |
| | | List<User> resultats = filter(requeteur.getPredicats(), null, null, 0, 1); |
| | | if (resultats == null || resultats.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | User user; |
| | | //On verifie si le mot de passe est correct |
| | | HashCode hashCode = Hashing.sha256().hashString(motDePasse, StandardCharsets.UTF_8); |
| | | if (!hashCode.toString().equals(resultats.get(0).getPwd())) { |
| | | user = null; |
| | | } else { |
| | | user = resultats.get(0); |
| | | } |
| | | |
| | | return user; |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public User recuperUtilisateur(String username) { |
| | | List<User> liste = em.createQuery("SELECT u FROM User u " |
| | | + "WHERE u.userName = :userName AND u.typeOperation = :typeOperation AND u.locked = :locked") |
| | | .setParameter("userName", username) |
| | | .setParameter("typeOperation", TypeOperation.AJOUTER) |
| | | .setParameter("locked", false) |
| | | .getResultList(); |
| | | return liste != null && !liste.isEmpty() ? liste.stream().findFirst().get() : null; |
| | | } |
| | | |
| | | @Override |
| | | public User getUser(String username) { |
| | | List<User> liste = em.createQuery("SELECT u FROM User u " |
| | | + "WHERE u.userName = :userName AND u.typeOperation = :typeOperation") |
| | | .setParameter("userName", username) |
| | | .setParameter("typeOperation", TypeOperation.AJOUTER) |
| | | .getResultList(); |
| | | return liste != null && !liste.isEmpty() ? liste.stream().findFirst().get() : null; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.audit; |
| | | |
| | | import com.megatim.apifdxweb.model.audit.AuditActionsParticipant; |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.sql.Timestamp; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class AuditActionsParticicipantsQuery { |
| | | |
| | | private final Connection connection; |
| | | private final AuditActionsParticipant auditAction; |
| | | |
| | | public AuditActionsParticicipantsQuery(Connection connection, AuditActionsParticipant auditAction) { |
| | | this.connection = connection; |
| | | this.auditAction = auditAction; |
| | | } |
| | | |
| | | public void insert() throws SQLException { |
| | | String getNextIdQuery = "SELECT nextval('SEQ_AUDIT_ACTIONS_PARTICIPANT')"; |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(insertString()); PreparedStatement getIdStatement = connection.prepareStatement(getNextIdQuery)) { |
| | | |
| | | ResultSet resultSet = getIdStatement.executeQuery(); |
| | | long generatedId = 0; |
| | | |
| | | if (resultSet.next()) { |
| | | generatedId = resultSet.getLong(1); |
| | | } |
| | | |
| | | statement.setTimestamp(1, Timestamp.valueOf(auditAction.getDateAction())); |
| | | statement.setInt(2, auditAction.getLastIndexRead()); |
| | | statement.setString(3, auditAction.getParticipantDemandeur()); |
| | | statement.setString(4, auditAction.getTypeFichierConsulte()); |
| | | statement.setLong(5, generatedId); |
| | | |
| | | statement.executeUpdate(); |
| | | } |
| | | } |
| | | |
| | | public void update() throws SQLException { |
| | | try ( PreparedStatement statement = connection.prepareStatement(updateString())) { |
| | | statement.setTimestamp(1, Timestamp.valueOf(auditAction.getDateAction())); |
| | | statement.setInt(2, auditAction.getLastIndexRead()); |
| | | statement.setLong(3, auditAction.getId()); |
| | | |
| | | statement.executeUpdate(); |
| | | } |
| | | } |
| | | |
| | | private String insertString() { |
| | | return "INSERT INTO audit_actions_participant(date_action, last_index_read, participant_demandeur, type_fichier_consulte, id)" |
| | | + " VALUES (?, ?, ?, ?, ?);"; |
| | | } |
| | | |
| | | private String updateString() { |
| | | return "UPDATE audit_actions_participant SET date_action = ?, last_index_read = ? WHERE id = ?"; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.dao.impl.audit; |
| | | |
| | | import com.megatim.apifdxweb.model.audit.AuditActionsParticipant; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import javax.ejb.Stateless; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class AuditActionsParticipantRepository { |
| | | |
| | | @PersistenceContext(name = "fdxPU") |
| | | EntityManager em; |
| | | |
| | | public Optional<AuditActionsParticipant> findByParticipantDemandeurAndTypeFichierConsulte(String connectedParticipant, String typeFichierConsulte) { |
| | | Query query = em.createQuery("SELECT a FROM AuditActionsParticipant a WHERE a.participantDemandeur = :participantDemandeur" |
| | | + " AND a.typeFichierConsulte = :typeFichierConsulte"); |
| | | |
| | | query.setParameter("participantDemandeur", connectedParticipant); |
| | | query.setParameter("typeFichierConsulte", typeFichierConsulte); |
| | | |
| | | List<AuditActionsParticipant> liste = (List<AuditActionsParticipant>) query.getResultList(); |
| | | |
| | | return liste.stream().findFirst(); |
| | | } |
| | | |
| | | public void save(AuditActionsParticipant auditActionsParticipant) { |
| | | em.persist(auditActionsParticipant); |
| | | } |
| | | |
| | | public void update(AuditActionsParticipant auditActionsParticipant) { |
| | | em.merge(auditActionsParticipant); |
| | | } |
| | | |
| | | public AuditActionsParticipant lastAudit(String codeParticipant, String codeTypeFichier) { |
| | | Optional<AuditActionsParticipant> optAudit = findByParticipantDemandeurAndTypeFichierConsulte(codeParticipant, codeTypeFichier); |
| | | if (optAudit.isPresent()) { |
| | | return optAudit.get(); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.audit; |
| | | |
| | | import com.megatim.apifdxweb.model.audit.AuditExportations; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import javax.ejb.Stateless; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class AuditExportationsRepository { |
| | | |
| | | @PersistenceContext(name = "fdxPU") |
| | | EntityManager em; |
| | | |
| | | public void save(AuditExportations audit) { |
| | | em.persist(audit); |
| | | } |
| | | |
| | | public void update(AuditExportations audit) { |
| | | em.merge(audit); |
| | | } |
| | | |
| | | public Optional<AuditExportations> findByCodeTypeFichier(String codeTypeFichier) { |
| | | Query query = em.createQuery("SELECT a FROM AuditExportations a WHERE a.typeFichierExporte = :codeTypeFichier"); |
| | | |
| | | query.setParameter("codeTypeFichier", codeTypeFichier); |
| | | |
| | | List<AuditExportations> liste = (List<AuditExportations>)query.getResultList(); |
| | | |
| | | return liste.stream().findFirst(); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.camel.historique; |
| | | |
| | | import com.megatim.apifdxweb.model.camel.historique.ConsumedFilesHistory; |
| | | import javax.ejb.Stateless; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import com.megatim.apifdxweb.model.camel.historique.ConsumedFileType; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import com.megatim.apifdxweb.dao.ifaces.camel.historique.ConsumedFilesHistoryDAO; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class ConsumedFilesHistoryDAOImpl implements ConsumedFilesHistoryDAO { |
| | | |
| | | @PersistenceContext(name = "fdxPU") |
| | | EntityManager em; |
| | | |
| | | @Override |
| | | public Class<ConsumedFilesHistory> getManagedEntityClass() { |
| | | return ConsumedFilesHistory.class; |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public ConsumedFilesHistory getById(Long id) { |
| | | throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody |
| | | } |
| | | |
| | | @Override |
| | | public List<ConsumedFilesHistory> notDeleted() { |
| | | return em.createQuery("SELECT cfh FROM ConsumedFilesHistory cfh where cfh.deletedInFolder = :param") |
| | | .setParameter("param", false) |
| | | .getResultList(); |
| | | } |
| | | |
| | | @Override |
| | | public ConsumedFilesHistory findByTypeFileName(ConsumedFileType consumedFileType, String fileName) { |
| | | Optional<ConsumedFilesHistory> optDonnee = em.createQuery("SELECT cfh FROM ConsumedFilesHistory cfh WHERE cfh.fileName = :fileName AND cfh.consumedFileType = :consumedFileType") |
| | | .setParameter("fileName", fileName) |
| | | .setParameter("consumedFileType", consumedFileType) |
| | | .getResultList() |
| | | .stream() |
| | | .findFirst(); |
| | | |
| | | return optDonnee.isPresent() ? optDonnee.get() : null; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.dataproduction; |
| | | |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.dataproduction.DataProductionDAO; |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProduction; |
| | | import java.util.Optional; |
| | | import javax.ejb.Stateless; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import javax.persistence.Query; |
| | | import javax.persistence.TypedQuery; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class DataProductionDAOImpl implements DataProductionDAO { |
| | | |
| | | @PersistenceContext(name = "fdxPU") |
| | | EntityManager em; |
| | | |
| | | @Override |
| | | public Class<DataProduction> getManagedEntityClass() { |
| | | return DataProduction.class; |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public DataProduction getById(Long id) { |
| | | Query query = em.createQuery("SELECT d from DataProduction d WHERE d.id = :id"); |
| | | query.setParameter("id", id); |
| | | |
| | | Optional<DataProduction> optDataProduction = query.getResultList().stream().findFirst(); |
| | | return optDataProduction.isPresent() ? optDataProduction.get() : null; |
| | | } |
| | | |
| | | @Override |
| | | public DataProduction lastProduction(String referentielVersion, String codeTypeFichier) { |
| | | String jpql = "SELECT d FROM DataProduction d" |
| | | + " WHERE d.referentielVersion = :referentielVersion AND d.codeTypeFichier = :codeTypeFichier AND" |
| | | + " d.fileDate = (SELECT MAX(d1.fileDate) FROM DataProduction d1 WHERE d1.referentielVersion = :referentielVersion AND d1.codeTypeFichier = :codeTypeFichier)"; |
| | | TypedQuery<DataProduction> query = em.createQuery(jpql, DataProduction.class) |
| | | .setParameter("referentielVersion", referentielVersion) |
| | | .setParameter("codeTypeFichier", codeTypeFichier); |
| | | |
| | | Optional<DataProduction> optDataProduction = query.getResultList().stream().findFirst(); |
| | | return optDataProduction.isPresent() ? optDataProduction.get() : null; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.integration; |
| | | |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import com.megatim.fdxcommons.dao.ifaces.integration.ColumnDefinitionDAO; |
| | | import javax.ejb.Stateless; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class ColumnDefinitionDAOImpl implements ColumnDefinitionDAO { |
| | | |
| | | @PersistenceContext(name = "fdxPU") |
| | | EntityManager em; |
| | | |
| | | @Override |
| | | public Class<ColumnDefinition> getManagedEntityClass() { |
| | | return ColumnDefinition.class; |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.log; |
| | | |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.log.UserActionLogDAO; |
| | | import com.megatim.fdxcommons.model.log.UserActionLog; |
| | | import java.util.Optional; |
| | | import javax.ejb.Stateless; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class UserActionLogDAOImpl implements UserActionLogDAO { |
| | | |
| | | @PersistenceContext(unitName = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public Class<UserActionLog> getManagedEntityClass() { |
| | | return (UserActionLog.class); |
| | | } |
| | | |
| | | @Override |
| | | public UserActionLog getById(Long id) { |
| | | Query query = em.createQuery("SELECT u from UserActionLog u WHERE u.id = :id"); |
| | | query.setParameter("id", id); |
| | | |
| | | Optional<UserActionLog> optionalLog = query.getResultList().stream().findFirst(); |
| | | return optionalLog.isPresent() ? optionalLog.get() : null; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.ApplicationSourceDAO; |
| | | import com.megatim.fdxcommons.model.referentiel.ApplicationSource; |
| | | import java.util.List; |
| | | import javax.ejb.Stateless; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class ApplicationSourceDAOImpl implements ApplicationSourceDAO { |
| | | |
| | | @PersistenceContext(unitName = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | public ApplicationSourceDAOImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public Class<ApplicationSource> getManagedEntityClass() { |
| | | return (ApplicationSource.class); |
| | | } |
| | | |
| | | @Override |
| | | public ApplicationSource getById(String id) { |
| | | Query query = getEntityManager().createQuery("SELECT a FROM ApplicationSource a where a.libelle = :id"); |
| | | query.setParameter("id", id); |
| | | |
| | | List<ApplicationSource> liste = query.getResultList(); |
| | | |
| | | return liste != null ? liste.stream().findFirst().get() : null; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.ExtensionFichierDAO; |
| | | import com.megatim.fdxcommons.model.referentiel.ExtensionFichier; |
| | | import java.util.Optional; |
| | | import javax.ejb.Stateless; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class ExtensionFichierDAOImpl implements ExtensionFichierDAO { |
| | | |
| | | @PersistenceContext(unitName = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | public ExtensionFichierDAOImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public Class<ExtensionFichier> getManagedEntityClass() { |
| | | return (ExtensionFichier.class); |
| | | } |
| | | |
| | | @Override |
| | | public ExtensionFichier getById(String id) { |
| | | Query query = em.createQuery("SELECT e FROM ExtensionFichier e where e.extension = :id"); |
| | | query.setParameter("id", id); |
| | | |
| | | Optional<ExtensionFichier> optionalExtensionFichier = query.getResultList().stream().findFirst(); |
| | | |
| | | if (optionalExtensionFichier.isPresent()) { |
| | | return optionalExtensionFichier.get(); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.GroupeNoeudDAO; |
| | | import com.megatim.fdxcommons.model.referentiel.GroupeNoeud; |
| | | import java.util.Optional; |
| | | import javax.ejb.Stateless; |
| | | import javax.inject.Inject; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class GroupeNoeudDAOImpl implements GroupeNoeudDAO { |
| | | |
| | | @PersistenceContext(unitName = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | public GroupeNoeudDAOImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public Class<GroupeNoeud> getManagedEntityClass() { |
| | | return (GroupeNoeud.class); |
| | | } |
| | | |
| | | @Override |
| | | public GroupeNoeud getById(String id) { |
| | | Query query = em.createQuery("SELECT gn FROM GroupeNoeud gn" |
| | | + " LEFT JOIN FETCH gn.noeuds LEFT JOIN FETCH gn.routageEnvois LEFT JOIN FETCH gn.routageReceptions" |
| | | + " WHERE gn.code = :id"); |
| | | query.setParameter("id", id); |
| | | |
| | | Optional<GroupeNoeud> optionalGroupeNoeud = query.getResultList().stream().findFirst(); |
| | | |
| | | if (optionalGroupeNoeud.isPresent()) { |
| | | return optionalGroupeNoeud.get(); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.GroupeParticipantDAO; |
| | | import com.megatim.fdxcommons.model.referentiel.GroupeParticipant; |
| | | import java.util.Optional; |
| | | import javax.ejb.Stateless; |
| | | import javax.inject.Inject; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class GroupeParticipantDAOImpl implements GroupeParticipantDAO { |
| | | |
| | | @PersistenceContext(unitName = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | public GroupeParticipantDAOImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public Class<GroupeParticipant> getManagedEntityClass() { |
| | | return (GroupeParticipant.class); |
| | | } |
| | | |
| | | @Override |
| | | public GroupeParticipant getById(String id) { |
| | | Query query = em.createQuery("SELECT gp FROM GroupeParticipant gp" |
| | | + " LEFT JOIN FETCH gp.participants LEFT JOIN FETCH gp.routageEnvois LEFT JOIN FETCH gp.routageReceptions" |
| | | + " WHERE gp.code = :code"); |
| | | query.setParameter("code", id); |
| | | |
| | | Optional<GroupeParticipant> optionalGroupeParticipant = query.getResultList().stream().findFirst(); |
| | | if (optionalGroupeParticipant.isPresent()) { |
| | | return optionalGroupeParticipant.get(); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.NoeudDAO; |
| | | import com.megatim.fdxcommons.model.referentiel.Noeud; |
| | | import java.util.Optional; |
| | | import javax.ejb.Stateless; |
| | | import javax.inject.Inject; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class NoeudDAOImpl implements NoeudDAO { |
| | | |
| | | @PersistenceContext(unitName = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | public NoeudDAOImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public Class<Noeud> getManagedEntityClass() { |
| | | return (Noeud.class); |
| | | } |
| | | |
| | | @Override |
| | | public Noeud getById(String id) { |
| | | Query query = em.createQuery("SELECT n from Noeud n" |
| | | + " LEFT JOIN FETCH n.groupeNoeuds LEFT JOIN FETCH n.routageEnvois LEFT JOIN FETCH n.routageReceptions" |
| | | + " WHERE n.code = :code"); |
| | | query.setParameter("code", id); |
| | | |
| | | Optional<Noeud> optionalNoeud = query.getResultList().stream().findFirst(); |
| | | return optionalNoeud.isPresent() ? optionalNoeud.get() : null; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.ParticipantDAO; |
| | | import com.megatim.fdxcommons.model.referentiel.Participant; |
| | | import java.util.Optional; |
| | | import javax.ejb.Stateless; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class ParticipantDAOImpl implements ParticipantDAO { |
| | | |
| | | @PersistenceContext(unitName = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | public ParticipantDAOImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public Class<Participant> getManagedEntityClass() { |
| | | return (Participant.class); |
| | | } |
| | | |
| | | @Override |
| | | public Participant getById(String id) { |
| | | Query query = em.createQuery("SELECT p from Participant p" |
| | | + " LEFT JOIN FETCH p.groupeParticipants LEFT JOIN FETCH p.routageEnvois " |
| | | + " LEFT JOIN FETCH p.routageReceptions LEFT JOIN FETCH p.noeuds" |
| | | + " WHERE p.code = :code"); |
| | | query.setParameter("code", id); |
| | | |
| | | Optional<Participant> optionalParticipant = query.getResultList().stream().findFirst(); |
| | | return optionalParticipant.isPresent() ? optionalParticipant.get() : null; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.PaysDAO; |
| | | import com.megatim.fdxcommons.model.referentiel.Pays; |
| | | import java.util.Optional; |
| | | import javax.ejb.Stateless; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class PaysDAOImpl implements PaysDAO { |
| | | |
| | | @PersistenceContext(unitName = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | public PaysDAOImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public Class<Pays> getManagedEntityClass() { |
| | | return (Pays.class); |
| | | } |
| | | |
| | | @Override |
| | | public Pays getById(String id) { |
| | | Query query = em.createQuery("SELECT p from Pays p" |
| | | + " WHERE p.code = :code"); |
| | | query.setParameter("code", id); |
| | | |
| | | Optional<Pays> optionalPays = query.getResultList().stream().findFirst(); |
| | | return optionalPays.isPresent() ? optionalPays.get() : null; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.ReferentielDAO; |
| | | import com.megatim.fdxcommons.model.enumeration.StatutReferentiel; |
| | | import com.megatim.fdxcommons.model.referentiel.Referentiel; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import javax.ejb.Stateless; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class ReferentielDAOImpl implements ReferentielDAO { |
| | | |
| | | @PersistenceContext(unitName = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | |
| | | public ReferentielDAOImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public Class<Referentiel> getManagedEntityClass() { |
| | | return (Referentiel.class); |
| | | } |
| | | |
| | | @Override |
| | | public Referentiel getById(String id) { |
| | | Query query = em.createQuery("SELECT r from Referentiel r" |
| | | + " LEFT JOIN FETCH r.extensionFichiers LEFT JOIN FETCH r.applicationSources " |
| | | + " LEFT JOIN FETCH r.routages LEFT JOIN FETCH r.participants" |
| | | + " LEFT JOIN FETCH r.validateurFichierConfigurations LEFT JOIN FETCH r.noeuds" |
| | | + " LEFT JOIN FETCH r.groupeParticipants LEFT JOIN FETCH r.groupeNoeuds" |
| | | + " LEFT JOIN FETCH r.pays" |
| | | + " WHERE r.version = :version"); |
| | | query.setParameter("version", id); |
| | | |
| | | Optional<Referentiel> optionalReferentiel = query.getResultList().stream().findFirst(); |
| | | return optionalReferentiel.isPresent() ? optionalReferentiel.get() : null; |
| | | } |
| | | |
| | | @Override |
| | | public Referentiel findByStatutReferentiel(StatutReferentiel statutReferentiel) { |
| | | Query query = em.createQuery("SELECT r FROM Referentiel r where r.statutReferentiel = :param"); |
| | | query.setParameter("param", statutReferentiel); |
| | | |
| | | Optional<Referentiel> optionalRef = ((List<Referentiel>) query.getResultList()).stream().findFirst(); |
| | | return optionalRef.isPresent() ? optionalRef.get() : null; |
| | | } |
| | | |
| | | @Override |
| | | public Referentiel getReferentielEnCours() { |
| | | Query query = em.createQuery("SELECT r FROM Referentiel r where r.statutReferentiel = :param"); |
| | | query.setParameter("param", StatutReferentiel.EN_COURS); |
| | | |
| | | Optional<Referentiel> optionalRef = ((List<Referentiel>) query.getResultList()).stream().findFirst(); |
| | | return optionalRef.isPresent() ? optionalRef.get() : null; |
| | | } |
| | | |
| | | @Override |
| | | public void archiverReferentielEncours() { |
| | | Query query = em.createQuery("UPDATE Referentiel r set statutReferentiel = :nouveauStatut where r.statutReferentiel = :param"); |
| | | query.setParameter("nouveauStatut", StatutReferentiel.ARCHIVE); |
| | | query.setParameter("param", StatutReferentiel.EN_COURS); |
| | | |
| | | int nb = query.executeUpdate(); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.dao.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.RoutageDAO; |
| | | import com.megatim.fdxcommons.model.referentiel.Participant; |
| | | import javax.ejb.Stateless; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class RoutageDAOImpl implements RoutageDAO { |
| | | |
| | | @PersistenceContext(unitName = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | public RoutageDAOImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public Long countRoutageByReferentielTypeFichierForParticipantForReceive(String versionReferentiel, String codeTypeFichier, Participant participant) { |
| | | return (Long) getEntityManager().createQuery("SELECT COALESCE(COUNT(r), 0) FROM Routage r " |
| | | + "LEFT JOIN r.participantsReception p " |
| | | + "LEFT JOIN r.noeudsReception n " |
| | | + "LEFT JOIN r.groupeParticipantsReception gp LEFT JOIN gp.participants pa " |
| | | + "LEFT JOIN r.groupeNoeudsReception gn LEFT JOIN gn.noeuds no " |
| | | + "WHERE r.referentiel.version = :versionReferentiel AND r.typeFichier.code = :codeTypeFichier " |
| | | + "AND (p = :participant OR pa = :participant OR n.participant = :participant OR no.participant = :participant)") |
| | | .setParameter("versionReferentiel", versionReferentiel) |
| | | .setParameter("codeTypeFichier", codeTypeFichier) |
| | | .setParameter("participant", participant) |
| | | .getSingleResult(); |
| | | } |
| | | |
| | | @Override |
| | | public Long countRoutageByReferentielTypeFichierForParticipantForSend(String versionReferentiel, String codeTypeFichier, Participant participant) { |
| | | return (Long) getEntityManager().createQuery("SELECT COALESCE(COUNT(r), 0) FROM Routage r " |
| | | + "LEFT JOIN r.participantsEnvoi p " |
| | | + "LEFT JOIN r.noeudsEnvoi n " |
| | | + "LEFT JOIN r.groupeParticipantsEnvoi gp LEFT JOIN gp.participants pa " |
| | | + "LEFT JOIN r.groupeNoeudsEnvoi gn LEFT JOIN gn.noeuds no " |
| | | + "WHERE r.referentiel.version = :versionReferentiel AND r.typeFichier.code = :codeTypeFichier " |
| | | + "AND (p = :participant OR pa = :participant OR n.participant = :participant OR no.participant = :participant)") |
| | | .setParameter("versionReferentiel", versionReferentiel) |
| | | .setParameter("codeTypeFichier", codeTypeFichier) |
| | | .setParameter("participant", participant) |
| | | .getSingleResult(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.StructureLigneDAO; |
| | | import com.megatim.fdxcommons.model.referentiel.StructureLigne; |
| | | import javax.ejb.Stateless; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class StructureLigneDAOImpl implements StructureLigneDAO{ |
| | | @PersistenceContext(unitName = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | public StructureLigneDAOImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public Class<StructureLigne> getManagedEntityClass() { |
| | | return (StructureLigne.class); |
| | | } |
| | | |
| | | @Override |
| | | public StructureLigne getById(String id) { |
| | | throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.TypeFichierDAO; |
| | | import com.megatim.fdxcommons.model.referentiel.TypeFichier; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import javax.ejb.Stateless; |
| | | import javax.inject.Inject; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class TypeFichierDAOImpl implements TypeFichierDAO { |
| | | |
| | | @PersistenceContext(unitName = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | public TypeFichierDAOImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public Class<TypeFichier> getManagedEntityClass() { |
| | | return (TypeFichier.class); |
| | | } |
| | | |
| | | @Override |
| | | public TypeFichier getById(String id) { |
| | | Query query = em.createQuery("SELECT t from TypeFichier t" |
| | | + " LEFT JOIN FETCH t.routages LEFT JOIN FETCH t.validateurFichiers " |
| | | + " LEFT JOIN FETCH t.validateurFichierConfigurations" |
| | | + " WHERE t.code = :code"); |
| | | query.setParameter("code", id); |
| | | |
| | | Optional<TypeFichier> optionalTypeFichier = query.getResultList().stream().findFirst(); |
| | | return optionalTypeFichier.isPresent() ? optionalTypeFichier.get() : null; |
| | | } |
| | | |
| | | @Override |
| | | public List<TypeFichier> getByReferentiel(String referentielVersion) { |
| | | |
| | | Query query = em.createQuery("SELECT t from TypeFichier t WHERE t.referentiel.version = :referentielVersion"); |
| | | query.setParameter("referentielVersion", referentielVersion); |
| | | |
| | | return query.getResultList(); |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.ValidateurFichierConfigurationDAO; |
| | | import com.megatim.fdxcommons.model.referentiel.ValidateurFichierConfiguration; |
| | | import com.megatim.fdxcommons.model.referentiel.ValidateurFichierConfigurationId; |
| | | import java.util.Optional; |
| | | import javax.ejb.Stateless; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class ValidateurFichierConfigurationDAOImpl implements ValidateurFichierConfigurationDAO { |
| | | |
| | | @PersistenceContext(unitName = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | public ValidateurFichierConfigurationDAOImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public Class<ValidateurFichierConfiguration> getManagedEntityClass() { |
| | | return (ValidateurFichierConfiguration.class); |
| | | } |
| | | |
| | | @Override |
| | | public ValidateurFichierConfiguration getById(ValidateurFichierConfigurationId id) { |
| | | Query query = em.createQuery("SELECT v FROM ValidateurFichierConfiguration v WHERE v.referentiel.version = :referentielVersion" |
| | | + " AND v.typeFichier.code = :codeTypeFichier"); |
| | | |
| | | query.setParameter("codeTypeFichier", id.getTypeFichier()); |
| | | query.setParameter("referentielVersion", id.getReferentiel()); |
| | | |
| | | Optional<ValidateurFichierConfiguration> optionalValFichier = query.getResultList().stream().findFirst(); |
| | | |
| | | if (optionalValFichier.isPresent()) { |
| | | return optionalValFichier.get(); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.dao.ifaces.referentiel.ValidateurFichierDAO; |
| | | import com.megatim.fdxcommons.model.referentiel.ValidateurFichier; |
| | | import java.util.Optional; |
| | | import javax.ejb.Stateless; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class ValidateurFichierDAOImpl implements ValidateurFichierDAO { |
| | | |
| | | @PersistenceContext(unitName = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | public ValidateurFichierDAOImpl() { |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public Class<ValidateurFichier> getManagedEntityClass() { |
| | | return (ValidateurFichier.class); |
| | | } |
| | | |
| | | @Override |
| | | public ValidateurFichier getById(String id) { |
| | | Query query = em.createQuery("SELECT v from ValidateurFichier v" |
| | | + " LEFT JOIN FETCH v.structureLignes" |
| | | + " WHERE t.id = :id"); |
| | | query.setParameter("id", id); |
| | | |
| | | Optional<ValidateurFichier> optionalValidateurFichier = query.getResultList().stream().findFirst(); |
| | | return optionalValidateurFichier.isPresent() ? optionalValidateurFichier.get() : null; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.referentiel.historique; |
| | | |
| | | import com.megatim.fdxcommons.dao.ifaces.referentiel.historique.ReferentielIntegrationHistoriqueDAO; |
| | | import com.megatim.fdxcommons.model.referentiel.historique.ReferentielIntegrationHistorique; |
| | | import com.megatim.fdxcommons.model.referentiel.historique.ReferentielIntegrationHistoriqueId; |
| | | import java.util.Optional; |
| | | import javax.ejb.Stateless; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class ReferentielIntegrationHistoriqueDAOImpl implements ReferentielIntegrationHistoriqueDAO { |
| | | |
| | | @PersistenceContext(name = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | @Override |
| | | public Class<ReferentielIntegrationHistorique> getManagedEntityClass() { |
| | | return ReferentielIntegrationHistorique.class; |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public ReferentielIntegrationHistorique getById(ReferentielIntegrationHistoriqueId id) { |
| | | Optional<ReferentielIntegrationHistorique> optRefInt = em |
| | | .createQuery("SELECT r from ReferentielIntegrationHistorique r where r.codeTypeFichier = :codeTypeFichier AND r.referentielVersion = :refVersion") |
| | | .getResultList() |
| | | .stream() |
| | | .findFirst(); |
| | | |
| | | return optRefInt.isPresent() ? optRefInt.get() : null; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.referentiel.natureproduction; |
| | | |
| | | import com.megatim.fdxcommons.dao.ifaces.natureproduction.NatureProductionFichierDAO; |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProductionFichier; |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProductionFichierId; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class NatureProductionFichierDAOImpl implements NatureProductionFichierDAO { |
| | | |
| | | @PersistenceContext(unitName = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | @Override |
| | | public Class<NatureProductionFichier> getManagedEntityClass() { |
| | | return NatureProductionFichier.class; |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public NatureProductionFichier getById(NatureProductionFichierId id) { |
| | | Query query = em.createQuery("SELECT n from NatureProductionFichier n where n.referentiel.version = :referentielVersion" |
| | | + " AND n.typeFichier.code = :codeTypeFichier"); |
| | | query.setParameter("referentielVersion", id.getReferentiel()); |
| | | query.setParameter("codeTypeFichier", id.getTypeFichier()); |
| | | Optional<NatureProductionFichier> optNatureProd = query.getResultList().stream().findFirst(); |
| | | |
| | | return optNatureProd.isPresent() ? optNatureProd.get() : null; |
| | | } |
| | | |
| | | @Override |
| | | public List<NatureProductionFichier> getByReferentiel(String referentielVersion) { |
| | | Query query = em.createQuery("SELECT n from NatureProductionFichier n where n.referentiel.version = :referentielVersion"); |
| | | query.setParameter("referentielVersion", referentielVersion); |
| | | |
| | | return query.getResultList(); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.tmp; |
| | | |
| | | import com.megatim.apifdxweb.dao.ifaces.tmp.TokenTmpDAO; |
| | | import com.megatim.apifdxweb.model.tmp.StatutTmp; |
| | | import com.megatim.apifdxweb.model.tmp.TokenTmp; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import javax.ejb.Stateless; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class TokenTmpDAOImpl implements TokenTmpDAO { |
| | | |
| | | @PersistenceContext(unitName = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | @Override |
| | | public Class<TokenTmp> getManagedEntityClass() { |
| | | return TokenTmp.class; |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public TokenTmp getById(String id) { |
| | | Query query = em.createQuery("SELECT t from TokenTmp t WHERE t.id = :id"); |
| | | query.setParameter("id", id); |
| | | |
| | | Optional<TokenTmp> optionalTokenTmp = query.getResultList().stream().findFirst(); |
| | | return optionalTokenTmp.isPresent() ? optionalTokenTmp.get() : null; |
| | | } |
| | | |
| | | @Override |
| | | public List<TokenTmp> getByStatutTmp(StatutTmp statutTmp) { |
| | | Query query = em.createQuery("SELECT t from TokenTmp t WHERE t.statutTmp = :statut"); |
| | | query.setParameter("statut", statutTmp); |
| | | return query.getResultList(); |
| | | } |
| | | |
| | | @Override |
| | | public List<TokenTmp> getExpiredToken() { |
| | | Query query = em.createQuery("SELECT t from TokenTmp t WHERE t.dateExpiration <= :now OR t.statutTmp = :statut"); |
| | | query.setParameter("now", LocalDateTime.now()); |
| | | query.setParameter("statut", StatutTmp.EXPIRE); |
| | | |
| | | return query.getResultList(); |
| | | } |
| | | |
| | | @Override |
| | | public TokenTmp getByParticipantAndTypeFichier(String codeParticipant, String codeTypeFichier) { |
| | | Optional<TokenTmp> optTokenTmp = em.createQuery("SELECT t from TokenTmp t " |
| | | + "WHERE t.codeParticipant = :codeParticipant AND t.codeTypeFichier = :codeTypeFichier AND t.statutTmp = :statut AND t.dateExpiration > :now") |
| | | .setParameter("codeParticipant", codeParticipant) |
| | | .setParameter("codeTypeFichier", codeTypeFichier) |
| | | .setParameter("statut", StatutTmp.EN_COURS) |
| | | .setParameter("now", LocalDateTime.now()) |
| | | .getResultList().stream().findFirst(); |
| | | |
| | | return optTokenTmp.isPresent() ? optTokenTmp.get() : null; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.dao.impl.tmp; |
| | | |
| | | import com.megatim.apifdxweb.dao.ifaces.tmp.TypeFichierDataTmpDAO; |
| | | import com.megatim.apifdxweb.model.tmp.TypeFichierDataTmp; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import javax.ejb.Stateless; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.PersistenceContext; |
| | | import javax.persistence.Query; |
| | | import javax.persistence.Tuple; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Stateless |
| | | public class TypeFichierDataTmpDAOImpl implements TypeFichierDataTmpDAO { |
| | | |
| | | @PersistenceContext(unitName = "fdxPU") |
| | | protected EntityManager em; |
| | | |
| | | @Override |
| | | public Class<TypeFichierDataTmp> getManagedEntityClass() { |
| | | return TypeFichierDataTmp.class; |
| | | } |
| | | |
| | | @Override |
| | | public EntityManager getEntityManager() { |
| | | return em; |
| | | } |
| | | |
| | | @Override |
| | | public TypeFichierDataTmp getById(Long id) { |
| | | Query query = em.createQuery("SELECT t FROM TypeFichierDataTmp t WHERE t.id = :id"); |
| | | query.setParameter("id", id); |
| | | |
| | | Optional<TypeFichierDataTmp> optionalTypeFichierDataTmp = query.getResultList().stream().findFirst(); |
| | | return optionalTypeFichierDataTmp.isPresent() ? optionalTypeFichierDataTmp.get() : null; |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByToken(String token) { |
| | | Query query = em.createQuery("DELETE TypeFichierDataTmp t WHERE t.token = :token"); |
| | | query.setParameter("token", token); |
| | | |
| | | query.executeUpdate(); |
| | | } |
| | | |
| | | @Override |
| | | public List<TypeFichierDataTmp> getByToken(String token) { |
| | | // WITH NumberedValues AS ( |
| | | // SELECT |
| | | // colonne, |
| | | // datum, |
| | | // ROW_NUMBER() OVER (PARTITION BY colonne ORDER BY numeroligne) AS row_num |
| | | // FROM |
| | | // typefichierdatatmp |
| | | // where token='dd6ed96a-0bfc-38ce-bdf4-5d9716325f4a' |
| | | //) |
| | | //SELECT |
| | | // MAX(CASE WHEN colonne = 'niu' THEN datum END) AS NIU, |
| | | // MAX(CASE WHEN colonne = 'codecentre' THEN datum END) AS codecentre, |
| | | // MAX(CASE WHEN colonne = 'codecm' THEN datum END) AS codecm, |
| | | // MAX(CASE WHEN colonne = 'regime' THEN datum END) AS regime, |
| | | // MAX(CASE WHEN colonne = 'registre_commerce' THEN datum END) AS registre_commerce, |
| | | // MAX(CASE WHEN colonne = 'raisoc' THEN datum END) AS raisoc, |
| | | // MAX(CASE WHEN colonne = 'nom_etablisement' THEN datum END) AS nom_etablisement |
| | | // |
| | | //FROM |
| | | // NumberedValues |
| | | //GROUP BY |
| | | // row_num |
| | | //ORDER BY |
| | | // row_num; |
| | | |
| | | Query query = em.createQuery("SELECT t FROM TypeFichierDataTmp t WHERE t.token = :token"); |
| | | query.setParameter("token", token); |
| | | |
| | | return query.getResultList(); |
| | | } |
| | | |
| | | @Override |
| | | public List<TypeFichierDataTmp> getByTokenAndByNumeroLigne(String token, int minNumeroLigne, int maxNumeroLigne) { |
| | | Query query = em.createQuery("SELECT t FROM TypeFichierDataTmp t WHERE t.token = :token AND t.numeroLigne >= : minNumeroLigne AND t.numeroLigne < :maxNumeroLigne"); |
| | | query.setParameter("token", token); |
| | | query.setParameter("minNumeroLigne", minNumeroLigne); |
| | | query.setParameter("maxNumeroLigne", maxNumeroLigne); |
| | | |
| | | return query.getResultList(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean hasBatchAlreadyBeenReceived(String token, int batchNumber) { |
| | | |
| | | Query query = em.createQuery("SELECT t FROM TypeFichierDataTmp t WHERE t.token = :token and t.batchNumber = :batchNumber"); |
| | | query.setParameter("token", token); |
| | | query.setParameter("batchNumber", batchNumber); |
| | | |
| | | return query.getResultList().stream().findFirst().isPresent(); |
| | | } |
| | | |
| | | @Override |
| | | public List<LinkedHashMap<String, Object>> getByStructuredLines(String token, List<ColumnDefinition> columnsDef) { |
| | | Collections.sort(columnsDef, (ColumnDefinition c1, ColumnDefinition c2) -> Integer.valueOf(c1.getPosition()).compareTo(c2.getPosition())); |
| | | List<LinkedHashMap<String, Object>> results = new ArrayList<>(); |
| | | |
| | | String query = constructQuery(token, columnsDef); |
| | | List<Tuple> tuples = em.createNativeQuery(query, Tuple.class).getResultList(); |
| | | |
| | | tuples.stream().forEach(t -> { |
| | | LinkedHashMap<String, Object> map = new LinkedHashMap<>(); |
| | | for (int i = 0; i < columnsDef.size(); i++) { |
| | | map.put(columnsDef.get(i).getName(), t.get(i, String.class)); |
| | | } |
| | | results.add(map); |
| | | }); |
| | | return results; |
| | | } |
| | | |
| | | private String constructQuery(String token, List<ColumnDefinition> columnsDef) { |
| | | StringBuilder builder = new StringBuilder("WITH Lines AS (" |
| | | + " SELECT colonne, datum, ROW_NUMBER() OVER (PARTITION BY colonne ORDER BY numeroligne) AS row_num" |
| | | + " FROM typefichierdatatmp" |
| | | + " WHERE token='" + token + "'" |
| | | + ") SELECT "); |
| | | for (ColumnDefinition c : columnsDef) { |
| | | builder.append(" MAX(CASE WHEN colonne = '").append(c.getName()).append("' THEN datum END) AS ").append(c.getName()).append(","); |
| | | } |
| | | builder.replace(builder.length() - 1, builder.length(), ""); |
| | | builder.append(" FROM Lines GROUP BY row_num ORDER BY row_num"); |
| | | |
| | | return builder.toString(); |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> |
| | | <persistence-unit name="fdxPU" transaction-type="JTA"> |
| | | |
| | | <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> |
| | | <jta-data-source>java:/fdxDS</jta-data-source> |
| | | <shared-cache-mode>NONE</shared-cache-mode> |
| | | |
| | | <!--Module Administration--> |
| | | <class>com.megatim.apifdxweb.model.administration.Action</class> |
| | | <class>com.megatim.apifdxweb.model.administration.Role</class> |
| | | <class>com.megatim.apifdxweb.model.administration.User</class> |
| | | <class>com.megatim.apifdxweb.model.administration.JournalActionUtilisateur</class> |
| | | <class>com.megatim.apifdxweb.model.administration.JournalConnexionUtilisateur</class> |
| | | |
| | | <class>com.megatim.apifdxweb.model.administration.TokenGeneration</class> |
| | | |
| | | <!--Module Referentiel--> |
| | | <class>com.megatim.fdxcommons.model.referentiel.ApplicationSource</class> |
| | | <class>com.megatim.fdxcommons.model.referentiel.ExtensionFichier</class> |
| | | <class>com.megatim.fdxcommons.model.referentiel.GroupeNoeud</class> |
| | | <class>com.megatim.fdxcommons.model.referentiel.GroupeParticipant</class> |
| | | <class>com.megatim.fdxcommons.model.referentiel.Noeud</class> |
| | | <class>com.megatim.fdxcommons.model.referentiel.Participant</class> |
| | | <class>com.megatim.fdxcommons.model.referentiel.Pays</class> |
| | | <class>com.megatim.fdxcommons.model.referentiel.Referentiel</class> |
| | | <class>com.megatim.fdxcommons.model.referentiel.Routage</class> |
| | | <class>com.megatim.fdxcommons.model.referentiel.StructureLigne</class> |
| | | <class>com.megatim.fdxcommons.model.referentiel.TypeFichier</class> |
| | | <class>com.megatim.fdxcommons.model.referentiel.ValidateurFichier</class> |
| | | <class>com.megatim.fdxcommons.model.referentiel.ValidateurFichierConfiguration</class> |
| | | <class>com.megatim.fdxcommons.model.integration.ColumnDefinition</class> |
| | | <class>com.megatim.fdxcommons.model.auth.TokenAuthentification</class> |
| | | |
| | | <!-- Audit--> |
| | | <class>com.megatim.apifdxweb.model.audit.AuditActionsParticipant</class> |
| | | <class>com.megatim.apifdxweb.model.audit.AuditExportations</class> |
| | | |
| | | <class>com.megatim.fdxcommons.model.dataproduction.DataProduction</class> |
| | | <class>com.megatim.fdxcommons.model.dataproduction.DataProductionHistorique</class> |
| | | |
| | | <class>com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProductionFichier</class> |
| | | <class>com.megatim.fdxcommons.model.log.UserActionLog</class> |
| | | |
| | | <!-- Traitement par lots --> |
| | | <class>com.megatim.apifdxweb.model.tmp.TokenTmp</class> |
| | | <class>com.megatim.apifdxweb.model.tmp.TypeFichierDataTmp</class> |
| | | |
| | | <!-- Historique des fichiers consommés au niveau des routes Camel--> |
| | | <class>com.megatim.apifdxweb.model.camel.historique.ConsumedFilesHistory</class> |
| | | |
| | | <!-- Historique Intégration Référentiel --> |
| | | <class>com.megatim.fdxcommons.model.referentiel.historique.ReferentielIntegrationHistorique</class> |
| | | |
| | | <properties> |
| | | <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL95Dialect"/> |
| | | <property name="hibernate.hbm2ddl.auto" value="update"/> |
| | | <property name="hibernate.show_sql" value="false"/> |
| | | <!--<property name="hibernate.jdbc.lob.non_contextual_creation" value="true"/>--> |
| | | </properties> |
| | | </persistence-unit> |
| | | |
| | | </persistence> |
| New file |
| | |
| | | user.name=postgres |
| | | password=mela |
| | | adresse.ip=localhost |
| | | port=5432 |
| | | database.name=fdxDB |
| | | sgbd.name=megatim |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project-shared-configuration> |
| | | <!-- |
| | | This file contains additional configuration written by modules in the NetBeans IDE. |
| | | The configuration is intended to be shared among all the users of project and |
| | | therefore it is assumed to be part of version control checkout. |
| | | Without this configuration present, some functionality in the IDE may be limited or fail altogether. |
| | | --> |
| | | <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1"> |
| | | <!-- |
| | | Properties that influence various parts of the IDE, especially code formatting and the like. |
| | | You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up. |
| | | That way multiple projects can share the same settings (useful for formatting rules for example). |
| | | Any value defined here will override the pom.xml file value but is only applicable to the current project. |
| | | --> |
| | | <netbeans.hint.jdkPlatform>JDK_1.8</netbeans.hint.jdkPlatform> |
| | | </properties> |
| | | </project-shared-configuration> |
| New file |
| | |
| | | <?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"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <parent> |
| | | <groupId>com.megatim.apifdxweb</groupId> |
| | | <artifactId>apifdxweb</artifactId> |
| | | <version>1.0</version> |
| | | </parent> |
| | | |
| | | <groupId>com.megatim.apifdxweb.model</groupId> |
| | | <artifactId>apifdxweb-model</artifactId> |
| | | <version>1.0</version> |
| | | <packaging>jar</packaging> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>1.8</maven.compiler.source> |
| | | <maven.compiler.target>1.8</maven.compiler.target> |
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| | | <jakartaee>8.0</jakartaee> |
| | | <version.lombok>1.18.18</version.lombok> |
| | | <version.mapstruct>1.4.2.Final</version.mapstruct> |
| | | <version.mapstruct-lombok>0.2.0</version.mapstruct-lombok> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>javax</groupId> |
| | | <artifactId>javaee-api</artifactId> |
| | | <version>${jakartaee}</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <version>${version.lombok}</version> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatim</groupId> |
| | | <artifactId>rs-security-core</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.mapstruct</groupId> |
| | | <artifactId>mapstruct</artifactId> |
| | | <version>${version.mapstruct}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok-mapstruct-binding</artifactId> |
| | | <version>${version.mapstruct-lombok}</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.hibernate.validator</groupId> |
| | | <artifactId>hibernate-validator</artifactId> |
| | | <version>6.0.13.Final</version> |
| | | </dependency> |
| | | |
| | | <!-- Apiee --> |
| | | <dependency> |
| | | <groupId>com.github.phillip-kruger</groupId> |
| | | <artifactId>apiee-core</artifactId> |
| | | <version>1.0.8</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <!-- ... --> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <version>3.5.1</version> |
| | | <configuration> |
| | | <source>1.8</source> |
| | | <target>1.8</target> |
| | | <annotationProcessorPaths> |
| | | <path> |
| | | <groupId>org.mapstruct</groupId> |
| | | <artifactId>mapstruct-processor</artifactId> |
| | | <version>${version.mapstruct}</version> |
| | | </path> |
| | | <path> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <version>${version.lombok}</version> |
| | | </path> |
| | | <path> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok-mapstruct-binding</artifactId> |
| | | <version>${version.mapstruct-lombok}</version> |
| | | </path> |
| | | </annotationProcessorPaths> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | <name>apifdxweb-model</name> |
| | | |
| | | </project> |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.administration; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.TypeOperation; |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import javax.persistence.Column; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.GeneratedValue; |
| | | import javax.persistence.GenerationType; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.ManyToMany; |
| | | import javax.persistence.SequenceGenerator; |
| | | import javax.persistence.Table; |
| | | |
| | | /** |
| | | * |
| | | * @author Leonel FOFOU |
| | | */ |
| | | @Entity(name = "Action") |
| | | @Table(name = "FS_ACTION") |
| | | public class Action implements Comparable<Action>, Serializable { |
| | | |
| | | @SequenceGenerator(name = "SEQ_ACTION", |
| | | sequenceName = "SEQ_ACTION", |
| | | allocationSize = 1, |
| | | initialValue = 1) |
| | | @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_ACTION") |
| | | @Column(name = "ID") |
| | | @Id |
| | | private Long id; |
| | | |
| | | @Column(name = "path") |
| | | private String path; |
| | | |
| | | @Column(name = "module") |
| | | private String module; |
| | | |
| | | @Column(name = "name") |
| | | private String name; |
| | | |
| | | @Column(name = "categorie") |
| | | private String categorie; |
| | | |
| | | @Column(name = "description") |
| | | private String description; |
| | | |
| | | @Column(name = "autorise") |
| | | private Boolean autorise; |
| | | |
| | | @Column(name = "ID_GENERER") |
| | | protected String idGenerer; |
| | | |
| | | @Column(name = "TYPE_OPERATION") |
| | | private TypeOperation typeOperation = TypeOperation.AJOUTER; |
| | | |
| | | @ManyToMany(mappedBy = "actions") |
| | | private List<Role> roles = new ArrayList<Role>(); |
| | | |
| | | public Action() { |
| | | } |
| | | |
| | | public Action(String name, String description, String path, String module, Boolean autorise) { |
| | | this.name = name; |
| | | this.description = description; |
| | | this.path = path; |
| | | this.module = module; |
| | | this.autorise = autorise; |
| | | } |
| | | |
| | | public Action(String name, String description, String path, String module, String categorie, Boolean autorise) { |
| | | this.name = name; |
| | | this.description = description; |
| | | this.path = path; |
| | | this.module = module; |
| | | this.categorie = categorie; |
| | | this.autorise = autorise; |
| | | } |
| | | |
| | | public Action(String name, String description, String path, String module, Boolean autorise, Role role) { |
| | | this.name = name; |
| | | this.description = description; |
| | | this.path = path; |
| | | this.module = module; |
| | | this.autorise = autorise; |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getPath() { |
| | | return path; |
| | | } |
| | | |
| | | public void setPath(String path) { |
| | | this.path = path; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public List<Role> getRoles() { |
| | | return roles; |
| | | } |
| | | |
| | | public void setRoles(List<Role> roles) { |
| | | this.roles = roles; |
| | | } |
| | | |
| | | public String getIdGenerer() { |
| | | return idGenerer; |
| | | } |
| | | |
| | | public void setIdGenerer(String idGenerer) { |
| | | this.idGenerer = idGenerer; |
| | | } |
| | | |
| | | public TypeOperation getTypeOperation() { |
| | | return typeOperation; |
| | | } |
| | | |
| | | public void setTypeOperation(TypeOperation typeOperation) { |
| | | this.typeOperation = typeOperation; |
| | | } |
| | | |
| | | public Boolean getAutorise() { |
| | | return autorise; |
| | | } |
| | | |
| | | public void setAutorise(Boolean autorise) { |
| | | this.autorise = autorise; |
| | | } |
| | | |
| | | public String getModule() { |
| | | return module; |
| | | } |
| | | |
| | | public void setModule(String module) { |
| | | this.module = module; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | public void setDescription(String description) { |
| | | this.description = description; |
| | | } |
| | | |
| | | public String getCategorie() { |
| | | return categorie; |
| | | } |
| | | |
| | | public void setCategorie(String categorie) { |
| | | this.categorie = categorie; |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | int hash = 7; |
| | | hash = 79 * hash + Objects.hashCode(this.id); |
| | | return hash; |
| | | } |
| | | |
| | | @Override |
| | | public boolean equals(Object obj) { |
| | | if (this == obj) { |
| | | return true; |
| | | } |
| | | if (obj == null) { |
| | | return false; |
| | | } |
| | | if (getClass() != obj.getClass()) { |
| | | return false; |
| | | } |
| | | final Action other = (Action) obj; |
| | | return Objects.equals(this.id, other.id); |
| | | } |
| | | |
| | | /* |
| | | * (non-Javadoc) |
| | | * @see java.lang.Comparable#compareTo(java.lang.Object) |
| | | */ |
| | | @Override |
| | | public int compareTo(Action parameter) { |
| | | |
| | | // Si le parametre est null |
| | | if (parameter == null) { |
| | | return -1; |
| | | } |
| | | |
| | | // Si le code du parametre est vide |
| | | if (parameter.id == null) { |
| | | return -1; |
| | | } |
| | | |
| | | // Si le code du parametre en cours est vide |
| | | if (id == null) { |
| | | return 1; |
| | | } |
| | | |
| | | // On retourne la comparaison des codes |
| | | return id.compareTo(parameter.id); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.model.administration; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.Gravite; |
| | | import com.megatim.fdxcommons.model.enumeration.TypeOperation; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.Objects; |
| | | import javax.persistence.Column; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.EnumType; |
| | | import javax.persistence.Enumerated; |
| | | import javax.persistence.GeneratedValue; |
| | | import javax.persistence.GenerationType; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.SequenceGenerator; |
| | | import javax.persistence.Table; |
| | | import javax.persistence.Temporal; |
| | | import javax.persistence.TemporalType; |
| | | |
| | | /** |
| | | * |
| | | * @author DYNABOOK |
| | | */ |
| | | @Entity(name = "JournalActionUtilisateur") |
| | | @Table(name = "FS_JRN_ACT_USR") |
| | | public class JournalActionUtilisateur implements Comparable<JournalActionUtilisateur>, Serializable { |
| | | |
| | | @SequenceGenerator(name = "SEQ_JRN_ACT_USR", |
| | | sequenceName = "SEQ_JRN_ACT_USR", |
| | | allocationSize = 1, |
| | | initialValue = 1) |
| | | @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_JRN_ACT_USR") |
| | | @Column(name = "ID") |
| | | @Id |
| | | private Long id; |
| | | |
| | | @Column(name = "ID_GENERER") |
| | | protected String idGenerer; |
| | | |
| | | @Column(name = "TYPE_OPERATION") |
| | | private TypeOperation typeOperation = TypeOperation.AJOUTER; |
| | | |
| | | @Column(name = "UTILISATEUR") |
| | | private String utilisateur; |
| | | |
| | | @Column(name = "DESCRIPTION") |
| | | private String description; |
| | | |
| | | @Column(name = "GRAVITE") |
| | | @Enumerated(EnumType.STRING) |
| | | private Gravite gravite; |
| | | |
| | | @Column(name = "ADRESSE_IP") |
| | | private int adresseIp; |
| | | |
| | | @Column(name = "DATE_CREATION") |
| | | @Temporal(TemporalType.TIMESTAMP) |
| | | private Date dateCreation; |
| | | |
| | | @Column(name = "USER_CREATION") |
| | | private String utilisateurCreation; |
| | | |
| | | @Column(name = "DATE_DERN_MOD") |
| | | @Temporal(TemporalType.TIMESTAMP) |
| | | private Date dateDerniereModification; |
| | | |
| | | @Column(name = "USER_UPDATE") |
| | | private String utilisateurModification; |
| | | |
| | | @Column(name = "DATE_SUPPR") |
| | | @Temporal(TemporalType.TIMESTAMP) |
| | | private Date dateSuppression; |
| | | |
| | | @Column(name = "USER_DELETE") |
| | | private String utilisateurSuppression; |
| | | |
| | | public JournalActionUtilisateur() { |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getIdGenerer() { |
| | | return idGenerer; |
| | | } |
| | | |
| | | public void setIdGenerer(String idGenerer) { |
| | | this.idGenerer = idGenerer; |
| | | } |
| | | |
| | | public TypeOperation getTypeOperation() { |
| | | return typeOperation; |
| | | } |
| | | |
| | | public void setTypeOperation(TypeOperation typeOperation) { |
| | | this.typeOperation = typeOperation; |
| | | } |
| | | |
| | | public Date getDateDerniereModification() { |
| | | return dateDerniereModification; |
| | | } |
| | | |
| | | public void setDateDerniereModification(Date dateDerniereModification) { |
| | | this.dateDerniereModification = dateDerniereModification; |
| | | } |
| | | |
| | | public Date getDateSuppression() { |
| | | return dateSuppression; |
| | | } |
| | | |
| | | public void setDateSuppression(Date dateSuppression) { |
| | | this.dateSuppression = dateSuppression; |
| | | } |
| | | |
| | | public String getUtilisateurCreation() { |
| | | return utilisateurCreation; |
| | | } |
| | | |
| | | public void setUtilisateurCreation(String utilisateurCreation) { |
| | | this.utilisateurCreation = utilisateurCreation; |
| | | } |
| | | |
| | | public String getUtilisateurModification() { |
| | | return utilisateurModification; |
| | | } |
| | | |
| | | public void setUtilisateurModification(String utilisateurModification) { |
| | | this.utilisateurModification = utilisateurModification; |
| | | } |
| | | |
| | | public String getUtilisateurSuppression() { |
| | | return utilisateurSuppression; |
| | | } |
| | | |
| | | public void setUtilisateurSuppression(String utilisateurSuppression) { |
| | | this.utilisateurSuppression = utilisateurSuppression; |
| | | } |
| | | |
| | | public String getUtilisateur() { |
| | | return utilisateur; |
| | | } |
| | | |
| | | public void setUtilisateur(String utilisateur) { |
| | | this.utilisateur = utilisateur; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | public void setDescription(String description) { |
| | | this.description = description; |
| | | } |
| | | |
| | | public Gravite getGravite() { |
| | | return gravite; |
| | | } |
| | | |
| | | public void setGravite(Gravite gravite) { |
| | | this.gravite = gravite; |
| | | } |
| | | |
| | | public int getAdresseIp() { |
| | | return adresseIp; |
| | | } |
| | | |
| | | public void setAdresseIp(int adresseIp) { |
| | | this.adresseIp = adresseIp; |
| | | } |
| | | |
| | | public Date getDateCreation() { |
| | | return dateCreation; |
| | | } |
| | | |
| | | public void setDateCreation(Date dateCreation) { |
| | | this.dateCreation = dateCreation; |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | int hash = 7; |
| | | hash = 79 * hash + Objects.hashCode(this.id); |
| | | return hash; |
| | | } |
| | | |
| | | @Override |
| | | public boolean equals(Object obj) { |
| | | if (this == obj) { |
| | | return true; |
| | | } |
| | | if (obj == null) { |
| | | return false; |
| | | } |
| | | if (getClass() != obj.getClass()) { |
| | | return false; |
| | | } |
| | | final JournalActionUtilisateur other = (JournalActionUtilisateur) obj; |
| | | return Objects.equals(this.id, other.id); |
| | | } |
| | | |
| | | /* |
| | | * (non-Javadoc) |
| | | * @see java.lang.Comparable#compareTo(java.lang.Object) |
| | | */ |
| | | @Override |
| | | public int compareTo(JournalActionUtilisateur parameter) { |
| | | if (parameter == null) { |
| | | return -1; |
| | | } |
| | | if (parameter.id == null) { |
| | | return -1; |
| | | } |
| | | if (id == null) { |
| | | return 1; |
| | | } |
| | | return id.compareTo(parameter.id); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.model.administration; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.Gravite; |
| | | import com.megatim.fdxcommons.model.enumeration.TypeOperation; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.Objects; |
| | | import javax.persistence.Column; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.EnumType; |
| | | import javax.persistence.Enumerated; |
| | | import javax.persistence.GeneratedValue; |
| | | import javax.persistence.GenerationType; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.SequenceGenerator; |
| | | import javax.persistence.Table; |
| | | import javax.persistence.Temporal; |
| | | import javax.persistence.TemporalType; |
| | | |
| | | /** |
| | | * |
| | | * @author DYNABOOK |
| | | */ |
| | | @Entity(name = "JournalConnexionUtilisateur") |
| | | @Table(name = "FS_JRN_CON_USR") |
| | | public class JournalConnexionUtilisateur implements Comparable<JournalConnexionUtilisateur>, Serializable { |
| | | |
| | | @SequenceGenerator(name = "SEQ_JRN_CON_USR", |
| | | sequenceName = "SEQ_JRN_CON_USR", |
| | | allocationSize = 1, |
| | | initialValue = 1) |
| | | @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_JRN_CON_USR") |
| | | @Column(name = "ID") |
| | | @Id |
| | | private Long id; |
| | | |
| | | @Column(name = "ID_GENERER") |
| | | protected String idGenerer; |
| | | |
| | | @Column(name = "TYPE_OPERATION") |
| | | private TypeOperation typeOperation = TypeOperation.AJOUTER; |
| | | |
| | | @Column(name = "UTILISATEUR") |
| | | private String utilisateur; |
| | | |
| | | @Column(name = "DESCRIPTION") |
| | | private String description; |
| | | |
| | | @Column(name = "GRAVITE") |
| | | @Enumerated(EnumType.STRING) |
| | | private Gravite gravite; |
| | | |
| | | @Column(name = "ADRESSE_IP") |
| | | private int adresseIp; |
| | | |
| | | @Column(name = "DATE_CREATION") |
| | | @Temporal(TemporalType.TIMESTAMP) |
| | | private Date dateCreation; |
| | | |
| | | @Column(name = "USER_CREATION") |
| | | private String utilisateurCreation; |
| | | |
| | | @Column(name = "DATE_DERN_MOD") |
| | | @Temporal(TemporalType.TIMESTAMP) |
| | | private Date dateDerniereModification; |
| | | |
| | | @Column(name = "USER_UPDATE") |
| | | private String utilisateurModification; |
| | | |
| | | @Column(name = "DATE_SUPPR") |
| | | @Temporal(TemporalType.TIMESTAMP) |
| | | private Date dateSuppression; |
| | | |
| | | @Column(name = "USER_DELETE") |
| | | private String utilisateurSuppression; |
| | | |
| | | public Date getDateCreation() { |
| | | return dateCreation; |
| | | } |
| | | |
| | | public void setDateCreation(Date dateCreation) { |
| | | this.dateCreation = dateCreation; |
| | | } |
| | | |
| | | public JournalConnexionUtilisateur() { |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getIdGenerer() { |
| | | return idGenerer; |
| | | } |
| | | |
| | | public void setIdGenerer(String idGenerer) { |
| | | this.idGenerer = idGenerer; |
| | | } |
| | | |
| | | public TypeOperation getTypeOperation() { |
| | | return typeOperation; |
| | | } |
| | | |
| | | public void setTypeOperation(TypeOperation typeOperation) { |
| | | this.typeOperation = typeOperation; |
| | | } |
| | | |
| | | public Date getDateDerniereModification() { |
| | | return dateDerniereModification; |
| | | } |
| | | |
| | | public void setDateDerniereModification(Date dateDerniereModification) { |
| | | this.dateDerniereModification = dateDerniereModification; |
| | | } |
| | | |
| | | public Date getDateSuppression() { |
| | | return dateSuppression; |
| | | } |
| | | |
| | | public void setDateSuppression(Date dateSuppression) { |
| | | this.dateSuppression = dateSuppression; |
| | | } |
| | | |
| | | public String getUtilisateurCreation() { |
| | | return utilisateurCreation; |
| | | } |
| | | |
| | | public void setUtilisateurCreation(String utilisateurCreation) { |
| | | this.utilisateurCreation = utilisateurCreation; |
| | | } |
| | | |
| | | public String getUtilisateurModification() { |
| | | return utilisateurModification; |
| | | } |
| | | |
| | | public void setUtilisateurModification(String utilisateurModification) { |
| | | this.utilisateurModification = utilisateurModification; |
| | | } |
| | | |
| | | public String getUtilisateurSuppression() { |
| | | return utilisateurSuppression; |
| | | } |
| | | |
| | | public void setUtilisateurSuppression(String utilisateurSuppression) { |
| | | this.utilisateurSuppression = utilisateurSuppression; |
| | | } |
| | | |
| | | public String getUtilisateur() { |
| | | return utilisateur; |
| | | } |
| | | |
| | | public void setUtilisateur(String utilisateur) { |
| | | this.utilisateur = utilisateur; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | public void setDescription(String description) { |
| | | this.description = description; |
| | | } |
| | | |
| | | public Gravite getGravite() { |
| | | return gravite; |
| | | } |
| | | |
| | | public void setGravite(Gravite gravite) { |
| | | this.gravite = gravite; |
| | | } |
| | | |
| | | public int getAdresseIp() { |
| | | return adresseIp; |
| | | } |
| | | |
| | | public void setAdresseIp(int adresseIp) { |
| | | this.adresseIp = adresseIp; |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | int hash = 7; |
| | | hash = 79 * hash + Objects.hashCode(this.id); |
| | | return hash; |
| | | } |
| | | |
| | | @Override |
| | | public boolean equals(Object obj) { |
| | | if (this == obj) { |
| | | return true; |
| | | } |
| | | if (obj == null) { |
| | | return false; |
| | | } |
| | | if (getClass() != obj.getClass()) { |
| | | return false; |
| | | } |
| | | final JournalConnexionUtilisateur other = (JournalConnexionUtilisateur) obj; |
| | | return Objects.equals(this.id, other.id); |
| | | } |
| | | |
| | | /* |
| | | * (non-Javadoc) |
| | | * @see java.lang.Comparable#compareTo(java.lang.Object) |
| | | */ |
| | | @Override |
| | | public int compareTo(JournalConnexionUtilisateur parameter) { |
| | | if (parameter == null) { |
| | | return -1; |
| | | } |
| | | if (parameter.id == null) { |
| | | return -1; |
| | | } |
| | | if (id == null) { |
| | | return 1; |
| | | } |
| | | return id.compareTo(parameter.id); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.model.administration; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.EtatOperation; |
| | | import com.megatim.fdxcommons.model.enumeration.TypeOperation; |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import javax.persistence.Column; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.FetchType; |
| | | import javax.persistence.GeneratedValue; |
| | | import javax.persistence.GenerationType; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.ManyToMany; |
| | | import javax.persistence.SequenceGenerator; |
| | | import javax.persistence.Table; |
| | | import javax.persistence.Temporal; |
| | | import javax.persistence.TemporalType; |
| | | import javax.persistence.EnumType; |
| | | import javax.persistence.Enumerated; |
| | | import javax.persistence.JoinColumn; |
| | | import javax.persistence.JoinTable; |
| | | import javax.persistence.OneToMany; |
| | | import javax.validation.constraints.NotEmpty; |
| | | |
| | | /** |
| | | * |
| | | * @author DYNABOOK |
| | | */ |
| | | @Entity(name = "Role") |
| | | @Table(name = "FDX_ROLE") |
| | | public class Role implements Comparable<Role>, Serializable { |
| | | |
| | | @SequenceGenerator(name = "SEQ_ROLE", |
| | | sequenceName = "SEQ_ROLE", |
| | | allocationSize = 1, |
| | | initialValue = 1) |
| | | @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_ROLE") |
| | | @Column(name = "ID") |
| | | @Id |
| | | private Long id; |
| | | |
| | | @Column(name = "ID_GENERER") |
| | | protected String idGenerer; |
| | | |
| | | @Column(nullable = false, name = "libelle") |
| | | @NotEmpty(message = "Le libellé est obligatoire") |
| | | private String libelle; |
| | | |
| | | @Column(name = "description") |
| | | private String description; |
| | | |
| | | @Column(name = "TYPE_OPERATION") |
| | | private TypeOperation typeOperation = TypeOperation.AJOUTER; |
| | | |
| | | @Column(name = "ETAT_OPERATION") |
| | | @Enumerated(EnumType.STRING) |
| | | private EtatOperation etatOperation; |
| | | |
| | | @Column(name = "IS_ADMIN") |
| | | private boolean admin = false; |
| | | |
| | | @Column(name = "IS_SUPER_ADMIN") |
| | | private boolean superAdmin = false; |
| | | |
| | | @Column(name = "IS_MEGA_ADMIN") |
| | | private boolean megaAdmin = false; |
| | | |
| | | @OneToMany(mappedBy = "role") |
| | | private List<User> users = new ArrayList<>(); |
| | | |
| | | @ManyToMany(fetch = FetchType.EAGER) |
| | | @JoinTable( |
| | | name = "FS_ROLE_ACTION", |
| | | joinColumns = @JoinColumn(name = "FS_ROLE_ID"), |
| | | inverseJoinColumns = @JoinColumn(name = "FS_ACTION_ID")) |
| | | private List<Action> actions = new ArrayList<>(); |
| | | |
| | | @Column(name = "DATE_CREATION") |
| | | @Temporal(TemporalType.TIMESTAMP) |
| | | private Date dateCreation; |
| | | |
| | | @Column(name = "USER_CREATION") |
| | | private String utilisateurCreation; |
| | | |
| | | @Column(name = "DATE_DERN_MOD") |
| | | @Temporal(TemporalType.TIMESTAMP) |
| | | private Date dateDerniereModification; |
| | | |
| | | @Column(name = "USER_UPDATE") |
| | | private String utilisateurModification; |
| | | |
| | | @Column(name = "DATE_SUPPR") |
| | | @Temporal(TemporalType.TIMESTAMP) |
| | | private Date dateSuppression; |
| | | |
| | | @Column(name = "USER_DELETE") |
| | | private String utilisateurSuppression; |
| | | |
| | | public Role() { |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getLibelle() { |
| | | return libelle; |
| | | } |
| | | |
| | | public void setLibelle(String libelle) { |
| | | this.libelle = libelle; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | public void setDescription(String description) { |
| | | this.description = description; |
| | | } |
| | | |
| | | public TypeOperation getTypeOperation() { |
| | | return typeOperation; |
| | | } |
| | | |
| | | public void setTypeOperation(TypeOperation typeOperation) { |
| | | this.typeOperation = typeOperation; |
| | | } |
| | | |
| | | public String getIdGenerer() { |
| | | return idGenerer; |
| | | } |
| | | |
| | | public void setIdGenerer(String idGenerer) { |
| | | this.idGenerer = idGenerer; |
| | | } |
| | | |
| | | public List<Action> getActions() { |
| | | return actions; |
| | | } |
| | | |
| | | public void setActions(List<Action> actions) { |
| | | this.actions = actions; |
| | | } |
| | | |
| | | public Date getDateCreation() { |
| | | return dateCreation; |
| | | } |
| | | |
| | | public void setDateCreation(Date dateCreation) { |
| | | this.dateCreation = dateCreation; |
| | | } |
| | | |
| | | public String getUtilisateurCreation() { |
| | | return utilisateurCreation; |
| | | } |
| | | |
| | | public void setUtilisateurCreation(String utilisateurCreation) { |
| | | this.utilisateurCreation = utilisateurCreation; |
| | | } |
| | | |
| | | public Date getDateDerniereModification() { |
| | | return dateDerniereModification; |
| | | } |
| | | |
| | | public void setDateDerniereModification(Date dateDerniereModification) { |
| | | this.dateDerniereModification = dateDerniereModification; |
| | | } |
| | | |
| | | public String getUtilisateurModification() { |
| | | return utilisateurModification; |
| | | } |
| | | |
| | | public void setUtilisateurModification(String utilisateurModification) { |
| | | this.utilisateurModification = utilisateurModification; |
| | | } |
| | | |
| | | public Date getDateSuppression() { |
| | | return dateSuppression; |
| | | } |
| | | |
| | | public void setDateSuppression(Date dateSuppression) { |
| | | this.dateSuppression = dateSuppression; |
| | | } |
| | | |
| | | public String getUtilisateurSuppression() { |
| | | return utilisateurSuppression; |
| | | } |
| | | |
| | | public boolean isAdmin() { |
| | | return admin; |
| | | } |
| | | |
| | | public void setAdmin(boolean admin) { |
| | | this.admin = admin; |
| | | } |
| | | |
| | | public boolean isSuperAdmin() { |
| | | return superAdmin; |
| | | } |
| | | |
| | | public void setSuperAdmin(boolean superAdmin) { |
| | | this.superAdmin = superAdmin; |
| | | } |
| | | |
| | | public boolean isMegaAdmin() { |
| | | return megaAdmin; |
| | | } |
| | | |
| | | public void setMegaAdmin(boolean megaAdmin) { |
| | | this.megaAdmin = megaAdmin; |
| | | } |
| | | |
| | | public void setUtilisateurSuppression(String utilisateurSuppression) { |
| | | this.utilisateurSuppression = utilisateurSuppression; |
| | | } |
| | | |
| | | public EtatOperation getEtatOperation() { |
| | | return etatOperation; |
| | | } |
| | | |
| | | public void setEtatOperation(EtatOperation etatOperation) { |
| | | this.etatOperation = etatOperation; |
| | | } |
| | | |
| | | public List<User> getUsers() { |
| | | return users; |
| | | } |
| | | |
| | | public void setUsers(List<User> users) { |
| | | this.users = users; |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | int hash = 7; |
| | | hash = 11 * hash + Objects.hashCode(this.id); |
| | | return hash; |
| | | } |
| | | |
| | | @Override |
| | | public boolean equals(Object obj) { |
| | | if (this == obj) { |
| | | return true; |
| | | } |
| | | if (obj == null) { |
| | | return false; |
| | | } |
| | | if (getClass() != obj.getClass()) { |
| | | return false; |
| | | } |
| | | final Role other = (Role) obj; |
| | | if (!Objects.equals(this.id, other.id)) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /* |
| | | * (non-Javadoc) |
| | | * @see java.lang.Comparable#compareTo(java.lang.Object) |
| | | */ |
| | | @Override |
| | | public int compareTo(Role parameter) { |
| | | if (parameter == null) { |
| | | return -1; |
| | | } |
| | | if (parameter.libelle == null || parameter.libelle.trim().length() == 0) { |
| | | return -1; |
| | | } |
| | | if (libelle == null || libelle.trim().length() == 0) { |
| | | return 1; |
| | | } |
| | | return libelle.compareTo(parameter.libelle); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.model.administration; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.enums.StatutTokenGeneration; |
| | | import com.megatim.fdxcommons.model.enumeration.TypeOperation; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Objects; |
| | | import javax.persistence.Column; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.EnumType; |
| | | import javax.persistence.Enumerated; |
| | | import javax.persistence.GeneratedValue; |
| | | import javax.persistence.GenerationType; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.JoinColumn; |
| | | import javax.persistence.ManyToOne; |
| | | import javax.persistence.SequenceGenerator; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @Entity |
| | | public class TokenGeneration implements Serializable { |
| | | |
| | | @SequenceGenerator(name = "SEQ_USER", |
| | | sequenceName = "SEQ_USER", |
| | | allocationSize = 1, |
| | | initialValue = 1) |
| | | @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_USER") |
| | | @Column(name = "ID") |
| | | @Id |
| | | private Long id; |
| | | |
| | | @Column(name = "ID_GENERER") |
| | | protected String idGenerer; |
| | | |
| | | @Column(name = "TYPE_OPERATION") |
| | | private TypeOperation typeOperation = TypeOperation.AJOUTER; |
| | | |
| | | @ManyToOne |
| | | @JoinColumn |
| | | private User user; |
| | | |
| | | @Column(name = "TOKEN") |
| | | private String token; |
| | | |
| | | @Column(name = "VALIDITE") |
| | | private int validite; |
| | | |
| | | @Column |
| | | private LocalDateTime dateGeneration; |
| | | |
| | | @Column |
| | | @Enumerated(EnumType.STRING) |
| | | private StatutTokenGeneration statutTokenGeneration; |
| | | |
| | | @Override |
| | | public boolean equals(Object obj) { |
| | | if (this == obj) { |
| | | return true; |
| | | } |
| | | if (obj == null) { |
| | | return false; |
| | | } |
| | | if (getClass() != obj.getClass()) { |
| | | return false; |
| | | } |
| | | final TokenGeneration other = (TokenGeneration) obj; |
| | | return Objects.equals(this.id, other.id); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.model.administration; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.EtatOperation; |
| | | import com.megatim.fdxcommons.model.enumeration.TypeOperation; |
| | | import com.megatim.fdxcommons.model.referentiel.Participant; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.Objects; |
| | | import javax.persistence.Column; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.EnumType; |
| | | import javax.persistence.Enumerated; |
| | | import javax.persistence.GeneratedValue; |
| | | import javax.persistence.GenerationType; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.JoinColumn; |
| | | import javax.persistence.ManyToOne; |
| | | import javax.persistence.SequenceGenerator; |
| | | import javax.persistence.Table; |
| | | import javax.persistence.Temporal; |
| | | import javax.persistence.TemporalType; |
| | | import javax.persistence.Transient; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author DYNABOOK |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @Entity(name = "User") |
| | | @Table(name = "FDX_USER") |
| | | public class User implements Comparable<User>, Serializable { |
| | | |
| | | public User() { |
| | | } |
| | | |
| | | @SequenceGenerator(name = "SEQ_USER", |
| | | sequenceName = "SEQ_USER", |
| | | allocationSize = 1, |
| | | initialValue = 1) |
| | | @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_USER") |
| | | @Column(name = "ID") |
| | | @Id |
| | | private Long id; |
| | | |
| | | @Column(name = "ID_GENERER") |
| | | protected String idGenerer; |
| | | |
| | | @Column(name = "TYPE_OPERATION") |
| | | private TypeOperation typeOperation = TypeOperation.AJOUTER; |
| | | |
| | | @Column(name = "username") |
| | | private String userName; |
| | | |
| | | @Column(name = "firstname") |
| | | private String firstName; |
| | | |
| | | @Column(name = "lastname") |
| | | private String lastName; |
| | | |
| | | @Column(name = "MOTIF_REJET") |
| | | private String motifRejet; |
| | | |
| | | @Column(name = "expirationdelay") |
| | | private int expirationDelay; |
| | | |
| | | @Column(name = "alertdelay") |
| | | private int alertDelay; |
| | | |
| | | @Column(name = "attempsnumber") |
| | | private int attempsNumber; |
| | | |
| | | @Column(name = "attemps") |
| | | private int attemps; |
| | | |
| | | @Column(name = "locked") |
| | | private boolean locked; |
| | | |
| | | @Column(name = "active") |
| | | private boolean active; |
| | | |
| | | @Column(name = "editpassword") |
| | | private boolean editPassword; |
| | | |
| | | @Column(name = "connected") |
| | | private boolean connected; |
| | | |
| | | @Transient |
| | | private boolean updatePassword; |
| | | |
| | | @Column(name = "lastconnexiondatetime") |
| | | @Temporal(TemporalType.TIMESTAMP) |
| | | private Date lastConnexionDateTime; |
| | | |
| | | @Column(name = "pwd") |
| | | private String pwd; |
| | | |
| | | @Transient |
| | | private String pwdConfirm; |
| | | |
| | | @Column(name = "ETAT_OPERATION") |
| | | @Enumerated(EnumType.STRING) |
| | | private EtatOperation etatOperation = EtatOperation.ATTENTE_VALIDATION; |
| | | |
| | | @Column(name = "DATE_CREATION") |
| | | @Temporal(TemporalType.TIMESTAMP) |
| | | private Date dateCreation; |
| | | |
| | | @Column(name = "USER_CREATION") |
| | | private String utilisateurCreation; |
| | | |
| | | @Column(name = "DATE_DERN_MOD") |
| | | @Temporal(TemporalType.TIMESTAMP) |
| | | private Date dateDerniereModification; |
| | | |
| | | @Column(name = "USER_UPDATE") |
| | | private String utilisateurModification; |
| | | |
| | | @Column(name = "DATE_SUPPR") |
| | | @Temporal(TemporalType.TIMESTAMP) |
| | | private Date dateSuppression; |
| | | |
| | | @Column(name = "USER_DELETE") |
| | | private String utilisateurSuppression; |
| | | |
| | | @ManyToOne |
| | | @JoinColumn(name = "ROLE") |
| | | private Role role; |
| | | |
| | | @ManyToOne |
| | | @JoinColumn(name = "participant_code") |
| | | private Participant participant; |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | int hash = 7; |
| | | hash = 79 * hash + Objects.hashCode(this.userName); |
| | | return hash; |
| | | } |
| | | |
| | | @Override |
| | | public boolean equals(Object obj) { |
| | | if (this == obj) { |
| | | return true; |
| | | } |
| | | if (obj == null) { |
| | | return false; |
| | | } |
| | | if (getClass() != obj.getClass()) { |
| | | return false; |
| | | } |
| | | final User other = (User) obj; |
| | | return Objects.equals(this.userName, other.userName); |
| | | } |
| | | |
| | | /* |
| | | * (non-Javadoc) |
| | | * @see java.lang.Comparable#compareTo(java.lang.Object) |
| | | */ |
| | | @Override |
| | | public int compareTo(User parameter) { |
| | | if (parameter == null) { |
| | | return -1; |
| | | } |
| | | |
| | | // Si le code du parametre est vide |
| | | if (parameter.userName == null || parameter.userName.trim().length() == 0) { |
| | | return -1; |
| | | } |
| | | |
| | | // Si le code du parametre en cours est vide |
| | | if (userName == null || userName.trim().length() == 0) { |
| | | return 1; |
| | | } |
| | | |
| | | // On retourne la comparaison des codes |
| | | return userName.compareTo(parameter.userName); |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | |
| | | //Variables |
| | | String variable = ""; |
| | | |
| | | if (this.lastName != null) { |
| | | variable = variable + this.lastName; |
| | | } |
| | | |
| | | if (this.firstName != null) { |
| | | variable = variable + " " + this.firstName; |
| | | } |
| | | |
| | | if (this.userName != null) { |
| | | variable = variable + " (" + this.userName + ")"; |
| | | } |
| | | |
| | | return variable; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.model.administration.enums; |
| | | |
| | | public enum StatutTokenGeneration { |
| | | EN_COURS("EN COURS"), |
| | | ARCHIVE("ARCHIVE"); |
| | | |
| | | private final String statut; |
| | | |
| | | private StatutTokenGeneration(String statut) { |
| | | this.statut = statut; |
| | | } |
| | | |
| | | public String getStatut() { |
| | | return statut; |
| | | } |
| | | |
| | | public static StatutTokenGeneration fromValeur(String value) { |
| | | switch (value) { |
| | | case "EN COURS": |
| | | return StatutTokenGeneration.EN_COURS; |
| | | case "ARCHIVE": |
| | | return StatutTokenGeneration.ARCHIVE; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.administration.security; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.Action; |
| | | import com.mgt.rs.security.core.ifaces.ActionRsSecurity; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class ActionSecurity implements ActionRsSecurity { |
| | | |
| | | private final Action action; |
| | | |
| | | public ActionSecurity(Action action) { |
| | | this.action = action; |
| | | } |
| | | |
| | | @Override |
| | | public String getModule() { |
| | | return action.getModule(); |
| | | } |
| | | |
| | | @Override |
| | | public String getPath() { |
| | | return action.getPath(); |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return action.getName(); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.model.administration.security; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.Role; |
| | | import com.mgt.rs.security.core.ifaces.ActionRsSecurity; |
| | | import com.mgt.rs.security.core.ifaces.RoleRsSecurity; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * |
| | | * @author DYNABOOK |
| | | */ |
| | | public class RoleSecurity implements RoleRsSecurity { |
| | | |
| | | private Role role; |
| | | |
| | | public RoleSecurity() { |
| | | } |
| | | |
| | | public RoleSecurity(Role role) { |
| | | this.role = role; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isAdmin() { |
| | | return role.isAdmin(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isSuperAdmin() { |
| | | return role.isSuperAdmin(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isMegaAdmin() { |
| | | return role.isMegaAdmin(); |
| | | } |
| | | |
| | | @Override |
| | | public List<ActionRsSecurity> getActions() { |
| | | return role |
| | | .getActions() |
| | | .stream() |
| | | .map(a -> new ActionSecurity(a)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.administration.security; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.mgt.rs.security.core.ifaces.RoleRsSecurity; |
| | | import com.mgt.rs.security.core.ifaces.UserRsSecurity; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class UserSecurity implements UserRsSecurity { |
| | | |
| | | private String userName; |
| | | private RoleSecurity roleSecurity; |
| | | |
| | | public UserSecurity(User user) { |
| | | this.userName = user.getUserName(); |
| | | if (user.getRole() != null) { |
| | | roleSecurity = new RoleSecurity(user.getRole()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | @Override |
| | | public RoleRsSecurity getRole() { |
| | | return roleSecurity; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.model.audit; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import javax.persistence.Column; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.GeneratedValue; |
| | | import javax.persistence.GenerationType; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.SequenceGenerator; |
| | | import javax.persistence.Table; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Entity |
| | | @Table(name = "audit_actions_participant") |
| | | @Getter |
| | | @Setter |
| | | public class AuditActionsParticipant implements Serializable { |
| | | |
| | | @SequenceGenerator(name = "SEQ_AUDIT_ACTIONS_PARTICIPANT", |
| | | sequenceName = "SEQ_AUDIT_ACTIONS_PARTICIPANT", |
| | | allocationSize = 1, |
| | | initialValue = 1) |
| | | @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_AUDIT_ACTIONS_PARTICIPANT") |
| | | @Id |
| | | private Long id; |
| | | |
| | | @Column(name = "participant_demandeur") |
| | | @NotEmpty(message = "Le participant qui effectue l'action est obligatoire") |
| | | private String participantDemandeur; |
| | | |
| | | @Column(name = "type_fichier_consulte") |
| | | @NotEmpty(message = "Le type ficier est consulté est obligatoire") |
| | | private String typeFichierConsulte; |
| | | |
| | | @Column(name = "last_index_read") |
| | | private int lastIndexRead; |
| | | |
| | | @Column(name = "date_action") |
| | | private LocalDateTime dateAction;//date consultation, modification, ou ajout |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.audit; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import javax.persistence.Column; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.GeneratedValue; |
| | | import javax.persistence.GenerationType; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.SequenceGenerator; |
| | | import javax.persistence.Table; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Entity |
| | | @Table(name = "audit_exportations") |
| | | @Getter |
| | | @Setter |
| | | public class AuditExportations implements Serializable { |
| | | |
| | | @SequenceGenerator(name = "SEQ_AUDIT_EXPORTATIONS", |
| | | sequenceName = "SEQ_AUDIT_EXPORTATIONS", |
| | | allocationSize = 1, |
| | | initialValue = 1) |
| | | @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_AUDIT_EXPORTATIONS") |
| | | @Id |
| | | private Long id; |
| | | |
| | | @Column(name = "date_export") |
| | | @NotNull(message = "La date de l'exportation est obligatoire") |
| | | private LocalDateTime dateExport; |
| | | |
| | | @Column(name = "code_type_fichier") |
| | | @NotEmpty(message = "Le code du type de fichier est obligatoire") |
| | | private String typeFichierExporte; |
| | | |
| | | @Column(name = "last_index_read") |
| | | @NotNull(message = "Le dernier index lu est obligatoire") |
| | | private int lastIndexRead; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Enum.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.camel.historique; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public enum ConsumedFileType { |
| | | REFERENTIEL, DONNEES; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.camel.historique; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import javax.persistence.Column; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.GeneratedValue; |
| | | import javax.persistence.GenerationType; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.SequenceGenerator; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Entity |
| | | @Getter |
| | | @Setter |
| | | public class ConsumedFilesHistory implements Serializable { |
| | | |
| | | @SequenceGenerator(name = "SEQ_CONSUMED_FILES_HISTORY", |
| | | sequenceName = "SEQ_CONSUMED_FILES_HISTORY", |
| | | allocationSize = 1, |
| | | initialValue = 1) |
| | | @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_CONSUMED_FILES_HISTORY") |
| | | @Column(name = "ID") |
| | | @Id |
| | | private Long id; |
| | | |
| | | @NotEmpty(message = "Le nom du fichier consommé est obligatoire") |
| | | private String fileName; |
| | | |
| | | @NotNull(message = "La date de création est obligatoire") |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @NotNull(message = "Le type de données est obligatoire") |
| | | private ConsumedFileType consumedFileType; |
| | | |
| | | private boolean deletedInFolder; |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.model.dtos; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class EditPasswordDto { |
| | | |
| | | @NotBlank(message = "Le mot de passe actuel est obligatoire") |
| | | private String actualPassword; |
| | | |
| | | @NotBlank(message = "Le nouveau mot de passe est obligatoire") |
| | | private String newPassword; |
| | | |
| | | @NotBlank(message = "La confirmation du nouveau mot de passe est obligatoire") |
| | | private String newPasswordConfirm; |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.model.dtos; |
| | | |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | @Data |
| | | public class TokenAuthentificationRequest { |
| | | |
| | | @NotBlank(message = "Le nom utilisateur est obligatoire") |
| | | private String codeParticipant; |
| | | |
| | | @NotBlank(message = "Le mot de passe est obligatoire") |
| | | private String password; |
| | | |
| | | @NotNull(message = "La validité du token est obligatire") |
| | | @Min(value = 1, message = "La validité doit être supérieure ou égale à 1") |
| | | private int validite; |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * To change this license header, choose License Headers in Project Properties. |
| | | * To change this template file, choose Tools | Templates |
| | | * and open the template in the editor. |
| | | */ |
| | | package com.megatim.apifdxweb.model.dtos.administration; |
| | | |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.TypeOperation; |
| | | |
| | | /** |
| | | * |
| | | * @author bissey |
| | | */ |
| | | public class ActionDto { |
| | | |
| | | private Long id; |
| | | |
| | | private String path; |
| | | |
| | | private String module; |
| | | |
| | | private String name; |
| | | |
| | | private String categorie; |
| | | |
| | | private String description; |
| | | |
| | | private Boolean autorise; |
| | | |
| | | protected String idGenerer; |
| | | |
| | | private TypeOperation typeOperation; |
| | | |
| | | public ActionDto() { |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getPath() { |
| | | return path; |
| | | } |
| | | |
| | | public void setPath(String path) { |
| | | this.path = path; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getIdGenerer() { |
| | | return idGenerer; |
| | | } |
| | | |
| | | public void setIdGenerer(String idGenerer) { |
| | | this.idGenerer = idGenerer; |
| | | } |
| | | |
| | | public TypeOperation getTypeOperation() { |
| | | return typeOperation; |
| | | } |
| | | |
| | | public void setTypeOperation(TypeOperation typeOperation) { |
| | | this.typeOperation = typeOperation; |
| | | } |
| | | |
| | | public Boolean getAutorise() { |
| | | return autorise; |
| | | } |
| | | |
| | | public void setAutorise(Boolean autorise) { |
| | | this.autorise = autorise; |
| | | } |
| | | |
| | | public String getModule() { |
| | | return module; |
| | | } |
| | | |
| | | public void setModule(String module) { |
| | | this.module = module; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | public void setDescription(String description) { |
| | | this.description = description; |
| | | } |
| | | |
| | | public String getCategorie() { |
| | | return categorie; |
| | | } |
| | | |
| | | public void setCategorie(String categorie) { |
| | | this.categorie = categorie; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * To change this license header, choose License Headers in Project Properties. |
| | | * To change this template file, choose Tools | Templates |
| | | * and open the template in the editor. |
| | | */ |
| | | package com.megatim.apifdxweb.model.dtos.administration; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.TypeOperation; |
| | | |
| | | /** |
| | | * |
| | | * @author bissey |
| | | */ |
| | | public class ActionSlimDto { |
| | | |
| | | private Long id; |
| | | |
| | | private String path; |
| | | |
| | | private String module; |
| | | |
| | | private String name; |
| | | |
| | | private String categorie; |
| | | |
| | | private String description; |
| | | |
| | | private Boolean autorise; |
| | | |
| | | protected String idGenerer; |
| | | |
| | | private TypeOperation typeOperation; |
| | | |
| | | public ActionSlimDto() { |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getPath() { |
| | | return path; |
| | | } |
| | | |
| | | public void setPath(String path) { |
| | | this.path = path; |
| | | } |
| | | |
| | | public String getModule() { |
| | | return module; |
| | | } |
| | | |
| | | public void setModule(String module) { |
| | | this.module = module; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getCategorie() { |
| | | return categorie; |
| | | } |
| | | |
| | | public void setCategorie(String categorie) { |
| | | this.categorie = categorie; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | public void setDescription(String description) { |
| | | this.description = description; |
| | | } |
| | | |
| | | public Boolean getAutorise() { |
| | | return autorise; |
| | | } |
| | | |
| | | public void setAutorise(Boolean autorise) { |
| | | this.autorise = autorise; |
| | | } |
| | | |
| | | public String getIdGenerer() { |
| | | return idGenerer; |
| | | } |
| | | |
| | | public void setIdGenerer(String idGenerer) { |
| | | this.idGenerer = idGenerer; |
| | | } |
| | | |
| | | public TypeOperation getTypeOperation() { |
| | | return typeOperation; |
| | | } |
| | | |
| | | public void setTypeOperation(TypeOperation typeOperation) { |
| | | this.typeOperation = typeOperation; |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * To change this license header, choose License Headers in Project Properties. |
| | | * To change this template file, choose Tools | Templates |
| | | * and open the template in the editor. |
| | | */ |
| | | package com.megatim.apifdxweb.model.dtos.administration; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.Gravite; |
| | | import com.megatim.fdxcommons.model.enumeration.TypeOperation; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * |
| | | * @author bissey |
| | | */ |
| | | public class JournalActionUtilisateurDto { |
| | | |
| | | private Long id; |
| | | |
| | | protected String idGenerer; |
| | | |
| | | private TypeOperation typeOperation; |
| | | |
| | | private String utilisateur; |
| | | |
| | | private String description; |
| | | |
| | | private Gravite gravite; |
| | | |
| | | private Date dateCreation; |
| | | |
| | | private String utilisateurCreation; |
| | | |
| | | private Date dateDerniereModification; |
| | | |
| | | private String utilisateurModification; |
| | | |
| | | private Date dateSuppression; |
| | | |
| | | private String utilisateurSuppression; |
| | | |
| | | public JournalActionUtilisateurDto() { |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getIdGenerer() { |
| | | return idGenerer; |
| | | } |
| | | |
| | | public void setIdGenerer(String idGenerer) { |
| | | this.idGenerer = idGenerer; |
| | | } |
| | | |
| | | public TypeOperation getTypeOperation() { |
| | | return typeOperation; |
| | | } |
| | | |
| | | public void setTypeOperation(TypeOperation typeOperation) { |
| | | this.typeOperation = typeOperation; |
| | | } |
| | | |
| | | public String getUtilisateur() { |
| | | return utilisateur; |
| | | } |
| | | |
| | | public void setUtilisateur(String utilisateur) { |
| | | this.utilisateur = utilisateur; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | public void setDescription(String description) { |
| | | this.description = description; |
| | | } |
| | | |
| | | public Gravite getGravite() { |
| | | return gravite; |
| | | } |
| | | |
| | | public void setGravite(Gravite gravite) { |
| | | this.gravite = gravite; |
| | | } |
| | | |
| | | public Date getDateCreation() { |
| | | return dateCreation; |
| | | } |
| | | |
| | | public void setDateCreation(Date dateCreation) { |
| | | this.dateCreation = dateCreation; |
| | | } |
| | | |
| | | public String getUtilisateurCreation() { |
| | | return utilisateurCreation; |
| | | } |
| | | |
| | | public void setUtilisateurCreation(String utilisateurCreation) { |
| | | this.utilisateurCreation = utilisateurCreation; |
| | | } |
| | | |
| | | public Date getDateDerniereModification() { |
| | | return dateDerniereModification; |
| | | } |
| | | |
| | | public void setDateDerniereModification(Date dateDerniereModification) { |
| | | this.dateDerniereModification = dateDerniereModification; |
| | | } |
| | | |
| | | public String getUtilisateurModification() { |
| | | return utilisateurModification; |
| | | } |
| | | |
| | | public void setUtilisateurModification(String utilisateurModification) { |
| | | this.utilisateurModification = utilisateurModification; |
| | | } |
| | | |
| | | public Date getDateSuppression() { |
| | | return dateSuppression; |
| | | } |
| | | |
| | | public void setDateSuppression(Date dateSuppression) { |
| | | this.dateSuppression = dateSuppression; |
| | | } |
| | | |
| | | public String getUtilisateurSuppression() { |
| | | return utilisateurSuppression; |
| | | } |
| | | |
| | | public void setUtilisateurSuppression(String utilisateurSuppression) { |
| | | this.utilisateurSuppression = utilisateurSuppression; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * To change this license header, choose License Headers in Project Properties. |
| | | * To change this template file, choose Tools | Templates |
| | | * and open the template in the editor. |
| | | */ |
| | | package com.megatim.apifdxweb.model.dtos.administration; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.Gravite; |
| | | import com.megatim.fdxcommons.model.enumeration.TypeOperation; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * |
| | | * @author bissey |
| | | */ |
| | | public class JournalConnexionUtilisateurDto { |
| | | |
| | | private Long id; |
| | | |
| | | protected String idGenerer; |
| | | |
| | | private TypeOperation typeOperation; |
| | | |
| | | private String utilisateur; |
| | | |
| | | private String description; |
| | | |
| | | private Gravite gravite; |
| | | |
| | | private Date dateCreation; |
| | | |
| | | private String utilisateurCreation; |
| | | |
| | | private Date dateDerniereModification; |
| | | |
| | | private String utilisateurModification; |
| | | |
| | | private Date dateSuppression; |
| | | |
| | | private String utilisateurSuppression; |
| | | |
| | | public JournalConnexionUtilisateurDto() { |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getIdGenerer() { |
| | | return idGenerer; |
| | | } |
| | | |
| | | public void setIdGenerer(String idGenerer) { |
| | | this.idGenerer = idGenerer; |
| | | } |
| | | |
| | | public TypeOperation getTypeOperation() { |
| | | return typeOperation; |
| | | } |
| | | |
| | | public void setTypeOperation(TypeOperation typeOperation) { |
| | | this.typeOperation = typeOperation; |
| | | } |
| | | |
| | | public String getUtilisateur() { |
| | | return utilisateur; |
| | | } |
| | | |
| | | public void setUtilisateur(String utilisateur) { |
| | | this.utilisateur = utilisateur; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | public void setDescription(String description) { |
| | | this.description = description; |
| | | } |
| | | |
| | | public Gravite getGravite() { |
| | | return gravite; |
| | | } |
| | | |
| | | public void setGravite(Gravite gravite) { |
| | | this.gravite = gravite; |
| | | } |
| | | |
| | | public Date getDateCreation() { |
| | | return dateCreation; |
| | | } |
| | | |
| | | public void setDateCreation(Date dateCreation) { |
| | | this.dateCreation = dateCreation; |
| | | } |
| | | |
| | | public String getUtilisateurCreation() { |
| | | return utilisateurCreation; |
| | | } |
| | | |
| | | public void setUtilisateurCreation(String utilisateurCreation) { |
| | | this.utilisateurCreation = utilisateurCreation; |
| | | } |
| | | |
| | | public Date getDateDerniereModification() { |
| | | return dateDerniereModification; |
| | | } |
| | | |
| | | public void setDateDerniereModification(Date dateDerniereModification) { |
| | | this.dateDerniereModification = dateDerniereModification; |
| | | } |
| | | |
| | | public String getUtilisateurModification() { |
| | | return utilisateurModification; |
| | | } |
| | | |
| | | public void setUtilisateurModification(String utilisateurModification) { |
| | | this.utilisateurModification = utilisateurModification; |
| | | } |
| | | |
| | | public Date getDateSuppression() { |
| | | return dateSuppression; |
| | | } |
| | | |
| | | public void setDateSuppression(Date dateSuppression) { |
| | | this.dateSuppression = dateSuppression; |
| | | } |
| | | |
| | | public String getUtilisateurSuppression() { |
| | | return utilisateurSuppression; |
| | | } |
| | | |
| | | public void setUtilisateurSuppression(String utilisateurSuppression) { |
| | | this.utilisateurSuppression = utilisateurSuppression; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * To change this license header, choose License Headers in Project Properties. |
| | | * To change this template file, choose Tools | Templates |
| | | * and open the template in the editor. |
| | | */ |
| | | package com.megatim.apifdxweb.model.dtos.administration; |
| | | |
| | | |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.EtatOperation; |
| | | import com.megatim.fdxcommons.model.enumeration.TypeOperation; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author bissey |
| | | */ |
| | | |
| | | public class RoleDto { |
| | | |
| | | private Long id; |
| | | |
| | | protected String idGenerer; |
| | | |
| | | private String libelle; |
| | | |
| | | private String description; |
| | | |
| | | private boolean admin; |
| | | |
| | | private boolean superAdmin; |
| | | |
| | | private boolean megaAdmin; |
| | | |
| | | private TypeOperation typeOperation; |
| | | |
| | | private EtatOperation etatOperation; |
| | | |
| | | private List<ActionDto> actions; |
| | | |
| | | private Date dateCreation; |
| | | |
| | | private String utilisateurCreation; |
| | | |
| | | private Date dateDerniereModification; |
| | | |
| | | private String utilisateurModification; |
| | | |
| | | private Date dateSuppression; |
| | | |
| | | private String utilisateurSuppression; |
| | | |
| | | public RoleDto() { |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getLibelle() { |
| | | return libelle; |
| | | } |
| | | |
| | | public void setLibelle(String libelle) { |
| | | this.libelle = libelle; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | public void setDescription(String description) { |
| | | this.description = description; |
| | | } |
| | | |
| | | public TypeOperation getTypeOperation() { |
| | | return typeOperation; |
| | | } |
| | | |
| | | public void setTypeOperation(TypeOperation typeOperation) { |
| | | this.typeOperation = typeOperation; |
| | | } |
| | | |
| | | public String getIdGenerer() { |
| | | return idGenerer; |
| | | } |
| | | |
| | | public void setIdGenerer(String idGenerer) { |
| | | this.idGenerer = idGenerer; |
| | | } |
| | | |
| | | public List<ActionDto> getActions() { |
| | | return actions; |
| | | } |
| | | |
| | | public void setActions(List<ActionDto> actions) { |
| | | this.actions = actions; |
| | | } |
| | | |
| | | public Date getDateCreation() { |
| | | return dateCreation; |
| | | } |
| | | |
| | | public void setDateCreation(Date dateCreation) { |
| | | this.dateCreation = dateCreation; |
| | | } |
| | | |
| | | public String getUtilisateurCreation() { |
| | | return utilisateurCreation; |
| | | } |
| | | |
| | | public void setUtilisateurCreation(String utilisateurCreation) { |
| | | this.utilisateurCreation = utilisateurCreation; |
| | | } |
| | | |
| | | public Date getDateDerniereModification() { |
| | | return dateDerniereModification; |
| | | } |
| | | |
| | | public void setDateDerniereModification(Date dateDerniereModification) { |
| | | this.dateDerniereModification = dateDerniereModification; |
| | | } |
| | | |
| | | public String getUtilisateurModification() { |
| | | return utilisateurModification; |
| | | } |
| | | |
| | | public void setUtilisateurModification(String utilisateurModification) { |
| | | this.utilisateurModification = utilisateurModification; |
| | | } |
| | | |
| | | public Date getDateSuppression() { |
| | | return dateSuppression; |
| | | } |
| | | |
| | | public void setDateSuppression(Date dateSuppression) { |
| | | this.dateSuppression = dateSuppression; |
| | | } |
| | | |
| | | public String getUtilisateurSuppression() { |
| | | return utilisateurSuppression; |
| | | } |
| | | |
| | | public void setUtilisateurSuppression(String utilisateurSuppression) { |
| | | this.utilisateurSuppression = utilisateurSuppression; |
| | | } |
| | | |
| | | public EtatOperation getEtatOperation() { |
| | | return etatOperation; |
| | | } |
| | | |
| | | public void setEtatOperation(EtatOperation etatOperation) { |
| | | this.etatOperation = etatOperation; |
| | | } |
| | | |
| | | public boolean isAdmin() { |
| | | return admin; |
| | | } |
| | | |
| | | public void setAdmin(boolean admin) { |
| | | this.admin = admin; |
| | | } |
| | | |
| | | public boolean isSuperAdmin() { |
| | | return superAdmin; |
| | | } |
| | | |
| | | public void setSuperAdmin(boolean superAdmin) { |
| | | this.superAdmin = superAdmin; |
| | | } |
| | | |
| | | public boolean isMegaAdmin() { |
| | | return megaAdmin; |
| | | } |
| | | |
| | | public void setMegaAdmin(boolean megaAdmin) { |
| | | this.megaAdmin = megaAdmin; |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * To change this license header, choose License Headers in Project Properties. |
| | | * To change this template file, choose Tools | Templates |
| | | * and open the template in the editor. |
| | | */ |
| | | package com.megatim.apifdxweb.model.dtos.administration; |
| | | |
| | | /** |
| | | * |
| | | * @author bissey |
| | | */ |
| | | public class RoleSlimDto { |
| | | |
| | | private Long id; |
| | | |
| | | private String libelle; |
| | | |
| | | private String description; |
| | | |
| | | private boolean admin; |
| | | |
| | | private boolean superAdmin; |
| | | |
| | | private boolean megaAdmin; |
| | | |
| | | public RoleSlimDto() { |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getLibelle() { |
| | | return libelle; |
| | | } |
| | | |
| | | public void setLibelle(String libelle) { |
| | | this.libelle = libelle; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | public void setDescription(String description) { |
| | | this.description = description; |
| | | } |
| | | |
| | | public boolean isAdmin() { |
| | | return admin; |
| | | } |
| | | |
| | | public void setAdmin(boolean admin) { |
| | | this.admin = admin; |
| | | } |
| | | |
| | | public boolean isSuperAdmin() { |
| | | return superAdmin; |
| | | } |
| | | |
| | | public void setSuperAdmin(boolean superAdmin) { |
| | | this.superAdmin = superAdmin; |
| | | } |
| | | |
| | | public boolean isMegaAdmin() { |
| | | return megaAdmin; |
| | | } |
| | | |
| | | public void setMegaAdmin(boolean megaAdmin) { |
| | | this.megaAdmin = megaAdmin; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * To change this license header, choose License Headers in Project Properties. |
| | | * To change this template file, choose Tools | Templates |
| | | * and open the template in the editor. |
| | | */ |
| | | package com.megatim.apifdxweb.model.dtos.administration; |
| | | |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.EtatOperation; |
| | | import com.megatim.fdxcommons.model.enumeration.TypeOperation; |
| | | import java.util.Date; |
| | | /** |
| | | * |
| | | * @author bissey |
| | | */ |
| | | |
| | | public class UserDto { |
| | | |
| | | private Long id; |
| | | |
| | | protected String idGenerer; |
| | | |
| | | private TypeOperation typeOperation; |
| | | |
| | | private String userName; |
| | | |
| | | private String firstName; |
| | | |
| | | private String lastName; |
| | | |
| | | private int expirationDelay; |
| | | |
| | | private int alertDelay; |
| | | |
| | | private int attempsNumber; |
| | | |
| | | private int attemps; |
| | | |
| | | private boolean locked; |
| | | |
| | | private boolean active; |
| | | |
| | | private boolean connected; |
| | | |
| | | private Date lastConnexionDateTime; |
| | | |
| | | private EtatOperation etatOperation; |
| | | |
| | | private Date dateCreation; |
| | | |
| | | private String utilisateurCreation; |
| | | |
| | | private Date dateDerniereModification; |
| | | |
| | | private String utilisateurModification; |
| | | |
| | | private Date dateSuppression; |
| | | |
| | | private String utilisateurSuppression; |
| | | |
| | | private boolean admin ; |
| | | |
| | | private boolean superAdmin ; |
| | | |
| | | private boolean megaAdmin ; |
| | | |
| | | private RoleDto role; |
| | | |
| | | public UserDto() { |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getIdGenerer() { |
| | | return idGenerer; |
| | | } |
| | | |
| | | public void setIdGenerer(String idGenerer) { |
| | | this.idGenerer = idGenerer; |
| | | } |
| | | |
| | | public TypeOperation getTypeOperation() { |
| | | return typeOperation; |
| | | } |
| | | |
| | | public void setTypeOperation(TypeOperation typeOperation) { |
| | | this.typeOperation = typeOperation; |
| | | } |
| | | |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | public String getFirstName() { |
| | | return firstName; |
| | | } |
| | | |
| | | public void setFirstName(String firstName) { |
| | | this.firstName = firstName; |
| | | } |
| | | |
| | | public String getLastName() { |
| | | return lastName; |
| | | } |
| | | |
| | | public void setLastName(String lastName) { |
| | | this.lastName = lastName; |
| | | } |
| | | |
| | | public int getExpirationDelay() { |
| | | return expirationDelay; |
| | | } |
| | | |
| | | public void setExpirationDelay(int expirationDelay) { |
| | | this.expirationDelay = expirationDelay; |
| | | } |
| | | |
| | | public int getAlertDelay() { |
| | | return alertDelay; |
| | | } |
| | | |
| | | public void setAlertDelay(int alertDelay) { |
| | | this.alertDelay = alertDelay; |
| | | } |
| | | |
| | | public int getAttempsNumber() { |
| | | return attempsNumber; |
| | | } |
| | | |
| | | public void setAttempsNumber(int attempsNumber) { |
| | | this.attempsNumber = attempsNumber; |
| | | } |
| | | |
| | | public int getAttemps() { |
| | | return attemps; |
| | | } |
| | | |
| | | public void setAttemps(int attemps) { |
| | | this.attemps = attemps; |
| | | } |
| | | |
| | | public boolean isLocked() { |
| | | return locked; |
| | | } |
| | | |
| | | public void setLocked(boolean locked) { |
| | | this.locked = locked; |
| | | } |
| | | |
| | | public boolean isConnected() { |
| | | return connected; |
| | | } |
| | | |
| | | public void setConnected(boolean connected) { |
| | | this.connected = connected; |
| | | } |
| | | |
| | | public Date getLastConnexionDateTime() { |
| | | return lastConnexionDateTime; |
| | | } |
| | | |
| | | public void setLastConnexionDateTime(Date lastConnexionDateTime) { |
| | | this.lastConnexionDateTime = lastConnexionDateTime; |
| | | } |
| | | |
| | | public EtatOperation getEtatOperation() { |
| | | return etatOperation; |
| | | } |
| | | |
| | | public void setEtatOperation(EtatOperation etatOperation) { |
| | | this.etatOperation = etatOperation; |
| | | } |
| | | |
| | | public Date getDateCreation() { |
| | | return dateCreation; |
| | | } |
| | | |
| | | public void setDateCreation(Date dateCreation) { |
| | | this.dateCreation = dateCreation; |
| | | } |
| | | |
| | | public Date getDateDerniereModification() { |
| | | return dateDerniereModification; |
| | | } |
| | | |
| | | public void setDateDerniereModification(Date dateDerniereModification) { |
| | | this.dateDerniereModification = dateDerniereModification; |
| | | } |
| | | |
| | | public Date getDateSuppression() { |
| | | return dateSuppression; |
| | | } |
| | | |
| | | public void setDateSuppression(Date dateSuppression) { |
| | | this.dateSuppression = dateSuppression; |
| | | } |
| | | |
| | | public String getUtilisateurCreation() { |
| | | return utilisateurCreation; |
| | | } |
| | | |
| | | public void setUtilisateurCreation(String utilisateurCreation) { |
| | | this.utilisateurCreation = utilisateurCreation; |
| | | } |
| | | |
| | | public String getUtilisateurModification() { |
| | | return utilisateurModification; |
| | | } |
| | | |
| | | public void setUtilisateurModification(String utilisateurModification) { |
| | | this.utilisateurModification = utilisateurModification; |
| | | } |
| | | |
| | | public String getUtilisateurSuppression() { |
| | | return utilisateurSuppression; |
| | | } |
| | | |
| | | public void setUtilisateurSuppression(String utilisateurSuppression) { |
| | | this.utilisateurSuppression = utilisateurSuppression; |
| | | } |
| | | |
| | | public RoleDto getRole() { |
| | | return role; |
| | | } |
| | | |
| | | public void setRole(RoleDto role) { |
| | | this.role = role; |
| | | } |
| | | |
| | | public boolean isAdmin() { |
| | | return admin; |
| | | } |
| | | |
| | | public void setAdmin(boolean admin) { |
| | | this.admin = admin; |
| | | } |
| | | |
| | | public boolean isSuperAdmin() { |
| | | return superAdmin; |
| | | } |
| | | |
| | | public void setSuperAdmin(boolean superAdmin) { |
| | | this.superAdmin = superAdmin; |
| | | } |
| | | |
| | | public boolean isMegaAdmin() { |
| | | return megaAdmin; |
| | | } |
| | | |
| | | public void setMegaAdmin(boolean meegaAdmin) { |
| | | this.megaAdmin = meegaAdmin; |
| | | } |
| | | |
| | | public boolean isActive() { |
| | | return active; |
| | | } |
| | | |
| | | public void setActive(boolean active) { |
| | | this.active = active; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * To change this license header, choose License Headers in Project Properties. |
| | | * To change this template file, choose Tools | Templates |
| | | * and open the template in the editor. |
| | | */ |
| | | package com.megatim.apifdxweb.model.dtos.administration; |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @author bissey |
| | | */ |
| | | public class UserSlimDto { |
| | | |
| | | private Long id; |
| | | |
| | | private String userName; |
| | | |
| | | private String firstName; |
| | | |
| | | private String lastName; |
| | | |
| | | private boolean connected; |
| | | |
| | | |
| | | |
| | | public UserSlimDto() { |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | public String getFirstName() { |
| | | return firstName; |
| | | } |
| | | |
| | | public void setFirstName(String firstName) { |
| | | this.firstName = firstName; |
| | | } |
| | | |
| | | public String getLastName() { |
| | | return lastName; |
| | | } |
| | | |
| | | public void setLastName(String lastName) { |
| | | this.lastName = lastName; |
| | | } |
| | | |
| | | public boolean isConnected() { |
| | | return connected; |
| | | } |
| | | |
| | | public void setConnected(boolean connected) { |
| | | this.connected = connected; |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.dtos.tmp; |
| | | |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @NoArgsConstructor |
| | | public class DataTmpDto { |
| | | |
| | | @NotEmpty(message = "Le token est obligatoire") |
| | | private String token; |
| | | |
| | | private List<LinkedHashMap<String,Object>> data; |
| | | |
| | | @Min(value = 1, message = "Le numéro de lot doit être supérieur à 0") |
| | | private int batchNumber; |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.model.dtos.tmp; |
| | | |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @NoArgsConstructor |
| | | public class TokenTmpDto { |
| | | |
| | | private String token; |
| | | |
| | | @Min(value = 1, message = "La validité(en minute) doit être supérieure à 0") |
| | | private int validite; |
| | | |
| | | @NotEmpty(message = "Le type de fichier est obligatoire") |
| | | private String codeTypeFichier; |
| | | |
| | | @Min(value = 1, message = "Le nombre de lots doit être supérieure à 0") |
| | | private int nbBatchs; |
| | | |
| | | @Min(value = 1, message = "Le nombre d'éléments par lots doit être supérieur à 0") |
| | | private int nbEltsPerBatch; |
| | | } |
| New file |
| | |
| | | /* |
| | | * To change this license header, choose License Headers in Project Properties. |
| | | * To change this template file, choose Tools | Templates |
| | | * and open the template in the editor. |
| | | */ |
| | | package com.megatim.apifdxweb.model.formodel; |
| | | |
| | | /** |
| | | * |
| | | * @author bissey |
| | | */ |
| | | public class NoeudFormModel { |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * To change this license header, choose License Headers in Project Properties. |
| | | * To change this template file, choose Tools | Templates |
| | | * and open the template in the editor. |
| | | */ |
| | | package com.megatim.apifdxweb.model.formodel; |
| | | |
| | | |
| | | import com.megatim.apifdxweb.model.dtos.administration.ActionSlimDto; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author bissey |
| | | */ |
| | | public class RoleFormModel { |
| | | |
| | | List<ActionSlimDto> actions = new ArrayList<>(); |
| | | |
| | | public List<ActionSlimDto> getActions() { |
| | | return actions; |
| | | } |
| | | |
| | | public void setActions(List<ActionSlimDto> actions) { |
| | | this.actions = actions; |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.jaxb; |
| | | |
| | | import com.megatim.fdxcommons.model.referentiel.ApplicationSource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Setter |
| | | @Getter |
| | | @XmlRootElement(name = "sources") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | public class ApplicationSourcesToExport { |
| | | |
| | | private List<ApplicationSource> applicationSourceList = new ArrayList<>(); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.jaxb; |
| | | |
| | | import com.megatim.fdxcommons.model.referentiel.ExtensionFichier; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @XmlRootElement(name = "ExtensionFichiersToExport") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | @Setter |
| | | @Getter |
| | | public class ExtensionFichiersToExport { |
| | | |
| | | private List<ExtensionFichier> extensionFichiers = new ArrayList<>(); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.jaxb; |
| | | |
| | | import com.megatim.fdxcommons.model.referentiel.GroupeNoeud; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlElement; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @XmlRootElement(name = "GroupeNoeudsToExport") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | @Setter |
| | | @Getter |
| | | public class GroupeNoeudsToExport { |
| | | |
| | | @XmlElement(name = "groupeNoeuds") |
| | | private List<GroupeNoeud> groupeNoeuds = new ArrayList<>(); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.jaxb; |
| | | |
| | | import com.megatim.fdxcommons.model.referentiel.GroupeParticipant; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @XmlRootElement(name = "GroupeParticipantsToExport") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | @Setter |
| | | @Getter |
| | | public class GroupeParticipantsToExport { |
| | | |
| | | private List<GroupeParticipant> groupeParticipants = new ArrayList<>(); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.jaxb; |
| | | |
| | | import com.megatim.fdxcommons.model.referentiel.Noeud; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @XmlRootElement(name = "NoeudsToExport") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | @Setter |
| | | @Getter |
| | | public class NoeudsToExport { |
| | | |
| | | private List<Noeud> noeuds = new ArrayList<>(); |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.jaxb; |
| | | |
| | | import com.megatim.fdxcommons.model.referentiel.Participant; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @XmlRootElement(name = "ParticipantsToExport") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | @Setter |
| | | @Getter |
| | | public class ParticipantsToExport { |
| | | |
| | | private List<Participant> participants = new ArrayList<>(); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.jaxb; |
| | | |
| | | import com.megatim.fdxcommons.model.referentiel.Pays; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @XmlRootElement(name = "PaysToExport") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | public class PaysToExport { |
| | | |
| | | private List<Pays> paysList = new ArrayList<>(); |
| | | |
| | | public List<Pays> getPaysList() { |
| | | return paysList; |
| | | } |
| | | |
| | | public void setPaysList(List<Pays> paysList) { |
| | | this.paysList = paysList; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.jaxb; |
| | | |
| | | import com.megatim.fdxcommons.model.referentiel.Referentiel; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @XmlRootElement(name = "ReferentielsToExport") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | @Setter |
| | | @Getter |
| | | public class ReferentielsToExport { |
| | | |
| | | private List<Referentiel> referentielList = new ArrayList<>(); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.jaxb; |
| | | |
| | | import com.megatim.fdxcommons.model.referentiel.Routage; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @XmlRootElement(name = "RoutagesToExport") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | @Setter |
| | | @Getter |
| | | public class RoutagesToExport { |
| | | |
| | | private List<Routage> routageList = new ArrayList<>(); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.jaxb; |
| | | |
| | | import com.megatim.fdxcommons.model.referentiel.StructureLigne; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @XmlRootElement(name = "StructureLigneToExport") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | @Setter |
| | | @Getter |
| | | public class StructureLigneToExport { |
| | | |
| | | private List<StructureLigne> structureLigneList = new ArrayList<>(); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.jaxb; |
| | | |
| | | import com.megatim.fdxcommons.model.referentiel.TypeFichier; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @XmlRootElement(name = "TypeFichiersToExport") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | @Setter |
| | | @Getter |
| | | public class TypeFichiersToExport { |
| | | |
| | | private List<TypeFichier> typeFichiersList = new ArrayList<>(); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.jaxb; |
| | | |
| | | import com.megatim.fdxcommons.model.referentiel.ValidateurFichierConfiguration; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @XmlRootElement(name = "ValidateurFichierConfigurationList") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | @Setter |
| | | @Getter |
| | | public class ValidateurFichierConfigurationList { |
| | | |
| | | private List<ValidateurFichierConfiguration> validateurFichierConfigurationList = new ArrayList<>(); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.jaxb; |
| | | |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @XmlRootElement(name = "ValidateurFichierConfigurationToExport") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | @Setter |
| | | @Getter |
| | | public class ValidateurFichierConfigurationToExport { |
| | | |
| | | private ValidateurFichierConfigurationList validateurFichierConfigurationList; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.jaxb; |
| | | |
| | | import com.megatim.fdxcommons.model.referentiel.ValidateurFichier; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlElement; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @XmlRootElement(name = "ValidateurFichierToExport") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | @Setter |
| | | @Getter |
| | | public class ValidateurFichierToExport { |
| | | |
| | | @XmlElement(name = "ValidateurFichier") |
| | | private List<ValidateurFichier> validateurFichierList = new ArrayList<>(); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.jaxbentity.adapter; |
| | | |
| | | import java.time.LocalDate; |
| | | import javax.xml.bind.annotation.adapters.XmlAdapter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class LocalDateAdapter extends XmlAdapter<String, LocalDate> { |
| | | |
| | | @Override |
| | | public LocalDate unmarshal(String v) throws Exception { |
| | | return LocalDate.parse(v); |
| | | } |
| | | |
| | | @Override |
| | | public String marshal(LocalDate v) throws Exception { |
| | | return v.toString(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.mappers; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.Action; |
| | | import com.megatim.apifdxweb.model.administration.JournalActionUtilisateur; |
| | | import com.megatim.apifdxweb.model.administration.JournalConnexionUtilisateur; |
| | | import com.megatim.apifdxweb.model.administration.Role; |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.dtos.administration.ActionDto; |
| | | import com.megatim.apifdxweb.model.dtos.administration.ActionSlimDto; |
| | | import com.megatim.apifdxweb.model.dtos.administration.JournalActionUtilisateurDto; |
| | | import com.megatim.apifdxweb.model.dtos.administration.JournalConnexionUtilisateurDto; |
| | | import com.megatim.apifdxweb.model.dtos.administration.RoleDto; |
| | | import com.megatim.apifdxweb.model.dtos.administration.RoleSlimDto; |
| | | import com.megatim.apifdxweb.model.dtos.administration.UserDto; |
| | | import com.megatim.apifdxweb.model.dtos.administration.UserSlimDto; |
| | | import com.megatim.apifdxweb.model.dtos.tmp.TokenTmpDto; |
| | | import com.megatim.apifdxweb.model.tmp.TokenTmp; |
| | | import com.megatim.fdxcommons.tools.database.tables.FdxTableColumnData; |
| | | import com.megatim.fdxcommons.tools.database.tables.FdxTableRow; |
| | | import com.megatim.fdxcommons.tools.database.tables.dto.FdxTableColumnDataDto; |
| | | import com.megatim.fdxcommons.tools.database.tables.dto.FdxTableRowDto; |
| | | import java.util.List; |
| | | import org.mapstruct.InjectionStrategy; |
| | | import org.mapstruct.Mapper; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Mapper(componentModel = "cdi", injectionStrategy = InjectionStrategy.FIELD) |
| | | public interface MapStructMapper { |
| | | |
| | | UserDto userToUserDto(User user); |
| | | |
| | | UserSlimDto userToUserSlimDto(User user); |
| | | |
| | | List<UserSlimDto> userSlimDtos(List<User> users); |
| | | |
| | | RoleDto roleToRoleDto(Role role); |
| | | |
| | | RoleSlimDto roleToRoleSlimDto(Role role); |
| | | |
| | | List<RoleSlimDto> roleSlimDtos(List<Role> roles); |
| | | |
| | | ActionDto actionToActionDto(Action action); |
| | | |
| | | ActionSlimDto actionToaActionSlimDto(Action action); |
| | | |
| | | List<ActionSlimDto> actionSlimDtos(List<Action> actions); |
| | | |
| | | JournalActionUtilisateurDto journalActionUtilisateurToJournalActionUtilisateurDto(JournalActionUtilisateur journalActionUtilisateur); |
| | | |
| | | JournalConnexionUtilisateurDto JournalConnexionUtilisateurToJournalConnexionUtilisateurDto(JournalConnexionUtilisateur journalConnexionUtilisateur); |
| | | |
| | | TokenTmpDto tokenTmpToTokenTmpDto(TokenTmp tokenTmp); |
| | | |
| | | TokenTmp tokenTmpDtoToTokenTmp(TokenTmpDto dto); |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.model.request; |
| | | |
| | | import com.megatim.fdxcommons.model.pojo.CriteriaEntityFromView; |
| | | import java.util.Map; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class UpdateRequest { |
| | | |
| | | private CriteriaEntityFromView criteriaEntityFromView; |
| | | |
| | | private Map<String, Object> dataToUpdate; |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.searchentities; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.EtatIntegration; |
| | | import com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur; |
| | | import com.megatim.fdxcommons.model.search.Search; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter @Setter |
| | | public class ApplicationSourceSearch { |
| | | @Search(fieldName = "libelle", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private String libelle; |
| | | |
| | | @Search(fieldName = "etatIntegration", operateur =SearchAnnotationOperateur.EQUALS) |
| | | private EtatIntegration etatIntegration; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.searchentities; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.EtatIntegration; |
| | | import com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur; |
| | | import com.megatim.fdxcommons.model.search.Search; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter @Setter |
| | | public class ExtensionFichierSearch { |
| | | |
| | | @Search(fieldName = "extension", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private String extension; |
| | | |
| | | @Search(fieldName = "etatIntegration", operateur =SearchAnnotationOperateur.EQUALS) |
| | | private EtatIntegration etatIntegration; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.searchentities; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.EtatIntegration; |
| | | import com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur; |
| | | import com.megatim.fdxcommons.model.search.Search; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter @Setter |
| | | public class GroupeNoeudSearch { |
| | | @Search(fieldName = "code", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private String code; |
| | | |
| | | @Search(fieldName = "etatIntegration", operateur =SearchAnnotationOperateur.EQUALS) |
| | | private EtatIntegration etatIntegration; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.searchentities; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.EtatIntegration; |
| | | import com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur; |
| | | import com.megatim.fdxcommons.model.search.Search; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class GroupeParticipantSearch { |
| | | |
| | | @Search(fieldName = "code", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private String code; |
| | | |
| | | @Search(fieldName = "etatIntegration", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private EtatIntegration etatIntegration; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.searchentities; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.EtatIntegration; |
| | | import com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur; |
| | | import com.megatim.fdxcommons.model.search.Search; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class NoeudSearch { |
| | | |
| | | @Search(fieldName = "code", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private String code; |
| | | |
| | | @Search(fieldName = "etatIntegration", operateur =SearchAnnotationOperateur.EQUALS) |
| | | private EtatIntegration etatIntegration; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.searchentities; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.EtatIntegration; |
| | | import com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur; |
| | | import com.megatim.fdxcommons.model.search.Search; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class ParticipantSearch { |
| | | |
| | | @Search(fieldName = "code", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private String code; |
| | | |
| | | @Search(fieldName = "etatIntegration", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private EtatIntegration etatIntegration; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.searchentities; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.EtatIntegration; |
| | | import com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur; |
| | | import com.megatim.fdxcommons.model.search.Search; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class PaysSearch { |
| | | |
| | | @Search(fieldName = "code", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private String code; |
| | | |
| | | @Search(fieldName = "etatIntegration", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private EtatIntegration etatIntegration; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.searchentities; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.EtatIntegration; |
| | | import com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur; |
| | | import com.megatim.fdxcommons.model.enumeration.StatutReferentiel; |
| | | import com.megatim.fdxcommons.model.search.Search; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class ReferentielSearch { |
| | | |
| | | @Search(fieldName = "version", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private String version; |
| | | |
| | | @Search(fieldName = "etatIntegration", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private EtatIntegration etatIntegration; |
| | | |
| | | @Search(fieldName = "statutReferentiel", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private StatutReferentiel statutReferentiel; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.searchentities; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.EtatIntegration; |
| | | import com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur; |
| | | import com.megatim.fdxcommons.model.search.Search; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class RoutageSearch { |
| | | |
| | | @Search(fieldName = "referentiel.version", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private String referentielVersion; |
| | | |
| | | @Search(fieldName = "typeFichier.code", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private String codeTypeFichier; |
| | | |
| | | @Search(fieldName = "etatIntegration", operateur =SearchAnnotationOperateur.EQUALS) |
| | | private EtatIntegration etatIntegration; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.searchentities; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.EtatIntegration; |
| | | import com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur; |
| | | import com.megatim.fdxcommons.model.search.Search; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class StructureLigneSearch { |
| | | |
| | | @Search(fieldName = "id", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private String id; |
| | | |
| | | @Search(fieldName = "etatIntegration", operateur =SearchAnnotationOperateur.EQUALS) |
| | | private EtatIntegration etatIntegration; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.searchentities; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.EtatIntegration; |
| | | import com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur; |
| | | import com.megatim.fdxcommons.model.search.Search; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class TypeFichierSearch { |
| | | |
| | | @Search(fieldName = "code", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private String code; |
| | | |
| | | @Search(fieldName = "etatIntegration", operateur =SearchAnnotationOperateur.EQUALS) |
| | | private EtatIntegration etatIntegration; |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.searchentities; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.EtatIntegration; |
| | | import com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur; |
| | | import com.megatim.fdxcommons.model.search.Search; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class ValidateurFichierConfigurationSearch { |
| | | |
| | | @Search(fieldName = "referentiel.version", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private String referentielVersion; |
| | | |
| | | @Search(fieldName = "typeFichier.code", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private String codeTypeFichier; |
| | | |
| | | @Search(fieldName = "etatIntegration", operateur =SearchAnnotationOperateur.EQUALS) |
| | | private EtatIntegration etatIntegration; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.searchentities; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.EtatIntegration; |
| | | import com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur; |
| | | import com.megatim.fdxcommons.model.search.Search; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class ValidateurFichierSearch { |
| | | |
| | | @Search(fieldName = "id", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private String id; |
| | | |
| | | @Search(fieldName = "etatIntegration", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private EtatIntegration etatIntegration; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.searchentities.tmp; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur; |
| | | import com.megatim.fdxcommons.model.search.Search; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class TokenTmpSearch { |
| | | |
| | | @Search(fieldName = "token", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private String token; |
| | | |
| | | @Search(fieldName = "codeTypeFichier", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private String codeTypeFichier; |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.searchentities.tmp; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur; |
| | | import com.megatim.fdxcommons.model.search.Search; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class TypeFichierDataTmpSearch { |
| | | |
| | | @Search(fieldName = "numeroLigne", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private int numeroLigne; |
| | | |
| | | @Search(fieldName = "tokenId", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private Long tokenId; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Enum.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.tmp; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public enum StatutTmp { |
| | | EN_COURS, EXPIRE, ACHEVE; |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.model.tmp; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.EnumType; |
| | | import javax.persistence.Enumerated; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.Transient; |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @Entity |
| | | public class TokenTmp implements Serializable { |
| | | |
| | | @Id |
| | | private String token; |
| | | |
| | | @NotNull(message = "Le statut est obligatoire") |
| | | @Enumerated(EnumType.STRING) |
| | | private StatutTmp statutTmp = StatutTmp.EN_COURS; |
| | | |
| | | @Transient |
| | | private int validite; |
| | | |
| | | @NotEmpty(message = "Le typefichier est obligatoire") |
| | | private String codeTypeFichier; |
| | | |
| | | @NotEmpty(message = "Le participant est obligatoire") |
| | | private String codeParticipant; |
| | | |
| | | @Min(value = 1, message = "Le nombre de lots est obligatoire") |
| | | private int nbBatchs; |
| | | |
| | | @Min(value = 1, message = "Le nombre d'éléments par lots est obligatoire") |
| | | private int nbEltsPerBatch; |
| | | |
| | | private int nbOfBatchsReceived; |
| | | |
| | | @NotNull(message = "La date de création est obligatoire") |
| | | private LocalDateTime dateCreation = LocalDateTime.now(); |
| | | |
| | | @NotNull(message = "La date d'expiration est obligatoire") |
| | | private LocalDateTime dateExpiration; |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.tmp; |
| | | |
| | | import java.io.Serializable; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.IdClass; |
| | | import javax.validation.constraints.Min; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @Entity |
| | | @IdClass(TypeFichierDataTmpId.class) |
| | | public class TypeFichierDataTmp implements Serializable { |
| | | |
| | | private String datum; |
| | | |
| | | @Id |
| | | private String colonne; |
| | | |
| | | @Id |
| | | private int numeroLigne; |
| | | |
| | | @Id |
| | | private String token; |
| | | |
| | | @Min(value = 1, message = "Le numéro de lot doit être supérieur à 0") |
| | | private int batchNumber; |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.model.tmp; |
| | | |
| | | import java.io.Serializable; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Data |
| | | public class TypeFichierDataTmpId implements Serializable { |
| | | |
| | | private String colonne; |
| | | |
| | | private int numeroLigne; |
| | | |
| | | private String token; |
| | | } |
| New file |
| | |
| | | # These are some examples of commonly ignored file patterns. |
| | | # You should customize this list as applicable to your project. |
| | | # Learn more about .gitignore: |
| | | # https://www.atlassian.com/git/tutorials/saving-changes/gitignore |
| | | |
| | | # Node artifact files |
| | | node_modules/ |
| | | dist/ |
| | | |
| | | # Compiled Java class files |
| | | *.class |
| | | |
| | | # Compiled Python bytecode |
| | | *.py[cod] |
| | | |
| | | # Log files |
| | | *.log |
| | | |
| | | # Package files |
| | | *.jar |
| | | |
| | | # Maven |
| | | target/ |
| | | dist/ |
| | | |
| | | # JetBrains IDE |
| | | .idea/ |
| | | |
| | | # Unit test reports |
| | | TEST*.xml |
| | | |
| | | # Generated by MacOS |
| | | .DS_Store |
| | | |
| | | # Generated by Windows |
| | | Thumbs.db |
| | | |
| | | # Applications |
| | | *.app |
| | | *.exe |
| | | *.war |
| | | |
| | | # Large media files |
| | | *.mp4 |
| | | *.tiff |
| | | *.avi |
| | | *.flv |
| | | *.mov |
| | | *.wmv |
| | | |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project-shared-configuration> |
| | | <!-- |
| | | This file contains additional configuration written by modules in the NetBeans IDE. |
| | | The configuration is intended to be shared among all the users of project and |
| | | therefore it is assumed to be part of version control checkout. |
| | | Without this configuration present, some functionality in the IDE may be limited or fail altogether. |
| | | --> |
| | | <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1"> |
| | | <!-- |
| | | Properties that influence various parts of the IDE, especially code formatting and the like. |
| | | You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up. |
| | | That way multiple projects can share the same settings (useful for formatting rules for example). |
| | | Any value defined here will override the pom.xml file value but is only applicable to the current project. |
| | | --> |
| | | <netbeans.hint.jdkPlatform>JDK_1.8</netbeans.hint.jdkPlatform> |
| | | </properties> |
| | | </project-shared-configuration> |
| New file |
| | |
| | | <?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"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <parent> |
| | | <groupId>com.megatim.apifdxweb</groupId> |
| | | <artifactId>apifdxweb</artifactId> |
| | | <version>1.0</version> |
| | | </parent> |
| | | |
| | | <groupId>com.megatim.apifdxweb.service.ifaces</groupId> |
| | | <artifactId>apifdxweb-service-ifaces</artifactId> |
| | | <packaging>jar</packaging> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>1.8</maven.compiler.source> |
| | | <maven.compiler.target>1.8</maven.compiler.target> |
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| | | <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir> |
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| | | <failOnMissingWebXml>false</failOnMissingWebXml> |
| | | <jakartaee>8.0</jakartaee> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.jboss.resteasy</groupId> |
| | | <artifactId>resteasy-multipart-provider</artifactId> |
| | | <version>3.6.3.Final</version> |
| | | <scope>provided</scope> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatim.apifdxweb.tools</groupId> |
| | | <artifactId>apifdxweb-tools</artifactId> |
| | | <version>1.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatim</groupId> |
| | | <artifactId>application-backend-commons-tools</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatim.apifdxweb.core.ifaces</groupId> |
| | | <artifactId>apifdxweb-core-ifaces</artifactId> |
| | | <version>${project.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatim</groupId> |
| | | <artifactId>rs-security-core</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>javax</groupId> |
| | | <artifactId>javaee-api</artifactId> |
| | | <version>${jakartaee}</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ibm.icu</groupId> |
| | | <artifactId>icu4j</artifactId> |
| | | <version>61.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatim.fdxcommons.service.ifaces</groupId> |
| | | <artifactId>fdxcommons-service-ifaces</artifactId> |
| | | <version>1.0</version> |
| | | </dependency> |
| | | </dependencies> |
| | | <name>apifdxweb-service-ifaces</name> |
| | | </project> |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.service.ifaces; |
| | | |
| | | import javax.annotation.security.PermitAll; |
| | | import javax.ws.rs.GET; |
| | | import javax.ws.rs.Path; |
| | | import javax.ws.rs.PathParam; |
| | | import javax.ws.rs.core.Context; |
| | | import javax.ws.rs.core.HttpHeaders; |
| | | import javax.ws.rs.core.Response; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface VerifyUser { |
| | | |
| | | @GET |
| | | @PermitAll |
| | | public Response check(@Context HttpHeaders headers, @PathParam("code_type_fichier") String codeTypeFichier); |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.ifaces.abstracts; |
| | | |
| | | import javax.annotation.security.PermitAll; |
| | | import javax.ws.rs.GET; |
| | | import javax.ws.rs.Path; |
| | | import javax.ws.rs.Produces; |
| | | import javax.ws.rs.core.Context; |
| | | import javax.ws.rs.core.HttpHeaders; |
| | | import javax.ws.rs.core.MediaType; |
| | | import javax.ws.rs.core.Response; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public interface AbstractFormModelIFaces<T> { |
| | | |
| | | @PermitAll |
| | | @GET |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("/form-model") |
| | | Response getFormModel(@Context HttpHeaders headers); |
| | | |
| | | @PermitAll |
| | | @GET |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("/form-model-update") |
| | | Response getFormModelUpdate(@Context HttpHeaders headers); |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.service.ifaces.abstracts; |
| | | |
| | | import com.mgt.rs.security.core.common.Secured; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.ws.rs.GET; |
| | | import javax.ws.rs.POST; |
| | | import javax.ws.rs.Path; |
| | | import javax.ws.rs.PathParam; |
| | | import javax.ws.rs.Produces; |
| | | import javax.ws.rs.core.Context; |
| | | import javax.ws.rs.core.HttpHeaders; |
| | | import javax.ws.rs.core.MediaType; |
| | | import javax.ws.rs.core.Response; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface AbstractGenericConsultingResourceIFaces<T, K, ID, U> { |
| | | |
| | | public default List<K> allToDto(List<T> datas) { |
| | | List<K> dtos = new ArrayList<>(); |
| | | |
| | | if (datas != null) { |
| | | for (T data : datas) { |
| | | dtos.add(mapToDto(data)); |
| | | } |
| | | } |
| | | return dtos; |
| | | } |
| | | |
| | | public K mapToDto(T entity); |
| | | |
| | | @GET |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("findbyid/{id}") |
| | | @Secured(action = "*") |
| | | public Response findById(@Context HttpHeaders headers, @PathParam("id") ID id); |
| | | |
| | | @POST |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("findwithpagination/{pageNumber}/{pagesize}") |
| | | @Secured(action = "consulter", enable = true) |
| | | public Response findWithPagination(@Context HttpHeaders headers, @PathParam("pageNumber") Integer pageNumber, @PathParam("pagesize") Integer pagesize, U searchEntity); |
| | | |
| | | @POST |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Secured(action = "consulter", enable = true) |
| | | @Path("findall") |
| | | public Response findAll(@Context HttpHeaders headers, U searchEntity); |
| | | |
| | | @POST |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("count") |
| | | @Secured(actions = {"consulter"}) |
| | | public Long count(@Context HttpHeaders headers, U searchEntity); |
| | | |
| | | @GET |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("getsearchcolumns") |
| | | @Secured(actions = {"consulter"}) |
| | | public Response getSearchColumns(@Context HttpHeaders headers); |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.ifaces.abstracts; |
| | | |
| | | import java.io.Serializable; |
| | | import javax.annotation.security.PermitAll; |
| | | import javax.validation.Valid; |
| | | import javax.ws.rs.Consumes; |
| | | import javax.ws.rs.GET; |
| | | import javax.ws.rs.POST; |
| | | import javax.ws.rs.Path; |
| | | import javax.ws.rs.PathParam; |
| | | import javax.ws.rs.Produces; |
| | | import javax.ws.rs.core.Context; |
| | | import javax.ws.rs.core.HttpHeaders; |
| | | import javax.ws.rs.core.MediaType; |
| | | import javax.ws.rs.core.Response; |
| | | |
| | | public interface AbstractGenericCrudResourceIFaces<T, K, ID extends Serializable, U> { //U représente le type de l'objet sur lequel on va appliquer la recherche |
| | | |
| | | K mapToDto(T entity); |
| | | |
| | | @POST |
| | | @Consumes({MediaType.APPLICATION_JSON}) |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("add") |
| | | @PermitAll |
| | | public Response save(@Context HttpHeaders headers, @Valid T entity); |
| | | |
| | | @POST |
| | | @Consumes({MediaType.APPLICATION_JSON}) |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("update/{id}") |
| | | @PermitAll |
| | | public Response update(@Context HttpHeaders headers, @PathParam("id") ID id, @Valid T entity); |
| | | |
| | | @POST |
| | | @Consumes({MediaType.APPLICATION_JSON}) |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("delete/{id}") |
| | | @PermitAll |
| | | public void delete(@Context HttpHeaders headers, @PathParam("id") ID id); |
| | | |
| | | @GET |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("findbyid/{id}") |
| | | @PermitAll |
| | | public Response findById(@Context HttpHeaders headers, @PathParam("id") ID id); |
| | | |
| | | @POST |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("findwithpagination/{pageNumber}/{pagesize}") |
| | | @PermitAll |
| | | public Response findWithPagination(@Context HttpHeaders headers, @PathParam("pageNumber") Integer pageNumber, @PathParam("pagesize") Integer pagesize, U searchEntity); |
| | | |
| | | @POST |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @PermitAll |
| | | @Path("findall") |
| | | public Response findAll(@Context HttpHeaders headers, U searchEntity); |
| | | |
| | | @POST |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("count") |
| | | @PermitAll |
| | | public Long count(@Context HttpHeaders headers, U searchEntity); |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.ifaces.abstracts; |
| | | |
| | | import com.bekosoftware.genericdaolayer.dao.tools.RestrictionsContainer; |
| | | import com.bekosoftware.genericmanagerlayer.core.ifaces.GenericManager; |
| | | import com.megatim.fdxcommons.model.enumeration.TypeOperation; |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.annotation.security.PermitAll; |
| | | import javax.ws.rs.Consumes; |
| | | import javax.ws.rs.POST; |
| | | import javax.ws.rs.Path; |
| | | import javax.ws.rs.PathParam; |
| | | import javax.ws.rs.Produces; |
| | | import javax.ws.rs.core.Context; |
| | | import javax.ws.rs.core.HttpHeaders; |
| | | import javax.ws.rs.core.MediaType; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public interface AbstractGenericValidationIFaces<T, U, K, ID extends Serializable> { |
| | | |
| | | @PermitAll |
| | | @POST |
| | | @Consumes({MediaType.APPLICATION_JSON}) |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("validate") |
| | | // @Secured(action = "validate") |
| | | public default void validate(@Context HttpHeaders headers, T entity) { |
| | | |
| | | // getValidationManager().validate(entity, getActualState(), getNextState()); |
| | | } |
| | | |
| | | @PermitAll |
| | | @POST |
| | | @Consumes({MediaType.APPLICATION_JSON}) |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("reject") |
| | | // @Secured(action = "reject") |
| | | public default void reject(@Context HttpHeaders headers, T entity) { |
| | | |
| | | // getValidationManager().reject(entity, getActualState(), getRejectionState()); |
| | | } |
| | | |
| | | @PermitAll |
| | | @POST |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("findwithpagination/{pageNumber}/{pagesize}") |
| | | // @Secured(actions = {"add", "update", "delete", "view", "validate"}) |
| | | public default List<T> findWithPagination(@Context HttpHeaders headers, @PathParam("pageNumber") Integer pageNumber, @PathParam("pagesize") Integer pagesize, K searchEntity) { |
| | | |
| | | //Variables |
| | | List<T> datas = null; |
| | | |
| | | //On construit la requete |
| | | RestrictionsContainer requeteur = construireRequete(searchEntity, TypeOperation.AJOUTER); |
| | | |
| | | //Construction de l'index |
| | | int index = (pageNumber - 1) * pagesize; |
| | | |
| | | //On on recherche l'entité |
| | | // datas = getManager().filter(requeteur.getPredicats(), null, null, index, pagesize); |
| | | |
| | | //Si non vide |
| | | if (datas == null || datas.isEmpty()) { |
| | | |
| | | //Liste vide |
| | | datas = new ArrayList<>(); |
| | | |
| | | } |
| | | |
| | | return datas; |
| | | |
| | | } |
| | | |
| | | @PermitAll |
| | | @POST |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("count") |
| | | // @Secured(actions = {"add", "update", "delete", "view", "validate"}) |
| | | public default Long count(@Context HttpHeaders headers, K searchEntity) { |
| | | |
| | | //Variables |
| | | Long count = 0l; |
| | | |
| | | //On construit la requete |
| | | RestrictionsContainer requeteur = construireRequete(searchEntity, TypeOperation.AJOUTER); |
| | | |
| | | //On on recherche l'entité |
| | | count = getManager().count(requeteur.getPredicats()); |
| | | |
| | | return count; |
| | | |
| | | } |
| | | |
| | | // public abstract GenericValidationIFaces<T, U> getValidationManager(); |
| | | |
| | | public abstract GenericManager<T, ID> getManager(); |
| | | |
| | | public abstract U getActualState(); |
| | | |
| | | public abstract U getNextState(); |
| | | |
| | | public abstract U getRejectionState(); |
| | | |
| | | public abstract RestrictionsContainer construireRequete(K parametre, TypeOperation typeOperation); |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.ifaces.abstracts; |
| | | |
| | | //import com.megatim.retrocedor.web.core.ifaces.common.UniqueElement; |
| | | import javax.annotation.security.PermitAll; |
| | | import javax.ws.rs.Consumes; |
| | | import javax.ws.rs.GET; |
| | | import javax.ws.rs.POST; |
| | | import javax.ws.rs.Path; |
| | | import javax.ws.rs.Produces; |
| | | import javax.ws.rs.core.Context; |
| | | import javax.ws.rs.core.HttpHeaders; |
| | | import javax.ws.rs.core.MediaType; |
| | | import javax.ws.rs.core.Response; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public interface AbstractUniqueElementIFace<T> { |
| | | |
| | | /* @PermitAll |
| | | @POST |
| | | @Consumes({MediaType.APPLICATION_JSON}) |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("save-current") |
| | | public default Response saveCurrent(@Context HttpHeaders headers, T entity) { |
| | | |
| | | T newEntity = getUniqueElementManager().saveOrUpdateCurrentElement(entity); |
| | | |
| | | return Response.ok(newEntity).build(); |
| | | } |
| | | |
| | | @PermitAll |
| | | @GET |
| | | @Consumes({MediaType.APPLICATION_JSON}) |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("current") |
| | | public default Response getCurrentElement(@Context HttpHeaders headers) { |
| | | |
| | | T newEntity = getUniqueElementManager().getCurrentElement(); |
| | | |
| | | System.out.println(newEntity == null); |
| | | |
| | | return Response.ok(newEntity).build(); |
| | | } |
| | | |
| | | abstract UniqueElement<T> getUniqueElementManager(); |
| | | */ |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.ifaces.administration; |
| | | |
| | | import com.megatim.apifdxweb.model.administration.Action; |
| | | import com.megatim.apifdxweb.service.ifaces.abstracts.AbstractGenericCrudResourceIFaces; |
| | | import com.megatim.apifdxweb.model.dtos.administration.ActionDto; |
| | | |
| | | /** |
| | | * Interface du service JAX-RS |
| | | * |
| | | * @since Fri Sep 27 08:15:34 GMT+01:00 2019 |
| | | * |
| | | */ |
| | | public interface ActionRS extends AbstractGenericCrudResourceIFaces<Action, ActionDto, Long, Action> { |
| | | |
| | | // @POST |
| | | // @Consumes({MediaType.APPLICATION_JSON}) |
| | | // @Produces({MediaType.APPLICATION_JSON}) |
| | | // @Path("add") |
| | | //// @Secured(action = "add") |
| | | //// @SecuredAdmin |
| | | //// @SecuredMegaAdmin |
| | | //// @PermitAll |
| | | // @Override |
| | | // public Response save(@Context HttpHeaders headers, @Valid Action entity); |
| | | // |
| | | // @POST |
| | | // @Consumes({MediaType.APPLICATION_JSON}) |
| | | // @Produces({MediaType.APPLICATION_JSON}) |
| | | // @Path("update/{id}") |
| | | // @Secured(action = "update") |
| | | // @SecuredAdmin |
| | | // @SecuredMegaAdmin |
| | | // @Override |
| | | // public Response update(@Context HttpHeaders headers, @PathParam("id") Long id, @Valid Action entity); |
| | | // |
| | | // @POST |
| | | // @Consumes({MediaType.APPLICATION_JSON}) |
| | | // @Produces({MediaType.APPLICATION_JSON}) |
| | | // @Path("delete/{id}") |
| | | // @Secured(action = "delete") |
| | | // @SecuredAdmin |
| | | // @SecuredMegaAdmin |
| | | // @Override |
| | | // public void delete(@Context HttpHeaders headers, @PathParam("id") Long id); |
| | | // |
| | | // @GET |
| | | // @Produces({MediaType.APPLICATION_JSON}) |
| | | // @Path("findbyid/{id}") |
| | | // @Secured(action = "*") |
| | | // @SecuredAdmin |
| | | // @SecuredSuperAdmin |
| | | // @SecuredMegaAdmin |
| | | // @Override |
| | | // public Response findById(@Context HttpHeaders headers, @PathParam("id") Long id); |
| | | // |
| | | // @GET |
| | | // @Produces({MediaType.APPLICATION_JSON}) |
| | | // @Path("findbyoneproperty/{property}/{value}") |
| | | // @Secured(action = "*") |
| | | // @SecuredAdmin |
| | | // @SecuredSuperAdmin |
| | | // @SecuredMegaAdmin |
| | | // @Override |
| | | // public Response findByOneProperty(@Context HttpHeaders headers, @PathParam("property") String propertyName, @PathParam("value") String propertyValue); |
| | | // |
| | | // @POST |
| | | // @Produces({MediaType.APPLICATION_JSON}) |
| | | // @Path("findwithpagination/{pageNumber}/{pagesize}") |
| | | // @Secured(action = "*") |
| | | // @SecuredAdmin |
| | | // @SecuredSuperAdmin |
| | | // @SecuredMegaAdmin |
| | | // @Override |
| | | // public Response findWithPagination(@Context HttpHeaders headers, @PathParam("pageNumber") Integer pageNumber, @PathParam("pagesize") Integer pagesize, Action searchEntity); |
| | | // |
| | | // @POST |
| | | // @Produces({MediaType.APPLICATION_JSON}) |
| | | // @Secured(action = "*") |
| | | // @SecuredAdmin |
| | | // @SecuredSuperAdmin |
| | | // @SecuredMegaAdmin |
| | | // @Override |
| | | // public Response findAll(@Context HttpHeaders headers, Action searchEntity); |
| | | // |
| | | // @POST |
| | | // @Produces({MediaType.APPLICATION_JSON}) |
| | | // @Path("count") |
| | | // @Secured(action = "*") |
| | | // @SecuredAdmin |
| | | // @SecuredSuperAdmin |
| | | // @SecuredMegaAdmin |
| | | // @Override |
| | | // public Long count(@Context HttpHeaders headers, Action searchEntity); |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.ifaces.administration; |
| | | |
| | | import com.megatim.apifdxweb.model.formodel.RoleFormModel; |
| | | import com.megatim.apifdxweb.service.ifaces.abstracts.AbstractFormModelIFaces; |
| | | import com.megatim.apifdxweb.service.ifaces.abstracts.AbstractGenericCrudResourceIFaces; |
| | | import com.megatim.apifdxweb.model.administration.Role; |
| | | import com.megatim.apifdxweb.model.dtos.administration.RoleDto; |
| | | |
| | | /** |
| | | * Interface du service JAX-RS |
| | | * |
| | | * @since Fri Sep 27 08:15:34 GMT+01:00 2019 |
| | | * |
| | | */ |
| | | public interface RoleRS extends AbstractGenericCrudResourceIFaces<Role, RoleDto, Long, Role>, AbstractFormModelIFaces<RoleFormModel> { |
| | | |
| | | // @POST |
| | | // @Consumes({MediaType.APPLICATION_JSON}) |
| | | // @Produces({MediaType.APPLICATION_JSON}) |
| | | // @SecuredSuperAdmin |
| | | // @SecuredMegaAdmin |
| | | // @Path("validate/{id}") |
| | | // @Secured(action = "validate") |
| | | // public void validate(@Context HttpHeaders headers, @PathParam("id") Long id); |
| | | // |
| | | // @POST |
| | | // @Consumes({MediaType.APPLICATION_JSON}) |
| | | // @Produces({MediaType.APPLICATION_JSON}) |
| | | // @SecuredSuperAdmin |
| | | // @SecuredMegaAdmin |
| | | // @Path("reject/{id}") |
| | | // @Secured(action = "reject") |
| | | // public void reject(@Context HttpHeaders headers, @PathParam("id") Long id); |
| | | // |
| | | // @GET |
| | | // @Produces({MediaType.APPLICATION_JSON}) |
| | | // @SecuredAdmin |
| | | // @SecuredSuperAdmin |
| | | // @SecuredMegaAdmin |
| | | // @Path("findbyetatoperation/{property}/{value}") |
| | | // @Secured(action = "*") |
| | | // public Response findByEtatOperation(@Context HttpHeaders headers, @PathParam("property") String propertyName, @PathParam("value") String propertyValue); |
| | | // |
| | | // @POST |
| | | // @Consumes({MediaType.APPLICATION_JSON}) |
| | | // @Produces({MediaType.APPLICATION_JSON}) |
| | | // @Path("add") |
| | | // @Secured(action = "add") |
| | | // @SecuredAdmin |
| | | // @SecuredMegaAdmin |
| | | // public Response save(@Context HttpHeaders headers, @Valid Role entity); |
| | | // |
| | | // @POST |
| | | // @Consumes({MediaType.APPLICATION_JSON}) |
| | | // @Produces({MediaType.APPLICATION_JSON}) |
| | | // @Path("update/{id}") |
| | | // @Secured(action = "update") |
| | | // @SecuredAdmin |
| | | // @SecuredMegaAdmin |
| | | // public Response update(@Context HttpHeaders headers, @PathParam("id") Long id, @Valid Role entity); |
| | | // |
| | | // @POST |
| | | // @Consumes({MediaType.APPLICATION_JSON}) |
| | | // @Produces({MediaType.APPLICATION_JSON}) |
| | | // @Path("delete/{id}") |
| | | // @Secured(action = "delete") |
| | | // @SecuredAdmin |
| | | // @SecuredMegaAdmin |
| | | // public void delete(@Context HttpHeaders headers, @PathParam("id") Long id); |
| | | // |
| | | // @GET |
| | | // @Produces({MediaType.APPLICATION_JSON}) |
| | | // @Path("findbyid/{id}") |
| | | // @Secured(action = "*") |
| | | // @SecuredAdmin |
| | | // @SecuredSuperAdmin |
| | | // @SecuredMegaAdmin |
| | | // public Response findById(@Context HttpHeaders headers, @PathParam("id") Long id); |
| | | // |
| | | // @GET |
| | | // @Produces({MediaType.APPLICATION_JSON}) |
| | | // @Path("findbyoneproperty/{property}/{value}") |
| | | // @Secured(action = "*") |
| | | // @SecuredAdmin |
| | | // @SecuredSuperAdmin |
| | | // @SecuredMegaAdmin |
| | | // public Response findByOneProperty(@Context HttpHeaders headers, @PathParam("property") String propertyName, @PathParam("value") String propertyValue); |
| | | // |
| | | // @POST |
| | | // @Produces({MediaType.APPLICATION_JSON}) |
| | | // @Path("findwithpagination/{pageNumber}/{pagesize}") |
| | | // @Secured(action = "*") |
| | | // @SecuredAdmin |
| | | // @SecuredSuperAdmin |
| | | // @SecuredMegaAdmin |
| | | // public Response findWithPagination(@Context HttpHeaders headers, @PathParam("pageNumber") Integer pageNumber, @PathParam("pagesize") Integer pagesize, Role searchEntity); |
| | | // |
| | | // @POST |
| | | // @Produces({MediaType.APPLICATION_JSON}) |
| | | // @Secured(action = "*") |
| | | // @SecuredAdmin |
| | | // @SecuredSuperAdmin |
| | | // @SecuredMegaAdmin |
| | | // public Response findAll(@Context HttpHeaders headers, Role searchEntity); |
| | | // |
| | | // @POST |
| | | // @Produces({MediaType.APPLICATION_JSON}) |
| | | // @Path("count") |
| | | // @Secured(action = "*") |
| | | // @SecuredAdmin |
| | | // @SecuredSuperAdmin |
| | | // @SecuredMegaAdmin |
| | | // public Long count(@Context HttpHeaders headers, Role searchEntity); |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.ifaces.authentication; |
| | | |
| | | import com.megatim.apifdxweb.model.dtos.EditPasswordDto; |
| | | import com.megatim.apifdxweb.model.dtos.TokenAuthentificationRequest; |
| | | import javax.annotation.security.PermitAll; |
| | | import javax.validation.Valid; |
| | | import javax.ws.rs.Consumes; |
| | | import javax.ws.rs.POST; |
| | | import javax.ws.rs.Path; |
| | | import javax.ws.rs.Produces; |
| | | import javax.ws.rs.core.Context; |
| | | import javax.ws.rs.core.HttpHeaders; |
| | | import javax.ws.rs.core.MediaType; |
| | | import javax.ws.rs.core.Response; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public interface AuthenticationRS { |
| | | |
| | | @POST |
| | | @Consumes({MediaType.APPLICATION_JSON}) |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("generate-token") |
| | | public Response authenticate(@Valid TokenAuthentificationRequest authentificationRequest); |
| | | |
| | | @POST |
| | | @Consumes({MediaType.APPLICATION_JSON}) |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("edit-password") |
| | | @PermitAll |
| | | public Response editPassword(@Context HttpHeaders headers, @Valid EditPasswordDto editPasswordDto); |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.ifaces.batch; |
| | | |
| | | import com.megatim.apifdxweb.model.dtos.tmp.DataTmpDto; |
| | | import com.megatim.apifdxweb.model.dtos.tmp.TokenTmpDto; |
| | | import javax.annotation.security.PermitAll; |
| | | import javax.validation.Valid; |
| | | import javax.ws.rs.Consumes; |
| | | import javax.ws.rs.POST; |
| | | import javax.ws.rs.Path; |
| | | import javax.ws.rs.Produces; |
| | | import javax.ws.rs.core.Context; |
| | | import javax.ws.rs.core.HttpHeaders; |
| | | import javax.ws.rs.core.MediaType; |
| | | import javax.ws.rs.core.Response; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface DataPerBatchRS { |
| | | |
| | | @POST |
| | | @Consumes({MediaType.APPLICATION_JSON}) |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("generate-token") |
| | | @PermitAll |
| | | public Response generateToken(@Context HttpHeaders headers, @Valid TokenTmpDto entity); |
| | | |
| | | @POST |
| | | @Consumes({MediaType.APPLICATION_JSON}) |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("add-data") |
| | | @PermitAll |
| | | public Response addData(@Context HttpHeaders headers, @Valid DataTmpDto entity); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.service.ifaces.camel; |
| | | |
| | | import com.megatim.fdxcommons.model.pojo.ReferentielToImportData; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ReferentielIntegration { |
| | | public void produceDatasFromApi(ReferentielToImportData referentielToImportData); |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.ifaces.dataconsumption; |
| | | |
| | | import com.megatim.fdxcommons.core.ifaces.interceptor.LoggingInterceptorBinding; |
| | | import com.megatim.fdxcommons.model.pojo.CriteriaEntityFromView; |
| | | import javax.annotation.security.PermitAll; |
| | | import javax.ws.rs.Consumes; |
| | | import javax.ws.rs.GET; |
| | | import javax.ws.rs.POST; |
| | | import javax.ws.rs.Path; |
| | | import javax.ws.rs.PathParam; |
| | | import javax.ws.rs.Produces; |
| | | import javax.ws.rs.core.Context; |
| | | import javax.ws.rs.core.HttpHeaders; |
| | | import javax.ws.rs.core.MediaType; |
| | | import javax.ws.rs.core.Response; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public interface DataConsumptionRS { |
| | | |
| | | @GET |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @PermitAll |
| | | @Path("all/{code_type_fichier}") |
| | | @LoggingInterceptorBinding(message = "Consultation des données du typefichier {code_type_fichier}") |
| | | public Response findAll(@Context HttpHeaders headers, @PathParam("code_type_fichier") String codeTypeFichier); |
| | | |
| | | @POST |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @PermitAll |
| | | @Path("new-or-updated/{code_type_fichier}") |
| | | @LoggingInterceptorBinding(message = "Consultation des données du typefichier {code_type_fichier}") |
| | | public Response loadAllAddedAndUpdated(@Context HttpHeaders headers, @PathParam("code_type_fichier") String codeTypeFichier); |
| | | |
| | | // @POST |
| | | // @Produces({MediaType.APPLICATION_JSON}) |
| | | // @PermitAll |
| | | // @Path("updated/{code_type_fichier}") |
| | | // @LoggingInterceptorBinding(message = "Consultation des données du typefichier {code_type_fichier}") |
| | | // public Response loadAllUpdated(@Context HttpHeaders headers, @PathParam("code_type_fichier") String codeTypeFichier); |
| | | |
| | | @POST |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Consumes({MediaType.APPLICATION_JSON}) |
| | | @PermitAll |
| | | @Path("by-criterias/{code_type_fichier}") |
| | | @LoggingInterceptorBinding(message = "Consultation des données du typefichier {code_type_fichier}") |
| | | public Response findByCriterias(@Context HttpHeaders headers, @PathParam("code_type_fichier") String codeTypeFichier, CriteriaEntityFromView criterion); |
| | | |
| | | @POST |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @PermitAll |
| | | @Path("count-all/{code_type_fichier}") |
| | | @LoggingInterceptorBinding(message = "Consultation des données du typefichier {code_type_fichier}") |
| | | public Response countAll(@Context HttpHeaders headers, @PathParam("code_type_fichier") String codeTypeFichier); |
| | | |
| | | @POST |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @PermitAll |
| | | @Path("count-new-or-updated/{code_type_fichier}") |
| | | @LoggingInterceptorBinding(message = "Consultation des données du typefichier {code_type_fichier}") |
| | | public Response countAllAddedAndUpdated(@Context HttpHeaders headers, @PathParam("code_type_fichier") String codeTypeFichier); |
| | | |
| | | @GET |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @PermitAll |
| | | @Path("all-with-pagination/{code_type_fichier}/{pageNumber}/{pageSize}") |
| | | @LoggingInterceptorBinding(message = "Consultation des données du typefichier {code_type_fichier}") |
| | | public Response loadAllWithPagination(@Context HttpHeaders headers, @PathParam("code_type_fichier") String codeTypeFichier, @PathParam("pageNumber") Integer pageNumber, @PathParam("pageSize") Integer pageSize); |
| | | |
| | | @POST |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Consumes({MediaType.APPLICATION_JSON}) |
| | | @PermitAll |
| | | @Path("by-criterias-with-pagination/{code_type_fichier}/{pageNumber}/{pageSize}") |
| | | @LoggingInterceptorBinding(message = "Consultation des données du typefichier {code_type_fichier}") |
| | | public Response findByCriteriaWithPagination(@Context HttpHeaders headers, @PathParam("code_type_fichier") String codeTypeFichier, @PathParam("pageNumber") Integer pageNumber, @PathParam("pageSize") Integer pageSize, CriteriaEntityFromView criterion); |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.ifaces.dataproduction; |
| | | |
| | | import com.megatim.apifdxweb.model.request.UpdateRequest; |
| | | import com.megatim.fdxcommons.core.ifaces.interceptor.LoggingInterceptorBinding; |
| | | import com.megatim.fdxcommons.model.pojo.CriteriaEntityFromView; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import javax.annotation.security.PermitAll; |
| | | import javax.ws.rs.Consumes; |
| | | import javax.ws.rs.POST; |
| | | import javax.ws.rs.PUT; |
| | | import javax.ws.rs.Path; |
| | | import javax.ws.rs.PathParam; |
| | | import javax.ws.rs.Produces; |
| | | import javax.ws.rs.core.Context; |
| | | import javax.ws.rs.core.HttpHeaders; |
| | | import javax.ws.rs.core.MediaType; |
| | | import javax.ws.rs.core.Response; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public interface DataProductionRS { |
| | | |
| | | @POST |
| | | @Consumes({MediaType.APPLICATION_JSON}) |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @PermitAll |
| | | @Path("add-all/{code_type_fichier}") |
| | | @LoggingInterceptorBinding(message = "Production de plusieurs lignes de données du typefichier {code_type_fichier}", shouldCopyData = false) |
| | | public Response saveAll(@Context HttpHeaders headers, @PathParam("code_type_fichier") String codeTypeFichier, List<LinkedHashMap<String, Object>> datas); |
| | | |
| | | @POST |
| | | @Consumes({MediaType.APPLICATION_JSON}) |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @PermitAll |
| | | @Path("add-one/{code_type_fichier}") |
| | | @LoggingInterceptorBinding(message = "Production d'une ligne de donnée du typefichier {code_type_fichier}") |
| | | public Response save(@Context HttpHeaders headers, @PathParam("code_type_fichier") String codeTypeFichier, LinkedHashMap<String, Object> datas); |
| | | |
| | | @PUT |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Consumes({MediaType.APPLICATION_JSON}) |
| | | @PermitAll |
| | | @Path("update-all/{code_type_fichier}") |
| | | @LoggingInterceptorBinding(message = "Modification de plusieurs lignes du typefichier {code_type_fichier}") |
| | | public Response updateAll(@Context HttpHeaders headers, @PathParam("code_type_fichier") String codeTypeFichier, UpdateRequest updateRequest); |
| | | |
| | | @PUT |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Consumes({MediaType.APPLICATION_JSON}) |
| | | @PermitAll |
| | | @Path("update-one/{code_type_fichier}") |
| | | @LoggingInterceptorBinding(message = "Modification d'une ligne du typefichier {code_type_fichier}") |
| | | public Response updateOne(@Context HttpHeaders headers, @PathParam("code_type_fichier") String codeTypeFichier, UpdateRequest updateRequest); |
| | | |
| | | @POST |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Consumes({MediaType.APPLICATION_JSON}) |
| | | @PermitAll |
| | | @Path("delete-all/{code_type_fichier}") |
| | | @LoggingInterceptorBinding(message = "Supppression des lignes du typefichier {code_type_fichier}") |
| | | public Response deleteAll(@Context HttpHeaders headers, @PathParam("code_type_fichier") String codeTypeFichier, CriteriaEntityFromView criterion); |
| | | |
| | | @POST |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Consumes({MediaType.APPLICATION_JSON}) |
| | | @PermitAll |
| | | @Path("delete-one/{code_type_fichier}") |
| | | @LoggingInterceptorBinding(message = "Supppression des lignes du typefichier {code_type_fichier}") |
| | | public Response deleteOne(@Context HttpHeaders headers, @PathParam("code_type_fichier") String codeTypeFichier, CriteriaEntityFromView criterion); |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.ifaces.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.model.searchentities.NoeudSearch; |
| | | import com.megatim.apifdxweb.service.ifaces.abstracts.AbstractGenericConsultingResourceIFaces; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.NoeudDto; |
| | | import com.megatim.fdxcommons.model.referentiel.Noeud; |
| | | |
| | | /** |
| | | * Interface du service JAX-RS |
| | | * |
| | | * @since Fri Sep 27 08:15:34 GMT+01:00 2019 |
| | | * |
| | | */ |
| | | public interface NoeudRS extends AbstractGenericConsultingResourceIFaces<Noeud, NoeudDto, String, NoeudSearch> { |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.service.ifaces.scheduler; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface DeleteConsumedFilesJob { |
| | | |
| | | void deleteConsumedFilesInFolder() throws Exception; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.service.ifaces.scheduler; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface TypeFichierDataJob { |
| | | public void publishData(); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.service.ifaces.scheduler; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface TypeFichierDataTmpJob { |
| | | void mergeData(); |
| | | |
| | | void deleteExpiredTokens(); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.service.ifaces.utils; |
| | | |
| | | import com.megatim.fdxcommons.model.dtos.integration.ColumnDefinitionDto; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface MapperUtil { |
| | | |
| | | ColumnDefinitionDto mapColumnDefinitionToDto(ColumnDefinition entity); |
| | | |
| | | public default List<ColumnDefinitionDto> mapColumnDefinitionListToDto(List<ColumnDefinition> data) { |
| | | List<ColumnDefinitionDto> dtos = new ArrayList<>(); |
| | | |
| | | for (ColumnDefinition c : data) { |
| | | dtos.add(mapColumnDefinitionToDto(c)); |
| | | } |
| | | return dtos; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | # These are some examples of commonly ignored file patterns. |
| | | # You should customize this list as applicable to your project. |
| | | # Learn more about .gitignore: |
| | | # https://www.atlassian.com/git/tutorials/saving-changes/gitignore |
| | | |
| | | # Node artifact files |
| | | node_modules/ |
| | | dist/ |
| | | |
| | | # Compiled Java class files |
| | | *.class |
| | | |
| | | # Compiled Python bytecode |
| | | *.py[cod] |
| | | |
| | | # Log files |
| | | *.log |
| | | |
| | | # Package files |
| | | *.jar |
| | | |
| | | # Maven |
| | | target/ |
| | | dist/ |
| | | |
| | | # JetBrains IDE |
| | | .idea/ |
| | | |
| | | # Unit test reports |
| | | TEST*.xml |
| | | |
| | | # Generated by MacOS |
| | | .DS_Store |
| | | |
| | | # Generated by Windows |
| | | Thumbs.db |
| | | |
| | | # Applications |
| | | *.app |
| | | *.exe |
| | | *.war |
| | | |
| | | # Large media files |
| | | *.mp4 |
| | | *.tiff |
| | | *.avi |
| | | *.flv |
| | | *.mov |
| | | *.wmv |
| | | |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project-shared-configuration> |
| | | <!-- |
| | | This file contains additional configuration written by modules in the NetBeans IDE. |
| | | The configuration is intended to be shared among all the users of project and |
| | | therefore it is assumed to be part of version control checkout. |
| | | Without this configuration present, some functionality in the IDE may be limited or fail altogether. |
| | | --> |
| | | <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1"> |
| | | <!-- |
| | | Properties that influence various parts of the IDE, especially code formatting and the like. |
| | | You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up. |
| | | That way multiple projects can share the same settings (useful for formatting rules for example). |
| | | Any value defined here will override the pom.xml file value but is only applicable to the current project. |
| | | --> |
| | | <org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type>ide</org-netbeans-modules-maven-jaxws.rest_2e_config_2e_type> |
| | | <netbeans.hint.jdkPlatform>JDK_1.8</netbeans.hint.jdkPlatform> |
| | | <org-netbeans-modules-css-prep.less_2e_mappings>/less:/css</org-netbeans-modules-css-prep.less_2e_mappings> |
| | | <org-netbeans-modules-css-prep.less_2e_enabled>false</org-netbeans-modules-css-prep.less_2e_enabled> |
| | | <org-netbeans-modules-css-prep.sass_2e_enabled>false</org-netbeans-modules-css-prep.sass_2e_enabled> |
| | | <org-netbeans-modules-css-prep.sass_2e_compiler_2e_options/> |
| | | <org-netbeans-modules-css-prep.less_2e_compiler_2e_options/> |
| | | <org-netbeans-modules-css-prep.sass_2e_mappings>/scss:/css</org-netbeans-modules-css-prep.sass_2e_mappings> |
| | | </properties> |
| | | </project-shared-configuration> |
| New file |
| | |
| | | <?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"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <parent> |
| | | <artifactId>apifdxweb</artifactId> |
| | | <groupId>com.megatim.apifdxweb</groupId> |
| | | <version>1.0</version> |
| | | </parent> |
| | | |
| | | <groupId>com.megatim.apifdxweb.service.impl</groupId> |
| | | <artifactId>apifdxweb-service-impl</artifactId> |
| | | <version>1.0</version> |
| | | <packaging>war</packaging> |
| | | |
| | | <name>apifdxweb-service-impl</name> |
| | | |
| | | <properties> |
| | | <maven.compiler.source>1.8</maven.compiler.source> |
| | | <maven.compiler.target>1.8</maven.compiler.target> |
| | | <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir> |
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| | | <failOnMissingWebXml>false</failOnMissingWebXml> |
| | | <jakartaee>8.0</jakartaee> |
| | | |
| | | <!-- <serveur.jboss.repertoire.deploiement.war>C:\wildfly\standalone\deployments\apifdxweb-service-impl-1.0.war</serveur.jboss.repertoire.deploiement.war> |
| | | <repertoire.target.generation.war>C:\Users\Gabuntu\Documents\NetBeansProjects\share_sources\apifdxweb\api\apifdxweb-service-impl\target\apifdxweb-service-impl-1.0.war</repertoire.target.generation.war>--> |
| | | <!-- <serveur.jboss.repertoire.deploiement.war>D:\wildfly-17.0.0.Final-web-local\standalone\deployments\apifdxweb-service-impl-1.0.war</serveur.jboss.repertoire.deploiement.war> |
| | | <repertoire.target.generation.war>C:\Users\ASUS\Documents\NetBeansProjects\share_sources\apifdxweb\api\apifdxweb-service-impl\target\apifdxweb-service-impl-1.0.war</repertoire.target.generation.war>--> |
| | | <!-- <serveur.jboss.repertoire.deploiement.war>C:\wildfly\standalone\deployments\apifdxweb-service-impl-1.0.war</serveur.jboss.repertoire.deploiement.war> |
| | | <repertoire.target.generation.war>C:\Users\Gabuntu\Documents\NetBeansProjects\share_sources\apifdxweb\api\apifdxweb-service-impl\target\apifdxweb-service-impl-1.0.war</repertoire.target.generation.war>--> |
| | | <serveur.jboss.repertoire.deploiement.war>D:\wildfly-17.0.0.Final-web-local\standalone\deployments\apifdxweb-service-impl-1.0.war</serveur.jboss.repertoire.deploiement.war> |
| | | <repertoire.target.generation.war>C:\Users\ASUS\Documents\NetBeansProjects\share_sources\apifdxweb\api\apifdxweb-service-impl\target\apifdxweb-service-impl-1.0.war</repertoire.target.generation.war> |
| | | |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.burningwave</groupId> |
| | | <artifactId>core</artifactId> |
| | | <version>12.65.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatim.apifdxweb.service.ifaces</groupId> |
| | | <artifactId>apifdxweb-service-ifaces</artifactId> |
| | | <version>${project.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatim</groupId> |
| | | <artifactId>rs-security-core</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatim.apifdxweb.tools</groupId> |
| | | <artifactId>apifdxweb-tools</artifactId> |
| | | <version>1.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatim.apifdxweb.core.impl</groupId> |
| | | <artifactId>apifdxweb-core-impl</artifactId> |
| | | <version>1.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatim.apifdxweb.model</groupId> |
| | | <artifactId>apifdxweb-model</artifactId> |
| | | <version>1.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatim</groupId> |
| | | <artifactId>application-backend-commons-tools</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>javax</groupId> |
| | | <artifactId>javaee-api</artifactId> |
| | | <version>${jakartaee}</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatim</groupId> |
| | | <artifactId>module-compression</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.jboss.resteasy</groupId> |
| | | <artifactId>resteasy-multipart-provider</artifactId> |
| | | <version>3.6.3.Final</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.quartz-scheduler</groupId> |
| | | <artifactId>quartz</artifactId> |
| | | <version>2.3.2</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.wildfly.transaction</groupId> |
| | | <artifactId>wildfly-transaction-client</artifactId> |
| | | <version>1.0.0.Final</version> |
| | | </dependency> |
| | | |
| | | <!-- <dependency> |
| | | <groupId>javax.xml.bind</groupId> |
| | | <artifactId>jaxb-api</artifactId> |
| | | <version>2.3.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.glassfish.jaxb</groupId> |
| | | <artifactId>jaxb-runtime</artifactId> |
| | | <version>2.3.1</version> |
| | | </dependency>--> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <plugins> |
| | | |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <version>3.1</version> |
| | | <configuration> |
| | | <source>1.8</source> |
| | | <target>1.8</target> |
| | | <compilerArguments> |
| | | <endorseddirs>${endorsed.dir}</endorseddirs> |
| | | </compilerArguments> |
| | | <annotationProcessorPaths> |
| | | <path> |
| | | <groupId>org.mapstruct</groupId> |
| | | <artifactId>mapstruct-processor</artifactId> |
| | | <version>1.5.3.Final</version> |
| | | </path> |
| | | <path> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <version>1.18.22</version> |
| | | </path> |
| | | </annotationProcessorPaths> |
| | | </configuration> |
| | | </plugin> |
| | | |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-war-plugin</artifactId> |
| | | <version>2.6</version> |
| | | </plugin> |
| | | |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-dependency-plugin</artifactId> |
| | | <version>2.8</version> |
| | | <executions> |
| | | <execution> |
| | | <phase>validate</phase> |
| | | <goals> |
| | | <goal>copy</goal> |
| | | </goals> |
| | | <configuration> |
| | | <outputDirectory>${endorsed.dir}</outputDirectory> |
| | | <silent>true</silent> |
| | | <artifactItems> |
| | | <artifactItem> |
| | | <groupId>javax</groupId> |
| | | <artifactId>javaee-api</artifactId> |
| | | <version>${jakartaee}</version> |
| | | <type>jar</type> |
| | | </artifactItem> |
| | | </artifactItems> |
| | | </configuration> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | <!-- Ant run maven plugin --> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-antrun-plugin</artifactId> |
| | | <version>1.8</version> |
| | | <executions> |
| | | <execution> |
| | | <id>mkdir-files-artifact-repo</id> |
| | | <phase>install</phase> |
| | | <configuration> |
| | | <tasks> |
| | | <delete file="${serveur.jboss.repertoire.deploiement.war}"/> |
| | | <copy file="${repertoire.target.generation.war}" tofile="${serveur.jboss.repertoire.deploiement.war}"/> |
| | | </tasks> |
| | | </configuration> |
| | | <goals> |
| | | <goal>run</goal> |
| | | </goals> |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | </project> |
| New file |
| | |
| | | package com.megatim.apifdxweb.impl.authentication; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.administration.TokenGenerationManager; |
| | | import com.megatim.apifdxweb.core.ifaces.administration.UserManager; |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.dtos.EditPasswordDto; |
| | | import com.megatim.apifdxweb.model.dtos.TokenAuthentificationRequest; |
| | | import com.megatim.apifdxweb.service.ifaces.authentication.AuthenticationRS; |
| | | import com.mgt.rs.security.core.common.AuthenticatedUser; |
| | | import com.mgt.rs.security.core.exception.AuthenticationException; |
| | | import com.mgt.rs.security.core.model.AuthenticationToken; |
| | | import com.mgt.rs.security.core.service.AuthenticationTokenService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import javax.enterprise.context.RequestScoped; |
| | | import javax.enterprise.event.Observes; |
| | | import javax.inject.Inject; |
| | | import javax.ws.rs.Path; |
| | | import javax.ws.rs.core.HttpHeaders; |
| | | import javax.ws.rs.core.Response; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | @Path("auth") |
| | | @RequestScoped |
| | | @Api(value = "Ressources pour l'authentification de l'API") |
| | | public class AuthenticationRSImpl implements AuthenticationRS { |
| | | |
| | | @Inject |
| | | private AuthenticationTokenService authenticationTokenService; |
| | | |
| | | @Inject |
| | | private UserManager userManager; |
| | | |
| | | @Inject |
| | | private TokenGenerationManager tokenGenerationManager; |
| | | |
| | | private String codeParticipant; |
| | | |
| | | public void handleAuthenticationEvent(@Observes @AuthenticatedUser String connectedUserName) { |
| | | this.codeParticipant = connectedUserName; |
| | | } |
| | | |
| | | @ApiOperation(value = "Génère un token si les identifiants du participant passé en paramètre sont corrects") |
| | | @Override |
| | | public Response authenticate(TokenAuthentificationRequest authentificationRequest) { |
| | | authentificationRequest.setValidite(authentificationRequest.getValidite() * 3600 * 1000); |
| | | |
| | | //On recupère l'utilisateur |
| | | User user = validateCredentials(authentificationRequest.getCodeParticipant(), authentificationRequest.getPassword()); |
| | | |
| | | //On génère le token |
| | | String token = authenticationTokenService.issueToken(user.getUserName(), authentificationRequest.getValidite()); |
| | | |
| | | //On enregistre le token généré en base de donné car c'est le seul valide pour connexion pour cet utilisateur |
| | | tokenGenerationManager.createTokenGeneration(user, token, authentificationRequest.getValidite()); |
| | | |
| | | //On cree une instance |
| | | AuthenticationToken authenticationToken = new AuthenticationToken(); |
| | | authenticationToken.setToken(token); |
| | | |
| | | return Response.ok(authenticationToken).build(); |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "Génère un token si les identifiants du participant passé en paramètre sont corrects") |
| | | @Override |
| | | public Response editPassword(HttpHeaders headers, EditPasswordDto editPasswordDto) { |
| | | userManager.editPassword(codeParticipant, editPasswordDto); |
| | | return Response.ok().build(); |
| | | } |
| | | |
| | | /** |
| | | * Validate username and password. |
| | | * |
| | | * @param username |
| | | * @param password |
| | | * @return |
| | | */ |
| | | private User validateCredentials(String username, String password) { |
| | | User user = userManager.recuperUtilisateur(username, password); |
| | | if (user == null) { |
| | | throw new AuthenticationException("Identifiants de connexion incorrects."); |
| | | } |
| | | return user; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.impl.pojo; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class TokenPojo { |
| | | |
| | | private String userName; |
| | | private String password; |
| | | |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | public String getPassword() { |
| | | return password; |
| | | } |
| | | |
| | | public void setPassword(String password) { |
| | | this.password = password; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.impl.referentiel; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.administration.UserManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.NoeudManager; |
| | | import javax.inject.Inject; |
| | | import javax.ws.rs.Path; |
| | | import com.megatim.apifdxweb.service.ifaces.referentiel.NoeudRS; |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.searchentities.NoeudSearch; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.NoeudDto; |
| | | import com.megatim.fdxcommons.model.mappers.MapStructMapper; |
| | | import com.megatim.fdxcommons.model.referentiel.Noeud; |
| | | import com.mgt.rs.security.core.common.AuthenticatedUser; |
| | | import java.util.List; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.enterprise.event.Observes; |
| | | import javax.ws.rs.core.HttpHeaders; |
| | | import javax.ws.rs.core.Response; |
| | | |
| | | /** |
| | | * REST Web Service |
| | | * |
| | | * @author ABEGA |
| | | */ |
| | | @Path("noeud") |
| | | public class NoeudRSImpl implements NoeudRS { |
| | | |
| | | @Dependent |
| | | protected NoeudManager manager; |
| | | |
| | | @Inject |
| | | private UserManager userManager; |
| | | |
| | | @AuthenticatedUser |
| | | private User utilisateurConnecte; |
| | | |
| | | @Inject |
| | | private MapStructMapper commonMapper; |
| | | |
| | | public NoeudRSImpl() { |
| | | super(); |
| | | } |
| | | |
| | | public void handleAuthenticationEvent(@Observes @AuthenticatedUser String username) { |
| | | utilisateurConnecte = userManager.recuperUtilisateur(username); |
| | | } |
| | | |
| | | @Override |
| | | public NoeudDto mapToDto(Noeud entity) { |
| | | NoeudDto dto = null; |
| | | try { |
| | | dto = commonMapper.noeudToNoeudDto(entity); |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | | } |
| | | return dto; |
| | | } |
| | | |
| | | @Override |
| | | public Response getSearchColumns(HttpHeaders headers) { |
| | | return Response.ok(manager.getSearchColumns(Noeud.class)).build(); |
| | | } |
| | | |
| | | @Override |
| | | public Response findWithPagination(HttpHeaders headers, Integer pageNumber, Integer pagesize, NoeudSearch searchEntity) { |
| | | List<Noeud> datas = manager.findWithPagination(pageNumber, pagesize, searchEntity, utilisateurConnecte); |
| | | return Response.ok(allToDto(datas)).build(); |
| | | } |
| | | |
| | | @Override |
| | | public Long count(HttpHeaders headers, NoeudSearch searchEntity) { |
| | | return manager.count(searchEntity); |
| | | } |
| | | |
| | | @Override |
| | | public Response findById(HttpHeaders headers, String id) { |
| | | Noeud noeud = manager.getById(id, utilisateurConnecte); |
| | | return Response.ok(mapToDto(noeud)).build(); |
| | | } |
| | | |
| | | @Override |
| | | public Response findAll(HttpHeaders headers, NoeudSearch searchEntity) { |
| | | List<Noeud> datas = manager.getAll(searchEntity, utilisateurConnecte); |
| | | return Response.ok(allToDto(datas)).build(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.impl.tools; |
| | | |
| | | import com.megatim.apifdxweb.tools.AppContext; |
| | | import com.megatim.apifdxweb.tools.exceptions.ApplicationServerException; |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.List; |
| | | import javax.ws.rs.core.MultivaluedMap; |
| | | import org.jboss.resteasy.plugins.providers.multipart.InputPart; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class Utilities { |
| | | |
| | | // public static boolean arePropertiesOk() { |
| | | // boolean dirOk = AppContext.INTEGRATION_STANDALONE_DESTINATION_DIR != null && !AppContext.INTEGRATION_STANDALONE_DESTINATION_DIR.isEmpty() |
| | | // && AppContext.INTEGRATION_STANDALONE_TEMP_DIR != null && !AppContext.INTEGRATION_STANDALONE_TEMP_DIR.isEmpty() |
| | | // && Files.exists(Paths.get(AppContext.INTEGRATION_STANDALONE_TEMP_DIR)); |
| | | // System.out.println("dirOk = " + dirOk); |
| | | // |
| | | // if (!AppContext.INTEGRATION_STANDALONE_IS_REMOTE) { |
| | | // return dirOk; |
| | | // } else { |
| | | // boolean paramsOk = AppContext.INTEGRATION_STANDALONE_HOSTNAME != null && !AppContext.INTEGRATION_STANDALONE_HOSTNAME.isEmpty() |
| | | // && AppContext.INTEGRATION_STANDALONE_PASSWORD != null && !AppContext.INTEGRATION_STANDALONE_PASSWORD.isEmpty() |
| | | // && AppContext.INTEGRATION_STANDALONE_USERNAME != null && !AppContext.INTEGRATION_STANDALONE_USERNAME.isEmpty(); |
| | | // |
| | | // System.out.println("paramsOk = " + paramsOk); |
| | | // return dirOk && paramsOk; |
| | | // } |
| | | // } |
| | | |
| | | public static File saveFileToDisk(List<InputPart> inputParts) throws ApplicationServerException { |
| | | |
| | | int bufferSize = 1024; |
| | | File customDir = new File(AppContext.UPLOAD_DIR); |
| | | |
| | | //Si le repertoire n'existe pas, on crée |
| | | if (!customDir.exists()) { |
| | | //On crée le repertoire |
| | | customDir.mkdir(); |
| | | } |
| | | |
| | | if (inputParts != null) { |
| | | for (InputPart inputPart : inputParts) { |
| | | MultivaluedMap<String, String> header = inputPart.getHeaders(); |
| | | try { |
| | | String fileName = getFileName(header); |
| | | InputStream inputStream = inputPart.getBody(InputStream.class, null); |
| | | fileName = customDir + File.separator + fileName; |
| | | File file = writeFile(inputStream, fileName, bufferSize); |
| | | return file; |
| | | } catch (IOException ex) { |
| | | ex.printStackTrace(); |
| | | throw new ApplicationServerException(); |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private static String getFileName(MultivaluedMap<String, String> header) { |
| | | String[] contentDisposition = header.getFirst("Content-Disposition").split(";"); |
| | | for (String filename : contentDisposition) { |
| | | if ((filename.trim().startsWith("filename"))) { |
| | | String[] name = filename.split("="); |
| | | String finalFileName = name[1].trim().replaceAll("\"", ""); |
| | | return finalFileName; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private static File writeFile(InputStream input, String filename, int bufferSize) throws IOException { |
| | | |
| | | File file = new File(filename); |
| | | if (!file.exists()) { |
| | | file.createNewFile(); |
| | | } |
| | | |
| | | try ( FileOutputStream fop = new FileOutputStream(file)) { |
| | | byte[] buffer = new byte[bufferSize]; |
| | | int n = 0; |
| | | while (-1 != (n = input.read(buffer))) { |
| | | fop.write(buffer, 0, n); |
| | | } |
| | | fop.flush(); |
| | | } |
| | | |
| | | return file; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.service.batch; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.administration.UserManager; |
| | | import com.megatim.apifdxweb.core.ifaces.tmp.TokenTmpManager; |
| | | import com.megatim.apifdxweb.core.ifaces.tmp.TypeFichierDataTmpManager; |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.dtos.tmp.DataTmpDto; |
| | | import com.megatim.apifdxweb.model.dtos.tmp.TokenTmpDto; |
| | | import com.megatim.apifdxweb.model.mappers.MapStructMapper; |
| | | import com.megatim.apifdxweb.model.tmp.TokenTmp; |
| | | import com.mgt.rs.security.core.common.AuthenticatedUser; |
| | | import com.mgt.rs.security.core.common.SecuredClass; |
| | | import javax.enterprise.context.RequestScoped; |
| | | import javax.enterprise.event.Observes; |
| | | import javax.inject.Inject; |
| | | import javax.ws.rs.Path; |
| | | import javax.ws.rs.core.HttpHeaders; |
| | | import javax.ws.rs.core.Response; |
| | | import com.megatim.apifdxweb.service.ifaces.batch.DataPerBatchRS; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @SecuredClass(module = "application", path = "gestion des tokens pour l'envoie de données par lots", description = "gestion des tokens") |
| | | @Path("batch-data") |
| | | @RequestScoped |
| | | public class DataPerBatchRSImpl implements DataPerBatchRS { |
| | | |
| | | @Inject |
| | | private MapStructMapper mapper; |
| | | |
| | | @Inject |
| | | private TypeFichierDataTmpManager manager; |
| | | |
| | | @Inject |
| | | private UserManager userManager; |
| | | |
| | | private String codeParticipant; |
| | | |
| | | @Inject |
| | | private TokenTmpManager tokenTmpManager; |
| | | |
| | | public void handleAuthenticationEvent(@Observes @AuthenticatedUser String connectedUserName) { |
| | | User user = userManager.recuperUtilisateur(connectedUserName); |
| | | this.codeParticipant = user != null ? user.getParticipant().getCode() : null; |
| | | } |
| | | |
| | | @Override |
| | | public Response addData(HttpHeaders headers, DataTmpDto entity) { |
| | | manager.saveData(codeParticipant, entity); |
| | | return Response.ok().build(); |
| | | } |
| | | |
| | | @Override |
| | | public Response generateToken(HttpHeaders headers, TokenTmpDto dto) { |
| | | |
| | | TokenTmp entity = mapper.tokenTmpDtoToTokenTmp(dto); |
| | | TokenTmpDto finalDto = mapper.tokenTmpToTokenTmpDto(tokenTmpManager.saveEntity(entity, codeParticipant)); |
| | | finalDto.setValidite(dto.getValidite()); |
| | | |
| | | return Response.ok(finalDto).build(); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl; |
| | | |
| | | import io.swagger.annotations.Contact; |
| | | import io.swagger.annotations.Info; |
| | | import io.swagger.annotations.SwaggerDefinition; |
| | | import javax.ws.rs.ApplicationPath; |
| | | import javax.ws.rs.core.Application; |
| | | |
| | | /** |
| | | * Configures JAX-RS for the application. |
| | | * |
| | | * @author Leonel FOFOU |
| | | */ |
| | | @ApplicationPath("apifdxweb") |
| | | @SwaggerDefinition(info = @Info( |
| | | title = "Financial Data Exchange API", |
| | | description = "API Web pour l'interfaçage des fichiers de la plateforme Fdx", |
| | | version = "1.0.0", |
| | | contact = @Contact( |
| | | name = "Megatim group", |
| | | email = "contact@megatimgroup.com", |
| | | url = "http://megatimgroup.com" |
| | | ) |
| | | ) |
| | | ) |
| | | public class JAXRSConfiguration extends Application { |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.administration; |
| | | |
| | | |
| | | import javax.ws.rs.Path; |
| | | |
| | | /** |
| | | * REST Web Service |
| | | * |
| | | * @author ABEGA |
| | | */ |
| | | //@SecuredClass(module = "application", path = "action", description = "Actions") |
| | | @Path("action") |
| | | public class ActionRSImpl {//implements ActionRS { |
| | | // |
| | | // /** |
| | | // * On injecte un Gestionnaire d'entites |
| | | // * |
| | | // */ |
| | | // @Inject |
| | | // protected ActionManager manager; |
| | | // |
| | | // /** |
| | | // * On injecte un Gestionnaire d'entites |
| | | // * |
| | | // */ |
| | | // @Inject |
| | | // protected ActionManager roleManager; |
| | | // |
| | | // @Context |
| | | // private UriInfo context; |
| | | // |
| | | // @AuthenticatedUser |
| | | // private Noeud utilisateurConnecte; |
| | | // |
| | | // @Inject |
| | | // private MapStructMapper mapstructMapper; |
| | | // |
| | | // public ActionRSImpl() { |
| | | // super(); |
| | | // } |
| | | // |
| | | // /** |
| | | // * Permet de retourne les parametres de la requete sous forme de d'entité |
| | | // * |
| | | // * @param searchEntity |
| | | // * @param typeOperation |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public RestrictionsContainer construireRequete(Action searchEntity, TypeOperation typeOperation) { |
| | | // |
| | | // //Variables |
| | | // RestrictionsContainer requeteur = RestrictionsContainer.newInstance(); |
| | | // |
| | | // //On ajoute le code |
| | | // if (searchEntity.getPath() != null) { |
| | | // requeteur.addLike("path", "%" + searchEntity.getPath()); |
| | | // } |
| | | // |
| | | // //On ajoute le nom |
| | | // if (searchEntity.getName() != null) { |
| | | // requeteur.addLike("name", "%" + searchEntity.getName()); |
| | | // } |
| | | // |
| | | // //On ajoute les critères de recherche |
| | | // requeteur.addEq("typeOperation", typeOperation); |
| | | // |
| | | // return requeteur; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void performDelete(Action entity) { |
| | | // //On marque comme supprimé |
| | | // entity.setTypeOperation(TypeOperation.SUPPRIMER); |
| | | // |
| | | // //On update ne bd |
| | | // manager.update(entity.getId(), entity); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void performUpdate(Action actualEntity, Action requestEntity) { |
| | | // |
| | | // if (actualEntity == null) { |
| | | // throw new CommonRessourceNotFoundException("Action introuvable"); |
| | | // } |
| | | // |
| | | // //On copie les nouvelles valeurs |
| | | // actualEntity.setPath(requestEntity.getPath()); |
| | | // actualEntity.setName(requestEntity.getName()); |
| | | // actualEntity.setModule(requestEntity.getModule()); |
| | | // |
| | | // //On update ne bd |
| | | // manager.update(actualEntity.getId(), actualEntity); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public String getIdPropertyName() { |
| | | // return "id"; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public GenericManager<Action, Long> getManager() { |
| | | // return manager; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void beforeSave(Action entity) { |
| | | // |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void afterSave(Action entity) { |
| | | // |
| | | // } |
| | | // |
| | | // @Override |
| | | // public ActionDto mapToDto(Action entity) { |
| | | // return mapstructMapper.actionToActionDto(entity); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Response save(HttpHeaders headers, Action entity) { |
| | | // //Pre-traitements |
| | | // beforeSave(entity); |
| | | // |
| | | // //On save |
| | | // Action newEntity = getManager().save(entity); |
| | | // |
| | | // //Post-traitements |
| | | // afterSave(entity); |
| | | // logAfterSave(entity); |
| | | // return Response.ok(mapToDto(newEntity)).build(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Response update(HttpHeaders headers, Long id, Action entity) { |
| | | // //Variables |
| | | // Action actualEntity = getManager().find(getIdPropertyName(), id); |
| | | // |
| | | // //On copie les nouvelles valeurs |
| | | // performUpdate(actualEntity, entity); |
| | | // logAfterUpdate(actualEntity); |
| | | // return Response.ok(mapToDto(actualEntity)).build(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void delete(HttpHeaders headers, Long id) { |
| | | // //Variables |
| | | // Action entity = getManager().find(getIdPropertyName(), id); |
| | | // |
| | | // performDelete(entity); |
| | | // logAfterDelete(entity); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Response findById(HttpHeaders headers, Long id) { |
| | | // //Variables |
| | | // Action entity = getManager().find(getIdPropertyName(), id); |
| | | // logAfterGetRessource(); |
| | | // return Response.ok(mapToDto(entity)).build(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Response findByOneProperty(HttpHeaders headers, String propertyName, String propertyValue) { |
| | | // //Variables |
| | | // List<Action> datas = null; |
| | | // |
| | | // List<ActionDto> dtos = new ArrayList<ActionDto>(); |
| | | // |
| | | // //On on recherche l'entité |
| | | // datas = getManager().findByUniqueProperty(propertyName, propertyValue, null); |
| | | // |
| | | // //Si non vide |
| | | // if (datas != null) { |
| | | // |
| | | // for (Action data : datas) { |
| | | // dtos.add(mapToDto(data)); |
| | | // } |
| | | // |
| | | // } |
| | | // logAfterGetRessource(); |
| | | // return Response.ok(dtos).build(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Response findWithPagination(HttpHeaders headers, Integer pageNumber, Integer pagesize, Action searchEntity) { |
| | | // //Variables |
| | | // List<Action> datas = null; |
| | | // List<ActionDto> dtos = new ArrayList<>(); |
| | | // |
| | | // Map<String, OrderType> orders = new HashMap<>(); |
| | | // |
| | | // //On trie par id |
| | | // orders.put("id", OrderType.DESC); |
| | | // //On construit la requete |
| | | // RestrictionsContainer requeteur = construireRequete(searchEntity, TypeOperation.AJOUTER); |
| | | // |
| | | // //Construction de l'index |
| | | // int index = (pageNumber - 1) * pagesize; |
| | | // |
| | | // //On on recherche l'entité |
| | | // datas = getManager().filter(requeteur.getPredicats(), orders, null, index, pagesize); |
| | | // |
| | | // //Si non vide |
| | | // if (datas != null) { |
| | | // |
| | | // for (Action data : datas) { |
| | | // dtos.add(mapToDto(data)); |
| | | // } |
| | | // |
| | | // } |
| | | // logAfterGetRessource(); |
| | | // return Response.ok(dtos).build(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Response findAll(HttpHeaders headers, Action searchEntity) { |
| | | // //Variables |
| | | // List<Action> datas = null; |
| | | // List<ActionDto> dtos = new ArrayList<>(); |
| | | // |
| | | // //On construit la requete |
| | | // RestrictionsContainer requeteur = construireRequete(searchEntity, TypeOperation.AJOUTER); |
| | | // Map<String, OrderType> orders = new HashMap<>(); |
| | | // |
| | | // //On trie par id |
| | | // orders.put("id", OrderType.DESC); |
| | | // |
| | | // //On on recherche l'entité |
| | | // datas = getManager().filter(requeteur.getPredicats(), orders, null, 0, -1); |
| | | // |
| | | // //Si non vide |
| | | // if (datas != null) { |
| | | // for (Action data : datas) { |
| | | // dtos.add(mapToDto(data)); |
| | | // } |
| | | // |
| | | // } |
| | | // logAfterGetRessource(); |
| | | // return Response.ok(dtos).build(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Long count(HttpHeaders headers, Action searchEntity) { |
| | | // //Variables |
| | | // Long count = 0l; |
| | | // |
| | | // //On construit la requete |
| | | // RestrictionsContainer requeteur = construireRequete(searchEntity, TypeOperation.AJOUTER); |
| | | // |
| | | // //On on recherche l'entité |
| | | // count = getManager().count(requeteur.getPredicats()); |
| | | // |
| | | // return count; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void logAfterSave(Action entity) { |
| | | //// journalActionUtilisateurManager.logAction("Enregistrement de l'action : " + entity.getName(), Gravite.INFO, utilisateurConnecte); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void logAfterUpdate(Action entity) { |
| | | //// journalActionUtilisateurManager.logAction("Mise à jour de l'action : " + entity.getName(), Gravite.INFO, utilisateurConnecte); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void logAfterDelete(Action entity) { |
| | | //// journalActionUtilisateurManager.logAction("Suppression de l'action : " + entity.getName(), Gravite.INFO, utilisateurConnecte); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void logAfterGetRessource() { |
| | | //// journalActionUtilisateurManager.logAction("Consultation de la liste des actions ", Gravite.INFO, utilisateurConnecte); |
| | | // } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.administration; |
| | | |
| | | import javax.ws.rs.Path; |
| | | |
| | | /** |
| | | * REST Web Service |
| | | * |
| | | * @author ABEGA |
| | | */ |
| | | //@SecuredClass(module = "application", path = "role", description = "Roles") |
| | | @Path("role") |
| | | public class RoleRSImpl {//implements RoleRS { |
| | | // |
| | | // @Inject |
| | | // protected RoleManager manager; |
| | | // |
| | | // @Dependent |
| | | // protected NoeudManager userManager; |
| | | // |
| | | // @Inject |
| | | // protected ActionManager actionManager; |
| | | // |
| | | // @Context |
| | | // private UriInfo context; |
| | | // |
| | | // @Inject |
| | | // private MapStructMapper mapstructMapper; |
| | | // |
| | | // public RoleRSImpl() { |
| | | // super(); |
| | | // } |
| | | // |
| | | // public RoleDto mapToDto(Role entity) { |
| | | // return mapstructMapper.roleToRoleDto(entity); |
| | | // } |
| | | // |
| | | // /** |
| | | // * Permet de retourne les parametres de la requete sous forme de d'entité |
| | | // * |
| | | // * @param searchEntity |
| | | // * @param typeOperation |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public RestrictionsContainer construireRequete(Role searchEntity, TypeOperation typeOperation) { |
| | | // |
| | | // //Variables |
| | | // RestrictionsContainer requeteur = RestrictionsContainer.newInstance(); |
| | | // |
| | | // //On ajoute le code |
| | | // if (searchEntity.getLibelle() != null && !searchEntity.getLibelle().isEmpty()) { |
| | | // requeteur.addLike("libelle", "%" + searchEntity.getLibelle()); |
| | | // } |
| | | // |
| | | // //On ajoute le description du role |
| | | // if (searchEntity.getDescription() != null && !searchEntity.getDescription().isEmpty()) { |
| | | // requeteur.addLike("description", "%" + searchEntity.getDescription()); |
| | | // } |
| | | // |
| | | // //On ajoute l'etat operation |
| | | // if (searchEntity.getEtatOperation() != null) { |
| | | // requeteur.addEq("etatOperation", searchEntity.getEtatOperation()); |
| | | // } |
| | | // |
| | | // //On ajoute le type opération |
| | | // requeteur.addEq("typeOperation", typeOperation); |
| | | // |
| | | // return requeteur; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void validate(@Context HttpHeaders headers, @PathParam("id") Long id) { |
| | | // |
| | | // //Variables |
| | | // Role entity = getManager().find(getIdPropertyName(), id); |
| | | // if (entity == null) { |
| | | // throw new CommonRessourceNotFoundException("Role introuvable pour l'identifiant " + id); |
| | | // } |
| | | // //On change l'etat |
| | | // entity.setEtatOperation(EtatOperation.ACTIF); |
| | | // |
| | | // //On update ne bd |
| | | // manager.update(entity.getId(), entity); |
| | | // |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void reject(@Context HttpHeaders headers, @PathParam("id") Long id) { |
| | | // |
| | | // //Variables |
| | | // Role entity = getManager().find(getIdPropertyName(), id); |
| | | // if (entity == null) { |
| | | // throw new CommonRessourceNotFoundException("Role introuvable pour l'identifiant " + id); |
| | | // } |
| | | // //On change l'etat |
| | | // entity.setEtatOperation(EtatOperation.INNACTIF); |
| | | // |
| | | // //On marque comme supprimé |
| | | // entity.setTypeOperation(TypeOperation.SUPPRIMER); |
| | | // |
| | | // //On update ne bd |
| | | // manager.update(entity.getId(), entity); |
| | | // |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void performDelete(Role entity) { |
| | | // |
| | | // //On marque comme supprimé |
| | | // entity.setTypeOperation(TypeOperation.SUPPRIMER); |
| | | // |
| | | // //On set les informations supplementaires |
| | | // entity.setDateSuppression(new Date()); |
| | | // |
| | | // //On update ne bd |
| | | // manager.update(entity.getId(), entity); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void performUpdate(Role actualEntity, Role requestEntity) { |
| | | // |
| | | // if (actualEntity == null) { |
| | | // throw new CommonRessourceNotFoundException("Role introuvable pour l'identifiant "); |
| | | // } |
| | | // |
| | | // //Si ce libelle existe dejà |
| | | // if (requestEntity.getLibelle() != null && !requestEntity.getLibelle().isEmpty() && !getManager().findByUniqueProperty("libelle", requestEntity.getLibelle(), null).isEmpty()) { |
| | | // //On retourne le message d'erreur |
| | | // if (!getManager().findByUniqueProperty("libelle", requestEntity.getLibelle(), null).get(0).getLibelle().equals(actualEntity.getLibelle())) { |
| | | // throw new CommonAlredyExistException("libelle", "Ce Libelle Existe déjà."); |
| | | // } |
| | | // } |
| | | // |
| | | // //On copie les nouvelles valeurs |
| | | // actualEntity.setLibelle(requestEntity.getLibelle()); |
| | | // actualEntity.setDescription(requestEntity.getDescription()); |
| | | // |
| | | // //On set les informations supplementaires |
| | | // actualEntity.setDateDerniereModification(new Date()); |
| | | // |
| | | // //On update ne bd |
| | | // getManager().update(actualEntity.getId(), actualEntity); |
| | | // |
| | | // } |
| | | // |
| | | // @Override |
| | | // public String getIdPropertyName() { |
| | | // return "id"; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public GenericManager<Role, Long> getManager() { |
| | | // return manager; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Response findByEtatOperation(@Context HttpHeaders headers, @PathParam("property") String propertyName, @PathParam("value") String propertyValue) { |
| | | // |
| | | // //Variables |
| | | // List<Role> datas = null; |
| | | // RestrictionsContainer requeteur = RestrictionsContainer.newInstance(); |
| | | // |
| | | // //On ajoute les criteres |
| | | // requeteur.addEq(propertyName, EtatOperation.fromValeur(propertyValue)); |
| | | // requeteur.addEq("typeOperation", TypeOperation.AJOUTER); |
| | | // |
| | | // //On on recherche l'entité |
| | | // datas = getManager().filter(requeteur.getPredicats(), null, null, 0, -1); |
| | | // |
| | | // //Si non vide |
| | | // if (datas == null || datas.isEmpty()) { |
| | | // |
| | | // //Liste vide |
| | | // datas = new ArrayList<>(); |
| | | // |
| | | // } |
| | | // |
| | | // return Response.ok(mapstructMapper.roleSlimDtos(datas)).build(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void beforeSave(Role entity) { |
| | | // //Si ce libelle existe dejà |
| | | // if (entity.getLibelle() != null && !entity.getLibelle().isEmpty() && !getManager().findByUniqueProperty("libelle", entity.getLibelle(), null).isEmpty()) { |
| | | // //On retourne le message d'erreur |
| | | // throw new CommonAlredyExistException("libelle", "Ce Libelle Existe déjà."); |
| | | // } |
| | | // entity.setDateCreation(new Date()); |
| | | // entity.setEtatOperation(EtatOperation.NOUVEAU); |
| | | // |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void afterSave(Role entity) { |
| | | // |
| | | // } |
| | | // |
| | | |
| | | // @Override |
| | | // public Response getFormModel(@Context HttpHeaders headers) { |
| | | // RoleFormModel formModel = new RoleFormModel(); |
| | | // formModel.setActions(mapstructMapper.actionSlimDtos(actionManager.findAll())); |
| | | // return Response.ok(formModel).build(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Response getFormModelUpdate(@Context HttpHeaders headers) { |
| | | // RoleFormModel formModel = new RoleFormModel(); |
| | | // formModel.setActions(mapstructMapper.actionSlimDtos(actionManager.findAll())); |
| | | // return Response.ok(formModel).build(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Response save(HttpHeaders headers, Role entity) { |
| | | // //Pre-traitements |
| | | // beforeSave(entity); |
| | | // |
| | | // //On save |
| | | // Role newEntity = getManager().save(entity); |
| | | // |
| | | // //Post-traitements |
| | | // afterSave(entity); |
| | | // logAfterSave(entity); |
| | | // return Response.ok(mapToDto(newEntity)).build(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Response update(HttpHeaders headers, Long id, Role entity) { |
| | | // //Variables |
| | | // Role actualEntity = getManager().find(getIdPropertyName(), id); |
| | | // |
| | | // //On copie les nouvelles valeurs |
| | | // performUpdate(actualEntity, entity); |
| | | // logAfterUpdate(actualEntity); |
| | | // return Response.ok(mapToDto(actualEntity)).build(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void delete(HttpHeaders headers, Long id) { |
| | | // //Variables |
| | | // Role entity = getManager().find(getIdPropertyName(), id); |
| | | // |
| | | // performDelete(entity); |
| | | // logAfterDelete(entity); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Response findById(HttpHeaders headers, Long id) { |
| | | // //Variables |
| | | // Role entity = getManager().find(getIdPropertyName(), id); |
| | | // logAfterGetRessource(); |
| | | // return Response.ok(mapToDto(entity)).build(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Response findByOneProperty(HttpHeaders headers, String propertyName, String propertyValue) { |
| | | // //Variables |
| | | // List<Role> datas = null; |
| | | // |
| | | // List<RoleDto> dtos = new ArrayList<>(); |
| | | // |
| | | // //On on recherche l'entité |
| | | // datas = getManager().findByUniqueProperty(propertyName, propertyValue, null); |
| | | // |
| | | // //Si non vide |
| | | // if (datas != null) { |
| | | // for (Role data : datas) { |
| | | // dtos.add(mapToDto(data)); |
| | | // } |
| | | // } |
| | | // |
| | | // logAfterGetRessource(); |
| | | // |
| | | // return Response.ok(dtos).build(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Response findWithPagination(HttpHeaders headers, Integer pageNumber, Integer pagesize, Role searchEntity) { |
| | | // //Variables |
| | | // List<Role> datas = null; |
| | | // List<RoleDto> dtos = new ArrayList<>(); |
| | | // |
| | | // Map<String, OrderType> orders = new HashMap<>(); |
| | | // |
| | | // //On trie par id |
| | | // orders.put("id", OrderType.DESC); |
| | | // //On construit la requete |
| | | // RestrictionsContainer requeteur = construireRequete(searchEntity, TypeOperation.AJOUTER); |
| | | // |
| | | // //Construction de l'index |
| | | // int index = (pageNumber - 1) * pagesize; |
| | | // |
| | | // //On on recherche l'entité |
| | | // datas = getManager().filter(requeteur.getPredicats(), orders, null, index, pagesize); |
| | | // |
| | | // //Si non vide |
| | | // if (datas != null) { |
| | | // for (Role data : datas) { |
| | | // dtos.add(mapToDto(data)); |
| | | // } |
| | | // } |
| | | // |
| | | // logAfterGetRessource(); |
| | | // |
| | | // return Response.ok(dtos).build(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Response findAll(HttpHeaders headers, Role searchEntity) { |
| | | // //Variables |
| | | // List<Role> datas = null; |
| | | // List<RoleDto> dtos = new ArrayList<>(); |
| | | // |
| | | // //On construit la requete |
| | | // RestrictionsContainer requeteur = construireRequete(searchEntity, TypeOperation.AJOUTER); |
| | | // Map<String, OrderType> orders = new HashMap<>(); |
| | | // |
| | | // //On trie par id |
| | | // orders.put("id", OrderType.DESC); |
| | | // |
| | | // //On on recherche l'entité |
| | | // datas = getManager().filter(requeteur.getPredicats(), orders, null, 0, -1); |
| | | // |
| | | // //Si non vide |
| | | // if (datas != null) { |
| | | // for (Role data : datas) { |
| | | // dtos.add(mapToDto(data)); |
| | | // } |
| | | // } |
| | | // |
| | | // logAfterGetRessource(); |
| | | // |
| | | // return Response.ok(dtos).build(); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public Long count(HttpHeaders headers, Role searchEntity) { |
| | | // //Variables |
| | | // Long count = 0l; |
| | | // |
| | | // //On construit la requete |
| | | // RestrictionsContainer requeteur = construireRequete(searchEntity, TypeOperation.AJOUTER); |
| | | // |
| | | // //On on recherche l'entité |
| | | // count = getManager().count(requeteur.getPredicats()); |
| | | // |
| | | // return count; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void logAfterSave(Role entity) { |
| | | //// journalActionUtilisateurManager.logAction("Enregistrement du groupe d'utilisateur : " + entity.getLibelle(), Gravite.INFO, utilisateurConnecte); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void logAfterUpdate(Role entity) { |
| | | //// journalActionUtilisateurManager.logAction("Mise à jour du groupe d'utilisateur : " + entity.getLibelle(), Gravite.INFO, utilisateurConnecte); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void logAfterDelete(Role entity) { |
| | | //// journalActionUtilisateurManager.logAction("Suppression du groupe d'utilisateur : " + entity.getLibelle(), Gravite.INFO, utilisateurConnecte); |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void logAfterGetRessource() { |
| | | //// journalActionUtilisateurManager.logAction("Consultation de la liste des groupes d'utilisateur : ", Gravite.INFO, utilisateurConnecte); |
| | | // } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel; |
| | | |
| | | import com.megatim.apifdxweb.service.impl.camel.config.CamelRouteConfiguration; |
| | | import com.megatim.apifdxweb.service.impl.camel.routes.in.FichierIntegrationLocalRoute; |
| | | import com.megatim.apifdxweb.service.impl.camel.routes.in.FichierIntegrationRemoteRoute; |
| | | import com.megatim.apifdxweb.service.impl.camel.routes.out.FdxStandaloneRoute; |
| | | import com.megatim.apifdxweb.service.impl.camel.routes.out.FileIntegrationRoute; |
| | | import com.megatim.apifdxweb.service.impl.camel.routes.in.TokenAuthentificationRoute; |
| | | import com.megatim.apifdxweb.service.impl.camel.routes.in.ReferentielIntegrationLocalRoute; |
| | | import com.megatim.apifdxweb.service.impl.camel.routes.in.ReferentielIntegrationRemoteRoute; |
| | | import com.megatim.apifdxweb.service.impl.camel.routes.in.UserActionsRoute; |
| | | import com.megatim.apifdxweb.service.impl.camel.routes.timers.DataIntegrationTimerRoute; |
| | | import com.megatim.apifdxweb.service.impl.camel.routes.timers.DeleteConsumedFilesTimer; |
| | | import com.megatim.apifdxweb.service.impl.camel.routes.timers.DeleteExpiredTokensTimer; |
| | | import com.megatim.apifdxweb.service.impl.camel.routes.timers.MergeTypeFichierBatchDataTimer; |
| | | import com.megatim.apifdxweb.tools.AppContext; |
| | | import java.util.logging.Level; |
| | | import java.util.logging.Logger; |
| | | import javax.annotation.PostConstruct; |
| | | import javax.annotation.Resource; |
| | | import javax.ejb.Singleton; |
| | | import javax.ejb.Startup; |
| | | import javax.enterprise.event.Observes; |
| | | import javax.inject.Inject; |
| | | import javax.naming.NamingException; |
| | | import javax.sql.DataSource; |
| | | import org.apache.camel.cdi.CdiCamelConfiguration; |
| | | import org.apache.camel.cdi.CdiCamelContext; |
| | | import org.apache.camel.component.jdbc.JdbcComponent; |
| | | import org.apache.camel.component.rabbitmq.RabbitMQComponent; |
| | | |
| | | @Singleton |
| | | @Startup |
| | | public class CamelBootstrap { |
| | | |
| | | @Inject |
| | | private CdiCamelContext camelContext; |
| | | |
| | | @Resource(lookup = AppContext.JNDI_NAME) |
| | | private DataSource dataSource; |
| | | |
| | | @Inject |
| | | private FdxStandaloneRoute fdxStandaloneRoute; |
| | | |
| | | @Inject |
| | | private FileIntegrationRoute fileIntegrationRoute; |
| | | |
| | | @Inject |
| | | private TokenAuthentificationRoute tokenAuthentificationRoute; |
| | | |
| | | @Inject |
| | | private UserActionsRoute userActionsRoute; |
| | | |
| | | @Inject |
| | | private FichierIntegrationLocalRoute fichierIntegrationLocalRoute; |
| | | |
| | | @Inject |
| | | private ReferentielIntegrationLocalRoute referentielIntegrationLocalRoute; |
| | | |
| | | @Inject |
| | | private FichierIntegrationRemoteRoute fichierIntegrationRemoteRoute; |
| | | |
| | | @Inject |
| | | private ReferentielIntegrationRemoteRoute referentielIntegrationRemoteRoute; |
| | | |
| | | @Inject |
| | | private DataIntegrationTimerRoute dataIntegrationTimerRoute; |
| | | |
| | | @Inject |
| | | private MergeTypeFichierBatchDataTimer mergeBatchDataTimer; |
| | | |
| | | @Inject |
| | | private DeleteConsumedFilesTimer deleteConsumedFilesTimer; |
| | | |
| | | @Inject |
| | | private DeleteExpiredTokensTimer deleteExpiredTokensTimer; |
| | | |
| | | @PostConstruct |
| | | public void init() { |
| | | |
| | | try { |
| | | |
| | | addDataSourceToContext(); |
| | | addRabbitMQComponent(); |
| | | |
| | | loadJMSRoutes(); |
| | | loadIntegrationRoutes(); |
| | | loadTimers(); |
| | | |
| | | } catch (Exception ex) { |
| | | Logger.getLogger(CamelBootstrap.class.getName()).log(Level.SEVERE, null, ex); |
| | | } |
| | | |
| | | } |
| | | |
| | | private void loadIntegrationRoutes() throws Exception { |
| | | |
| | | CamelRouteConfiguration camelRouteConfiguration = new CamelRouteConfiguration(AppContext.PROPERTY_FILE_PATH); |
| | | if (camelRouteConfiguration.hasCorrectLocalConfig()) { |
| | | |
| | | loadLocalIntegrationRoutes(); |
| | | |
| | | if (camelRouteConfiguration.hasCorrectStfpConfig()) { |
| | | loadRemoteIntegrationRoutes(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | private void loadRemoteIntegrationRoutes() throws Exception { |
| | | camelContext.addRoutes(fichierIntegrationRemoteRoute); |
| | | camelContext.addRoutes(referentielIntegrationRemoteRoute); |
| | | } |
| | | |
| | | private void loadLocalIntegrationRoutes() throws Exception { |
| | | camelContext.addRoutes(fichierIntegrationLocalRoute); |
| | | camelContext.addRoutes(referentielIntegrationLocalRoute); |
| | | camelContext.addRoutes(fdxStandaloneRoute); |
| | | } |
| | | |
| | | private void loadJMSRoutes() throws Exception { |
| | | camelContext.addRoutes(fileIntegrationRoute); |
| | | camelContext.addRoutes(tokenAuthentificationRoute); |
| | | camelContext.addRoutes(userActionsRoute); |
| | | } |
| | | |
| | | private void loadTimers() throws Exception { |
| | | camelContext.addRoutes(dataIntegrationTimerRoute); |
| | | camelContext.addRoutes(mergeBatchDataTimer); |
| | | camelContext.addRoutes(deleteConsumedFilesTimer); |
| | | camelContext.addRoutes(deleteExpiredTokensTimer); |
| | | } |
| | | |
| | | private void addDataSourceToContext() throws NamingException { |
| | | JdbcComponent jdbcComponent = new JdbcComponent(); |
| | | jdbcComponent.setDataSource(dataSource); |
| | | camelContext.addComponent("jdbc", jdbcComponent); |
| | | } |
| | | |
| | | private void addRabbitMQComponent() throws NamingException { |
| | | |
| | | // Add RabbitMQ Component with connection details |
| | | RabbitMQComponent rabbitMQComponent = new RabbitMQComponent(); |
| | | rabbitMQComponent.setHostname("localhost"); |
| | | rabbitMQComponent.setPortNumber(5672); |
| | | rabbitMQComponent.setPortNumber(5672); |
| | | rabbitMQComponent.setUsername("guest"); |
| | | rabbitMQComponent.setPassword("guest"); |
| | | |
| | | camelContext.addComponent("rabbitmq", rabbitMQComponent); |
| | | } |
| | | |
| | | public static void configuration(@Observes CdiCamelConfiguration configuration) { |
| | | configuration.autoConfigureRoutes(false); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.service.impl.camel; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.RoutageManager; |
| | | import com.megatim.apifdxweb.service.ifaces.camel.ReferentielIntegration; |
| | | import com.megatim.apifdxweb.core.ifaces.integration.ColumnDefinitionManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ApplicationSourceManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ExtensionFichierManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.GroupeNoeudManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.GroupeParticipantManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.NoeudManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ParticipantManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.PaysManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ReferentielManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.StructureLigneManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.TypeFichierManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ValidateurFichierConfigurationManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ValidateurFichierManager; |
| | | import com.megatim.fdxcommons.model.pojo.ReferentielToImportData; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | import org.apache.camel.ProducerTemplate; |
| | | import org.apache.camel.cdi.CdiCamelContext; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class ReferentielIntegrationImpl implements ReferentielIntegration { |
| | | |
| | | @Inject |
| | | private CdiCamelContext camelContext; |
| | | |
| | | @Override |
| | | public void produceDatasFromApi(ReferentielToImportData referentielToImportData) { |
| | | ProducerTemplate producerTemplate = camelContext.createProducerTemplate(); |
| | | producerTemplate.sendBody("jms:topic:referentialIntegrationTopic", referentielToImportData); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.service.impl.camel.component; |
| | | |
| | | import javax.enterprise.context.ApplicationScoped; |
| | | import javax.inject.Inject; |
| | | import org.apache.camel.CamelContext; |
| | | import org.apache.camel.component.kafka.KafkaComponent; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @ApplicationScoped |
| | | public class KafkaComponentConfiguration { |
| | | |
| | | @Inject |
| | | CamelContext camelContext; |
| | | |
| | | @Inject |
| | | public void configureKafkaComponent() { |
| | | KafkaComponent kafkaComponent = new KafkaComponent(); |
| | | kafkaComponent.getConfiguration().setBrokers("localhost:9092"); |
| | | camelContext.addComponent("kafka", kafkaComponent); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.config; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class CamelRouteConfiguration { |
| | | |
| | | private final LocalConfiguration localConfiguration; |
| | | private final SftpConfiguration sftpConfiguration; |
| | | |
| | | public CamelRouteConfiguration(String configurationFilePath) { |
| | | FileProperties fileProperties = new FileProperties(configurationFilePath); |
| | | localConfiguration = new LocalConfiguration(fileProperties); |
| | | sftpConfiguration = new SftpConfiguration(fileProperties); |
| | | } |
| | | |
| | | public boolean hasCorrectLocalConfig() throws IOException { |
| | | return localConfiguration.isCorrect(); |
| | | } |
| | | |
| | | public boolean hasCorrectStfpConfig() throws IOException { |
| | | return sftpConfiguration.isCorrect(); |
| | | } |
| | | |
| | | public LocalConfiguration getLocalConfiguration() { |
| | | return localConfiguration; |
| | | } |
| | | |
| | | public SftpConfiguration getSftpConfiguration() { |
| | | return sftpConfiguration; |
| | | } |
| | | |
| | | public String standaloneTmpURI() throws IOException { |
| | | return hasCorrectStfpConfig() |
| | | ? getSftpConfiguration().standaloneTmpRouteURI() |
| | | : getLocalConfiguration().standaloneTmpRouteURI(); |
| | | } |
| | | |
| | | public String standaloneURI() throws IOException { |
| | | return hasCorrectStfpConfig() |
| | | ? getSftpConfiguration().standaloneRouteURI() |
| | | : getLocalConfiguration().standaloneRouteURI(); |
| | | } |
| | | |
| | | public String standaloneTmpDir() throws IOException { |
| | | return hasCorrectStfpConfig() |
| | | ? getSftpConfiguration().standaloneTmpDir() |
| | | : getLocalConfiguration().standaloneTmpDir(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.config; |
| | | |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Properties; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | class FileProperties { |
| | | |
| | | private final String configurationFilePath; |
| | | private final List<Properties> cachedProperties = new ArrayList<>(1); |
| | | |
| | | public FileProperties(String configurationFilePath) { |
| | | this.configurationFilePath = configurationFilePath; |
| | | } |
| | | |
| | | public Properties properties() throws FileNotFoundException, IOException { |
| | | if (cachedProperties.isEmpty()) { |
| | | try (FileInputStream fis = new FileInputStream(configurationFilePath)) { |
| | | Properties properties = new Properties(); |
| | | properties.load(fis); |
| | | cachedProperties.add(properties); |
| | | } |
| | | } |
| | | return cachedProperties.get(0); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.config; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class LocalConfiguration { |
| | | |
| | | private final FileProperties fileProperties; |
| | | |
| | | public LocalConfiguration(FileProperties fileProperties) { |
| | | this.fileProperties = fileProperties; |
| | | } |
| | | |
| | | public String referentielRouteURI() throws IOException { |
| | | return "file:" + referentielLocalPath() + "?include=.*.zip" + routeParameters(); |
| | | } |
| | | |
| | | public String fichierRouteURI() throws IOException { |
| | | return "file:" + fichierLocalPath() + "?include=.*.txt" + routeParameters(); |
| | | } |
| | | |
| | | public String standaloneTmpRouteURI() throws IOException { |
| | | return "file:" + standaloneTmpDir() + "?include=.*.txt" + routeParameters(); |
| | | } |
| | | |
| | | public String standaloneRouteURI() throws IOException { |
| | | return "file:" + standaloneDestinationDir() + "?include=.*.txt" + routeParameters(); |
| | | } |
| | | |
| | | public String standaloneTmpDir() throws IOException { |
| | | return fileProperties.properties().getProperty("fdx.api.integration-standalone-temp-dir"); |
| | | } |
| | | |
| | | public boolean isCorrect() throws IOException { |
| | | return referentielLocalPath() != null |
| | | && fichierLocalPath() != null |
| | | && standaloneTmpDir() != null |
| | | && standaloneDestinationDir() != null; |
| | | } |
| | | |
| | | private String routeParameters() { |
| | | return "&moveFailed=error&noop=true&readLock=changed"; |
| | | } |
| | | |
| | | public String referentielLocalPath() throws IOException { |
| | | return fileProperties.properties().getProperty("fdx.api.referentiel-integration-local-path"); |
| | | } |
| | | |
| | | public String fichierLocalPath() throws IOException { |
| | | return fileProperties.properties().getProperty("fdx.api.fichier-integration-local-path"); |
| | | } |
| | | |
| | | private String standaloneDestinationDir() throws IOException { |
| | | return fileProperties.properties().getProperty("fdx.api.integration-standalone-destination-dir"); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.config; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | public class SftpConfiguration { |
| | | |
| | | private final FileProperties fileProperties; |
| | | |
| | | public SftpConfiguration(FileProperties fileProperties) { |
| | | this.fileProperties = fileProperties; |
| | | } |
| | | |
| | | public String referentielRouteURI() throws IOException { |
| | | return buildURI(referentielRemotePath()); |
| | | } |
| | | |
| | | public String fichierRouteURI() throws IOException { |
| | | return buildURI(fichierRemotePath()); |
| | | } |
| | | |
| | | public String standaloneRouteURI() throws IOException { |
| | | return buildURI(standaloneDestinationRemotePath()); |
| | | } |
| | | |
| | | public String standaloneTmpRouteURI() throws IOException { |
| | | return "file:" + standaloneTmpDir() + "?include=.*.txt" + routeParameters(); |
| | | } |
| | | |
| | | public String standaloneTmpDir() throws IOException { |
| | | return fileProperties.properties().getProperty("fdx.api.integration-standalone-temp-dir"); |
| | | } |
| | | |
| | | private String routeParameters() { |
| | | return "&moveFailed=error&delete=true&readLock=changed"; |
| | | } |
| | | |
| | | private String buildURI(String path) throws IOException { |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | stringBuilder |
| | | .append(firstURIpart()) |
| | | .append(path) |
| | | .append(secondURIpart()); |
| | | return stringBuilder.toString(); |
| | | } |
| | | |
| | | private String firstURIpart() throws IOException { |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | stringBuilder |
| | | .append("sftp:") |
| | | .append(hostName()) |
| | | .append(":") |
| | | .append(port()) |
| | | .append("/"); |
| | | return stringBuilder.toString(); |
| | | } |
| | | |
| | | private String secondURIpart() throws IOException { |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | stringBuilder |
| | | .append("?username=").append(userName()) |
| | | .append("&password=").append(password()) |
| | | .append("&streamDownload=true&stepwise=false&disconnect=true&useUserKnownHostsFile=false&readLock=changed&readLockLoggingLevel=ERROR") |
| | | .append("&jschLoggingLevel=ERROR&runLoggingLevel=OFF&moveFailed=error&delete=true"); |
| | | return stringBuilder.toString(); |
| | | } |
| | | |
| | | public boolean isCorrect() throws IOException { |
| | | return standaloneRemote() |
| | | && referentielRemotePath() != null |
| | | && fichierRemotePath() != null |
| | | && standaloneDestinationRemotePath() != null |
| | | && userName() != null |
| | | && password() != null |
| | | && hostName() != null; |
| | | } |
| | | |
| | | private String referentielRemotePath() throws IOException { |
| | | return fileProperties.properties().getProperty("fdx.api.referentiel-integration-remote-path"); |
| | | } |
| | | |
| | | private String fichierRemotePath() throws IOException { |
| | | return fileProperties.properties().getProperty("fdx.api.fichier-integration-remote-path"); |
| | | } |
| | | |
| | | private boolean standaloneRemote() throws IOException { |
| | | String remoteIntegrationProperty = fileProperties.properties().getProperty("fdx.integration-standalone-remote"); |
| | | return remoteIntegrationProperty != null && Boolean.parseBoolean(remoteIntegrationProperty); |
| | | } |
| | | |
| | | private String standaloneDestinationRemotePath() throws IOException { |
| | | return fileProperties.properties().getProperty("fdx.api.integration-standalone-destination-dir"); |
| | | } |
| | | |
| | | private String userName() throws IOException { |
| | | return fileProperties.properties().getProperty("fdx.integration-standalone-username"); |
| | | } |
| | | |
| | | private String password() throws IOException { |
| | | return fileProperties.properties().getProperty("fdx.integration-standalone-password"); |
| | | } |
| | | |
| | | private String hostName() throws IOException { |
| | | return fileProperties.properties().getProperty("fdx.integration-standalone-hostname"); |
| | | } |
| | | |
| | | private int port() throws IOException { |
| | | String portProperty = fileProperties.properties().getProperty("fdx.integration-standalone-port"); |
| | | return portProperty != null ? Integer.parseInt(portProperty) : 22; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.consumers; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.administration.UserManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.ParticipantManager; |
| | | import com.megatim.fdxcommons.model.jms.messages.ApiTokenMessage; |
| | | import com.megatim.fdxcommons.model.referentiel.Participant; |
| | | import javax.inject.Inject; |
| | | import org.apache.camel.Handler; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class ApiTokenMessageConsumer { |
| | | |
| | | @Inject |
| | | private UserManager userManager; |
| | | |
| | | @Inject |
| | | private ParticipantManager participantManager; |
| | | |
| | | @Handler |
| | | public void saveTokenAuthentification(ApiTokenMessage apiTokenMessage) throws Exception { |
| | | |
| | | Participant participant = participantManager.getById(apiTokenMessage.getCodeParticipant()); |
| | | if (participant != null) { |
| | | switch (apiTokenMessage.getApiTokenMessageType()) { |
| | | case ADD: |
| | | userManager.addUser(participant, apiTokenMessage.getToken()); |
| | | break; |
| | | case UPDATE: |
| | | userManager.updateUser(participant, apiTokenMessage.getToken()); |
| | | break; |
| | | case LOCKED: |
| | | userManager.lockUser(participant); |
| | | break; |
| | | case UNLOCKED: |
| | | userManager.unLockUser(participant); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.consumers; |
| | | |
| | | import com.megatim.apifdxweb.model.camel.historique.ConsumedFilesHistory; |
| | | import com.megatim.apifdxweb.model.camel.historique.ConsumedFileType; |
| | | import com.megatim.apifdxweb.tools.AppContext; |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProduction; |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProductionSource; |
| | | import com.megatim.fdxcommons.tools.database.connection.DBConnection; |
| | | import com.megatim.fdxcommons.tools.database.tables.FdxApiTable; |
| | | import org.apache.camel.Handler; |
| | | import com.megatim.fdxcommons.tools.integration.ApiIntegrationData; |
| | | import java.sql.Connection; |
| | | import java.sql.SQLException; |
| | | import java.time.LocalDateTime; |
| | | import javax.annotation.Resource; |
| | | import javax.inject.Inject; |
| | | import javax.naming.NamingException; |
| | | import javax.sql.DataSource; |
| | | import org.apache.camel.cdi.CdiCamelContext; |
| | | import com.megatim.apifdxweb.core.ifaces.camel.historique.ConsumedFilesHistoryManager; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public class FichierDataConsumer { |
| | | |
| | | @Resource(lookup = AppContext.JNDI_NAME) |
| | | private DataSource dataSource; |
| | | |
| | | @Inject |
| | | ConsumedFilesHistoryManager fichierHistoriqueManger; |
| | | |
| | | @Inject |
| | | private CdiCamelContext camelContext; |
| | | |
| | | @Handler |
| | | public void saveFileData(ApiIntegrationData integrationData) throws Exception { |
| | | insert(integrationData); |
| | | } |
| | | |
| | | private void insert(ApiIntegrationData integrationData) throws SQLException, NamingException, Exception { |
| | | DataProduction dataProduction = new DataProduction(); |
| | | dataProduction.setDateProduction(LocalDateTime.now()); |
| | | dataProduction.setReferentielVersion(integrationData.getReferentielVersion()); |
| | | dataProduction.setCodeTypeFichier(integrationData.getCodeTypeFichier()); |
| | | dataProduction.setSource(DataProductionSource.FICHIER); |
| | | dataProduction.setFileName(integrationData.getFileName()); |
| | | dataProduction.setFileDate(integrationData.getFileDate()); |
| | | |
| | | try ( Connection connection = new DBConnection(dataSource).connection()) { |
| | | new FdxApiTable(integrationData.getCodeTypeFichier(), |
| | | integrationData.getReferentielVersion(), |
| | | connection) |
| | | .insert(integrationData.getData(), dataProduction); |
| | | } |
| | | insertFichierHistorique(integrationData.getFileName()); |
| | | } |
| | | |
| | | private void insertFichierHistorique(String fileName) { |
| | | ConsumedFilesHistory fichHist = new ConsumedFilesHistory(); |
| | | fichHist.setDateCreation(LocalDateTime.now()); |
| | | fichHist.setFileName(fileName); |
| | | fichHist.setConsumedFileType(ConsumedFileType.DONNEES); |
| | | |
| | | fichierHistoriqueManger.save(fichHist); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.consumers; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.log.UserActionLogManager; |
| | | import com.megatim.fdxcommons.model.log.UserActionLog; |
| | | import javax.inject.Inject; |
| | | import org.apache.camel.Handler; |
| | | import org.apache.camel.ProducerTemplate; |
| | | import org.apache.camel.cdi.CdiCamelContext; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class UserActionLogConsumer { |
| | | |
| | | @Inject |
| | | private UserActionLogManager logManager; |
| | | |
| | | @Inject |
| | | private CdiCamelContext camelContext; |
| | | |
| | | @Handler |
| | | public void process(UserActionLog log) throws Exception { |
| | | |
| | | UserActionLog refreshEntity = logManager.save(log); |
| | | ProducerTemplate producerTemplate = camelContext.createProducerTemplate(); |
| | | |
| | | producerTemplate.sendBody("direct:" + com.megatim.fdxcommons.tools.context.AppContext.USER_ACTION_TO_FDX_CONS_DIRECT, refreshEntity); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.exceptions; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public class BadFileNamePatterException extends Exception { |
| | | |
| | | public BadFileNamePatterException(String fileName) { |
| | | super("Le nom du fichier " + fileName + " n'a pas un format correct"); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.service.impl.camel.exceptions; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class BadFileRefVersionException extends Exception { |
| | | |
| | | public BadFileRefVersionException(String refVersion) { |
| | | super("Les informations du référentiel "+refVersion+" sont inexistantes"); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.exceptions; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public class ReferentielEncoursNotFound extends Exception { |
| | | |
| | | public ReferentielEncoursNotFound() { |
| | | super("Traitement impossible car il n'y a aucun référentiel en cours"); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.service.impl.camel.exceptions; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class TimestampException extends Exception { |
| | | |
| | | public TimestampException(String fileName) { |
| | | super(fileName + " : La date du fichier à consommer doit être ultérieure à la date du précédent fichier consommé"); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.service.impl.camel.filters; |
| | | |
| | | import com.megatim.apifdxweb.model.camel.historique.ConsumedFileType; |
| | | import java.io.File; |
| | | import javax.inject.Inject; |
| | | import org.apache.camel.Exchange; |
| | | import com.megatim.apifdxweb.core.ifaces.camel.historique.ConsumedFilesHistoryManager; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class FileFilter { |
| | | |
| | | @Inject |
| | | ConsumedFilesHistoryManager manager; |
| | | |
| | | public boolean isConsumable(Exchange exchange) { |
| | | File file = exchange.getIn().getBody(File.class); |
| | | final String fileName = file.getName(); |
| | | |
| | | return manager.findByTypeFileName(ConsumedFileType.DONNEES, fileName) == null; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.service.impl.camel.filters; |
| | | |
| | | import com.megatim.apifdxweb.model.camel.historique.ConsumedFileType; |
| | | import java.io.File; |
| | | import javax.inject.Inject; |
| | | import org.apache.camel.Exchange; |
| | | import com.megatim.apifdxweb.core.ifaces.camel.historique.ConsumedFilesHistoryManager; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class ReferentielFilter { |
| | | |
| | | @Inject |
| | | ConsumedFilesHistoryManager manager; |
| | | |
| | | public boolean isConsumable(Exchange exchange) { |
| | | File file = exchange.getIn().getBody(File.class); |
| | | final String fileName = file.getName(); |
| | | |
| | | return manager.findByTypeFileName(ConsumedFileType.REFERENTIEL, fileName) == null ; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.service.impl.camel.processors; |
| | | |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Path; |
| | | import javax.enterprise.context.Dependent; |
| | | import org.apache.camel.Exchange; |
| | | import org.apache.camel.Processor; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class ConsumedFilesProcessor implements Processor { |
| | | |
| | | @Override |
| | | public void process(Exchange exchange) throws Exception { |
| | | Path filePath = exchange.getIn().getBody(Path.class); |
| | | Files.deleteIfExists(filePath); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.processors; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.dataproduction.DataProductionManager; |
| | | import com.megatim.apifdxweb.core.ifaces.helper.FileDataReader; |
| | | import com.megatim.apifdxweb.core.ifaces.integration.ColumnDefinitionManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.TypeFichierManager; |
| | | import com.megatim.apifdxweb.core.ifaces.referentiel.natureproduction.NatureProductionFichierManager; |
| | | import com.megatim.fdxcommons.model.searchentities.ColumnDefinitionSearch; |
| | | import com.megatim.apifdxweb.service.impl.camel.exceptions.BadFileNamePatterException; |
| | | import com.megatim.apifdxweb.service.impl.camel.exceptions.TimestampException; |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProduction; |
| | | import com.megatim.fdxcommons.tools.exceptions.FileTypeNotExistException; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.model.referentiel.TypeFichier; |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProduction; |
| | | import com.megatim.fdxcommons.tools.exceptions.CommonRessourceNotFoundException; |
| | | import com.megatim.fdxcommons.tools.integration.ApiIntegrationData; |
| | | import java.io.File; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | import org.apache.camel.Exchange; |
| | | import org.apache.camel.Processor; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | @Dependent |
| | | public class FichierIntegrationProcessor implements Processor { |
| | | |
| | | @Inject |
| | | private TypeFichierManager typeFichierManager; |
| | | |
| | | @Inject |
| | | private ColumnDefinitionManager columnDefinitionManager; |
| | | |
| | | @Inject |
| | | private FileDataReader fileDataReader; |
| | | |
| | | @Inject |
| | | private DataProductionManager dataProductionManager; |
| | | |
| | | @Inject |
| | | private NatureProductionFichierManager natureProductionFichierManager; |
| | | |
| | | @Override |
| | | public void process(Exchange exchange) throws Exception { |
| | | System.out.println("***********************in FichierIntegrationProcessor"); |
| | | File file = exchange.getIn().getBody(File.class); |
| | | final String fileName = file.getName(); |
| | | |
| | | if (fileName.length() < 12) { |
| | | throw new BadFileNamePatterException(fileName); |
| | | } |
| | | |
| | | String referentielVersion = fileName.substring(0, 6); |
| | | String codeTypeFichier = fileName.substring(6, 12); |
| | | String date = fileName.substring(12, 26); |
| | | LocalDateTime fileDate = LocalDateTime.parse(date, DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); |
| | | |
| | | stopIfTypeFichierNotExists(codeTypeFichier, referentielVersion); |
| | | stopIfFileTimestampBeforeLastPoduction(referentielVersion, codeTypeFichier, fileName, fileDate); |
| | | |
| | | List<LinkedHashMap<String, Object>> data = fileDataReader.getDatas(referentielVersion, codeTypeFichier, file); |
| | | ApiIntegrationData integrationData = new ApiIntegrationData(data, codeTypeFichier, referentielVersion, fileName, fileDate); |
| | | |
| | | exchange.getIn().setBody(integrationData); |
| | | } |
| | | |
| | | private void stopIfTypeFichierNotExists(String codeTypeFichier, String referentielVersion) throws FileTypeNotExistException { |
| | | TypeFichier typeFich = typeFichierManager.getById(codeTypeFichier); |
| | | |
| | | if (typeFich == null) { |
| | | throw new CommonRessourceNotFoundException("TypeFichier '" + codeTypeFichier + "' inexistant"); |
| | | } |
| | | System.out.println("******************************"); |
| | | System.out.println("codeTypeFichier : " + codeTypeFichier + ", referentielVersion : " + referentielVersion); |
| | | ColumnDefinitionSearch searchEntity = new ColumnDefinitionSearch(); |
| | | searchEntity.setCodeTypeFichier(codeTypeFichier); |
| | | searchEntity.setReferentielVersion(referentielVersion); |
| | | |
| | | System.out.println("before call to getAll"); |
| | | List<ColumnDefinition> colDefs = columnDefinitionManager.getAll(searchEntity); |
| | | System.out.println("after call to getAll"); |
| | | System.out.println("******************************"); |
| | | |
| | | if (colDefs == null || colDefs.isEmpty()) { |
| | | throw new CommonRessourceNotFoundException("La structure du typeFichier '" + codeTypeFichier + "' est introuvable"); |
| | | } |
| | | } |
| | | |
| | | private void stopIfFileTimestampBeforeLastPoduction(String referentielVersion, String codeTypeFichier, String fileName, LocalDateTime dateTime) throws TimestampException { |
| | | NatureProduction natureProd = natureProductionFichierManager.getNatureProduction(codeTypeFichier, referentielVersion); |
| | | |
| | | if (natureProd.equals(NatureProduction.REFERENTIELLE)) { |
| | | DataProduction lastDataProduction = dataProductionManager.lastProduction(referentielVersion, codeTypeFichier); |
| | | |
| | | if (lastDataProduction != null |
| | | && (dateTime.equals(lastDataProduction.getFileDate()) || dateTime.isBefore(lastDataProduction.getFileDate()))) { |
| | | throw new TimestampException(fileName); |
| | | } |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.processors; |
| | | |
| | | import com.megatim.fdxcommons.core.ifaces.db.ImportReferentielHelper; |
| | | import com.megatim.fdxcommons.core.ifaces.helper.ReferentielConsumptionHelper; |
| | | import com.megatim.fdxcommons.model.pojo.ReferentielToImportData; |
| | | import java.io.File; |
| | | import javax.inject.Inject; |
| | | import org.apache.camel.Exchange; |
| | | import org.apache.camel.Processor; |
| | | import org.apache.camel.cdi.CdiCamelContext; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public class ReferentielProcessor implements Processor { |
| | | |
| | | @Inject |
| | | private ReferentielConsumptionHelper referentielConsumptionHelper; |
| | | |
| | | @Inject |
| | | private ImportReferentielHelper importReferentielHelper; |
| | | |
| | | @Inject |
| | | private CdiCamelContext camelContext; |
| | | |
| | | @Override |
| | | public void process(Exchange exchange) throws Exception { |
| | | |
| | | File file = exchange.getIn().getBody(File.class); |
| | | |
| | | ReferentielToImportData referentielToImportData = importReferentielHelper.extractData(file); |
| | | |
| | | //On enregistre les données de référentiel trouvées |
| | | referentielConsumptionHelper.consume(referentielToImportData); |
| | | |
| | | //Envoie des données du ref vers une file |
| | | exchange.getIn().setBody(referentielToImportData); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.routes.in; |
| | | |
| | | import com.megatim.apifdxweb.service.impl.camel.processors.FichierIntegrationProcessor; |
| | | import com.megatim.apifdxweb.service.impl.camel.config.CamelRouteConfiguration; |
| | | import com.megatim.apifdxweb.service.impl.camel.config.LocalConfiguration; |
| | | import com.megatim.apifdxweb.service.impl.camel.consumers.FichierDataConsumer; |
| | | import com.megatim.apifdxweb.service.impl.camel.filters.FileFilter; |
| | | import com.megatim.apifdxweb.tools.AppContext; |
| | | import javax.inject.Inject; |
| | | import org.apache.camel.builder.RouteBuilder; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class FichierIntegrationLocalRoute extends RouteBuilder { |
| | | |
| | | @Inject |
| | | private FichierIntegrationProcessor fichierIntegrationProcessor; |
| | | |
| | | @Override |
| | | public void configure() throws Exception { |
| | | |
| | | LocalConfiguration localConfiguration = new CamelRouteConfiguration(AppContext.PROPERTY_FILE_PATH).getLocalConfiguration(); |
| | | |
| | | onException(Exception.class) |
| | | .handled(true) |
| | | .log("Exception occured: ${exception.message}") |
| | | .logStackTrace(true) |
| | | .end(); |
| | | |
| | | from(localConfiguration.fichierRouteURI()) |
| | | .log("*************************In FichierIntegrationLocalRoute") |
| | | .transacted() |
| | | .filter() |
| | | .method(FileFilter.class, "isConsumable") |
| | | .process(fichierIntegrationProcessor) |
| | | .bean(FichierDataConsumer.class); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.routes.in; |
| | | |
| | | import com.megatim.apifdxweb.service.impl.camel.config.CamelRouteConfiguration; |
| | | import com.megatim.apifdxweb.service.impl.camel.config.LocalConfiguration; |
| | | import com.megatim.apifdxweb.service.impl.camel.config.SftpConfiguration; |
| | | import com.megatim.apifdxweb.tools.AppContext; |
| | | import javax.enterprise.context.Dependent; |
| | | import org.apache.camel.builder.RouteBuilder; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | @Dependent |
| | | public class FichierIntegrationRemoteRoute extends RouteBuilder { |
| | | |
| | | @Override |
| | | public void configure() throws Exception { |
| | | |
| | | CamelRouteConfiguration camelRouteConfiguration = new CamelRouteConfiguration(AppContext.PROPERTY_FILE_PATH); |
| | | LocalConfiguration localConfiguration = camelRouteConfiguration.getLocalConfiguration(); |
| | | SftpConfiguration sftpConfiguration = camelRouteConfiguration.getSftpConfiguration(); |
| | | |
| | | onException(Exception.class) |
| | | .handled(true) |
| | | .log("Exception occured: ${exception.message}") |
| | | .end(); |
| | | |
| | | from(sftpConfiguration.fichierRouteURI()) |
| | | .to(localConfiguration.fichierRouteURI()); |
| | | |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.routes.in; |
| | | |
| | | import com.megatim.apifdxweb.service.impl.camel.config.CamelRouteConfiguration; |
| | | import com.megatim.apifdxweb.service.impl.camel.config.LocalConfiguration; |
| | | import com.megatim.apifdxweb.service.impl.camel.filters.ReferentielFilter; |
| | | import com.megatim.apifdxweb.service.impl.camel.processors.ReferentielProcessor; |
| | | import com.megatim.fdxcommons.model.pojo.ReferentielToImportData; |
| | | import com.megatim.fdxcommons.tools.context.AppContext; |
| | | import com.megatim.fdxcommons.tools.resolvers.JacksonMapperFormat; |
| | | import java.util.concurrent.RejectedExecutionException; |
| | | import javax.inject.Inject; |
| | | import org.apache.camel.builder.RouteBuilder; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class ReferentielIntegrationLocalRoute extends RouteBuilder { |
| | | |
| | | @Inject |
| | | private ReferentielProcessor referentielProcessor; |
| | | |
| | | @Override |
| | | public void configure() throws Exception { |
| | | |
| | | LocalConfiguration localConfiguration |
| | | = new CamelRouteConfiguration(com.megatim.apifdxweb.tools.AppContext.PROPERTY_FILE_PATH).getLocalConfiguration(); |
| | | |
| | | onException(IllegalArgumentException.class) |
| | | .process(exchange -> { |
| | | exchange.getException().printStackTrace(); |
| | | }) |
| | | .handled(true); |
| | | |
| | | onException(RejectedExecutionException.class) |
| | | .log("Caught RejectedExecutionException: ${exception.message}") |
| | | .handled(true); |
| | | |
| | | from(localConfiguration.referentielRouteURI()) |
| | | .filter() |
| | | .method(ReferentielFilter.class, "isConsumable") |
| | | .process(referentielProcessor) |
| | | .marshal(JacksonMapperFormat.jacksonDataFormat(ReferentielToImportData.class)) |
| | | .to("rabbitmq:" |
| | | + AppContext.REFERENTIEL_INTEGRATION_EXCHANGE |
| | | + "?queue=" + AppContext.REFERENTIEL_INTEGRATION_QUEUE |
| | | + "&routingKey=" + AppContext.REFERENTIEL_INTEGRATION_ROUTING_KEY |
| | | + "&autoDelete=false"); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.routes.in; |
| | | |
| | | import com.megatim.apifdxweb.service.impl.camel.config.CamelRouteConfiguration; |
| | | import com.megatim.apifdxweb.service.impl.camel.config.LocalConfiguration; |
| | | import com.megatim.apifdxweb.service.impl.camel.config.SftpConfiguration; |
| | | import com.megatim.apifdxweb.tools.AppContext; |
| | | import javax.enterprise.context.Dependent; |
| | | import org.apache.camel.builder.RouteBuilder; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | @Dependent |
| | | public class ReferentielIntegrationRemoteRoute extends RouteBuilder { |
| | | |
| | | @Override |
| | | public void configure() throws Exception { |
| | | |
| | | CamelRouteConfiguration camelRouteConfiguration = new CamelRouteConfiguration(AppContext.PROPERTY_FILE_PATH); |
| | | LocalConfiguration localConfiguration = camelRouteConfiguration.getLocalConfiguration(); |
| | | SftpConfiguration sftpConfiguration = camelRouteConfiguration.getSftpConfiguration(); |
| | | |
| | | onException(Exception.class) |
| | | .handled(true) |
| | | .log("Exception occured: ${exception.message}") |
| | | .end(); |
| | | |
| | | from(sftpConfiguration.referentielRouteURI()) |
| | | .to(localConfiguration.referentielRouteURI()); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.routes.in; |
| | | |
| | | import com.megatim.apifdxweb.service.impl.camel.consumers.ApiTokenMessageConsumer; |
| | | import com.megatim.fdxcommons.model.jms.messages.ApiTokenMessage; |
| | | import com.megatim.fdxcommons.tools.CommonAppContext; |
| | | import com.megatim.fdxcommons.tools.resolvers.JacksonMapperFormat; |
| | | import javax.enterprise.context.ApplicationScoped; |
| | | import org.apache.camel.builder.RouteBuilder; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @ApplicationScoped |
| | | public class TokenAuthentificationRoute extends RouteBuilder { |
| | | |
| | | @Override |
| | | public void configure() throws Exception { |
| | | |
| | | onException(Exception.class) |
| | | .process(exchange -> { |
| | | exchange.getException().printStackTrace(); |
| | | }) |
| | | .handled(true); |
| | | |
| | | from("rabbitmq:" |
| | | + CommonAppContext.TOKEN_GENERATION_EXCHANGE |
| | | + "?queue=" + CommonAppContext.TOKEN_GENERATION_QUEUE |
| | | + "&routingKey=" + CommonAppContext.TOKEN_GENERATION_ROUTING_KEY |
| | | + "&autoDelete=false") |
| | | .transacted() |
| | | .unmarshal(JacksonMapperFormat.jacksonDataFormat(ApiTokenMessage.class)) |
| | | .bean(ApiTokenMessageConsumer.class); |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.routes.in; |
| | | |
| | | import com.megatim.apifdxweb.service.impl.camel.consumers.UserActionLogConsumer; |
| | | import com.megatim.apifdxweb.tools.AppContext; |
| | | import com.megatim.fdxcommons.model.log.UserActionLog; |
| | | import com.megatim.fdxcommons.tools.resolvers.JacksonMapperFormat; |
| | | import javax.enterprise.context.ApplicationScoped; |
| | | import org.apache.camel.builder.RouteBuilder; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @ApplicationScoped |
| | | public class UserActionsRoute extends RouteBuilder { |
| | | |
| | | @Override |
| | | public void configure() throws Exception { |
| | | |
| | | from("direct:" + AppContext.API_USER_ACTION_DIRECT) |
| | | .marshal(JacksonMapperFormat.jacksonDataFormat(UserActionLog.class)) |
| | | .to("rabbitmq:" |
| | | + AppContext.API_USER_ACTION_EXCHANGE |
| | | + "?queue=" + AppContext.API_USER_ACTION_QUEUE |
| | | + "&routingKey=" + AppContext.API_USER_ACTION_ROUTING_KEY |
| | | + "&autoDelete=false"); |
| | | |
| | | from("rabbitmq:" |
| | | + AppContext.API_USER_ACTION_EXCHANGE |
| | | + "?queue=" + AppContext.API_USER_ACTION_QUEUE |
| | | + "&routingKey=" + AppContext.API_USER_ACTION_ROUTING_KEY |
| | | + "&autoDelete=false") |
| | | .unmarshal(JacksonMapperFormat.jacksonDataFormat(UserActionLog.class)) |
| | | .bean(UserActionLogConsumer.class); |
| | | |
| | | from("direct:" + com.megatim.fdxcommons.tools.context.AppContext.USER_ACTION_TO_FDX_CONS_DIRECT) |
| | | .marshal(JacksonMapperFormat.jacksonDataFormat(UserActionLog.class)) |
| | | .to("rabbitmq:" |
| | | + com.megatim.fdxcommons.tools.context.AppContext.USER_ACTION_TO_FDX_CONS_EXCHANGE |
| | | + "?queue=" + com.megatim.fdxcommons.tools.context.AppContext.USER_ACTION_TO_FDX_CONS_QUEUE |
| | | + "&routingKey=" + com.megatim.fdxcommons.tools.context.AppContext.USER_ACTION_TO_FDX_CONS_ROUTING_KEY |
| | | + "&autoDelete=false"); |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.routes.out; |
| | | |
| | | import com.megatim.apifdxweb.service.impl.camel.config.CamelRouteConfiguration; |
| | | import com.megatim.apifdxweb.tools.AppContext; |
| | | import javax.enterprise.context.ApplicationScoped; |
| | | import org.apache.camel.builder.RouteBuilder; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @ApplicationScoped |
| | | public class FdxStandaloneRoute extends RouteBuilder { |
| | | |
| | | @Override |
| | | public void configure() throws Exception { |
| | | |
| | | CamelRouteConfiguration camelRouteConfiguration |
| | | = new CamelRouteConfiguration(AppContext.PROPERTY_FILE_PATH); |
| | | |
| | | onException(IllegalArgumentException.class) |
| | | .handled(true) |
| | | .log("Exception occured: ${exception.message}") |
| | | .logStackTrace(true) |
| | | .end(); |
| | | |
| | | from(camelRouteConfiguration.standaloneTmpURI()) |
| | | .to(camelRouteConfiguration.standaloneURI()); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.routes.out; |
| | | |
| | | import com.megatim.apifdxweb.tools.AppContext; |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProduction; |
| | | import com.megatim.fdxcommons.model.enumeration.StatutDataProduction; |
| | | import com.megatim.fdxcommons.tools.integration.FdxConsultationIntegrationData; |
| | | import com.megatim.fdxcommons.tools.integration.dto.FdxConsultationIntegrationDataDto; |
| | | import com.megatim.fdxcommons.tools.resolvers.JacksonMapperFormat; |
| | | import java.time.LocalDateTime; |
| | | import javax.enterprise.context.ApplicationScoped; |
| | | import org.apache.camel.builder.RouteBuilder; |
| | | import org.apache.camel.jta.JtaTransactionErrorHandlerBuilder; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | @ApplicationScoped |
| | | public class FileIntegrationRoute extends RouteBuilder { |
| | | |
| | | @Override |
| | | public void configure() throws Exception { |
| | | |
| | | JtaTransactionErrorHandlerBuilder transactionErrorHandler = new JtaTransactionErrorHandlerBuilder(); |
| | | errorHandler(transactionErrorHandler); |
| | | |
| | | onException(Exception.class) |
| | | .handled(true) |
| | | .log("Exception occured: ${exception.message}") |
| | | .logStackTrace(true) |
| | | .end(); |
| | | |
| | | from("direct:" + AppContext.DATA_TO_API_DIRECT) |
| | | .transacted() |
| | | .marshal(JacksonMapperFormat.jacksonDataFormat(FdxConsultationIntegrationDataDto.class)) |
| | | .to("rabbitmq:" |
| | | + com.megatim.fdxcommons.tools.context.AppContext.DATA_INTEGRATION_EXCHANGE |
| | | + "?queue=" + com.megatim.fdxcommons.tools.context.AppContext.DATA_INTEGRATION_QUEUE |
| | | + "&routingKey=" + com.megatim.fdxcommons.tools.context.AppContext.DATA_INTEGRATION_ROUTING_KEY |
| | | + "&autoDelete=false") |
| | | .unmarshal(JacksonMapperFormat.jacksonDataFormat(FdxConsultationIntegrationDataDto.class)) |
| | | .process(ex -> { |
| | | |
| | | FdxConsultationIntegrationDataDto dto = ex.getIn().getBody(FdxConsultationIntegrationDataDto.class); |
| | | FdxConsultationIntegrationData integrationData = new FdxConsultationIntegrationData(dto.getRows(), dto.getDataProduction()); |
| | | ex.getIn().setHeader("id", integrationData.getDataProduction().getId()); |
| | | ex.getIn().setHeader("statutDataProduction", StatutDataProduction.CONSOMME.name()); |
| | | ex.getIn().setHeader("dateMiseAJour", LocalDateTime.now()); |
| | | |
| | | String query = "UPDATE " + DataProduction.class.getSimpleName().toLowerCase() |
| | | + " SET statutDataProduction= :?statutDataProduction, dateMiseAJour = :?dateMiseAJour" |
| | | + " WHERE id = :?id"; |
| | | |
| | | ex.getIn().setBody(query); |
| | | }) |
| | | .to("jdbc:datasource?useHeadersAsParameters=true&resetAutoCommit=false") |
| | | .end(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.routes.timers; |
| | | |
| | | import com.megatim.apifdxweb.service.ifaces.scheduler.TypeFichierDataJob; |
| | | import com.megatim.apifdxweb.tools.AppContext; |
| | | import javax.inject.Inject; |
| | | import org.apache.camel.builder.RouteBuilder; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class DataIntegrationTimerRoute extends RouteBuilder { |
| | | |
| | | @Inject |
| | | private TypeFichierDataJob typeFichierDataJob; |
| | | |
| | | @Override |
| | | public void configure() throws Exception { |
| | | |
| | | onException(Exception.class) |
| | | .handled(true) |
| | | .log("Exception occured: ${exception.message}") |
| | | .logStackTrace(true) |
| | | .end(); |
| | | |
| | | from("timer://" + AppContext.DATA_INTEGRATION_TIMER + "?period=30000&delay=0&fixedRate=false&synchronous=true") |
| | | .log("*************************** In " + AppContext.DATA_INTEGRATION_TIMER) |
| | | .throttle(1) |
| | | .bean(typeFichierDataJob); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.routes.timers; |
| | | |
| | | import com.megatim.apifdxweb.service.ifaces.scheduler.DeleteConsumedFilesJob; |
| | | import com.megatim.apifdxweb.tools.AppContext; |
| | | import javax.inject.Inject; |
| | | import org.apache.camel.builder.RouteBuilder; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class DeleteConsumedFilesTimer extends RouteBuilder { |
| | | |
| | | @Inject |
| | | private DeleteConsumedFilesJob deleteConsumedFilesJob; |
| | | |
| | | @Override |
| | | public void configure() throws Exception { |
| | | |
| | | onException(Exception.class) |
| | | .handled(true) |
| | | .log("Exception occured: ${exception.message}") |
| | | .logStackTrace(true) |
| | | .end(); |
| | | |
| | | from("timer://" + AppContext.DELETE_CONSUMED_FILES_TIMER + "?period=60000&delay=0&fixedRate=false&synchronous=true") |
| | | // .log("*************************** In " + AppContext.DELETE_CONSUMED_FILES_TIMER) |
| | | .throttle(1) |
| | | .bean(deleteConsumedFilesJob); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.routes.timers; |
| | | |
| | | import com.megatim.apifdxweb.service.ifaces.scheduler.TypeFichierDataTmpJob; |
| | | import com.megatim.apifdxweb.tools.AppContext; |
| | | import javax.inject.Inject; |
| | | import org.apache.camel.builder.RouteBuilder; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class DeleteExpiredTokensTimer extends RouteBuilder { |
| | | |
| | | @Inject |
| | | private TypeFichierDataTmpJob dataTmpJob; |
| | | |
| | | @Override |
| | | public void configure() throws Exception { |
| | | |
| | | onException(Exception.class) |
| | | .handled(true) |
| | | .log("Exception occured: ${exception.message}") |
| | | .logStackTrace(true) |
| | | .end(); |
| | | |
| | | from("timer://" + AppContext.DELETE_EXPIRED_TOKENS_TIMER + "?period=30000&delay=0&fixedRate=false&synchronous=true") |
| | | // .log("*************************** In " + AppContext.DELETE_EXPIRED_TOKENS_TIMER) |
| | | .throttle(1) |
| | | .bean(dataTmpJob, "deleteExpiredTokens"); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.camel.routes.timers; |
| | | |
| | | import com.megatim.apifdxweb.service.ifaces.scheduler.TypeFichierDataTmpJob; |
| | | import com.megatim.apifdxweb.tools.AppContext; |
| | | import javax.inject.Inject; |
| | | import org.apache.camel.builder.RouteBuilder; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class MergeTypeFichierBatchDataTimer extends RouteBuilder { |
| | | |
| | | @Inject |
| | | private TypeFichierDataTmpJob dataTmpJob; |
| | | |
| | | @Override |
| | | public void configure() throws Exception { |
| | | |
| | | onException(Exception.class) |
| | | .handled(true) |
| | | .log("Exception occured: ${exception.message}") |
| | | .logStackTrace(true) |
| | | .end(); |
| | | |
| | | from("timer://" + AppContext.MERGE_BATCH_DATA_TIMER + "?period=30000&delay=0&fixedRate=false&synchronous=true") |
| | | // .log("*************************** In " + AppContext.MERGE_BATCH_DATA_TIMER) |
| | | .throttle(1) |
| | | .bean(dataTmpJob, "mergeData"); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.service.impl.connexion; |
| | | |
| | | import javax.annotation.security.PermitAll; |
| | | import javax.ws.rs.POST; |
| | | import javax.ws.rs.Path; |
| | | import javax.ws.rs.Produces; |
| | | import javax.ws.rs.core.MediaType; |
| | | import javax.ws.rs.core.Response; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Path("connexion") |
| | | public class ConnexionRS { |
| | | |
| | | public ConnexionRS() { |
| | | } |
| | | |
| | | @POST |
| | | @Produces({MediaType.APPLICATION_JSON}) |
| | | @Path("test") |
| | | @PermitAll |
| | | public Response tesConnexion() { |
| | | return Response.ok().build(); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.dataconsumption; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.administration.UserManager; |
| | | import com.megatim.apifdxweb.core.ifaces.helper.DataConsumptionOperations; |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.service.ifaces.dataconsumption.DataConsumptionRS; |
| | | import com.megatim.fdxcommons.model.pojo.CriteriaEntityFromView; |
| | | import com.megatim.fdxcommons.model.pojo.PageData; |
| | | import com.mgt.rs.security.core.common.AuthenticatedUser; |
| | | import com.mgt.rs.security.core.common.SecuredClass; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import io.swagger.annotations.ApiResponses; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import javax.enterprise.context.RequestScoped; |
| | | import javax.enterprise.event.Observes; |
| | | import javax.inject.Inject; |
| | | import javax.ws.rs.Path; |
| | | import javax.ws.rs.core.HttpHeaders; |
| | | import javax.ws.rs.core.Response; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | @SecuredClass(module = "Consommation des fichiers", path = "consommation des fichiers", description = "Sécurisation des endpoints de l'API Fdx") |
| | | @RequestScoped |
| | | @Path("consume") |
| | | @Api(value = "Ressources de consommation des fichiers échangés") |
| | | public class DataConsumptionRSImpl implements DataConsumptionRS { |
| | | |
| | | @Inject |
| | | private DataConsumptionOperations dataConsumptionOperations; |
| | | |
| | | @Inject |
| | | private UserManager userManager; |
| | | |
| | | private String codeParticipant; |
| | | |
| | | public DataConsumptionRSImpl() { |
| | | super(); |
| | | } |
| | | |
| | | public void handleAuthenticationEvent(@Observes @AuthenticatedUser String connectedUserName) { |
| | | User user = userManager.recuperUtilisateur(connectedUserName); |
| | | this.codeParticipant = user != null ? user.getParticipant().getCode() : null; |
| | | } |
| | | |
| | | @Override |
| | | @ApiOperation(value = "Consommation de toutes les données du type de fichier indiqué en paramètre", |
| | | notes = "Cette méthode renvoie toutes les données du type de fichier indiqué en paramètre. " |
| | | + "Les données sont renvoyées sous la forme d'un objet dont les clés sont les colonnes du type de fichier tel qu'indiqué dans le manuel" |
| | | ) |
| | | @ApiResponses(value = { |
| | | @ApiResponse(code = 200, message = "Données renvoyées avec succès"), |
| | | @ApiResponse(code = 401, message = "L'appelant n'a pas accès à la ressource"), |
| | | @ApiResponse(code = 403, message = "Le participant qui soumet la requête n'est pas autorisée à consommer les données du type de fichier indiqué en paramètre"), |
| | | @ApiResponse(code = 404, message = "Une ressource est introuvable (Type Fichier, Référentiel en cours, Participant associé à l'utilisateur qui exécute la requête)"),}) |
| | | public Response findAll( |
| | | HttpHeaders headers, |
| | | @ApiParam(value = "Le type de fichier pour lequel on désire effectuer l'opération de consommation des lignes", required = true) String codeTypeFichier |
| | | ) { |
| | | |
| | | List<Map<String, Object>> listeMap = dataConsumptionOperations.loadAll(codeTypeFichier, codeParticipant); |
| | | return Response.ok(listeMap).build(); |
| | | } |
| | | |
| | | @Override |
| | | @ApiOperation(value = "Consommation des données du type de fichier indiqué en paramètre, selon des critères de sélection", |
| | | notes = "Cette méthode renvoie des données respectant les critères définis dans le corps de la requête et associées au type de fichier indiqué en paramètre. " |
| | | + "Les données sont renvoyées sous la forme d'un objet dont les clés sont les colonnes du type de fichier indiqué dans le manuel." |
| | | ) |
| | | @ApiResponses(value = { |
| | | @ApiResponse(code = 200, message = "Données renvoyées avec succès"), |
| | | @ApiResponse(code = 401, message = "L'appelant n'a pas accès à la ressource"), |
| | | @ApiResponse(code = 403, message = "Le participant qui soumet la requête n'est pas autorisée à consommer les données du type de fichier indiqué en paramètre"), |
| | | @ApiResponse(code = 404, message = "Une ressource est introuvable (Type Fichier, Référentiel en cours, Participant associé à l'utilisateur qui exécute la requête)"), |
| | | @ApiResponse(code = 422, message = "Les critères de sélection de la requête ne sont pas conformes à la structure des champs du type de fichier"),}) |
| | | public Response findByCriterias( |
| | | HttpHeaders headers, |
| | | @ApiParam(value = "Le type de fichier pour lequel on désire effectuer l'opération de consommation des lignes selon un ensemble de critères", required = true) String codeTypeFichier, |
| | | CriteriaEntityFromView criterion |
| | | ) { |
| | | List<Map<String, Object>> listeMap = dataConsumptionOperations.findByCriterias(codeTypeFichier, criterion, codeParticipant); |
| | | return Response.ok(listeMap).build(); |
| | | } |
| | | |
| | | @Override |
| | | @ApiOperation(value = "Consommation de toutes lignes ajoutées ou mises à jour après la dernière consommation pour le type de fichier en paramètre", |
| | | notes = "Cette méthode renvoie la liste de toutes les lignes ajoutées ou mises à jour après la dernière consultation par le noeud " |
| | | + "qui effectue la requête pour le type de fichier indiqué en paramètres." |
| | | + "Les lignes renvoyés sont sous la forme d'un objet dont les clés sont les colonnes du type de fichier indiqué dans le manuel." |
| | | ) |
| | | @ApiResponses(value = { |
| | | @ApiResponse(code = 200, message = "Données renvoyées avec succès"), |
| | | @ApiResponse(code = 401, message = "L'appelant n'a pas accès à la ressource"), |
| | | @ApiResponse(code = 403, message = "Consommation de la donnée non autorisée pour le noeud associé à l'utilisateur qui exécute la requête"), |
| | | @ApiResponse(code = 404, message = "Une ressource est introuvable (Type Fichier, Référentiel en cours, Noeud associé à l'utilisateur qui exécute la requête)"),}) |
| | | public Response loadAllAddedAndUpdated( |
| | | HttpHeaders headers, |
| | | @ApiParam(value = "Le type de fichier pour lequel on désire effectuer l'opération de consommation des lignes ajoutées et mises à jour", required = true) String codeTypeFichier |
| | | ) { |
| | | List<Map<String, Object>> listeMap = dataConsumptionOperations.loadAllAddedAndUpdated(codeTypeFichier, codeParticipant); |
| | | return Response.ok(listeMap).build(); |
| | | } |
| | | |
| | | // @Override |
| | | // @ApiOperation(value = "Consommation des lignes mises à jour après la dernière consommation pour le type de fichier en paramètre", |
| | | // notes = "Cette méthode renvoie la liste de toutes les lignes mises à jour après la dernière consultation par le noeud " |
| | | // + "qui effectue la requête pour le type de fichier indiqué en paramètres." |
| | | // + "Les lignes renvoyés sont sous la forme d'un objet dont les clés sont les colonnes du type de fichier indiqué dans le manuel." |
| | | // ) |
| | | // @ApiResponses(value = { |
| | | // @ApiResponse(code = 200, message = "Données renvoyées avec succès"), |
| | | // @ApiResponse(code = 401, message = "L'appelant n'a pas accès à la ressource"), |
| | | // @ApiResponse(code = 403, message = "Consommation de la donnée non autorisée pour le noeud associé à l'utilisateur qui exécute la requête"), |
| | | // @ApiResponse(code = 404, message = "Une ressource est introuvable (Type Fichier, Référentiel en cours, Noeud associé à l'utilisateur qui exécute la requête)"),}) |
| | | // public Response loadAllUpdated( |
| | | // HttpHeaders headers, |
| | | // @ApiParam(value = "Le type de fichier pour lequel on désire effectuer l'opération de consommation des lignes mises à jour", required = true) String codeTypeFichier |
| | | // ) { |
| | | // List<Map<String, Object>> listeMap = dataConsumptionOperations.loadAllUpdated(codeTypeFichier, codeParticipant); |
| | | // return Response.ok(listeMap).build(); |
| | | // } |
| | | @Override |
| | | @ApiOperation(value = "Décompte des lignes mises à jour après la dernière consommation pour le type de fichier en paramètre", |
| | | notes = "Cette méthode renvoie le nombre de lignes mises à jour après la dernière consultation par le noeud " |
| | | + "qui effectue la requête pour le type de fichier indiqué en paramètres." |
| | | + "Les lignes renvoyés sont sous la forme d'un objet dont les clés sont les colonnes du type de fichier indiqué dans le manuel." |
| | | ) |
| | | @ApiResponses(value = { |
| | | @ApiResponse(code = 200, message = "Décompte effectué avec succès"), |
| | | @ApiResponse(code = 401, message = "L'appelant n'a pas accès à la ressource"), |
| | | @ApiResponse(code = 403, message = "Consommation de la donnée non autorisée pour le noeud associé à l'utilisateur qui exécute la requête"), |
| | | @ApiResponse(code = 404, message = "Une ressource est introuvable (Type Fichier, Référentiel en cours, Noeud associé à l'utilisateur qui exécute la requête)"),}) |
| | | public Response countAll(HttpHeaders headers, String codeTypeFichier) { |
| | | return Response.ok(dataConsumptionOperations.countAll(codeTypeFichier, codeParticipant)).build(); |
| | | } |
| | | |
| | | @Override |
| | | @ApiOperation(value = "Décompte des lignes mises à jour après la dernière consommation pour le type de fichier en paramètre", |
| | | notes = "Cette méthode renvoie le nombre de lignes mises à jour après la dernière consultation par le noeud " |
| | | + "qui effectue la requête pour le type de fichier indiqué en paramètres." |
| | | + "Les lignes renvoyés sont sous la forme d'un objet dont les clés sont les colonnes du type de fichier indiqué dans le manuel." |
| | | ) |
| | | @ApiResponses(value = { |
| | | @ApiResponse(code = 200, message = "Décompte effectué avec succès"), |
| | | @ApiResponse(code = 401, message = "L'appelant n'a pas accès à la ressource"), |
| | | @ApiResponse(code = 403, message = "Consommation de la donnée non autorisée pour le noeud associé à l'utilisateur qui exécute la requête"), |
| | | @ApiResponse(code = 404, message = "Une ressource est introuvable (Type Fichier, Référentiel en cours, Noeud associé à l'utilisateur qui exécute la requête)"),}) |
| | | public Response countAllAddedAndUpdated(HttpHeaders headers, String codeTypeFichier) { |
| | | return Response.ok(dataConsumptionOperations.countAllLoadedOrUpdated(codeTypeFichier, codeParticipant)).build(); |
| | | } |
| | | |
| | | @Override |
| | | @ApiOperation(value = "Consommation de toutes lignes d'un type de fichier pour le type de fichier en paramètre", |
| | | notes = "Cette méthode renvoie la liste de toutes les lignes associées au type de fichier indiqué en paramètre. " |
| | | + "Les lignes renvoyés sont sous la forme d'un objet dont les clés sont les colonnes du type de fichier indiqué dans le manuel" |
| | | ) |
| | | @ApiResponses(value = { |
| | | @ApiResponse(code = 200, message = "Données renvoyées avec succès"), |
| | | @ApiResponse(code = 401, message = "L'appelant n'a pas accès à la ressource"), |
| | | @ApiResponse(code = 403, message = "Consommation de la donnée non autorisée pour le noeud associé à l'utilisateur qui exécute la requête"), |
| | | @ApiResponse(code = 404, message = "Une ressource est introuvable (Type Fichier, Référentiel en cours, Noeud associé à l'utilisateur qui exécute la requête)"),}) |
| | | public Response loadAllWithPagination( |
| | | HttpHeaders headers, |
| | | @ApiParam(value = "Le type de fichier pour lequel on désire effectuer l'opération de consommation des lignes", required = true) String codeTypeFichier, |
| | | @ApiParam(value = "Le numéro de page ciblée", required = true) Integer pageNumber, |
| | | @ApiParam(value = "Le nombre d'éléments par page", required = true) Integer pageSize |
| | | ) { |
| | | |
| | | PageData pageData = dataConsumptionOperations.loadAllWithPagination(codeTypeFichier, codeParticipant, pageNumber, pageSize); |
| | | return Response.ok(pageData).build(); |
| | | } |
| | | |
| | | @Override |
| | | @ApiOperation(value = "Consommation de toutes lignes d'un type de fichier selon des critères de sélection pour le type de fichier en paramètre", |
| | | notes = "Cette méthode renvoie la liste de toutes les lignes respectant les critères définis dans le corps de la requête et associées au type de fichier indiqué en paramètre. " |
| | | + "Les lignes renvoyés sont sous la forme d'un objet dont les clés sont les colonnes du type de fichier indiqué dans le manuel." |
| | | ) |
| | | @ApiResponses(value = { |
| | | @ApiResponse(code = 200, message = "Données renvoyées avec succès"), |
| | | @ApiResponse(code = 401, message = "L'appelant n'a pas accès à la ressource"), |
| | | @ApiResponse(code = 403, message = "Consommation de la donnée non autorisée pour le noeud associé à l'utilisateur qui exécute la requête"), |
| | | @ApiResponse(code = 404, message = "Une ressource est introuvable (Type Fichier, Référentiel en cours, Noeud associé à l'utilisateur qui exécute la requête)"), |
| | | @ApiResponse(code = 422, message = "Les critères de sélection de la requête ne sont pas conformes à la structure des champs du type de fichier"),}) |
| | | public Response findByCriteriaWithPagination( |
| | | HttpHeaders headers, |
| | | @ApiParam(value = "Le type de fichier pour lequel on désire effectuer l'opération de consommation des lignes selon un ensemble de critères", required = true) String codeTypeFichier, |
| | | @ApiParam(value = "Le numéro de page ciblée", required = true) Integer pageNumber, |
| | | @ApiParam(value = "Le nombre d'éléments par page", required = true) Integer pageSize, |
| | | CriteriaEntityFromView criterion |
| | | ) { |
| | | PageData pageData = dataConsumptionOperations.findByCriteriaWithPagination(codeTypeFichier, criterion, codeParticipant, pageNumber, pageSize); |
| | | return Response.ok(pageData).build(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.dataproduction; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.administration.UserManager; |
| | | import com.megatim.apifdxweb.core.ifaces.helper.DataProductionOperations; |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | import com.megatim.apifdxweb.model.request.UpdateRequest; |
| | | import com.megatim.apifdxweb.service.ifaces.dataproduction.DataProductionRS; |
| | | import com.megatim.fdxcommons.model.pojo.CriteriaEntityFromView; |
| | | import com.mgt.rs.security.core.common.AuthenticatedUser; |
| | | import com.mgt.rs.security.core.common.SecuredClass; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import io.swagger.annotations.ApiResponses; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import javax.enterprise.context.RequestScoped; |
| | | import javax.enterprise.event.Observes; |
| | | import javax.inject.Inject; |
| | | import javax.ws.rs.Path; |
| | | import javax.ws.rs.core.HttpHeaders; |
| | | import javax.ws.rs.core.Response; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | @SecuredClass(module = "Production des fichiers", path = "production des fichiers", description = "Sécurisation des endpoints de l'API Fdx") |
| | | @RequestScoped |
| | | @Path("produce") |
| | | @Api(value = "Ressources de production des fichiers échangés") |
| | | public class DataProductionRSImpl implements DataProductionRS { |
| | | |
| | | @Inject |
| | | private DataProductionOperations dataProductionOperations; |
| | | |
| | | @Inject |
| | | private UserManager userManager; |
| | | |
| | | private String codeParticipant; |
| | | |
| | | public void handleAuthenticationEvent(@Observes @AuthenticatedUser String connectedUserName) { |
| | | User user = userManager.recuperUtilisateur(connectedUserName); |
| | | this.codeParticipant = user != null ? user.getParticipant().getCode() : null; |
| | | } |
| | | |
| | | @Override |
| | | @ApiOperation(value = "Ajoute plusieurs lignes pour le type de fichier en paramètre", |
| | | notes = "Cette méthode permet d'ajouter une liste d'éléments dont la structure de chaque " |
| | | + "élément est conforme à celle spécifiée dans le manuel technique pour le type de fichier passé en paramètre." |
| | | ) |
| | | @ApiResponses(value = { |
| | | @ApiResponse(code = 200, message = "Données enregistrées avec succès"), |
| | | @ApiResponse(code = 401, message = "L'appelant n'a pas accès à la ressource"), |
| | | @ApiResponse(code = 403, message = "Production des données non autorisée pour le noeud associé à l'utilisateur qui exécute la requête"), |
| | | @ApiResponse(code = 404, message = "Une ressource est introuvable (Type Fichier, Référentiel en cours, Noeud associé à l'utilisateur qui exécute la requête)"), |
| | | @ApiResponse(code = 422, message = "La structure des données à insérer n'est pas conforme à la structure attendue")}) |
| | | public Response saveAll( |
| | | HttpHeaders headers, |
| | | @ApiParam(value = "Le type de fichier pour lequel on désire effectuer l'opération d'ajout des lignes", required = true) String codeTypeFichier, |
| | | @ApiParam(value = "Liste d'objets dont la structure est conforme à celle du type de fichier indiqué en parametre", required = true) List<LinkedHashMap<String, Object>> datas |
| | | ) { |
| | | |
| | | dataProductionOperations.saveAll(codeTypeFichier, datas, codeParticipant); |
| | | return Response.ok().build(); |
| | | } |
| | | |
| | | @Override |
| | | @ApiOperation(value = "Ajout d'une ligne pour le type de fichier en paramètre", |
| | | notes = "Cette méthode permet d'ajouter un élément dont la structure est conforme à celle spécifiée dans le manuel technique pour le type de fichier passé en paramètre.") |
| | | @ApiResponses(value = { |
| | | @ApiResponse(code = 200, message = "Données enregistrées avec succès"), |
| | | @ApiResponse(code = 401, message = "L'appelant n'a pas accès à la ressource"), |
| | | @ApiResponse(code = 403, message = "Production des données non autorisée pour le noeud associé à l'utilisateur qui exécute la requête"), |
| | | @ApiResponse(code = 404, message = "Une ressource est introuvable (Type Fichier, Référentiel en cours, Noeud associé à l'utilisateur qui exécute la requête)"), |
| | | @ApiResponse(code = 422, message = "La structure de donnée à insérer n'est pas conforme à la structure attendue")}) |
| | | public Response save( |
| | | HttpHeaders headers, |
| | | @ApiParam(value = "Le type de fichier pour lequel on désire effectuer l'opération d'ajout d'une ligne", required = true) String codeTypeFichier, |
| | | @ApiParam(value = "Objet dont la structure est conforme à celle du type de fichier indiqué en parametre", required = true) LinkedHashMap<String, Object> data |
| | | ) { |
| | | |
| | | dataProductionOperations.saveOne(codeTypeFichier, data, codeParticipant); |
| | | return Response.ok().build(); |
| | | } |
| | | |
| | | @Override |
| | | @ApiOperation(value = "Mise à jour de plusieurs lignes pour le type de fichier en paramètre selon un ensemble de critères", |
| | | notes = "Cette méthode permet de mettre à jour les lignes associées au type de fichier en paramètre selon un ensemble de critère indiqués dans le corps de la requête.") |
| | | @ApiResponses(value = { |
| | | @ApiResponse(code = 200, message = "Données enregistrées avec succès"), |
| | | @ApiResponse(code = 401, message = "L'appelant n'a pas accès à la ressource"), |
| | | @ApiResponse(code = 403, message = "Production des données non autorisée pour le noeud associé à l'utilisateur qui exécute la requête"), |
| | | @ApiResponse(code = 404, message = "Une ressource est introuvable (Type Fichier, Référentiel en cours, Noeud associé à l'utilisateur qui exécute la requête)"), |
| | | @ApiResponse(code = 422, message = "Les critères de sélection ou les paramètres de mise à jour de la requête ne sont pas conformes à la structure des champs du type de fichier")}) |
| | | public Response updateAll( |
| | | HttpHeaders headers, |
| | | @ApiParam(value = "Le type de fichier pour lequel on désire effectuer l'opération de mise à jour des lignes", required = true) String codeTypeFichier, |
| | | @ApiParam(value = "Contient les critères de sélection et les valeurs de mise à jour", required = true) UpdateRequest updateRequest |
| | | ) { |
| | | dataProductionOperations.updateAll(codeTypeFichier, updateRequest, codeParticipant); |
| | | return Response.ok().build(); |
| | | } |
| | | |
| | | @Override |
| | | @ApiOperation(value = "Mise à jour d'une ligne pour le type de fichier en paramètre selon un ensemble de critères", |
| | | notes = "Cette méthode permet de mettre à jour une ligne associée au type de fichier en paramètre selon un ensemble de critères indiqués dans le corps de la requête. " |
| | | + "Si le filtre selon le critère de sélection ne trouve pas de ligne, nous une erreur 404 est levée. De même, si l'application du filtre sur les critères trouve plus d'une ligne, " |
| | | + "une erreur 422 est levée pour indiqué le mauvais format de la requête.") |
| | | @ApiResponses(value = { |
| | | @ApiResponse(code = 200, message = "Données enregistrées avec succès"), |
| | | @ApiResponse(code = 401, message = "L'appelant n'a pas accès à la ressource"), |
| | | @ApiResponse(code = 403, message = "Production des données non autorisée pour le noeud associé à l'utilisateur qui exécute la requête"), |
| | | @ApiResponse(code = 404, message = "Une ressource est introuvable (Type Fichier, Référentiel en cours, Noeud associé à l'utilisateur qui exécute la requête), ou aucune ligne n'a été trouvée"), |
| | | @ApiResponse(code = 422, message = "Les critères de sélection ou les paramètres de mise à jour de la requête ne sont pas conformes à la structure des champs du type de fichier, " |
| | | + "ou le résultat de la sélection a retourné plus d'une ligne")}) |
| | | public Response updateOne( |
| | | HttpHeaders headers, |
| | | @ApiParam(value = "Le type de fichier pour lequel on désire effectuer l'opération de mise à jour d'une ligne", required = true) String codeTypeFichier, |
| | | @ApiParam(value = "Contient les critères de sélection et les valeurs de mise à jour", required = true) UpdateRequest updateRequest |
| | | ) { |
| | | dataProductionOperations.updateOne(codeTypeFichier, updateRequest, codeParticipant); |
| | | return Response.ok().build(); |
| | | } |
| | | |
| | | @Override |
| | | @ApiOperation(value = "Suppression des lignes pour le type de fichier en paramètre selon un ensemble de critères", |
| | | notes = "Cette méthode permet de supprimer une ligne associée au type de fichier en paramètre selon un ensemble de critères indiqués dans le corps de la requête.") |
| | | @ApiResponses(value = { |
| | | @ApiResponse(code = 200, message = "Données enregistrées avec succès"), |
| | | @ApiResponse(code = 401, message = "L'appelant n'a pas accès à la ressource"), |
| | | @ApiResponse(code = 403, message = "Production des données non autorisée pour le noeud associé à l'utilisateur qui exécute la requête"), |
| | | @ApiResponse(code = 404, message = "Une ressource est introuvable (Type Fichier, Référentiel en cours, Noeud associé à l'utilisateur qui exécute la requête)"), |
| | | @ApiResponse(code = 422, message = "Les critères de sélection des colonnes de la requête ne sont pas conformes à la structure des champs du type de fichier")}) |
| | | public Response deleteAll( |
| | | HttpHeaders headers, |
| | | @ApiParam(value = "Le type de fichier pour lequel on désire effectuer l'opération de suppression", required = true) String codeTypeFichier, |
| | | @ApiParam(value = "Liste des critères de sélection des lignes que l'on désire supprimer", required = true) CriteriaEntityFromView criterion |
| | | ) { |
| | | dataProductionOperations.deleteAll(codeTypeFichier, criterion, codeParticipant); |
| | | return Response.ok().build(); |
| | | } |
| | | |
| | | @Override |
| | | @ApiOperation(value = "Suppression des lignes pour le type de fichier en paramètre selon un ensemble de critères", |
| | | notes = "Cette méthode permet de supprimer une ligne associée au type de fichier en paramètre selon un ensemble de critères indiqués dans le corps de la requête.") |
| | | @ApiResponses(value = { |
| | | @ApiResponse(code = 200, message = "Données enregistrées avec succès"), |
| | | @ApiResponse(code = 401, message = "L'appelant n'a pas accès à la ressource"), |
| | | @ApiResponse(code = 403, message = "Production des données non autorisée pour le noeud associé à l'utilisateur qui exécute la requête"), |
| | | @ApiResponse(code = 404, message = "Une ressource est introuvable (Type Fichier, Référentiel en cours, Noeud associé à l'utilisateur qui exécute la requête)"), |
| | | @ApiResponse(code = 422, message = "Les critères de sélection des colonnes de la requête ne sont pas conformes à la structure des champs du type de fichier")}) |
| | | public Response deleteOne( |
| | | HttpHeaders headers, |
| | | @ApiParam(value = "Le type de fichier pour lequel on désire effectuer l'opération de suppression", required = true) String codeTypeFichier, |
| | | @ApiParam(value = "Liste des critères de sélection des lignes que l'on désire supprimer", required = true) CriteriaEntityFromView criterion |
| | | ) { |
| | | dataProductionOperations.deleteOne(codeTypeFichier, criterion, codeParticipant); |
| | | return Response.ok().build(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.filters; |
| | | |
| | | import com.megatim.apifdxweb.tools.AppContext; |
| | | import com.megatim.fdxcommons.core.ifaces.interceptor.AfterUserAction; |
| | | import com.megatim.fdxcommons.core.ifaces.interceptor.InterceptorHandler; |
| | | import com.megatim.fdxcommons.model.log.ContainerContextDto; |
| | | import com.megatim.fdxcommons.model.log.UserActionLog; |
| | | import java.io.IOException; |
| | | import java.util.logging.Level; |
| | | import java.util.logging.Logger; |
| | | import javax.inject.Inject; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.ws.rs.container.ContainerRequestContext; |
| | | import javax.ws.rs.container.ContainerResponseContext; |
| | | import javax.ws.rs.container.ContainerResponseFilter; |
| | | import javax.ws.rs.container.ResourceInfo; |
| | | import javax.ws.rs.core.Context; |
| | | import javax.ws.rs.core.SecurityContext; |
| | | import javax.ws.rs.core.UriInfo; |
| | | import javax.ws.rs.ext.Provider; |
| | | import org.apache.camel.ProducerTemplate; |
| | | import org.apache.camel.cdi.CdiCamelContext; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Provider |
| | | public class AfterUserActionFilter implements ContainerResponseFilter { |
| | | |
| | | @Context |
| | | private ResourceInfo resourceInfo; |
| | | |
| | | @Inject |
| | | private InterceptorHandler handler; |
| | | |
| | | @Inject |
| | | private CdiCamelContext camelContext; |
| | | |
| | | @Context |
| | | private SecurityContext securityContext; |
| | | |
| | | @Context |
| | | private UriInfo uriInfo; |
| | | |
| | | @Context |
| | | private HttpServletRequest servletRequest; |
| | | |
| | | @Inject |
| | | private AfterUserAction afterAction; |
| | | |
| | | @Override |
| | | public void filter(ContainerRequestContext crc, ContainerResponseContext crc1) throws IOException { |
| | | try { |
| | | |
| | | UserActionLog log = afterAction.filter(getContainerContext(crc, crc1)); |
| | | if (log != null) { |
| | | ProducerTemplate producerTemplate = camelContext.createProducerTemplate(); |
| | | producerTemplate.asyncSendBody("direct:" + AppContext.API_USER_ACTION_DIRECT, log); |
| | | } |
| | | |
| | | } catch (Exception ex) { |
| | | Logger.getLogger(AfterUserActionFilter.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); |
| | | } |
| | | |
| | | } |
| | | |
| | | private ContainerContextDto getContainerContext(ContainerRequestContext containerRequestContext, ContainerResponseContext containerResponseContext) { |
| | | ContainerContextDto containerContext = new ContainerContextDto(); |
| | | |
| | | containerContext.setContainerRequestContext(containerRequestContext); |
| | | containerContext.setContainerResponseContext(containerResponseContext); |
| | | containerContext.setHttpServletRequest(servletRequest); |
| | | containerContext.setUriInfo(uriInfo); |
| | | containerContext.setResourceInfo(resourceInfo); |
| | | containerContext.setSecurityContext(securityContext); |
| | | |
| | | return containerContext; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.service.impl.filters; |
| | | |
| | | import com.megatim.fdxcommons.core.ifaces.interceptor.BeforeAction; |
| | | import java.io.IOException; |
| | | import javax.inject.Inject; |
| | | import javax.ws.rs.container.ContainerRequestContext; |
| | | import javax.ws.rs.container.ContainerRequestFilter; |
| | | import javax.ws.rs.container.ResourceInfo; |
| | | import javax.ws.rs.core.Context; |
| | | import javax.ws.rs.ext.Provider; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Provider |
| | | public class BeforeUserActionFilter implements ContainerRequestFilter { |
| | | |
| | | @Context |
| | | private ResourceInfo resourceInfo; |
| | | |
| | | @Inject |
| | | private BeforeAction beforeAction; |
| | | |
| | | @Override |
| | | public void filter(ContainerRequestContext crc) throws IOException { |
| | | beforeAction.filter(crc, resourceInfo); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.filters; |
| | | |
| | | import java.io.IOException; |
| | | import javax.servlet.Filter; |
| | | import javax.servlet.FilterChain; |
| | | import javax.servlet.FilterConfig; |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.ServletRequest; |
| | | import javax.servlet.ServletResponse; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public class CORSFilter implements Filter { |
| | | |
| | | @Override |
| | | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { |
| | | |
| | | HttpServletRequest request = (HttpServletRequest) servletRequest; |
| | | HttpServletResponse response = (HttpServletResponse) servletResponse; |
| | | |
| | | response.addHeader("Access-Control-Allow-Origin", "*"); |
| | | response.addHeader("Access-Control-Allow-Methods", "GET,PUT,POST,DELETE,PATCH,OPTIONS"); |
| | | response.addHeader("Access-Control-Allow-Headers", request.getHeader("Access-Control-Request-Headers")); |
| | | response.addHeader("Access-Control-Expose-Headers", "Location, Content-Disposition"); |
| | | |
| | | // For HTTP OPTIONS verb reply with ACCEPTED status code, for CORS handshake |
| | | if (request.getMethod().equals("OPTIONS")) { |
| | | response.setStatus(HttpServletResponse.SC_ACCEPTED); |
| | | return; |
| | | } |
| | | |
| | | filterChain.doFilter(servletRequest, servletResponse); |
| | | } |
| | | |
| | | @Override |
| | | public void destroy() { |
| | | } |
| | | |
| | | @Override |
| | | public void init(FilterConfig arg0) throws ServletException { |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.filters; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.administration.TokenGenerationManager; |
| | | import com.megatim.apifdxweb.core.ifaces.administration.UserManager; |
| | | import com.mgt.rs.security.core.common.Secured; |
| | | import com.mgt.rs.security.core.filter.AuthenticationFilter; |
| | | import javax.inject.Inject; |
| | | import com.mgt.rs.security.core.ifaces.UserRsSecurity; |
| | | import javax.annotation.Priority; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.ws.rs.Priorities; |
| | | import javax.ws.rs.ext.Provider; |
| | | import com.megatim.apifdxweb.model.administration.security.UserSecurity; |
| | | import com.megatim.apifdxweb.model.administration.User; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | //@Secured |
| | | @Provider |
| | | @Dependent |
| | | @Priority(Priorities.AUTHENTICATION) |
| | | public class SecurityFilter extends AuthenticationFilter { |
| | | |
| | | /** |
| | | * On injecte un Gestionnaire d'entites |
| | | * |
| | | */ |
| | | @Inject |
| | | private UserManager userManager; |
| | | |
| | | @Inject |
| | | private TokenGenerationManager tokenGenerationManager; |
| | | |
| | | @Override |
| | | public boolean applicationValidation(UserRsSecurity user, Secured secured) { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected UserRsSecurity recuperUtilisateur(String userName) { |
| | | UserSecurity userSecurity = null; |
| | | User user = userManager.recuperUtilisateur(userName); |
| | | if (user != null) { |
| | | userSecurity = new UserSecurity(user); |
| | | } |
| | | return userSecurity; |
| | | } |
| | | |
| | | @Override |
| | | public boolean tokenIsValid(UserRsSecurity user, String token) { |
| | | return tokenGenerationManager.isTokenCorrect(user.getUserName(), token); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.resolvers; |
| | | |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.fasterxml.jackson.databind.SerializationFeature; |
| | | //import com.fasterxml.jackson.datatype.jsr310.JSR310Module; |
| | | import javax.ws.rs.ext.ContextResolver; |
| | | import javax.ws.rs.ext.Provider; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | //@Provider |
| | | public class ObjectMapperContextResolver implements ContextResolver<ObjectMapper> { |
| | | |
| | | private final ObjectMapper mapper; |
| | | |
| | | public ObjectMapperContextResolver() { |
| | | mapper = new ObjectMapper(); |
| | | |
| | | // mapper.registerModule(new JSR310Module()); |
| | | // mapper.activateDefaultTyping( |
| | | // mapper.getPolymorphicTypeValidator(), |
| | | // ObjectMapper.DefaultTyping.OBJECT_AND_NON_CONCRETE |
| | | // ); |
| | | mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); |
| | | } |
| | | |
| | | @Override |
| | | public ObjectMapper getContext(Class<?> type) { |
| | | return mapper; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.service.impl.scheduler; |
| | | |
| | | import com.megatim.apifdxweb.model.camel.historique.ConsumedFilesHistory; |
| | | import com.megatim.apifdxweb.service.impl.camel.config.CamelRouteConfiguration; |
| | | import com.megatim.apifdxweb.tools.AppContext; |
| | | import java.io.File; |
| | | import java.util.List; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | import com.megatim.apifdxweb.service.ifaces.scheduler.DeleteConsumedFilesJob; |
| | | import com.megatim.apifdxweb.core.ifaces.camel.historique.ConsumedFilesHistoryManager; |
| | | import com.megatim.apifdxweb.model.camel.historique.ConsumedFileType; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class DeleteConsumedFilesJobImpl implements DeleteConsumedFilesJob { |
| | | |
| | | @Inject |
| | | ConsumedFilesHistoryManager manager; |
| | | |
| | | @Override |
| | | public void deleteConsumedFilesInFolder() throws Exception { |
| | | String dataPath = new CamelRouteConfiguration(AppContext.PROPERTY_FILE_PATH).getLocalConfiguration().fichierLocalPath(); |
| | | String referentielPath = new CamelRouteConfiguration(AppContext.PROPERTY_FILE_PATH).getLocalConfiguration().referentielLocalPath(); |
| | | List<ConsumedFilesHistory> consumedFiles = manager.notDeleted(); |
| | | |
| | | consumedFiles.stream().forEach(cf -> { |
| | | String filePath = cf.getConsumedFileType().equals(ConsumedFileType.DONNEES) ? dataPath : referentielPath; |
| | | File file = new File(filePath, cf.getFileName()); |
| | | |
| | | if (!file.exists() || file.exists() && file.delete()) { |
| | | cf.setDeletedInFolder(true); |
| | | manager.save(cf); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.scheduler; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.helper.ApiRequestDataExporter; |
| | | import com.megatim.apifdxweb.core.ifaces.dataproduction.DataProductionManager; |
| | | import com.megatim.apifdxweb.tools.AppContext; |
| | | import com.megatim.fdxcommons.tools.utils.CustomColumns; |
| | | import com.megatim.fdxcommons.tools.integration.FdxConsultationIntegrationData; |
| | | import com.megatim.fdxcommons.model.enumeration.Operateur; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | import com.megatim.apifdxweb.service.ifaces.scheduler.TypeFichierDataJob; |
| | | import com.megatim.apifdxweb.service.impl.camel.config.CamelRouteConfiguration; |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProduction; |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProductionSource; |
| | | import com.megatim.fdxcommons.model.enumeration.CriteriaLogicConnector; |
| | | import com.megatim.fdxcommons.model.enumeration.StatutDataProduction; |
| | | import com.megatim.fdxcommons.model.searchentities.DataProductionSearch; |
| | | import com.megatim.fdxcommons.tools.database.connection.DBConnection; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryCriterion; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.SelectQueryResult; |
| | | import com.megatim.fdxcommons.tools.database.tables.DataProductionIdColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.FdxApiTable; |
| | | import com.megatim.fdxcommons.tools.integration.dto.FdxConsultationIntegrationDataDto; |
| | | import java.util.Arrays; |
| | | import java.util.logging.Level; |
| | | import java.util.logging.Logger; |
| | | import org.apache.camel.ProducerTemplate; |
| | | import org.apache.camel.cdi.CdiCamelContext; |
| | | import com.megatim.fdxcommons.tools.mappers.FdxTableMapper; |
| | | import java.io.IOException; |
| | | import java.sql.Connection; |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | import javax.sql.DataSource; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class TypeFichierDataJobImpl implements TypeFichierDataJob { |
| | | |
| | | @Resource(lookup = AppContext.JNDI_NAME) |
| | | private DataSource dataSource; |
| | | |
| | | @Inject |
| | | private DataProductionManager dataProductionManager; |
| | | |
| | | @Inject |
| | | private CdiCamelContext camelContext; |
| | | |
| | | @Inject |
| | | private ApiRequestDataExporter dataExporter; |
| | | |
| | | @Inject |
| | | private FdxTableMapper fdxTableMapper; |
| | | |
| | | @Override |
| | | public void publishData() { |
| | | |
| | | List<DataProduction> dataProductions = dataProductionsToPublish(); |
| | | |
| | | for (DataProduction d : dataProductions) { |
| | | QueryCriterion queryCriterion = constructQueryCriterion(d); |
| | | |
| | | try ( Connection connection = new DBConnection(dataSource).connection()) { |
| | | SelectQueryResult result = new FdxApiTable( |
| | | d.getCodeTypeFichier(), |
| | | d.getReferentielVersion(), |
| | | connection |
| | | ).selectResultWithAllColumns(queryCriterion); |
| | | FdxConsultationIntegrationData integrationData = new FdxConsultationIntegrationData(fdxTableMapper.fdxTableRowListToFdxTableRowDtoList(result.rows()), d); |
| | | |
| | | if (!integrationData.getRows().isEmpty()) { |
| | | System.out.println("********************dataProduction Id " + integrationData.getDataProduction().getId() + " rows to send " + integrationData.getRows().size()); |
| | | sendData(integrationData); |
| | | System.out.println("****************************Really send " + integrationData.getDataProduction().getId()); |
| | | } |
| | | } catch (Exception ex) { |
| | | Logger.getLogger(TypeFichierDataJobImpl.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); |
| | | throw new com.megatim.commons.tools.exceptions.ApplicationServerException(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | private QueryCriterion constructQueryCriterion(DataProduction d) { |
| | | |
| | | if (d.getDateMiseAJour() == null) { |
| | | return new QueryCriterion(new DataProductionIdColumnDefinition().name(), |
| | | d.getId(), |
| | | Operateur.EQUALS, |
| | | null, |
| | | Arrays.asList()); |
| | | } else { |
| | | return new QueryCriterion(null, null, null, CriteriaLogicConnector.AND, |
| | | Arrays.asList(new QueryCriterion(new DataProductionIdColumnDefinition().name(), |
| | | d.getId(), |
| | | Operateur.EQUALS, |
| | | null, |
| | | Arrays.asList()), |
| | | new QueryCriterion(CustomColumns.DATE_ACTION_COLUMN, |
| | | d.getDateMiseAJour(), |
| | | Operateur.EQUALS, |
| | | null, |
| | | Arrays.asList()) |
| | | )); |
| | | } |
| | | } |
| | | |
| | | private void sendData(FdxConsultationIntegrationData integrationData) throws IOException { |
| | | System.out.println("*************************PRODUCING DATA FOR FILE " + integrationData.getDataProduction().getCodeTypeFichier()); |
| | | |
| | | if (integrationData.getDataProduction().getSource().equals(DataProductionSource.API)) { |
| | | String standaloneTmpDir |
| | | = new CamelRouteConfiguration(AppContext.PROPERTY_FILE_PATH) |
| | | .standaloneTmpDir(); |
| | | dataExporter.export(integrationData, standaloneTmpDir); |
| | | } |
| | | |
| | | ProducerTemplate producerTemplate = camelContext.createProducerTemplate(); |
| | | producerTemplate.sendBody("direct:" + AppContext.DATA_TO_API_DIRECT, |
| | | new FdxConsultationIntegrationDataDto(integrationData.getRows(), integrationData.getDataProduction())); |
| | | |
| | | } |
| | | |
| | | private List<DataProduction> dataProductionsToPublish() { |
| | | DataProductionSearch searchEntity = new DataProductionSearch(); |
| | | searchEntity.setStatutDataProduction(StatutDataProduction.A_CONSOMMER); |
| | | |
| | | List<DataProduction> dataProductions = dataProductionManager.getAll(searchEntity); |
| | | |
| | | return dataProductions; |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.scheduler; |
| | | |
| | | import com.megatim.apifdxweb.core.ifaces.tmp.TokenTmpManager; |
| | | import com.megatim.apifdxweb.core.ifaces.tmp.TypeFichierDataTmpManager; |
| | | import com.megatim.apifdxweb.model.tmp.StatutTmp; |
| | | import com.megatim.apifdxweb.model.tmp.TokenTmp; |
| | | import com.megatim.apifdxweb.model.tmp.TypeFichierDataTmp; |
| | | import com.megatim.apifdxweb.service.ifaces.scheduler.TypeFichierDataTmpJob; |
| | | import com.megatim.apifdxweb.tools.AppContext; |
| | | import com.megatim.fdxcommons.core.ifaces.helper.DataInMemoryHandler; |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProduction; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.logging.Level; |
| | | import java.util.logging.Logger; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | import javax.transaction.Transactional; |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProductionSource; |
| | | import com.megatim.fdxcommons.tools.database.connection.DBConnection; |
| | | import com.megatim.fdxcommons.tools.database.tables.FdxApiTable; |
| | | import java.sql.Connection; |
| | | import java.sql.SQLException; |
| | | import java.time.LocalDateTime; |
| | | import javax.annotation.Resource; |
| | | import javax.naming.NamingException; |
| | | import javax.sql.DataSource; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class TypeFichierDataTmpJobImpl implements TypeFichierDataTmpJob { |
| | | |
| | | @Inject |
| | | private TokenTmpManager tokenTmpManager; |
| | | |
| | | @Inject |
| | | private TypeFichierDataTmpManager dataTmpManager; |
| | | |
| | | @Inject |
| | | private DataInMemoryHandler dataInMemoryHandler; |
| | | |
| | | @Resource(lookup = AppContext.JNDI_NAME) |
| | | private DataSource dataSource; |
| | | |
| | | @Override |
| | | public void mergeData() { |
| | | List<TokenTmp> tokens = tokenTmpManager.getByStatutTmp(StatutTmp.ACHEVE); |
| | | tokens.stream().forEach(t -> { |
| | | try { |
| | | List<LinkedHashMap<String, Object>> data = dataTmpManager.getByStructuredLines(t.getToken(), t.getCodeTypeFichier()); |
| | | updateDatabase(data, t); |
| | | } catch (Exception ex) { |
| | | Logger.getLogger(TypeFichierDataTmpJobImpl.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void deleteExpiredTokens() { |
| | | List<TokenTmp> tokenExpired = tokenTmpManager.getExpiredToken(); |
| | | |
| | | for (TokenTmp t : tokenExpired) { |
| | | List<TypeFichierDataTmp> data = dataTmpManager.getByToken(t.getToken()); |
| | | for (TypeFichierDataTmp d : data) { |
| | | dataTmpManager.delete(d); |
| | | } |
| | | tokenTmpManager.delete(t); |
| | | } |
| | | } |
| | | |
| | | @Transactional |
| | | private void updateDatabase(List<LinkedHashMap<String, Object>> data, TokenTmp tokenTmp) throws Exception { |
| | | insert(tokenTmp.getCodeTypeFichier(), |
| | | dataInMemoryHandler.getDataInMemory().getReferentielEnCours().getVersion(), |
| | | data, |
| | | tokenTmp.getCodeParticipant()); |
| | | |
| | | deleteTokenTmp(tokenTmp); |
| | | } |
| | | |
| | | private void insert(String codeTypeFichier, String referentielVersion, List<LinkedHashMap<String, Object>> data, String connectedParticipant) throws SQLException, NamingException, Exception { |
| | | DataProduction dataProduction = newDataProduction(codeTypeFichier, connectedParticipant, referentielVersion); |
| | | |
| | | try ( Connection connection = new DBConnection(dataSource).connection()) { |
| | | connection.setAutoCommit(false); |
| | | |
| | | new FdxApiTable(codeTypeFichier, |
| | | referentielVersion, |
| | | connection) |
| | | .insert(data, dataProduction); |
| | | connection.commit(); |
| | | } |
| | | |
| | | } |
| | | |
| | | private void deleteTokenTmp(TokenTmp tokenTmp) { |
| | | List<TypeFichierDataTmp> dataTmp = dataTmpManager.getByToken(tokenTmp.getToken()); |
| | | for (TypeFichierDataTmp td : dataTmp) { |
| | | dataTmpManager.delete(td); |
| | | } |
| | | TokenTmp t = tokenTmpManager.getById(tokenTmp.getToken()); |
| | | tokenTmpManager.delete(t); |
| | | } |
| | | |
| | | private DataProduction newDataProduction(String codeTypeFichier, String codeParticipant, String referentielVersion) { |
| | | DataProduction dataProduction = new DataProduction(); |
| | | dataProduction.setDateProduction(LocalDateTime.now()); |
| | | dataProduction.setReferentielVersion(referentielVersion); |
| | | dataProduction.setCodeTypeFichier(codeTypeFichier); |
| | | dataProduction.setCodeParticipant(codeParticipant); |
| | | dataProduction.setSource(DataProductionSource.API); |
| | | |
| | | return dataProduction; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.service.impl.startup; |
| | | |
| | | import com.megatim.apifdxweb.service.ifaces.scheduler.DeleteConsumedFilesJob; |
| | | import com.megatim.fdxcommons.core.ifaces.helper.DataInMemoryHandler; |
| | | import com.megatim.apifdxweb.service.ifaces.scheduler.TypeFichierDataJob; |
| | | import com.megatim.apifdxweb.service.ifaces.scheduler.TypeFichierDataTmpJob; |
| | | import java.io.Serializable; |
| | | import javax.annotation.PostConstruct; |
| | | import javax.ejb.Singleton; |
| | | import javax.ejb.Startup; |
| | | import javax.inject.Inject; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | @Singleton |
| | | @Startup |
| | | public class StartupBean implements Serializable { |
| | | |
| | | @Inject |
| | | TypeFichierDataJob typeFichierDataJob; |
| | | |
| | | @Inject |
| | | private DataInMemoryHandler dataInMemoryHandler; |
| | | |
| | | @Inject |
| | | private TypeFichierDataTmpJob dataTmpJob; |
| | | |
| | | @Inject |
| | | private DeleteConsumedFilesJob deleteConsumedFilesJob; |
| | | |
| | | @PostConstruct |
| | | public void init() { |
| | | dataInMemoryHandler.initializeDataInMemory(); |
| | | } |
| | | // |
| | | // @Schedule(second = "*/30", minute = "*", hour = "*", persistent = false) |
| | | // public void executeTypeFichierDataTask() { |
| | | // System.out.println(" in executeTypeFichierDataTask"); |
| | | // typeFichierDataJob.publishData(); |
| | | // } |
| | | // |
| | | // @Schedule(second = "*/30", minute = "*", hour = "*", persistent = false) |
| | | // public void mergeTypeFichierDataTmpTask() { |
| | | // System.out.println(" in executeTypeFichierDataTmpTask"); |
| | | // dataTmpJob.mergeData(); |
| | | // } |
| | | // |
| | | // @Schedule(second = "*/30", minute = "*", hour = "*", persistent = false) |
| | | // public void deleteExpiredTokenTask() { |
| | | // System.out.println(" in deleteExpiredTokenTask"); |
| | | // dataTmpJob.deleteExpiredTokens(); |
| | | // } |
| | | // |
| | | // @Schedule(second = "*/30", minute = "*", hour = "*", persistent = false) |
| | | // public void deleteConsumedFilesTask() throws Exception { |
| | | // System.out.println(" in deleteConsumedFilesTask"); |
| | | // deleteConsumedFilesJob.deleteConsumedFilesInFolder(); |
| | | // } |
| | | } |
| New file |
| | |
| | | authentication.jwt.secret = secret |
| | | authentication.jwt.issuer = http://example.org |
| | | authentication.jwt.audience = http://example.org |
| | | authentication.jwt.clockSkew = 10 |
| | | authentication.jwt.validFor = 600000 |
| | | authentication.jwt.validForRefresh = 900000 |
| | | authentication.jwt.refreshLimit = 1 |
| | | authentication.jwt.claimNames.authorities = authorities |
| | | authentication.jwt.claimNames.refreshCount = refreshCount |
| | | authentication.jwt.claimNames.refreshLimit = refreshLimit |
| New file |
| | |
| | | <PaysToExport> |
| | | <paysList> |
| | | <code>CMR</code> |
| | | <libelle>Cameroun</libelle> |
| | | <referentiel> |
| | | <version>000001</version> |
| | | <description>Referentiel N°1</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-02-15T14:29:01.057</dateMiseAjour> |
| | | <lastModifiedBy>fdxc</lastModifiedBy> |
| | | </referentiel> |
| | | <dateCreation>12/11/2022 12:20:14</dateCreation> |
| | | <dateMiseAjour>12/11/2022 12:20:14</dateMiseAjour> |
| | | <createBy>fdxc</createBy> |
| | | <lastModifiedBy>fdxc</lastModifiedBy> |
| | | </paysList> |
| | | </PaysToExport> |
| New file |
| | |
| | | <ReferentielsToExport> |
| | | <referentielList> |
| | | <version>000001</version> |
| | | <description>initialisation</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2024-11-15T15:37:39.54</dateMiseAjour> |
| | | <dateGeneration>2024-11-14T18:52:16.463</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000002</version> |
| | | <description>TEST</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2024-11-18T14:00:10.757</dateMiseAjour> |
| | | <dateGeneration>2024-11-15T15:37:39.393</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000003</version> |
| | | <description>Ajout et configuration nouveaux noeuds</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2024-11-21T10:56:39.34</dateMiseAjour> |
| | | <dateGeneration>2024-11-18T14:00:10.543</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000004</version> |
| | | <description>AJOUT FICHIER DGT</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2024-11-21T11:42:01.617</dateMiseAjour> |
| | | <dateGeneration>2024-11-21T10:56:38.81</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000005</version> |
| | | <description>TEST </description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2024-11-22T10:25:07.957</dateMiseAjour> |
| | | <dateGeneration>2024-11-21T11:42:00.763</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000006</version> |
| | | <description>Ajout de nouveaux participants et nouveaux types fichiers</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2024-11-22T13:33:53.977</dateMiseAjour> |
| | | <dateGeneration>2024-11-22T10:25:06.59</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000007</version> |
| | | <description>Ajout fichier DGD, RMP, PAT et MAP</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2024-11-25T15:08:09.957</dateMiseAjour> |
| | | <dateGeneration>2024-11-22T13:33:52.38</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000008</version> |
| | | <description>Ajout validateurs RMP et PAT</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2024-12-04T11:19:02.023</dateMiseAjour> |
| | | <dateGeneration>2024-11-25T15:08:08.157</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000009</version> |
| | | <description>Definition type fichier cumulatif</description> |
| | | <statutReferentiel>EN_COURS</statutReferentiel> |
| | | <dateMiseAjour>2024-12-04T11:21:04.503</dateMiseAjour> |
| | | <dateGeneration>2024-12-04T11:18:58.6</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | </ReferentielsToExport> |
| New file |
| | |
| | | <ReferentielsToExport> |
| | | <referentielList> |
| | | <version>000001</version> |
| | | <description>Referentiel N°1</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-02-15T14:29:01.057</dateMiseAjour> |
| | | <lastModifiedBy>fdxc</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000002</version> |
| | | <description>REFERENTIEL DE TEST GRANDEUR NATURE</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-02-16T11:58:19.116</dateMiseAjour> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000003</version> |
| | | <description>Ajout routage MAP et PAT</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-05-10T13:14:47.551</dateMiseAjour> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000004</version> |
| | | <description>REFERENTIEL AVEC FICHIER NIU</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-05-10T16:21:39.815</dateMiseAjour> |
| | | <dateGeneration>2023-05-10T13:14:47.351</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000005</version> |
| | | <description>INTEGRATION DES FICHIERS DE VALIDATION MINMAP</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-05-11T11:10:11.842</dateMiseAjour> |
| | | <dateGeneration>2023-05-10T16:21:39.625</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000006</version> |
| | | <description>INTEGRATION DE L'ARMP DANS LE REFERENTIEL</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-05-11T13:57:46.696</dateMiseAjour> |
| | | <dateGeneration>2023-05-11T11:10:11.599</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000007</version> |
| | | <description>AJOUT DES FICHIERS DU MINEPAT ET DE LA DGT</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-05-11T14:45:34.69</dateMiseAjour> |
| | | <dateGeneration>2023-05-11T13:57:46.447</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000008</version> |
| | | <description>Aajout validateur PAT</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-05-11T15:46:09.394</dateMiseAjour> |
| | | <dateGeneration>2023-05-11T14:45:34.395</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000009</version> |
| | | <description>Mise à jour referentiel fichier PAT</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-05-11T16:09:32.14</dateMiseAjour> |
| | | <dateGeneration>2023-05-11T15:46:09.012</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000010</version> |
| | | <description>integration des fichiers DGBBAL</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-05-11T19:30:40.034</dateMiseAjour> |
| | | <dateGeneration>2023-05-11T16:09:31.76</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000011</version> |
| | | <description>AJOUT FICHIERS RMP</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-05-12T15:49:18.009</dateMiseAjour> |
| | | <dateGeneration>2023-05-11T19:30:39.534</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000012</version> |
| | | <description>AJOUT VALIDATEURS FICHIER PARTICIPANTS DGB</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-05-12T15:55:21.603</dateMiseAjour> |
| | | <dateGeneration>2023-05-12T15:49:17.551</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000013</version> |
| | | <description>Edition routage DGB</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-05-12T16:24:37.42</dateMiseAjour> |
| | | <dateGeneration>2023-05-12T15:55:21.049</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000014</version> |
| | | <description>Ajout referentiel DGB</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-05-12T17:42:43.431</dateMiseAjour> |
| | | <dateGeneration>2023-05-12T16:24:36.794</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000015</version> |
| | | <description>AJOUT FICHIERS RMP</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-05-12T17:46:25.969</dateMiseAjour> |
| | | <dateGeneration>2023-05-12T17:42:42.835</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000016</version> |
| | | <description>AJOUT VALIDATEUR RMP</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-05-29T13:38:32.951</dateMiseAjour> |
| | | <dateGeneration>2023-05-12T17:46:25.335</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000017</version> |
| | | <description>INTEGRATION DES BONS VALIDATEURS POUR LES FICHIER DGTPEC ET DGTPAY</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-05-30T14:01:56.561</dateMiseAjour> |
| | | <dateGeneration>2023-05-29T13:38:32.24</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000018</version> |
| | | <description>MISE A JOUR DU VALIDATEUR DU FICHIER DGTPAY DE LA DGT</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-06-01T17:01:53.136</dateMiseAjour> |
| | | <dateGeneration>2023-05-30T14:01:55.804</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000019</version> |
| | | <description>MISE A JOUR DU VALIDATEUR POUR LE FICHIER RMPCNE</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-06-15T12:46:33.873</dateMiseAjour> |
| | | <dateGeneration>2023-06-01T17:01:52.378</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000020</version> |
| | | <description>MISE A JOUR DES FICHIERS ET FORMATS DE L'ARMP</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-06-15T13:09:23.36</dateMiseAjour> |
| | | <dateGeneration>2023-06-15T12:46:33.045</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000021</version> |
| | | <description>INSERTION DES ROUTAGES DES FICHIERS NOUVEAU FICHIERS RMP</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-07-04T12:19:49.603</dateMiseAjour> |
| | | <dateGeneration>2023-06-15T13:09:22.287</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000022</version> |
| | | <description>INTEGRATION DU VALIDATEUR EPL MINAP</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-07-19T13:15:25.32</dateMiseAjour> |
| | | <dateGeneration>2023-07-04T12:19:48.634</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000023</version> |
| | | <description>MISE A JOUR DES FICHIERS DAD DU MINEPAT</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-07-20T13:40:17.561</dateMiseAjour> |
| | | <dateGeneration>2023-07-19T13:15:23.535</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000024</version> |
| | | <description>MISE A JOUR DES VALIDATEURS DGI</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-07-21T14:31:29.765</dateMiseAjour> |
| | | <dateGeneration>2023-07-20T13:40:15.262</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000025</version> |
| | | <description>AJOUT DU FICHIER MPE DU MINMAP</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-08-16T14:34:16.554</dateMiseAjour> |
| | | <dateGeneration>2023-07-21T14:31:28.229</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000026</version> |
| | | <description>MISE A JOUR DU VALIDATEUR DGBORG</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-08-23T11:50:48.963</dateMiseAjour> |
| | | <dateGeneration>2023-08-16T14:34:15.192</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000027</version> |
| | | <description>INTEGRATION DES FICHIERS DES ENTREPRISES SANCTIONNEES PAR LE MINMAP</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-09-21T15:45:53.779</dateMiseAjour> |
| | | <dateGeneration>2023-08-23T11:50:46.409</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000028</version> |
| | | <description>INTEGRATION DES FICHIERS DES UNITES DE DOUANES ET DES DECLARANTS DE DOUANE</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2023-09-21T15:45:53.78</dateMiseAjour> |
| | | <dateGeneration>2023-09-21T15:45:50.719</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000029</version> |
| | | <description>INTEGRATION DES FICHIERS POUR LA DGI</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2024-01-30T12:52:56.208</dateMiseAjour> |
| | | <dateGeneration>2023-09-21T13:28:50.719</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000030</version> |
| | | <description>AJOUT DES FICHIERS DGTLPC ET DGTLCM</description> |
| | | <statutReferentiel>ARCHIVE</statutReferentiel> |
| | | <dateMiseAjour>2024-02-06T10:46:19.876</dateMiseAjour> |
| | | <dateGeneration>2024-02-01T15:48:50.719</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | <referentielList> |
| | | <version>000031</version> |
| | | <description>AJOUT DES COLONNES SUR LE FICHIER DU CONTRIBUABLE</description> |
| | | <statutReferentiel>EN_COURS</statutReferentiel> |
| | | <dateMiseAjour>2024-02-06T10:46:19.877</dateMiseAjour> |
| | | <dateGeneration>2024-02-06T10:46:18.311</dateGeneration> |
| | | <lastModifiedBy>AdminMinfi</lastModifiedBy> |
| | | </referentielList> |
| | | </ReferentielsToExport> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" |
| | | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" |
| | | bean-discovery-mode="all"> |
| | | </beans> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <web-app version="4.0" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"> |
| | | <session-config> |
| | | <session-timeout> |
| | | 30 |
| | | </session-timeout> |
| | | </session-config> |
| | | <filter> |
| | | <filter-name>CorsFilter</filter-name> |
| | | <filter-class>com.megatim.apifdxweb.service.impl.filters.CORSFilter</filter-class> |
| | | </filter> |
| | | <filter-mapping> |
| | | <filter-name>CorsFilter</filter-name> |
| | | <url-pattern>/*</url-pattern> |
| | | </filter-mapping> |
| | | </web-app> |
| New file |
| | |
| | | <!DOCTYPE html> |
| | | <html> |
| | | <head> |
| | | <title>API GAD </title> |
| | | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| | | </head> |
| | | <body> |
| | | <h1>API GAD PROJECT </h1> |
| | | </body> |
| | | </html> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project-shared-configuration> |
| | | <!-- |
| | | This file contains additional configuration written by modules in the NetBeans IDE. |
| | | The configuration is intended to be shared among all the users of project and |
| | | therefore it is assumed to be part of version control checkout. |
| | | Without this configuration present, some functionality in the IDE may be limited or fail altogether. |
| | | --> |
| | | <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1"> |
| | | <!-- |
| | | Properties that influence various parts of the IDE, especially code formatting and the like. |
| | | You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up. |
| | | That way multiple projects can share the same settings (useful for formatting rules for example). |
| | | Any value defined here will override the pom.xml file value but is only applicable to the current project. |
| | | --> |
| | | <netbeans.hint.jdkPlatform>JDK_1.8</netbeans.hint.jdkPlatform> |
| | | </properties> |
| | | </project-shared-configuration> |
| New file |
| | |
| | | <?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"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <parent> |
| | | <groupId>com.megatim.apifdxweb</groupId> |
| | | <artifactId>apifdxweb</artifactId> |
| | | <version>1.0</version> |
| | | </parent> |
| | | <groupId>com.megatim.apifdxweb.tools</groupId> |
| | | <artifactId>apifdxweb-tools</artifactId> |
| | | <version>1.0</version> |
| | | <packaging>jar</packaging> |
| | | <name>apifdxweb-tools</name> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <version>2.3.2</version> |
| | | <configuration> |
| | | <debug>false</debug> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | </build><!-- |
| | | --> |
| | | <properties> |
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| | | <maven.compiler.source>1.8</maven.compiler.source> |
| | | <maven.compiler.target>1.8</maven.compiler.target> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>javax</groupId> |
| | | <artifactId>javaee-api</artifactId> |
| | | <version>8.0</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.github.classgraph</groupId> |
| | | <artifactId>classgraph</artifactId> |
| | | <version>4.8.90</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.poi</groupId> |
| | | <artifactId>poi-ooxml</artifactId> |
| | | <version>3.17</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.poi</groupId> |
| | | <artifactId>poi-scratchpad</artifactId> |
| | | <version>3.17</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>net.sf.jasperreports</groupId> |
| | | <artifactId>jasperreports</artifactId> |
| | | <version>6.19.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>net.sf.jasperreports</groupId> |
| | | <artifactId>jasperreports-fonts</artifactId> |
| | | <version>6.19.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.opencsv</groupId> |
| | | <artifactId>opencsv</artifactId> |
| | | <version>4.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatim</groupId> |
| | | <artifactId>export-excel</artifactId> |
| | | <version>1.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatim.apifdxweb.model</groupId> |
| | | <artifactId>apifdxweb-model</artifactId> |
| | | <version>1.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.tika</groupId> |
| | | <artifactId>tika-parser-text-module</artifactId> |
| | | <version>2.9.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatim</groupId> |
| | | <artifactId>module-compression</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | </dependency> |
| | | </dependencies> |
| | | </project> |
| New file |
| | |
| | | package com.megatim.apifdxweb.tools; |
| | | |
| | | import java.io.File; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public class AppContext { |
| | | |
| | | public static final String JNDI_NAME = "java:/fdxDS"; |
| | | public static final String PERSISTENCE_UNIT_NAME = "fdxPU"; |
| | | public static final String PROPERTY_FILE_PATH = System.getProperty("api-file"); |
| | | |
| | | public static String DATA_TO_API_DIRECT = "data-to-api-direct"; |
| | | |
| | | public static final String API_USER_ACTION_DIRECT = "apiUserActionDirect"; |
| | | public static final String API_USER_ACTION_EXCHANGE = "apiUserActionExchange"; |
| | | public static final String API_USER_ACTION_QUEUE = "apiUserActionQueue"; |
| | | public static final String API_USER_ACTION_ROUTING_KEY = "apiUserActionRoutingKey"; |
| | | |
| | | public static final String DATA_INTEGRATION_TIMER = "data-integration-timer"; |
| | | public static final String MERGE_BATCH_DATA_TIMER = "merge-batch-data-timer"; |
| | | public static final String DELETE_EXPIRED_TOKENS_TIMER = "delete-expired-tokens-timer"; |
| | | public static final String DELETE_CONSUMED_FILES_TIMER = "delete-consumed-files-timer"; |
| | | |
| | | public static final String SERVER_DIR = getCurrentDirectory().getParent(); |
| | | public static final String APP_DIR = SERVER_DIR + File.separator + "standalone" + File.separator + "apifdx"; |
| | | public static final String TEMP_DIR = APP_DIR + File.separator + "tmp"; |
| | | public static final String UPLOAD_DIR = APP_DIR + File.separator + "upload"; |
| | | public static final String DOWNLOAD_DIR = APP_DIR + File.separator + "download"; |
| | | public static final String DATA_DIR = APP_DIR + File.separator + "data"; |
| | | |
| | | public static final String REFERENTIEL_ZIP_FILE_NAME = "referentiel.zip"; |
| | | public static final String UNZIP_REFERENTIEL_VALIDATEUR_DIR_NAME = "validateurs"; |
| | | |
| | | public static File getCurrentDirectory() { |
| | | String fileName = (String) System.getProperties().get("user.dir"); |
| | | return new File(fileName); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.tools; |
| | | |
| | | import com.megatim.module.compression.impl.JavaZipZip4Impl; |
| | | import java.io.File; |
| | | import java.nio.file.Paths; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public class AppFileUtils { |
| | | |
| | | private AppFileUtils() { |
| | | } |
| | | |
| | | public static File unzipFileInDirectory(String source, String destination) throws Exception { |
| | | File sourceFile = new File(source); |
| | | File destinationFile = new File(destination); |
| | | |
| | | String sourceFileName = sourceFile.getName(); |
| | | int lastIndex = sourceFileName.lastIndexOf("."); |
| | | String unzipFileName = sourceFileName.substring(0, lastIndex); |
| | | |
| | | JavaZipZip4Impl zip = new JavaZipZip4Impl(); |
| | | zip.unZipFile(sourceFile, destinationFile); |
| | | |
| | | return Paths.get(destination, unzipFileName).toFile(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.tools; |
| | | |
| | | import com.lowagie.text.Document; |
| | | import com.lowagie.text.pdf.PdfContentByte; |
| | | import com.lowagie.text.pdf.PdfImportedPage; |
| | | import com.lowagie.text.pdf.PdfReader; |
| | | import com.lowagie.text.pdf.PdfWriter; |
| | | import com.opencsv.CSVReader; |
| | | import com.opencsv.CSVReaderBuilder; |
| | | import io.github.classgraph.ClassGraph; |
| | | import io.github.classgraph.ClassInfoList; |
| | | import io.github.classgraph.ScanResult; |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStreamReader; |
| | | import java.io.OutputStream; |
| | | import java.io.Reader; |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.security.SecureRandom; |
| | | import java.security.spec.InvalidKeySpecException; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Properties; |
| | | import javax.crypto.SecretKeyFactory; |
| | | import javax.crypto.spec.PBEKeySpec; |
| | | import java.lang.annotation.Annotation; |
| | | import java.text.NumberFormat; |
| | | import java.util.Calendar; |
| | | import java.util.Iterator; |
| | | import net.sf.jasperreports.engine.JasperExportManager; |
| | | import net.sf.jasperreports.engine.JasperFillManager; |
| | | import net.sf.jasperreports.engine.JasperPrint; |
| | | import net.sf.jasperreports.engine.JasperReport; |
| | | import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; |
| | | import net.sf.jasperreports.engine.util.JRLoader; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.apache.poi.xwpf.usermodel.XWPFDocument; |
| | | import org.apache.poi.xwpf.usermodel.XWPFParagraph; |
| | | import org.apache.poi.xwpf.usermodel.XWPFRun; |
| | | import com.megatim.export.excel.Export; |
| | | import java.io.InputStream; |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.format.FormatStyle; |
| | | import java.util.Locale; |
| | | import java.util.stream.IntStream; |
| | | import org.apache.poi.ss.usermodel.Cell; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import javax.ws.rs.core.MultivaluedMap; |
| | | |
| | | /* |
| | | * To change this license header, choose License Headers in Project Properties. |
| | | * To change this template file, choose Tools | Templates |
| | | * and open the template in the editor. |
| | | */ |
| | | /** |
| | | * |
| | | * @author ABEGA |
| | | */ |
| | | public class CommonsTools { |
| | | |
| | | /** |
| | | * Methode permettant de fusionner plusieur pdf |
| | | * |
| | | * @param inputPdfList |
| | | * @param outputStream |
| | | * @throws Exception |
| | | */ |
| | | public static void mergePdfFiles(List<InputStream> inputPdfList, OutputStream outputStream) throws Exception { |
| | | //Create document and pdfReader objects. |
| | | Document document = new Document(); |
| | | List<PdfReader> readers |
| | | = new ArrayList<>(); |
| | | int totalPages = 0; |
| | | |
| | | //Create pdf Iterator object using inputPdfList. |
| | | Iterator<InputStream> pdfIterator |
| | | = inputPdfList.iterator(); |
| | | |
| | | // Create reader list for the input pdf files. |
| | | while (pdfIterator.hasNext()) { |
| | | InputStream pdf = pdfIterator.next(); |
| | | PdfReader pdfReader = new PdfReader(pdf); |
| | | readers.add(pdfReader); |
| | | totalPages = totalPages + pdfReader.getNumberOfPages(); |
| | | } |
| | | |
| | | // Create writer for the outputStream |
| | | PdfWriter writer = PdfWriter.getInstance(document, outputStream); |
| | | |
| | | //Open document. |
| | | document.open(); |
| | | |
| | | //Contain the pdf data. |
| | | PdfContentByte pageContentByte = writer.getDirectContent(); |
| | | |
| | | PdfImportedPage pdfImportedPage; |
| | | int currentPdfReaderPage = 1; |
| | | Iterator<PdfReader> iteratorPDFReader = readers.iterator(); |
| | | |
| | | // Iterate and process the reader list. |
| | | while (iteratorPDFReader.hasNext()) { |
| | | PdfReader pdfReader = iteratorPDFReader.next(); |
| | | //Create page and add content. |
| | | while (currentPdfReaderPage <= pdfReader.getNumberOfPages()) { |
| | | document.newPage(); |
| | | pdfImportedPage = writer.getImportedPage( |
| | | pdfReader, currentPdfReaderPage); |
| | | pageContentByte.addTemplate(pdfImportedPage, 0, 0); |
| | | currentPdfReaderPage++; |
| | | } |
| | | currentPdfReaderPage = 1; |
| | | } |
| | | |
| | | //Close document and outputStream. |
| | | outputStream.flush(); |
| | | document.close(); |
| | | outputStream.close(); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Permet de convertir un tableau de bytes en un fichier |
| | | * |
| | | * @param nomFichier |
| | | * @param content |
| | | * @return |
| | | */ |
| | | public static File convertBytesArrayToFile(String nomFichier, byte[] content) { |
| | | |
| | | //Variables |
| | | FileOutputStream fileOuputStream = null; |
| | | File fichier = null; |
| | | |
| | | try { |
| | | |
| | | //Variables |
| | | fileOuputStream = new FileOutputStream(nomFichier); |
| | | |
| | | //On lit le fichier |
| | | fileOuputStream.write(content); |
| | | |
| | | //On ferme le fichier |
| | | fileOuputStream.close(); |
| | | |
| | | } catch (Exception ex) { |
| | | |
| | | //On affiche l'erreur |
| | | ex.printStackTrace(); |
| | | |
| | | } |
| | | |
| | | return new File(nomFichier); |
| | | } |
| | | |
| | | /** |
| | | * Permet de convertir un fichier en tableau de bytes |
| | | * |
| | | * @param fichier |
| | | * @return |
| | | */ |
| | | public static byte[] convertFileToBytesArray(File fichier) { |
| | | |
| | | //Variables |
| | | byte[] byteArray = new byte[(int) fichier.length()]; |
| | | |
| | | try { |
| | | |
| | | //Variables |
| | | FileInputStream inputStream = new FileInputStream(fichier); |
| | | |
| | | //On lit le fichier |
| | | inputStream.read(byteArray); |
| | | |
| | | //On ferme le fichier |
| | | inputStream.close(); |
| | | |
| | | } catch (Exception ex) { |
| | | |
| | | //On affiche l'erreur |
| | | ex.printStackTrace(); |
| | | |
| | | } |
| | | |
| | | return byteArray; |
| | | } |
| | | |
| | | /** |
| | | * Permet d'exporter en excel dans repertoire donn� |
| | | * |
| | | * @param datas |
| | | * @param repertoireGeneration |
| | | * @return |
| | | */ |
| | | public static File exporterEnExcel(List datas, File fichier) { |
| | | |
| | | try { |
| | | |
| | | //On effectue l'export |
| | | Export.exportExcel(datas, fichier.getAbsolutePath()); |
| | | |
| | | } catch (Exception ex) { |
| | | |
| | | //On affiche l'erreur |
| | | ex.printStackTrace(); |
| | | |
| | | } |
| | | |
| | | return fichier; |
| | | } |
| | | |
| | | /** |
| | | * Permet de verifier si une liste de valeurs est contenu dans une chaine |
| | | * |
| | | * @param chaine |
| | | * @param tab |
| | | * @return |
| | | */ |
| | | public static boolean contains(String chaine, List<String> tab) { |
| | | |
| | | //Variables |
| | | boolean bool = false; |
| | | |
| | | //Si non vide |
| | | if (tab != null && !tab.isEmpty()) { |
| | | |
| | | //On parcourt la liste des valeurs |
| | | for (String valeur : tab) { |
| | | |
| | | //Si la chaine est contenu dans la chaine |
| | | if (chaine.contains(valeur)) { |
| | | |
| | | //On set la valeur |
| | | bool = true; |
| | | |
| | | //On sort |
| | | break; |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | return bool; |
| | | } |
| | | |
| | | /** |
| | | * Cette methode permet les donnees depuis un fichier excel |
| | | * |
| | | * @param file |
| | | * @return |
| | | */ |
| | | public static List<Cell> readExcelFile(File file) { |
| | | |
| | | //On definit de variables de reference |
| | | FileInputStream inputStream = null; |
| | | Workbook workbook = null; |
| | | Sheet firstSheet = null; |
| | | Iterator<Row> iterator = null; |
| | | |
| | | //Declaration |
| | | List<Cell> cellules = new ArrayList<Cell>(); |
| | | |
| | | try { |
| | | |
| | | //Affectation |
| | | inputStream = new FileInputStream(file); |
| | | workbook = new XSSFWorkbook(inputStream); |
| | | firstSheet = workbook.getSheetAt(0); |
| | | //iterator = firstSheet.iterator(); |
| | | |
| | | for (int rowNumber = firstSheet.getFirstRowNum(); rowNumber <= firstSheet.getLastRowNum(); rowNumber++) { |
| | | Row row = firstSheet.getRow(rowNumber); |
| | | if (row == null) { |
| | | // This row is completely empty |
| | | } else { |
| | | // The row has data |
| | | for (int cellNumber = row.getFirstCellNum(); cellNumber <= row.getLastCellNum(); cellNumber++) { |
| | | Cell cell = row.getCell(cellNumber, Row.MissingCellPolicy.RETURN_BLANK_AS_NULL); |
| | | |
| | | // if (cell == null || cell.getCellType() == Cell.CELL_TYPE_BLANK) { |
| | | // |
| | | // //On ajoute la cellule |
| | | // cellules.add(cell); |
| | | // |
| | | // } else { |
| | | // |
| | | // |
| | | // |
| | | // } |
| | | //On ajoute la cellule |
| | | cellules.add(cell); |
| | | // if(cell != null){ |
| | | // System.out.println(">>>>>>>>>>>>>"+cell.getCellValue()); |
| | | // }else{ |
| | | // System.out.println("Cell NULLL>>>>>>>>>>>>>"); |
| | | // } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | //On parcour la feuille |
| | | // while (iterator.hasNext()) { |
| | | // Row nextRow = iterator.next(); |
| | | // Iterator<Cell> cellIterator = nextRow.cellIterator(); |
| | | // |
| | | // //On parcour les cellules |
| | | // while (cellIterator.hasNext()) { |
| | | // |
| | | // //On ajoute les cellules |
| | | // cellules.add(cellIterator.next()); |
| | | // } |
| | | // } |
| | | // |
| | | //On ferme le classeur |
| | | workbook.close(); |
| | | |
| | | //On ferme le stream |
| | | inputStream.close(); |
| | | |
| | | } catch (Exception ex) { |
| | | |
| | | //On affiche l'erreur |
| | | ex.printStackTrace(); |
| | | |
| | | } finally { |
| | | try { |
| | | inputStream.close(); |
| | | } catch (IOException ex) { |
| | | |
| | | //On affiche l'erreur |
| | | ex.printStackTrace(); |
| | | |
| | | } |
| | | } |
| | | |
| | | return cellules; |
| | | } |
| | | |
| | | /** |
| | | * Permet de lire un fichier csv |
| | | * |
| | | * @param file |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static List<String[]> readCsvFile(File file) throws Exception { |
| | | |
| | | //Variables |
| | | List<String[]> allData = null; |
| | | InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(file), "UTF-8"); |
| | | CSVReader csvReader = null; |
| | | |
| | | try { |
| | | |
| | | // create csvReader object and skip first Line |
| | | try { |
| | | |
| | | //On lit le fichier |
| | | csvReader = new CSVReaderBuilder(inputStreamReader) |
| | | .withSkipLines(1) |
| | | .build(); |
| | | |
| | | //On recup�re les donn�es |
| | | allData = csvReader.readAll(); |
| | | |
| | | } catch (Exception ex) { |
| | | |
| | | //On affiche l'erreur |
| | | ex.printStackTrace(); |
| | | |
| | | } finally { |
| | | |
| | | //On ferme le reader |
| | | csvReader.close(); |
| | | } |
| | | |
| | | } finally { |
| | | |
| | | //On ferme le fichier |
| | | inputStreamReader.close(); |
| | | } |
| | | |
| | | return allData; |
| | | } |
| | | |
| | | /** |
| | | * Permet de mettre de mettre l'heure � minuit |
| | | * |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static Date passerHeureAMinuit(Date date) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(date); |
| | | calendar.set(Calendar.HOUR_OF_DAY, 0); |
| | | calendar.set(Calendar.MINUTE, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * Permet de retourner la liste des codes valeurs ch�que |
| | | * |
| | | * @return |
| | | */ |
| | | public static List<String> getCodeValeursCheque() { |
| | | |
| | | //Variables |
| | | List<String> liste = new ArrayList<String>(); |
| | | |
| | | //On charge |
| | | liste.add("30"); |
| | | liste.add("33"); |
| | | |
| | | return liste; |
| | | } |
| | | |
| | | /** |
| | | * Permet de retourner la liste des codes valeurs virement |
| | | * |
| | | * @return |
| | | */ |
| | | public static List<String> getCodeValeursVirement() { |
| | | |
| | | //Variables |
| | | List<String> liste = new ArrayList<String>(); |
| | | |
| | | //On charge |
| | | liste.add("10"); |
| | | liste.add("13"); |
| | | |
| | | return liste; |
| | | } |
| | | |
| | | /** |
| | | * permet de g��nrer en pdf |
| | | * |
| | | * @param datas |
| | | * @param pdfFile |
| | | * @param reportFilePath |
| | | * @param params |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static File genererFichierPdf(List<?> datas, String pdfFile, String reportFilePath, Map params) throws Exception { |
| | | |
| | | // Creation d'un File sur le fichier |
| | | File reportFile = new File(reportFilePath); |
| | | File fichierGenerer = new File(pdfFile); |
| | | |
| | | //On cree le fichier s'ile n'existe pas |
| | | if (!fichierGenerer.exists()) { |
| | | |
| | | //On cree le fichier |
| | | fichierGenerer.createNewFile(); |
| | | |
| | | } |
| | | |
| | | // Chargement du Rapport |
| | | JasperReport report = null; |
| | | |
| | | // Etat rempli |
| | | JasperPrint jasperPrint = null; |
| | | |
| | | // Chargement du report |
| | | report = (JasperReport) JRLoader.loadObject(reportFile); |
| | | jasperPrint = JasperFillManager.fillReport(report, params, new JRBeanCollectionDataSource(datas, false)); |
| | | |
| | | OutputStream output = new FileOutputStream(fichierGenerer); |
| | | JasperExportManager.exportReportToPdfStream(jasperPrint, output); |
| | | output.close(); |
| | | |
| | | return fichierGenerer; |
| | | } |
| | | |
| | | /** |
| | | * Permet de modifier un document word |
| | | * |
| | | * @param map |
| | | * @param pathFile |
| | | * @param repertoireDestination |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String updateWordFileToOtherFile(Map<String, Object> map, String pathFile, String fileName, String repertoireDestination) throws Exception { |
| | | |
| | | try { |
| | | // System.out.println("---------------------------updateWordFileToOtherFile----------1111111111111--------------------------------------"+pathFile); |
| | | //Variables |
| | | FileInputStream fis = new FileInputStream(pathFile); |
| | | XWPFDocument doc = new XWPFDocument(fis); |
| | | FileOutputStream out = null; |
| | | //String fileName = genererValeurAleatoire() + ".docx"; |
| | | String filePathDestination = repertoireDestination + File.separator + fileName + ".docx"; |
| | | |
| | | //On parcourt le document |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | for (XWPFParagraph p : doc.getParagraphs()) { |
| | | List<XWPFRun> runs = p.getRuns(); |
| | | if (runs != null) { |
| | | for (XWPFRun r : runs) { |
| | | String text = r.getText(0); |
| | | |
| | | //On verifie s'il elle contient la cle |
| | | if (text != null && text.contains(entry.getKey())) { |
| | | |
| | | //Si la valeur est non vide |
| | | if (entry.getValue() != null) { |
| | | |
| | | //On dermine le type |
| | | if (entry.getValue() instanceof String) { |
| | | text = text.replace(entry.getKey(), (String) entry.getValue()); |
| | | r.setText(text, 0); |
| | | } else { |
| | | text = text.replace(entry.getKey(), entry.getValue().toString()); |
| | | r.setText(text, 0); |
| | | } |
| | | |
| | | } else { |
| | | r.setText("", 0); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //On ecrit dans le fichier |
| | | out = new FileOutputStream(new File(filePathDestination)); |
| | | doc.write(out); |
| | | out.close(); |
| | | doc.close(); |
| | | |
| | | return filePathDestination; |
| | | |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * Permet de generer des nomre aleatorement |
| | | * |
| | | * @return |
| | | */ |
| | | public static String genererValeurAleatoire() { |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | String nombre = format.format(new Date()) + String.valueOf((int) (Math.random() * 1000000000)); |
| | | return nombre; |
| | | } |
| | | |
| | | /** |
| | | * Permet de charger des classes qui ont une annotation pr�cise |
| | | * |
| | | * @param pkgName |
| | | * @param annotation |
| | | * @return |
| | | */ |
| | | public static List<Annotation> getAnnotations(final String pkgName, String annotation) { |
| | | |
| | | //Variables |
| | | List<Class<?>> classRefs = new ArrayList<>(); |
| | | |
| | | List<Annotation> annotations = new ArrayList<>(); |
| | | |
| | | try ( ScanResult scanResult = new ClassGraph().acceptPackages(pkgName).enableAllInfo().scan()) { |
| | | |
| | | //On recup�re les classes annot�es |
| | | ClassInfoList liste = scanResult.getClassesWithAnnotation(annotation); |
| | | |
| | | //On charge les classes |
| | | classRefs = liste.loadClasses(); |
| | | |
| | | //On parcourt les classes |
| | | for (Class<?> classe : classRefs) { |
| | | |
| | | //On parcourt les annotations |
| | | for (Annotation annotationDeclaree : classe.getDeclaredAnnotations()) { |
| | | |
| | | //On ajoute l'annotation |
| | | annotations.add(annotationDeclaree); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | |
| | | //On affiche les traces |
| | | e.printStackTrace(); |
| | | |
| | | } |
| | | |
| | | return annotations; |
| | | } |
| | | |
| | | /** |
| | | * Permet de charger des classes qui ont une annotation pr�cise |
| | | * |
| | | * @param pkgName |
| | | * @param annotation |
| | | * @return |
| | | */ |
| | | public static List<Class<?>> getAnnotatedClasses(final String pkgName, String annotation) { |
| | | |
| | | //Variables |
| | | List<Class<?>> classRefs = new ArrayList<>(); |
| | | |
| | | try ( ScanResult scanResult = new ClassGraph().acceptPackages(pkgName).enableAllInfo().scan()) { |
| | | |
| | | //On recup�re les classes annot�es |
| | | ClassInfoList liste = scanResult.getClassesWithAnnotation(annotation); |
| | | |
| | | //On charge les classes |
| | | classRefs = liste.loadClasses(); |
| | | |
| | | } catch (Exception e) { |
| | | |
| | | //On affiche les traces |
| | | e.printStackTrace(); |
| | | |
| | | } |
| | | |
| | | return classRefs; |
| | | } |
| | | |
| | | /** |
| | | * Permet verifier si une chaine est contenu un tableau de chaine |
| | | * |
| | | * @param value |
| | | * @param tab |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static boolean in(String value, String tab[]) { |
| | | |
| | | //Variables |
| | | boolean bool = false; |
| | | |
| | | //Si non null |
| | | if (tab != null && value != null) { |
| | | |
| | | //On parcourt la chaine |
| | | for (String obj : tab) { |
| | | |
| | | //Si trouv� |
| | | if (obj.equalsIgnoreCase(value)) { |
| | | |
| | | //On marque comme trouv� |
| | | bool = true; |
| | | |
| | | //On sort |
| | | break; |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | return bool; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Permet verifier si une chaine est contenu un tableau de chaine |
| | | * |
| | | * @param value |
| | | * @param tab |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static boolean contains(String value, String tab[]) { |
| | | |
| | | //Variables |
| | | boolean bool = false; |
| | | |
| | | //Si non null |
| | | if (tab != null && value != null) { |
| | | |
| | | //On parcourt la chaine |
| | | for (String obj : tab) { |
| | | |
| | | //Si trouv� |
| | | if (value.contains(obj)) { |
| | | |
| | | //On marque comme trouv� |
| | | bool = true; |
| | | |
| | | //On sort |
| | | break; |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | return bool; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Permet de charger le fichier |
| | | * |
| | | * @param contenuDuFichier |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static List<String> lireFichier(File fichier) throws Exception { |
| | | |
| | | //Variables |
| | | List<String> lignes = null; |
| | | |
| | | //On charge le fichier |
| | | lignes = chargerLesDonnees(new FileInputStream(fichier)); |
| | | |
| | | return lignes; |
| | | } |
| | | |
| | | /** |
| | | * Permet de charger le fichier |
| | | * |
| | | * @param contenuDuFichier |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static List<String> chargerLesDonnees(Object contenuDuFichier) throws Exception { |
| | | |
| | | //Variables |
| | | FileInputStream fichier = (FileInputStream) contenuDuFichier; |
| | | InputStreamReader inputStreamReader = new InputStreamReader(fichier); |
| | | BufferedReader entree; |
| | | List<String> contenuFichier; |
| | | String ligne = null; |
| | | |
| | | //Affectation |
| | | entree = new BufferedReader((Reader) inputStreamReader); |
| | | contenuFichier = new ArrayList<String>(); |
| | | |
| | | //On parcourt ligne par ligne le fichier |
| | | while (true) { |
| | | |
| | | //On lie une ligne dans le fichier |
| | | ligne = entree.readLine(); |
| | | |
| | | //Traitement si la ligne est non null |
| | | if (ligne != null) { |
| | | |
| | | //On recupere la ligne |
| | | contenuFichier.add(ligne); |
| | | } else { |
| | | |
| | | //On sort de la boucle |
| | | break; |
| | | |
| | | } |
| | | } |
| | | |
| | | //On close |
| | | entree.close(); |
| | | |
| | | return contenuFichier; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Permet de decouper le traitement en plusieurs processus |
| | | * |
| | | * @param <T> |
| | | * @param list |
| | | * @param subListNumber |
| | | * @return |
| | | */ |
| | | public static <T> List<List<T>> splitList(List<T> list, int subListNumber) { |
| | | |
| | | //Liste a retourner |
| | | List<List<T>> splitted = new ArrayList<List<T>>(); |
| | | |
| | | //Si la liste est vide |
| | | if (list == null || list.size() == 0) { |
| | | return splitted; |
| | | } |
| | | |
| | | //CAs sp?cifique du nombre de sous liste inf?rieur ? 1 |
| | | if (subListNumber <= 1) { |
| | | |
| | | //Ajout de la liste courante ? la liste des sous liste |
| | | splitted.add(list); |
| | | |
| | | //retour de la liste des sous liste |
| | | return splitted; |
| | | } |
| | | |
| | | //Taille de la liste |
| | | int listSize = list.size(); |
| | | |
| | | //taille de la sous liste |
| | | int subListSize = Math.max(listSize / (subListNumber - 1), 1); |
| | | |
| | | //parcours de la liste a splitter |
| | | for (int i = 0; i < listSize; i += subListSize) { |
| | | |
| | | //Ajout de la sous-liste |
| | | splitted.add(new ArrayList<T>(list.subList(i, Math.min(listSize, i + subListSize)))); |
| | | } |
| | | |
| | | //On retourne la liste des sous-liste |
| | | return splitted; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Retourn le chemin courant |
| | | * |
| | | * @return |
| | | */ |
| | | public static File getCurrentDirectory() { |
| | | String fileName = (String) System.getProperties().get("user.dir"); |
| | | return new File(fileName); |
| | | } |
| | | |
| | | public static Properties loadProperties(String filename) { |
| | | Properties properties = new Properties(); |
| | | |
| | | try { |
| | | |
| | | //On charge le fichier de config |
| | | properties.load(new FileInputStream(filename)); |
| | | |
| | | } catch (Exception ex) { |
| | | |
| | | //On affiche l'erreur |
| | | ex.printStackTrace(); |
| | | |
| | | } |
| | | |
| | | return properties; |
| | | } |
| | | |
| | | /** |
| | | * Permet d'ecrire le fichier sur el disque |
| | | * |
| | | * @param content |
| | | * @param filename |
| | | * @throws IOException |
| | | */ |
| | | public static void ecrireFichier(byte[] content, String filename) throws IOException { |
| | | File file = new File(filename); |
| | | if (!file.exists()) { |
| | | file.createNewFile(); |
| | | } |
| | | FileOutputStream fop = new FileOutputStream(file); |
| | | fop.write(content); |
| | | fop.flush(); |
| | | fop.close(); |
| | | } |
| | | |
| | | /** |
| | | * Permet de recup�erer le nom du fichier |
| | | * |
| | | * @param headers |
| | | * @return |
| | | */ |
| | | public static String getNomFichier(MultivaluedMap<String, String> headers) { |
| | | String[] contentDisposition = headers.getFirst("Content-Disposition").split(";"); |
| | | for (String filename : contentDisposition) { |
| | | if ((filename.trim().startsWith("filename"))) { |
| | | String[] name = filename.split("="); |
| | | String finalFileName = name[1].trim().replaceAll("\"", ""); |
| | | return finalFileName; |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | // |
| | | // /** |
| | | // * Permet de convertir un object java en json |
| | | // * |
| | | // * @param objects |
| | | // * @return |
| | | // */ |
| | | // public static String convertirJavaToJson(List<Object> objects) { |
| | | // |
| | | // //Variables |
| | | // ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); |
| | | // StringBuilder json = new StringBuilder(); |
| | | // |
| | | // try { |
| | | // |
| | | // //Si non null |
| | | // if (objects != null && !objects.isEmpty()) { |
| | | // |
| | | // //On parcourt la liste |
| | | // for (Object obj : objects) { |
| | | // |
| | | // //On parse en json |
| | | // json.append(convertirJavaToJson(obj)); |
| | | // |
| | | // } |
| | | // |
| | | // } |
| | | // |
| | | // } catch (Exception ex) { |
| | | // |
| | | // //On affiche l'erreur |
| | | // ex.printStackTrace(); |
| | | // |
| | | // } |
| | | // |
| | | // return json.toString(); |
| | | // |
| | | // } |
| | | |
| | | /** |
| | | * Permet de convertir un object java en json |
| | | * |
| | | * @param object |
| | | * @return |
| | | */ |
| | | // public static String convertirJavaToJson(Object object) { |
| | | // |
| | | // //Variables |
| | | // ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); |
| | | // String json = null; |
| | | // |
| | | // try { |
| | | // |
| | | // //On convertit en json |
| | | // json = ow.writeValueAsString(object); |
| | | // |
| | | // } catch (Exception ex) { |
| | | // |
| | | // //On affiche l'erreur |
| | | // ex.printStackTrace(); |
| | | // |
| | | // } |
| | | // |
| | | // return json; |
| | | // |
| | | // } |
| | | /** |
| | | * Permet de hacher le mot de passe |
| | | * |
| | | * @param password |
| | | * @return |
| | | * @throws NoSuchAlgorithmException |
| | | * @throws InvalidKeySpecException |
| | | */ |
| | | public static String encryptPassword(String password) { |
| | | |
| | | try { |
| | | |
| | | int iterations = 1000; |
| | | char[] chars = password.toCharArray(); |
| | | byte[] salt = getSalt(); |
| | | |
| | | PBEKeySpec spec = new PBEKeySpec(chars, salt, iterations, 64 * 8); |
| | | SecretKeyFactory skf = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); |
| | | |
| | | byte[] hash = skf.generateSecret(spec).getEncoded(); |
| | | return iterations + ":" + toHex(salt) + ":" + toHex(hash); |
| | | |
| | | } catch (Exception ex) { |
| | | |
| | | //On affiche le message d'errreur |
| | | ex.printStackTrace(); |
| | | |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @return @throws NoSuchAlgorithmException |
| | | */ |
| | | public static byte[] getSalt() throws NoSuchAlgorithmException { |
| | | SecureRandom sr = SecureRandom.getInstance("SHA1PRNG"); |
| | | byte[] salt = new byte[16]; |
| | | sr.nextBytes(salt); |
| | | return salt; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param array |
| | | * @return |
| | | * @throws NoSuchAlgorithmException |
| | | */ |
| | | public static String toHex(byte[] array) throws NoSuchAlgorithmException { |
| | | BigInteger bi = new BigInteger(1, array); |
| | | String hex = bi.toString(16); |
| | | |
| | | int paddingLength = (array.length * 2) - hex.length(); |
| | | if (paddingLength > 0) { |
| | | return String.format("%0" + paddingLength + "d", 0) + hex; |
| | | } else { |
| | | return hex; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Permet de valider le mot de passe |
| | | * |
| | | * @param originalPassword |
| | | * @param storedPassword |
| | | * @return |
| | | * @throws NoSuchAlgorithmException |
| | | * @throws InvalidKeySpecException |
| | | */ |
| | | public static boolean validerMotDePasse(String originalPassword, String storedPassword) |
| | | throws NoSuchAlgorithmException, InvalidKeySpecException { |
| | | String[] parts = storedPassword.split(":"); |
| | | int iterations = Integer.parseInt(parts[0]); |
| | | |
| | | byte[] salt = fromHex(parts[1]); |
| | | byte[] hash = fromHex(parts[2]); |
| | | |
| | | PBEKeySpec spec = new PBEKeySpec(originalPassword.toCharArray(), |
| | | salt, iterations, hash.length * 8); |
| | | SecretKeyFactory skf = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); |
| | | byte[] testHash = skf.generateSecret(spec).getEncoded(); |
| | | |
| | | int diff = hash.length ^ testHash.length; |
| | | for (int i = 0; i < hash.length && i < testHash.length; i++) { |
| | | diff |= hash[i] ^ testHash[i]; |
| | | } |
| | | return diff == 0; |
| | | } |
| | | |
| | | /** |
| | | * Permet de convertir un hexadeicmal en tableau de byte |
| | | * |
| | | * @param hex |
| | | * @return |
| | | * @throws NoSuchAlgorithmException |
| | | */ |
| | | public static byte[] fromHex(String hex) throws NoSuchAlgorithmException { |
| | | byte[] bytes = new byte[hex.length() / 2]; |
| | | for (int i = 0; i < bytes.length; i++) { |
| | | bytes[i] = (byte) Integer.parseInt(hex.substring(2 * i, 2 * i + 2), 16); |
| | | } |
| | | return bytes; |
| | | } |
| | | |
| | | /** |
| | | * Permet de convertir une chaine en date |
| | | * |
| | | * @param formatSource |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static Date getStringToDate(String formatSource, String date) { |
| | | |
| | | //Variables |
| | | SimpleDateFormat valeur = new SimpleDateFormat(formatSource); |
| | | |
| | | try { |
| | | |
| | | return valeur.parse(date); |
| | | |
| | | } catch (Exception ex) { |
| | | |
| | | //On affiche l'erreur |
| | | ex.printStackTrace(); |
| | | |
| | | return null; |
| | | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Permet de generer des nomre aleatorement |
| | | * |
| | | * @return |
| | | */ |
| | | public static synchronized String genererChaineAleatoire() { |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | String nombre = format.format(new Date()) + String.valueOf((int) (Math.random() * 1000000000)); |
| | | return nombre; |
| | | } |
| | | |
| | | /** |
| | | * Echapper des caractere pour une requete sql |
| | | * |
| | | * @param chaine |
| | | * @return |
| | | */ |
| | | public static String echapperCaractereRequete(String chaine) { |
| | | |
| | | //Si non null |
| | | if (chaine != null) { |
| | | |
| | | //on echappe |
| | | chaine = chaine.replaceAll("'", "''"); |
| | | |
| | | //On retourne |
| | | return chaine; |
| | | |
| | | } else { |
| | | return ""; |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Permet de determiner le nombre d'occurences de cheques |
| | | * |
| | | * @param ncheque |
| | | * @return |
| | | */ |
| | | public static int getNombreChequesTrouve(Map<String, Object> nbreOccurencesCheques, String numeroCheque) { |
| | | |
| | | //Variables |
| | | int nbre = 0; |
| | | |
| | | //On teste si la liste est non vide |
| | | if (nbreOccurencesCheques != null && nbreOccurencesCheques.get(numeroCheque.trim()) != null) { |
| | | |
| | | //On recupere le nombre |
| | | nbre = ((BigDecimal) nbreOccurencesCheques.get(numeroCheque.trim())).intValue(); |
| | | |
| | | } |
| | | |
| | | return nbre; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Permet de mettre la premi�re lettre en majuscule uniquement |
| | | * |
| | | * @param chaine |
| | | * @return |
| | | */ |
| | | public static String mettreLesPremieresLettresChaineEnMajuscule(String chaine) { |
| | | |
| | | //Vairiables |
| | | String resultat = ""; |
| | | String tab[] = null; |
| | | |
| | | //On splitte sur la base des espaces |
| | | tab = chaine.split(" "); |
| | | |
| | | if (tab != null) { |
| | | |
| | | //On parcourt la chaine |
| | | for (int i = 0; i < tab.length; i++) { |
| | | |
| | | //Si nous ne sommes pas encore arriv� � la fin de la chaine |
| | | if (i < (tab.length - 1)) { |
| | | resultat = resultat + mettrePremiereLettreEnMajuscule(tab[i]) + " "; |
| | | } else { |
| | | resultat = resultat + mettrePremiereLettreEnMajuscule(tab[i]); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | return resultat; |
| | | } |
| | | |
| | | /** |
| | | * Permet de mettre la premi�re lettre en majuscule uniquement |
| | | * |
| | | * @param chaine |
| | | * @return |
| | | */ |
| | | public static String mettrePremiereLettreEnMajuscule(String chaine) { |
| | | |
| | | //Variables |
| | | String resultat = ""; |
| | | |
| | | if (chaine != null && !chaine.isEmpty()) { |
| | | |
| | | //On met toute la chaine en minuscule |
| | | resultat = chaine.toLowerCase(); |
| | | |
| | | //On met la premiere lettre en majucule |
| | | char premiereLettre = resultat.charAt(0); |
| | | |
| | | // convert it to an UpperCase letter |
| | | char premiereLettreMajuscule = Character.toUpperCase(premiereLettre); |
| | | |
| | | //On ajoute remplace la premiere lettre |
| | | resultat = resultat.replaceFirst(Character.toString(resultat.charAt(0)), Character.toString(premiereLettreMajuscule)); |
| | | |
| | | } |
| | | |
| | | return resultat; |
| | | } |
| | | |
| | | /** |
| | | * Permet de convertir la date en toutes lettres |
| | | * |
| | | * @param date |
| | | * @param langue |
| | | * @param format |
| | | * @return |
| | | */ |
| | | public static String convertirDateEnToutesLettres(Date date, Locale langue, FormatStyle format) { |
| | | |
| | | //Variables |
| | | LocalDate dateConvertie = null; |
| | | String resultat = ""; |
| | | |
| | | //Si non null |
| | | if (date != null) { |
| | | |
| | | //On convertit la date en type LocalDate |
| | | dateConvertie = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | |
| | | //On convertit en toutes lettres |
| | | resultat = dateConvertie.format(DateTimeFormatter.ofLocalizedDate(format).withLocale(langue)); |
| | | |
| | | } |
| | | |
| | | return resultat; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Permet de formatter une date |
| | | * |
| | | * @return the datePresentation |
| | | */ |
| | | public static String formaterDate(String format, Date date) { |
| | | |
| | | if (date != null) { |
| | | return new SimpleDateFormat(format).format(date); |
| | | } else { |
| | | return ""; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Permet de formatter une date recu yyyyMMdd en ce format dd/MM/yy |
| | | * |
| | | * @return the datePresentation |
| | | */ |
| | | public static String formatetterDate3(String dateAformatee) { |
| | | |
| | | //On formate la date jj/MM/yyyy |
| | | String dateFormatee = null; |
| | | |
| | | if (dateAformatee != null) { |
| | | |
| | | String annee = dateAformatee.substring(0, 2); |
| | | String mois = dateAformatee.substring(2, 4); |
| | | String jour = dateAformatee.substring(4, 6); |
| | | dateFormatee = jour + "/" + mois + "/" + annee; |
| | | |
| | | return dateFormatee; |
| | | |
| | | } else { |
| | | |
| | | return dateAformatee; |
| | | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Prend une date au format yyyyMMdd et la transforme au format dd/MM/yyyy |
| | | * |
| | | * @param date |
| | | */ |
| | | public static String formaterDateddMMyyyy(String date) { |
| | | |
| | | //On formate la date jj/MM/yyyy |
| | | String dateFormatee = null; |
| | | |
| | | if (date != null) { |
| | | |
| | | String annee = date.substring(0, 4); |
| | | String mois = date.substring(4, 6); |
| | | String jour = date.substring(6, 8); |
| | | dateFormatee = jour + "/" + mois + "/" + annee; |
| | | |
| | | return dateFormatee; |
| | | } else { |
| | | return date; |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Prend une date au format yyyyMMddHHmmss et la transforme au format |
| | | * dd/MM/yyyy � HH:mm:ss |
| | | * |
| | | * @param date |
| | | */ |
| | | public static String formaterDateddMMyyyyHHmmss(String date) { |
| | | |
| | | //On formate la date jj/MM/yyyy |
| | | String dateFormatee = null; |
| | | String heureFormatee = null; |
| | | |
| | | if (date != null) { |
| | | |
| | | String annee = date.substring(0, 4); |
| | | String mois = date.substring(4, 6); |
| | | String jour = date.substring(6, 8); |
| | | String heure = date.substring(8, 10); |
| | | String minute = date.substring(10, 12); |
| | | String seconde = date.substring(12, 14); |
| | | |
| | | dateFormatee = jour + "/" + mois + "/" + annee; |
| | | heureFormatee = heure + ":" + minute + ":" + seconde; |
| | | |
| | | return dateFormatee + " � " + heureFormatee; |
| | | } else { |
| | | return date; |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Prend une date au format yyMMdd et la transforme au format dd/MM/yy |
| | | * |
| | | * @param date |
| | | */ |
| | | public static String formaterDateyyMMdd(String date) { |
| | | |
| | | //On formate la date jj/MM/yyyy |
| | | String dateFormatee = null; |
| | | |
| | | if (date != null) { |
| | | |
| | | String annee = date.substring(0, 2); |
| | | String mois = date.substring(2, 4); |
| | | String jour = date.substring(4, 6); |
| | | dateFormatee = jour + "/" + mois + "/" + annee; |
| | | |
| | | return dateFormatee; |
| | | } else { |
| | | return date; |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * On affiche l'etat du virement |
| | | * |
| | | * @param item |
| | | * @return |
| | | */ |
| | | public static String getCodeAgenceToRIB(String rib) { |
| | | |
| | | //On test si le rib respecte la taille |
| | | if (rib != null && rib.length() >= 10) { |
| | | return rib.substring(5, 10); |
| | | } else { |
| | | return rib; |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Permet de formatter une date recu yyyyMMdd en ce format dd/MM/yyyy |
| | | * |
| | | * @return the datePresentation |
| | | */ |
| | | public static String formaterDateAuFormat(String format, String date) { |
| | | |
| | | //Variables |
| | | Date valeur = null; |
| | | String dateFinale = ""; |
| | | SimpleDateFormat formatDest = new SimpleDateFormat("dd/MM/yyyy"); |
| | | |
| | | //On recup�re la date |
| | | if (date != null && !date.trim().isEmpty()) { |
| | | |
| | | try { |
| | | |
| | | //Onr recupere la date |
| | | valeur = new SimpleDateFormat(format).parse(date); |
| | | |
| | | //On formate au bon format |
| | | dateFinale = formatDest.format(valeur); |
| | | |
| | | } catch (ParseException ex) { |
| | | |
| | | //On affiche l'erreur |
| | | ex.printStackTrace(); |
| | | |
| | | } |
| | | } |
| | | |
| | | return dateFinale; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Fonction permettant d'appliquer le s�parateur de millier sur les montants |
| | | * |
| | | * @param montant |
| | | * @return |
| | | */ |
| | | public static String separateurMillier(BigDecimal montant) { |
| | | NumberFormat numberFormat = NumberFormat.getInstance(java.util.Locale.FRENCH); |
| | | return (numberFormat.format(montant)); |
| | | } |
| | | |
| | | /** |
| | | * Permet de formatter une date |
| | | * |
| | | * @param formatSource |
| | | * @param date |
| | | * @param formatDestinataire |
| | | * @return |
| | | */ |
| | | public static String formaterDateAuFormat(String formatSource, String date, String formatDestinataire) { |
| | | |
| | | //Variables |
| | | Date valeur = null; |
| | | String dateFinale = ""; |
| | | SimpleDateFormat format = new SimpleDateFormat(formatDestinataire); |
| | | |
| | | //On recup�re la date |
| | | if (date != null && !date.trim().isEmpty()) { |
| | | |
| | | try { |
| | | |
| | | //Onr recupere la date |
| | | valeur = new SimpleDateFormat(formatSource).parse(date); |
| | | |
| | | //On formate au bon format |
| | | dateFinale = format.format(valeur); |
| | | |
| | | } catch (ParseException ex) { |
| | | |
| | | //On affiche l'erreur |
| | | ex.printStackTrace(); |
| | | |
| | | } |
| | | } |
| | | |
| | | return dateFinale; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Permet determiner confirmation Sygma |
| | | * |
| | | * @param taille |
| | | * @param chaine |
| | | * @return |
| | | */ |
| | | public static String determinerConfirmation(String dateReglement) { |
| | | |
| | | //On teste si la chaine est non vide |
| | | if (dateReglement != null && !dateReglement.isEmpty()) { |
| | | return "Confirm�"; |
| | | } else { |
| | | return "Non Confirm�"; |
| | | } |
| | | |
| | | } |
| | | |
| | | public static String getFileExtension(String fileName) { |
| | | String extension = ""; |
| | | |
| | | try { |
| | | extension = fileName.substring(fileName.lastIndexOf(".")); |
| | | } catch (Exception e) { |
| | | extension = ""; |
| | | } |
| | | |
| | | return extension; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Permet de retourer la taille en Kilo d'un fichier |
| | | * |
| | | * @param file |
| | | * @return |
| | | */ |
| | | public static double getFileSizeKiloOctects(double octets) { |
| | | return (double) octets / 1024; |
| | | } |
| | | |
| | | /** |
| | | * Permet de convertir un type en long en type Date |
| | | * |
| | | * @param file |
| | | * @return |
| | | */ |
| | | public static Date convertLongTODate(Long time) { |
| | | |
| | | //Variables |
| | | Calendar c = Calendar.getInstance(); |
| | | Date date = null; |
| | | |
| | | //Si non null |
| | | if (time != null) { |
| | | |
| | | //On set la valeur |
| | | c.setTimeInMillis(time); |
| | | |
| | | //On recup�re la date |
| | | date = c.getTime(); |
| | | |
| | | } |
| | | |
| | | return date; |
| | | } |
| | | |
| | | public static String buildErrorMessage(List<String> errors) { |
| | | StringBuilder stringBuilder = new StringBuilder(""); |
| | | int size = errors.size(); |
| | | IntStream.range(0, size).forEach(index -> { |
| | | String message = errors.get(index); |
| | | if ((index + 1) < size) { |
| | | stringBuilder.append(message).append("\n"); |
| | | } else { |
| | | stringBuilder.append(message); |
| | | } |
| | | }); |
| | | return stringBuilder.toString(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.tools; |
| | | |
| | | import java.io.BufferedInputStream; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.nio.charset.Charset; |
| | | import java.nio.charset.UnsupportedCharsetException; |
| | | import org.apache.tika.parser.txt.CharsetDetector; |
| | | import org.apache.tika.parser.txt.CharsetMatch; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class FileUtilities { |
| | | public static Charset getCharset(File file) throws FileNotFoundException, IOException { |
| | | |
| | | try ( InputStream stream = new FileInputStream(file); InputStream input = new BufferedInputStream(stream);) { |
| | | CharsetDetector charsetDetector = new CharsetDetector(); |
| | | |
| | | charsetDetector.setText(input); |
| | | |
| | | CharsetMatch charsetMatch = charsetDetector.detect(); |
| | | String charsetName = charsetMatch != null ? charsetMatch.getName() : "UTF-8"; |
| | | |
| | | return Charset.forName(charsetName); |
| | | |
| | | } catch(UnsupportedCharsetException ex) { |
| | | return Charset.forName("UTF-8"); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.tools; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import javax.xml.bind.JAXBContext; |
| | | import javax.xml.bind.JAXBException; |
| | | import javax.xml.bind.Unmarshaller; |
| | | import javax.xml.stream.XMLInputFactory; |
| | | import javax.xml.stream.XMLStreamException; |
| | | import javax.xml.stream.XMLStreamReader; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public class XmlUtils { |
| | | |
| | | private XmlUtils() { |
| | | } |
| | | |
| | | public static Object unMarshal(File xmlFile, Class<?> classe) throws JAXBException, FileNotFoundException, XMLStreamException { |
| | | XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance(); |
| | | XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(new FileInputStream(xmlFile)); |
| | | |
| | | JAXBContext jaxbContext = JAXBContext.newInstance(classe); |
| | | Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); |
| | | return jaxbUnmarshaller.unmarshal(xmlStreamReader); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.tools.exceptions; |
| | | |
| | | import javax.ws.rs.WebApplicationException; |
| | | import javax.ws.rs.core.MediaType; |
| | | import javax.ws.rs.core.Response; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public class ApplicationForbidenException extends WebApplicationException { |
| | | |
| | | private final String messsage; |
| | | |
| | | public ApplicationForbidenException(String messsage) { |
| | | super(); |
| | | this.messsage = messsage; |
| | | } |
| | | |
| | | @Override |
| | | public Response getResponse() { |
| | | return Response |
| | | .status(403) |
| | | .entity(messsage) |
| | | .type(MediaType.APPLICATION_JSON) |
| | | .build(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.tools.exceptions; |
| | | |
| | | import javax.ws.rs.WebApplicationException; |
| | | import javax.ws.rs.core.MediaType; |
| | | import javax.ws.rs.core.Response; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public class ApplicationServerException extends WebApplicationException { |
| | | |
| | | @Override |
| | | public Response getResponse() { |
| | | return Response.status(500).entity("Erreur serveur").type(MediaType.APPLICATION_JSON).build(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.apifdxweb.tools.exceptions; |
| | | |
| | | import javax.ws.rs.WebApplicationException; |
| | | import javax.ws.rs.core.MediaType; |
| | | import javax.ws.rs.core.Response; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public class ApplicationValidationException extends WebApplicationException { |
| | | |
| | | private final String messsage; |
| | | |
| | | public ApplicationValidationException(String messsage) { |
| | | super(); |
| | | this.messsage = messsage; |
| | | } |
| | | |
| | | @Override |
| | | public Response getResponse() { |
| | | return Response |
| | | .status(422) |
| | | .entity(messsage) |
| | | .type(MediaType.APPLICATION_JSON) |
| | | .build(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license |
| | | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template |
| | | */ |
| | | package com.megatim.apifdxweb.tools.jaxb.util; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.io.Reader; |
| | | import java.nio.charset.Charset; |
| | | import javax.xml.bind.JAXBContext; |
| | | import javax.xml.bind.JAXBException; |
| | | import javax.xml.bind.Marshaller; |
| | | import javax.xml.bind.Unmarshaller; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class JaxBUtil { |
| | | |
| | | public static <T> T convertXmlFileToObject(String fileName, Class<T> clazz) throws Exception { |
| | | JAXBContext context = JAXBContext.newInstance(clazz); |
| | | Unmarshaller unmarshaller = context.createUnmarshaller(); |
| | | InputStream inputStream = new FileInputStream(fileName); |
| | | Reader reader = new InputStreamReader(inputStream, Charset.forName("UTF-8")); |
| | | BufferedReader buffer = new BufferedReader(reader); |
| | | return (T) unmarshaller.unmarshal(buffer); |
| | | } |
| | | |
| | | public static void buildXmlFile(Class clazz, String fileName, Object valueToWrite) throws JAXBException { |
| | | JAXBContext jaxbContext = JAXBContext.newInstance(clazz); |
| | | Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); |
| | | jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); |
| | | jaxbMarshaller.marshal(valueToWrite, new File(fileName)); |
| | | //jaxbMarshaller.marshal(valueToWrite, System.out); |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project-shared-configuration> |
| | | <!-- |
| | | This file contains additional configuration written by modules in the NetBeans IDE. |
| | | The configuration is intended to be shared among all the users of project and |
| | | therefore it is assumed to be part of version control checkout. |
| | | Without this configuration present, some functionality in the IDE may be limited or fail altogether. |
| | | --> |
| | | <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1"> |
| | | <!-- |
| | | Properties that influence various parts of the IDE, especially code formatting and the like. |
| | | You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up. |
| | | That way multiple projects can share the same settings (useful for formatting rules for example). |
| | | Any value defined here will override the pom.xml file value but is only applicable to the current project. |
| | | --> |
| | | <netbeans.hint.jdkPlatform>JDK_1.8</netbeans.hint.jdkPlatform> |
| | | </properties> |
| | | </project-shared-configuration> |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| | | <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"> |
| | | |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <groupId>com.megatim.apifdxweb</groupId> |
| | | <artifactId>apifdxweb</artifactId> |
| | | <version>1.0</version> |
| | | <packaging>pom</packaging> |
| | | |
| | | <modules> |
| | | <module>apifdxweb-tools</module> |
| | | <module>apifdxweb-model</module> |
| | | <module>apifdxweb-dao-ifaces</module> |
| | | <module>apifdxweb-dao-impl</module> |
| | | <module>apifdxweb-core-ifaces</module> |
| | | <module>apifdxweb-core-impl</module> |
| | | <module>apifdxweb-service-ifaces</module> |
| | | <module>apifdxweb-service-impl</module> |
| | | </modules> |
| | | |
| | | <properties> |
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| | | <version>1.0</version> |
| | | </properties> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.megatim.fdxcommons.core.impl</groupId> |
| | | <artifactId>fdxcommons-core-impl</artifactId> |
| | | <version>1.0</version> |
| | | </dependency> |
| | | </dependencies> |
| | | </project> |