add fdx-commons and fdx-consultation
| 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.fdxcommons</groupId> |
| | | <artifactId>fdxcommons</artifactId> |
| | | <version>1.0</version> |
| | | </parent> |
| | | |
| | | <groupId>com.megatim.fdxcommons.core.ifaces</groupId> |
| | | <artifactId>fdxcommons-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.fdxcommons.dao.ifaces</groupId> |
| | | <artifactId>fdxcommons-dao-ifaces</artifactId> |
| | | <version>${project.version}</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>javax</groupId> |
| | | <artifactId>javaee-api</artifactId> |
| | | <version>${jakartaee}</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.bekosoftware</groupId> |
| | | <artifactId>genericDAOLayer</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.bekosoftware</groupId> |
| | | <artifactId>genericManagerLayer</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatimgroup</groupId> |
| | | <artifactId>mgt-commons-tools</artifactId> |
| | | <version>1.0-SNAPSHOT</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.fdxcommons.tools</groupId> |
| | | <artifactId>fdxcommons-tools</artifactId> |
| | | <version>${project.version}</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.hibernate</groupId> |
| | | <artifactId>hibernate-core</artifactId> |
| | | <version>5.3.0.Final</version> |
| | | <scope>compile</scope> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | <name>fdxcommons-core-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.fdxcommons.core.ifaces.abstracts; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.TypeDonnee; |
| | | import com.megatim.fdxcommons.model.search.SearchColumn; |
| | | import com.megatim.fdxcommons.tools.utils.SqlUtilities; |
| | | import java.lang.reflect.Field; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import javax.persistence.EnumType; |
| | | import javax.persistence.Enumerated; |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | import com.megatim.fdxcommons.model.search.CriteriaEntitySearch; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | * @param <T> : Entite reelle |
| | | * @param <ID> : Classe de l'identifiant |
| | | * @param <S> : entité de recherche |
| | | * @param <U> : entité qui représente un utilisateur |
| | | */ |
| | | public interface CustomManagerIFaces<T, ID, S, U> { |
| | | |
| | | <R extends CustomDAOIfaces<T, ID, S>> R getDao(); |
| | | |
| | | default T save(T entity) { |
| | | return getDao().save(entity); |
| | | } |
| | | |
| | | default void delete(T entity) { |
| | | getDao().delete(entity); |
| | | } |
| | | |
| | | public default T getById(ID id, U connectedUser) { |
| | | T entity = getDao().getById(id); |
| | | return entity; |
| | | } |
| | | |
| | | public default T getById(ID id) { |
| | | |
| | | return getDao().getById(id); |
| | | } |
| | | |
| | | public default List<T> findWithPagination(Integer pageNumber, Integer pagesize, S searchEntity, U connectedUser) { |
| | | return getDao().findWithPagination(pageNumber, pagesize, searchEntity); |
| | | } |
| | | |
| | | public default List<T> getAll(S searchEntity, U connectedUser) { |
| | | List<T> data = getDao().getAll(searchEntity); |
| | | return data; |
| | | } |
| | | |
| | | public default List<T> getAll(S searchEntity) { |
| | | List<T> data = getDao().getAll(searchEntity); |
| | | return data; |
| | | } |
| | | |
| | | public default List<T> getAll() { |
| | | return getDao().getAll(null); |
| | | } |
| | | |
| | | public default Long count(S searchEntity) { |
| | | return getDao().count(searchEntity); |
| | | } |
| | | |
| | | public default List<SearchColumn> getSearchColumns(Class<T> classe) { |
| | | List<SearchColumn> searchColumns = new ArrayList<>(); |
| | | List<Field> fields = Arrays.asList(classe.getDeclaredFields()); |
| | | |
| | | for (Field f : fields) { |
| | | CriteriaEntitySearch searchAnn = f.getAnnotation(CriteriaEntitySearch.class); |
| | | if (searchAnn != null) { |
| | | SearchColumn searchColumn = new SearchColumn(); |
| | | searchColumn.setLibelle(searchAnn.libelle()); |
| | | // searchColumn.setName(searchAnn.fieldName().isEmpty() ? f.getName() : searchAnn.fieldName()); |
| | | |
| | | TypeDonnee typeDonnee = getTypeDonnee(f, searchAnn); |
| | | |
| | | if (typeDonnee != null) { |
| | | searchColumn.setTypeDonnee(typeDonnee); |
| | | searchColumns.add(searchColumn); |
| | | } |
| | | |
| | | } |
| | | } |
| | | return searchColumns; |
| | | } |
| | | |
| | | public default TypeDonnee getTypeDonnee(Field field, CriteriaEntitySearch searchAnn) { |
| | | Class<?> fieldClass = field.getType(); |
| | | TypeDonnee typeDonnee = null; |
| | | |
| | | if (fieldClass.isPrimitive()) { |
| | | typeDonnee = SqlUtilities.typeDonneeFromJavaClass(fieldClass); |
| | | |
| | | } else if (fieldClass.isEnum()) { |
| | | Enumerated enumerated = field.getAnnotation(Enumerated.class); |
| | | typeDonnee = enumerated == null || enumerated.value().equals(EnumType.ORDINAL) ? TypeDonnee.NUMERIQUE : TypeDonnee.ALPHANUMERIQUE; |
| | | |
| | | } else if (!fieldClass.isInterface() && !Collection.class.isAssignableFrom(fieldClass) && !Map.class.isAssignableFrom(fieldClass)) { |
| | | String[] fieldPath = searchAnn.fieldName().split("\\."); |
| | | if (fieldPath.length < 2) { |
| | | typeDonnee = SqlUtilities.typeDonneeFromJavaClass(fieldClass); |
| | | } else { |
| | | typeDonnee = SqlUtilities.typeDonneeFromJavaClass(getFieldType(fieldClass, Arrays.copyOfRange(fieldPath, 1, fieldPath.length))); |
| | | } |
| | | } |
| | | |
| | | return typeDonnee; |
| | | } |
| | | |
| | | public default Class<?> getFieldType(Class<?> classe, String[] fieldPath) { |
| | | String fieldName = fieldPath[0]; |
| | | List<Field> fields = Arrays.asList(classe.getDeclaredFields()); |
| | | Optional<Field> optField = fields.stream().filter(f -> f.getName().equals(fieldName)).findFirst(); |
| | | |
| | | if (optField.isPresent()) { |
| | | Field field = optField.get(); |
| | | if (fieldPath.length == 1) { |
| | | return field.getType(); |
| | | } else { |
| | | return getFieldType(field.getType(), Arrays.copyOfRange(fieldPath, 1, fieldPath.length)); |
| | | } |
| | | } else { |
| | | return 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.fdxcommons.core.ifaces.customtypefichier; |
| | | |
| | | import com.megatim.fdxcommons.model.integration.TableDefinition; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface DynamicClassCreator { |
| | | |
| | | void createDynamicClasses(List<TableDefinition> tableDefinitions); |
| | | } |
| 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.fdxcommons.core.ifaces.dataproduction; |
| | | |
| | | import com.megatim.fdxcommons.model.dataproduction.CommonDataProduction; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface DataProductionHandler { |
| | | |
| | | CommonDataProduction handle(String codeTypeFichier, String connectedParticipant, String referentielVersion, String fileName); |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.core.ifaces.db; |
| | | |
| | | import com.megatim.fdxcommons.model.pojo.ReferentielToImportData; |
| | | import java.io.File; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public interface ImportReferentielHelper { |
| | | |
| | | ReferentielToImportData extractData(File referentielFile) throws Exception; |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.core.ifaces.db; |
| | | |
| | | import com.megatim.fdxcommons.model.pojo.ReferentielToImportData; |
| | | import com.megatim.fdxcommons.model.integration.TableDefinition; |
| | | import java.io.File; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ImportZipValidatorIfaces { |
| | | |
| | | /** |
| | | * Méthode qui extrait les informations des colonnes dans chaque validateur |
| | | * |
| | | * @param validatorDir |
| | | * @param referentielToImportData |
| | | * @return : Map<version_referentiel, |
| | | * Map<codeTypeFichier, Liste_colonnes_validateur>> @throws Exception |
| | | * @throws java.lang.Exception |
| | | */ |
| | | public List<TableDefinition> getTableDefinitions(File validatorDir, final ReferentielToImportData referentielToImportData) throws Exception; |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.core.ifaces.db; |
| | | |
| | | import com.megatim.fdxcommons.model.pojo.ReferentielToImportData; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ReferentielDataSaver { |
| | | |
| | | public void persist(ReferentielToImportData referentielToImportData) throws Exception; |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.core.ifaces.db.validators; |
| | | |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.model.pojo.BetweenOperatorValues; |
| | | import com.megatim.fdxcommons.model.pojo.CriteriaEntity; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public interface CriteriaQueryValidator { |
| | | |
| | | List<String> validate(CriteriaEntity criterion, Map<String, ColumnDefinition> columnDefinitionsMap); |
| | | |
| | | public BetweenOperatorValues getBetweenOperatorValues(Object value); |
| | | |
| | | } |
| 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.fdxcommons.core.ifaces.db.validators; |
| | | |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.model.pojo.QueryParameterFromView; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ParametersValidator { |
| | | List<String> validate(List<QueryParameterFromView> parametersFromView, Map<String, ColumnDefinition> columnDefinitionsMap); |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.core.ifaces.helper; |
| | | |
| | | import com.megatim.fdxcommons.model.pojo.DataInMemory; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface DataInMemoryHandler { |
| | | |
| | | void initializeDataInMemory(); |
| | | |
| | | DataInMemory getDataInMemory(); |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.core.ifaces.helper; |
| | | |
| | | import com.megatim.fdxcommons.model.pojo.ReferentielToImportData; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ReferentielConsumptionHelper { |
| | | |
| | | void consume(ReferentielToImportData referentielToImportData) throws Exception; |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.core.ifaces.helper.referentiel; |
| | | |
| | | import com.megatim.fdxcommons.model.integration.TableDefinition; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public interface DynamicTableCreator { |
| | | |
| | | public void createDynamicTables(List<TableDefinition> tableDefinitions) throws Exception; |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.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.fdxcommons.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 |
| | |
| | | /* |
| | | * 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.fdxcommons.core.ifaces.helper.referentiel; |
| | | |
| | | import com.megatim.fdxcommons.model.integration.TableDefinition; |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProductionFichier; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface TableDefinitionChecker { |
| | | boolean isSame(TableDefinition previousRefTableDef, TableDefinition nextRefTableDef, List<NatureProductionFichier> natureProductionFichiers); |
| | | } |
| 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.fdxcommons.core.ifaces.helper.referentiel; |
| | | |
| | | import com.megatim.fdxcommons.model.pojo.ReferentielToImportData; |
| | | import com.megatim.fdxcommons.model.referentiel.historique.ReferentielIntegrationHistorique; |
| | | import com.megatim.fdxcommons.model.referentiel.historique.pojo.TableDefinitionFiltered; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface TableDefinitionFilter { |
| | | |
| | | public TableDefinitionFiltered doFilter(String previousRef, ReferentielToImportData referentielToImportData, List<ReferentielIntegrationHistorique> refsHistoriqueIntegration); |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.core.ifaces.helper.referentiel; |
| | | |
| | | import com.megatim.fdxcommons.model.integration.TableDefinition; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ValidateurTypeFichierParser { |
| | | |
| | | public TableDefinition 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.fdxcommons.core.ifaces.integration; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface AppColumnCreator { |
| | | void create(); |
| | | } |
| 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.fdxcommons.core.ifaces.interceptor; |
| | | |
| | | import com.megatim.fdxcommons.model.log.ContainerContextDto; |
| | | import com.megatim.fdxcommons.model.log.UserActionLog; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface AfterUserAction { |
| | | UserActionLog filter(ContainerContextDto containerContext) 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.fdxcommons.core.ifaces.interceptor; |
| | | |
| | | import javax.ws.rs.container.ContainerRequestContext; |
| | | import javax.ws.rs.container.ResourceInfo; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface BeforeAction { |
| | | void filter(ContainerRequestContext crc, ResourceInfo resourceInfo); |
| | | } |
| 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.fdxcommons.core.ifaces.interceptor; |
| | | |
| | | import java.lang.reflect.Parameter; |
| | | import javax.ws.rs.core.MultivaluedMap; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface InterceptorHandler { |
| | | |
| | | String finalMessage(LoggingInterceptorBinding interceptorBinding, Parameter[] parameters, MultivaluedMap<String, String> queryParams, Object requestEntity, Object responseEntity) 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.fdxcommons.core.ifaces.interceptor; |
| | | |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | import javax.interceptor.InterceptorBinding; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @InterceptorBinding |
| | | @Target({ElementType.METHOD}) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | public @interface LoggingInterceptorBinding { |
| | | |
| | | public String message(); |
| | | |
| | | public Class<?> classe() default String.class; //classe de l'objet retourné |
| | | |
| | | public boolean shouldCopyData() default true; |
| | | } |
| 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.fdxcommons</groupId> |
| | | <artifactId>fdxcommons</artifactId> |
| | | <version>1.0</version> |
| | | </parent> |
| | | |
| | | <groupId>com.megatim.fdxcommons.core.impl</groupId> |
| | | <artifactId>fdxcommons-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> |
| | | |
| | | <!-- <dependencyManagement> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.apache.camel</groupId> |
| | | <artifactId>camel-bom</artifactId> |
| | | <version>3.14.8</version> |
| | | <type>pom</type> |
| | | <scope>import</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | </dependencyManagement>--> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.megatim.fdxcommons.dao.impl</groupId> |
| | | <artifactId>fdxcommons-dao-impl</artifactId> |
| | | <version>${project.version}</version> |
| | | <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.fdxcommons.core.ifaces</groupId> |
| | | <artifactId>fdxcommons-core-ifaces</artifactId> |
| | | <version>${project.version}</version> |
| | | <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.fdxcommons.tools</groupId> |
| | | <artifactId>fdxcommons-tools</artifactId> |
| | | <version>${project.version}</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>javax</groupId> |
| | | <artifactId>javaee-api</artifactId> |
| | | <version>${jakartaee}</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.bekosoftware</groupId> |
| | | <artifactId>genericManagerLayer</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatimgroup</groupId> |
| | | <artifactId>mgt-commons-tools</artifactId> |
| | | <version>1.0-SNAPSHOT</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.ibm.icu</groupId> |
| | | <artifactId>icu4j</artifactId> |
| | | <version>61.1</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>commons-validator</groupId> |
| | | <artifactId>commons-validator</artifactId> |
| | | <version>1.6</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>commons-io</groupId> |
| | | <artifactId>commons-io</artifactId> |
| | | <version>2.11.0</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.camel</groupId> |
| | | <artifactId>camel-core</artifactId> |
| | | <version>3.14.8</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.camel</groupId> |
| | | <artifactId>camel-endpointdsl</artifactId> |
| | | <version>3.14.8</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.camel</groupId> |
| | | <artifactId>camel-cdi</artifactId> |
| | | <version>3.14.8</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </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>fdxcommons-core-impl</name> |
| | | </project> |
| New file |
| | |
| | | package com.megatim.fdxcommons.core.impl.db; |
| | | |
| | | import com.megatim.fdxcommons.core.ifaces.db.ImportReferentielHelper; |
| | | import com.megatim.fdxcommons.core.ifaces.helper.referentiel.ReferentielToImportDataReader; |
| | | import com.megatim.fdxcommons.model.pojo.ReferentielToImportData; |
| | | import java.io.File; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | @Dependent |
| | | public class ImportReferentielHelperImpl implements ImportReferentielHelper { |
| | | |
| | | @Inject |
| | | private ReferentielToImportDataReader referentielToImportDataReader; |
| | | |
| | | |
| | | @Override |
| | | public ReferentielToImportData extractData(File referentielFile) throws Exception { |
| | | return referentielToImportDataReader.getData(referentielFile); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.core.impl.db; |
| | | |
| | | import com.megatim.fdxcommons.model.referentiel.Referentiel; |
| | | import com.megatim.fdxcommons.model.referentiel.ValidateurFichierConfiguration; |
| | | import com.megatim.fdxcommons.core.ifaces.db.ImportZipValidatorIfaces; |
| | | import com.megatim.fdxcommons.core.ifaces.helper.referentiel.ValidateurTypeFichierParser; |
| | | import com.megatim.fdxcommons.tools.exceptions.ImportReferentielException; |
| | | import com.megatim.fdxcommons.model.pojo.ReferentielToImportData; |
| | | import com.megatim.fdxcommons.model.integration.TableDefinition; |
| | | import java.io.File; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.LinkOption; |
| | | import java.nio.file.Path; |
| | | import java.nio.file.Paths; |
| | | import java.util.ArrayList; |
| | | 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.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class ImportZipValidatorImpl implements ImportZipValidatorIfaces { |
| | | |
| | | @Inject |
| | | private ValidateurTypeFichierParser validateurTypeFichierParser; |
| | | |
| | | @Override |
| | | public List<TableDefinition> getTableDefinitions(File validatorDir, ReferentielToImportData referentielToImportData) throws Exception { |
| | | |
| | | List<TableDefinition> tableDefinitions = new ArrayList<>(); |
| | | |
| | | if (validatorDir.isDirectory()) { |
| | | for (Referentiel referentiel : referentielToImportData.getReferentiels()) { |
| | | Path referentielPath = Paths.get(validatorDir.getAbsolutePath(), referentiel.getVersion()); |
| | | |
| | | //S'il n'existe pas un chemin correspondant à la version du referentiel en_cours |
| | | if (!Files.exists(referentielPath, LinkOption.NOFOLLOW_LINKS)) { |
| | | if (referentiel.getVersion().equals(referentielToImportData.getReferentielEnCours().getVersion())) { |
| | | throw new ImportReferentielException("Le répertoire '" + referentiel.getVersion() + "' des validateurs est introuvable"); |
| | | } else { |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | //Si ce chemin n'est pas celui d'un répertoire |
| | | if (!Files.isDirectory(referentielPath, LinkOption.NOFOLLOW_LINKS)) { |
| | | throw new ImportReferentielException("'" + referentiel.getVersion() + "' n'est pas un répertoire dans le repertoire des validateurs"); |
| | | } |
| | | |
| | | //Liste des configurations de validateurs associées au reférentiel en cours de traitement |
| | | List<ValidateurFichierConfiguration> validateursConfiguratioForReferentiel |
| | | = validateurFichierConfigurationForCurrentReferentiel(referentiel, referentielToImportData); |
| | | |
| | | Map<String, ValidateurFichierConfiguration> mapValidateurConfByFileName = fileNameToValidateurConfiguration(validateursConfiguratioForReferentiel); |
| | | |
| | | //Liste des répertoires des participants du referentiel en cours de traitement |
| | | File[] participantDirectories = (new File(validatorDir.getAbsolutePath(), referentiel.getVersion())).listFiles(); |
| | | for (File participantDirectory : participantDirectories) { |
| | | |
| | | //Si le fichier en cours de traitement est un répertoire |
| | | if (participantDirectory.isDirectory()) { |
| | | |
| | | //Liste des validateurs contenus dans le dossier d'un participant |
| | | File[] validateurs = participantDirectory.listFiles(); |
| | | |
| | | for (File validatorFile : validateurs) { |
| | | |
| | | if (validatorFile.isFile()) { |
| | | |
| | | if (mapValidateurConfByFileName.containsKey(validatorFile.getName())) { |
| | | TableDefinition tableDefinition = new TableDefinition(); |
| | | String codeTypeFichier = mapValidateurConfByFileName.get(validatorFile.getName()).getTypeFichier().getCode(); |
| | | |
| | | try { |
| | | tableDefinition = validateurTypeFichierParser.parseToColumnDefinition(validatorFile.getAbsolutePath(), |
| | | codeTypeFichier, referentiel.getVersion()); |
| | | } catch (Exception ex) { |
| | | tableDefinition.setColumnDefinitions(new ArrayList<>()); |
| | | Logger.getLogger(ImportZipValidatorImpl.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); |
| | | } |
| | | if (tableDefinition.getColumnDefinitions() != null && !tableDefinition.getColumnDefinitions().isEmpty()) { |
| | | tableDefinitions.add(tableDefinition); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return tableDefinitions; |
| | | } |
| | | |
| | | private List<ValidateurFichierConfiguration> validateurFichierConfigurationForCurrentReferentiel(Referentiel referentielEnCours, ReferentielToImportData referentielToImportData) { |
| | | return referentielToImportData.getValidateurFichierConfigurations() |
| | | .stream() |
| | | .filter(p -> p.getReferentiel().getVersion().equals(referentielEnCours.getVersion())) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * Classer les configurations des validateurs par nom du fichier |
| | | * |
| | | * @param validateursConf |
| | | * @return |
| | | */ |
| | | private Map<String, ValidateurFichierConfiguration> fileNameToValidateurConfiguration(List<ValidateurFichierConfiguration> validateursConfiguration) { |
| | | Map<String, ValidateurFichierConfiguration> mapValidateurConf = new HashMap<>(); |
| | | |
| | | for (ValidateurFichierConfiguration vc : validateursConfiguration) { |
| | | File file = new File(vc.getFileName()); |
| | | /** |
| | | * Dans le fichier zip du referentiel, le nom du fichier de |
| | | * validateur est en chemin absolu Raison pour laquelle il faut |
| | | * passer un objet de type 'File' afin de recupérer le nom relatif |
| | | * du fichier |
| | | */ |
| | | mapValidateurConf.put(file.getName(), vc); |
| | | } |
| | | |
| | | return mapValidateurConf; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.core.impl.db.validators; |
| | | |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.*; |
| | | import com.megatim.fdxcommons.model.enumeration.TypeDonnee; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.model.pojo.BetweenOperatorValues; |
| | | import com.megatim.fdxcommons.model.pojo.CriteriaEntity; |
| | | import com.megatim.fdxcommons.tools.exceptions.CommonApplicationValidationException; |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeParseException; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import javax.enterprise.context.Dependent; |
| | | import com.megatim.fdxcommons.core.ifaces.db.validators.CriteriaQueryValidator; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | @Dependent |
| | | public class CriteriaQueryValidatorImpl implements CriteriaQueryValidator { |
| | | |
| | | @Override |
| | | public List<String> validate(CriteriaEntity criterion, Map<String, ColumnDefinition> columnDefinitionsMap) { |
| | | List<String> errors = new ArrayList<>(); |
| | | // int index = 1; |
| | | // String numeroElt = " : Elément numéro " + index; |
| | | TypeDonnee typeDonnee = null; |
| | | |
| | | if (criterion != null && isNotEmptyCriteria(criterion)) { |
| | | if (criterion.getSubCriterias().isEmpty()) { |
| | | if (!validateCriteriaNomColonne(columnDefinitionsMap, criterion)) { |
| | | errors.add("Colonne '" + criterion.getNomColonne() + "' des critères de sélection est introuvable"); |
| | | |
| | | } else if ((typeDonnee = TypeDonnee.fromValeur(columnDefinitionsMap.get(criterion.getNomColonne().toLowerCase()).getTypeDonnee())) == null) { |
| | | errors.add("Le type de la colonne '" + criterion.getNomColonne() + "est introuvable"); |
| | | |
| | | } else if (!validateCriteriaEntityValue(criterion, typeDonnee)) { |
| | | errors.add("Type de données de la colonne " + criterion.getNomColonne() + " incorrect"); |
| | | } |
| | | } else { |
| | | if (criterion.getCriteriaLogicConnector() == null) { |
| | | errors.add("Le connecteur logique est absent"); |
| | | } |
| | | for (CriteriaEntity c : criterion.getSubCriterias()) { |
| | | errors.addAll(validate(c, columnDefinitionsMap)); |
| | | } |
| | | } |
| | | } |
| | | return errors; |
| | | } |
| | | |
| | | private boolean validateCriteriaNomColonne(Map<String, ColumnDefinition> columnDefinitionsMap, CriteriaEntity c) { |
| | | return c.getNomColonne() != null |
| | | && !c.getNomColonne().isEmpty() |
| | | && columnDefinitionsMap.containsKey(c.getNomColonne().toLowerCase()); |
| | | } |
| | | |
| | | private boolean validateCriteriaEntityValue(CriteriaEntity criteriaEntity, TypeDonnee typeDonnee) { |
| | | switch (criteriaEntity.getOperateur()) { |
| | | case LIKE: |
| | | return (criteriaEntity.getCriteriaValue() instanceof String) && columTypeIsString(typeDonnee); |
| | | case IN: |
| | | case NOT_IN: |
| | | return (criteriaEntity.getCriteriaValue() instanceof List<?>) && elementsOfList((List) criteriaEntity.getCriteriaValue(), typeDonnee); |
| | | case LOWER_OR_EQUALS_THAN: |
| | | case LOWER_THAN: |
| | | case GREATER_OR_EQUALS_THAN: |
| | | case GREATER_THAN: |
| | | case EQUALS: |
| | | case NOT_EQUALS: |
| | | return (criteriaEntity.getCriteriaValue() instanceof Comparable<?>) && criteriaValueHasCorrectType(criteriaEntity.getCriteriaValue(), typeDonnee); |
| | | case BETWEEN: |
| | | case NOT_BETWEEN: |
| | | BetweenOperatorValues betweenOperatorValues = getBetweenOperatorValues(criteriaEntity.getCriteriaValue()); |
| | | criteriaEntity.setCriteriaValue(betweenOperatorValues); |
| | | |
| | | return betweenOperatorValues != null |
| | | && criteriaValueHasCorrectType(betweenOperatorValues.getLowerBound(), typeDonnee) |
| | | && criteriaValueHasCorrectType(betweenOperatorValues.getUpperBound(), typeDonnee) |
| | | && betweenOperatorValuesAreCorrect(betweenOperatorValues, typeDonnee); |
| | | case IS_NULL: |
| | | case IS_NOT_NULL: |
| | | return criteriaEntity.getCriteriaValue() == null; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public BetweenOperatorValues getBetweenOperatorValues(Object value) { |
| | | BetweenOperatorValues betweenOperatorValues = null; |
| | | if (!(value instanceof LinkedHashMap)) { |
| | | throw new CommonApplicationValidationException("LinkedHashMap est attendu"); |
| | | } |
| | | LinkedHashMap<String, String> map = (LinkedHashMap) value; |
| | | String lowerBound = null; |
| | | String upperBound = null; |
| | | |
| | | for (String key : map.keySet()) { |
| | | if (key.equalsIgnoreCase("lowerBound")) { |
| | | lowerBound = map.get(key); |
| | | } |
| | | if (key.equalsIgnoreCase("upperBound")) { |
| | | upperBound = map.get(key); |
| | | } |
| | | } |
| | | StringBuilder message = new StringBuilder(""); |
| | | |
| | | if (lowerBound == null) { |
| | | message.append("Borne inférieure absente\n"); |
| | | } |
| | | if (upperBound == null) { |
| | | message.append("Borne supérieure absente"); |
| | | } |
| | | if (message.length() > 0) { |
| | | throw new CommonApplicationValidationException(message.toString()); |
| | | } |
| | | betweenOperatorValues = new BetweenOperatorValues(lowerBound, upperBound); |
| | | |
| | | return betweenOperatorValues; |
| | | } |
| | | |
| | | /** |
| | | * Vérifier que le borne inférieure est bel et bien inférieure à la borne |
| | | * supérieure |
| | | * |
| | | * @param betweenOperatorValues |
| | | * @param columnType |
| | | * @return |
| | | */ |
| | | private boolean betweenOperatorValuesAreCorrect(BetweenOperatorValues betweenOperatorValues, TypeDonnee typeDonnee) { |
| | | boolean result = false; |
| | | switch (typeDonnee) { |
| | | |
| | | case NUMERIQUE: |
| | | try { |
| | | Long lowerBound = Long.valueOf(betweenOperatorValues.getLowerBound().toString()); |
| | | Long upperBound = Long.valueOf(betweenOperatorValues.getUpperBound().toString()); |
| | | |
| | | result = lowerBound <= upperBound; |
| | | if (!result) { |
| | | throw new CommonApplicationValidationException("La borne inférieure ne peut être supérieure à la borne supérieure"); |
| | | } |
| | | } catch (NumberFormatException ex) { |
| | | } |
| | | break; |
| | | |
| | | case DECIMAL: |
| | | try { |
| | | BigDecimal lowerBound = new BigDecimal(betweenOperatorValues.getLowerBound().toString()); |
| | | BigDecimal upperBound = new BigDecimal(betweenOperatorValues.getUpperBound().toString()); |
| | | |
| | | result = lowerBound.compareTo(upperBound) <= 0; |
| | | if (!result) { |
| | | throw new CommonApplicationValidationException("La borne inférieure ne peut être supérieure à la borne supérieure"); |
| | | } |
| | | } catch (NumberFormatException ex) { |
| | | } |
| | | break; |
| | | |
| | | case DATE: |
| | | try { |
| | | Timestamp lowerBound = Timestamp.valueOf(LocalDateTime.parse(betweenOperatorValues.getLowerBound().toString())); |
| | | Timestamp upperBound = Timestamp.valueOf(LocalDateTime.parse(betweenOperatorValues.getUpperBound().toString())); |
| | | |
| | | result = lowerBound.before(upperBound); |
| | | if (!result) { |
| | | throw new CommonApplicationValidationException("La borne inférieure ne peut être supérieure à la borne supérieure"); |
| | | } |
| | | } catch (DateTimeParseException ex) { |
| | | } |
| | | break; |
| | | |
| | | default: |
| | | throw new CommonApplicationValidationException("L'opérarateur 'BETWEEN' n'est pas valable pour ce type de données " + typeDonnee); |
| | | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private boolean elementsOfList(List<?> elements, TypeDonnee typeDonnee) { |
| | | boolean result = true; |
| | | |
| | | for (Object elt : elements) { |
| | | result = criteriaValueHasCorrectType(elt, typeDonnee); |
| | | |
| | | if (!result) { |
| | | break; |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private boolean criteriaValueHasCorrectType(Object value, TypeDonnee typeDonnee) { |
| | | boolean result = false; |
| | | |
| | | switch (typeDonnee) { |
| | | case NUMERIQUE: |
| | | try { |
| | | Long.valueOf(value.toString()); |
| | | result = true; |
| | | } catch (NumberFormatException ex) { |
| | | } |
| | | break; |
| | | |
| | | case DECIMAL: |
| | | try { |
| | | new BigDecimal(value.toString()); |
| | | result = true; |
| | | } catch (Exception ex) { |
| | | } |
| | | break; |
| | | |
| | | case DATE: |
| | | try { |
| | | Timestamp.valueOf(LocalDateTime.parse(value.toString())); |
| | | result = true; |
| | | } catch (IllegalArgumentException ex) { |
| | | } |
| | | break; |
| | | |
| | | case ALPHANUMERIQUE: |
| | | result = value instanceof String; |
| | | break; |
| | | |
| | | default: |
| | | throw new CommonApplicationValidationException("Type de données inconnu"); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private boolean columTypeIsString(TypeDonnee typeDonnee) { |
| | | return typeDonnee.equals(TypeDonnee.ALPHANUMERIQUE); |
| | | } |
| | | |
| | | private boolean isNotEmptyCriteria(CriteriaEntity c) { |
| | | return c.getNomColonne() != null && !c.getNomColonne().isEmpty() && c.getOperateur() != null |
| | | || c.getSubCriterias() != null && !c.getSubCriterias().isEmpty(); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.core.impl.helper.referentiel; |
| | | |
| | | import com.megatim.fdxcommons.core.ifaces.db.ImportZipValidatorIfaces; |
| | | import com.megatim.fdxcommons.core.ifaces.helper.referentiel.ReferentielToImportDataReader; |
| | | import com.megatim.fdxcommons.core.ifaces.helper.referentiel.ReferentielXmlDataReader; |
| | | import com.megatim.fdxcommons.tools.exceptions.ImportReferentielException; |
| | | import com.megatim.fdxcommons.model.enumeration.StatutReferentiel; |
| | | import com.megatim.fdxcommons.model.pojo.ReferentielToImportData; |
| | | import com.megatim.fdxcommons.model.integration.TableDefinition; |
| | | import com.megatim.fdxcommons.model.referentiel.Referentiel; |
| | | import com.megatim.fdxcommons.tools.CommonAppContext; |
| | | import com.megatim.fdxcommons.tools.AppFileUtils; |
| | | import java.io.File; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | @Dependent |
| | | public class ReferentielToImportDataReaderImpl implements ReferentielToImportDataReader { |
| | | |
| | | @Inject |
| | | private ReferentielXmlDataReader referentielXmlDataReader; |
| | | |
| | | @Inject |
| | | private ImportZipValidatorIfaces importValidator; |
| | | |
| | | @Override |
| | | public ReferentielToImportData getData(File referentielFile) throws Exception { |
| | | |
| | | //On décompresse le fichier zip du référentiel dans le répertoire temporaire du serveur |
| | | File unzipDirectory = AppFileUtils.unzipFileInDirectory(referentielFile.getAbsolutePath(), CommonAppContext.TEMP_DIR); |
| | | |
| | | //Dans le répertoire décompressé, on décompresse encore le fichier contenant les fichiers xml des entités du référentiel |
| | | File unzipReferentielDirectory = AppFileUtils.unzipFileInDirectory((unzipDirectory + File.separator + CommonAppContext.REFERENTIEL_ZIP_FILE_NAME), unzipDirectory.getAbsolutePath()); |
| | | |
| | | //Indique le répertoire des validateurs du référentiel |
| | | File validateursDirectory = new File(unzipDirectory + File.separator + CommonAppContext.UNZIP_REFERENTIEL_VALIDATEUR_DIR_NAME); |
| | | |
| | | ReferentielToImportData referentielToImportData = new ReferentielToImportData(); |
| | | referentielToImportData.setFileName(referentielFile.getName()); |
| | | referentielXmlDataReader.readData(unzipReferentielDirectory, referentielToImportData); |
| | | |
| | | Referentiel referentielEncours = getReferentielEncours(referentielToImportData); |
| | | referentielToImportData.setReferentielEnCours(referentielEncours); |
| | | |
| | | //On extrait la définition des tables associées aux validateur (structures lignes) du référentiel EN COURS |
| | | List<TableDefinition> tableDefinitions = importValidator.getTableDefinitions(validateursDirectory, referentielToImportData); |
| | | referentielToImportData.setTableDefinitions(tableDefinitions); |
| | | |
| | | return referentielToImportData; |
| | | |
| | | } |
| | | |
| | | private Referentiel getReferentielEncours(ReferentielToImportData referentielToImportData) throws Exception { |
| | | List<Referentiel> referentiels = referentielToImportData.getReferentiels() |
| | | .stream() |
| | | .filter(p -> p.getStatutReferentiel().equals(StatutReferentiel.EN_COURS)) |
| | | .collect(Collectors.toList()); |
| | | |
| | | if (referentiels == null || referentiels.isEmpty()) { |
| | | throw new ImportReferentielException("Cette archive n'a pas de referentiel avec le statut EN COURS"); |
| | | } |
| | | |
| | | if (referentiels.size() > 1) { |
| | | throw new ImportReferentielException(referentiels.size() + " réferentiels en cours trouvés"); |
| | | } |
| | | |
| | | return referentiels.get(0); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.core.impl.helper.referentiel; |
| | | |
| | | import com.megatim.fdxcommons.core.ifaces.helper.referentiel.ReferentielXmlDataReader; |
| | | import com.megatim.fdxcommons.model.jaxb.ApplicationSourcesToExport; |
| | | import com.megatim.fdxcommons.model.jaxb.ExtensionFichiersToExport; |
| | | import com.megatim.fdxcommons.model.jaxb.GroupeNoeudsToExport; |
| | | import com.megatim.fdxcommons.model.jaxb.GroupeParticipantsToExport; |
| | | import com.megatim.fdxcommons.model.jaxb.NatureProductionFichiersToExport; |
| | | import com.megatim.fdxcommons.model.jaxb.NoeudsToExport; |
| | | import com.megatim.fdxcommons.model.jaxb.ParticipantsToExport; |
| | | import com.megatim.fdxcommons.model.jaxb.PaysToExport; |
| | | import com.megatim.fdxcommons.model.jaxb.ReferentielsToExport; |
| | | import com.megatim.fdxcommons.model.jaxb.RoutagesToExport; |
| | | import com.megatim.fdxcommons.model.jaxb.StructureLigneToExport; |
| | | import com.megatim.fdxcommons.model.jaxb.TypeFichiersToExport; |
| | | import com.megatim.fdxcommons.model.jaxb.ValidateurFichierConfigurationToExport; |
| | | import com.megatim.fdxcommons.model.jaxb.ValidateurFichierToExport; |
| | | import com.megatim.fdxcommons.model.pojo.ReferentielToImportData; |
| | | import com.megatim.fdxcommons.model.referentiel.ValidateurFichierConfiguration; |
| | | import com.megatim.fdxcommons.core.impl.tools.XmlUtils; |
| | | import java.io.File; |
| | | import java.util.List; |
| | | import javax.enterprise.context.Dependent; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | @Dependent |
| | | public class ReferentielXmlDataReaderImpl implements ReferentielXmlDataReader { |
| | | |
| | | @Override |
| | | public void readData(File referentielXmlFileDirectory, ReferentielToImportData referentielToImportData) throws Exception { |
| | | |
| | | if (referentielXmlFileDirectory.isDirectory()) { |
| | | |
| | | File[] xmlFiles = referentielXmlFileDirectory.listFiles(); |
| | | |
| | | for (File xmlFile : xmlFiles) { |
| | | |
| | | switch (xmlFile.getName()) { |
| | | |
| | | case "applicationSources.xml": |
| | | readApplicationSources(xmlFile, referentielToImportData); |
| | | break; |
| | | |
| | | case "extensionFichiers.xml": |
| | | readExtensionFichiers(xmlFile, referentielToImportData); |
| | | break; |
| | | |
| | | case "groupeNoeuds.xml": |
| | | readGroupeNoeuds(xmlFile, referentielToImportData); |
| | | break; |
| | | |
| | | case "structureLignes.xml": |
| | | readStructureLignes(xmlFile, referentielToImportData); |
| | | break; |
| | | |
| | | case "validateurFichiers.xml": |
| | | readValidateurFichiers(xmlFile, referentielToImportData); |
| | | break; |
| | | |
| | | case "groupeParticipants.xml": |
| | | readGroupeParticipants(xmlFile, referentielToImportData); |
| | | break; |
| | | |
| | | case "noeuds.xml": |
| | | readNoeuds(xmlFile, referentielToImportData); |
| | | break; |
| | | |
| | | case "participants.xml": |
| | | readParticipants(xmlFile, referentielToImportData); |
| | | break; |
| | | |
| | | case "pays.xml": |
| | | readPays(xmlFile, referentielToImportData); |
| | | break; |
| | | |
| | | case "referentiels.xml": |
| | | readReferentiels(xmlFile, referentielToImportData); |
| | | break; |
| | | |
| | | case "routages.xml": |
| | | readRoutages(xmlFile, referentielToImportData); |
| | | break; |
| | | |
| | | case "typeFichiers.xml": |
| | | readTypeFichiers(xmlFile, referentielToImportData); |
| | | break; |
| | | |
| | | case "validateurFichierConfigurations.xml": |
| | | readValidateurFichierConfiguration(xmlFile, referentielToImportData); |
| | | break; |
| | | |
| | | case "natureProductionFichiers.xml": |
| | | readNatureProductionFichiers(xmlFile, referentielToImportData); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | private void readValidateurFichierConfiguration(File xmlFile, ReferentielToImportData referentielToImportData) throws Exception { |
| | | ValidateurFichierConfigurationToExport validateurFichierConfigurationToExport = (ValidateurFichierConfigurationToExport) XmlUtils.unMarshal(xmlFile, ValidateurFichierConfigurationToExport.class); |
| | | List<ValidateurFichierConfiguration> validateurFichierConfigurations = validateurFichierConfigurationToExport.getValidateurFichierConfigurationList().getValidateurFichierConfigurationList(); |
| | | referentielToImportData.setValidateurFichierConfigurations(validateurFichierConfigurations); |
| | | } |
| | | |
| | | private void readTypeFichiers(File xmlFile, ReferentielToImportData referentielToImportData) throws Exception { |
| | | TypeFichiersToExport typeFichiersToExport = (TypeFichiersToExport) XmlUtils.unMarshal(xmlFile, TypeFichiersToExport.class); |
| | | referentielToImportData.setTypeFichiers(typeFichiersToExport.getTypeFichiersList()); |
| | | } |
| | | |
| | | private void readRoutages(File xmlFile, ReferentielToImportData referentielToImportData) throws Exception { |
| | | RoutagesToExport routagesToExport = (RoutagesToExport) XmlUtils.unMarshal(xmlFile, RoutagesToExport.class); |
| | | referentielToImportData.setRoutages(routagesToExport.getRoutageList()); |
| | | } |
| | | |
| | | private void readReferentiels(File xmlFile, ReferentielToImportData referentielToImportData) throws Exception { |
| | | ReferentielsToExport referentielsToExport = (ReferentielsToExport) XmlUtils.unMarshal(xmlFile, ReferentielsToExport.class); |
| | | referentielToImportData.setReferentiels(referentielsToExport.getReferentielList()); |
| | | } |
| | | |
| | | private void readPays(File xmlFile, ReferentielToImportData referentielToImportData) throws Exception { |
| | | PaysToExport paysToExport = (PaysToExport) XmlUtils.unMarshal(xmlFile, PaysToExport.class); |
| | | referentielToImportData.setPays(paysToExport.getPaysList()); |
| | | } |
| | | |
| | | private void readParticipants(File xmlFile, ReferentielToImportData referentielToImportData) throws Exception { |
| | | ParticipantsToExport participantsToExport = (ParticipantsToExport) XmlUtils.unMarshal(xmlFile, ParticipantsToExport.class); |
| | | referentielToImportData.setParticipants(participantsToExport.getParticipants()); |
| | | } |
| | | |
| | | private void readNoeuds(File xmlFile, ReferentielToImportData referentielToImportData) throws Exception { |
| | | NoeudsToExport noeudsToExport = (NoeudsToExport) XmlUtils.unMarshal(xmlFile, NoeudsToExport.class); |
| | | referentielToImportData.setNoeuds(noeudsToExport.getNoeuds()); |
| | | } |
| | | |
| | | private void readGroupeParticipants(File xmlFile, ReferentielToImportData referentielToImportData) throws Exception { |
| | | GroupeParticipantsToExport groupeParticipantsToExport = (GroupeParticipantsToExport) XmlUtils.unMarshal(xmlFile, GroupeParticipantsToExport.class); |
| | | referentielToImportData.setGroupeParticipants(groupeParticipantsToExport.getGroupeParticipants()); |
| | | } |
| | | |
| | | private void readValidateurFichiers(File xmlFile, ReferentielToImportData referentielToImportData) throws Exception { |
| | | ValidateurFichierToExport validateurFichierToExport = (ValidateurFichierToExport) XmlUtils.unMarshal(xmlFile, ValidateurFichierToExport.class); |
| | | referentielToImportData.setValidateurFichiers(validateurFichierToExport.getValidateurFichierList()); |
| | | } |
| | | |
| | | private void readStructureLignes(File xmlFile, ReferentielToImportData referentielToImportData) throws Exception { |
| | | StructureLigneToExport structureLigneToExport = (StructureLigneToExport) XmlUtils.unMarshal(xmlFile, StructureLigneToExport.class); |
| | | referentielToImportData.setStructureLignes(structureLigneToExport.getStructureLigneList()); |
| | | } |
| | | |
| | | private void readGroupeNoeuds(File xmlFile, ReferentielToImportData referentielToImportData) throws Exception { |
| | | GroupeNoeudsToExport groupeNoeudsToExport = (GroupeNoeudsToExport) XmlUtils.unMarshal(xmlFile, GroupeNoeudsToExport.class); |
| | | referentielToImportData.setGroupeNoeuds(groupeNoeudsToExport.getGroupeNoeuds()); |
| | | } |
| | | |
| | | private void readExtensionFichiers(File xmlFile, ReferentielToImportData referentielToImportData) throws Exception { |
| | | ExtensionFichiersToExport extensionFichiersToExport = (ExtensionFichiersToExport) XmlUtils.unMarshal(xmlFile, ExtensionFichiersToExport.class); |
| | | referentielToImportData.setExtensionFichiers(extensionFichiersToExport.getExtensionFichiers()); |
| | | } |
| | | |
| | | private void readApplicationSources(File xmlFile, ReferentielToImportData referentielToImportData) throws Exception { |
| | | ApplicationSourcesToExport applicationSourcesToExport = (ApplicationSourcesToExport) XmlUtils.unMarshal(xmlFile, ApplicationSourcesToExport.class); |
| | | referentielToImportData.setApplicationSources(applicationSourcesToExport.getApplicationSourceList()); |
| | | } |
| | | |
| | | private void readNatureProductionFichiers(File xmlFile, ReferentielToImportData referentielToImportData) throws Exception { |
| | | NatureProductionFichiersToExport natureProductionFichiersToExport = (NatureProductionFichiersToExport) XmlUtils.unMarshal(xmlFile, NatureProductionFichiersToExport.class); |
| | | referentielToImportData.setNatureProductionFichiers(natureProductionFichiersToExport.getNatureProductionFichierList()); |
| | | } |
| | | } |
| 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.fdxcommons.core.impl.helper.referentiel; |
| | | |
| | | import com.megatim.fdxcommons.core.ifaces.helper.referentiel.TableDefinitionChecker; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.model.integration.TableDefinition; |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProduction; |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProductionFichier; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | import javax.enterprise.context.Dependent; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class TableDefinitionCheckerImpl implements TableDefinitionChecker { |
| | | |
| | | @Override |
| | | public boolean isSame(TableDefinition previousRefTableDef, TableDefinition nextRefTableDef, List<NatureProductionFichier> natureProductionFichiers) { |
| | | if (!previousRefTableDef.getCodeTypeFichier().equals(nextRefTableDef.getCodeTypeFichier())) { |
| | | throw new IllegalArgumentException(); |
| | | } |
| | | return isSameNatureProductionFichier(previousRefTableDef.getReferentielVersion(), nextRefTableDef.getReferentielVersion(), natureProductionFichiers) |
| | | && isSame(previousRefTableDef, nextRefTableDef) |
| | | && isSame(nextRefTableDef.getColumnDefinitions(), previousRefTableDef.getColumnDefinitions()); |
| | | } |
| | | |
| | | private boolean isSameNatureProductionFichier(String refVersion, String previousRef, List<NatureProductionFichier> natureProductionFichiers) { |
| | | Optional<NatureProductionFichier> natureProdFichOpt = natureProductionFichiers.stream().filter(p -> p.getReferentiel().getVersion().equals(refVersion)).findFirst(); |
| | | Optional<NatureProductionFichier> previousNatureProdFichOpt = natureProductionFichiers.stream().filter(p -> p.getReferentiel().getVersion().equals(previousRef)).findFirst(); |
| | | |
| | | if (natureProdFichOpt.isPresent() && previousNatureProdFichOpt.isPresent()) { |
| | | return natureProdFichOpt.get().getNatureProduction().equals(previousNatureProdFichOpt.get().getNatureProduction()); |
| | | } else if (!natureProdFichOpt.isPresent() && !previousNatureProdFichOpt.isPresent()) { |
| | | return true; |
| | | } else { |
| | | if (natureProdFichOpt.isPresent()) { |
| | | return natureProdFichOpt.get().getNatureProduction().equals(NatureProduction.REFERENTIELLE); |
| | | } else { |
| | | return previousNatureProdFichOpt.get().getNatureProduction().equals(NatureProduction.REFERENTIELLE); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private boolean isSame(TableDefinition previousRefTableDef, TableDefinition nextRefTableDef) { |
| | | return isSameColumnDelimiter(previousRefTableDef, nextRefTableDef) |
| | | && isSameLineDelimiter(previousRefTableDef, nextRefTableDef) |
| | | && isSameHeaderPresent(previousRefTableDef, nextRefTableDef); |
| | | } |
| | | |
| | | private boolean isSameColumnDelimiter(TableDefinition previousRefTableDef, TableDefinition nextRefTableDef) { |
| | | if (previousRefTableDef.getColumnDelimiter() != null && nextRefTableDef.getColumnDelimiter() != null) { |
| | | return previousRefTableDef.getColumnDelimiter().equals(nextRefTableDef.getColumnDelimiter()); |
| | | } else { |
| | | return previousRefTableDef.getColumnDelimiter() == null && nextRefTableDef.getColumnDelimiter() == null; |
| | | } |
| | | } |
| | | |
| | | private boolean isSameLineDelimiter(TableDefinition previousRefTableDef, TableDefinition nextRefTableDef) { |
| | | if (previousRefTableDef.getLineDelimiter() != null && nextRefTableDef.getLineDelimiter() != null) { |
| | | return previousRefTableDef.getLineDelimiter().equals(nextRefTableDef.getLineDelimiter()); |
| | | } else { |
| | | return previousRefTableDef.getLineDelimiter() == null && nextRefTableDef.getLineDelimiter() == null; |
| | | } |
| | | } |
| | | |
| | | private boolean isSameHeaderPresent(TableDefinition previousRefTableDef, TableDefinition nextRefTableDef) { |
| | | if (previousRefTableDef.getHeaderPresent() != null && nextRefTableDef.getHeaderPresent() != null) { |
| | | return previousRefTableDef.getHeaderPresent().equals(nextRefTableDef.getHeaderPresent()); |
| | | } else { |
| | | return previousRefTableDef.getHeaderPresent() == null && nextRefTableDef.getHeaderPresent() == null; |
| | | } |
| | | } |
| | | |
| | | private boolean isSame(List<ColumnDefinition> newRefColumnDef, List<ColumnDefinition> oldRefColumnDef) { |
| | | boolean isSame = true; |
| | | |
| | | if (newRefColumnDef.size() != oldRefColumnDef.size()) { |
| | | return false; |
| | | } |
| | | Map<String, ColumnDefinition> currentRefColDefToMap = newRefColumnDef.stream().collect(Collectors.toMap(ColumnDefinition::getName, Function.identity())); |
| | | |
| | | for (ColumnDefinition c : oldRefColumnDef) { |
| | | ColumnDefinition oldColDef = currentRefColDefToMap.get(c.getName()); |
| | | |
| | | if (oldColDef == null) { |
| | | isSame = false; |
| | | break; |
| | | } |
| | | |
| | | isSame = isSameFormatDate(c, oldColDef) |
| | | && isSamePosition(c, oldColDef) |
| | | && isSameTypeDonnee(c, oldColDef) |
| | | && isSameTaille(c, oldColDef) |
| | | && isSameTaillePartieDecimale(c, oldColDef); |
| | | |
| | | if (!isSame) { |
| | | break; |
| | | } |
| | | } |
| | | return isSame; |
| | | } |
| | | |
| | | private boolean isSameFormatDate(ColumnDefinition newColDef, ColumnDefinition oldColDef) { |
| | | return (newColDef.getFormatDate() == null ? oldColDef.getFormatDate() == null : newColDef.getFormatDate().trim().equalsIgnoreCase(oldColDef.getFormatDate())); |
| | | } |
| | | |
| | | private boolean isSamePosition(ColumnDefinition newColDef, ColumnDefinition oldColDef) { |
| | | return newColDef.getPosition() == oldColDef.getPosition(); |
| | | } |
| | | |
| | | private boolean isSameTypeDonnee(ColumnDefinition newColDef, ColumnDefinition oldColDef) { |
| | | return (newColDef.getTypeDonnee() == null ? oldColDef.getTypeDonnee() == null : newColDef.getTypeDonnee().trim().equalsIgnoreCase(oldColDef.getTypeDonnee())); |
| | | } |
| | | |
| | | private boolean isSameTaille(ColumnDefinition newColDef, ColumnDefinition oldColDef) { |
| | | return newColDef.getTaille() == oldColDef.getTaille(); |
| | | } |
| | | |
| | | private boolean isSameTaillePartieDecimale(ColumnDefinition newColDef, ColumnDefinition oldColDef) { |
| | | return newColDef.getTaillePartieDecimale() == oldColDef.getTaillePartieDecimale(); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.core.impl.helper.referentiel; |
| | | |
| | | import com.megatim.fdxcommons.core.ifaces.helper.referentiel.TableDefinitionChecker; |
| | | import com.megatim.fdxcommons.core.ifaces.helper.referentiel.TableDefinitionFilter; |
| | | import com.megatim.fdxcommons.model.pojo.ReferentielToImportData; |
| | | import com.megatim.fdxcommons.model.integration.TableDefinition; |
| | | import com.megatim.fdxcommons.model.referentiel.historique.ReferentielIntegrationHistorique; |
| | | import com.megatim.fdxcommons.model.referentiel.historique.pojo.TableDefinitionFiltered; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class TableDefinitionFilterImpl implements TableDefinitionFilter { |
| | | |
| | | @Inject |
| | | private TableDefinitionChecker tableDefinitionChecker; |
| | | |
| | | @Override |
| | | public TableDefinitionFiltered doFilter(String previousRef, ReferentielToImportData referentielToImportData, List<ReferentielIntegrationHistorique> refsHistoriqueIntegration) { |
| | | final int refEncours = Integer.parseInt(referentielToImportData.getReferentielEnCours().getVersion()); |
| | | int indexDebut = previousRef == null ? 1 : Integer.parseInt(previousRef) + 1; |
| | | |
| | | while (indexDebut <= refEncours) { |
| | | compareTableDefinition(indexDebut, referentielToImportData, refsHistoriqueIntegration); |
| | | indexDebut++; |
| | | } |
| | | |
| | | return new TableDefinitionFiltered(tablesToCreate(referentielToImportData, refsHistoriqueIntegration), refsHistoriqueIntegration); |
| | | } |
| | | |
| | | private List<TableDefinition> tablesToCreate(ReferentielToImportData referentielToImportData, List<ReferentielIntegrationHistorique> refsHistoriqueIntegration) { |
| | | List<TableDefinition> tablesToCreate = new ArrayList<>(); |
| | | |
| | | refsHistoriqueIntegration.stream().forEach(h -> { |
| | | referentielToImportData |
| | | .getTableDefinitions() |
| | | .stream() |
| | | .filter(p -> h.getCodeTypeFichier().equals(p.getCodeTypeFichier()) && h.getReferentielVersion().equals(p.getReferentielVersion())) |
| | | .findFirst() |
| | | .ifPresent(c -> tablesToCreate.add(c)); |
| | | }); |
| | | |
| | | return tablesToCreate; |
| | | } |
| | | |
| | | private void compareTableDefinition(int index, ReferentielToImportData referentielToImportData, List<ReferentielIntegrationHistorique> refsHistoriqueIntegration) { |
| | | String refVersion = referentielVersion(index); |
| | | String previousRef = referentielVersion(index - 1); |
| | | |
| | | List<TableDefinition> newTableDef = referentielToImportData.getTableDefinitions().stream().filter(p -> p.getReferentielVersion().equals(refVersion)).collect(Collectors.toList()); |
| | | |
| | | newTableDef.stream().forEach(nt -> { |
| | | Optional<ReferentielIntegrationHistorique> optRefHist |
| | | = refsHistoriqueIntegration |
| | | .stream() |
| | | .filter(r -> r.getCodeTypeFichier().equals(nt.getCodeTypeFichier()) && r.getDependingReferentiels().contains(previousRef)) |
| | | .findFirst(); |
| | | |
| | | if (optRefHist.isPresent()) { |
| | | Optional<TableDefinition> oldTableDef |
| | | = referentielToImportData.getTableDefinitions() |
| | | .stream() |
| | | .filter(p -> p.getReferentielVersion().equals(optRefHist.get().getReferentielVersion()) && p.getCodeTypeFichier().equals(nt.getCodeTypeFichier())) |
| | | .findFirst(); |
| | | |
| | | if (oldTableDef.isPresent() && tableDefinitionChecker.isSame(nt, oldTableDef.get(), referentielToImportData.getNatureProductionFichiers())) { |
| | | ReferentielIntegrationHistorique refHist = optRefHist.get(); |
| | | refHist.getDependingReferentiels().add(refVersion); |
| | | } else { |
| | | addNewReferentielIntegrationHistorique(nt.getCodeTypeFichier(), refVersion, refsHistoriqueIntegration); |
| | | } |
| | | } else { |
| | | addNewReferentielIntegrationHistorique(nt.getCodeTypeFichier(), refVersion, refsHistoriqueIntegration); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | private void addNewReferentielIntegrationHistorique(String codeTypeFichier, String refVersion, List<ReferentielIntegrationHistorique> refsHistoriqueIntegration) { |
| | | refsHistoriqueIntegration.add(new ReferentielIntegrationHistorique(codeTypeFichier, |
| | | refVersion, |
| | | new HashSet<>(Arrays.asList(refVersion)))); |
| | | } |
| | | |
| | | private String referentielVersion(int ref) { |
| | | return generateZeros(6 - (ref + "").length()) + ref; |
| | | } |
| | | |
| | | private String generateZeros(int nbOfZero) { |
| | | StringBuilder str = new StringBuilder(); |
| | | for (int i = 0; i < nbOfZero; i++) { |
| | | str.append("0"); |
| | | } |
| | | return str.toString(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.core.impl.helper.referentiel; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.TypeDonnee; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.model.pojo.Constantes; |
| | | import com.megatim.fdxcommons.core.ifaces.helper.referentiel.ValidateurTypeFichierParser; |
| | | import com.megatim.fdxcommons.model.integration.TableDefinition; |
| | | import com.megatim.fdxcommons.model.integration.enums.FileExtension; |
| | | import com.megatim.fdxcommons.tools.exceptions.CommonApplicationValidationException; |
| | | import java.io.File; |
| | | import java.text.Normalizer; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.xml.parsers.DocumentBuilder; |
| | | import javax.xml.parsers.DocumentBuilderFactory; |
| | | import org.w3c.dom.Document; |
| | | import org.w3c.dom.NamedNodeMap; |
| | | import org.w3c.dom.Node; |
| | | import org.w3c.dom.NodeList; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class ValidateurTypeFichierParserImpl implements ValidateurTypeFichierParser { |
| | | |
| | | @Override |
| | | public TableDefinition parseToColumnDefinition(String validatorPath, String codeTypeFichier, String referentielVersion) throws Exception { |
| | | File file = new File(validatorPath); |
| | | return retrieveFieldsFromValidator(file, codeTypeFichier, referentielVersion); |
| | | } |
| | | |
| | | /** |
| | | * Méthode permettant d'extraire les éléments du validateur XML |
| | | * |
| | | * @param file : Fichier du validateur |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | private TableDefinition retrieveFieldsFromValidator(File file, String codeTypeFichier, String referentielVersion) throws Exception { |
| | | Document doc = intialize(file); |
| | | NodeList entityList = doc.getElementsByTagName("entity"); //Liste des noeud <entity> |
| | | |
| | | //Map qui stocke le champ à une position, ainsi que les caractéristiques de champ(typeDonnee, taille, index de debut d'extraction) |
| | | Map<Integer, Map<String, String>> mapParams = new HashMap<>(); |
| | | int position = 1; |
| | | TableDefinition tableDefinition = new TableDefinition(); |
| | | |
| | | //Le validateur XML doit avoir au moins deux balises <entity> pour être conforme |
| | | if (entityList.getLength() >= 2) { |
| | | |
| | | //Liste des noeud de type <validation> du deuxième Noeud <entity> |
| | | final Node entityNode = entityList.item(1); |
| | | NodeList entityFileLineChildren = entityNode.getChildNodes(); |
| | | tableDefinition = tableDefinition(entityNode); |
| | | |
| | | //Map qui contient champ set son nombe d'occurrence dans le fichier en coures de traitement |
| | | Map<String, Integer> mapFieldName = new HashMap<>(); |
| | | |
| | | //parcours de la balise <entity> pour récupérer ses enfants |
| | | for (int i = 0; i < entityFileLineChildren.getLength(); i++) { |
| | | |
| | | if (entityFileLineChildren.item(i) != null && entityFileLineChildren.item(i).getAttributes() != null) { |
| | | |
| | | //balise <validation> |
| | | Node validation = entityFileLineChildren.item(i); |
| | | |
| | | if (validation != null) { |
| | | Map<String, String> mapAttributes = new HashMap<>(); |
| | | |
| | | //Liste des assertions de la balise <validation> |
| | | NodeList assertions = validation.getChildNodes(); |
| | | |
| | | for (int r = 0; r < assertions.getLength(); r++) { |
| | | |
| | | Node assertion = assertions.item(r); |
| | | |
| | | if (assertion != null && assertion.getAttributes() != null) { |
| | | NamedNodeMap assertionAttributes = assertion.getAttributes(); |
| | | |
| | | for (int q = 0; q < assertionAttributes.getLength(); q++) { |
| | | String assertionAttributeName = assertionAttributes.item(q).getNodeName(); |
| | | String assertionAttributeValue = assertionAttributes.item(q).getNodeValue(); |
| | | |
| | | if (assertionAttributeName.equalsIgnoreCase(Constantes.ERROR_CODE)) { |
| | | String fieldName = constructFieldName(assertionAttributeValue, codeTypeFichier); |
| | | |
| | | //Stocker le nbre d'occurrences trouvés dans la map |
| | | if (mapFieldName.containsKey(fieldName)) { |
| | | Integer nbOccurrences = mapFieldName.get(fieldName); |
| | | mapFieldName.replace(fieldName, nbOccurrences + 1); |
| | | |
| | | } else { |
| | | mapFieldName.put(fieldName, 1); |
| | | } |
| | | Integer nbOccurrences = mapFieldName.get(fieldName); |
| | | String finalFieldName = nbOccurrences == 1 ? fieldName : fieldName + (nbOccurrences - 1); |
| | | |
| | | mapAttributes.put(Constantes.FIELD_NAME, finalFieldName); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | //Liste des balises <param-value> de la balise <assertion> |
| | | NodeList params = assertion.getChildNodes(); |
| | | Integer positionAttribute = null; |
| | | |
| | | for (int j = 0; j < params.getLength(); j++) { |
| | | |
| | | if (params.item(j) != null && params.item(j).getAttributes() != null) { |
| | | |
| | | //Les attributs de la balise <param-value> |
| | | NamedNodeMap attributesParamValue = params.item(j).getAttributes(); |
| | | |
| | | if (attributesParamValue.getLength() == 2) { |
| | | |
| | | String nodeValue = attributesParamValue.item(0).getNodeValue(); |
| | | String nextNodeValue = attributesParamValue.item(1).getNodeValue(); |
| | | |
| | | if (!nodeValue.equalsIgnoreCase(Constantes.EQUAL_PARAM) |
| | | && !nextNodeValue.equalsIgnoreCase(Constantes.EQUAL_PARAM) |
| | | && !nodeValue.equalsIgnoreCase(Constantes.LIGNE) |
| | | && !nextNodeValue.equalsIgnoreCase(Constantes.LIGNE) |
| | | && !nodeValue.equalsIgnoreCase(Constantes.EQUAL_VALUE) |
| | | && !nextNodeValue.equalsIgnoreCase(Constantes.EQUAL_VALUE)) { |
| | | mapAttributes.put(nodeValue, nextNodeValue); |
| | | |
| | | if (nodeValue.equalsIgnoreCase(Constantes.POSITION)) { |
| | | positionAttribute = Integer.valueOf(nextNodeValue); |
| | | } |
| | | } |
| | | } |
| | | if (mapAttributes.size() > 2) {//On ne garde pas les informatios sur la taille de la ligne |
| | | mapParams.put(positionAttribute != null ? positionAttribute : position, mapAttributes); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | position++; |
| | | } |
| | | } |
| | | } |
| | | tableDefinition.setColumnDefinitions(getColumnsDefinition(mapParams, codeTypeFichier, referentielVersion)); |
| | | tableDefinition.setCodeTypeFichier(codeTypeFichier); |
| | | tableDefinition.setReferentielVersion(referentielVersion); |
| | | |
| | | return tableDefinition; |
| | | |
| | | } |
| | | |
| | | private TableDefinition tableDefinition(Node entityNode) { |
| | | TableDefinition tableDefinition = new TableDefinition(); |
| | | NamedNodeMap attributes = entityNode.getAttributes(); |
| | | |
| | | for (int i = 0; i < attributes.getLength(); i++) { |
| | | String assertionAttributeName = attributes.item(i).getNodeName(); |
| | | String assertionAttributeValue = attributes.item(i).getNodeValue(); |
| | | |
| | | if (assertionAttributeName.equalsIgnoreCase(Constantes.COLUMN_DELIMITER)) { |
| | | tableDefinition.setColumnDelimiter(assertionAttributeValue); |
| | | } else if (assertionAttributeName.equalsIgnoreCase(Constantes.LINE_DELIMITER)) { |
| | | tableDefinition.setLineDelimiter(assertionAttributeValue); |
| | | } else if (assertionAttributeName.equalsIgnoreCase(Constantes.HEADER_PRESENT)) { |
| | | tableDefinition.setHeaderPresent(Boolean.valueOf(assertionAttributeValue)); |
| | | } else if (assertionAttributeName.equalsIgnoreCase(Constantes.EXTENSION)) { |
| | | tableDefinition.setExtension(FileExtension.fromValeur(assertionAttributeValue)); |
| | | } |
| | | } |
| | | return tableDefinition; |
| | | } |
| | | |
| | | /** |
| | | * Méthode utilitaire pour extraire les données dans un fichier xml |
| | | * |
| | | * @param array |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | private Document intialize(File file) throws Exception { |
| | | |
| | | /** |
| | | * Défini un factory qui aide à obtenir un parseur qui produit un arbre |
| | | * d'objets DOM Ã partir d'un document XML. |
| | | */ |
| | | DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); |
| | | |
| | | /** |
| | | * création d'un objet du builder pour parser le fichier XML. |
| | | */ |
| | | DocumentBuilder db = dbf.newDocumentBuilder(); |
| | | |
| | | Document doc = db.parse(file); |
| | | |
| | | doc.getDocumentElement().normalize(); |
| | | |
| | | return doc; |
| | | } |
| | | |
| | | /** |
| | | * Méthode qui met les informations du validateur dans un ColumnDefinition |
| | | * pour utilisation future |
| | | * |
| | | * @param mapStructure |
| | | * @return |
| | | */ |
| | | private List<ColumnDefinition> getColumnsDefinition(Map<Integer, Map<String, String>> mapStructure, String codeTypeFichier, String referentielVersion) throws CommonApplicationValidationException { |
| | | List<ColumnDefinition> columns = new ArrayList<>(); |
| | | |
| | | for (Integer key : mapStructure.keySet()) { |
| | | ColumnDefinition column = new ColumnDefinition(); |
| | | Map<String, String> value = mapStructure.get(key); |
| | | final String typeDonnee = value.get(Constantes.TYPE_DONNEE); |
| | | |
| | | if (typeDonnee != null) { |
| | | column.setPosition(key); |
| | | |
| | | if (value.get(Constantes.TAILLE) != null) { |
| | | column.setTaille(Integer.parseInt(value.get(Constantes.TAILLE))); |
| | | } else {//Valeur par défaut |
| | | |
| | | if (typeDonnee.equalsIgnoreCase(TypeDonnee.ALPHANUMERIQUE.toString())) { |
| | | column.setTaille(255); |
| | | } else if (typeDonnee.equalsIgnoreCase(TypeDonnee.NUMERIQUE.toString())) { |
| | | column.setTaille(17); |
| | | } else if (typeDonnee.equalsIgnoreCase(TypeDonnee.DECIMAL.toString())) { |
| | | column.setTaille(17); |
| | | column.setTaillePartieDecimale(3); |
| | | } |
| | | } |
| | | column.setPosition(key); |
| | | column.setName(value.get(Constantes.FIELD_NAME).trim().toLowerCase()); |
| | | column.setTypeDonnee(TypeDonnee.fromValeur(typeDonnee).getValue().trim()); |
| | | column.setCodeTypeFichier(codeTypeFichier.trim()); |
| | | column.setReferentielVersion(referentielVersion.trim()); |
| | | |
| | | if (typeDonnee.equalsIgnoreCase(TypeDonnee.DECIMAL.toString()) && value.get(Constantes.TAILLE) != null) { |
| | | |
| | | if (value.get(Constantes.TAILLE_PARTIE_DECIMALE) != null) { |
| | | column.setTaillePartieDecimale(Integer.parseInt(value.get(Constantes.TAILLE_PARTIE_DECIMALE))); |
| | | } |
| | | } else if (typeDonnee.equalsIgnoreCase(TypeDonnee.DATE.toString())) { |
| | | String separateurDate = value.get(Constantes.SEPARATEUR_DATE); |
| | | String formatDate = value.get(Constantes.FORMAT_DATE); |
| | | |
| | | if (formatDate != null && !formatDate.isEmpty()) { |
| | | |
| | | if (separateurDate != null && !separateurDate.isEmpty()) { |
| | | |
| | | if (separateurDate.equals("-") || separateurDate.equals("/")) { |
| | | formatDate = addSeparateurToDateFormat(formatDate, separateurDate, column.getName()); |
| | | |
| | | } else { |
| | | throw new CommonApplicationValidationException("Le séparateur de date du champ " + column.getName() + " ne peut être " + separateurDate); |
| | | } |
| | | } |
| | | column.setFormatDate(formatDate); |
| | | } else { |
| | | throw new CommonApplicationValidationException("Le format date du champ " + column.getName() + " est absent"); |
| | | } |
| | | } |
| | | |
| | | columns.add(column); |
| | | } |
| | | } |
| | | |
| | | return columns; |
| | | } |
| | | |
| | | /** |
| | | * Méthode qui ajoute le séparateur renseigné dans le validateur au format |
| | | * |
| | | * @param formatDate |
| | | * @param separateurDate |
| | | * @param columnName |
| | | * @return |
| | | */ |
| | | private String addSeparateurToDateFormat(String formatDate, String separateurDate, String columnName) { |
| | | StringBuilder dateValue = new StringBuilder(); |
| | | |
| | | switch (formatDate) { |
| | | case "ddMMyyyy": |
| | | dateValue.append("dd").append(separateurDate).append("MM").append(separateurDate).append("yyyy"); |
| | | break; |
| | | case "ddyyyyMM": |
| | | dateValue.append("dd").append(separateurDate).append("yyyy").append(separateurDate).append("MM"); |
| | | break; |
| | | case "MMddyyyy": |
| | | dateValue.append("MM").append(separateurDate).append("dd").append(separateurDate).append("yyyy"); |
| | | break; |
| | | case "MMyyyydd": |
| | | dateValue.append("MM").append(separateurDate).append("yyyy").append(separateurDate).append("dd"); |
| | | break; |
| | | case "yyyyddMM": |
| | | dateValue.append("yyyy").append(separateurDate).append("dd").append(separateurDate).append("MM"); |
| | | break; |
| | | case "yyyyMMdd": |
| | | dateValue.append("yyyy").append(separateurDate).append("MM").append(separateurDate).append("dd"); |
| | | break; |
| | | case "yyyy": |
| | | dateValue.append("yyyy"); |
| | | break; |
| | | case "yyyyMM": |
| | | dateValue.append("yyyy").append(separateurDate).append("MM"); |
| | | case "MMyyyy": |
| | | dateValue.append("MM").append(separateurDate).append("yyyy"); |
| | | break; |
| | | default: |
| | | throw new CommonApplicationValidationException("Le format date " + formatDate + " du champ" + columnName + " n'est pas acceptable "); |
| | | } |
| | | |
| | | return dateValue.toString(); |
| | | } |
| | | |
| | | private String constructFieldName(String fieldName, String codeTypeFichier) { |
| | | |
| | | fieldName = fieldName.startsWith(codeTypeFichier) |
| | | ? fieldName.substring(6) |
| | | : fieldName; |
| | | fieldName = fieldName.equalsIgnoreCase("int") ? "_" + fieldName : fieldName; |
| | | return removeAccents(fieldName.replaceAll(" ", "_")); |
| | | } |
| | | |
| | | private String removeAccents(String input) { |
| | | // Normalize to decomposed form (NFD): é → e + ´, è → e + ` |
| | | String normalized = Normalizer.normalize(input, Normalizer.Form.NFD); |
| | | // Remove all diacritical marks (accents) |
| | | return normalized.replaceAll("\\p{M}", ""); |
| | | } |
| | | } |
| 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.fdxcommons.core.impl.interceptor; |
| | | |
| | | import com.megatim.fdxcommons.core.ifaces.interceptor.AfterUserAction; |
| | | import com.megatim.fdxcommons.core.ifaces.interceptor.InterceptorHandler; |
| | | import com.megatim.fdxcommons.core.ifaces.interceptor.LoggingInterceptorBinding; |
| | | import com.megatim.fdxcommons.model.log.ContainerContextDto; |
| | | import com.megatim.fdxcommons.model.log.UserActionLog; |
| | | import com.megatim.fdxcommons.tools.context.AppContext; |
| | | import java.lang.reflect.Method; |
| | | import java.time.LocalDateTime; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.inject.Inject; |
| | | import ua_parser.Client; |
| | | import ua_parser.Parser; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class AfterUserActionImpl implements AfterUserAction { |
| | | |
| | | @Inject |
| | | private InterceptorHandler handler; |
| | | |
| | | @Override |
| | | public UserActionLog filter(ContainerContextDto containerContext) throws Exception { |
| | | Method method = containerContext.getResourceInfo().getResourceMethod(); |
| | | |
| | | if (method != null && method.getAnnotation(LoggingInterceptorBinding.class) != null) { |
| | | return logMethodInvocation(method, containerContext); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | private UserActionLog logMethodInvocation(Method method, ContainerContextDto containerContext) throws Exception { |
| | | Object responseEntity = containerContext.getContainerResponseContext().getEntity(); |
| | | Object requestEntity = containerContext.getContainerRequestContext().getProperty("entity"); |
| | | final int status = containerContext.getContainerResponseContext().getStatus(); |
| | | |
| | | UserActionLog log = new UserActionLog(); |
| | | log.setDateAction(LocalDateTime.now()); |
| | | log.setUserName(containerContext.getSecurityContext().getUserPrincipal() != null |
| | | ? containerContext.getSecurityContext().getUserPrincipal().getName() |
| | | : null); |
| | | log.setStatus(status); |
| | | log.setMotif(log.getStatus() != null ? log.getStatus().toString() + " (" + AppContext.registre_codes_http.get(log.getStatus().toString()) + ")" : null); |
| | | log.setIpAddress(containerContext.getHttpServletRequest().getRemoteAddr()); |
| | | log.setHttpMethod(containerContext.getContainerRequestContext().getMethod()); |
| | | log.setRelativePath(containerContext.getUriInfo().getPath()); |
| | | Parser uaParser = new Parser(); |
| | | Client c = uaParser.parse(containerContext.getHttpServletRequest().getHeader("User-Agent")); |
| | | log.setUserAgent(c.userAgent.family); |
| | | |
| | | if (status < 400) { |
| | | log.setMessage(message(method, requestEntity, responseEntity, containerContext)); |
| | | } else { |
| | | log.setMessage("Erreur " + status); |
| | | } |
| | | return log; |
| | | } |
| | | |
| | | private String message(Method method, Object requestEntity, Object responseEntity, ContainerContextDto containerContext) throws Exception { |
| | | LoggingInterceptorBinding ann = method.getAnnotation(LoggingInterceptorBinding.class); |
| | | return handler.finalMessage(ann, |
| | | method.getParameters(), |
| | | containerContext.getContainerRequestContext().getUriInfo().getPathParameters(), |
| | | requestEntity, |
| | | responseEntity); |
| | | } |
| | | |
| | | } |
| 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.fdxcommons.core.impl.interceptor; |
| | | |
| | | import com.megatim.fdxcommons.core.ifaces.interceptor.BeforeAction; |
| | | import com.megatim.fdxcommons.core.ifaces.interceptor.LoggingInterceptorBinding; |
| | | import java.io.BufferedReader; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.InputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.lang.reflect.Method; |
| | | import java.util.stream.Collectors; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.ws.rs.container.ContainerRequestContext; |
| | | import javax.ws.rs.container.ResourceInfo; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class BeforeActionImpl implements BeforeAction { |
| | | |
| | | @Override |
| | | public void filter(ContainerRequestContext crc, ResourceInfo resourceInfo) { |
| | | Method method = resourceInfo.getResourceMethod(); |
| | | LoggingInterceptorBinding ann = method.getAnnotation(LoggingInterceptorBinding.class); |
| | | |
| | | if (crc.hasEntity() && ann != null && ann.shouldCopyData()) { |
| | | InputStream inputStream = crc.getEntityStream(); |
| | | String body = new BufferedReader(new InputStreamReader(inputStream)) |
| | | .lines().collect(Collectors.joining("\n")); |
| | | |
| | | crc.setProperty("entity", body); |
| | | |
| | | // Replace the original input stream with a new one after reading it |
| | | crc.setEntityStream(new ByteArrayInputStream(body.getBytes())); |
| | | } |
| | | } |
| | | } |
| 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.fdxcommons.core.impl.interceptor; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.internal.LinkedTreeMap; |
| | | import com.megatim.fdxcommons.core.ifaces.interceptor.LoggingInterceptorBinding; |
| | | import com.megatim.fdxcommons.core.ifaces.interceptor.InterceptorHandler; |
| | | import java.lang.reflect.Field; |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.lang.reflect.Method; |
| | | import java.lang.reflect.Parameter; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | | import javax.enterprise.context.Dependent; |
| | | import javax.ws.rs.core.MultivaluedMap; |
| | | |
| | | /** |
| | | * {} : Les paramètres de requête sont entre accolades () : La valeur de retour |
| | | * entre les parenthèses [] : L'entité de requête est entre les crochets |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Dependent |
| | | public class InterceptorHandlerImpl implements InterceptorHandler { |
| | | |
| | | @Override |
| | | public String finalMessage(LoggingInterceptorBinding interceptorBinding, Parameter[] parameters, MultivaluedMap<String, String> queryParams, Object requestEntity, Object responseEntity) throws Exception { |
| | | //Recherche des références au paramètres de la requête |
| | | String message = infoFromPathParameters(interceptorBinding.message(), queryParams); |
| | | |
| | | //Recherche des références aux éléments du tableau de paramètres |
| | | message = infoFromParameters(message, parameters, requestEntity); |
| | | |
| | | //Recherche des références à la valeur de retour |
| | | return infoFromReturnValue(message, interceptorBinding.classe(), responseEntity); |
| | | } |
| | | |
| | | private String infoFromPathParameters(String message, MultivaluedMap<String, String> queryParams) throws Exception { |
| | | if (!queryParams.isEmpty()) { |
| | | Pattern pattern = Pattern.compile("\\{\\S{1,}\\}"); |
| | | Matcher matcher = pattern.matcher(message); |
| | | |
| | | while (matcher.find()) { |
| | | String group = matcher.group(); |
| | | String fieldName = group.substring(1, group.length() - 1); |
| | | |
| | | if (queryParams.containsKey(fieldName)) { |
| | | message = message.replace(group, queryParams.getFirst(fieldName)); |
| | | } |
| | | } |
| | | } |
| | | return message; |
| | | } |
| | | |
| | | private String infoFromReturnValue(String message, Class<?> classe, Object dataToProcess) throws Exception { |
| | | Pattern pattern = Pattern.compile("\\(\\S{1,}\\)"); |
| | | Matcher matcher = pattern.matcher(message); |
| | | |
| | | while (matcher.find()) { |
| | | String group = matcher.group(); |
| | | String fieldName = group.substring(1, group.length() - 1); |
| | | String[] fieldPath = fieldName.split("\\."); |
| | | String fieldValue = value(fieldPath, classe, dataToProcess); |
| | | message = message.replace(group, fieldValue); |
| | | } |
| | | |
| | | return message; |
| | | } |
| | | |
| | | private String infoFromParameters(String message, Parameter[] parameters, Object requestEntity) throws Exception { |
| | | if (parameters.length > 0) { |
| | | Pattern pattern = Pattern.compile("\\[\\d{1,}\\S*\\]"); |
| | | Matcher matcher = pattern.matcher(message); |
| | | |
| | | while (matcher.find()) { |
| | | String group = matcher.group(); |
| | | String fieldName = group.substring(1, group.length() - 1); |
| | | String[] fieldPath = fieldName.split("\\."); |
| | | int index = Integer.parseInt(fieldPath[0]); |
| | | |
| | | if (requestEntity != null && index < parameters.length) { |
| | | Object obj = new Gson().fromJson(requestEntity.toString(), parameters[index].getType()); |
| | | String value = ""; |
| | | |
| | | if (fieldPath.length == 1) { |
| | | value = value(fieldPath, parameters[index].getType(), obj); |
| | | } else { |
| | | value = value(Arrays.copyOfRange(fieldPath, 1, fieldPath.length), |
| | | parameters[index].getType(), obj); |
| | | } |
| | | |
| | | message = message.replace(group, value); |
| | | } |
| | | } |
| | | } |
| | | return message; |
| | | } |
| | | |
| | | private String value(String[] fieldPath, Class<?> classe, Object dataToProcess) throws Exception { |
| | | |
| | | if (dataToProcess instanceof Collection) { |
| | | return valueFromCollection(fieldPath, classe, (Collection) dataToProcess); |
| | | |
| | | } else { |
| | | return valueFromField(fieldPath, classe, dataToProcess); |
| | | } |
| | | } |
| | | |
| | | private String valueFromCollection(String[] fieldPath, Class<?> classe, Collection collection) throws Exception { |
| | | List<String> values = new ArrayList<>(); |
| | | for (Object obj : collection) { |
| | | values.add(valueFromField(fieldPath, classe, obj)); |
| | | } |
| | | return "[" + values.stream().collect(Collectors.joining(",")) + "]"; |
| | | } |
| | | |
| | | private String valueFromLinkedTreeMap(LinkedTreeMap dataToProcess, String field) { |
| | | return dataToProcess.get(field).toString(); |
| | | } |
| | | |
| | | private String valueFromField(String[] fieldPath, Class<?> classe, Object dataToProcess) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { |
| | | if (dataToProcess instanceof LinkedTreeMap) { |
| | | return valueFromLinkedTreeMap((LinkedTreeMap) dataToProcess, fieldPath[0]); |
| | | } else { |
| | | String methodName = "get" + (fieldPath[0].charAt(0) + "").toUpperCase() + fieldPath[0].substring(1); |
| | | Method method = classe.getMethod(methodName); |
| | | Object obj = method.invoke(classe.cast(dataToProcess)); |
| | | |
| | | if (fieldPath.length == 1) { |
| | | return obj.toString(); |
| | | |
| | | } else { |
| | | Class<?> classToParse = fieldType(fieldPath[0], classe); |
| | | return valueFromField(Arrays.copyOfRange(fieldPath, 1, fieldPath.length), classToParse, obj); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private Class<?> fieldType(String fieldName, Class<?> classe) { |
| | | Optional<Field> optionalField = Arrays.asList(classe.getDeclaredFields()).stream().filter(f -> f.getName().equals(fieldName)).findFirst(); |
| | | |
| | | if (optionalField.isPresent()) { |
| | | return optionalField.get().getType(); |
| | | } 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.fdxcommons.core.impl.tools; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.TypeDonnee; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import java.io.File; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.IOException; |
| | | import java.nio.charset.Charset; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class CommonUtilities { |
| | | |
| | | /** |
| | | * Méthode qui récupère l'encodage d'un fichier |
| | | * |
| | | * @param file : Fichier dont on veut connaître l'encodage |
| | | * @return : retourne l'encodage le plus probable |
| | | * @throws FileNotFoundException |
| | | * @throws IOException |
| | | */ |
| | | public static Charset getCharset(File file) throws FileNotFoundException, IOException { |
| | | return StandardCharsets.UTF_8; |
| | | } |
| | | |
| | | public static Map<String, ColumnDefinition> columnDefinitionsToMap(List<ColumnDefinition> columnDefinitions) { |
| | | Map<String, ColumnDefinition> columnDefinitionsMap = new HashMap<>(); |
| | | columnDefinitions.stream().forEach(c -> columnDefinitionsMap.put(c.getName(), c)); |
| | | |
| | | return columnDefinitionsMap; |
| | | } |
| | | |
| | | public static Class<?> fullQualifiedNameTypeFromTypeDonnee(TypeDonnee typeDonnee) { |
| | | switch (typeDonnee) { |
| | | case NUMERIQUE: |
| | | return java.lang.Long.class; |
| | | case DATE: |
| | | return java.time.LocalDateTime.class; |
| | | case DECIMAL: |
| | | return java.math.BigDecimal.class; |
| | | default: |
| | | return java.lang.String.class; |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.core.impl.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 |
| | |
| | | # 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.fdxcommons</groupId> |
| | | <artifactId>fdxcommons</artifactId> |
| | | <version>1.0</version> |
| | | </parent> |
| | | |
| | | <groupId>com.megatim.fdxcommons.dao.ifaces</groupId> |
| | | <artifactId>fdxcommons-dao-ifaces</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.fdxcommons.model</groupId> |
| | | <artifactId>fdxcommons-model</artifactId> |
| | | <version>${project.version}</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>javax</groupId> |
| | | <artifactId>javaee-api</artifactId> |
| | | <version>${jakartaee}</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.bekosoftware</groupId> |
| | | <artifactId>genericDAOLayer</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatimgroup</groupId> |
| | | <artifactId>mgt-commons-tools</artifactId> |
| | | <version>1.0-SNAPSHOT</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>org.hibernate</groupId> |
| | | <artifactId>hibernate-core</artifactId> |
| | | <version>5.3.0.Final</version> |
| | | <scope>compile</scope> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </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>fdxcommons-dao-ifaces</name> |
| | | </project> |
| New file |
| | |
| | | package com.megatim.fdxcommons.dao.ifaces.abstracts; |
| | | |
| | | import com.megatim.fdxcommons.dao.ifaces.utils.SearchCriteriaBuilderUtil; |
| | | import com.megatim.fdxcommons.model.search.SearchCriteria; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.TypedQuery; |
| | | import javax.persistence.criteria.CriteriaBuilder; |
| | | import javax.persistence.criteria.CriteriaQuery; |
| | | import javax.persistence.criteria.Predicate; |
| | | import javax.persistence.criteria.Root; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface AbstractCrudDAO<T, ID, U> { |
| | | |
| | | public EntityManager getEntityManager(); |
| | | |
| | | public Class<T> getManagedEntityClass(); |
| | | |
| | | public T getById(ID id); |
| | | |
| | | public default T save(T entity) { |
| | | return getEntityManager().merge(entity); |
| | | } |
| | | |
| | | public default void delete(T entity) { |
| | | getEntityManager().remove(entity); |
| | | } |
| | | |
| | | public default long count(U searchEntity) { |
| | | CriteriaBuilder qb = getEntityManager().getCriteriaBuilder(); |
| | | CriteriaQuery<Long> cq = qb.createQuery(Long.class); |
| | | Root<T> root = cq.from(getManagedEntityClass()); |
| | | |
| | | List<SearchCriteria> searchCriterias = SearchCriteriaBuilderUtil.getSearchCriterias(searchEntity, getManagedEntityClass(), root, new ArrayList<>()); |
| | | List<Predicate> predicates = createPedicates(searchCriterias, qb, root); |
| | | |
| | | cq.select(qb.count(root)); |
| | | cq.where(predicates.toArray(new Predicate[predicates.size()])); |
| | | |
| | | return (long) getEntityManager().createQuery(cq).getSingleResult(); |
| | | } |
| | | |
| | | public default List<T> getAll(U searchEntity) { |
| | | CriteriaBuilder qb = getEntityManager().getCriteriaBuilder(); |
| | | CriteriaQuery<T> cq = qb.createQuery(getManagedEntityClass()); |
| | | |
| | | Root<T> root = cq.from(getManagedEntityClass()); |
| | | |
| | | List<SearchCriteria> searchCriterias = SearchCriteriaBuilderUtil.getSearchCriterias(searchEntity, getManagedEntityClass(), root, new ArrayList<>()); |
| | | |
| | | List<Predicate> predicates = new ArrayList<>(); |
| | | |
| | | try { |
| | | predicates = createPedicates(searchCriterias, qb, root); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | cq.select(root); |
| | | cq.where(predicates.toArray(new Predicate[predicates.size()])); |
| | | |
| | | return getEntityManager().createQuery(cq).getResultList(); |
| | | } |
| | | |
| | | public default List<T> findWithPagination(Integer pageNumber, Integer pagesize, U searchEntity) { |
| | | CriteriaBuilder qb = getEntityManager().getCriteriaBuilder(); |
| | | CriteriaQuery<T> cq = qb.createQuery(getManagedEntityClass()); |
| | | |
| | | Root<T> root = cq.from(getManagedEntityClass()); |
| | | |
| | | List<SearchCriteria> searchCriterias = SearchCriteriaBuilderUtil.getSearchCriterias(searchEntity, getManagedEntityClass(), root, new ArrayList<>()); |
| | | |
| | | List<Predicate> predicates = new ArrayList<>(); |
| | | |
| | | try { |
| | | predicates = createPedicates(searchCriterias, qb, root); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | cq.select(root); |
| | | cq.where(predicates.toArray(new Predicate[predicates.size()])); |
| | | |
| | | TypedQuery<T> typedQuery = getEntityManager().createQuery(cq); |
| | | |
| | | typedQuery.setFirstResult((pageNumber - 1) * pagesize); |
| | | typedQuery.setMaxResults(pagesize); |
| | | |
| | | return typedQuery.getResultList(); |
| | | } |
| | | |
| | | /** |
| | | * Méthode qui les prédicats à partir des critères de recherche |
| | | * |
| | | * @param searchCriterias |
| | | * @param cb |
| | | * @param root |
| | | * @return |
| | | */ |
| | | public default List<Predicate> createPedicates(List<SearchCriteria> searchCriterias, CriteriaBuilder cb, Root<T> root) { |
| | | List<Predicate> predicates = new ArrayList<>(); |
| | | |
| | | searchCriterias.parallelStream().forEach(s -> { |
| | | |
| | | if (s.getFieldValue() != null) { |
| | | Predicate predicate = null; |
| | | switch (s.getOperateur()) { |
| | | case EQUALS: |
| | | predicate = cb.equal(s.getFrom().get(s.getFieldName()), s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | break; |
| | | |
| | | case NOT_EQUALS: |
| | | predicate = cb.notEqual(s.getFrom().get(s.getFieldName()), s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | break; |
| | | |
| | | case LIKE: |
| | | if (s.getFieldValue() instanceof String) { |
| | | predicate = cb.like(s.getFrom().get(s.getFieldName()), "%" + s.getFieldValue().toString() + "%"); |
| | | predicates.add(predicate); |
| | | } |
| | | break; |
| | | |
| | | case GREATER_THAN: |
| | | if (s.getFieldValue() instanceof Number) { |
| | | predicate = cb.gt(s.getFrom().get(s.getFieldName()), (Number) s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | |
| | | } else if (s.getFieldValue() instanceof LocalDate) { |
| | | predicate = cb.greaterThan(s.getFrom().get(s.getFieldName()), (LocalDate) s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | } |
| | | break; |
| | | |
| | | case GREATER_OR_EQUALS_THAN: |
| | | if (s.getFieldValue() instanceof Number) { |
| | | predicate = cb.ge(root.get(s.getFieldName()), (Number) s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | } else if (s.getFieldValue() instanceof LocalDate) { |
| | | predicate = cb.greaterThanOrEqualTo(root.get(s.getFieldName()), (LocalDate) s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | } |
| | | break; |
| | | |
| | | case LESS_THAN: |
| | | if (s.getFieldValue() instanceof Number) { |
| | | predicate = cb.lt(s.getFrom().get(s.getFieldName()), (Number) s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | } else if (s.getFieldValue() instanceof LocalDate) { |
| | | predicate = cb.lessThan(s.getFrom().get(s.getFieldName()), (LocalDate) s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | } |
| | | break; |
| | | |
| | | case LESS_OR_EQUALS_THAN: |
| | | if (s.getFieldValue() instanceof Number) { |
| | | predicate = cb.le(s.getFrom().get(s.getFieldName()), (Number) s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | } else if (s.getFieldValue() instanceof LocalDate) { |
| | | predicate = cb.lessThanOrEqualTo(s.getFrom().get(s.getFieldName()), (LocalDate) s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | } |
| | | break; |
| | | case IN: |
| | | if (s.getFieldValue() instanceof java.util.Collection) { |
| | | predicate = s.getFrom().get(s.getFieldName()).in(s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | } |
| | | break; |
| | | default: |
| | | |
| | | } |
| | | } |
| | | }); |
| | | |
| | | return predicates; |
| | | } |
| | | } |
| 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.fdxcommons.dao.ifaces.abstracts; |
| | | |
| | | import com.megatim.fdxcommons.dao.ifaces.utils.SearchCriteriaBuilderUtil; |
| | | import static com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur.EQUALS; |
| | | import static com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur.GREATER_OR_EQUALS_THAN; |
| | | import static com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur.GREATER_THAN; |
| | | import static com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur.IN; |
| | | import static com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur.LESS_OR_EQUALS_THAN; |
| | | import static com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur.LESS_THAN; |
| | | import static com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur.LIKE; |
| | | import static com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur.NOT_EQUALS; |
| | | import com.megatim.fdxcommons.model.search.SearchCriteria; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.persistence.EntityManager; |
| | | import javax.persistence.TypedQuery; |
| | | import javax.persistence.criteria.CriteriaBuilder; |
| | | import javax.persistence.criteria.CriteriaQuery; |
| | | import javax.persistence.criteria.Predicate; |
| | | import javax.persistence.criteria.Root; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface CustomDAOIfaces<T, ID, U> { |
| | | |
| | | default T save(T entity) { |
| | | return getEntityManager().merge(entity); |
| | | } |
| | | |
| | | default void delete(T entity) { |
| | | getEntityManager().remove(entity); |
| | | } |
| | | |
| | | public Class<T> getManagedEntityClass(); |
| | | |
| | | public EntityManager getEntityManager(); |
| | | |
| | | public T getById(ID id); |
| | | |
| | | public default long count(U searchEntity) { |
| | | CriteriaBuilder qb = getEntityManager().getCriteriaBuilder(); |
| | | CriteriaQuery<Long> cq = qb.createQuery(Long.class); |
| | | Root<T> root = cq.from(getManagedEntityClass()); |
| | | |
| | | List<SearchCriteria> searchCriterias = SearchCriteriaBuilderUtil.getSearchCriterias(searchEntity, getManagedEntityClass(), root, new ArrayList<>()); |
| | | List<Predicate> predicates = createPedicates(searchCriterias, qb, root); |
| | | |
| | | cq.select(qb.count(root)); |
| | | cq.where(predicates.toArray(new Predicate[predicates.size()])); |
| | | |
| | | return (long) getEntityManager().createQuery(cq).getSingleResult(); |
| | | } |
| | | |
| | | public default List<T> getAll(U searchEntity) { |
| | | CriteriaBuilder qb = getEntityManager().getCriteriaBuilder(); |
| | | CriteriaQuery<T> cq = qb.createQuery(getManagedEntityClass()); |
| | | |
| | | Root<T> root = cq.from(getManagedEntityClass()); |
| | | |
| | | List<SearchCriteria> searchCriterias = SearchCriteriaBuilderUtil.getSearchCriterias(searchEntity, getManagedEntityClass(), root, new ArrayList<>()); |
| | | |
| | | List<Predicate> predicates = new ArrayList<>(); |
| | | |
| | | try { |
| | | predicates = createPedicates(searchCriterias, qb, root); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | cq.select(root); |
| | | cq.where(predicates.toArray(new Predicate[predicates.size()])); |
| | | |
| | | return getEntityManager().createQuery(cq).getResultList(); |
| | | } |
| | | |
| | | public default List<T> findWithPagination(Integer pageNumber, Integer pagesize, U searchEntity) { |
| | | CriteriaBuilder qb = getEntityManager().getCriteriaBuilder(); |
| | | CriteriaQuery<T> cq = qb.createQuery(getManagedEntityClass()); |
| | | |
| | | Root<T> root = cq.from(getManagedEntityClass()); |
| | | |
| | | List<SearchCriteria> searchCriterias = SearchCriteriaBuilderUtil.getSearchCriterias(searchEntity, getManagedEntityClass(), root, new ArrayList<>()); |
| | | |
| | | List<Predicate> predicates = new ArrayList<>(); |
| | | |
| | | try { |
| | | predicates = createPedicates(searchCriterias, qb, root); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | cq.select(root); |
| | | cq.where(predicates.toArray(new Predicate[predicates.size()])); |
| | | |
| | | TypedQuery<T> typedQuery = getEntityManager().createQuery(cq); |
| | | |
| | | typedQuery.setFirstResult((pageNumber - 1) * pagesize); |
| | | typedQuery.setMaxResults(pagesize); |
| | | |
| | | return typedQuery.getResultList(); |
| | | } |
| | | |
| | | /** |
| | | * Méthode qui les prédicats à partir des critères de recherche |
| | | * |
| | | * @param searchCriterias |
| | | * @param cb |
| | | * @param root |
| | | * @return |
| | | */ |
| | | public default List<Predicate> createPedicates(List<SearchCriteria> searchCriterias, CriteriaBuilder cb, Root<T> root) { |
| | | List<Predicate> predicates = new ArrayList<>(); |
| | | |
| | | searchCriterias.stream().forEach(s -> { |
| | | |
| | | if (s.getFieldValue() != null) { |
| | | Predicate predicate = null; |
| | | switch (s.getOperateur()) { |
| | | case EQUALS: |
| | | predicate = cb.equal(s.getFrom().get(s.getFieldName()), s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | break; |
| | | |
| | | case NOT_EQUALS: |
| | | predicate = cb.notEqual(s.getFrom().get(s.getFieldName()), s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | break; |
| | | |
| | | case LIKE: |
| | | if (s.getFieldValue() instanceof String) { |
| | | predicate = cb.like(s.getFrom().get(s.getFieldName()), "%" + s.getFieldValue().toString() + "%"); |
| | | predicates.add(predicate); |
| | | } |
| | | break; |
| | | |
| | | case GREATER_THAN: |
| | | if (s.getFieldValue() instanceof Number) { |
| | | predicate = cb.gt(s.getFrom().get(s.getFieldName()), (Number) s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | |
| | | } else if (s.getFieldValue() instanceof LocalDate) { |
| | | predicate = cb.greaterThan(s.getFrom().get(s.getFieldName()), (LocalDate) s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | } |
| | | break; |
| | | |
| | | case GREATER_OR_EQUALS_THAN: |
| | | if (s.getFieldValue() instanceof Number) { |
| | | predicate = cb.ge(root.get(s.getFieldName()), (Number) s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | } else if (s.getFieldValue() instanceof LocalDate) { |
| | | predicate = cb.greaterThanOrEqualTo(root.get(s.getFieldName()), (LocalDate) s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | } |
| | | break; |
| | | |
| | | case LESS_THAN: |
| | | if (s.getFieldValue() instanceof Number) { |
| | | predicate = cb.lt(s.getFrom().get(s.getFieldName()), (Number) s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | } else if (s.getFieldValue() instanceof LocalDate) { |
| | | predicate = cb.lessThan(s.getFrom().get(s.getFieldName()), (LocalDate) s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | } |
| | | break; |
| | | |
| | | case LESS_OR_EQUALS_THAN: |
| | | if (s.getFieldValue() instanceof Number) { |
| | | predicate = cb.le(s.getFrom().get(s.getFieldName()), (Number) s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | } else if (s.getFieldValue() instanceof LocalDate) { |
| | | predicate = cb.lessThanOrEqualTo(s.getFrom().get(s.getFieldName()), (LocalDate) s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | } |
| | | break; |
| | | case IN: |
| | | if (s.getFieldValue() instanceof java.util.Collection) { |
| | | predicate = s.getFrom().get(s.getFieldName()).in(s.getFieldValue()); |
| | | predicates.add(predicate); |
| | | } |
| | | break; |
| | | default: |
| | | |
| | | } |
| | | } |
| | | }); |
| | | |
| | | return predicates; |
| | | } |
| | | } |
| 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.fdxcommons.dao.ifaces.integration; |
| | | |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinitionId; |
| | | import com.megatim.fdxcommons.model.searchentities.ColumnDefinitionSearch; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.Set; |
| | | import javax.persistence.Query; |
| | | import javax.persistence.Tuple; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ColumnDefinitionDAO extends CustomDAOIfaces<ColumnDefinition, ColumnDefinitionId, ColumnDefinitionSearch> { |
| | | |
| | | public default ColumnDefinition findByNameAndReferentielAndTypeFichier(String columnName, String referentielVersion, String codeTypeFichier) { |
| | | Query query = getEntityManager().createQuery("SELECT c FROM ColumnDefinition c " |
| | | + " WHERE c.name = :columnName AND c.referentielVersion = :referentielVersion " |
| | | + " AND c.codeTypeFichier = :codeTypeFichier"); |
| | | |
| | | query.setParameter("columnName", columnName); |
| | | query.setParameter("referentielVersion", referentielVersion); |
| | | query.setParameter("codeTypeFichier", codeTypeFichier); |
| | | |
| | | Optional<ColumnDefinition> optColumnDef = ((List<ColumnDefinition>) query.getResultList()).stream().findFirst(); |
| | | |
| | | return optColumnDef.isPresent() ? optColumnDef.get() : null; |
| | | } |
| | | |
| | | public default List<ColumnDefinition> findByReferentielAndTypeFichier(String referentielVersion, String codeTypeFichier) { |
| | | return getEntityManager() |
| | | .createQuery("SELECT c FROM ColumnDefinition c" |
| | | + " WHERE c.referentielVersion = :referentielVersion AND c.codeTypeFichier = :codeTypeFichier", ColumnDefinition.class) |
| | | .setParameter("referentielVersion", referentielVersion) |
| | | .setParameter("codeTypeFichier", codeTypeFichier) |
| | | .getResultList(); |
| | | |
| | | } |
| | | |
| | | public default List<ColumnDefinition> findByReferentiel(String referentielVersion) { |
| | | return getEntityManager() |
| | | .createQuery("SELECT c FROM ColumnDefinition c" |
| | | + " WHERE c.referentielVersion = :referentielVersion ", ColumnDefinition.class) |
| | | .setParameter("referentielVersion", referentielVersion) |
| | | .getResultList(); |
| | | } |
| | | |
| | | public default Set<String> findTypeFichierByReferentiel(String referentielVersion) { |
| | | Set<String> typeFichiers = new HashSet<>(); |
| | | List<ColumnDefinition> columnDefinitions = findByReferentiel(referentielVersion); |
| | | |
| | | columnDefinitions.stream().forEach(c -> { |
| | | if (!typeFichiers.contains(c.getCodeTypeFichier())) { |
| | | typeFichiers.add(c.getCodeTypeFichier()); |
| | | } |
| | | }); |
| | | return typeFichiers; |
| | | } |
| | | |
| | | @Override |
| | | public default ColumnDefinition getById(ColumnDefinitionId id) { |
| | | Query query = getEntityManager().createQuery("SELECT c FROM ColumnDefinition c" |
| | | + " WHERE c.referentielVersion = :referentielVersion AND c.codeTypeFichier = :codeTypeFichier" |
| | | + " AND c.name = :name"); |
| | | |
| | | query.setParameter("referentielVersion", id.getReferentielVersion()); |
| | | query.setParameter("codeTypeFichier", id.getCodeTypeFichier()); |
| | | query.setParameter("name", id.getName()); |
| | | |
| | | Optional<ColumnDefinition> optColumnDef = ((List<ColumnDefinition>) query.getResultList()).stream().findFirst(); |
| | | |
| | | return optColumnDef.isPresent() ? optColumnDef.get() : null; |
| | | } |
| | | |
| | | List<Tuple> byRefVersionAndByTypeFichier(); |
| | | } |
| 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.fdxcommons.dao.ifaces.integration; |
| | | |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | import com.megatim.fdxcommons.model.integration.TableDefinitionId; |
| | | import com.megatim.fdxcommons.model.integration.TableDefinition; |
| | | import com.megatim.fdxcommons.model.searchentities.TableDefinitionSearch; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface TableDefinitionDAO extends CustomDAOIfaces<TableDefinition, TableDefinitionId, TableDefinitionSearch> { |
| | | |
| | | @Override |
| | | public default TableDefinition getById(TableDefinitionId id) { |
| | | Query query = getEntityManager().createQuery("SELECT t FROM TableDefinition t " |
| | | + " WHERE t.referentielVersion = :referentielVersion AND t.codeTypeFichier = :codeTypeFichier"); |
| | | |
| | | query.setParameter("referentielVersion", id.getReferentielVersion()); |
| | | query.setParameter("codeTypeFichier", id.getCodeTypeFichier()); |
| | | |
| | | Optional<TableDefinition> optTableDef = ((List<TableDefinition>) query.getResultList()).stream().findFirst(); |
| | | |
| | | return optTableDef.isPresent() ? optTableDef.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.fdxcommons.dao.ifaces.integration.json; |
| | | |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | import com.megatim.fdxcommons.model.integration.json.JsonStructure; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface JsonStructureDAO extends CustomDAOIfaces<JsonStructure, Long, JsonStructure> { |
| | | |
| | | default JsonStructure loadSubJsonStructure(JsonStructure jsonStructure) { |
| | | List<JsonStructure> children = getChildren(jsonStructure.getId()); |
| | | List<JsonStructure> subJsonStructure = new ArrayList<>(); |
| | | |
| | | for (JsonStructure j : children) { |
| | | subJsonStructure.add(loadSubJsonStructure(j)); |
| | | } |
| | | jsonStructure.getFields().clear(); |
| | | jsonStructure.getFields().addAll(subJsonStructure); |
| | | |
| | | return jsonStructure; |
| | | } |
| | | |
| | | default List<JsonStructure> getChildren(Long id) { |
| | | Query query = getEntityManager().createQuery("SELECT j from JsonStructure j where j.parent.id = :id "); |
| | | query.setParameter("id", id); |
| | | |
| | | return (List<JsonStructure>) query.getResultList(); |
| | | } |
| | | |
| | | @Override |
| | | public default JsonStructure getById(Long id) { |
| | | Query query = getEntityManager().createQuery("SELECT j from JsonStructure j where j.id = :id "); |
| | | query.setParameter("id", id); |
| | | Optional<JsonStructure> optJsonStructure = ((List<JsonStructure>) query.getResultList()).stream().findFirst(); |
| | | |
| | | return optJsonStructure.isPresent() ? optJsonStructure.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.fdxcommons.dao.ifaces.integration.json; |
| | | |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | import com.megatim.fdxcommons.model.integration.json.TypeFichierJson; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface TypeFichierJsonDAO extends CustomDAOIfaces<TypeFichierJson, Long, TypeFichierJson> { |
| | | |
| | | @Override |
| | | public default TypeFichierJson getById(Long id) { |
| | | Query query = getEntityManager().createQuery("SELECT t from TypeFichierJson t where t.id = :id "); |
| | | query.setParameter("id", id); |
| | | Optional<TypeFichierJson> optJsonStructure = ((List<TypeFichierJson>) query.getResultList()).stream().findFirst(); |
| | | |
| | | return optJsonStructure.isPresent() ? optJsonStructure.get() : null; |
| | | } |
| | | |
| | | TypeFichierJson findByReferentielAndByTypeFichier(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.fdxcommons.dao.ifaces.natureproduction; |
| | | |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProductionFichier; |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProductionFichierId; |
| | | import java.util.List; |
| | | import javax.persistence.Query; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface NatureProductionFichierDAO extends CustomDAOIfaces<NatureProductionFichier, NatureProductionFichierId, NatureProductionFichier> { |
| | | |
| | | default List<NatureProductionFichier> getByReferentiel(String referentielVersion) { |
| | | Query query = getEntityManager().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/Interface.java to edit this template |
| | | */ |
| | | package com.megatim.fdxcommons.dao.ifaces.referentiel.historique; |
| | | |
| | | import com.megatim.fdxcommons.dao.ifaces.abstracts.CustomDAOIfaces; |
| | | import com.megatim.fdxcommons.model.referentiel.historique.ReferentielIntegrationHistorique; |
| | | import com.megatim.fdxcommons.model.referentiel.historique.ReferentielIntegrationHistoriqueId; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface ReferentielIntegrationHistoriqueDAO extends CustomDAOIfaces<ReferentielIntegrationHistorique, ReferentielIntegrationHistoriqueId, ReferentielIntegrationHistorique> { |
| | | |
| | | public ReferentielIntegrationHistorique suitableIntegrationHistorique(String codeTypeFichier, String refVersion); |
| | | |
| | | List<ReferentielIntegrationHistorique> suitableIntegrationHistorique(String refVersion); |
| | | } |
| 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.fdxcommons.dao.ifaces.utils; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.NumberOperator; |
| | | import com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur; |
| | | import com.megatim.fdxcommons.model.search.Search; |
| | | import com.megatim.fdxcommons.model.search.SearchCriteria; |
| | | import java.beans.IntrospectionException; |
| | | import java.beans.PropertyDescriptor; |
| | | import java.lang.reflect.Field; |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.lang.reflect.Method; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import javax.persistence.criteria.From; |
| | | import javax.persistence.criteria.Join; |
| | | import javax.persistence.criteria.Root; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class SearchCriteriaBuilderUtil { |
| | | |
| | | private SearchCriteriaBuilderUtil() { |
| | | } |
| | | |
| | | public static <T, U> List<SearchCriteria> getSearchCriterias(U searchEntity, Class<T> entityClass, Root<?> root, List<SearchCriteria> externalSearchCriterias) { |
| | | Field[] entityFields = entityClass.getDeclaredFields(); |
| | | List<SearchCriteria> searchCriterias = new ArrayList<>(); |
| | | |
| | | if (externalSearchCriterias != null) { |
| | | searchCriterias.addAll(externalSearchCriterias); |
| | | } |
| | | |
| | | if (searchEntity == null) { |
| | | return searchCriterias; |
| | | } |
| | | |
| | | Field[] searchEntityFields = searchEntity.getClass().getDeclaredFields(); |
| | | for (Field searchEntityField : searchEntityFields) { |
| | | Search searchAnnotation = searchEntityField.getAnnotation(Search.class); |
| | | |
| | | if (searchAnnotation != null && searchAnnotation.fieldName() != null && !searchAnnotation.fieldName().isEmpty()) { |
| | | String[] fieldPath = searchAnnotation.fieldName().split("\\."); |
| | | if (fieldPath.length == 1) { |
| | | if (isSearchFieldDescriptionCorrect(searchAnnotation.fieldName(), searchEntityField, entityFields)) { |
| | | searchCriterias.add(createSearchCriteria(searchAnnotation, searchAnnotation.fieldName(), searchEntityField, searchEntity, root)); |
| | | } |
| | | } else if (fieldPath.length > 1) { |
| | | Join<Object, Object> join = null; |
| | | String fieldName = fieldPath[fieldPath.length - 1]; |
| | | for (int i = 0; i < fieldPath.length - 1; i++) { |
| | | if (i == 0) { |
| | | join = root.join(fieldPath[i]); |
| | | } else { |
| | | if (join != null) { |
| | | join = join.join(fieldPath[i]); |
| | | } |
| | | } |
| | | } |
| | | if (isSearchHierarchicalFieldDescriptionCorrect(fieldPath, searchEntityField, entityFields)) { |
| | | searchCriterias.add(createSearchCriteria(searchAnnotation, fieldName, searchEntityField, searchEntity, join)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | return searchCriterias; |
| | | } |
| | | |
| | | private static SearchCriteria createSearchCriteria(Search searchAnnotation, String fieldName, Field searchEntityField, Object searchEntity, From<?, ?> from) { |
| | | SearchCriteria searchCriteria = new SearchCriteria(); |
| | | searchCriteria.setFrom(from); |
| | | searchCriteria.setFieldName(fieldName); |
| | | searchCriteria.setOperateur(searchAnnotation.operateur()); |
| | | searchCriteria.setFieldType(searchEntityField.getType()); |
| | | Object fieldValue = getFieldValue(searchEntityField, searchEntity); |
| | | searchCriteria.setFieldValue(fieldValue); |
| | | |
| | | if (searchAnnotation.operateur().equals(SearchAnnotationOperateur.NUMBER_OPERATOR)) { |
| | | try { |
| | | searchCriteria.setNumberOperator(getNumberOperatorFieldValue(searchAnnotation.operatorFieldName(), searchEntity)); |
| | | } catch (IntrospectionException ex) { |
| | | } |
| | | } |
| | | return searchCriteria; |
| | | } |
| | | |
| | | private static Object getFieldValue(Field field, Object searchEntity) { |
| | | Object value = null; |
| | | field.setAccessible(true); |
| | | try { |
| | | Method method = new PropertyDescriptor(field.getName(), searchEntity.getClass()).getReadMethod(); |
| | | value = (Comparable<?>) method.invoke(searchEntity); |
| | | } catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException | java.beans.IntrospectionException ex) { |
| | | } |
| | | return value; |
| | | } |
| | | |
| | | private static NumberOperator getNumberOperatorFieldValue(String operatorFieldName, Object searchEntity) throws java.beans.IntrospectionException { |
| | | NumberOperator numberOperator = NumberOperator.UNKNOW; |
| | | Field[] fields = searchEntity.getClass().getDeclaredFields(); |
| | | for (Field field : fields) { |
| | | if (field.getName().equals(operatorFieldName)) { |
| | | field.setAccessible(true); |
| | | try { |
| | | Method method = new PropertyDescriptor(field.getName(), searchEntity.getClass()).getReadMethod(); |
| | | Object value = method.invoke(searchEntity); |
| | | if (value instanceof NumberOperator) { |
| | | numberOperator = (NumberOperator) value; |
| | | } |
| | | } catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException ex) { |
| | | } |
| | | } |
| | | } |
| | | return numberOperator; |
| | | } |
| | | |
| | | private static boolean isSearchHierarchicalFieldDescriptionCorrect(String[] fieldPath, Field searchEntityField, Field[] entityFields) { |
| | | String fieldName = fieldPath[0]; |
| | | if (fieldPath.length == 1) { |
| | | return isSearchFieldDescriptionCorrect(fieldName, searchEntityField, entityFields); |
| | | } else { |
| | | |
| | | Class<?> clazz = getFieldClass(fieldName, entityFields); |
| | | if (clazz != null) { |
| | | Field[] subFields = clazz.getDeclaredFields(); |
| | | String[] subFieldPath = Arrays.copyOfRange(fieldPath, 1, fieldPath.length); |
| | | return isSearchHierarchicalFieldDescriptionCorrect(subFieldPath, searchEntityField, subFields); |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | private static Class<?> getFieldClass(String fieldName, Field[] entityFields) { |
| | | int index = getIndex(fieldName, entityFields); |
| | | return (index != -1) ? entityFields[index].getType() : null; |
| | | } |
| | | |
| | | private static boolean isSearchFieldDescriptionCorrect(String fieldName, Field searchEntityField, Field[] entityFields) { |
| | | int index = getIndex(fieldName, entityFields); |
| | | return (index != -1) && isFieldTypeEquals(searchEntityField, entityFields[index]); |
| | | } |
| | | |
| | | private static int getIndex(String fieldName, Field[] entityFields) { |
| | | int index = 0; |
| | | for (Field field : entityFields) { |
| | | if (fieldName.equals(field.getName())) { |
| | | return index; |
| | | } |
| | | index++; |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | private static boolean isFieldTypeEquals(Field searchEntityField, Field entityField) { |
| | | return searchEntityField.getType().equals(entityField.getType()); |
| | | } |
| | | } |
| 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.fdxcommons</groupId> |
| | | <artifactId>fdxcommons</artifactId> |
| | | <version>1.0</version> |
| | | </parent> |
| | | |
| | | <groupId>com.megatim.fdxcommons.dao.impl</groupId> |
| | | <artifactId>fdxcommons-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.fdxcommons.dao.ifaces</groupId> |
| | | <artifactId>fdxcommons-dao-ifaces</artifactId> |
| | | <version>${project.version}</version> |
| | | <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.fdxcommons.tools</groupId> |
| | | <artifactId>fdxcommons-tools</artifactId> |
| | | <version>1.0</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>javax</groupId> |
| | | <artifactId>javaee-api</artifactId> |
| | | <version>${jakartaee}</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>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> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.hibernate.validator</groupId> |
| | | <artifactId>hibernate-validator</artifactId> |
| | | <version>6.0.13.Final</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.hibernate</groupId> |
| | | <artifactId>hibernate-core</artifactId> |
| | | <version>5.4.2.Final</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.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>fdxcommons-dao-impl</name> |
| | | </project> |
| New file |
| | |
| | | user.name=postgres |
| | | password=mela |
| | | adresse.ip=localhost |
| | | port=5432 |
| | | database.name=fdxCommonsDB |
| | | 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.fdxcommons</groupId> |
| | | <artifactId>fdxcommons</artifactId> |
| | | <version>1.0</version> |
| | | </parent> |
| | | |
| | | <groupId>com.megatim.fdxcommons.model</groupId> |
| | | <artifactId>fdxcommons-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> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <version>${version.lombok}</version> |
| | | <optional>true</optional> |
| | | <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</groupId> |
| | | <artifactId>rs-security-core</artifactId> |
| | | <version>1.0-SNAPSHOT</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.mapstruct</groupId> |
| | | <artifactId>mapstruct</artifactId> |
| | | <version>${version.mapstruct}</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.projectlombok</groupId> |
| | | <artifactId>lombok-mapstruct-binding</artifactId> |
| | | <version>${version.mapstruct-lombok}</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.hibernate.validator</groupId> |
| | | <artifactId>hibernate-validator</artifactId> |
| | | <version>6.0.13.Final</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <!-- Apiee --> |
| | | <dependency> |
| | | <groupId>com.github.phillip-kruger</groupId> |
| | | <artifactId>apiee-core</artifactId> |
| | | <version>1.0.8</version> |
| | | <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</groupId> |
| | | <artifactId>reporting-adhoc</artifactId> |
| | | <version>1.0</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.hibernate</groupId> |
| | | <artifactId>hibernate-core</artifactId> |
| | | <version>5.4.2.Final</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.github.ua-parser</groupId> |
| | | <artifactId>uap-java</artifactId> |
| | | <version>1.6.1</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </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>fdxcommons-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.fdxcommons.model.base; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.TypeOperation; |
| | | import com.megatim.fdxcommons.model.search.CriteriaEntitySearch; |
| | | import java.util.Date; |
| | | import javax.persistence.Column; |
| | | import javax.persistence.EnumType; |
| | | import javax.persistence.Enumerated; |
| | | import javax.persistence.MappedSuperclass; |
| | | import javax.persistence.Temporal; |
| | | import javax.persistence.TemporalType; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @MappedSuperclass |
| | | public class BaseEntity { |
| | | |
| | | @Column(name = "TYPE_OPERATION") |
| | | @Enumerated(EnumType.STRING) |
| | | protected TypeOperation typeOperation = TypeOperation.AJOUTER; |
| | | |
| | | @CriteriaEntitySearch(libelle = "Date création", rang = 1) |
| | | @Column(name = "DATE_CREATION") |
| | | @Temporal(TemporalType.TIMESTAMP) |
| | | protected Date dateCreation = new Date(); |
| | | |
| | | @CriteriaEntitySearch(libelle = "Crée par", rang = 2) |
| | | @Column(name = "USER_CREATION") |
| | | protected String utilisateurCreation; |
| | | |
| | | @CriteriaEntitySearch(libelle = "Date dernière regen.", rang = 3, visible = false) |
| | | @Column(name = "DATE_DERN_MOD") |
| | | @Temporal(TemporalType.TIMESTAMP) |
| | | protected Date dateDerniereModification; |
| | | |
| | | @CriteriaEntitySearch(libelle = "Modifié par", rang = 4, visible = false) |
| | | @Column(name = "USER_UPDATE") |
| | | protected String utilisateurModification; |
| | | |
| | | @Column(name = "DATE_SUPPR") |
| | | @Temporal(TemporalType.TIMESTAMP) |
| | | protected Date dateSuppression; |
| | | |
| | | @Column(name = "USER_DELETE") |
| | | protected String utilisateurSuppression; |
| | | } |
| 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.fdxcommons.model.camel; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class BrokerProperties { |
| | | |
| | | public static String HOSTNAME = "broker.hostname"; |
| | | public static String PORT_NUMBER = "broker.port-number"; |
| | | public static String USER_NAME = "broker.user-name"; |
| | | public static String PASSWORD = "broker.password"; |
| | | } |
| 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.fdxcommons.model.camel; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class CamelProperties { |
| | | |
| | | public static String ERROR_DIR = "error"; |
| | | |
| | | public static String STANDALONE_TMP_DIR_PROPERTY = "fdx.api.integration-standalone-temp-dir"; |
| | | public static String CONSULTATION_TMP_DIR = "fdx.api.integration-consultation-temp-dir"; |
| | | |
| | | public static String REFERENTIEL_LOCAL_PATH_PROPERTY = "fdx.api.referentiel-integration-local-path"; |
| | | public static String FICHIER_LOCAL_PATH_PROPERTY = "fdx.api.fichier-integration-local-path"; |
| | | public static String STANDALONE_DESTINATION_DIR_PROPERTY = "fdx.api.integration-standalone-destination-dir"; |
| | | public static String CONSULTATION_DESTINATION_DIR_PROPERTY = "fdx.api.integration-consultation-destination-dir"; |
| | | |
| | | public static String REFERENTIEL_REMOTE_PATH_PROPERTY = "fdx.api.referentiel-integration-remote-path"; |
| | | public static String FICHIER_REMOTE_PATH_PROPERTY = "fdx.api.fichier-integration-remote-path"; |
| | | public static String STANDALONE_REMOTE_DIR_PROPERTY = "fdx.integration-standalone-remote"; |
| | | public static String CONSULTATION_REMOTE_DIR_PROPERTY = "fdx.integration-consultation-remote"; |
| | | |
| | | public static String STANDALONE_USER_NAME = "fdx.integration-standalone-username"; |
| | | public static String STANDALONE_PASSWORD = "fdx.integration-standalone-password"; |
| | | public static String STANDALONE_HOST_NAME = "fdx.integration-standalone-hostname"; |
| | | public static String STANDALONE_PORT = "fdx.integration-standalone-port"; |
| | | public static String CONSULTATION_USER_NAME = "fdx.integration-consultation-username"; |
| | | public static String CONSULTATION_PASSWORD = "fdx.integration-consultation-password"; |
| | | public static String CONSULTATION_HOST_NAME = "fdx.integration-consultation-hostname"; |
| | | public static String CONSULTATION_PORT = "fdx.integration-consultation-port"; |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.camel; |
| | | |
| | | 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 isStandaloneSftpConfigCorrect() throws IOException { |
| | | return sftpConfiguration.isStandaloneCorrect(); |
| | | } |
| | | |
| | | public boolean isStandaloneLocalConfigCorrect() throws IOException { |
| | | return localConfiguration.isStandaloneCorrect(); |
| | | } |
| | | |
| | | public boolean isConsultationConfigCorrect() throws IOException { |
| | | return localConfiguration.isConsultationCorrect() || sftpConfiguration.isConsultationCorrect(); |
| | | } |
| | | |
| | | public LocalConfiguration getLocalConfiguration() { |
| | | return localConfiguration; |
| | | } |
| | | |
| | | public SftpConfiguration getSftpConfiguration() { |
| | | return sftpConfiguration; |
| | | } |
| | | |
| | | public String standaloneURI() throws IOException { |
| | | return isStandaloneStfpConfigCorrect() |
| | | ? getSftpConfiguration().standaloneRouteURI() |
| | | : getLocalConfiguration().standaloneRouteURI(); |
| | | } |
| | | |
| | | public String consultationURI() throws IOException { |
| | | return isConsultationStfpConfigCorrect() |
| | | ? getSftpConfiguration().consultationRouteURI() |
| | | : getLocalConfiguration().consultationRouteURI(); |
| | | } |
| | | |
| | | private boolean isStandaloneStfpConfigCorrect() throws IOException { |
| | | return sftpConfiguration.isStandaloneCorrect(); |
| | | } |
| | | |
| | | private boolean isConsultationStfpConfigCorrect() throws IOException { |
| | | return sftpConfiguration.isStandaloneCorrect(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.camel; |
| | | |
| | | 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 |
| | | */ |
| | | public 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.fdxcommons.model.camel; |
| | | |
| | | 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=.*\\.(csv|txt)$" + routeParameters(); |
| | | } |
| | | |
| | | public String standaloneTmpRouteURI() throws IOException { |
| | | return "file:" + standaloneTmpDir() + "?include=.*\\.(csv|txt)$&delete=true" + routeParameters(); |
| | | } |
| | | |
| | | public String standaloneRouteURI() throws IOException { |
| | | return "file:" + standaloneDestinationDir() + "?include=.*\\.(csv|txt)$" + routeParameters(); |
| | | } |
| | | |
| | | public String standaloneTmpDir() throws IOException { |
| | | return fileProperties.properties().getProperty(CamelProperties.STANDALONE_TMP_DIR_PROPERTY); |
| | | } |
| | | |
| | | public String consultationTmpRouteURI() throws IOException { |
| | | return "file:" + consultationTmpDir() + "?include=.*\\.(csv|txt)$&delete=true" + routeParameters(); |
| | | } |
| | | |
| | | public String consultationRouteURI() throws IOException { |
| | | return "file:" + consultationDestinationDir() + "?include=.*\\.(csv|txt)$" + routeParameters(); |
| | | } |
| | | |
| | | public String consultationTmpDir() throws IOException { |
| | | return fileProperties.properties().getProperty(CamelProperties.CONSULTATION_TMP_DIR); |
| | | } |
| | | |
| | | public boolean isStandaloneCorrect() throws IOException { |
| | | return referentielLocalPath() != null |
| | | && fichierLocalPath() != null |
| | | && standaloneTmpDir() != null |
| | | && standaloneDestinationDir() != null; |
| | | } |
| | | |
| | | public boolean isConsultationCorrect() throws IOException { |
| | | return consultationTmpDir() != null && consultationDestinationDir() != null; |
| | | } |
| | | |
| | | private String routeParameters() { |
| | | return "&moveFailed=" + CamelProperties.ERROR_DIR + "&noop=true&readLock=rename"; |
| | | } |
| | | |
| | | public String referentielLocalPath() throws IOException { |
| | | return fileProperties.properties().getProperty(CamelProperties.REFERENTIEL_LOCAL_PATH_PROPERTY); |
| | | } |
| | | |
| | | public String fichierLocalPath() throws IOException { |
| | | return fileProperties.properties().getProperty(CamelProperties.FICHIER_LOCAL_PATH_PROPERTY); |
| | | } |
| | | |
| | | private String standaloneDestinationDir() throws IOException { |
| | | return fileProperties.properties().getProperty(CamelProperties.STANDALONE_DESTINATION_DIR_PROPERTY); |
| | | } |
| | | |
| | | public String consultationDestinationDir() throws IOException { |
| | | return fileProperties.properties().getProperty(CamelProperties.CONSULTATION_DESTINATION_DIR_PROPERTY); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.camel; |
| | | |
| | | 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(), standaloneHostName(), standalonePort(), standaloneUserName(), standalonePassword()); |
| | | } |
| | | |
| | | public String fichierRouteURI() throws IOException { |
| | | return buildURI(fichierRemotePath(), standaloneHostName(), standalonePort(), standaloneUserName(), standalonePassword()); |
| | | } |
| | | |
| | | public String standaloneRouteURI() throws IOException { |
| | | return buildURI(standaloneDestinationDir(), standaloneHostName(), standalonePort(), standaloneUserName(), standalonePassword()); |
| | | } |
| | | |
| | | public String consultationRouteURI() throws IOException { |
| | | return buildURI(consultationDestinationDir(), consultationHostName(), consultationPort(), consultationUserName(), consultationPassword()); |
| | | } |
| | | |
| | | public String standaloneTmpDir() throws IOException { |
| | | return fileProperties.properties().getProperty(CamelProperties.STANDALONE_TMP_DIR_PROPERTY); |
| | | } |
| | | |
| | | public String consultationTmpDir() throws IOException { |
| | | return fileProperties.properties().getProperty(CamelProperties.CONSULTATION_TMP_DIR); |
| | | } |
| | | |
| | | private String buildURI(String path, String hostName, int port, String userName, String password) throws IOException { |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | stringBuilder |
| | | .append(firstURIpart(hostName, port)) |
| | | .append(path) |
| | | .append(secondURIpart(userName, password)); |
| | | return stringBuilder.toString(); |
| | | } |
| | | |
| | | private String firstURIpart(String hostName, int port) throws IOException { |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | stringBuilder |
| | | .append("sftp:") |
| | | .append(hostName) |
| | | .append(":") |
| | | .append(port) |
| | | .append("/"); |
| | | return stringBuilder.toString(); |
| | | } |
| | | |
| | | private String secondURIpart(String userName, String password) 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 isStandaloneCorrect() throws IOException { |
| | | return standaloneRemote() |
| | | && referentielRemotePath() != null |
| | | && fichierRemotePath() != null |
| | | && standaloneDestinationDir() != null |
| | | && standaloneUserName() != null |
| | | && standalonePassword() != null |
| | | && standaloneHostName() != null; |
| | | } |
| | | |
| | | public boolean isConsultationCorrect() throws IOException { |
| | | return consultationRemote() |
| | | && consultationDestinationDir() != null |
| | | && consultationUserName() != null |
| | | && consultationPassword() != null |
| | | && consultationHostName() != null; |
| | | } |
| | | |
| | | private String referentielRemotePath() throws IOException { |
| | | return fileProperties.properties().getProperty(CamelProperties.REFERENTIEL_REMOTE_PATH_PROPERTY); |
| | | } |
| | | |
| | | private String fichierRemotePath() throws IOException { |
| | | return fileProperties.properties().getProperty(CamelProperties.FICHIER_REMOTE_PATH_PROPERTY); |
| | | } |
| | | |
| | | private boolean standaloneRemote() throws IOException { |
| | | String remoteIntegrationProperty = fileProperties.properties().getProperty(CamelProperties.STANDALONE_REMOTE_DIR_PROPERTY); |
| | | return remoteIntegrationProperty != null && Boolean.parseBoolean(remoteIntegrationProperty); |
| | | } |
| | | |
| | | private boolean consultationRemote() throws IOException { |
| | | String remoteIntegrationProperty = fileProperties.properties().getProperty(CamelProperties.CONSULTATION_REMOTE_DIR_PROPERTY); |
| | | return remoteIntegrationProperty != null && Boolean.parseBoolean(remoteIntegrationProperty); |
| | | } |
| | | |
| | | private String standaloneDestinationDir() throws IOException { |
| | | return fileProperties.properties().getProperty(CamelProperties.STANDALONE_DESTINATION_DIR_PROPERTY); |
| | | } |
| | | |
| | | private String consultationDestinationDir() throws IOException { |
| | | return fileProperties.properties().getProperty(CamelProperties.CONSULTATION_DESTINATION_DIR_PROPERTY); |
| | | } |
| | | |
| | | private String standaloneUserName() throws IOException { |
| | | return fileProperties.properties().getProperty(CamelProperties.STANDALONE_USER_NAME); |
| | | } |
| | | |
| | | private String standalonePassword() throws IOException { |
| | | return fileProperties.properties().getProperty(CamelProperties.STANDALONE_PASSWORD); |
| | | } |
| | | |
| | | private String standaloneHostName() throws IOException { |
| | | return fileProperties.properties().getProperty(CamelProperties.STANDALONE_HOST_NAME); |
| | | } |
| | | |
| | | private int standalonePort() throws IOException { |
| | | String portProperty = fileProperties.properties().getProperty(CamelProperties.STANDALONE_PORT); |
| | | return portProperty != null ? Integer.parseInt(portProperty) : 22; |
| | | } |
| | | |
| | | private String consultationUserName() throws IOException { |
| | | return fileProperties.properties().getProperty(CamelProperties.CONSULTATION_USER_NAME); |
| | | } |
| | | |
| | | private String consultationPassword() throws IOException { |
| | | return fileProperties.properties().getProperty(CamelProperties.CONSULTATION_PASSWORD); |
| | | } |
| | | |
| | | private String consultationHostName() throws IOException { |
| | | return fileProperties.properties().getProperty(CamelProperties.CONSULTATION_HOST_NAME); |
| | | } |
| | | |
| | | private int consultationPort() throws IOException { |
| | | String portProperty = fileProperties.properties().getProperty(CamelProperties.CONSULTATION_PORT); |
| | | return portProperty != null ? Integer.parseInt(portProperty) : 22; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.dataproduction; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.StatutDataProduction; |
| | | import com.megatim.fdxcommons.model.search.CriteriaEntitySearch; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import javax.persistence.EnumType; |
| | | import javax.persistence.Enumerated; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.MappedSuperclass; |
| | | import javax.validation.constraints.NotNull; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @NoArgsConstructor |
| | | @MappedSuperclass |
| | | public class CommonDataProduction implements Serializable { |
| | | |
| | | @Id |
| | | private Long id; |
| | | |
| | | @NotNull(message = "Le type de fichier est obligatoire") |
| | | @CriteriaEntitySearch(libelle = "Type du Fichier", rang = 1) |
| | | protected String codeTypeFichier; |
| | | |
| | | @CriteriaEntitySearch(libelle = "Participant", rang = 2) |
| | | protected String codeParticipant; |
| | | |
| | | @NotNull(message = "Le référentiel est obligatoire") |
| | | @CriteriaEntitySearch(libelle = "Référentiel", rang = 3) |
| | | protected String referentielVersion; |
| | | |
| | | @NotNull(message = "La source est obligatoire") |
| | | @Enumerated(EnumType.STRING) |
| | | @CriteriaEntitySearch(libelle = "Source de la production", rang = 4) |
| | | protected DataProductionSource source; |
| | | |
| | | @NotNull(message = "La date est obligatoire") |
| | | @CriteriaEntitySearch(libelle = "Date création de la production", rang = 0) |
| | | protected LocalDateTime dateProduction; |
| | | |
| | | @CriteriaEntitySearch(libelle = "Nom du Fichier", rang = 5) |
| | | protected String fileName; |
| | | |
| | | @NotNull(message = "La statut de la production est obligatoire") |
| | | @Enumerated(EnumType.STRING) |
| | | protected StatutDataProduction statutDataProduction = StatutDataProduction.A_CONSOMMER; |
| | | |
| | | protected LocalDateTime fileDate; |
| | | |
| | | @Enumerated(EnumType.STRING) |
| | | protected DataProductionType dataProductionType = DataProductionType.ADD; |
| | | |
| | | protected String token; |
| | | |
| | | protected LocalDateTime dateMiseAJour; |
| | | |
| | | protected Long nbreElements = 0L; |
| | | |
| | | protected Long tailleFichier = 0L;//en octet |
| | | |
| | | protected String integrationFileName;// Nom du fichier généré pour consommation par Standalone et Consultation |
| | | |
| | | protected String tokenDirectory; |
| | | |
| | | } |
| 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.fdxcommons.model.dataproduction; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonValue; |
| | | import com.megatim.fdxcommons.model.search.EnumValue; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public enum DataProductionSource { |
| | | API("API"), FICHIER("FICHIER"); |
| | | |
| | | private final String value; |
| | | |
| | | private DataProductionSource(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return this.value; |
| | | } |
| | | |
| | | @JsonValue |
| | | public String getValue() { |
| | | return this.value; |
| | | } |
| | | |
| | | @EnumValue |
| | | public static DataProductionSource fromValue(String value) { |
| | | if (value == null) { |
| | | return null; |
| | | } |
| | | if (value.equalsIgnoreCase("api")) { |
| | | return DataProductionSource.API; |
| | | } else if (value.equalsIgnoreCase("fichier")) { |
| | | return DataProductionSource.FICHIER; |
| | | } 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.fdxcommons.model.dataproduction; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.Id; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * Cette entité est utilisé pour les types de fichier referentielle dont il faut supprimer les anciennes données à chaque nouvelle production |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Entity |
| | | public class DataProductionToDelete implements Serializable { |
| | | |
| | | @Id |
| | | private Long id;// Id de la production à conserver |
| | | |
| | | private LocalDateTime dateCreation; |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.dataproduction; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public enum DataProductionType { |
| | | ADD, UPDATE, DELETE; |
| | | } |
| 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.fdxcommons.model.dataproduction.metadata; |
| | | |
| | | import com.megatim.fdxcommons.model.dataproduction.CommonDataProduction; |
| | | import com.megatim.fdxcommons.model.dataproduction.metadata.constraint.ProductionMetaDataConstraint; |
| | | import java.io.Serializable; |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | import javax.persistence.CollectionTable; |
| | | import javax.persistence.ElementCollection; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.FetchType; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.JoinColumn; |
| | | import javax.persistence.Transient; |
| | | import javax.validation.constraints.NotNull; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @NoArgsConstructor |
| | | @ProductionMetaDataConstraint |
| | | @Entity |
| | | public class ProductionMetaData implements Serializable { |
| | | |
| | | @NotNull(message = "L'identifiant de la production est obligatoire") |
| | | @Id |
| | | private Long productionId; |
| | | |
| | | @NotNull(message = "Le type de production est obligatoire") |
| | | private String dataProductionType; |
| | | |
| | | private Long startIndex; //Index de debut dans le cas d'un ADD |
| | | |
| | | @NotNull(message = "Le nombre d'éléments de la production est obligatoire") |
| | | private Long nbreElts; |
| | | |
| | | @Transient |
| | | private CommonDataProduction dataProduction; |
| | | |
| | | @ElementCollection(targetClass = Long.class, fetch = FetchType.EAGER) |
| | | @CollectionTable( |
| | | name = "productionMetaData_indexes", // Name of the table for the collection |
| | | joinColumns = { |
| | | @JoinColumn(name = "productionId") |
| | | } // Foreign key column in the collection table |
| | | ) |
| | | private final Set<Long> indexes = new HashSet<>();//Liste des indexes dans le cas d'un Update |
| | | |
| | | public ProductionMetaData(Long productionId, Long nbreElts) { |
| | | this.productionId = productionId; |
| | | this.nbreElts = nbreElts; |
| | | } |
| | | |
| | | public ProductionMetaData(Long productionId, Long startIndex, Long nbreElts) { |
| | | this.productionId = productionId; |
| | | this.startIndex = startIndex; |
| | | this.nbreElts = nbreElts; |
| | | } |
| | | |
| | | public ProductionMetaData(CommonDataProduction dataProduction) { |
| | | this.dataProduction = 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.fdxcommons.model.dataproduction.metadata; |
| | | |
| | | import java.io.Serializable; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Data |
| | | public class ProductionMetaDataId implements Serializable{ |
| | | |
| | | private Long fdxIndex; |
| | | |
| | | private Long lineNumber; |
| | | |
| | | private Long productionId; |
| | | } |
| 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.fdxcommons.model.dataproduction.metadata.constraint; |
| | | |
| | | import java.lang.annotation.Documented; |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | import javax.validation.Constraint; |
| | | import javax.validation.Payload; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Documented |
| | | @Constraint(validatedBy = ProductionMetaDataValidator.class) |
| | | @Target( { ElementType.TYPE }) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | public @interface ProductionMetaDataConstraint { |
| | | String message() default "L'index de début est obligatoire pour les productions d'ajout "; |
| | | Class<?>[] groups() default {}; |
| | | Class<? extends Payload>[] payload() default {}; |
| | | } |
| 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.fdxcommons.model.dataproduction.metadata.constraint; |
| | | |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProductionType; |
| | | import com.megatim.fdxcommons.model.dataproduction.metadata.ProductionMetaData; |
| | | import javax.validation.ConstraintValidator; |
| | | import javax.validation.ConstraintValidatorContext; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class ProductionMetaDataValidator implements ConstraintValidator<ProductionMetaDataConstraint, ProductionMetaData> { |
| | | |
| | | @Override |
| | | public void initialize(ProductionMetaDataConstraint cons) { |
| | | } |
| | | |
| | | @Override |
| | | public boolean isValid(ProductionMetaData pmd, ConstraintValidatorContext cxt) { |
| | | return pmd.getDataProductionType().equals(DataProductionType.ADD) ? pmd.getStartIndex() != null : true; |
| | | } |
| | | } |
| 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.fdxcommons.model.dtos.dataproduction; |
| | | |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProductionSource; |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProductionType; |
| | | import com.megatim.fdxcommons.model.enumeration.StatutDataProduction; |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class CommonDataProductionDto { |
| | | |
| | | private Long id; |
| | | |
| | | private String codeTypeFichier; |
| | | |
| | | private String codeParticipant; |
| | | |
| | | private String referentielVersion; |
| | | |
| | | private DataProductionSource source; |
| | | |
| | | private LocalDateTime dateProduction; |
| | | |
| | | private String fileName; |
| | | |
| | | private StatutDataProduction statutDataProduction; |
| | | |
| | | private LocalDateTime fileDate; |
| | | |
| | | private DataProductionType dataProductionType; |
| | | |
| | | private String token; |
| | | |
| | | private LocalDateTime dateMiseAJour; |
| | | |
| | | private Long nbreElements; |
| | | |
| | | private Long tailleFichier; |
| | | |
| | | private String integrationFileName; |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.dtos.dataproduction; |
| | | |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProductionType; |
| | | import com.megatim.fdxcommons.model.enumeration.StatutDataProduction; |
| | | import com.megatim.reporting.adhoc.annotations.PrintColumn; |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class DataProductionDto { |
| | | |
| | | private Long id; |
| | | |
| | | @PrintColumn(libelle = "Type du Fichier") |
| | | private String codeTypeFichier; |
| | | |
| | | @PrintColumn(libelle = "Participant") |
| | | private String codeParticipant; |
| | | |
| | | @PrintColumn(libelle = "Référentiel") |
| | | private String referentielVersion; |
| | | |
| | | @PrintColumn(libelle = "Source de la production") |
| | | private String source; |
| | | |
| | | @PrintColumn(libelle = "Date de la production") |
| | | private LocalDateTime dateProduction; |
| | | |
| | | @PrintColumn(libelle = "Nom du fichier") |
| | | private String fileName; |
| | | |
| | | private StatutDataProduction statutDataProduction; |
| | | |
| | | private LocalDateTime fileDate; |
| | | |
| | | private DataProductionType dataProductionType; |
| | | |
| | | private String token; |
| | | |
| | | private LocalDateTime dateMiseAJour; |
| | | |
| | | private Long nbreElements; |
| | | |
| | | private Long tailleFichier; |
| | | |
| | | private String integrationFileName; |
| | | |
| | | } |
| 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.fdxcommons.model.dtos.dataproduction; |
| | | |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProductionType; |
| | | import java.util.Set; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class ProductionMetaDataDto { |
| | | |
| | | private Long productionId; |
| | | |
| | | private DataProductionType dataProductionType; |
| | | |
| | | private Long startIndex; //Index de debut dans le cas d'un ADD |
| | | |
| | | private Long nbreElts; |
| | | |
| | | private CommonDataProductionDto dataProduction; |
| | | |
| | | private Set<Long> indexes; |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.dtos.integration; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.TypeDonnee; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class ColumnDefinitionDto { |
| | | |
| | | private String name; |
| | | private TypeDonnee typeDonnee; |
| | | private String formatDate; |
| | | |
| | | } |
| 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.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class ApplicationSourceDto { |
| | | |
| | | private String libelle; |
| | | |
| | | private String description; |
| | | |
| | | private LocalDateTime dateCreation; |
| | | |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | |
| | | private ReferentielSlimDto 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.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class ApplicationSourceSlimDto { |
| | | |
| | | private String libelle; |
| | | |
| | | private String description; |
| | | |
| | | private LocalDateTime dateCreation; |
| | | |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | } |
| 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.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.TypeExtension; |
| | | import com.megatim.reporting.adhoc.annotations.PrintColumn; |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class ExtensionFichierDto { |
| | | |
| | | @PrintColumn(libelle = "Libellé", rang = 2) |
| | | private String extension; |
| | | |
| | | @PrintColumn(libelle = "Libellé", rang = 3) |
| | | private TypeExtension typeExtension; |
| | | |
| | | @PrintColumn(libelle = "Libellé", rang = 1) |
| | | private String libelle; |
| | | |
| | | @PrintColumn(libelle = "DATE CREATION", rang = 5) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @PrintColumn(libelle = "DATE DERN. MISE A JOUR", rang = 6) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | @PrintColumn(libelle = "CREE PAR", rang = 7) |
| | | private String createBy; |
| | | |
| | | @PrintColumn(libelle = "MODIFIE PAR", rang = 8) |
| | | private String lastModifiedBy; |
| | | |
| | | private ReferentielSlimDto referentiel; |
| | | |
| | | @PrintColumn(rang = 4, libelle = "Référentiel") |
| | | public String getReferentielVersion() { |
| | | return referentiel.getVersion(); |
| | | } |
| | | |
| | | } |
| 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.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.TypeExtension; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class ExtensionFichierSlimDto { |
| | | |
| | | private String extension; |
| | | |
| | | private TypeExtension typeExtension; |
| | | |
| | | private String libelle; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | } |
| 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.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import com.megatim.reporting.adhoc.annotations.PrintColumn; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class GroupeNoeudDto { |
| | | |
| | | @PrintColumn(libelle = "Code", rang = 1) |
| | | private String code; |
| | | |
| | | @PrintColumn(libelle = "Libellé", rang = 2) |
| | | private String libelle; |
| | | |
| | | @PrintColumn(libelle = "Libellé", rang = 3) |
| | | private String description; |
| | | |
| | | @PrintColumn(libelle = "DATE CREATION", rang = 5) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @PrintColumn(libelle = "DATE DERN. MISE A JOUR", rang = 6) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | @PrintColumn(libelle = "CREE PAR", rang = 7) |
| | | private String createBy; |
| | | |
| | | @PrintColumn(libelle = "MODIFIE PAR", rang = 8) |
| | | private String lastModifiedBy; |
| | | |
| | | private ReferentielSlimDto referentiel; |
| | | |
| | | // private List<NoeudSlimDto> noeuds = new ArrayList<>(); |
| | | // |
| | | // private List<RoutageSlimDto> routageEnvois = new ArrayList<>(); |
| | | // |
| | | // private List<RoutageSlimDto> routageReceptions = new ArrayList<>(); |
| | | |
| | | @PrintColumn(rang = 4, libelle = "Référentiel") |
| | | public String getReferentielVersion() { |
| | | return referentiel.getVersion(); |
| | | } |
| | | } |
| 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.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class GroupeNoeudSlimDto { |
| | | |
| | | private String code; |
| | | |
| | | private String libelle; |
| | | |
| | | private String description; |
| | | |
| | | private LocalDateTime dateCreation; |
| | | |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | } |
| 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.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import com.megatim.reporting.adhoc.annotations.PrintColumn; |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class GroupeParticipantDto { |
| | | |
| | | @PrintColumn(libelle = "Code", rang = 1) |
| | | private String code; |
| | | |
| | | @PrintColumn(libelle = "Libellé", rang = 2) |
| | | private String libelle; |
| | | |
| | | @PrintColumn(libelle = "Libellé", rang = 3) |
| | | private String description; |
| | | |
| | | @PrintColumn(libelle = "DATE CREATION", rang = 5) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @PrintColumn(libelle = "DATE DERN. MISE A JOUR", rang = 6) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | @PrintColumn(libelle = "CREE PAR", rang = 7) |
| | | private String createBy; |
| | | |
| | | @PrintColumn(libelle = "MODIFIE PAR", rang = 8) |
| | | private String lastModifiedBy; |
| | | |
| | | private ReferentielSlimDto referentiel; |
| | | |
| | | // private List<Participant> participants = new ArrayList<>(); |
| | | // |
| | | // private List<Routage> routageEnvois = new ArrayList<>(); |
| | | // |
| | | // private List<Routage> routageReceptions = new ArrayList<>(); |
| | | |
| | | @PrintColumn(rang = 4, libelle = "Référentiel") |
| | | public String getReferentielVersion() { |
| | | return referentiel.getVersion(); |
| | | } |
| | | } |
| 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.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class GroupeParticipantSlimDto { |
| | | |
| | | private String code; |
| | | |
| | | private String libelle; |
| | | |
| | | private String description; |
| | | |
| | | private LocalDateTime dateCreation; |
| | | |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | |
| | | } |
| 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.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import com.megatim.reporting.adhoc.annotations.PrintColumn; |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class NoeudDto { |
| | | |
| | | @PrintColumn(libelle = "Code", rang = 1) |
| | | private String code; |
| | | |
| | | @PrintColumn(libelle = "Libellé", rang = 2) |
| | | private String libelle; |
| | | |
| | | @PrintColumn(libelle = "DATE CREATION", rang = 5) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @PrintColumn(libelle = "DATE DERN. MISE A JOUR", rang = 6) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | @PrintColumn(libelle = "CREE PAR", rang = 7) |
| | | private String createBy; |
| | | |
| | | @PrintColumn(libelle = "MODIFIE PAR", rang = 8) |
| | | private String lastModifiedBy; |
| | | |
| | | private ReferentielSlimDto referentiel; |
| | | |
| | | private ParticipantSlimDto participant; |
| | | |
| | | // private List<RoutageSlimDto> routageEnvois = new ArrayList<>(); |
| | | // |
| | | // private List<RoutageSlimDto> routageReceptions = new ArrayList<>(); |
| | | |
| | | @PrintColumn(rang = 3, libelle = "Référentiel") |
| | | public String getReferentielVersion() { |
| | | return referentiel.getVersion(); |
| | | } |
| | | |
| | | @PrintColumn(rang = 4, libelle = "Participant") |
| | | public String getParticipantDescription() { |
| | | return participant.getCode() + "- " + participant.getLibelle(); |
| | | } |
| | | |
| | | } |
| 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.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import com.megatim.reporting.adhoc.annotations.PrintColumn; |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class NoeudSlimDto { |
| | | |
| | | @PrintColumn(libelle = "Code", rang = 2) |
| | | private String code; |
| | | |
| | | @PrintColumn(libelle = "Libellé", rang = 1) |
| | | private String libelle; |
| | | |
| | | private LocalDateTime dateCreation; |
| | | |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import com.megatim.reporting.adhoc.annotations.PrintColumn; |
| | | import com.megatim.reporting.adhoc.annotations.PrintList; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class ParticipantDto { |
| | | |
| | | @PrintColumn(libelle = "Code", rang = 1) |
| | | private String code; |
| | | |
| | | @PrintColumn(libelle = "Libellé", rang = 2) |
| | | private String libelle; |
| | | |
| | | private String description; |
| | | |
| | | private String rue; |
| | | |
| | | private String adresse; |
| | | |
| | | private String ville; |
| | | |
| | | private String email; |
| | | |
| | | @PrintColumn(libelle = "DATE CREATION", rang = 5) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @PrintColumn(libelle = "DATE DERN. MISE A JOUR", rang = 6) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | @PrintColumn(libelle = "CREE PAR", rang = 7) |
| | | private String createBy; |
| | | |
| | | @PrintColumn(libelle = "MODIFIE PAR", rang = 8) |
| | | private String lastModifiedBy; |
| | | |
| | | private ReferentielSlimDto referentiel; |
| | | |
| | | private PaysSlimDto pays; |
| | | |
| | | @PrintList(titre = "Liste des noeuds", classe = NoeudSlimDto.class, rang = 1) |
| | | private List<NoeudSlimDto> noeuds = new ArrayList<>(); |
| | | |
| | | @PrintColumn(libelle = "Référentiel", rang = 3) |
| | | public String getReferentielVersion() { |
| | | return referentiel.getVersion(); |
| | | } |
| | | |
| | | @PrintColumn(libelle = "Pays", rang = 4) |
| | | public String getPaysDescription() { |
| | | return pays.getLibelle(); |
| | | } |
| | | |
| | | } |
| 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.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import com.megatim.reporting.adhoc.annotations.PrintColumn; |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class ParticipantSlimDto { |
| | | |
| | | @PrintColumn(libelle = "Code") |
| | | private String code; |
| | | |
| | | @PrintColumn(libelle = "Libellé") |
| | | private String libelle; |
| | | |
| | | private String description; |
| | | |
| | | private String rue; |
| | | |
| | | private String adresse; |
| | | |
| | | private String ville; |
| | | |
| | | private String email; |
| | | |
| | | private LocalDateTime dateCreation; |
| | | |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | } |
| 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.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import com.megatim.reporting.adhoc.annotations.PrintColumn; |
| | | import com.megatim.reporting.adhoc.annotations.PrintList; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class PaysDto { |
| | | |
| | | @PrintColumn(libelle = "Code", rang = 2) |
| | | private String code; |
| | | |
| | | @PrintColumn(libelle = "Libellé", rang = 1) |
| | | private String libelle; |
| | | |
| | | @PrintColumn(libelle = "DATE CREATION", rang = 4) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @PrintColumn(libelle = "DATE DERN. MISE A JOUR", rang = 5) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | @PrintColumn(libelle = "CREE PAR", rang = 6) |
| | | private String createBy; |
| | | |
| | | @PrintColumn(libelle = "MODIFIE PAR", rang = 7) |
| | | private String lastModifiedBy; |
| | | |
| | | private ReferentielSlimDto referentiel; |
| | | |
| | | @PrintList(titre = "Liste des participants", classe = ParticipantSlimDto.class) |
| | | private List<ParticipantSlimDto> participants = new ArrayList<>(); |
| | | |
| | | @PrintColumn(rang = 3, libelle = "Référentiel") |
| | | public String getReferentielVersion() { |
| | | return referentiel.getVersion(); |
| | | } |
| | | |
| | | } |
| 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.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class PaysSlimDto { |
| | | |
| | | private String code; |
| | | |
| | | private String libelle; |
| | | |
| | | private LocalDateTime dateCreation; |
| | | |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | } |
| 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.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.StatutReferentiel; |
| | | import com.megatim.reporting.adhoc.annotations.PrintColumn; |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class ReferentielDto { |
| | | |
| | | @PrintColumn(libelle = "Version", rang = 1) |
| | | private String version; |
| | | |
| | | private StatutReferentiel statutReferentiel; |
| | | |
| | | @PrintColumn(libelle = "Description", rang = 2) |
| | | private String description; |
| | | |
| | | @PrintColumn(libelle = "DATE CREATION", rang = 4) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @PrintColumn(libelle = "DATE DERN. MISE A JOUR", rang = 5) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | @PrintColumn(libelle = "CREE PAR", rang = 6) |
| | | private String createBy; |
| | | |
| | | @PrintColumn(libelle = "MODIFIE PAR", rang = 7) |
| | | private String lastModifiedBy; |
| | | |
| | | private LocalDateTime dateGeneration; |
| | | |
| | | // private List<ExtensionFichierSlimDto> extensionFichiers = new ArrayList<>(); |
| | | |
| | | @PrintColumn(libelle = "Statut Référentiel", rang = 3) |
| | | public String getStatutReferentielDescription() { |
| | | return statutReferentiel.getValue(); |
| | | } |
| | | |
| | | } |
| 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.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.StatutReferentiel; |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class ReferentielSlimDto { |
| | | |
| | | private StatutReferentiel statutReferentiel; |
| | | |
| | | private String version; |
| | | |
| | | private String description; |
| | | |
| | | private LocalDateTime dateCreation; |
| | | |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | |
| | | private LocalDateTime dateGeneration; |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import com.megatim.reporting.adhoc.annotations.PrintColumn; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class RoutageDto { |
| | | |
| | | private String code; |
| | | |
| | | @PrintColumn(libelle = "DATE CREATION", rang = 3) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @PrintColumn(libelle = "DATE DERN. MISE A JOUR", rang = 4) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | @PrintColumn(libelle = "CREE PAR", rang = 5) |
| | | private String createBy; |
| | | |
| | | @PrintColumn(libelle = "MODIFIE PAR", rang = 6) |
| | | private String lastModifiedBy; |
| | | |
| | | private TypeFichierSlimDto typeFichier; |
| | | |
| | | private ReferentielSlimDto referentiel; |
| | | |
| | | // private List<NoeudSlimDto> noeudsEnvoi = new ArrayList<>(); |
| | | // |
| | | // private List<GroupeNoeudSlimDto> groupeNoeudsEnvoi = new ArrayList<>(); |
| | | // |
| | | // private List<ParticipantSlimDto> participantsEnvoi = new ArrayList<>(); |
| | | // |
| | | // private List<GroupeParticipantSlimDto> groupeParticipantsEnvoi = new ArrayList<>(); |
| | | // |
| | | // private List<NoeudSlimDto> noeudsReception = new ArrayList<>(); |
| | | // |
| | | // private List<GroupeNoeudSlimDto> groupeNoeudsReception = new ArrayList<>(); |
| | | // |
| | | // private List<ParticipantSlimDto> participantsReception = new ArrayList<>(); |
| | | // |
| | | // private List<GroupeParticipantSlimDto> groupeParticipantsReception = new ArrayList<>(); |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getCode() { |
| | | return this.code; |
| | | } |
| | | |
| | | public LocalDateTime getDateCreation() { |
| | | return dateCreation; |
| | | } |
| | | |
| | | public void setDateCreation(LocalDateTime dateCreation) { |
| | | this.dateCreation = dateCreation; |
| | | } |
| | | |
| | | public LocalDateTime getDateMiseAjour() { |
| | | return dateMiseAjour; |
| | | } |
| | | |
| | | public void setDateMiseAjour(LocalDateTime dateMiseAjour) { |
| | | this.dateMiseAjour = dateMiseAjour; |
| | | } |
| | | |
| | | public String getCreateBy() { |
| | | return createBy; |
| | | } |
| | | |
| | | public void setCreateBy(String createBy) { |
| | | this.createBy = createBy; |
| | | } |
| | | |
| | | public String getLastModifiedBy() { |
| | | return lastModifiedBy; |
| | | } |
| | | |
| | | public void setLastModifiedBy(String lastModifiedBy) { |
| | | this.lastModifiedBy = lastModifiedBy; |
| | | } |
| | | |
| | | public TypeFichierSlimDto getTypeFichier() { |
| | | return typeFichier; |
| | | } |
| | | |
| | | public void setTypeFichier(TypeFichierSlimDto typeFichier) { |
| | | this.typeFichier = typeFichier; |
| | | } |
| | | |
| | | public ReferentielSlimDto getReferentiel() { |
| | | return referentiel; |
| | | } |
| | | |
| | | public void setReferentiel(ReferentielSlimDto referentiel) { |
| | | this.referentiel = referentiel; |
| | | } |
| | | |
| | | @PrintColumn(libelle = "TypeFichier", rang = 1) |
| | | public String getTypeFichierDescription() { |
| | | return typeFichier.getLibelle(); |
| | | } |
| | | |
| | | @PrintColumn(libelle = "Référentiel", rang = 2) |
| | | public String getReferentielVersion() { |
| | | return referentiel.getVersion(); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import com.megatim.reporting.adhoc.annotations.PrintColumn; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class RoutageSlimDto { |
| | | |
| | | @PrintColumn(libelle = "Code", rang = 1) |
| | | private String code; |
| | | |
| | | private LocalDateTime dateCreation; |
| | | |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getCode() { |
| | | return this.code; |
| | | } |
| | | |
| | | public LocalDateTime getDateCreation() { |
| | | return dateCreation; |
| | | } |
| | | |
| | | public void setDateCreation(LocalDateTime dateCreation) { |
| | | this.dateCreation = dateCreation; |
| | | } |
| | | |
| | | public LocalDateTime getDateMiseAjour() { |
| | | return dateMiseAjour; |
| | | } |
| | | |
| | | public void setDateMiseAjour(LocalDateTime dateMiseAjour) { |
| | | this.dateMiseAjour = dateMiseAjour; |
| | | } |
| | | |
| | | public String getCreateBy() { |
| | | return createBy; |
| | | } |
| | | |
| | | public void setCreateBy(String createBy) { |
| | | this.createBy = createBy; |
| | | } |
| | | |
| | | public String getLastModifiedBy() { |
| | | return lastModifiedBy; |
| | | } |
| | | |
| | | public void setLastModifiedBy(String lastModifiedBy) { |
| | | this.lastModifiedBy = lastModifiedBy; |
| | | } |
| | | } |
| 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.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.CategorieFichier; |
| | | import com.megatim.reporting.adhoc.annotations.PrintColumn; |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class TypeFichierDto { |
| | | |
| | | @PrintColumn(libelle = "Code", rang = 1) |
| | | private String code; |
| | | |
| | | @PrintColumn(libelle = "Libellé", rang = 2) |
| | | private String libelle; |
| | | |
| | | private String description; |
| | | |
| | | @PrintColumn(libelle = "DATE CREATION", rang = 6) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @PrintColumn(libelle = "DATE DERN. MISE A JOUR", rang = 7) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | @PrintColumn(libelle = "CREE PAR", rang = 8) |
| | | private String createBy; |
| | | |
| | | @PrintColumn(libelle = "MODIFIE PAR", rang = 9) |
| | | private String lastModifiedBy; |
| | | |
| | | private CategorieFichier categorieFichier; |
| | | |
| | | private ParticipantSlimDto participant; |
| | | |
| | | private ReferentielSlimDto referentiel; |
| | | |
| | | private ExtensionFichierSlimDto extensionFichier; |
| | | |
| | | // private List<RoutageSlimDto> routages = new ArrayList<>(); |
| | | |
| | | @PrintColumn(libelle = "Catégorie Fichier", rang = 3) |
| | | public String getCategorieFichierDescription() { |
| | | return categorieFichier.getValue(); |
| | | } |
| | | |
| | | @PrintColumn(libelle = "Référentiel", rang = 4) |
| | | public String getReferentielVersion() { |
| | | return referentiel.getVersion(); |
| | | } |
| | | |
| | | @PrintColumn(rang = 5, libelle = "Participant") |
| | | public String getParticipantDescription() { |
| | | return participant.getCode() + "- " + participant.getLibelle(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.CategorieFichier; |
| | | import com.megatim.reporting.adhoc.annotations.PrintColumn; |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class TypeFichierFormDto { |
| | | |
| | | @PrintColumn(libelle = "Code", rang = 1) |
| | | private String code; |
| | | |
| | | @PrintColumn(libelle = "Libellé", rang = 2) |
| | | private String libelle; |
| | | |
| | | private String description; |
| | | |
| | | @PrintColumn(libelle = "DATE CREATION", rang = 6) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @PrintColumn(libelle = "DATE DERN. MISE A JOUR", rang = 7) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | @PrintColumn(libelle = "CREE PAR", rang = 8) |
| | | private String createBy; |
| | | |
| | | @PrintColumn(libelle = "MODIFIE PAR", rang = 9) |
| | | private String lastModifiedBy; |
| | | |
| | | private CategorieFichier categorieFichier; |
| | | |
| | | private ParticipantSlimDto participant; |
| | | |
| | | private ReferentielSlimDto referentiel; |
| | | |
| | | private ExtensionFichierSlimDto extensionFichier; |
| | | |
| | | } |
| 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.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.CategorieFichier; |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class TypeFichierSlimDto { |
| | | |
| | | private String code; |
| | | |
| | | private String libelle; |
| | | |
| | | private String description; |
| | | |
| | | private LocalDateTime dateCreation; |
| | | |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | |
| | | private CategorieFichier categorieFichier; |
| | | |
| | | } |
| 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.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import com.megatim.reporting.adhoc.annotations.PrintColumn; |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class ValidateurFichierConfigurationDto { |
| | | |
| | | @PrintColumn(libelle = "Nom du fichier", rang = 1) |
| | | private String fileName; |
| | | |
| | | @PrintColumn(libelle = "DATE CREATION", rang = 4) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @PrintColumn(libelle = "DATE DERN. MISE A JOUR", rang = 5) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | @PrintColumn(libelle = "CREE PAR", rang = 6) |
| | | private String createBy; |
| | | |
| | | @PrintColumn(libelle = "MODIFIE PAR", rang = 7) |
| | | private String lastModifiedBy; |
| | | |
| | | private TypeFichierSlimDto typeFichier; |
| | | |
| | | private ReferentielSlimDto referentiel; |
| | | |
| | | @PrintColumn(libelle = "TypeFichier", rang = 2) |
| | | public String getTypeFichierDescription() { |
| | | return typeFichier.getLibelle(); |
| | | } |
| | | |
| | | @PrintColumn(libelle = "Référentiel", rang = 3) |
| | | public String getReferentielVersion() { |
| | | return referentiel.getVersion(); |
| | | } |
| | | |
| | | } |
| 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.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter @Setter |
| | | public class ValidateurFichierConfigurationSlimDto { |
| | | private String fileName; |
| | | |
| | | private LocalDateTime dateCreation; |
| | | |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | } |
| 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.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class ValidateurFichierDto { |
| | | |
| | | private String id; |
| | | |
| | | private int nombrePosition; |
| | | |
| | | private LocalDateTime dateCreation; |
| | | |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | |
| | | private TypeFichierSlimDto typeFichier; |
| | | |
| | | } |
| 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.fdxcommons.model.dtos.referentiel; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class ValidateurFichierSlimDto { |
| | | |
| | | private String id; |
| | | |
| | | private int nombrePosition; |
| | | |
| | | private LocalDateTime dateCreation; |
| | | |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | } |
| 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.fdxcommons.model.dtos.remoteproduction; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.TypeOperation; |
| | | import com.megatim.fdxcommons.model.remotedataproduction.enums.ScheduleAction; |
| | | import com.megatim.fdxcommons.model.remotedataproduction.enums.TypePas; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @NoArgsConstructor |
| | | public class PlanificationDto { |
| | | |
| | | private Long id; |
| | | |
| | | private String description; |
| | | |
| | | private Boolean executeOnce; |
| | | |
| | | private Boolean active; |
| | | |
| | | private LocalDateTime nextExecution; |
| | | |
| | | private ScheduleAction scheduleAction; |
| | | |
| | | private int heureDebutTache; |
| | | private int minuteDebutTache; |
| | | private int secondeDebutTache; |
| | | |
| | | private int heureFinTache; |
| | | private int minuteFinTache; |
| | | private int secondeFinTache; |
| | | |
| | | private int intervalleTache; |
| | | |
| | | private TypePas typePas; |
| | | |
| | | private boolean monday; |
| | | private boolean tuesday; |
| | | private boolean wednesday; |
| | | private boolean thursday; |
| | | private boolean friday; |
| | | private boolean saturday; |
| | | private boolean sunday; |
| | | |
| | | private TypeOperation typeOperation; |
| | | |
| | | private Date dateCreation; |
| | | |
| | | private String utilisateurCreation; |
| | | |
| | | private Date dateDerniereModification; |
| | | |
| | | private String utilisateurModification; |
| | | |
| | | private Date dateSuppression; |
| | | |
| | | private String utilisateurSuppression; |
| | | } |
| 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.fdxcommons.model.dtos.remoteproduction; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.RemoteTypeAction; |
| | | import com.megatim.fdxcommons.model.enumeration.TypeOperation; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @NoArgsConstructor |
| | | public class RemoteConfigurationDto { |
| | | |
| | | private String codeTypeFichier; |
| | | |
| | | private String codeParticipant; |
| | | |
| | | private String url; |
| | | |
| | | private TypeOperation typeOperation; |
| | | |
| | | private RemoteTypeAction remoteTypeAction; |
| | | |
| | | private Date dateCreation; |
| | | |
| | | private String utilisateurCreation; |
| | | |
| | | private Date dateDerniereModification; |
| | | |
| | | private String utilisateurModification; |
| | | |
| | | private Date dateSuppression; |
| | | |
| | | private String utilisateurSuppression; |
| | | |
| | | private List<PlanificationDto> planifications; |
| | | } |
| 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.fdxcommons.model.enumeration; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public enum CategorieFichier { |
| | | STRUCTURE("STRUCTURE"), |
| | | SEMI_STRUCTURE("SEMI STRUCTURE"), |
| | | NON_STRUCTURE("NON STRUCTURE"); |
| | | |
| | | private final String value; |
| | | |
| | | private CategorieFichier(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public static CategorieFichier fromValeur(String value) { |
| | | switch (value) { |
| | | case "STRUCTURE": |
| | | return CategorieFichier.STRUCTURE; |
| | | case "SEMI STRUCTURE": |
| | | return CategorieFichier.SEMI_STRUCTURE; |
| | | case "NON STRUCTURE": |
| | | return CategorieFichier.NON_STRUCTURE; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return value; |
| | | } |
| | | } |
| 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.fdxcommons.model.enumeration; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public enum ColumnStatus { |
| | | ADD("ADD"), MODIFY("MODIFY"); |
| | | |
| | | private final String status; |
| | | |
| | | private ColumnStatus(String status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return status; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.enumeration; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public enum CriteriaLogicConnector { |
| | | OR, |
| | | AND; |
| | | } |
| 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.fdxcommons.model.enumeration; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public enum EtatIntegration { |
| | | NOUVEAU, ENVOYE; |
| | | } |
| 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.fdxcommons.model.enumeration; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonValue; |
| | | |
| | | public enum EtatOperation { |
| | | |
| | | ATTENTE_VALIDATION("ATTENTE VALIDATION"), |
| | | ACTIF("ACTIF"), |
| | | REJETE("REJETE"), |
| | | INNACTIF("INNACTIF"); |
| | | |
| | | private final String etat; |
| | | |
| | | private EtatOperation(String etat) { |
| | | this.etat = etat; |
| | | } |
| | | |
| | | @JsonValue |
| | | public String getEtat() { |
| | | return etat; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.enumeration; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonValue; |
| | | import com.megatim.fdxcommons.model.search.EnumValue; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public enum FonctionAggregation { |
| | | |
| | | MAX("MAXIMUM"), |
| | | MIN("MINIMUM"), |
| | | SUM("SOMME"), |
| | | COUNT("COMPTE"), |
| | | AVG("MOYENNE"); |
| | | |
| | | private final String value; |
| | | |
| | | private FonctionAggregation(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | @JsonValue |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | @EnumValue |
| | | public static FonctionAggregation fromValeur(String value) { |
| | | |
| | | if (value.equalsIgnoreCase("MAXIMUM")) { |
| | | return FonctionAggregation.MAX; |
| | | } else if (value.equalsIgnoreCase("MINIMUM")) { |
| | | return FonctionAggregation.MIN; |
| | | } else if (value.equalsIgnoreCase("SOMME")) { |
| | | return FonctionAggregation.SUM; |
| | | } else if (value.equalsIgnoreCase("COMPTE")) { |
| | | return FonctionAggregation.COUNT; |
| | | } else if (value.equalsIgnoreCase("MOYENNE")) { |
| | | return FonctionAggregation.AVG; |
| | | } else { |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * To change this template, choose Tools | Templates |
| | | * and open the template in the editor. |
| | | */ |
| | | package com.megatim.fdxcommons.model.enumeration; |
| | | |
| | | public enum Gravite { |
| | | |
| | | INFO("info"), |
| | | WARNING("warning"), |
| | | ERROR("error"); |
| | | |
| | | private String name = ""; |
| | | |
| | | //Constructeur |
| | | Gravite(String name){ |
| | | this.name = name; |
| | | } |
| | | |
| | | @Override |
| | | public String toString(){ |
| | | return name; |
| | | } |
| | | |
| | | } |
| 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.fdxcommons.model.enumeration; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonValue; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public enum NumberOperator { |
| | | UNKNOW(""), |
| | | EQUALS("="), |
| | | NOT_EQUALS("!="), |
| | | GREATER_THAN(">"), |
| | | GREATER_OR_EQUALS_THAN(">="), |
| | | LESS_THAN("<"), |
| | | LESS_OR_EQUALS_THAN("<="); |
| | | |
| | | private String name = ""; |
| | | |
| | | NumberOperator(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | @JsonValue |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return name; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.enumeration; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonValue; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public enum Operateur { |
| | | |
| | | LIKE("LIKE"), |
| | | EQUALS("="), NOT_EQUALS("<>"), |
| | | GREATER_THAN(">"), GREATER_OR_EQUALS_THAN(">="), |
| | | LOWER_THAN("<"), LOWER_OR_EQUALS_THAN("<="), |
| | | IN("IN"), NOT_IN("NOT IN"), |
| | | IS_NULL("IS NULL"), IS_NOT_NULL("IS NOT NULL"), |
| | | BETWEEN("BETWEEN"), NOT_BETWEEN("NOT BETWEEN"); |
| | | |
| | | private final String value; |
| | | |
| | | private Operateur(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public static Operateur fromValeur(String value) { |
| | | String cleanValue = value.trim().toUpperCase(); |
| | | cleanValue = cleanValue.replaceAll("\\s+", " ");//remplacer plusieurs chaines vides par une seule chaine vide |
| | | |
| | | switch (cleanValue) { |
| | | |
| | | case "LIKE": |
| | | return Operateur.LIKE; |
| | | |
| | | case "=": |
| | | return Operateur.EQUALS; |
| | | |
| | | case "<>": |
| | | return Operateur.NOT_EQUALS; |
| | | |
| | | case ">": |
| | | return Operateur.GREATER_THAN; |
| | | |
| | | case ">=": |
| | | return Operateur.GREATER_OR_EQUALS_THAN; |
| | | |
| | | case "<": |
| | | return Operateur.LOWER_THAN; |
| | | |
| | | case "<=": |
| | | return Operateur.LOWER_OR_EQUALS_THAN; |
| | | |
| | | case "IN": |
| | | return Operateur.IN; |
| | | |
| | | case "NOT IN": |
| | | return Operateur.NOT_IN; |
| | | |
| | | case "IS NULL": |
| | | return Operateur.IS_NULL; |
| | | |
| | | case "IS NOT NULL": |
| | | return Operateur.IS_NOT_NULL; |
| | | |
| | | case "BETWEEN": |
| | | return Operateur.BETWEEN; |
| | | |
| | | case "NOT BETWEEN": |
| | | return Operateur.NOT_BETWEEN; |
| | | |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @JsonValue |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | } |
| 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.fdxcommons.model.enumeration; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public enum OrderByType { |
| | | ASC, DESC; |
| | | } |
| 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.fdxcommons.model.enumeration; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonValue; |
| | | import com.megatim.fdxcommons.model.search.EnumValue; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public enum RemoteTypeAction { |
| | | AJOUTER("AJOUTER"), |
| | | CONSULTER("CONSULTER"), |
| | | SUPPRIMER("SUPPRIMER"); |
| | | |
| | | private final String name; |
| | | |
| | | private RemoteTypeAction(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return name; |
| | | } |
| | | |
| | | @JsonValue |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | @EnumValue |
| | | public static TypeOperation fromValeur(String value) { |
| | | if (value == null) { |
| | | return null; |
| | | } |
| | | if (value.equalsIgnoreCase("ajouter")) { |
| | | return TypeOperation.AJOUTER; |
| | | } else if (value.equalsIgnoreCase("consulter")) { |
| | | return TypeOperation.CONSULTER; |
| | | } else { |
| | | return null; |
| | | |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.enumeration; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public enum SearchAnnotationOperateur { |
| | | EQUALS, |
| | | NOT_EQUALS, |
| | | LIKE, |
| | | LEFT_LIKE, |
| | | RIGHT_LIKE, |
| | | GREATER_THAN, |
| | | GREATER_OR_EQUALS_THAN, |
| | | LESS_THAN, |
| | | LESS_OR_EQUALS_THAN, |
| | | IN, |
| | | NUMBER_OPERATOR; |
| | | } |
| 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.fdxcommons.model.enumeration; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonValue; |
| | | |
| | | public enum Sexe { |
| | | |
| | | FEMME("FEMME"), |
| | | HOMME("HOMME"); |
| | | |
| | | private String name; |
| | | |
| | | private Sexe(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | @JsonValue |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public static Sexe fromValeur(String value) { |
| | | switch (value) { |
| | | case "FEMME": |
| | | return Sexe.FEMME; |
| | | case "HOMME": |
| | | return Sexe.HOMME; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |
| 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.fdxcommons.model.enumeration; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public enum StatutDataProduction { |
| | | A_CONSOMMER, CONSOMME, ENCOURS_DE_PRODUCTION, ENCOURS_DE_CONSOMMATION; |
| | | } |
| 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.fdxcommons.model.enumeration; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonValue; |
| | | import com.megatim.fdxcommons.model.search.EnumValue; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public enum StatutReferentiel { |
| | | ARCHIVE("ARCHIVE"), |
| | | EN_PREPARATION("EN PREPARATION"), |
| | | EN_COURS("EN COURS"); |
| | | |
| | | private final String value; |
| | | |
| | | private StatutReferentiel(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | @JsonValue |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | @EnumValue |
| | | public static StatutReferentiel fromValeur(String value) { |
| | | switch (value) { |
| | | case "ARCHIVE": |
| | | return StatutReferentiel.ARCHIVE; |
| | | case "EN PREPARATION": |
| | | return StatutReferentiel.EN_PREPARATION; |
| | | case "EN COURS": |
| | | return StatutReferentiel.EN_COURS; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return value; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.enumeration; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonValue; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public enum TypeActionSysteme { |
| | | |
| | | DECONNEXION("DECONNEXION"), |
| | | INFORMATION("INFORMATION"), |
| | | AUCUNE("AUCUNE"); |
| | | |
| | | private String name = ""; |
| | | |
| | | //Constructeur |
| | | TypeActionSysteme(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | @JsonValue |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public static TypeActionSysteme fromValeur(String value) { |
| | | switch (value) { |
| | | case "DECONNEXION": |
| | | return TypeActionSysteme.DECONNEXION; |
| | | case "INFORMATION": |
| | | return TypeActionSysteme.INFORMATION; |
| | | case "AUCUNE": |
| | | return TypeActionSysteme.AUCUNE; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return name; |
| | | } |
| | | } |
| 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.fdxcommons.model.enumeration; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonValue; |
| | | |
| | | /** |
| | | * |
| | | * @author STEPHANIE |
| | | */ |
| | | public enum TypeDonnee { |
| | | ALPHANUMERIQUE("ALPHANUMERIQUE"), |
| | | NUMERIQUE("NUMERIQUE"), |
| | | DECIMAL("DECIMAL"), |
| | | DATE("DATE"), |
| | | ENUM("ENUMERATION"), |
| | | OBJET("OBJET"); |
| | | |
| | | private final String value; |
| | | |
| | | private TypeDonnee(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | @JsonValue |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public static TypeDonnee fromValeur(String value) { |
| | | if (value != null) { |
| | | if (value.equalsIgnoreCase(TypeDonnee.ALPHANUMERIQUE.getValue())) { |
| | | return TypeDonnee.ALPHANUMERIQUE; |
| | | |
| | | } else if (value.equalsIgnoreCase(TypeDonnee.NUMERIQUE.getValue())) { |
| | | return TypeDonnee.NUMERIQUE; |
| | | |
| | | } else if (value.equalsIgnoreCase(TypeDonnee.DATE.getValue())) { |
| | | return TypeDonnee.DATE; |
| | | |
| | | } else if (value.equalsIgnoreCase(TypeDonnee.DECIMAL.getValue())) { |
| | | return TypeDonnee.DECIMAL; |
| | | |
| | | } else if (value.equalsIgnoreCase(TypeDonnee.ENUM.getValue())) { |
| | | return TypeDonnee.ENUM; |
| | | |
| | | } else { |
| | | return null; |
| | | } |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return value; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.enumeration; |
| | | |
| | | import com.megatim.fdxcommons.model.search.EnumValue; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public enum TypeExtension { |
| | | |
| | | TEXTE("TEXTE"), |
| | | CSV("CSV"), |
| | | AUTRES("AUTRES"); |
| | | |
| | | private final String value; |
| | | |
| | | private TypeExtension(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | @EnumValue |
| | | public static TypeExtension fromValeur(String value) { |
| | | switch (value) { |
| | | case "TEXTE": |
| | | return TypeExtension.TEXTE; |
| | | case "CSV": |
| | | return TypeExtension.CSV; |
| | | case "AUTRES": |
| | | return TypeExtension.AUTRES; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return value; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.enumeration; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonValue; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public enum TypeIdMessageSysteme { |
| | | |
| | | ALERTE_MOT_DE_PASSE_EXPIRE("ALERTE MOT DE PASSE EXPIRE"), |
| | | MOT_DE_PASSE_EXPIRE("MOT DE PASSE EXPIRE"), |
| | | MODIFICATION_GROUPE_UTILISATEUR("MODIFICATION GROUPE UTILISATEUR"), |
| | | MODIFICATION_INFORMATION_UTILISATEUR("MODIFICATION INFORMATION UTILISATEUR"), |
| | | SUPPRESSION_COMPTE_UTILISATEUR("SUPPRESSION COMPTE UTILISATEUR"), |
| | | SUPPRESSION_GROUPE_UTILISATEUR("SUPPRESSION GROUPE UTILISATEUR"); |
| | | |
| | | private String name = ""; |
| | | |
| | | //Constructeur |
| | | TypeIdMessageSysteme(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | @JsonValue |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public static TypeIdMessageSysteme fromValeur(String value) { |
| | | switch (value) { |
| | | case "ALERTE MOT DE PASSE EXPIRE": |
| | | return TypeIdMessageSysteme.ALERTE_MOT_DE_PASSE_EXPIRE; |
| | | case "MOT DE PASSE EXPIRE": |
| | | return TypeIdMessageSysteme.MOT_DE_PASSE_EXPIRE; |
| | | case "MODIFICATION GROUPE UTILISATEUR": |
| | | return TypeIdMessageSysteme.MODIFICATION_GROUPE_UTILISATEUR; |
| | | case "MODIFICATION INFORMATION UTILISATEUR": |
| | | return TypeIdMessageSysteme.MODIFICATION_INFORMATION_UTILISATEUR; |
| | | case "SUPPRESSION COMPTE UTILISATEUR": |
| | | return TypeIdMessageSysteme.SUPPRESSION_COMPTE_UTILISATEUR; |
| | | case "SUPPRESSION GROUPE UTILISATEUR": |
| | | return TypeIdMessageSysteme.SUPPRESSION_GROUPE_UTILISATEUR; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return name; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.enumeration; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonValue; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public enum TypeMessageSysteme { |
| | | |
| | | INFO("INFO"), |
| | | AVERTISSEMENT("AVERTISSEMENT"), |
| | | ERREUR("ERREUR"); |
| | | |
| | | private String name = ""; |
| | | |
| | | //Constructeur |
| | | TypeMessageSysteme(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | @JsonValue |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public static TypeMessageSysteme fromValeur(String value) { |
| | | switch (value) { |
| | | case "INFO": |
| | | return TypeMessageSysteme.INFO; |
| | | case "AVERTISSEMENT": |
| | | return TypeMessageSysteme.AVERTISSEMENT; |
| | | case "ERREUR": |
| | | return TypeMessageSysteme.ERREUR; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return name; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * To change this template, choose Tools | Templates |
| | | * and open the template in the editor. |
| | | */ |
| | | package com.megatim.fdxcommons.model.enumeration; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonValue; |
| | | import com.megatim.fdxcommons.model.search.EnumValue; |
| | | |
| | | public enum TypeOperation { |
| | | |
| | | AJOUTER("ajouter"), |
| | | SUPPRIMER("supprimer"), |
| | | MODIFIER("modifier"), |
| | | CONSULTER("consulter"); |
| | | |
| | | private final String name; |
| | | |
| | | private TypeOperation(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return name; |
| | | } |
| | | |
| | | @JsonValue |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | @EnumValue |
| | | public static TypeOperation fromValeur(String value) { |
| | | if (value == null) { |
| | | return null; |
| | | } |
| | | if (value.equalsIgnoreCase("ajouter")) { |
| | | return TypeOperation.AJOUTER; |
| | | } else if (value.equalsIgnoreCase("supprimer")) { |
| | | return TypeOperation.SUPPRIMER; |
| | | } else if (value.equalsIgnoreCase("modifier")) { |
| | | return TypeOperation.MODIFIER; |
| | | } else if (value.equalsIgnoreCase("consulter")) { |
| | | return TypeOperation.CONSULTER; |
| | | } else { |
| | | return null; |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| 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.fdxcommons.model.enumeration; |
| | | |
| | | /** |
| | | * |
| | | * @author bissey |
| | | */ |
| | | public enum TypeStatut { |
| | | ACTIF("ACTIF"), |
| | | INNACTIF("INNACTIF"); |
| | | |
| | | private String etat; |
| | | |
| | | private TypeStatut(String etat) { |
| | | this.etat = etat; |
| | | } |
| | | |
| | | public String getEtat() { |
| | | return etat; |
| | | } |
| | | |
| | | public static TypeStatut fromValeur(String value) { |
| | | switch (value) { |
| | | case "ACTIF": |
| | | return TypeStatut.ACTIF; |
| | | case "INNACTIF": |
| | | return TypeStatut.INNACTIF; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.integration; |
| | | |
| | | import java.io.Serializable; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.IdClass; |
| | | import javax.persistence.Transient; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Entity |
| | | @NoArgsConstructor |
| | | @Getter |
| | | @Setter |
| | | @IdClass(ColumnDefinitionId.class) |
| | | public class ColumnDefinition implements Serializable { |
| | | |
| | | @Id |
| | | private String codeTypeFichier; |
| | | |
| | | @Id |
| | | private String referentielVersion; |
| | | |
| | | @Id |
| | | private String name; |
| | | |
| | | private String typeDonnee; |
| | | |
| | | private int taille; |
| | | |
| | | private int taillePartieDecimale; |
| | | |
| | | private String formatDate; |
| | | |
| | | private int position; |
| | | |
| | | @Transient |
| | | private boolean required; |
| | | |
| | | @Transient |
| | | private boolean collection; |
| | | |
| | | public ColumnDefinition(String codeTypeFichier, String referentielVersion, String name, String typeDonnee, int taille, int taillePartieDecimale, String formatDate, int position) { |
| | | this.codeTypeFichier = codeTypeFichier; |
| | | this.referentielVersion = referentielVersion; |
| | | this.name = name; |
| | | this.typeDonnee = typeDonnee; |
| | | this.taille = taille; |
| | | this.taillePartieDecimale = taillePartieDecimale; |
| | | this.formatDate = formatDate; |
| | | this.position = position; |
| | | } |
| | | |
| | | public ColumnDefinition(String name, String typeDonnee, int taille, boolean required, boolean collection) { |
| | | this.name = name; |
| | | this.typeDonnee = typeDonnee; |
| | | this.taille = taille; |
| | | this.required = required; |
| | | this.collection = collection; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "ColumnDefinition{" + "codeTypeFichier=" + codeTypeFichier + ", referentielVersion=" + referentielVersion + ", name=" + name + ", typeDonnee=" + typeDonnee + '}'; |
| | | } |
| | | } |
| 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.fdxcommons.model.integration; |
| | | |
| | | import java.io.Serializable; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Data |
| | | public class ColumnDefinitionId implements Serializable { |
| | | |
| | | private String codeTypeFichier; |
| | | |
| | | private String referentielVersion; |
| | | |
| | | private String name; |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.integration; |
| | | |
| | | import com.megatim.fdxcommons.model.integration.enums.FileExtension; |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.EnumType; |
| | | import javax.persistence.Enumerated; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.IdClass; |
| | | import javax.persistence.Transient; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | @Setter |
| | | @Getter |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Entity |
| | | @IdClass(TableDefinitionId.class) |
| | | public class TableDefinition implements Serializable { |
| | | |
| | | @Id |
| | | private String referentielVersion; |
| | | @Id |
| | | private String codeTypeFichier; |
| | | private Boolean headerPresent; |
| | | private String columnDelimiter; |
| | | private String lineDelimiter; |
| | | |
| | | @Enumerated(EnumType.STRING) |
| | | private FileExtension extension; |
| | | |
| | | @Transient |
| | | private List<ColumnDefinition> columnDefinitions = 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.fdxcommons.model.integration; |
| | | |
| | | import java.io.Serializable; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Data |
| | | public class TableDefinitionId implements Serializable { |
| | | |
| | | private String codeTypeFichier; |
| | | |
| | | private String 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.fdxcommons.model.integration.enums; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public enum FileExtension { |
| | | CSV, TXT, XLS, XLSX; |
| | | |
| | | public static FileExtension fromValeur(String value) { |
| | | switch (value.toUpperCase()) { |
| | | case "CSV": |
| | | return FileExtension.CSV; |
| | | case "TXT": |
| | | return FileExtension.TXT; |
| | | case "XLS": |
| | | return FileExtension.XLS; |
| | | case "XLSX": |
| | | return FileExtension.XLSX; |
| | | 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.fdxcommons.model.integration.json; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.TypeDonnee; |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.persistence.*; |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlAttribute; |
| | | import javax.xml.bind.annotation.XmlElement; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import javax.xml.bind.annotation.XmlTransient; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @Entity |
| | | @XmlRootElement |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | public class JsonStructure implements Serializable { |
| | | |
| | | @Id |
| | | @SequenceGenerator(name = "SEQ_TYPE_FICHIER_JSON", sequenceName = "SEQ_TYPE_FICHIER_JSON", allocationSize = 1, initialValue = 1) |
| | | @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_TYPE_FICHIER_JSON") |
| | | @XmlTransient |
| | | private Long id; |
| | | |
| | | @NotNull(message = "Le type de données est obligatoire") |
| | | @Enumerated(EnumType.STRING) |
| | | @XmlAttribute |
| | | private TypeDonnee typeDonnee; |
| | | |
| | | @NotNull(message = "Le nom est obligatoire") |
| | | @XmlAttribute |
| | | private String name; |
| | | |
| | | @Min(value = 1, message = "La taille doit être supérieure à 0") |
| | | @XmlAttribute |
| | | private int lengthh; |
| | | |
| | | @XmlAttribute |
| | | private boolean required; |
| | | |
| | | @XmlAttribute |
| | | private boolean collection; |
| | | |
| | | @XmlAttribute |
| | | private String formatDate; |
| | | |
| | | @XmlAttribute |
| | | private String codeDelimiteurDate; |
| | | |
| | | @OneToOne |
| | | @XmlTransient |
| | | private TypeFichierJson typeFichierJson; |
| | | |
| | | @ManyToOne |
| | | @XmlTransient |
| | | private JsonStructure parent; |
| | | |
| | | @OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, orphanRemoval = true) |
| | | @XmlElement(name = "jsonStructure") |
| | | private List<JsonStructure> fields = 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.fdxcommons.model.integration.json; |
| | | |
| | | import com.megatim.fdxcommons.model.referentiel.Referentiel; |
| | | import com.megatim.fdxcommons.model.referentiel.TypeFichier; |
| | | import java.io.Serializable; |
| | | import javax.persistence.*; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import javax.xml.bind.annotation.XmlTransient; |
| | | |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @Entity |
| | | @NoArgsConstructor |
| | | @XmlRootElement(name = "typeFichierJson") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | public class TypeFichierJson implements Serializable { |
| | | |
| | | @Id |
| | | @SequenceGenerator(name = "SEQ_TYPE_FICHIER", |
| | | sequenceName = "SEQ_TYPE_FICHIER", |
| | | allocationSize = 1, |
| | | initialValue = 1) |
| | | @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_TYPE_FICHIER") |
| | | @XmlTransient |
| | | private Long id; |
| | | |
| | | @OneToOne(cascade = CascadeType.MERGE) |
| | | @JoinColumn(name = "referentiel_version") |
| | | private Referentiel referentiel; |
| | | |
| | | @OneToOne(cascade = CascadeType.MERGE) |
| | | @JoinColumn(name = "type_fichier_code") |
| | | private TypeFichier typeFichier; |
| | | |
| | | @OneToOne(cascade = CascadeType.ALL) |
| | | @JoinColumn(name = "json_structure_id") |
| | | private JsonStructure jsonStructure; |
| | | |
| | | public TypeFichierJson(TypeFichier typeFichier, JsonStructure jsonStructure) { |
| | | this.typeFichier = typeFichier; |
| | | this.jsonStructure = jsonStructure; |
| | | } |
| | | } |
| 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.fdxcommons.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.fdxcommons.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.fdxcommons.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.fdxcommons.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.fdxcommons.model.jaxb; |
| | | |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProductionFichier; |
| | | 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 = "NatureProductionFichiersToExport") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | @Setter |
| | | @Getter |
| | | public class NatureProductionFichiersToExport { |
| | | |
| | | private List<NatureProductionFichier> natureProductionFichierList = 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.fdxcommons.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.fdxcommons.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.fdxcommons.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.fdxcommons.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.fdxcommons.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.fdxcommons.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.fdxcommons.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.fdxcommons.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.fdxcommons.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.fdxcommons.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.fdxcommons.model.jaxbentity.adapter; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | 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 |
| | |
| | | package com.megatim.fdxcommons.model.jms.messages; |
| | | |
| | | import java.io.Serializable; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class ActivationApiUserMessage implements Serializable { |
| | | private String codeParticipant; |
| | | private boolean activate; |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.jms.messages; |
| | | |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | @Data |
| | | public class ApiTokenMessage implements Serializable { |
| | | private String codeParticipant; |
| | | private String token; |
| | | private ApiTokenMessageType apiTokenMessageType; |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.jms.messages; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public enum ApiTokenMessageType { |
| | | ADD, UPDATE, LOCKED, UNLOCKED; |
| | | } |
| 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.fdxcommons.model.log; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.ws.rs.container.ContainerRequestContext; |
| | | import javax.ws.rs.container.ContainerResponseContext; |
| | | import javax.ws.rs.container.ResourceInfo; |
| | | import javax.ws.rs.core.SecurityContext; |
| | | import javax.ws.rs.core.UriInfo; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter @Setter |
| | | public class ContainerContextDto { |
| | | |
| | | private ContainerRequestContext containerRequestContext; |
| | | |
| | | private ContainerResponseContext containerResponseContext; |
| | | |
| | | private SecurityContext securityContext; |
| | | |
| | | private HttpServletRequest httpServletRequest; |
| | | |
| | | private UriInfo uriInfo; |
| | | |
| | | private ResourceInfo resourceInfo; |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.log; |
| | | |
| | | import com.megatim.fdxcommons.model.search.CriteriaEntitySearch; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.GeneratedValue; |
| | | import javax.persistence.GenerationType; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.Lob; |
| | | 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 UserActionLog implements Serializable { |
| | | |
| | | @Id |
| | | @SequenceGenerator(name = "SEQ_USER_ACTION_LOGS", |
| | | sequenceName = "SEQ_USER_ACTION_LOGS", |
| | | allocationSize = 1, |
| | | initialValue = 1) |
| | | @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_USER_ACTION_LOGS") |
| | | private Long id; |
| | | |
| | | @NotEmpty(message = "La description est obligatoire") |
| | | @CriteriaEntitySearch(libelle = "Description", rang = 2) |
| | | @Lob |
| | | private String message; |
| | | |
| | | @CriteriaEntitySearch(libelle = "Utilisateur", rang = 5) |
| | | private String userName; |
| | | |
| | | //@XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | @NotNull(message = "La date de l'action est obligatoire") |
| | | @CriteriaEntitySearch(libelle = "Date et heure", rang = 1) |
| | | private LocalDateTime dateAction; |
| | | |
| | | @CriteriaEntitySearch(libelle = "Adresse IP", rang = 4) |
| | | @NotEmpty(message = "L'addresse IP est obligatoire") |
| | | private String ipAddress; |
| | | |
| | | @CriteriaEntitySearch(libelle = "Statut requete", visible = false) |
| | | private Integer status; |
| | | |
| | | @CriteriaEntitySearch(libelle = "Navigateur", rang = 3) |
| | | private String userAgent; |
| | | |
| | | @CriteriaEntitySearch(libelle = "Path", visible = false) |
| | | private String relativePath; |
| | | |
| | | private String httpMethod; |
| | | |
| | | private String motif; |
| | | } |
| 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.fdxcommons.model.mappers; |
| | | |
| | | import com.megatim.fdxcommons.model.dataproduction.CommonDataProduction; |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProductionSource; |
| | | import com.megatim.fdxcommons.model.dataproduction.metadata.ProductionMetaData; |
| | | import com.megatim.fdxcommons.model.dtos.dataproduction.CommonDataProductionDto; |
| | | import com.megatim.fdxcommons.model.dtos.dataproduction.ProductionMetaDataDto; |
| | | import com.megatim.fdxcommons.model.dtos.integration.ColumnDefinitionDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.ExtensionFichierDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.ExtensionFichierSlimDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.GroupeNoeudDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.GroupeNoeudSlimDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.GroupeParticipantDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.GroupeParticipantSlimDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.NoeudDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.NoeudSlimDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.ParticipantDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.ParticipantSlimDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.PaysDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.PaysSlimDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.ReferentielDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.ReferentielSlimDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.RoutageDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.RoutageSlimDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.TypeFichierDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.TypeFichierSlimDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.ValidateurFichierConfigurationDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.ValidateurFichierConfigurationSlimDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.ValidateurFichierDto; |
| | | import com.megatim.fdxcommons.model.dtos.referentiel.ValidateurFichierSlimDto; |
| | | import com.megatim.fdxcommons.model.enumeration.TypeDonnee; |
| | | import com.megatim.fdxcommons.model.enumeration.TypeOperation; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.model.pojo.CriteriaEntity; |
| | | import com.megatim.fdxcommons.model.pojo.CriteriaEntityFromView; |
| | | 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.TypeFichier; |
| | | import com.megatim.fdxcommons.model.referentiel.ValidateurFichier; |
| | | import com.megatim.fdxcommons.model.referentiel.ValidateurFichierConfiguration; |
| | | import java.util.List; |
| | | import org.mapstruct.InjectionStrategy; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.MappingConstants; |
| | | import org.mapstruct.ValueMapping; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Mapper(componentModel = "cdi", injectionStrategy = InjectionStrategy.FIELD) |
| | | public interface MapStructMapper { |
| | | |
| | | ExtensionFichierDto extensionFichierToExtensionFichierDto(ExtensionFichier extensionFichier); |
| | | |
| | | ExtensionFichierSlimDto extensionFichierToExtensionFichierSlimDto(ExtensionFichier extensionFichier); |
| | | |
| | | List<ExtensionFichierDto> extensionFichierListToExtensionFichierDtoList(List<ExtensionFichier> extensionFichiers); |
| | | |
| | | GroupeNoeudDto groupeNoeudToGroupeNoeudDto(GroupeNoeud groupeNoeud); |
| | | |
| | | GroupeNoeudSlimDto groupeNoeudToGroupeNoeudSlimDto(GroupeNoeud groupeNoeud); |
| | | |
| | | List<GroupeNoeudDto> groupeNoeudListToGroupeNoeudDtoList(List<GroupeNoeud> groupeNoeuds); |
| | | |
| | | GroupeParticipantDto groupeParticipantToGroupeParticipantDto(GroupeParticipant groupeParticipant); |
| | | |
| | | GroupeParticipantSlimDto groupeParticipantToGroupeParticipantSlimDto(GroupeParticipant groupeParticipant); |
| | | |
| | | List<GroupeParticipantDto> groupeParticipantListToGroupeParticipantDtoList(List<GroupeParticipant> groupeParticipants); |
| | | |
| | | NoeudDto noeudToNoeudDto(Noeud noeud); |
| | | |
| | | List<NoeudDto> noeudListToNoeudDtoList(List<Noeud> noeuds); |
| | | |
| | | NoeudSlimDto noeudToNoeudSlimDto(Noeud noeud); |
| | | |
| | | ParticipantDto participantToPartcipantDto(Participant participant); |
| | | |
| | | List<ParticipantDto> participantListToParticipantDtoList(List<Participant> participants); |
| | | |
| | | ParticipantSlimDto participantToParticipantSlimDto(Participant participant); |
| | | |
| | | List<ParticipantSlimDto> participantListToPartcipantSlimDtoList(List<Participant> participants); |
| | | |
| | | PaysDto paysToPaysDto(Pays pays); |
| | | |
| | | List<PaysDto> paysListToPaysDtoList(List<Pays> pays); |
| | | |
| | | PaysSlimDto paysToPaysSlimDto(Pays pays); |
| | | |
| | | List<PaysSlimDto> paysListToPaysSlimDtoList(List<Pays> pays); |
| | | |
| | | ReferentielDto referentielToReferentielDto(Referentiel referentiel); |
| | | |
| | | ReferentielSlimDto referentielToReferentielSlimDto(Referentiel referentiel); |
| | | |
| | | List<ReferentielDto> referentielListToReferentielDtoList(List<Referentiel> referentiels); |
| | | |
| | | RoutageDto routageToRoutageDto(Routage routage); |
| | | |
| | | RoutageSlimDto routageToRoutageSlimDto(Routage routage); |
| | | |
| | | List<RoutageDto> routageListToRoutageDtoList(List<Routage> routages); |
| | | |
| | | TypeFichierDto typeFichierToTypeFichierDto(TypeFichier typeFichier); |
| | | |
| | | TypeFichierSlimDto typeFichierToTypeFichierSlimDto(TypeFichier typeFichier); |
| | | |
| | | TypeFichier typeFichierSlimDtoToTypeFichier(TypeFichierSlimDto typeFichier); |
| | | |
| | | List<TypeFichierDto> typeFichierListToTypeFichierDtoList(List<TypeFichier> typeFichiers); |
| | | |
| | | ValidateurFichierConfigurationDto validateurFichierConfigurationToValidateurFichierConfigurationDto(ValidateurFichierConfiguration validateurFichierConfiguration); |
| | | |
| | | ValidateurFichierConfigurationSlimDto validateurFichierConfigurationToValidateurFichierConfigurationSlimDto(ValidateurFichierConfiguration validateurFichierConfiguration); |
| | | |
| | | List<ValidateurFichierConfigurationDto> validateurFichierConfigurationListToValidateurFichierConfigurationDtoList(List<ValidateurFichierConfiguration> validateurFichierConfigurations); |
| | | |
| | | ValidateurFichierDto validateurFichierToValidateurFichierDto(ValidateurFichier validateurFichier); |
| | | |
| | | ValidateurFichierSlimDto validateurFichierToValidateurFichierSlimDto(ValidateurFichier validateurFichier); |
| | | |
| | | List<ValidateurFichierDto> validateurFichierListToValidateurFichierDtoList(List<ValidateurFichier> validateurFichiers); |
| | | |
| | | @ValueMapping(target = MappingConstants.NULL, source = MappingConstants.ANY_UNMAPPED) |
| | | @ValueMapping(target = "NUMERIQUE", source = "NUMERIQUE") |
| | | @ValueMapping(target = "ALPHANUMERIQUE", source = "ALPHANUMERIQUE") |
| | | @ValueMapping(target = "DATE", source = "DATE") |
| | | @ValueMapping(target = "DECIMAL", source = "DECIMAL") |
| | | TypeDonnee stringToTypeDonnee(String typeDonnee); |
| | | |
| | | String typeOperationToString(TypeOperation typeOperation); |
| | | |
| | | ColumnDefinitionDto columnDefinitionToColumnDefinitionDto(ColumnDefinition columnDefinitionDto); |
| | | |
| | | List<ColumnDefinitionDto> columnDefinitionListToColumnDefinitionDtoList(List<ColumnDefinition> data); |
| | | |
| | | default CriteriaEntity criteriaEntityFromViewToCriteriaEntity(CriteriaEntityFromView ce) { |
| | | if (ce == null |
| | | || (ce.getSubCriterias() == null || ce.getSubCriterias().isEmpty() |
| | | && (ce.getNomColonne() == null || ce.getNomColonne().isEmpty() |
| | | || ce.getOperateur() == null || ce.getOperateur() == null))) { |
| | | return null; |
| | | } else { |
| | | if (ce.getSubCriterias() != null && !ce.getSubCriterias().isEmpty()) { |
| | | CriteriaEntity finalCriterion = new CriteriaEntity(); |
| | | finalCriterion.setCriteriaLogicConnector(ce.getCriteriaLogicConnector()); |
| | | |
| | | for (CriteriaEntityFromView cev : ce.getSubCriterias()) { |
| | | CriteriaEntity criteriaEntity = criteriaEntityFromViewToCriteriaEntity(cev); |
| | | if (criteriaEntity != null) { |
| | | finalCriterion.getSubCriterias().add(criteriaEntity); |
| | | } |
| | | } |
| | | return finalCriterion; |
| | | } else { |
| | | return new CriteriaEntity(ce.getNomColonne(), ce.getCriteriaValue(), ce.getOperateur(), ce.isEndOfTheDay()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<CriteriaEntity> criteriaEntityFromViewListToCriteriaEntityList(List<CriteriaEntityFromView> ces); |
| | | |
| | | String dataProductionSourceToString(DataProductionSource source); |
| | | |
| | | CriteriaEntityFromView criteriaEntityToCriteriaEntityFromView(CriteriaEntity ce); |
| | | |
| | | ProductionMetaDataDto productionMetaDataToProductionMetaDataDto(ProductionMetaData metatData); |
| | | |
| | | CommonDataProductionDto commonDataProductionToCommonDataProductionDto(CommonDataProduction cd); |
| | | |
| | | ProductionMetaData productionMetaDataDtoToProductionMetaData(ProductionMetaDataDto dto); |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.pojo; |
| | | |
| | | /** |
| | | * POJO à utiliser pour stocker les bornes de l'opérateur BETWEEN |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class BetweenOperatorValues { |
| | | |
| | | private Object lowerBound; |
| | | private Object upperBound; |
| | | |
| | | public BetweenOperatorValues(Object lowerBound, Object upperBound) { |
| | | this.lowerBound = lowerBound; |
| | | this.upperBound = upperBound; |
| | | |
| | | } |
| | | |
| | | public Object getUpperBound() { |
| | | return upperBound; |
| | | } |
| | | |
| | | public void setUpperBound(Object upperBound) { |
| | | this.upperBound = upperBound; |
| | | } |
| | | |
| | | public Object getLowerBound() { |
| | | return lowerBound; |
| | | } |
| | | |
| | | public void setLowerBound(Object lowerBound) { |
| | | this.lowerBound = lowerBound; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return '{' + "lowerBound=" + lowerBound + ", upperBound=" + upperBound + '}'; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.pojo; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class Constantes { |
| | | public static final String FIELD_NAME = "field-name"; |
| | | public static final String TAILLE = "taille"; |
| | | public static final String POSITION = "position"; |
| | | public static final String TYPE_DONNEE = "typeDonnee"; |
| | | public static final String TAILLE_PARTIE_DECIMALE = "taillePartieDecimale"; |
| | | public static final String EQUAL_PARAM = "equalParam"; |
| | | public static final String EQUAL_VALUE = "equalValue"; |
| | | public static final String FORMAT_DATE = "formatDate"; |
| | | public static final String SEPARATEUR_DATE = "separateurDate"; |
| | | public static final String ERROR_CODE = "error-code"; |
| | | public static final String HEADER_PRESENT = "header-present"; |
| | | public static final String LINE_DELIMITER = "line-delimiter"; |
| | | public static final String COLUMN_DELIMITER = "column-delimiter"; |
| | | public static final String LIGNE = "ligne"; |
| | | public static final String EXTENSION = "extension"; |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.pojo; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.CriteriaLogicConnector; |
| | | import com.megatim.fdxcommons.model.enumeration.Operateur; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Entité permettant de construire un critère de recherche |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class CriteriaEntity { |
| | | |
| | | //nom de la colonne |
| | | private String nomColonne; |
| | | |
| | | //Valeur de comparaison lors de le recherche |
| | | private Object criteriaValue; |
| | | |
| | | //Operateur de recherche |
| | | private Operateur operateur; |
| | | |
| | | private boolean endOfTheDay = false; |
| | | |
| | | private CriteriaLogicConnector criteriaLogicConnector; |
| | | |
| | | private List<CriteriaEntity> subCriterias = new ArrayList<>(); |
| | | |
| | | public CriteriaEntity() { |
| | | } |
| | | |
| | | public CriteriaEntity(String nomColonne, Object criteriaValue, Operateur operateur) { |
| | | this(nomColonne, criteriaValue, operateur, false); |
| | | } |
| | | |
| | | public CriteriaEntity(String nomColonne, Object criteriaValue, Operateur operateur, boolean endOfTheDay) { |
| | | this.nomColonne = nomColonne; |
| | | this.criteriaValue = criteriaValue; |
| | | this.operateur = operateur; |
| | | this.endOfTheDay = endOfTheDay; |
| | | } |
| | | |
| | | public CriteriaEntity(String nomColonne, Operateur operateur) { |
| | | this.nomColonne = nomColonne; |
| | | this.operateur = operateur; |
| | | } |
| | | |
| | | public String getNomColonne() { |
| | | return nomColonne; |
| | | } |
| | | |
| | | public void setNomColonne(String nomColonne) { |
| | | this.nomColonne = nomColonne; |
| | | } |
| | | |
| | | public Object getCriteriaValue() { |
| | | return criteriaValue; |
| | | } |
| | | |
| | | public void setCriteriaValue(Object criteriaValue) { |
| | | this.criteriaValue = criteriaValue; |
| | | } |
| | | |
| | | public Operateur getOperateur() { |
| | | return operateur; |
| | | } |
| | | |
| | | public void setOperateur(Operateur operateur) { |
| | | this.operateur = operateur; |
| | | } |
| | | |
| | | public boolean isEndOfTheDay() { |
| | | return endOfTheDay; |
| | | } |
| | | |
| | | public void setEndOfTheDay(boolean endOfTheDay) { |
| | | this.endOfTheDay = endOfTheDay; |
| | | } |
| | | |
| | | public List<CriteriaEntity> getSubCriterias() { |
| | | return subCriterias; |
| | | } |
| | | |
| | | public void setSubCriterias(List<CriteriaEntity> subCriterias) { |
| | | this.subCriterias = subCriterias; |
| | | } |
| | | |
| | | public CriteriaLogicConnector getCriteriaLogicConnector() { |
| | | return criteriaLogicConnector; |
| | | } |
| | | |
| | | public void setCriteriaLogicConnector(CriteriaLogicConnector criteriaLogicConnector) { |
| | | this.criteriaLogicConnector = criteriaLogicConnector; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.pojo; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.CriteriaLogicConnector; |
| | | import com.megatim.fdxcommons.model.enumeration.Operateur; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * POJO permettant de contenir les critères de recherche provenant directement |
| | | * de la vue |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @ApiModel(description = "Structure représentant le critère de sélection des lignes pour un type de fichier") |
| | | @Getter |
| | | @Setter |
| | | public class CriteriaEntityFromView { |
| | | |
| | | //nom de la colonne |
| | | @ApiModelProperty(value = "nom d'une colonne du type de fichier", required = true) |
| | | private String nomColonne; |
| | | |
| | | @ApiModelProperty(value = "valeur du critère sur la colonne", required = true) |
| | | private Object criteriaValue; |
| | | |
| | | @ApiModelProperty(value = "opérateur logique", required = true, allowableValues = "IN,NOT IN,IS NULL,IS NOT NULL,BETWEEN,NOT BETWEEN,LIKE,...") |
| | | private Operateur operateur; |
| | | |
| | | private boolean endOfTheDay = false; |
| | | |
| | | private CriteriaLogicConnector criteriaLogicConnector; |
| | | |
| | | private List<CriteriaEntityFromView> subCriterias = new ArrayList<>(); |
| | | |
| | | public CriteriaEntityFromView() { |
| | | |
| | | } |
| | | |
| | | public CriteriaEntityFromView(String nomColonne, Object criteriaValue, Operateur operateur) { |
| | | this.nomColonne = nomColonne; |
| | | this.criteriaValue = criteriaValue; |
| | | this.operateur = operateur; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.pojo; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public class CriteriaFormRequest { |
| | | |
| | | private CriteriaEntityFromView criteria; |
| | | |
| | | public CriteriaFormRequest() {} |
| | | |
| | | public CriteriaFormRequest(CriteriaEntityFromView criteria) { |
| | | this.criteria = criteria; |
| | | } |
| | | |
| | | public CriteriaEntityFromView getCriteria() { |
| | | return criteria; |
| | | } |
| | | |
| | | public void setCriteria(CriteriaEntityFromView criteria) { |
| | | this.criteria = criteria; |
| | | } |
| | | } |
| 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.fdxcommons.model.pojo; |
| | | |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.model.referentiel.Referentiel; |
| | | import com.megatim.fdxcommons.model.referentiel.TypeFichier; |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProductionFichier; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @NoArgsConstructor |
| | | public class DataInMemory { |
| | | |
| | | private Referentiel referentielEnCours; |
| | | |
| | | private Map<String, TypeFichier> codeTypeFichierToTypeFichiers = new HashMap<>(); |
| | | |
| | | private Map<String, Map<String, ColumnDefinition>> typeFichierToColumnDefinitions = new HashMap<>(); |
| | | |
| | | private Map<String, NatureProductionFichier> typeFichierToNatureProductionsFichiers = new HashMap<>(); |
| | | |
| | | private Map<String, Set<String>> typeFichierToParticipantsEnvoi = new HashMap<>(); |
| | | |
| | | private Map<String, Set<String>> typeFichierToParticipantsReception = new HashMap<>(); |
| | | } |
| 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.fdxcommons.model.pojo; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.TypeDonnee; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class JsonColumnDefinition { |
| | | |
| | | private final TypeDonnee typeDonnee; |
| | | |
| | | private final String name; |
| | | |
| | | private final int lengthh; |
| | | |
| | | private final boolean required; |
| | | |
| | | private final boolean collection; |
| | | |
| | | private String formatDate; |
| | | |
| | | private String codeDelimiteurDate; |
| | | |
| | | private final Map<String,JsonColumnDefinition> columnNameToColumnDefinition = new HashMap<>(); |
| | | |
| | | public JsonColumnDefinition(TypeDonnee typeDonnee, String name, int lengthh, String formatDate, boolean required, boolean collection) { |
| | | this.typeDonnee = typeDonnee; |
| | | this.name = name; |
| | | this.lengthh = lengthh; |
| | | this.required = required; |
| | | this.collection = collection; |
| | | this.formatDate = formatDate; |
| | | } |
| | | |
| | | } |
| 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.fdxcommons.model.pojo; |
| | | |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class JsonTableDefinition { |
| | | |
| | | private final String tableName; |
| | | private final String parentTableName; |
| | | /** |
| | | <<<<<<< HEAD |
| | | * Nom du champ au niveau du parent qui contenir la donnée si champ encours de definition est une liste ou un objet. |
| | | * Utilisé uniquement pour faciliter l'extraction des données |
| | | ======= |
| | | * Nom du champ au niveau du parent qui contenir la donnée si champ encours |
| | | * de definition est une liste ou un objet. Utilisé uniquement pour |
| | | * faciliter l'extraction des données |
| | | >>>>>>> 5b75241178fbfc33b6de4290c8bdad4b7cbbf3b8 |
| | | */ |
| | | private final String parentFieldName; |
| | | private final List<ColumnDefinition> columnDefs; |
| | | private final List<JsonTableDefinition> tablesDefinition = new ArrayList<>(); |
| | | |
| | | public JsonTableDefinition(String tableName, List<ColumnDefinition> columnDefs, String parentTableName, String parentFieldName) { |
| | | this.tableName = tableName; |
| | | this.columnDefs = columnDefs; |
| | | this.parentTableName = parentTableName; |
| | | this.parentFieldName = parentFieldName; |
| | | } |
| | | |
| | | public String getTableName() { |
| | | return tableName; |
| | | } |
| | | |
| | | public List<ColumnDefinition> getColumnDefs() { |
| | | return columnDefs; |
| | | } |
| | | |
| | | public List<JsonTableDefinition> getTablesDefinition() { |
| | | return tablesDefinition; |
| | | } |
| | | |
| | | public String getParentTableName() { |
| | | return parentTableName; |
| | | } |
| | | |
| | | public String getParentFieldName() { |
| | | return parentFieldName; |
| | | } |
| | | } |
| 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.fdxcommons.model.pojo; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.OrderByType; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class OrderByDefinition { |
| | | |
| | | private String fieldName; |
| | | |
| | | private OrderByType orderByType = OrderByType.ASC; |
| | | |
| | | public OrderByDefinition(String fieldName, OrderByType orderByType) { |
| | | this.fieldName = fieldName; |
| | | this.orderByType = orderByType; |
| | | } |
| | | |
| | | public OrderByDefinition(String fieldName) { |
| | | this.fieldName = fieldName; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.pojo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class PageData { |
| | | |
| | | private List<Map<String, Object>> loadedData; |
| | | |
| | | private int pageNumber; |
| | | |
| | | private int pageSize; |
| | | |
| | | private long totalNumberOfElements; |
| | | |
| | | private String token; |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.pojo; |
| | | |
| | | /** |
| | | * Entité utilisée pour la construction des paramètres des requêtes préparées |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class QueryParameter { |
| | | |
| | | private int index; // index du paramètre dans la requête |
| | | |
| | | private String nomColonne; // nom de la colonne |
| | | |
| | | private Object parameterValue; // Nouvelle valeur à mettre en BD |
| | | |
| | | private String value; |
| | | |
| | | public QueryParameter() { |
| | | } |
| | | |
| | | public QueryParameter(int index, String nomColonne) { |
| | | this.index = index; |
| | | this.nomColonne = nomColonne; |
| | | } |
| | | |
| | | public QueryParameter(String nomColonne, Object parameterValue) { |
| | | this.nomColonne = nomColonne; |
| | | this.parameterValue = parameterValue; |
| | | } |
| | | |
| | | public int getIndex() { |
| | | return index; |
| | | } |
| | | |
| | | public void setIndex(int index) { |
| | | this.index = index; |
| | | } |
| | | |
| | | public String getNomColonne() { |
| | | return nomColonne; |
| | | } |
| | | |
| | | public void setNomColonne(String nomColonne) { |
| | | this.nomColonne = nomColonne; |
| | | } |
| | | |
| | | public Object getParameterValue() { |
| | | return parameterValue; |
| | | } |
| | | |
| | | public void setParameterValue(Object parameterValue) { |
| | | this.parameterValue = parameterValue; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "QueryParameter{" + "index=" + index + ", nomColonne=" + nomColonne + ", parameterValue=" + parameterValue + ", value=" + value + '}'; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.pojo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | /** |
| | | * POJO permettant de contenir les valeurs(provenant directement de la vue) Ã |
| | | * mettre à jour en BD |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @ApiModel(description="Structure représentant la valeur de mise à jour d'une colonne pour un type de fichier") |
| | | public class QueryParameterFromView { |
| | | |
| | | @ApiModelProperty(value = "nom d'une colonne du type de fichier", required = true) |
| | | private String nomColonne; // nom de la colonne |
| | | |
| | | @ApiModelProperty(value = "valeur à mettre à jour pour la colonne sélectionnée", required = true) |
| | | private String parameterValue; |
| | | |
| | | public String getNomColonne() { |
| | | return nomColonne; |
| | | } |
| | | |
| | | public void setNomColonne(String nomColonne) { |
| | | this.nomColonne = nomColonne; |
| | | } |
| | | |
| | | public String getParameterValue() { |
| | | return parameterValue; |
| | | } |
| | | |
| | | public void setParameterValue(String parameterValue) { |
| | | this.parameterValue = parameterValue; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.pojo; |
| | | |
| | | import com.megatim.fdxcommons.model.integration.TableDefinition; |
| | | import com.megatim.fdxcommons.model.integration.json.TypeFichierJson; |
| | | 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 java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class ReferentielToImportData implements Serializable { |
| | | |
| | | private List<ApplicationSource> applicationSources = new ArrayList<>(); |
| | | |
| | | private List<ExtensionFichier> extensionFichiers = new ArrayList<>(); |
| | | |
| | | private List<GroupeNoeud> groupeNoeuds = new ArrayList<>(); |
| | | |
| | | private List<GroupeParticipant> groupeParticipants = new ArrayList<>(); |
| | | |
| | | private List<Noeud> noeuds = new ArrayList<>(); |
| | | |
| | | private List<Participant> participants = new ArrayList<>(); |
| | | |
| | | private List<Pays> pays = new ArrayList<>(); |
| | | |
| | | private List<Referentiel> referentiels = new ArrayList<>(); |
| | | |
| | | private List<Routage> routages = new ArrayList<>(); |
| | | |
| | | private List<StructureLigne> structureLignes = new ArrayList<>(); |
| | | |
| | | private List<TypeFichier> typeFichiers = new ArrayList<>(); |
| | | |
| | | private List<ValidateurFichierConfiguration> validateurFichierConfigurations = new ArrayList<>(); |
| | | |
| | | private List<ValidateurFichier> validateurFichiers = new ArrayList<>(); |
| | | |
| | | private List<TableDefinition> tableDefinitions = new ArrayList<>(); |
| | | |
| | | private List<NatureProductionFichier> natureProductionFichiers = new ArrayList<>(); |
| | | |
| | | private List<TypeFichierJson> typeFichiersJson = new ArrayList<>(); |
| | | |
| | | private Referentiel referentielEnCours; |
| | | |
| | | private String 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.fdxcommons.model.pojo; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class SelectResult { |
| | | private int lastReadIndex = -1; |
| | | |
| | | List<Map<String, Object>> loadedData = new ArrayList<>(); |
| | | |
| | | public int getLastReadIndex() { |
| | | return lastReadIndex; |
| | | } |
| | | |
| | | public void setLastReadIndex(int lastReadIndex) { |
| | | this.lastReadIndex = lastReadIndex; |
| | | } |
| | | |
| | | public List<Map<String, Object>> getLoadedData() { |
| | | return loadedData; |
| | | } |
| | | |
| | | public void setLoadedData(List<Map<String, Object>> loadedData) { |
| | | this.loadedData = loadedData; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.pojo; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class UpdateQueryPojo { |
| | | |
| | | private CriteriaEntityFromView criterionFromView; |
| | | |
| | | private CriteriaEntity criterion; |
| | | |
| | | private List<QueryParameterFromView> parameters = new ArrayList<>(); |
| | | |
| | | public CriteriaEntityFromView getCriterionFromView() { |
| | | return criterionFromView; |
| | | } |
| | | |
| | | public void setCriteriasFromView(CriteriaEntityFromView criterionFromView) { |
| | | this.criterionFromView = criterionFromView; |
| | | } |
| | | |
| | | public CriteriaEntity getCriterion() { |
| | | return criterion; |
| | | } |
| | | |
| | | public void setCriterion(CriteriaEntity criterion) { |
| | | this.criterion = criterion; |
| | | } |
| | | |
| | | public List<QueryParameterFromView> getParameters() { |
| | | return parameters; |
| | | } |
| | | |
| | | public void setParameters(List<QueryParameterFromView> parameters) { |
| | | this.parameters = parameters; |
| | | } |
| | | |
| | | } |
| 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.fdxcommons.model.referentiel; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashSet; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | import javax.persistence.CascadeType; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.ManyToOne; |
| | | import javax.persistence.OneToMany; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import javax.xml.bind.annotation.XmlTransient; |
| | | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Entity |
| | | @Getter |
| | | @Setter |
| | | @NoArgsConstructor |
| | | @XmlRootElement |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | public class ApplicationSource implements Serializable { |
| | | |
| | | @Id |
| | | @NotEmpty(message = "Le libellé obligatoire") |
| | | private String libelle; |
| | | |
| | | private String description; |
| | | |
| | | @NotNull(message = "L'application source doit être associée à un réfrérentiel en préparation") |
| | | @ManyToOne |
| | | private Referentiel referentiel; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | |
| | | @OneToMany(mappedBy = "applicationSource", cascade = CascadeType.ALL) |
| | | @XmlTransient |
| | | @JsonIgnore |
| | | private Set<StructureLigne> structureLignes = new HashSet<>(); |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return this.getLibelle(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean equals(Object obj) { |
| | | if (this == obj) { |
| | | return true; |
| | | } |
| | | if (obj == null) { |
| | | return false; |
| | | } |
| | | if (getClass() != obj.getClass()) { |
| | | return false; |
| | | } |
| | | final ApplicationSource other = (ApplicationSource) obj; |
| | | if (this.getLibelle() != null && !this.getLibelle().equals(other.getLibelle())) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | int hash = 5; |
| | | hash = 19 * hash + Objects.hashCode(this.libelle); |
| | | return hash; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.referentiel; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.TypeExtension; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Objects; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.EnumType; |
| | | import javax.persistence.Enumerated; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.ManyToOne; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | import com.megatim.fdxcommons.model.search.CriteriaEntitySearch; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Entity |
| | | @Getter |
| | | @Setter |
| | | @XmlRootElement(name = "extensionFichiers") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | @NoArgsConstructor |
| | | public class ExtensionFichier implements Serializable { |
| | | |
| | | @Id |
| | | @NotEmpty(message = "Extension du fichier obligatoire") |
| | | @CriteriaEntitySearch(libelle = "Extension", rang = 1) |
| | | private String extension; |
| | | |
| | | @NotEmpty(message = "Le libellé du fichier est obligatoire") |
| | | @CriteriaEntitySearch(libelle = "Libellé", rang = 2) |
| | | private String libelle; |
| | | |
| | | @Enumerated(EnumType.STRING) |
| | | @NotNull(message = "Le type d'extension du fichier est obligatoire") |
| | | @CriteriaEntitySearch(libelle = "Type extension", rang = 3) |
| | | private TypeExtension typeExtension; |
| | | |
| | | @NotNull(message = "L'extension de fichier doit être associée à un réfrérentiel en préparation") |
| | | @ManyToOne |
| | | @CriteriaEntitySearch(libelle = "Référentiel", fieldName = "referentiel.version", rang = 4) |
| | | private Referentiel referentiel; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return this.getLibelle() + " (" + this.getExtension() + ")"; |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | int hash = 7; |
| | | hash = 53 * hash + Objects.hashCode(this.extension); |
| | | return hash; |
| | | } |
| | | |
| | | @Override |
| | | public boolean equals(Object obj) { |
| | | if (this == obj) { |
| | | return true; |
| | | } |
| | | if (!(obj instanceof ExtensionFichier)) { |
| | | return false; |
| | | } |
| | | ExtensionFichier other = (ExtensionFichier) obj; |
| | | if (this.getExtension() != null && !this.getExtension().equals(other.getExtension())) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.referentiel; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashSet; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.JoinColumn; |
| | | import javax.persistence.JoinTable; |
| | | import javax.persistence.ManyToMany; |
| | | import javax.persistence.ManyToOne; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Size; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import javax.xml.bind.annotation.XmlTransient; |
| | | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | import com.megatim.fdxcommons.model.search.CriteriaEntitySearch; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Entity |
| | | @Getter |
| | | @Setter |
| | | @XmlRootElement(name = "groupeNoeuds") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | @NoArgsConstructor |
| | | public class GroupeNoeud implements Serializable { |
| | | |
| | | @Id |
| | | @NotEmpty(message = "Code obligatoire") |
| | | @CriteriaEntitySearch(libelle = "Code", rang = 1) |
| | | private String code; |
| | | |
| | | @NotEmpty(message = "Libellé obligatoire") |
| | | @CriteriaEntitySearch(libelle = "Libellé", rang = 2) |
| | | private String libelle; |
| | | |
| | | private String description; |
| | | |
| | | @NotNull(message = "Le groupe de noeud doit être associé à un référentiel en préparation") |
| | | @ManyToOne |
| | | @CriteriaEntitySearch(libelle = "Référentiel", fieldName = "referentiel.version", rang = 3) |
| | | private Referentiel referentiel; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | |
| | | @Size(min = 1, message = "Un noeud au moins doit être sélectionné") |
| | | @ManyToMany |
| | | @JoinTable( |
| | | name = "groupe_noeud_association", |
| | | joinColumns = @JoinColumn(name = "groupe_id"), |
| | | inverseJoinColumns = @JoinColumn(name = "noeud_id")) |
| | | private Set<Noeud> noeuds = new HashSet<>(); |
| | | |
| | | @XmlTransient |
| | | @ManyToMany(mappedBy = "groupeNoeudsEnvoi") |
| | | @JsonIgnore |
| | | private Set<Routage> routageEnvois = new HashSet<>(); |
| | | |
| | | @XmlTransient |
| | | @ManyToMany(mappedBy = "groupeNoeudsReception") |
| | | @JsonIgnore |
| | | private Set<Routage> routageReceptions = new HashSet<>(); |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return this.getLibelle(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean equals(Object obj) { |
| | | if (this == obj) { |
| | | return true; |
| | | } |
| | | if (obj == null) { |
| | | return false; |
| | | } |
| | | if (!(obj instanceof GroupeNoeud)) { |
| | | return false; |
| | | } |
| | | final GroupeNoeud other = (GroupeNoeud) obj; |
| | | if (this.getCode() != null && !this.getCode().equals(other.getCode())) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | int hash = 7; |
| | | hash = 59 * hash + Objects.hashCode(this.code); |
| | | return hash; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.referentiel; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashSet; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.JoinColumn; |
| | | import javax.persistence.JoinTable; |
| | | import javax.persistence.ManyToMany; |
| | | import javax.persistence.ManyToOne; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Size; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import javax.xml.bind.annotation.XmlTransient; |
| | | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | import com.megatim.fdxcommons.model.search.CriteriaEntitySearch; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Entity |
| | | @Getter |
| | | @Setter |
| | | @NoArgsConstructor |
| | | @XmlRootElement(name = "groupeParticipants") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | public class GroupeParticipant implements Serializable { |
| | | |
| | | @Id |
| | | @NotEmpty(message = "Code obligatoire") |
| | | @CriteriaEntitySearch(libelle = "Code", rang = 1) |
| | | private String code; |
| | | |
| | | @NotEmpty(message = "Libellé obligatoire") |
| | | @CriteriaEntitySearch(libelle = "Libellé", rang = 2) |
| | | private String libelle; |
| | | |
| | | private String description; |
| | | |
| | | @NotNull(message = "Le groupe de participants doit être associé à un référentiel en préparation") |
| | | @ManyToOne |
| | | @CriteriaEntitySearch(libelle = "Référentiel", fieldName = "referentiel.version", rang = 3) |
| | | private Referentiel referentiel; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | @Size(min = 1, message = "Un participant doit au moins être sélectionné") |
| | | @ManyToMany |
| | | @JoinTable( |
| | | name = "grpe_pct_ass", |
| | | joinColumns = @JoinColumn(name = "groupe_id"), |
| | | inverseJoinColumns = @JoinColumn(name = "participant_id")) |
| | | private Set<Participant> participants = new HashSet<>(); |
| | | |
| | | @XmlTransient |
| | | @JsonIgnore |
| | | @ManyToMany(mappedBy = "groupeParticipantsEnvoi") |
| | | private Set<Routage> routageEnvois = new HashSet<>(); |
| | | |
| | | @XmlTransient |
| | | @JsonIgnore |
| | | @ManyToMany(mappedBy = "groupeParticipantsReception") |
| | | private Set<Routage> routageReceptions = new HashSet<>(); |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return this.getCode() + " " + this.getLibelle(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean equals(Object obj) { |
| | | if (this == obj) { |
| | | return true; |
| | | } |
| | | if (obj == null) { |
| | | return false; |
| | | } |
| | | if (!(obj instanceof GroupeParticipant)) { |
| | | return false; |
| | | } |
| | | final GroupeParticipant other = (GroupeParticipant) obj; |
| | | if (this.getCode() != null && !this.getCode().equals(other.getCode())) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | int hash = 7; |
| | | hash = 97 * hash + Objects.hashCode(this.code); |
| | | return hash; |
| | | } |
| | | |
| | | } |
| 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.fdxcommons.model.referentiel; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import javax.xml.bind.annotation.adapters.XmlAdapter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class LocalDateTimeAdapter extends XmlAdapter<String, LocalDateTime> { |
| | | |
| | | @Override |
| | | public LocalDateTime unmarshal(String v) throws Exception { |
| | | try { |
| | | return LocalDateTime.parse(v); |
| | | } catch (Exception ex) { |
| | | return LocalDateTime.parse(v, DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss")); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String marshal(LocalDateTime v) throws Exception { |
| | | return v.toString(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.referentiel; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashSet; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.ManyToMany; |
| | | import javax.persistence.ManyToOne; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Size; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import javax.xml.bind.annotation.XmlTransient; |
| | | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | import com.megatim.fdxcommons.model.search.CriteriaEntitySearch; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Entity |
| | | @Getter |
| | | @Setter |
| | | @NoArgsConstructor |
| | | @XmlRootElement(name = "noeuds") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | public class Noeud implements Serializable { |
| | | |
| | | @Id |
| | | @NotEmpty(message = "Code obligatoire") |
| | | @Size(min = 4, message = "Le format du code est incorrect") |
| | | @Size(max = 16, message = "Le format du code est incorrect") |
| | | @CriteriaEntitySearch(libelle = "Code", rang = 1) |
| | | private String code; |
| | | |
| | | @NotEmpty(message = "Libellé obligatoire") |
| | | @CriteriaEntitySearch(libelle = "Libellé", rang = 2) |
| | | private String libelle; |
| | | |
| | | @NotNull(message = "Le noeud doit être associé à un référentiel en préparation") |
| | | @ManyToOne |
| | | @CriteriaEntitySearch(libelle = "Référentiel", fieldName = "referentiel.version", rang = 3) |
| | | private Referentiel referentiel; |
| | | |
| | | @NotNull(message = "Participant obligatoire") |
| | | @ManyToOne |
| | | @CriteriaEntitySearch(libelle = "Participant", fieldName = "participant.code", rang = 4) |
| | | private Participant participant; |
| | | |
| | | @XmlTransient |
| | | @ManyToMany(mappedBy = "noeuds") |
| | | @JsonIgnore |
| | | private Set<GroupeNoeud> groupeNoeuds; |
| | | |
| | | @XmlTransient |
| | | @ManyToMany(mappedBy = "noeudsEnvoi") |
| | | @JsonIgnore |
| | | private Set<Routage> routageEnvois = new HashSet<>(); |
| | | |
| | | @XmlTransient |
| | | @ManyToMany(mappedBy = "noeudsReception") |
| | | @JsonIgnore |
| | | private Set<Routage> routageReceptions = new HashSet<>(); |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return this.getCode() + " - " + this.getLibelle(); |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | int hash = 7; |
| | | hash = 53 * hash + Objects.hashCode(this.code); |
| | | return hash; |
| | | } |
| | | |
| | | @Override |
| | | public boolean equals(Object obj) { |
| | | if (this == obj) { |
| | | return true; |
| | | } |
| | | if (!(obj instanceof Noeud)) { |
| | | return false; |
| | | } |
| | | Noeud other = (Noeud) obj; |
| | | if (this.getCode() != null && !this.getCode().equals(other.getCode())) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.referentiel; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashSet; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.ManyToMany; |
| | | import javax.persistence.ManyToOne; |
| | | import javax.persistence.OneToMany; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Size; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import javax.xml.bind.annotation.XmlTransient; |
| | | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | import com.megatim.fdxcommons.model.search.CriteriaEntitySearch; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Entity |
| | | @Getter |
| | | @Setter |
| | | @XmlRootElement(name = "participants") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | @NoArgsConstructor |
| | | public class Participant implements Serializable { |
| | | |
| | | @Id |
| | | @NotEmpty(message = "Code obligatoire") |
| | | @Size(min = 3, message = "Le champ code doit avoir 3 caractères") |
| | | @Size(max = 3, message = "Le champ code doit avoir 3 caractères") |
| | | @CriteriaEntitySearch(libelle = "Code", fieldName = "code", rang = 1) |
| | | private String code; |
| | | |
| | | @NotEmpty(message = "Libellé obligatoire") |
| | | @CriteriaEntitySearch(libelle = "Libellé", fieldName = "code", rang = 2) |
| | | private String libelle; |
| | | |
| | | private String description; |
| | | |
| | | private String rue; |
| | | |
| | | private String adresse; |
| | | |
| | | private String ville; |
| | | |
| | | private String email; |
| | | |
| | | @NotNull(message = "Le participant doit être associé à un référentiel en préparation") |
| | | @ManyToOne |
| | | @CriteriaEntitySearch(libelle = "Référentiel", fieldName = "referentiel.version", rang = 3) |
| | | private Referentiel referentiel; |
| | | |
| | | @NotNull(message = "Pays obligatoire") |
| | | @ManyToOne |
| | | @CriteriaEntitySearch(libelle = "Pays", fieldName = "pays.code", rang = 4) |
| | | private Pays pays; |
| | | |
| | | @XmlTransient |
| | | @OneToMany(mappedBy = "participant") |
| | | @JsonIgnore |
| | | private Set<Noeud> noeuds; |
| | | |
| | | @XmlTransient |
| | | @ManyToMany(mappedBy = "participants") |
| | | @JsonIgnore |
| | | private Set<GroupeParticipant> groupeParticipants; |
| | | |
| | | @XmlTransient |
| | | @ManyToMany(mappedBy = "participantsEnvoi") |
| | | @JsonIgnore |
| | | private Set<Routage> routageEnvois = new HashSet<>(); |
| | | |
| | | @XmlTransient |
| | | @ManyToMany(mappedBy = "participantsReception") |
| | | @JsonIgnore |
| | | private Set<Routage> routageReceptions = new HashSet<>(); |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return this.getCode() + " - " + this.getLibelle(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean equals(Object obj) { |
| | | if (this == obj) { |
| | | return true; |
| | | } |
| | | if (obj == null) { |
| | | return false; |
| | | } |
| | | if (getClass() != obj.getClass()) { |
| | | return false; |
| | | } |
| | | final Participant other = (Participant) obj; |
| | | if (this.getCode() != null && !this.getCode().equals(other.getCode())) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | int hash = 7; |
| | | hash = 13 * hash + Objects.hashCode(this.code); |
| | | return hash; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.referentiel; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashSet; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | import javax.persistence.CascadeType; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.ManyToOne; |
| | | import javax.persistence.OneToMany; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import javax.xml.bind.annotation.XmlTransient; |
| | | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | import com.megatim.fdxcommons.model.search.CriteriaEntitySearch; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Entity |
| | | @Getter |
| | | @Setter |
| | | @NoArgsConstructor |
| | | @XmlRootElement(name = "paysList") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | public class Pays implements Serializable { |
| | | |
| | | @Id |
| | | @NotEmpty(message = "Code obligatoire") |
| | | @CriteriaEntitySearch(libelle = "Code", rang = 1) |
| | | private String code; |
| | | |
| | | @NotEmpty(message = "Libelle obligatoire") |
| | | @CriteriaEntitySearch(libelle = "Libellé", rang = 2) |
| | | private String libelle; |
| | | |
| | | @XmlTransient |
| | | @OneToMany(mappedBy = "pays") |
| | | @JsonIgnore |
| | | Set<Participant> participants = new HashSet<>(); |
| | | |
| | | @NotNull(message = "Le pays doit être associé à un référentiel en préparation") |
| | | @ManyToOne(cascade = CascadeType.REFRESH) |
| | | @CriteriaEntitySearch(libelle = "Référentiel", fieldName = "referentiel.version", rang = 3) |
| | | private Referentiel referentiel; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | @CriteriaEntitySearch(libelle = "Date enregistrement", visible = false) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return this.getCode() + " - " + this.getLibelle(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean equals(Object obj) { |
| | | if (this == obj) { |
| | | return true; |
| | | } |
| | | if (obj == null) { |
| | | return false; |
| | | } |
| | | if (getClass() != obj.getClass()) { |
| | | return false; |
| | | } |
| | | final Pays other = (Pays) obj; |
| | | if (this.getCode() != null && !this.getCode().equals(other.getCode())) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | int hash = 5; |
| | | hash = 29 * hash + Objects.hashCode(this.code); |
| | | return hash; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.referentiel; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.megatim.fdxcommons.model.enumeration.StatutReferentiel; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashSet; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.EnumType; |
| | | import javax.persistence.Enumerated; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.OneToMany; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import javax.xml.bind.annotation.XmlTransient; |
| | | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | import com.megatim.fdxcommons.model.search.CriteriaEntitySearch; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Entity |
| | | @Getter |
| | | @Setter |
| | | @NoArgsConstructor |
| | | @XmlRootElement(name = "referentielList") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | public class Referentiel implements Serializable { |
| | | |
| | | @Id |
| | | @NotBlank(message = "La version est obligatoire") |
| | | @CriteriaEntitySearch(libelle = "Version", rang = 1) |
| | | private String version; |
| | | |
| | | @NotBlank(message = "La description est obligatoire") |
| | | @CriteriaEntitySearch(libelle = "Description", rang = 2) |
| | | private String description; |
| | | |
| | | @NotNull(message = "Le statut du référentiel est obligatoire") |
| | | @Enumerated(EnumType.STRING) |
| | | @CriteriaEntitySearch(libelle = "Statut Referentiel", rang = 3) |
| | | private StatutReferentiel statutReferentiel; |
| | | |
| | | @OneToMany(mappedBy = "referentiel") |
| | | @XmlTransient |
| | | @JsonIgnore |
| | | private Set<ExtensionFichier> extensionFichiers = new HashSet<>(); |
| | | |
| | | @OneToMany(mappedBy = "referentiel") |
| | | @XmlTransient |
| | | @JsonIgnore |
| | | private Set<ApplicationSource> applicationSources = new HashSet<>(); |
| | | |
| | | @XmlTransient |
| | | @OneToMany(mappedBy = "referentiel") |
| | | @JsonIgnore |
| | | private Set<Routage> routages = new HashSet<>(); |
| | | |
| | | @XmlTransient |
| | | @OneToMany(mappedBy = "referentiel") |
| | | @JsonIgnore |
| | | private Set<Pays> pays = new HashSet<>(); |
| | | |
| | | @XmlTransient |
| | | @OneToMany(mappedBy = "referentiel") |
| | | @JsonIgnore |
| | | private Set<Participant> participants = new HashSet<>(); |
| | | |
| | | @XmlTransient |
| | | @OneToMany(mappedBy = "referentiel") |
| | | @JsonIgnore |
| | | private Set<ValidateurFichierConfiguration> validateurFichierConfigurations = new HashSet<>(); |
| | | |
| | | @XmlTransient |
| | | @OneToMany(mappedBy = "referentiel") |
| | | @JsonIgnore |
| | | private Set<Noeud> noeuds = new HashSet<>(); |
| | | |
| | | @XmlTransient |
| | | @OneToMany(mappedBy = "referentiel") |
| | | @JsonIgnore |
| | | private Set<GroupeParticipant> groupeParticipants = new HashSet<>(); |
| | | |
| | | @XmlTransient |
| | | @OneToMany(mappedBy = "referentiel") |
| | | @JsonIgnore |
| | | private Set<GroupeNoeud> groupeNoeuds = new HashSet<>(); |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateGeneration; |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return this.getVersion(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean equals(Object obj) { |
| | | if (this == obj) { |
| | | return true; |
| | | } |
| | | if (obj == null) { |
| | | return false; |
| | | } |
| | | if (getClass() != obj.getClass()) { |
| | | return false; |
| | | } |
| | | final Referentiel other = (Referentiel) obj; |
| | | if (this.getVersion() != null && !this.getVersion().equals(other.getVersion())) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | int hash = 3; |
| | | hash = 61 * hash + Objects.hashCode(this.version); |
| | | return hash; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.referentiel; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashSet; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.IdClass; |
| | | import javax.persistence.JoinColumn; |
| | | import javax.persistence.JoinTable; |
| | | import javax.persistence.ManyToMany; |
| | | import javax.persistence.ManyToOne; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | import com.megatim.fdxcommons.model.search.CriteriaEntitySearch; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Entity |
| | | @IdClass(RoutageId.class) |
| | | @Getter |
| | | @Setter |
| | | @XmlRootElement(name = "routageList") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | @NoArgsConstructor |
| | | public class Routage implements Serializable { |
| | | |
| | | @Id |
| | | @NotNull(message = "Le type de fichier est obligatoire") |
| | | @ManyToOne |
| | | @CriteriaEntitySearch(libelle = "TypeFichier", fieldName = "typeFichier.code") |
| | | private TypeFichier typeFichier; |
| | | |
| | | @Id |
| | | @NotNull(message = "Le routage doit être associé à un réfrérentiel en préparation") |
| | | @ManyToOne |
| | | @CriteriaEntitySearch(libelle = "Référentiel", fieldName = "referentiel.version") |
| | | private Referentiel referentiel; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | @ManyToMany |
| | | @JoinTable( |
| | | name = "rtge_nd", |
| | | joinColumns = { |
| | | @JoinColumn(name = "referentiel"), |
| | | @JoinColumn(name = "typeFichier")}, |
| | | inverseJoinColumns = @JoinColumn(name = "noeud_id")) |
| | | private Set<Noeud> noeudsEnvoi = new HashSet<>(); |
| | | |
| | | @ManyToMany |
| | | @JoinTable( |
| | | name = "rtge_grpe_nd", |
| | | joinColumns = { |
| | | @JoinColumn(name = "referentiel"), |
| | | @JoinColumn(name = "typeFichier")}, |
| | | inverseJoinColumns = @JoinColumn(name = "groupe_noeud_id")) |
| | | private Set<GroupeNoeud> groupeNoeudsEnvoi = new HashSet<>(); |
| | | |
| | | @ManyToMany |
| | | @JoinTable( |
| | | name = "rtge_pct", |
| | | joinColumns = { |
| | | @JoinColumn(name = "referentiel"), |
| | | @JoinColumn(name = "typeFichier")}, |
| | | inverseJoinColumns = @JoinColumn(name = "participant_id")) |
| | | private Set<Participant> participantsEnvoi = new HashSet<>(); |
| | | |
| | | @ManyToMany |
| | | @JoinTable( |
| | | name = "rtge_grpe_pct", |
| | | joinColumns = { |
| | | @JoinColumn(name = "referentiel"), |
| | | @JoinColumn(name = "typeFichier")}, |
| | | inverseJoinColumns = @JoinColumn(name = "groupe_participant_id")) |
| | | private Set<GroupeParticipant> groupeParticipantsEnvoi = new HashSet<>(); |
| | | |
| | | @ManyToMany |
| | | @JoinTable( |
| | | name = "rtge_nd_rcpt", |
| | | joinColumns = { |
| | | @JoinColumn(name = "referentiel"), |
| | | @JoinColumn(name = "typeFichier")}, |
| | | inverseJoinColumns = @JoinColumn(name = "noeud_id")) |
| | | private Set<Noeud> noeudsReception = new HashSet<>(); |
| | | |
| | | @ManyToMany |
| | | @JoinTable( |
| | | name = "rtge_grpe_noeud_rcpt", |
| | | joinColumns = { |
| | | @JoinColumn(name = "referentiel"), |
| | | @JoinColumn(name = "typeFichier")}, |
| | | inverseJoinColumns = @JoinColumn(name = "groupe_noeud_id")) |
| | | private Set<GroupeNoeud> groupeNoeudsReception = new HashSet<>(); |
| | | |
| | | @ManyToMany |
| | | @JoinTable( |
| | | name = "rtge_pct_rcpt", |
| | | joinColumns = { |
| | | @JoinColumn(name = "referentiel"), |
| | | @JoinColumn(name = "typeFichier")}, |
| | | inverseJoinColumns = @JoinColumn(name = "participant_id")) |
| | | private Set<Participant> participantsReception = new HashSet<>(); |
| | | |
| | | @ManyToMany |
| | | @JoinTable( |
| | | name = "rtge_grpe_pct_rcpt", |
| | | joinColumns = { |
| | | @JoinColumn(name = "referentiel"), |
| | | @JoinColumn(name = "typeFichier")}, |
| | | inverseJoinColumns = @JoinColumn(name = "grpe_pct_id")) |
| | | private Set<GroupeParticipant> groupeParticipantsReception = new HashSet<>(); |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | |
| | | @Override |
| | | public boolean equals(Object o) { |
| | | if (this == o) { |
| | | return true; |
| | | } |
| | | if (o == null || getClass() != o.getClass()) { |
| | | return false; |
| | | } |
| | | Routage routage = (Routage) o; |
| | | return referentiel != null && referentiel.equals(routage.getReferentiel()) |
| | | && typeFichier != null && typeFichier.equals(routage.getTypeFichier()); |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | int hash = 3; |
| | | hash = 79 * hash + Objects.hashCode(this.typeFichier); |
| | | hash = 79 * hash + Objects.hashCode(this.referentiel); |
| | | return hash; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.referentiel; |
| | | |
| | | import java.io.Serializable; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Data |
| | | public class RoutageId implements Serializable { |
| | | |
| | | private String typeFichier; |
| | | private 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.fdxcommons.model.referentiel; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.EtatIntegration; |
| | | import com.megatim.fdxcommons.model.enumeration.TypeDonnee; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Objects; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.EnumType; |
| | | import javax.persistence.Enumerated; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.ManyToOne; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | import org.hibernate.validator.constraints.Range; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Entity |
| | | @Getter |
| | | @Setter |
| | | @NoArgsConstructor |
| | | @XmlRootElement |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | public class StructureLigne implements Serializable { |
| | | |
| | | @Id |
| | | @NotEmpty(message = "L'identifiant est obligatoire") |
| | | private String id; |
| | | |
| | | @Range(min = 1, message = "La position doit être supérieure à 0") |
| | | private int position; |
| | | |
| | | @NotEmpty(message = "Le code est obligatoire") |
| | | private String code; |
| | | |
| | | private String designation; |
| | | |
| | | @Range(min = 1, message = "La taille doit être supérieure à 0") |
| | | private int taille; |
| | | |
| | | private String source; |
| | | |
| | | private String formatDate; |
| | | |
| | | @Enumerated(EnumType.STRING) |
| | | @NotNull(message = "Le type de données est obligatoire") |
| | | private TypeDonnee typeDonnee; |
| | | |
| | | @NotNull(message = "Le validateur de fichier doit être indiqué") |
| | | @ManyToOne |
| | | private ValidateurFichier validateurFichier; |
| | | |
| | | @ManyToOne |
| | | private ApplicationSource applicationSource; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | |
| | | // @Enumerated(EnumType.STRING) |
| | | // private EtatIntegration etatIntegration = EtatIntegration.NOUVEAU; |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return this.code + " - " + this.designation; |
| | | } |
| | | |
| | | @Override |
| | | public boolean equals(Object obj) { |
| | | if (this == obj) { |
| | | return true; |
| | | } |
| | | if (obj == null) { |
| | | return false; |
| | | } |
| | | if (!(obj instanceof StructureLigne)) { |
| | | return false; |
| | | } |
| | | final StructureLigne other = (StructureLigne) obj; |
| | | if (this.getId() != null && !this.getId().equals(other.getId())) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | int hash = 5; |
| | | hash = 47 * hash + Objects.hashCode(this.code); |
| | | return hash; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.referentiel; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.megatim.fdxcommons.model.enumeration.CategorieFichier; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashSet; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.EnumType; |
| | | import javax.persistence.Enumerated; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.ManyToOne; |
| | | import javax.persistence.OneToMany; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import javax.xml.bind.annotation.XmlTransient; |
| | | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | import com.megatim.fdxcommons.model.search.CriteriaEntitySearch; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Entity |
| | | @Getter |
| | | @Setter |
| | | @XmlRootElement(name = "typeFichiersList") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | @NoArgsConstructor |
| | | public class TypeFichier implements Serializable { |
| | | |
| | | @Id |
| | | @CriteriaEntitySearch(libelle = "Code", rang = 1) |
| | | private String code; |
| | | |
| | | @NotEmpty(message = "Le libellé du type de fichier est obligatoire") |
| | | @CriteriaEntitySearch(libelle = "Libellé", rang = 2) |
| | | private String libelle; |
| | | |
| | | private String description; |
| | | |
| | | @ManyToOne |
| | | @CriteriaEntitySearch(libelle = "Participant", fieldName = "participant.code", rang = 3) |
| | | private Participant participant; |
| | | |
| | | @NotNull(message = "Le type de fichier doit être associé à un référentiel en préparation") |
| | | @ManyToOne |
| | | @CriteriaEntitySearch(libelle = "Référentiel", fieldName = "referentiel.version", rang = 4) |
| | | private Referentiel referentiel; |
| | | |
| | | @XmlTransient |
| | | @JsonIgnore |
| | | @OneToMany(mappedBy = "typeFichier") |
| | | private Set<Routage> routages = new HashSet<>(); |
| | | |
| | | @XmlTransient |
| | | @JsonIgnore |
| | | @OneToMany(mappedBy = "typeFichier") |
| | | private Set<ValidateurFichierConfiguration> validateurFichierConfigurations = new HashSet<>(); |
| | | |
| | | @XmlTransient |
| | | @JsonIgnore |
| | | @OneToMany(mappedBy = "typeFichier") |
| | | private Set<ValidateurFichier> validateurFichiers = new HashSet<>(); |
| | | |
| | | @NotNull(message = "La catégorie de fichier est obligatoire") |
| | | @Enumerated(EnumType.STRING) |
| | | private CategorieFichier categorieFichier; |
| | | |
| | | @NotNull(message = "L'extension du type de fichier est obligatoire") |
| | | @ManyToOne |
| | | private ExtensionFichier extensionFichier; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return this.getCode() + " - " + this.getLibelle(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean equals(Object obj) { |
| | | if (this == obj) { |
| | | return true; |
| | | } |
| | | if (obj == null) { |
| | | return false; |
| | | } |
| | | if (!(obj instanceof TypeFichier)) { |
| | | return false; |
| | | } |
| | | final TypeFichier other = (TypeFichier) obj; |
| | | if (this.getCode() != null && !this.getCode().equals(other.getCode())) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | int hash = 3; |
| | | hash = 17 * hash + Objects.hashCode(this.code); |
| | | return hash; |
| | | } |
| | | } |
| 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.fdxcommons.model.referentiel; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashSet; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | import javax.persistence.CascadeType; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.ManyToOne; |
| | | import javax.persistence.OneToMany; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import javax.xml.bind.annotation.XmlTransient; |
| | | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | import org.hibernate.validator.constraints.Range; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Entity |
| | | @Getter |
| | | @Setter |
| | | @NoArgsConstructor |
| | | @XmlRootElement |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | public class ValidateurFichier implements Serializable { |
| | | |
| | | @Id |
| | | @NotNull(message = "Aucun identifiant spécifié") |
| | | private String id; |
| | | |
| | | @Range(min = 1, message = "Le nombre de position doit être supérieure à 0") |
| | | private int nombrePosition; |
| | | |
| | | @NotNull(message = "Le type de fichier est obligatoire") |
| | | @ManyToOne |
| | | private TypeFichier typeFichier; |
| | | |
| | | @OneToMany(mappedBy = "validateurFichier", cascade = CascadeType.ALL) |
| | | @XmlTransient |
| | | @JsonIgnore |
| | | private Set<StructureLigne> structureLignes = new HashSet<>(); |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | |
| | | // @Enumerated(EnumType.STRING) |
| | | // private EtatIntegration etatIntegration = EtatIntegration.NOUVEAU; |
| | | @Override |
| | | public String toString() { |
| | | return this.typeFichier.toString(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean equals(Object obj) { |
| | | if (this == obj) { |
| | | return true; |
| | | } |
| | | if (obj == null) { |
| | | return false; |
| | | } |
| | | if (!(obj instanceof ValidateurFichier)) { |
| | | return false; |
| | | } |
| | | final ValidateurFichier other = (ValidateurFichier) obj; |
| | | if (this.getTypeFichier() != null && !this.getTypeFichier().equals(other.getTypeFichier())) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | int hash = 3; |
| | | hash = 53 * hash + Objects.hashCode(this.typeFichier); |
| | | return hash; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.referentiel; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Objects; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.IdClass; |
| | | import javax.persistence.ManyToOne; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Entity |
| | | @XmlRootElement(name = "validateurFichierConfigurationList") |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | @IdClass(ValidateurFichierConfigurationId.class) |
| | | @Getter |
| | | @Setter |
| | | @NoArgsConstructor |
| | | public class ValidateurFichierConfiguration implements Serializable { |
| | | |
| | | @Id |
| | | @NotNull(message = "Le type de fichier est obligatoire") |
| | | @ManyToOne |
| | | private TypeFichier typeFichier; |
| | | |
| | | @Id |
| | | @NotNull(message = "La configuration du validateur doit être associée à un réfrérentiel en préparation") |
| | | @ManyToOne |
| | | private Referentiel referentiel; |
| | | |
| | | @NotEmpty(message = "Le fichier de validation est obligatoire") |
| | | private String fileName; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | |
| | | @Override |
| | | public boolean equals(Object o) { |
| | | if (this == o) { |
| | | return true; |
| | | } |
| | | if (o == null || getClass() != o.getClass()) { |
| | | return false; |
| | | } |
| | | ValidateurFichierConfiguration other = (ValidateurFichierConfiguration) o; |
| | | return referentiel != null && referentiel.equals(other.getReferentiel()) |
| | | && typeFichier != null && typeFichier.equals(other.getTypeFichier()); |
| | | } |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | int hash = 5; |
| | | hash = 71 * hash + Objects.hashCode(this.typeFichier); |
| | | hash = 71 * hash + Objects.hashCode(this.referentiel); |
| | | return hash; |
| | | } |
| | | } |
| 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.fdxcommons.model.referentiel; |
| | | |
| | | import java.io.Serializable; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Data |
| | | public class ValidateurFichierConfigurationId implements Serializable { |
| | | private String typeFichier; |
| | | private String referentiel; |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.referentiel.historique; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | import javax.persistence.CollectionTable; |
| | | import javax.persistence.ElementCollection; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.FetchType; |
| | | import javax.persistence.Id; |
| | | import javax.persistence.IdClass; |
| | | import javax.persistence.JoinColumn; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | import lombok.NoArgsConstructor; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @Entity |
| | | @IdClass(ReferentielIntegrationHistoriqueId.class) |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class ReferentielIntegrationHistorique implements Serializable { |
| | | |
| | | @Id |
| | | @NotEmpty(message = "Le code du type fichier est obligatoire") |
| | | private String codeTypeFichier; |
| | | |
| | | @Id |
| | | @NotEmpty(message = "La version du référentiel est obligatoire") |
| | | private String referentielVersion; |
| | | |
| | | @ElementCollection(targetClass = String.class, fetch = FetchType.EAGER) |
| | | @CollectionTable( |
| | | name = "ref_int_historique_depending_refs", // Name of the table for the collection |
| | | joinColumns = {@JoinColumn(name = "codetypefichier"), @JoinColumn(name = "referentielversion")} // Foreign key column in the collection table |
| | | ) |
| | | private Set<String> dependingReferentiels; |
| | | |
| | | @Override |
| | | public int hashCode() { |
| | | int hash = 7; |
| | | hash = 67 * hash + Objects.hashCode(this.codeTypeFichier); |
| | | hash = 67 * hash + Objects.hashCode(this.referentielVersion); |
| | | hash = 67 * hash + Objects.hashCode(this.dependingReferentiels); |
| | | 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 ReferentielIntegrationHistorique other = (ReferentielIntegrationHistorique) obj; |
| | | |
| | | if (other.getCodeTypeFichier() != null && other.getReferentielVersion() != null) { |
| | | return other.getCodeTypeFichier().equals(this.codeTypeFichier) && other.getReferentielVersion().equals(this.referentielVersion); |
| | | } else { |
| | | return 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.fdxcommons.model.referentiel.historique; |
| | | |
| | | import java.io.Serializable; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Data |
| | | public class ReferentielIntegrationHistoriqueId implements Serializable { |
| | | |
| | | private String codeTypeFichier; |
| | | private String referentielVersion; |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.referentiel.historique.pojo; |
| | | |
| | | import com.megatim.fdxcommons.model.integration.TableDefinition; |
| | | import com.megatim.fdxcommons.model.referentiel.historique.ReferentielIntegrationHistorique; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class TableDefinitionFiltered { |
| | | |
| | | private final List<TableDefinition> tablesToCreate; |
| | | private final List<ReferentielIntegrationHistorique> refIntegrationHistorique; |
| | | |
| | | public TableDefinitionFiltered(List<TableDefinition> tablesToCreate, List<ReferentielIntegrationHistorique> refIntegrationHistorique) { |
| | | this.tablesToCreate = tablesToCreate; |
| | | this.refIntegrationHistorique = refIntegrationHistorique; |
| | | } |
| | | |
| | | public List<TableDefinition> getTablesToCreate() { |
| | | return tablesToCreate; |
| | | } |
| | | |
| | | public List<ReferentielIntegrationHistorique> getRefIntegrationHistorique() { |
| | | return refIntegrationHistorique; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.model.referentiel.natureproduction; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public enum NatureProduction { |
| | | REFERENTIELLE("REFERENTIELLE"), |
| | | CUMMULATIVE("CUMMULATIVE"); |
| | | |
| | | private final String value; |
| | | |
| | | private NatureProduction(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public static NatureProduction fromValue(String value) { |
| | | switch (value) { |
| | | case "REFERENTIELLE": |
| | | return NatureProduction.REFERENTIELLE; |
| | | case "CUMMULATIVE": |
| | | return NatureProduction.CUMMULATIVE; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return value; |
| | | } |
| | | } |
| 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.fdxcommons.model.referentiel.natureproduction; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | import com.megatim.fdxcommons.model.referentiel.LocalDateTimeAdapter; |
| | | import com.megatim.fdxcommons.model.referentiel.Referentiel; |
| | | import com.megatim.fdxcommons.model.referentiel.TypeFichier; |
| | | 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.IdClass; |
| | | import javax.persistence.ManyToOne; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.xml.bind.annotation.XmlAccessType; |
| | | import javax.xml.bind.annotation.XmlAccessorType; |
| | | import javax.xml.bind.annotation.XmlRootElement; |
| | | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import org.hibernate.annotations.CreationTimestamp; |
| | | import org.hibernate.annotations.UpdateTimestamp; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Entity |
| | | @IdClass(NatureProductionFichierId.class) |
| | | @Getter |
| | | @Setter |
| | | @XmlRootElement |
| | | @XmlAccessorType(XmlAccessType.FIELD) |
| | | @JsonInclude(JsonInclude.Include.NON_EMPTY) |
| | | public class NatureProductionFichier implements Serializable { |
| | | |
| | | @Id |
| | | @NotNull(message = "Le type de fichier est obligatoire") |
| | | @ManyToOne |
| | | private TypeFichier typeFichier; |
| | | |
| | | @Id |
| | | @NotNull(message = "L'élement doit être associé à un réfrérentiel en préparation") |
| | | @ManyToOne |
| | | private Referentiel referentiel; |
| | | |
| | | @NotNull(message = "La nature de la production est obligatoire") |
| | | @Enumerated(value = EnumType.STRING) |
| | | private NatureProduction natureProduction; |
| | | |
| | | @JsonFormat(pattern = "dd/MM/yyyy HH:mm:ss") |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | @CreationTimestamp |
| | | private LocalDateTime dateCreation; |
| | | |
| | | @JsonFormat(pattern = "dd/MM/yyyy HH:mm:ss") |
| | | @XmlJavaTypeAdapter(LocalDateTimeAdapter.class) |
| | | @UpdateTimestamp |
| | | private LocalDateTime dateMiseAjour; |
| | | |
| | | private String createBy; |
| | | |
| | | private String lastModifiedBy; |
| | | |
| | | @Override |
| | | public boolean equals(Object o) { |
| | | if (this == o) { |
| | | return true; |
| | | } |
| | | if (o == null || getClass() != o.getClass()) { |
| | | return false; |
| | | } |
| | | NatureProductionFichier natureProductionFichier = (NatureProductionFichier) o; |
| | | return referentiel != null && referentiel.equals(natureProductionFichier.getReferentiel()) |
| | | && typeFichier != null && typeFichier.equals(natureProductionFichier.getTypeFichier()); |
| | | } |
| | | } |
| 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.fdxcommons.model.referentiel.natureproduction; |
| | | |
| | | import java.io.Serializable; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Data |
| | | public class NatureProductionFichierId implements Serializable { |
| | | private String typeFichier; |
| | | private 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.fdxcommons.model.remoteaction; |
| | | |
| | | import java.io.Serializable; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Data |
| | | public class RemoteConfigurationId implements Serializable { |
| | | |
| | | private String codeTypeFichier; |
| | | private String codeParticipant; |
| | | } |
| 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.fdxcommons.model.remotedataproduction.enums; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public enum ScheduleAction { |
| | | |
| | | AJOUTER("AJOUTER"), |
| | | SUPPRIMER("SUPPRIMER"), |
| | | MODIFIER("MODIFIER"), |
| | | NEUTRE("NEUTRE"); |
| | | |
| | | private String type = ""; |
| | | |
| | | private ScheduleAction(String type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public static ScheduleAction fromValeur(String value) { |
| | | switch (value) { |
| | | case "AJOUTER": |
| | | return ScheduleAction.AJOUTER; |
| | | case "SUPPRIMER": |
| | | return ScheduleAction.SUPPRIMER; |
| | | case "MODIFIER": |
| | | return ScheduleAction.MODIFIER; |
| | | case "NEUTRE": |
| | | return ScheduleAction.NEUTRE; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return type; |
| | | } |
| | | } |
| 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.fdxcommons.model.remotedataproduction.enums; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonValue; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public enum TypePas { |
| | | MINUTE("Minutes"), |
| | | HEUR("Heurs"); |
| | | |
| | | private final String value; |
| | | |
| | | private TypePas(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | @JsonValue |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public static TypePas fromValeur(String value) { |
| | | switch (value) { |
| | | case "MINUTE": |
| | | return TypePas.MINUTE; |
| | | case "HEUR": |
| | | return TypePas.HEUR; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return value; |
| | | } |
| | | } |
| 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.fdxcommons.model.search; |
| | | |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Target(ElementType.FIELD) |
| | | public @interface CriteriaEntitySearch { |
| | | |
| | | public String libelle(); |
| | | |
| | | public String fieldName() default ""; |
| | | |
| | | public int rang() default 0; |
| | | |
| | | public boolean visible() default true;//Permet de definir si le champ sera visible à l'utilisateur final ou pas |
| | | } |
| 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.fdxcommons.model.search; |
| | | |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Target(ElementType.METHOD) |
| | | public @interface EnumValue { |
| | | } |
| 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.fdxcommons.model.search; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur; |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Target(ElementType.FIELD) |
| | | public @interface Search { |
| | | public String fieldName() default ""; |
| | | |
| | | public String dateFormat() default ""; |
| | | |
| | | public boolean endOfDay() default false; |
| | | |
| | | public String operatorFieldName() default ""; |
| | | |
| | | public SearchAnnotationOperateur operateur() default SearchAnnotationOperateur.LIKE; |
| | | } |
| 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.fdxcommons.model.search; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.TypeDonnee; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class SearchColumn { |
| | | |
| | | private TypeDonnee typeDonnee; |
| | | |
| | | private String libelle; |
| | | |
| | | private Class<?> classe; |
| | | |
| | | private List<String> valuesOfEnum = new ArrayList<>(); |
| | | |
| | | private int rang; |
| | | |
| | | private String fieldName; |
| | | } |
| 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.fdxcommons.model.search; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.NumberOperator; |
| | | import com.megatim.fdxcommons.model.enumeration.SearchAnnotationOperateur; |
| | | import javax.persistence.criteria.From; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | public class SearchCriteria { |
| | | |
| | | private String fieldName; |
| | | private Class<?> fieldType; |
| | | private SearchAnnotationOperateur operateur; |
| | | private NumberOperator numberOperator = NumberOperator.UNKNOW; |
| | | private Object fieldValue; |
| | | private From<?, ?> from; |
| | | } |
| 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.fdxcommons.model.searchentities; |
| | | |
| | | 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 ColumnDefinitionSearch { |
| | | |
| | | @Search(fieldName = "referentielVersion", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private String referentielVersion; |
| | | |
| | | @Search(fieldName = "codeTypeFichier", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private String codeTypeFichier; |
| | | |
| | | @Search(fieldName = "name", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private String columnName; |
| | | |
| | | // @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.fdxcommons.model.searchentities; |
| | | |
| | | 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 TableDefinitionSearch { |
| | | |
| | | @Search(fieldName = "referentielVersion", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private String referentielVersion; |
| | | |
| | | @Search(fieldName = "codeTypeFichier", operateur = SearchAnnotationOperateur.EQUALS) |
| | | private 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.fdxcommons</groupId> |
| | | <artifactId>fdxcommons</artifactId> |
| | | <version>1.0</version> |
| | | </parent> |
| | | |
| | | <groupId>com.megatim.fdxcommons.service.ifaces</groupId> |
| | | <artifactId>fdxcommons-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.fdxcommons.tools</groupId> |
| | | <artifactId>fdxcommons-tools</artifactId> |
| | | <version>1.0</version> |
| | | <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.fdxcommons.model</groupId> |
| | | <artifactId>fdxcommons-model</artifactId> |
| | | <version>${project.version}</version> |
| | | <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</groupId> |
| | | <artifactId>application-backend-commons-tools</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | <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.fdxcommons.core.ifaces</groupId> |
| | | <artifactId>fdxcommons-core-ifaces</artifactId> |
| | | <version>${project.version}</version> |
| | | <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</groupId> |
| | | <artifactId>rs-security-core</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>javax</groupId> |
| | | <artifactId>javaee-api</artifactId> |
| | | <version>${jakartaee}</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.ibm.icu</groupId> |
| | | <artifactId>icu4j</artifactId> |
| | | <version>61.1</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | </dependencies> |
| | | <name>fdxcommons-service-ifaces</name> |
| | | </project> |
| 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> |
| | | </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>fdxcommons</artifactId> |
| | | <groupId>com.megatim.fdxcommons</groupId> |
| | | <version>1.0</version> |
| | | </parent> |
| | | |
| | | <groupId>com.megatim.fdxcommons.service.impl</groupId> |
| | | <artifactId>fdxcommons-service-impl</artifactId> |
| | | <version>1.0</version> |
| | | <packaging>war</packaging> |
| | | |
| | | <name>fdxcommons-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>D:\wildfly-17.0.0.Final-web-local\standalone\deployments\fdxcommons-service-impl-1.0.war</serveur.jboss.repertoire.deploiement.war> |
| | | <repertoire.target.generation.war>C:\Users\ASUS\Documents\NetBeansProjects\share_sources\fdx-commons\fdxcommons-service-impl\target\fdxcommons-service-impl-1.0.war</repertoire.target.generation.war> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>com.megatim.fdxcommons.service.ifaces</groupId> |
| | | <artifactId>fdxcommons-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.fdxcommons.tools</groupId> |
| | | <artifactId>fdxcommons-tools</artifactId> |
| | | <version>1.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatim.fdxcommons.core.impl</groupId> |
| | | <artifactId>fdxcommons-core-impl</artifactId> |
| | | <version>1.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.megatim.fdxcommons.model</groupId> |
| | | <artifactId>fdxcommons-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> |
| | | |
| | | </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.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> |
| | | <!-- 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.fdxcommons.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("fdx-commons") |
| | | @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.fdxcommons.service.impl.startup; |
| | | |
| | | import javax.ejb.Singleton; |
| | | import javax.ejb.Startup; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | @Singleton |
| | | @Startup |
| | | public class StartupBean { |
| | | |
| | | } |
| 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> |
| | | </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.fdxcommons</groupId> |
| | | <artifactId>fdxcommons</artifactId> |
| | | <version>1.0</version> |
| | | </parent> |
| | | |
| | | <groupId>com.megatim.fdxcommons.tools</groupId> |
| | | <artifactId>fdxcommons-tools</artifactId> |
| | | <version>1.0</version> |
| | | <packaging>jar</packaging> |
| | | |
| | | <name>fdxcommons-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> |
| | | |
| | | <dependencyManagement> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.apache.camel</groupId> |
| | | <artifactId>camel-bom</artifactId> |
| | | <version>3.7.0</version> |
| | | <type>pom</type> |
| | | <scope>import</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | </dependencyManagement> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>javax</groupId> |
| | | <artifactId>javaee-api</artifactId> |
| | | <version>8.0</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>io.github.classgraph</groupId> |
| | | <artifactId>classgraph</artifactId> |
| | | <version>4.8.90</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-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> |
| | | <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-fonts</artifactId> |
| | | <version>6.19.1</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.opencsv</groupId> |
| | | <artifactId>opencsv</artifactId> |
| | | <version>4.1</version> |
| | | <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</groupId> |
| | | <artifactId>export-excel</artifactId> |
| | | <version>1.0</version> |
| | | <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.fdxcommons.model</groupId> |
| | | <artifactId>fdxcommons-model</artifactId> |
| | | <version>1.0</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.tika</groupId> |
| | | <artifactId>tika-parser-text-module</artifactId> |
| | | <version>2.9.0</version> |
| | | <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</groupId> |
| | | <artifactId>module-compression</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.xmlbeans</groupId> |
| | | <artifactId>xmlbeans</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>xerces</groupId> |
| | | <artifactId>xercesImpl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.google.guava</groupId> |
| | | <artifactId>guava</artifactId> |
| | | <version>31.1-jre</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.camel</groupId> |
| | | <artifactId>camel-core</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.camel</groupId> |
| | | <artifactId>camel-endpointdsl</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.camel</groupId> |
| | | <artifactId>camel-kafka</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.camel</groupId> |
| | | <artifactId>camel-cdi</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.camel</groupId> |
| | | <artifactId>camel-jta</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.camel</groupId> |
| | | <artifactId>camel-jdbc</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.camel</groupId> |
| | | <artifactId>camel-ftp</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.camel</groupId> |
| | | <artifactId>camel-rabbitmq</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.fasterxml.jackson.datatype</groupId> |
| | | <artifactId>jackson-datatype-jsr310</artifactId> |
| | | <version>2.13.1</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <artifactId>jackson-annotations</artifactId> |
| | | <groupId>com.fasterxml.jackson.core</groupId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <artifactId>jackson-core</artifactId> |
| | | <groupId>com.fasterxml.jackson.core</groupId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <artifactId>jackson-databind</artifactId> |
| | | <groupId>com.fasterxml.jackson.core</groupId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>com.fasterxml.jackson.module</groupId> |
| | | <artifactId>jackson-module-jaxb-annotations</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.camel</groupId> |
| | | <artifactId>camel-jackson</artifactId> |
| | | <exclusions> |
| | | <exclusion> |
| | | <artifactId>jackson-annotations</artifactId> |
| | | <groupId>com.fasterxml.jackson.core</groupId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <artifactId>jackson-core</artifactId> |
| | | <groupId>com.fasterxml.jackson.core</groupId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <artifactId>jackson-databind</artifactId> |
| | | <groupId>com.fasterxml.jackson.core</groupId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>com.fasterxml.jackson.module</groupId> |
| | | <artifactId>jackson-module-jaxb-annotations</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>com.sun.xml.bind</groupId> |
| | | <artifactId>jaxb-core</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>javax.xml.bind</groupId> |
| | | <artifactId>jaxb-api</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>com.sun.xml.bind</groupId> |
| | | <artifactId>jaxb-impl</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>com.sun.xml.ws</groupId> |
| | | <artifactId>jaxws-rt</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.sun.xml.bind</groupId> |
| | | <artifactId>jaxb-impl</artifactId> |
| | | <version>2.3.2</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>jakarta.xml.bind</groupId> |
| | | <artifactId>jakarta.xml.bind-api</artifactId> |
| | | <version>2.3.3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.glassfish.jaxb</groupId> |
| | | <artifactId>jaxb-runtime</artifactId> |
| | | <version>2.3.3</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | </project> |
| New file |
| | |
| | | package com.megatim.fdxcommons.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.fdxcommons.tools; |
| | | |
| | | import java.io.File; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public class CommonAppContext { |
| | | |
| | | 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 final String UNZIP_REFERENTIEL_VALIDATEUR_JSON_DIR_NAME = "validateursjson"; |
| | | |
| | | public static final String TOKEN_GENERATION_EXCHANGE = "tokenAuthentificationExchange"; |
| | | public static final String TOKEN_GENERATION_QUEUE = "tokenAuthentificationQueue"; |
| | | public static final String TOKEN_GENERATION_ROUTING_KEY = "tokenAuthentificationRoutingKey"; |
| | | |
| | | public static File getCurrentDirectory() { |
| | | String fileName = (String) System.getProperties().get("user.dir"); |
| | | return new File(fileName); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.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.hwpf.HWPFDocument; |
| | | //import org.apache.poi.hwpf.extractor.WordExtractor; |
| | | import org.apache.poi.xwpf.usermodel.XWPFDocument; |
| | | import org.apache.poi.xwpf.usermodel.XWPFParagraph; |
| | | import org.apache.poi.xwpf.usermodel.XWPFRun; |
| | | //import org.dhatim.fastexcel.reader.Row; |
| | | import com.megatim.export.excel.Export; |
| | | import com.megatim.fdxcommons.tools.context.AppContext; |
| | | import java.io.InputStream; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | 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 |
| | | * @param format |
| | | * @param date |
| | | * @return |
| | | */ |
| | | public static String formaterDate(String format, LocalDateTime date) { |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format); |
| | | String formattedDate = date.format(formatter); |
| | | return formattedDate; |
| | | } |
| | | |
| | | /** |
| | | * 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.fdxcommons.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.fdxcommons.tools.context; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class AppContext { |
| | | public static final String PROPERTY_FILE_PATH = System.getProperty("api-file"); |
| | | public static final String BROKER_FILE_PATH = System.getProperty("broker-file"); |
| | | |
| | | public static final String USER_ACTION_TO_FDX_CONS_DIRECT = "userActionToFdxConsDirect"; |
| | | public static final String USER_ACTION_TO_FDX_CONS_EXCHANGE = "userActionToFdxConsExchange"; |
| | | public static final String USER_ACTION_TO_FDX_CONS_QUEUE = "userActionToFdxConsQueue"; |
| | | public static final String USER_ACTION_TO_FDX_CONS_ROUTING_KEY = "userActionToFdxConsRoutingKey"; |
| | | public static final String DELETE_DATAPRODUCTION_TIMER = "delete-dataproduction-timer"; |
| | | |
| | | /* Format de date */ |
| | | public static String FORMAT_DATE_DDSlashMMSlashYYYY = "dd/MM/yyyy"; |
| | | public static String FORMAT_DATE_MMSlashDDSlashYYYY = "MM/dd/yyyy"; |
| | | public static String FORMAT_DATE_DDMMYYYYHHMMSS = "ddMMyyyyHHmmss"; |
| | | public static String FORMAT_DATE_YYYYMMDD = "yyyyMMdd"; |
| | | public static String FORMAT_DATE_HEURE_CLASSIQUE = "dd/MM/yyyy HH:mm:ss"; |
| | | public static String FORMAT_DATE_YYYYTIRETMMTIRETDD = "yyyy-MM-dd"; |
| | | public static String FORMAT_DATE_YYYYTIRETMMTIRETDD_HHMMSS = "yyyy-MM-dd HH:mm:ss"; |
| | | public static String FORMAT_ANNEE_YYYY = "yyyy"; |
| | | public static String FORMAT_ANNEE_YY = "yy"; |
| | | |
| | | public static final String BROKER = "localhost:9092&maxRequestSize=100000000"; |
| | | |
| | | public static final String REFERENTIEL_INTEGRATION_EXCHANGE = "referentielIntegrationExchange"; |
| | | public static final String REFERENTIEL_INTEGRATION_QUEUE = "referentielIntegrationQueue"; |
| | | public static final String REFERENTIEL_INTEGRATION_ROUTING_KEY = "referentielIntegrationRoutingKey"; |
| | | |
| | | public static final String DATA_INTEGRATION_EXCHANGE = "dataIntegrationExchange"; |
| | | public static final String DATA_INTEGRATION_QUEUE = "dataIntegrationQueue"; |
| | | public static final String DATA_INTEGRATION_ROUTING_KEY = "dataIntegrationRoutingKey"; |
| | | |
| | | public static final String REMOTE_CONFIGURATION_EXCHANGE = "remoteConfigurationExchange"; |
| | | public static final String REMOTE_CONFIGURATION_QUEUE = "remoteConfigurationQueue"; |
| | | public static final String REMOTE_CONFIGURATION_ROUTING_KEY = "remoteConfigurationRoutingKey"; |
| | | |
| | | /* Variables */ |
| | | public static Map<String, String> registre_codes_http = new HashMap<>(); |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.connection; |
| | | |
| | | import java.sql.Connection; |
| | | import java.sql.SQLException; |
| | | import javax.sql.DataSource; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class DBConnection { |
| | | |
| | | private final DataSource dataSource; |
| | | |
| | | public DBConnection(DataSource dataSource) { |
| | | this.dataSource = dataSource; |
| | | } |
| | | |
| | | public Connection connection() throws SQLException { |
| | | return dataSource.getConnection(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.contrat; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public interface AppColumnDefinition { |
| | | |
| | | String name(); |
| | | |
| | | String type(); |
| | | |
| | | boolean isNull(); |
| | | |
| | | Object defaultValue(); |
| | | |
| | | default boolean isPrimaryKey() { |
| | | return false; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.contrat; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryParam; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.SQLException; |
| | | import java.sql.Timestamp; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | import javax.naming.NamingException; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class DefaultPreparedStatementProcessor implements PreparedStatementProcessor { |
| | | |
| | | private final AtomicInteger lastIndex; |
| | | |
| | | public DefaultPreparedStatementProcessor() { |
| | | lastIndex = new AtomicInteger(0); |
| | | } |
| | | |
| | | public DefaultPreparedStatementProcessor(int startIndex) { |
| | | lastIndex = new AtomicInteger(startIndex); |
| | | } |
| | | |
| | | @Override |
| | | public void process(PreparedStatement statement, List<QueryParam> queryParameters) throws NamingException, SQLException { |
| | | processStatement(statement, queryParameters); |
| | | } |
| | | |
| | | @Override |
| | | public int lastProcessedIndex() { |
| | | return lastIndex.get(); |
| | | } |
| | | |
| | | private void processStatement(PreparedStatement preparedStatement, List<QueryParam> params) throws SQLException { |
| | | |
| | | int statementIndex = 1; |
| | | |
| | | for (QueryParam parameter : params) { |
| | | |
| | | Object value = parameter.getParamValue(); |
| | | if (value instanceof String) { |
| | | preparedStatement.setString(statementIndex, value.toString()); |
| | | } else if (value instanceof Integer) { |
| | | preparedStatement.setInt(statementIndex, (Integer) value); |
| | | } else if (value instanceof Long) { |
| | | preparedStatement.setLong(statementIndex, (Long) value); |
| | | } else if (value instanceof Double) { |
| | | preparedStatement.setDouble(statementIndex, (Double) value); |
| | | } else if (value instanceof LocalDateTime) { |
| | | preparedStatement.setTimestamp(statementIndex, Timestamp.valueOf((LocalDateTime) value)); |
| | | } else { |
| | | preparedStatement.setObject(statementIndex, value); |
| | | } |
| | | |
| | | statementIndex++; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.contrat; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public interface Insert { |
| | | |
| | | long insert(TypeFichierInsertMetaData insertMetaData) 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.fdxcommons.tools.database.contrat; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.JsonFdxParsedDataIterator; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface JsonInsert { |
| | | long insert(JsonFdxParsedDataIterator parsedDataIterator) 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.fdxcommons.tools.database.contrat; |
| | | |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.model.pojo.JsonTableDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.IndexColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.ParentIdColumnDefinition; |
| | | import java.sql.ResultSet; |
| | | import java.sql.ResultSetMetaData; |
| | | import java.sql.SQLException; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class JsonResultSetProcessor { |
| | | |
| | | private final ResultSet resultSet; |
| | | private final JsonTableDefinition tableDefinition; |
| | | |
| | | public JsonResultSetProcessor(ResultSet resultSet, JsonTableDefinition tableDefinition) { |
| | | this.resultSet = resultSet; |
| | | this.tableDefinition = tableDefinition; |
| | | } |
| | | |
| | | public Map<Long, Object> process() throws SQLException { |
| | | Map<Long, Object> data = new HashMap<>(); |
| | | |
| | | while (resultSet.next()) { |
| | | mergeData(resultSet, tableDefinition, data, null); |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param resSet : ligne de données à traiter |
| | | * @param tableDefinition : structure de la donnée à extraire |
| | | * @param data : données ayant été extraites lors des précédents parcours |
| | | * @param parentId : L'id du parent de la donnée |
| | | * @return : retourne les données extraites |
| | | * @throws SQLException |
| | | */ |
| | | private Object mergeData(ResultSet resSet, JsonTableDefinition tableDefinition, Map<Long, Object> data, Long parentId) throws SQLException { |
| | | Map<String, String> columnsAliasToColumnName = columnsAliasToColumnName(tableDefinition.getColumnDefs(), tableDefinition.getTableName()); |
| | | String indexAlias = columnAlias(tableDefinition.getTableName(), new IndexColumnDefinition().name()); |
| | | final Long fdxIndex = resSet.getLong(indexAlias); |
| | | |
| | | String parentIdAlias = null; |
| | | Long childParentId = null; |
| | | |
| | | if (parentId != null) { |
| | | parentIdAlias = columnAlias(tableDefinition.getTableName(), new ParentIdColumnDefinition().name()); |
| | | childParentId = resSet.getLong(parentIdAlias); |
| | | } |
| | | |
| | | if (parentId == null || parentId.equals(childParentId)) { |
| | | if (data.containsKey(fdxIndex)) { |
| | | Object obj = data.get(fdxIndex); |
| | | Map map = (Map) obj; |
| | | |
| | | for (JsonTableDefinition t : tableDefinition.getTablesDefinition()) { |
| | | Object ob = (Map) map.get(t.getParentFieldName()); |
| | | Map<Long, Object> m = new HashMap<>(); |
| | | |
| | | if (ob != null) { |
| | | m = (Map) ob; |
| | | } |
| | | map.put(t.getParentFieldName(), mergeData(resSet, t, m, fdxIndex)); |
| | | data.put(fdxIndex, map); |
| | | } |
| | | |
| | | } else { |
| | | Map<String, Object> simpleData = simpleData = retrieveData(resSet, columnsAliasToColumnName); |
| | | data.put(fdxIndex, simpleData); |
| | | |
| | | for (JsonTableDefinition t : tableDefinition.getTablesDefinition()) { |
| | | String newParentIdAlias = columnAlias(t.getTableName(), new ParentIdColumnDefinition().name()); |
| | | Long newChildParentId = resSet.getLong(newParentIdAlias); |
| | | |
| | | if (newChildParentId.equals(fdxIndex)) { |
| | | Map<Long, Object> m = new HashMap<>(); |
| | | mergeData(resSet, t, m, fdxIndex); |
| | | simpleData.put(t.getParentFieldName(), m); |
| | | } |
| | | } |
| | | |
| | | return data; |
| | | } |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Extraction des données simples d'un objet |
| | | * |
| | | * @param resultSet |
| | | * @param columnsAliasToColumnName |
| | | * @return |
| | | * @throws SQLException |
| | | */ |
| | | private Map<String, Object> retrieveData(ResultSet resultSet, Map<String, String> columnsAliasToColumnName) throws SQLException { |
| | | ResultSetMetaData metaData = resultSet.getMetaData(); |
| | | int columnCount = metaData.getColumnCount(); |
| | | Map<String, Object> selectResult = new HashMap<>(); |
| | | |
| | | for (int i = 1; i <= columnCount; i++) { |
| | | if (columnsAliasToColumnName.containsKey(metaData.getColumnName(i).trim().toLowerCase())) { |
| | | selectResult.put(columnsAliasToColumnName.get(metaData.getColumnName(i).trim().toLowerCase()), resultSet.getObject(i)); |
| | | } |
| | | } |
| | | return selectResult; |
| | | } |
| | | |
| | | /** |
| | | * Méthode qui associe chaque alias de colonne au nom réel de colonne |
| | | * |
| | | * @param columnsDef |
| | | * @param tableName : table |
| | | * @return |
| | | */ |
| | | private Map<String, String> columnsAliasToColumnName(List<ColumnDefinition> columnsDef, String tableName) { |
| | | Map<String, String> columnsAliasToColumnName = new HashMap<>(); |
| | | |
| | | columnsDef.stream().forEach(c -> { |
| | | columnsAliasToColumnName.put(columnAlias(tableName, c.getName()), c.getName()); |
| | | }); |
| | | columnsAliasToColumnName.put(columnAlias(tableName, new IndexColumnDefinition().name()), new IndexColumnDefinition().name()); |
| | | columnsAliasToColumnName.put(columnAlias(tableName, new ParentIdColumnDefinition().name()), new ParentIdColumnDefinition().name()); |
| | | return columnsAliasToColumnName; |
| | | } |
| | | |
| | | private String columnAlias(String tableName, String columnName) { |
| | | return (tableName + "_" + columnName).toLowerCase(); |
| | | } |
| | | } |
| 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.fdxcommons.tools.database.contrat; |
| | | |
| | | import com.megatim.fdxcommons.model.pojo.JsonTableDefinition; |
| | | import com.megatim.fdxcommons.model.enumeration.TypeDonnee; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.model.integration.json.JsonStructure; |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class JsonStructureIterator { |
| | | |
| | | private final JsonStructure jsonStructure; |
| | | private final String tableName; |
| | | |
| | | public JsonStructureIterator(String tableName, JsonStructure jsonStructure) { |
| | | this.jsonStructure = jsonStructure; |
| | | this.tableName = tableName; |
| | | } |
| | | |
| | | /** |
| | | * ColumnDefinition mais avec le nom complet de la colonne (exples : |
| | | * adresse.ville, cpteBanque.rib pour les colonnes de niveau 2) |
| | | * |
| | | * @return |
| | | */ |
| | | public List<ColumnDefinition> columnsDefinitionWithFullQualifiedName() { |
| | | List<ColumnDefinition> columnsDefinition = new ArrayList<>(); |
| | | |
| | | List<JsonStructure> fields = jsonStructure.getFields(); |
| | | List<JsonStructure> fieldsWithoutParent = fields.stream().filter(f -> !f.getTypeDonnee().equals(TypeDonnee.OBJET)).collect(Collectors.toList()); |
| | | List<JsonStructure> fieldsWithParent = fields.stream().filter(f -> f.getTypeDonnee().equals(TypeDonnee.OBJET)).collect(Collectors.toList()); |
| | | |
| | | columnsDefinition.addAll(columnsDefinitionWithFullQualifiedName(fieldsWithoutParent, "")); |
| | | fieldsWithParent.stream().forEach(j -> columnsDefinition.addAll(columnsDefinitionWithFullQualifiedName(j, ""))); |
| | | |
| | | return columnsDefinition; |
| | | } |
| | | |
| | | public JsonTableDefinition tableDefinition() throws SQLException { |
| | | List<JsonStructure> fields = jsonStructure.getFields(); |
| | | |
| | | List<JsonStructure> simpleFields = fields.stream().filter(f -> !f.isCollection() && !f.getTypeDonnee().equals(TypeDonnee.OBJET)).collect(Collectors.toList()); |
| | | JsonTableDefinition tableDefinition = new JsonTableDefinition(tableName.toLowerCase(), columnsDefinition(simpleFields), null, ""); |
| | | |
| | | List<JsonStructure> objectFields = fields.stream().filter(f -> f.isCollection() || f.getTypeDonnee().equals(TypeDonnee.OBJET)).collect(Collectors.toList()); |
| | | |
| | | for (JsonStructure j : objectFields) { |
| | | tableDefinition.getTablesDefinition().add(tableDefinition(j, tableName, j.getName())); |
| | | } |
| | | return tableDefinition; |
| | | } |
| | | |
| | | private List<ColumnDefinition> columnsDefinitionWithFullQualifiedName(JsonStructure jsonStructure, String parentFullQualifiedName) { |
| | | List<ColumnDefinition> columnsDefinition = new ArrayList<>(); |
| | | |
| | | for (JsonStructure j : jsonStructure.getFields()) { |
| | | if (j.getTypeDonnee().equals(TypeDonnee.OBJET)) { |
| | | if (parentFullQualifiedName.isEmpty()) { |
| | | columnsDefinition.addAll(columnsDefinitionWithFullQualifiedName(j, jsonStructure.getName())); |
| | | } else { |
| | | columnsDefinition.addAll(columnsDefinitionWithFullQualifiedName(j, parentFullQualifiedName + "." + jsonStructure.getName())); |
| | | } |
| | | } else { |
| | | if (parentFullQualifiedName.isEmpty()) { |
| | | columnsDefinition.add(columnDefinitionWithFullQualifiedName(j, jsonStructure.getName())); |
| | | } else { |
| | | columnsDefinition.add(columnDefinitionWithFullQualifiedName(j, parentFullQualifiedName + "." + jsonStructure.getName())); |
| | | } |
| | | |
| | | } |
| | | } |
| | | return columnsDefinition; |
| | | } |
| | | |
| | | private JsonTableDefinition tableDefinition(JsonStructure jsonStruct, String parentTableName, String parentFieldName) { |
| | | JsonTableDefinition tableDef = null; |
| | | |
| | | if (jsonStruct.getTypeDonnee().equals(TypeDonnee.OBJET)) { |
| | | List<JsonStructure> simpleFields = jsonStruct.getFields().stream().filter(f -> !f.isCollection() && !f.getTypeDonnee().equals(TypeDonnee.OBJET)).collect(Collectors.toList()); |
| | | tableDef = new JsonTableDefinition((parentTableName + "_" + jsonStruct.getName()).toLowerCase(), columnsDefinition(simpleFields), parentTableName.toLowerCase(), parentFieldName); |
| | | |
| | | List<JsonStructure> objectFields = jsonStruct.getFields().stream().filter(f -> f.isCollection() || f.getTypeDonnee().equals(TypeDonnee.OBJET)).collect(Collectors.toList()); |
| | | |
| | | for (JsonStructure j : objectFields) { |
| | | String newParentTableName = parentTableName.isEmpty() ? jsonStruct.getName() : parentTableName + "_" + jsonStruct.getName(); |
| | | String newParentFieldName = parentFieldName.isEmpty() ? jsonStruct.getName() : parentFieldName + "." + j.getName(); |
| | | tableDef.getTablesDefinition().add(tableDefinition(j, newParentTableName, newParentFieldName)); |
| | | } |
| | | } else if (jsonStruct.isCollection()) { |
| | | tableDef = new JsonTableDefinition((parentTableName + "_" + jsonStruct.getName()).toLowerCase(), columnsDefinition(Arrays.asList(jsonStruct)), parentTableName.toLowerCase(), parentFieldName); |
| | | } |
| | | return tableDef; |
| | | } |
| | | |
| | | private List<ColumnDefinition> columnsDefinition(List<JsonStructure> fields) { |
| | | List<ColumnDefinition> columnsDefinition = new ArrayList<>(); |
| | | fields.stream().forEach(f -> columnsDefinition.add(new ColumnDefinition(f.getName(), f.getTypeDonnee().name(), f.getLengthh(), f.isRequired(), f.isCollection()))); |
| | | |
| | | return columnsDefinition; |
| | | } |
| | | |
| | | private List<ColumnDefinition> columnsDefinitionWithFullQualifiedName(List<JsonStructure> fields, String parentFullQualifiedName) { |
| | | List<ColumnDefinition> columnsDefinition = new ArrayList<>(); |
| | | fields.stream().forEach(f -> { |
| | | if (parentFullQualifiedName.isEmpty()) { |
| | | columnsDefinition.add(new ColumnDefinition(f.getName(), f.getTypeDonnee().name(), f.getLengthh(), f.isRequired(), f.isCollection())); |
| | | } else { |
| | | columnsDefinition.add(new ColumnDefinition(parentFullQualifiedName + "." + f.getName(), f.getTypeDonnee().name(), f.getLengthh(), f.isRequired(), f.isCollection())); |
| | | } |
| | | } |
| | | ); |
| | | |
| | | return columnsDefinition; |
| | | } |
| | | |
| | | private ColumnDefinition columnDefinitionWithFullQualifiedName(JsonStructure f, String parentFullQualifiedName) { |
| | | if (parentFullQualifiedName.isEmpty()) { |
| | | return new ColumnDefinition(f.getName(), f.getTypeDonnee().name(), f.getLengthh(), f.isRequired(), f.isCollection()); |
| | | } else { |
| | | return new ColumnDefinition(parentFullQualifiedName + "." + f.getName(), f.getTypeDonnee().name(), f.getLengthh(), f.isRequired(), f.isCollection()); |
| | | } |
| | | |
| | | } |
| | | } |
| 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.fdxcommons.tools.database.contrat; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface JsonTypeFichierDataRow { |
| | | |
| | | List<TypeFichierDataColumn> columns() throws Exception; |
| | | |
| | | List<JsonTypeFichierDataRow> children(); |
| | | } |
| 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.fdxcommons.tools.database.contrat; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public interface JsonTypeFichierInsertMetaData { |
| | | |
| | | String tableName(); |
| | | |
| | | TypeFichierDataRow row() throws Exception; |
| | | |
| | | List<String> columnNames() throws Exception; |
| | | |
| | | List<JsonTypeFichierInsertMetaData> children() throws Exception; |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.contrat; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryParam; |
| | | import java.sql.PreparedStatement; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public interface PreparedStatementProcessor { |
| | | |
| | | void process(PreparedStatement statement, List<QueryParam> queryParameters) throws Exception; |
| | | |
| | | int lastProcessedIndex(); |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.contrat; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public interface QueryMetaData<T> { |
| | | |
| | | T execute() 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.fdxcommons.tools.database.contrat; |
| | | |
| | | import com.megatim.fdxcommons.model.pojo.JsonTableDefinition; |
| | | import java.sql.ResultSet; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class ResultSetExtractor { |
| | | |
| | | private final ResultSet resultSet; |
| | | private final JsonTableDefinition tableDefinition; |
| | | private SimpleData data; |
| | | private final List<ResultSetExtractor> resultSetsExtractor = new ArrayList<>(); |
| | | |
| | | public ResultSetExtractor(ResultSet resultSet, JsonTableDefinition tableDefinition) { |
| | | this.resultSet = resultSet; |
| | | this.tableDefinition = tableDefinition; |
| | | } |
| | | |
| | | public ResultSet getResultSet() { |
| | | return resultSet; |
| | | } |
| | | |
| | | public JsonTableDefinition getTableDefinition() { |
| | | return tableDefinition; |
| | | } |
| | | |
| | | public SimpleData getData() { |
| | | return data; |
| | | } |
| | | |
| | | public void setData(SimpleData data) { |
| | | this.data = data; |
| | | } |
| | | |
| | | public List<ResultSetExtractor> getResultSetsExtractor() { |
| | | return resultSetsExtractor; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.contrat; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.tables.FdxTableRow; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public interface Select { |
| | | |
| | | List<FdxTableRow> rows() 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.fdxcommons.tools.database.contrat; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class SimpleData { |
| | | private final Long index; |
| | | private final Map<String, Object> data; |
| | | |
| | | public SimpleData(Long index, Map<String, Object> data) { |
| | | this.index = index; |
| | | this.data = data; |
| | | } |
| | | |
| | | public Long getIndex() { |
| | | return index; |
| | | } |
| | | |
| | | public Map<String, Object> getData() { |
| | | return data; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "SimpleData{" + "index=" + index + ", data=" + data + '}'; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.contrat; |
| | | |
| | | import java.sql.Connection; |
| | | import java.sql.SQLException; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public interface TableName { |
| | | |
| | | String name(Connection connection) throws SQLException; |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.contrat; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public interface TypeFichierDataColumn { |
| | | |
| | | String column(); |
| | | |
| | | Object value() throws Exception; |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.contrat; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public interface TypeFichierDataRow { |
| | | |
| | | List<TypeFichierDataColumn> columns() throws Exception; |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.contrat; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public interface TypeFichierInsertMetaData { |
| | | |
| | | String tableName(); |
| | | |
| | | List<TypeFichierDataRow> rows() throws Exception; |
| | | |
| | | List<String> columnNames() throws Exception; |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.contrat; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public interface TypeFichierUpdateMetaData { |
| | | |
| | | String tableName(); |
| | | |
| | | TypeFichierDataRow row() throws Exception; |
| | | |
| | | List<String> columnNames() throws Exception; |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.exceptions; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class BadColumnTypeException extends Exception { |
| | | public BadColumnTypeException(String message) { |
| | | super(message); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.exceptions; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class BadDataValueException extends Exception { |
| | | |
| | | public BadDataValueException(String message) { |
| | | super(message); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.exceptions; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class BadQueryCriteriaException extends Exception { |
| | | public BadQueryCriteriaException(String message) { |
| | | super(message); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.exceptions; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class ColumnNotFoundException extends Exception { |
| | | |
| | | public ColumnNotFoundException(String message) { |
| | | super(message); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.exceptions; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class LocalDateTimeValueParseError extends Exception { |
| | | |
| | | public LocalDateTimeValueParseError(String message) { |
| | | super(message); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.exceptions; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class MoreThanOneTableDataNotFoundException extends Exception { |
| | | public MoreThanOneTableDataNotFoundException(String message) { |
| | | super(message); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.exceptions; |
| | | |
| | | import javax.ws.rs.WebApplicationException; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class TableDataNotFoundException extends WebApplicationException { |
| | | public TableDataNotFoundException(String message) { |
| | | super(message); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.exceptions; |
| | | |
| | | import javax.ws.rs.WebApplicationException; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class TableNotCummulativeException extends WebApplicationException { |
| | | public TableNotCummulativeException(String message) { |
| | | super(message); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.exceptions; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class TypeFichierDataBadRequest extends Exception { |
| | | |
| | | public TypeFichierDataBadRequest(String message) { |
| | | super(message); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.FonctionAggregation; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryCriterion; |
| | | import com.megatim.fdxcommons.tools.database.contrat.DefaultPreparedStatementProcessor; |
| | | import com.megatim.fdxcommons.tools.database.contrat.QueryMetaData; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.WhereQueryParameters; |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.IntStream; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class AggregationQuery implements QueryMetaData<List<String[]>> { |
| | | |
| | | private final String tableName; |
| | | private final Connection connection; |
| | | private final QueryCriterion queryCriterion; |
| | | private final String targetColumn; |
| | | private final FonctionAggregation fonctionAggregation; |
| | | private final List<String> groupingColumns; |
| | | |
| | | public AggregationQuery(String tableName, Connection connection, QueryCriterion queryCriterion, String targetColumn, List<String> groupingColumns, FonctionAggregation fonctionAggregation) { |
| | | this.tableName = tableName; |
| | | this.targetColumn = targetColumn; |
| | | this.connection = connection; |
| | | this.queryCriterion = queryCriterion; |
| | | this.groupingColumns = groupingColumns; |
| | | this.fonctionAggregation = fonctionAggregation; |
| | | } |
| | | |
| | | @Override |
| | | public List<String[]> execute() throws Exception { |
| | | |
| | | System.out.println("<------------------------------------------------------------------------------------------------------------------------------->"); |
| | | System.out.println(aggregationQuery()); |
| | | System.out.println("<------------------------------------------------------------------------------------------------------------------------------->"); |
| | | |
| | | try (PreparedStatement statement = connection.prepareStatement(aggregationQuery())) { |
| | | |
| | | new DefaultPreparedStatementProcessor().process(statement, new WhereQueryParameters(queryCriterion).parameters()); |
| | | |
| | | try ( ResultSet resultSet = statement.executeQuery()) { |
| | | |
| | | List<String[]> results = new ArrayList<>(); |
| | | |
| | | while (resultSet.next()) { |
| | | |
| | | String[] result = new String[groupingColumns.size() + 1]; |
| | | result[0] = resultSet.getString(aggregationColumnName()); |
| | | for (int i = 0; i < groupingColumns.size(); i++) { |
| | | String r = resultSet.getString(groupingColumns.get(i)); |
| | | result[i + 1] = r != null ? r : ""; |
| | | } |
| | | |
| | | results.add(result); |
| | | } |
| | | |
| | | return results; |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | private String aggregationQuery() { |
| | | StringBuilder query = new StringBuilder("SELECT COALESCE(" + fonctionAggregation.toString() + "(" + targetColumn + "), 0) AS " + aggregationColumnName() |
| | | + groupingColumnsSelection() + " FROM ").append(tableName); |
| | | query.append(new WhereQueryString(queryCriterion).query()); |
| | | query.append(new GroupByQuery(groupingColumns).query()); |
| | | return query.toString(); |
| | | } |
| | | |
| | | private String aggregationColumnName() { |
| | | return tableName + "_" + fonctionAggregation.toString(); |
| | | } |
| | | |
| | | private String groupingColumnsSelection() { |
| | | StringBuilder query = new StringBuilder(); |
| | | |
| | | int size = groupingColumns.size(); |
| | | if (size > 0) { |
| | | query.append(", "); |
| | | } |
| | | IntStream.range(0, size).forEach(index -> { |
| | | String column = groupingColumns.get(index); |
| | | query.append(column); |
| | | if ((index + 1) < size) { |
| | | query.append(","); |
| | | } |
| | | }); |
| | | |
| | | return query.toString(); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryCriterion; |
| | | import com.megatim.fdxcommons.tools.database.contrat.DefaultPreparedStatementProcessor; |
| | | import com.megatim.fdxcommons.tools.database.contrat.QueryMetaData; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.WhereQueryParameters; |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.IntStream; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class CountQuery implements QueryMetaData<List<String[]>> { |
| | | |
| | | private final String tableName; |
| | | private final Connection connection; |
| | | private final QueryCriterion queryCriterion; |
| | | private final List<String> groupingColumns; |
| | | |
| | | public CountQuery(String tableName, Connection connection, QueryCriterion queryCriterion, List<String> groupingColumns) { |
| | | this.tableName = tableName; |
| | | this.connection = connection; |
| | | this.queryCriterion = queryCriterion; |
| | | this.groupingColumns = groupingColumns; |
| | | } |
| | | |
| | | @Override |
| | | public List<String[]> execute() throws Exception { |
| | | |
| | | System.out.println("<------------------------------------------------------------------------------------------------------------------------------->"); |
| | | System.out.println(countQuery()); |
| | | System.out.println("<------------------------------------------------------------------------------------------------------------------------------->"); |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(countQuery())) { |
| | | |
| | | new DefaultPreparedStatementProcessor().process(statement, new WhereQueryParameters(queryCriterion).parameters()); |
| | | |
| | | try ( ResultSet resultSet = statement.executeQuery()) { |
| | | |
| | | List<String[]> results = new ArrayList<>(); |
| | | |
| | | while (resultSet.next()) { |
| | | |
| | | String[] result = new String[groupingColumns.size() + 1]; |
| | | result[0] = resultSet.getString(countColumnName()); |
| | | for (int i = 0; i < groupingColumns.size(); i++) { |
| | | |
| | | String r = resultSet.getString(groupingColumns.get(i)); |
| | | result[i + 1] = r != null ? r : ""; |
| | | } |
| | | |
| | | results.add(result); |
| | | } |
| | | |
| | | return results; |
| | | } |
| | | } |
| | | } |
| | | |
| | | private String countQuery() { |
| | | StringBuilder query = new StringBuilder("SELECT COUNT(*) AS " + countColumnName() + groupingColumnsSelection() + " FROM ").append(tableName); |
| | | query.append(new WhereQueryString(queryCriterion).query()); |
| | | |
| | | query.append(new GroupByQuery(groupingColumns).query()); |
| | | return query.toString(); |
| | | } |
| | | |
| | | private String countColumnName() { |
| | | return tableName + "_count"; |
| | | } |
| | | |
| | | private String groupingColumnsSelection() { |
| | | StringBuilder query = new StringBuilder(); |
| | | |
| | | int size = groupingColumns.size(); |
| | | if (size > 0) { |
| | | query.append(", "); |
| | | } |
| | | IntStream.range(0, size).forEach(index -> { |
| | | String column = groupingColumns.get(index); |
| | | query.append(column); |
| | | if ((index + 1) < size) { |
| | | query.append(","); |
| | | } |
| | | }); |
| | | |
| | | return query.toString(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.model.dataproduction.CommonDataProduction; |
| | | import com.megatim.fdxcommons.tools.database.contrat.QueryMetaData; |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.sql.Timestamp; |
| | | import javax.naming.NamingException; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class CreateDataProductionQuery implements QueryMetaData<Long> { |
| | | |
| | | private final CommonDataProduction dataProduction; |
| | | private final Connection connection; |
| | | |
| | | public CreateDataProductionQuery(CommonDataProduction dataProduction, Connection connection) { |
| | | this.dataProduction = dataProduction; |
| | | this.connection = connection; |
| | | } |
| | | |
| | | private String queryString() { |
| | | return "INSERT INTO dataproduction(id, dateproduction, referentielversion, codetypefichier, codeparticipant, source, filename, statutdataproduction, filedate, dataProductionType, token, nbreElements, tailleFichier, tokenDirectory)" |
| | | + " VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
| | | } |
| | | |
| | | @Override |
| | | public Long execute() throws NamingException, SQLException { |
| | | |
| | | System.out.println("<-------------------------------------------------------------------------->"); |
| | | System.out.println(queryString()); |
| | | System.out.println("<-------------------------------------------------------------------------->"); |
| | | |
| | | String getNextIdQuery = "SELECT nextval('SEQ_DATA_PRODUCTION')"; |
| | | |
| | | try ( |
| | | PreparedStatement statement = connection.prepareStatement(queryString()); PreparedStatement getIdStatement = connection.prepareStatement(getNextIdQuery);// Fetch the next sequence value |
| | | ) { |
| | | |
| | | long generatedId = dataProduction.getId() != null ? dataProduction.getId() : 0; |
| | | |
| | | if (dataProduction.getId() == null || dataProduction.getId() <= 0) {//Si l'id de la production n'est pas encore initialisé (FdxApi) |
| | | ResultSet resultSet = getIdStatement.executeQuery(); |
| | | if (resultSet.next()) { |
| | | generatedId = resultSet.getLong(1); |
| | | } |
| | | } |
| | | |
| | | statement.setLong(1, generatedId); |
| | | statement.setTimestamp(2, dataProduction.getDateProduction() != null ? Timestamp.valueOf(dataProduction.getDateProduction()) : null); |
| | | statement.setString(3, dataProduction.getReferentielVersion()); |
| | | statement.setString(4, dataProduction.getCodeTypeFichier()); |
| | | statement.setString(5, dataProduction.getCodeParticipant()); |
| | | statement.setString(6, dataProduction.getSource().name()); |
| | | statement.setString(7, dataProduction.getFileName()); |
| | | statement.setString(8, dataProduction.getStatutDataProduction().name()); |
| | | statement.setTimestamp(9, dataProduction.getFileDate() != null ? Timestamp.valueOf(dataProduction.getFileDate()) : null); |
| | | statement.setString(10, dataProduction.getDataProductionType().name()); |
| | | statement.setString(11, dataProduction.getToken()); |
| | | statement.setLong(12, dataProduction.getNbreElements()); |
| | | statement.setLong(13, dataProduction.getTailleFichier()); |
| | | statement.setString(14, dataProduction.getTokenDirectory()); |
| | | |
| | | statement.executeUpdate(); |
| | | |
| | | return generatedId; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.TypeDonnee; |
| | | import static com.megatim.fdxcommons.model.enumeration.TypeDonnee.ALPHANUMERIQUE; |
| | | import static com.megatim.fdxcommons.model.enumeration.TypeDonnee.DATE; |
| | | import static com.megatim.fdxcommons.model.enumeration.TypeDonnee.DECIMAL; |
| | | import static com.megatim.fdxcommons.model.enumeration.TypeDonnee.NUMERIQUE; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.contrat.AppColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.contrat.QueryMetaData; |
| | | import com.megatim.fdxcommons.tools.database.contrat.TableName; |
| | | import com.megatim.fdxcommons.tools.database.exceptions.BadColumnTypeException; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.AppColumnDefinitions; |
| | | import java.sql.Connection; |
| | | import java.sql.JDBCType; |
| | | import java.sql.SQLException; |
| | | import java.sql.Statement; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import javax.naming.NamingException; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class CreateTableIfNotExistQuery implements QueryMetaData<Void> { |
| | | |
| | | private final Connection connection; |
| | | private final AppColumnDefinitions appColumnDefinitions; |
| | | private final TableName tableName; |
| | | private final List<ColumnDefinition> columnDefinitions; |
| | | |
| | | public CreateTableIfNotExistQuery( |
| | | TableName tableName, |
| | | List<ColumnDefinition> columnDefinitions, |
| | | AppColumnDefinitions appColumnDefinitions, |
| | | Connection connection |
| | | ) { |
| | | this.connection = connection; |
| | | this.appColumnDefinitions = appColumnDefinitions; |
| | | this.tableName = tableName; |
| | | this.columnDefinitions = columnDefinitions; |
| | | } |
| | | |
| | | @Override |
| | | public Void execute() throws SQLException, NamingException, BadColumnTypeException { |
| | | |
| | | String query = query(tableName, columnDefinitions); |
| | | |
| | | try ( Statement stmt = connection.createStatement()) { |
| | | stmt.execute(query); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | private String query(TableName tableName, List<ColumnDefinition> columns) throws BadColumnTypeException, SQLException { |
| | | |
| | | StringBuilder query = new StringBuilder("CREATE TABLE IF NOT EXISTS " + tableName.name(connection) + "("); |
| | | List<AppColumnDefinition> primaryKeys = new ArrayList<>(); |
| | | |
| | | //Ordonner les colonnes par ordre croissant des positions, afin de les insérer dans cet ordre |
| | | Collections.sort(columns, (ColumnDefinition c1, ColumnDefinition c2) -> Integer.valueOf(c1.getPosition()).compareTo(c2.getPosition())); |
| | | |
| | | for (ColumnDefinition columnDefinition : columns) { |
| | | query.append(columnDefinition.getName().toLowerCase()).append(" ").append(sqlColumnType(columnDefinition)).append(", "); |
| | | } |
| | | |
| | | for (AppColumnDefinition appColumnDefinition : appColumnDefinitions.appColumns()) { |
| | | query.append(columnDefinitonString(appColumnDefinition)).append(", "); |
| | | |
| | | if (appColumnDefinition.isPrimaryKey()) { |
| | | primaryKeys.add(appColumnDefinition); |
| | | } |
| | | } |
| | | if (!primaryKeys.isEmpty()) { |
| | | query.append(" PRIMARY KEY("); |
| | | primaryKeys.stream().forEach(pk -> query.append(pk.name()).append(", ")); |
| | | |
| | | //Retirer la dernière virgule |
| | | query.replace(query.length() - 2, query.length(), "));"); |
| | | } else { |
| | | //Retirer la dernière virgule |
| | | query.replace(query.length() - 2, query.length(), ");"); |
| | | } |
| | | |
| | | return query.toString(); |
| | | } |
| | | |
| | | private String sqlColumnType(ColumnDefinition column) throws BadColumnTypeException { |
| | | switch (TypeDonnee.fromValeur(column.getTypeDonnee())) { |
| | | case ALPHANUMERIQUE: |
| | | return jdbcType(column) + "(" + column.getTaille() + ")"; |
| | | case NUMERIQUE: |
| | | return jdbcType(column).getName(); |
| | | case DATE: |
| | | return jdbcType(column).getName() + " NULL"; |
| | | case DECIMAL: |
| | | return jdbcType(column) + "(" + column.getTaille() + "," + column.getTaillePartieDecimale() + ")"; |
| | | } |
| | | throw new BadColumnTypeException("Type de colonne incorrect " + column.getTypeDonnee()); |
| | | } |
| | | |
| | | private JDBCType jdbcType(ColumnDefinition column) throws BadColumnTypeException { |
| | | switch (TypeDonnee.fromValeur(column.getTypeDonnee())) { |
| | | case NUMERIQUE: |
| | | return column.getTaille() < 5 ? JDBCType.SMALLINT : JDBCType.BIGINT; |
| | | case DECIMAL: |
| | | return JDBCType.DECIMAL; |
| | | case DATE: |
| | | return JDBCType.TIMESTAMP; |
| | | case ALPHANUMERIQUE: |
| | | return JDBCType.VARCHAR; |
| | | } |
| | | throw new BadColumnTypeException("Type de colonne incorrect " + column.getName()); |
| | | } |
| | | |
| | | private String columnDefinitonString(AppColumnDefinition column) throws BadColumnTypeException { |
| | | StringBuilder definition = new StringBuilder(); |
| | | definition |
| | | .append(column.name().toLowerCase()) |
| | | .append(" ") |
| | | .append(column.type()) |
| | | .append(" ") |
| | | .append(column.isNull() ? "NULL " : "NOT NULL "); |
| | | if (column.defaultValue() != null) { |
| | | definition |
| | | .append("DEFAULT ") |
| | | .append(column.defaultValue()); |
| | | } |
| | | return definition.toString(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.contrat.QueryMetaData; |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class CurrentDataProductionQuery implements QueryMetaData<Long> { |
| | | |
| | | private final String codeTypeFichier; |
| | | private final String referentielVersion; |
| | | private final Connection connection; |
| | | |
| | | public CurrentDataProductionQuery(String codeTypeFichier, String referentielVersion, Connection connection) { |
| | | this.codeTypeFichier = codeTypeFichier; |
| | | this.referentielVersion = referentielVersion; |
| | | this.connection = connection; |
| | | } |
| | | |
| | | @Override |
| | | public Long execute() throws Exception { |
| | | String query = "SELECT MAX(id) FROM dataproduction WHERE codetypefichier = ? AND referentielversion = ?"; |
| | | Long id = null; |
| | | |
| | | try (PreparedStatement statement = connection.prepareStatement(query);) { |
| | | |
| | | statement.setString(1, codeTypeFichier); |
| | | statement.setString(2, referentielVersion); |
| | | ResultSet resultSet = statement.executeQuery(); |
| | | |
| | | if (resultSet.next()) { |
| | | id = resultSet.getLong(1); |
| | | } |
| | | } |
| | | return 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.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.model.dataproduction.CommonDataProduction; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.DataProductionIdColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.IndexColumnDefinition; |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class CustomQueries { |
| | | |
| | | public Long selectMinIndexOfDataProduction(Long dataProdcutionId, String tableName, Connection connection) throws SQLException { |
| | | String query = "SELECT MIN(" + new IndexColumnDefinition().name() + ")" |
| | | + " FROM " + tableName |
| | | + " WHERE " + new DataProductionIdColumnDefinition().name() + " = " + dataProdcutionId; |
| | | Long min = null; |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(query); ResultSet resultSet = statement.executeQuery()) { |
| | | while (resultSet.next()) { |
| | | min = resultSet.getLong(1); |
| | | } |
| | | } |
| | | return min; |
| | | } |
| | | |
| | | public boolean fdxIndexExists(Long index, String tableName, Connection connection) throws SQLException { |
| | | String query = "SELECT * FROM " + tableName + " WHERE " + new IndexColumnDefinition().name() + " = ?"; |
| | | |
| | | boolean exists = false; |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(query);) { |
| | | statement.setLong(1, index); |
| | | ResultSet resultSet = statement.executeQuery(); |
| | | |
| | | if (resultSet.next()) { |
| | | exists = true; |
| | | } |
| | | } |
| | | return exists; |
| | | } |
| | | |
| | | public void deleteWhereIndexLowerThan(Long fdx_index, String tableName, Connection connection) throws SQLException { |
| | | String query = "DELETE FROM " + tableName + " WHERE " + new IndexColumnDefinition().name() + " < ?"; |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(query);) { |
| | | statement.setLong(1, fdx_index); |
| | | |
| | | statement.executeUpdate(); |
| | | } |
| | | } |
| | | |
| | | public Long countDataproductionElements(String token, Connection connection) throws SQLException { |
| | | String query = "SELECT COUNT(*) FROM " + CommonDataProduction.class.getSimpleName() + " WHERE token = ?"; |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(query);) { |
| | | statement.setString(1, token); |
| | | ResultSet result = statement.executeQuery(); |
| | | |
| | | result.next(); |
| | | return result.getLong(1); |
| | | } |
| | | } |
| | | |
| | | public List<Long> indexes(Long productionId, Connection connection) throws SQLException { |
| | | String query = "SELECT indexes FROM productionMetaData_indexes WHERE productionId = ? ORDER BY indexes"; |
| | | List<Long> indexes = new ArrayList<>(); |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(query);) { |
| | | statement.setLong(1, productionId); |
| | | ResultSet resultSet = statement.executeQuery(); |
| | | |
| | | while (resultSet.next()) { |
| | | indexes.add(resultSet.getLong(1)); |
| | | } |
| | | } |
| | | return indexes; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.model.dataproduction.CommonDataProduction; |
| | | import com.megatim.fdxcommons.tools.database.contrat.QueryMetaData; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.*; |
| | | |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.Timestamp; |
| | | |
| | | public class DataWithTokenToDataProductionQuery implements QueryMetaData<Void> { |
| | | |
| | | private final Connection connection; |
| | | private final CommonDataProduction dataProduction; |
| | | private final String token; |
| | | private final String tableName; |
| | | |
| | | public DataWithTokenToDataProductionQuery(Connection connection, CommonDataProduction dataProduction, String token, String tableName) { |
| | | this.connection = connection; |
| | | this.dataProduction = dataProduction; |
| | | this.token = token; |
| | | this.tableName = tableName; |
| | | } |
| | | |
| | | @Override |
| | | public Void execute() throws Exception { |
| | | |
| | | String query = "UPDATE " + tableName + " SET " + new DataProductionIdColumnDefinition().name() + " = ?, " + new DateCreationColumnDefinition().name() + " = ?, " |
| | | + new TokenColumnDefinition().name() + " = ?" + " WHERE " + new TokenColumnDefinition().name() + " = ?"; |
| | | |
| | | try (PreparedStatement stmt = connection.prepareStatement(query)) { |
| | | stmt.setLong(1, dataProduction.getId()); |
| | | stmt.setTimestamp(2, Timestamp.valueOf(dataProduction.getDateProduction())); |
| | | stmt.setString(3, null); |
| | | stmt.setString(4, token); |
| | | stmt.executeUpdate(); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.model.dataproduction.CommonDataProduction; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryCriterion; |
| | | import com.megatim.fdxcommons.tools.database.contrat.DefaultPreparedStatementProcessor; |
| | | import com.megatim.fdxcommons.tools.database.contrat.QueryMetaData; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryParam; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.WhereQueryParameters; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.DataProductionUpdateIdColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.DateMiseAJourColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.DeletedColumnDefinition; |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class DeleteQuery implements QueryMetaData<Void> { |
| | | |
| | | private final Connection connection; |
| | | private final QueryCriterion queryCriterion; |
| | | private final String tableName; |
| | | private final CommonDataProduction dataProduction; |
| | | |
| | | public DeleteQuery(String tableName, Connection connection, QueryCriterion queryCriterion, CommonDataProduction dataProduction) { |
| | | this.connection = connection; |
| | | this.queryCriterion = queryCriterion; |
| | | this.tableName = tableName; |
| | | this.dataProduction = dataProduction; |
| | | } |
| | | |
| | | @Override |
| | | public Void execute() throws Exception { |
| | | System.out.println("<----------------------------------------------------------------------------------------------------------->"); |
| | | System.out.println(deleteQuery()); |
| | | System.out.println("<----------------------------------------------------------------------------------------------------------->"); |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(deleteQuery())) { |
| | | connection.setAutoCommit(false); |
| | | |
| | | new DefaultPreparedStatementProcessor().process(statement, deletedParameters()); |
| | | statement.execute(); |
| | | connection.commit(); |
| | | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | private List<QueryParam> deletedParameters() throws Exception { |
| | | |
| | | List<QueryParam> params = new ArrayList<>(); |
| | | |
| | | //On ajoute les paramètres spécifiques à l'application |
| | | params.add(new QueryParam(new DeletedColumnDefinition().name(), 1)); |
| | | params.add(new QueryParam(new DataProductionUpdateIdColumnDefinition().name(), dataProduction.getId())); |
| | | params.add(new QueryParam(new DateMiseAJourColumnDefinition().name(), dataProduction.getDateProduction())); |
| | | |
| | | //On ajoute ensuite les paramètre de la clause WHERE |
| | | params.addAll(new WhereQueryParameters(queryCriterion).parameters()); |
| | | |
| | | return params; |
| | | } |
| | | |
| | | private String deleteQuery() throws Exception { |
| | | return "UPDATE " + tableName + " " + setQueryPart() + " " + new WhereQueryString(queryCriterion).query(); |
| | | } |
| | | |
| | | private String setQueryPart() throws Exception { |
| | | |
| | | List<String> columnsToUpdate = new ArrayList<>(); |
| | | |
| | | //Pendant l'update on set également certaines colonnes de l'application |
| | | columnsToUpdate.add(new DeletedColumnDefinition().name()); |
| | | columnsToUpdate.add(new DataProductionUpdateIdColumnDefinition().name()); |
| | | columnsToUpdate.add(new DateMiseAJourColumnDefinition().name()); |
| | | |
| | | StringBuilder query = new StringBuilder("SET "); |
| | | int index = 0; |
| | | |
| | | for (String column : columnsToUpdate) { |
| | | if ((index + 1) < columnsToUpdate.size()) { |
| | | query.append(column).append(" = ? ,"); |
| | | } else { |
| | | query.append(column).append(" = ?"); |
| | | } |
| | | index++; |
| | | } |
| | | return query.toString(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.contrat.DefaultPreparedStatementProcessor; |
| | | import com.megatim.fdxcommons.tools.database.contrat.QueryMetaData; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryCriterion; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.WhereQueryParameters; |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class DeleteTableDataQuery implements QueryMetaData<Void> { |
| | | |
| | | private final String tableName; |
| | | private final Connection connection; |
| | | private final QueryCriterion queryCriterion; |
| | | |
| | | public DeleteTableDataQuery(String tableName, Connection connection, QueryCriterion queryCriterion) { |
| | | this.tableName = tableName; |
| | | this.connection = connection; |
| | | this.queryCriterion = queryCriterion; |
| | | } |
| | | |
| | | @Override |
| | | public Void execute() throws Exception { |
| | | |
| | | System.out.println("<-------------------------------------------------------------------------->"); |
| | | System.out.println("DELETE FROM " + tableName); |
| | | System.out.println("<-------------------------------------------------------------------------->"); |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(deleteString())) { |
| | | new DefaultPreparedStatementProcessor().process(statement, new WhereQueryParameters(queryCriterion).parameters()); |
| | | statement.executeUpdate(); |
| | | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | private String deleteString() { |
| | | StringBuilder query = new StringBuilder("DELETE FROM "); |
| | | query |
| | | .append(tableName) |
| | | .append(new WhereQueryString(queryCriterion).query()); |
| | | |
| | | return query.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.fdxcommons.tools.database.queries; |
| | | |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.SQLException; |
| | | import java.sql.Timestamp; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class EchecIntegrationQueries { |
| | | |
| | | private final Connection connection; |
| | | private final Long dataProductionId; |
| | | |
| | | public EchecIntegrationQueries(Connection connection, Long dataProductionId) { |
| | | this.connection = connection; |
| | | this.dataProductionId = dataProductionId; |
| | | } |
| | | |
| | | public void save() throws SQLException { |
| | | String query = "INSERT INTO ECHECINTEGRATION (dataproductionid, datecreation) values(?,?)"; |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(query)) { |
| | | statement.setLong(1, dataProductionId); |
| | | statement.setTimestamp(2, Timestamp.valueOf(LocalDateTime.now())); |
| | | |
| | | statement.executeUpdate(); |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.contrat.TypeFichierInsertMetaData; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.DefaultTypeFichierDataColumn; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.DataProductionIdColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.DateCreationColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.TokenColumnDefinition; |
| | | |
| | | import java.sql.Connection; |
| | | import java.sql.SQLException; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import javax.naming.NamingException; |
| | | |
| | | /** |
| | | * @author Gabuntu |
| | | */ |
| | | public class FdxApiInsert extends FdxInsert { |
| | | |
| | | public FdxApiInsert(Connection connection, Long dataProductionId) { |
| | | super(connection, dataProductionId); |
| | | } |
| | | |
| | | @Override |
| | | public long insert(TypeFichierInsertMetaData insertMetaData) throws SQLException, NamingException, Exception { |
| | | |
| | | List<DefaultTypeFichierDataColumn> dataColumnsToAdd = dataColumnsToAdd(); |
| | | new InsertQuery(insertMetaData.tableName(), connection, dataColumnsToAdd, insertMetaData.columnNames(), insertMetaData.rows()).execute(); |
| | | |
| | | return dataProductionId; |
| | | } |
| | | |
| | | public void insert(TypeFichierInsertMetaData insertMetaData, String token) throws SQLException, NamingException, Exception { |
| | | |
| | | List<DefaultTypeFichierDataColumn> dataColumnsToAdd = Arrays.asList( |
| | | new DefaultTypeFichierDataColumn(new TokenColumnDefinition().name(), token), |
| | | new DefaultTypeFichierDataColumn(new DataProductionIdColumnDefinition().name(), 0L) |
| | | ); |
| | | |
| | | new InsertQuery(insertMetaData.tableName(), connection, dataColumnsToAdd, insertMetaData.columnNames(), insertMetaData.rows()).execute(); |
| | | |
| | | } |
| | | |
| | | private List<DefaultTypeFichierDataColumn> dataColumnsToAdd() { |
| | | return Arrays.asList( |
| | | new DefaultTypeFichierDataColumn(new DateCreationColumnDefinition().name(), LocalDateTime.now()), |
| | | new DefaultTypeFichierDataColumn(new DataProductionIdColumnDefinition().name(), dataProductionId) |
| | | ); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.contrat.TypeFichierInsertMetaData; |
| | | import java.sql.Connection; |
| | | import java.sql.SQLException; |
| | | import java.util.Arrays; |
| | | import javax.naming.NamingException; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class FdxConsultationInsert extends FdxInsert { |
| | | |
| | | public FdxConsultationInsert(Connection dbConnection, Long dataProductionId) throws SQLException { |
| | | super(dbConnection, dataProductionId); |
| | | } |
| | | |
| | | @Override |
| | | public long insert(TypeFichierInsertMetaData insertMetaData) throws SQLException, NamingException, Exception { |
| | | |
| | | new InsertQuery(insertMetaData.tableName(), connection, Arrays.asList(), insertMetaData.columnNames(), insertMetaData.rows()).execute(); |
| | | |
| | | return dataProductionId; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.contrat.Insert; |
| | | import com.megatim.fdxcommons.tools.database.contrat.TypeFichierInsertMetaData; |
| | | import java.sql.Connection; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public abstract class FdxInsert implements Insert { |
| | | |
| | | protected final Connection connection; |
| | | protected final Long dataProductionId; |
| | | |
| | | public FdxInsert(Connection connection, Long dataProductionId) { |
| | | this.connection = connection; |
| | | this.dataProductionId = dataProductionId; |
| | | } |
| | | |
| | | @Override |
| | | public abstract long insert(TypeFichierInsertMetaData insertMetaData) 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.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.model.dataproduction.CommonDataProduction; |
| | | import com.megatim.fdxcommons.tools.database.contrat.TypeFichierDataColumn; |
| | | import com.megatim.fdxcommons.tools.database.contrat.TypeFichierUpdateMetaData; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryCriterion; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryParam; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.WhereQueryParameters; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.DataProductionUpdateIdColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.DateMiseAJourColumnDefinition; |
| | | import java.sql.Connection; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class FdxUpdate { |
| | | |
| | | private final Connection connection; |
| | | private final QueryCriterion queryCriterion; |
| | | private final TypeFichierUpdateMetaData updateMetaData; |
| | | private final CommonDataProduction dataProduction; |
| | | |
| | | public FdxUpdate(Connection connection, QueryCriterion queryCriterion, TypeFichierUpdateMetaData updateMetaData, CommonDataProduction dataProduction) { |
| | | this.connection = connection; |
| | | this.queryCriterion = queryCriterion; |
| | | this.updateMetaData = updateMetaData; |
| | | this.dataProduction = dataProduction; |
| | | } |
| | | |
| | | public void update() throws Exception { |
| | | List<QueryParam> params = finalParameters(); |
| | | new UpdateQuery(connection, queryCriterion, updateMetaData.tableName(), columnNames(), params).execute(); |
| | | } |
| | | |
| | | private List<String> columnNames() throws Exception { |
| | | List<String> columNames = new ArrayList<>(); |
| | | columNames.addAll(updateMetaData.columnNames()); |
| | | columNames.add(new DataProductionUpdateIdColumnDefinition().name()); |
| | | columNames.add(new DateMiseAJourColumnDefinition().name()); |
| | | |
| | | return columNames; |
| | | } |
| | | |
| | | private List<QueryParam> finalParameters() throws Exception { |
| | | |
| | | List<QueryParam> params = new ArrayList<>(); |
| | | |
| | | //On ajoute les paramètres de la clause SET |
| | | for (TypeFichierDataColumn c : updateMetaData.row().columns()) { |
| | | params.add(new QueryParam(c.column(), c.value())); |
| | | } |
| | | |
| | | //On ajoute les paramètres de l'application |
| | | params.add(new QueryParam(new DataProductionUpdateIdColumnDefinition().name(), dataProduction.getId())); |
| | | params.add(new QueryParam(new DateMiseAJourColumnDefinition().name(), dataProduction.getDateProduction())); |
| | | |
| | | //On ajoute ensuite les paramètre de la clause WHERE |
| | | params.addAll(new WhereQueryParameters(queryCriterion).parameters()); |
| | | |
| | | return params; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.IntStream; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class GroupByQuery { |
| | | |
| | | private final List<String> groupingColumns; |
| | | |
| | | public GroupByQuery(List<String> groupingColumns) { |
| | | this.groupingColumns = groupingColumns; |
| | | } |
| | | |
| | | public String query() { |
| | | StringBuilder query = new StringBuilder(""); |
| | | if (!groupingColumns.isEmpty()) { |
| | | query |
| | | .append(" GROUP BY ") |
| | | .append(buildQuery()); |
| | | } |
| | | return query.toString(); |
| | | } |
| | | |
| | | private String buildQuery() { |
| | | StringBuilder query = new StringBuilder(); |
| | | |
| | | int size = groupingColumns.size(); |
| | | IntStream.range(0, size).forEach(index -> { |
| | | String column = groupingColumns.get(index); |
| | | query.append(column); |
| | | if ((index + 1) < size) { |
| | | query.append(","); |
| | | } |
| | | }); |
| | | |
| | | return query.toString(); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.contrat.QueryMetaData; |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.Timestamp; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class InsertDataProductionInDataProductionToDeleteQuery implements QueryMetaData<Void> { |
| | | |
| | | private final Connection connection; |
| | | private final Long dataProductionId; |
| | | |
| | | public InsertDataProductionInDataProductionToDeleteQuery(Connection connection, Long dataProductionId) { |
| | | this.connection = connection; |
| | | this.dataProductionId = dataProductionId; |
| | | } |
| | | |
| | | @Override |
| | | public Void execute() throws Exception { |
| | | if (dataProductionId != null && dataProductionId > 0) { |
| | | String query = "INSERT INTO dataproductiontodelete(id, datecreation) values (?,?)"; |
| | | try (PreparedStatement statement = connection.prepareStatement(query);) { |
| | | statement.setLong(1, dataProductionId); |
| | | statement.setTimestamp(2, Timestamp.valueOf(LocalDateTime.now())); |
| | | statement.executeUpdate(); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.contrat.DefaultPreparedStatementProcessor; |
| | | import com.megatim.fdxcommons.tools.database.contrat.PreparedStatementProcessor; |
| | | import com.megatim.fdxcommons.tools.database.contrat.QueryMetaData; |
| | | import com.megatim.fdxcommons.tools.database.contrat.TypeFichierDataColumn; |
| | | import com.megatim.fdxcommons.tools.database.contrat.TypeFichierDataRow; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.DefaultTypeFichierDataColumn; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryParam; |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class InsertQuery implements QueryMetaData<Void> { |
| | | |
| | | private final String tableName; |
| | | protected final Connection connection; |
| | | private final List<String> columnNames; |
| | | private final List<TypeFichierDataRow> rows; |
| | | private final List<DefaultTypeFichierDataColumn> dataColumnsToAdd; |
| | | private final int BATCH_SIZE = 100_000; |
| | | |
| | | public InsertQuery(String tableName, final Connection connection, List<DefaultTypeFichierDataColumn> dataColumnsToAdd, List<String> columnNames, List<TypeFichierDataRow> rows) { |
| | | this.tableName = tableName; |
| | | this.dataColumnsToAdd = dataColumnsToAdd; |
| | | this.connection = connection; |
| | | this.columnNames = columnNames; |
| | | this.rows = rows; |
| | | } |
| | | |
| | | @Override |
| | | public Void execute() throws Exception { |
| | | System.out.println("<-------------------------------------------------------------------------->"); |
| | | System.out.println(insertQueryString()); |
| | | System.out.println("<-------------------------------------------------------------------------->"); |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(insertQueryString());) { |
| | | |
| | | executeInBatch(statement, rows, dataColumnsToAdd); |
| | | statement.executeBatch(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private String insertQueryString() { |
| | | List<String> insertColumns = new ArrayList<>(columnNames); |
| | | |
| | | for (DefaultTypeFichierDataColumn dc : dataColumnsToAdd) { |
| | | insertColumns.add(dc.column()); |
| | | } |
| | | |
| | | StringBuilder query = new StringBuilder("INSERT INTO " + tableName + "("); |
| | | |
| | | insertColumns.forEach(column -> query.append(column).append(",")); |
| | | |
| | | query.replace(query.length() - 1, query.length(), ") VALUES("); |
| | | |
| | | insertColumns.forEach(s -> query.append("?,")); |
| | | |
| | | query.replace(query.length() - 1, query.length(), ")"); |
| | | |
| | | return query.toString(); |
| | | } |
| | | |
| | | private void executeInBatch(PreparedStatement preparedStatement, List<TypeFichierDataRow> rows, List<DefaultTypeFichierDataColumn> dataColumnsToAdd) throws SQLException, Exception { |
| | | |
| | | int index = 0; |
| | | int count = 0; |
| | | |
| | | for (TypeFichierDataRow row : rows) { |
| | | |
| | | List<QueryParam> queryParameters = new ArrayList<>(); |
| | | |
| | | for (TypeFichierDataColumn dataColumn : row.columns()) { |
| | | queryParameters.add(new QueryParam(dataColumn.column(), dataColumn.value())); |
| | | } |
| | | |
| | | //On ajoute les colonnes de dataColumnsToAdd |
| | | for (DefaultTypeFichierDataColumn dc : dataColumnsToAdd) { |
| | | queryParameters.add(new QueryParam(dc.column(), dc.value())); |
| | | } |
| | | |
| | | PreparedStatementProcessor statementProcessor = new DefaultPreparedStatementProcessor(index); |
| | | statementProcessor.process(preparedStatement, queryParameters); |
| | | index = statementProcessor.lastProcessedIndex(); |
| | | |
| | | preparedStatement.addBatch(); |
| | | |
| | | if (++count % BATCH_SIZE == 0) { |
| | | preparedStatement.executeBatch(); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| 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.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.model.pojo.JsonTableDefinition; |
| | | import com.megatim.fdxcommons.tools.database.contrat.DefaultPreparedStatementProcessor; |
| | | import com.megatim.fdxcommons.tools.database.contrat.QueryMetaData; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryCriterion; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.WhereQueryParameters; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.IndexColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.ParentIdColumnDefinition; |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class JsonCountQuery implements QueryMetaData<Long> { |
| | | |
| | | private final JsonTableDefinition tableDefinition; |
| | | private final Connection connection; |
| | | private final QueryCriterion queryCriterion; |
| | | private final Map<String, String> tablesNameToAlias; |
| | | |
| | | public JsonCountQuery(JsonTableDefinition tableDefinition, QueryCriterion queryCriterion, Connection connection, Map<String, String> tablesNameToAlias) { |
| | | this.connection = connection; |
| | | this.queryCriterion = queryCriterion; |
| | | this.tableDefinition = tableDefinition; |
| | | this.tablesNameToAlias = tablesNameToAlias; |
| | | } |
| | | |
| | | @Override |
| | | public Long execute() throws Exception { |
| | | String query = countString() + fromString() + joinString() + whereString(); |
| | | System.out.println("countQuery = " + query); |
| | | try ( PreparedStatement statement = connection.prepareStatement(query)) { |
| | | |
| | | new DefaultPreparedStatementProcessor().process(statement, new WhereQueryParameters(queryCriterion).parameters()); |
| | | ResultSet resultSet = statement.executeQuery(); |
| | | |
| | | if (resultSet.next()) { |
| | | return resultSet.getLong(1); |
| | | } |
| | | return 0L; |
| | | } |
| | | } |
| | | |
| | | private String countString() { |
| | | StringBuilder query = new StringBuilder("SELECT COUNT("); |
| | | query.append("DISTINCT(") |
| | | .append(tablesNameToAlias.get(tableDefinition.getTableName())) |
| | | .append(".") |
| | | .append(new IndexColumnDefinition().name()) |
| | | .append("))"); |
| | | |
| | | return query.toString(); |
| | | } |
| | | |
| | | private String whereString() { |
| | | return "\n" + new WhereQueryString(queryCriterion).query(); |
| | | } |
| | | |
| | | private String fromString() { |
| | | StringBuilder fromPart = new StringBuilder("\nFROM "); |
| | | fromPart |
| | | .append(tableDefinition.getTableName()) |
| | | .append(" ") |
| | | .append(tablesNameToAlias.get(tableDefinition.getTableName())); |
| | | |
| | | return fromPart.toString(); |
| | | } |
| | | |
| | | private String joinString() { |
| | | return joinString(tableDefinition.getTablesDefinition()); |
| | | } |
| | | |
| | | private String joinString(List<JsonTableDefinition> tablesDef) { |
| | | StringBuilder joinPart = new StringBuilder(""); |
| | | |
| | | if (tablesNameToAlias.size() > 1) { |
| | | for (JsonTableDefinition t : tablesDef) { |
| | | joinPart.append(joinString(t)); |
| | | joinPart.append(joinString(t.getTablesDefinition())); |
| | | } |
| | | } |
| | | return joinPart.toString(); |
| | | } |
| | | |
| | | private String joinString(JsonTableDefinition tableDef) { |
| | | StringBuilder joinPart = new StringBuilder("\nJOIN "); |
| | | joinPart.append(tableDef.getTableName()) |
| | | .append(" ") |
| | | .append(tablesNameToAlias.get(tableDef.getTableName())) |
| | | .append(" ON ") |
| | | .append(tablesNameToAlias.get(tableDef.getTableName())) |
| | | .append(".") |
| | | .append(new ParentIdColumnDefinition().name()) |
| | | .append(" = ") |
| | | .append(tablesNameToAlias.get(tableDef.getParentTableName())) |
| | | .append(".") |
| | | .append(new IndexColumnDefinition().name()); |
| | | |
| | | return joinPart.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.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.model.dataproduction.CommonDataProduction; |
| | | import com.megatim.fdxcommons.model.enumeration.CriteriaLogicConnector; |
| | | import com.megatim.fdxcommons.model.enumeration.Operateur; |
| | | import com.megatim.fdxcommons.model.pojo.JsonTableDefinition; |
| | | 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.QueryCriterion; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryParam; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.WhereQueryParameters; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.DataProductionUpdateIdColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.DateMiseAJourColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.DeletedColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.IndexColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.ParentIdColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.utils.JsonDataUtil; |
| | | import com.megatim.fdxcommons.tools.utils.JsonTableUtil; |
| | | import java.sql.Connection; |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class JsonDelete { |
| | | |
| | | private final Connection connection; |
| | | private final Map<Long, Object> matchedData; |
| | | private final String rootTableName; |
| | | private final JsonTableDefinition tableDefinition; |
| | | private final CommonDataProduction dataProduction; |
| | | |
| | | public JsonDelete(Connection connection, Map<Long, Object> matchedData, String rootTableName, JsonTableDefinition tableDefinition, CommonDataProduction dataProduction) { |
| | | this.connection = connection; |
| | | this.matchedData = matchedData; |
| | | this.rootTableName = rootTableName; |
| | | this.tableDefinition = tableDefinition; |
| | | this.dataProduction = dataProduction; |
| | | } |
| | | |
| | | public void delete() throws ColumnNotFoundException, SQLException, BadDataValueException, LocalDateTimeValueParseError, Exception { |
| | | Map<String, Set<Long>> tableToMatchingIndexes = new JsonDataUtil().tableToMatchingIndexes(matchedData, rootTableName); |
| | | Map<String, List<String>> tableToDirectChildren = new JsonTableUtil(tableDefinition).tableToChildrenTables(); |
| | | |
| | | for (Map.Entry<String, Set<Long>> entry : tableToMatchingIndexes.entrySet()) { |
| | | Set<Long> indexes = entry.getValue(); |
| | | List<String> childrenTableList = tableToDirectChildren.get(entry.getKey()); |
| | | final String parentTable = entry.getKey(); |
| | | final String parentIdColumn = new ParentIdColumnDefinition().name(); |
| | | final String indexColumn = new IndexColumnDefinition().name(); |
| | | |
| | | if (indexes != null) { |
| | | QueryCriterion childrenQueryCriterion = queryCriterion(indexes, parentIdColumn); |
| | | QueryCriterion parentQueryCriterion = queryCriterion(indexes, indexColumn); |
| | | List<QueryParam> childParams = parameters(childrenQueryCriterion); |
| | | List<QueryParam> parentParams = parameters(parentQueryCriterion); |
| | | List<String> columnNames = Arrays.asList(new DeletedColumnDefinition().name(), new DataProductionUpdateIdColumnDefinition().name(), new DateMiseAJourColumnDefinition().name()); |
| | | |
| | | if (childrenTableList != null && childrenTableList.isEmpty()) { |
| | | for (String table : childrenTableList) { |
| | | new UpdateQuery(connection, childrenQueryCriterion, table, columnNames, childParams).execute(); |
| | | } |
| | | } |
| | | new UpdateQuery(connection, parentQueryCriterion, parentTable, columnNames, parentParams).execute(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private List<QueryParam> parameters(QueryCriterion queryCriterion) throws Exception { |
| | | List<QueryParam> params = new ArrayList<>(); |
| | | |
| | | //On ajoute les paramètres de l'application |
| | | params.add(new QueryParam(new DeletedColumnDefinition().name(), 1)); |
| | | params.add(new QueryParam(new DataProductionUpdateIdColumnDefinition().name(), dataProduction.getId())); |
| | | params.add(new QueryParam(new DateMiseAJourColumnDefinition().name(), dataProduction.getDateProduction())); |
| | | |
| | | //On ajoute ensuite les paramètre de la clause WHERE |
| | | params.addAll(new WhereQueryParameters(queryCriterion).parameters()); |
| | | |
| | | return params; |
| | | } |
| | | |
| | | private QueryCriterion queryCriterion(Set<Long> indexes, String columnName) { |
| | | List<QueryCriterion> criteria = new ArrayList<>(); |
| | | indexes.stream().forEach(i -> criteria.add(new QueryCriterion(columnName, i, Operateur.EQUALS, null, Arrays.asList()))); |
| | | |
| | | return new QueryCriterion(null, null, null, CriteriaLogicConnector.OR, criteria); |
| | | } |
| | | } |
| 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.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.contrat.JsonFdxInsert; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.DefaultTypeFichierDataColumn; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.JsonFdxParsedDataIterator; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.DataProductionIdColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.DateCreationColumnDefinition; |
| | | import java.sql.Connection; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class JsonFdxApiInsert extends JsonFdxInsert { |
| | | |
| | | public JsonFdxApiInsert(Connection connection, Long dataProductionId) { |
| | | super(connection, dataProductionId); |
| | | } |
| | | |
| | | @Override |
| | | public long insert(JsonFdxParsedDataIterator parsedDataIterator) throws Exception { |
| | | List<DefaultTypeFichierDataColumn> dataColumnsToAdd = dataColumnsToAdd(); |
| | | new JsonInsertQuery(connection, parsedDataIterator, dataColumnsToAdd).execute(); |
| | | |
| | | return dataProductionId; |
| | | } |
| | | |
| | | private List<DefaultTypeFichierDataColumn> dataColumnsToAdd() { |
| | | return Arrays.asList( |
| | | new DefaultTypeFichierDataColumn(new DateCreationColumnDefinition().name(), LocalDateTime.now()), |
| | | new DefaultTypeFichierDataColumn(new DataProductionIdColumnDefinition().name(), dataProductionId) |
| | | ); |
| | | } |
| | | } |
| 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.fdxcommons.tools.database.contrat; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.JsonFdxParsedDataIterator; |
| | | import java.sql.Connection; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public abstract class JsonFdxInsert implements JsonInsert { |
| | | |
| | | protected final Connection connection; |
| | | protected final Long dataProductionId; |
| | | |
| | | public JsonFdxInsert(Connection connection, Long dataProductionId) { |
| | | this.connection = connection; |
| | | this.dataProductionId = dataProductionId; |
| | | } |
| | | |
| | | @Override |
| | | public abstract long insert(JsonFdxParsedDataIterator parsedDataIterator) 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.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.contrat.DefaultPreparedStatementProcessor; |
| | | import com.megatim.fdxcommons.tools.database.contrat.JsonTypeFichierInsertMetaData; |
| | | import com.megatim.fdxcommons.tools.database.contrat.PreparedStatementProcessor; |
| | | import com.megatim.fdxcommons.tools.database.contrat.QueryMetaData; |
| | | import com.megatim.fdxcommons.tools.database.contrat.TypeFichierDataColumn; |
| | | import com.megatim.fdxcommons.tools.database.contrat.TypeFichierDataRow; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.DefaultTypeFichierDataColumn; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.JsonApiTypeFichierInsertData; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.JsonFdxParsedDataIterator; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryParam; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.IndexColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.ParentIdColumnDefinition; |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class JsonInsertQuery implements QueryMetaData<Void> { |
| | | |
| | | private final Connection connection; |
| | | private final JsonFdxParsedDataIterator parsedDataIterator; |
| | | private final List<DefaultTypeFichierDataColumn> dataColumnsToAdd; |
| | | |
| | | public JsonInsertQuery(Connection connection, JsonFdxParsedDataIterator parsedDataIterator, List<DefaultTypeFichierDataColumn> dataColumnsToAdd) { |
| | | this.connection = connection; |
| | | this.parsedDataIterator = parsedDataIterator; |
| | | this.dataColumnsToAdd = dataColumnsToAdd; |
| | | } |
| | | |
| | | @Override |
| | | public Void execute() throws Exception { |
| | | List<JsonApiTypeFichierInsertData> rows = parsedDataIterator.rows(); |
| | | |
| | | for (JsonApiTypeFichierInsertData insertMetaData : rows) { |
| | | String query = insertQueryString(insertMetaData.columnNames(), insertMetaData.tableName(), false); |
| | | |
| | | TypeFichierDataRow row = insertMetaData.row(); |
| | | |
| | | System.out.println("---------------- parentQuery-----------------------"); |
| | | System.out.println(query); |
| | | System.out.println("-----------------------------------"); |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(query);) { |
| | | execute(statement, row, dataColumnsToAdd, null); |
| | | ResultSet resultSet = statement.executeQuery(); |
| | | |
| | | if (resultSet.next()) { |
| | | Long fdxIndex = resultSet.getLong(1); |
| | | insertChildren(insertMetaData.children(), fdxIndex); |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private void insertChildren(List<JsonTypeFichierInsertMetaData> data, Long parentId) throws Exception { |
| | | if (!data.isEmpty()) { |
| | | for (JsonTypeFichierInsertMetaData insertData : data) { |
| | | insertChild(insertData, parentId); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | private void insertChild(JsonTypeFichierInsertMetaData child, Long parentId) throws Exception { |
| | | String childQuery = insertQueryString(child.columnNames(), child.tableName(), true); |
| | | System.out.println("------------------ childQuery---------------------------"); |
| | | System.out.println(childQuery); |
| | | System.out.println("---------------------------------------------------------"); |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(childQuery);) { |
| | | |
| | | TypeFichierDataRow row = child.row(); |
| | | execute(statement, row, dataColumnsToAdd, parentId); |
| | | ResultSet resultSet = statement.executeQuery(); |
| | | |
| | | if (resultSet.next()) { |
| | | Long fdxIndex = resultSet.getLong(1); |
| | | insertChildren(child.children(), fdxIndex); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private String insertQueryString(List<String> columnNames, String tableName, boolean parentIdPresent) { |
| | | List<String> insertColumns = new ArrayList<>(columnNames); |
| | | |
| | | for (DefaultTypeFichierDataColumn dc : dataColumnsToAdd) { |
| | | insertColumns.add(dc.column()); |
| | | } |
| | | |
| | | if (parentIdPresent) { |
| | | insertColumns.add(new ParentIdColumnDefinition().name());// Ajout de la clé du parent |
| | | } |
| | | StringBuilder query = new StringBuilder("INSERT INTO " + tableName + "("); |
| | | |
| | | insertColumns.forEach(column -> query.append(column).append(",")); |
| | | |
| | | query.replace(query.length() - 1, query.length(), ") VALUES("); |
| | | |
| | | insertColumns.forEach(s -> query.append("?,")); |
| | | |
| | | query.replace(query.length() - 1, query.length(), ")"); |
| | | |
| | | query.append(" RETURNING ").append(new IndexColumnDefinition().name()).append(";"); |
| | | |
| | | return query.toString(); |
| | | } |
| | | |
| | | private void execute(PreparedStatement preparedStatement, TypeFichierDataRow row, List<DefaultTypeFichierDataColumn> dataColumnsToAdd, Long parentId) throws SQLException, Exception { |
| | | |
| | | List<QueryParam> queryParameters = new ArrayList<>(); |
| | | |
| | | if (row != null) { |
| | | for (TypeFichierDataColumn dataColumn : row.columns()) { |
| | | queryParameters.add(new QueryParam(dataColumn.column(), dataColumn.value())); |
| | | } |
| | | } |
| | | |
| | | //On ajoute les colonnes de dataColumnsToAdd |
| | | for (DefaultTypeFichierDataColumn dc : dataColumnsToAdd) { |
| | | queryParameters.add(new QueryParam(dc.column(), dc.value())); |
| | | } |
| | | |
| | | if (parentId != null && parentId != 0L) { |
| | | queryParameters.add(new QueryParam(new ParentIdColumnDefinition().name(), parentId));//Ajout clé du parent |
| | | } |
| | | |
| | | PreparedStatementProcessor statementProcessor = new DefaultPreparedStatementProcessor(0); |
| | | statementProcessor.process(preparedStatement, queryParameters); |
| | | |
| | | } |
| | | } |
| 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.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.model.pojo.JsonTableDefinition; |
| | | import com.megatim.fdxcommons.tools.database.contrat.DefaultPreparedStatementProcessor; |
| | | import com.megatim.fdxcommons.tools.database.contrat.QueryMetaData; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryCriterion; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.WhereQueryParameters; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.IndexColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.ParentIdColumnDefinition; |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | import java.sql.ResultSetMetaData; |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import javax.naming.NamingException; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class JsonSelectQuery implements QueryMetaData<Map<Long, Object>> { |
| | | |
| | | private final JsonTableDefinition tableDefinition; |
| | | private final QueryCriterion queryCriterion; |
| | | private final Connection connection; |
| | | private final Map<String, String> tablesNameToAlias; |
| | | private final int limit; |
| | | private final int offset; |
| | | |
| | | public JsonSelectQuery(JsonTableDefinition tableDefinition, QueryCriterion queryCriterion, Connection connection, Map<String, String> tablesNameToAlias) { |
| | | this(tableDefinition, queryCriterion, connection, tablesNameToAlias, -1, -1); |
| | | } |
| | | |
| | | public JsonSelectQuery(JsonTableDefinition tableDefinition, QueryCriterion queryCriterion, Connection connection, Map<String, String> tablesNameToAlias, int limit, int offset) { |
| | | this.tableDefinition = tableDefinition; |
| | | this.queryCriterion = queryCriterion; |
| | | this.connection = connection; |
| | | this.tablesNameToAlias = tablesNameToAlias; |
| | | this.limit = limit; |
| | | this.offset = offset; |
| | | } |
| | | |
| | | @Override |
| | | public Map<Long, Object> execute() throws Exception { |
| | | return result(); |
| | | } |
| | | |
| | | private Map<Long, Object> result() throws NamingException, SQLException { |
| | | Map<Long, Object> finalData = new HashMap<>(); |
| | | String query = selectString() + fromString() + joinString() + whereString() + pagination(); |
| | | System.out.println("------------------------------------------------------------------------------------"); |
| | | System.out.println(query); |
| | | System.out.println("------------------------------------------------------------------------------------"); |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(query)) { |
| | | new DefaultPreparedStatementProcessor().process(statement, new WhereQueryParameters(queryCriterion).parameters()); |
| | | ResultSet resultSet = statement.executeQuery(); |
| | | List<Long> indexes = new ArrayList<>(); |
| | | |
| | | while (resultSet.next()) { |
| | | indexes.add(resultSet.getLong(new IndexColumnDefinition().name())); |
| | | } |
| | | for (Long l : indexes) { |
| | | Map<String, Object> data = selectData(l, tableDefinition.getTableName()); |
| | | |
| | | for (JsonTableDefinition t : tableDefinition.getTablesDefinition()) { |
| | | data.put(t.getParentFieldName().toLowerCase(), selectChildren(l, t)); |
| | | } |
| | | finalData.put(l, data); |
| | | } |
| | | } |
| | | return finalData; |
| | | } |
| | | |
| | | private Map<String, Object> selectData(Long index, String tableName) throws SQLException { |
| | | Map<String, Object> data = new HashMap<>(); |
| | | String query = "SELECT * FROM " + tableName + " WHERE " + new IndexColumnDefinition().name() + " = ?"; |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(query)) { |
| | | statement.setLong(1, index); |
| | | ResultSet resultSet = statement.executeQuery(); |
| | | |
| | | ResultSetMetaData metaData = resultSet.getMetaData(); |
| | | int columnCount = metaData.getColumnCount(); |
| | | |
| | | if (resultSet.next()) { |
| | | for (int i = 1; i <= columnCount; i++) { |
| | | data.put(metaData.getColumnName(i).trim().toLowerCase(), resultSet.getObject(i)); |
| | | } |
| | | } |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | private Map<Long, Object> selectChildren(Long index, JsonTableDefinition tableDef) throws SQLException { |
| | | Map<Long, Object> finalData = new HashMap<>(); |
| | | String query = "SELECT * FROM " + tableDef.getTableName() + " WHERE " + new ParentIdColumnDefinition().name() + " = ?"; |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(query)) { |
| | | statement.setLong(1, index); |
| | | ResultSet resultSet = statement.executeQuery(); |
| | | Map<Long, Object> data = retrieveData(resultSet); |
| | | |
| | | if (!tableDef.getTablesDefinition().isEmpty()) { |
| | | |
| | | for (Map.Entry<Long, Object> entry : data.entrySet()) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.putAll((Map<String, Object>) entry.getValue()); |
| | | |
| | | for (JsonTableDefinition t : tableDef.getTablesDefinition()) { |
| | | map.put(t.getParentFieldName().toLowerCase(), selectChildren(entry.getKey(), t)); |
| | | } |
| | | finalData.put(entry.getKey(), map); |
| | | } |
| | | } else { |
| | | finalData.putAll(data); |
| | | } |
| | | } |
| | | return finalData; |
| | | } |
| | | |
| | | private Map<Long, Object> retrieveData(ResultSet resultSet) throws SQLException { |
| | | Map<Long, Object> data = new HashMap<>(); |
| | | ResultSetMetaData metaData = resultSet.getMetaData(); |
| | | int columnCount = metaData.getColumnCount(); |
| | | |
| | | while (resultSet.next()) { |
| | | Map<String, Object> datum = new HashMap<>(); |
| | | for (int i = 1; i <= columnCount; i++) { |
| | | datum.put(metaData.getColumnName(i).trim().toLowerCase(), resultSet.getObject(i)); |
| | | } |
| | | data.put(resultSet.getLong(new IndexColumnDefinition().name()), datum); |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | private String whereString() { |
| | | return "\n" + new WhereQueryString(queryCriterion).query(); |
| | | } |
| | | |
| | | private String pagination() { |
| | | if (limit > 0 && offset >= 0) { |
| | | return " LIMIT " + limit + " OFFSET " + offset; |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | private String fromString() { |
| | | StringBuilder fromPart = new StringBuilder("\nFROM "); |
| | | fromPart |
| | | .append(tableDefinition.getTableName()) |
| | | .append(" ") |
| | | .append(tablesNameToAlias.get(tableDefinition.getTableName())); |
| | | |
| | | return fromPart.toString(); |
| | | } |
| | | |
| | | private String joinString() { |
| | | return joinString(tableDefinition.getTablesDefinition()); |
| | | } |
| | | |
| | | private String joinString(List<JsonTableDefinition> tablesDef) { |
| | | StringBuilder joinPart = new StringBuilder(""); |
| | | |
| | | if (tablesNameToAlias.size() > 1) { |
| | | for (JsonTableDefinition t : tablesDef) { |
| | | joinPart.append(joinString(t)); |
| | | joinPart.append(joinString(t.getTablesDefinition())); |
| | | } |
| | | } |
| | | return joinPart.toString(); |
| | | } |
| | | |
| | | private String joinString(JsonTableDefinition tableDef) { |
| | | StringBuilder joinPart = new StringBuilder("\nJOIN "); |
| | | joinPart.append(tableDef.getTableName()) |
| | | .append(" ") |
| | | .append(tablesNameToAlias.get(tableDef.getTableName())) |
| | | .append(" ON ") |
| | | .append(tablesNameToAlias.get(tableDef.getTableName())) |
| | | .append(".") |
| | | .append(new ParentIdColumnDefinition().name()) |
| | | .append(" = ") |
| | | .append(tablesNameToAlias.get(tableDef.getParentTableName())) |
| | | .append(".") |
| | | .append(new IndexColumnDefinition().name()); |
| | | |
| | | return joinPart.toString(); |
| | | } |
| | | |
| | | private String selectString() { |
| | | return "SELECT " + columnsToSelect(); |
| | | } |
| | | |
| | | private String columnsToSelect() { |
| | | StringBuilder columnsToSelect = new StringBuilder(""); |
| | | columnsToSelect |
| | | .append("DISTINCT(") |
| | | .append(tablesNameToAlias.get(tableDefinition.getTableName())) |
| | | .append(".") |
| | | .append(new IndexColumnDefinition().name()) |
| | | .append(")"); |
| | | return columnsToSelect.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.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.model.dataproduction.CommonDataProduction; |
| | | import com.megatim.fdxcommons.model.enumeration.CriteriaLogicConnector; |
| | | import com.megatim.fdxcommons.model.enumeration.Operateur; |
| | | 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.JsonDataRowToUpdate; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryCriterion; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryParam; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.WhereQueryParameters; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.DataProductionUpdateIdColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.DateMiseAJourColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.IndexColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.utils.JsonDataUtil; |
| | | import java.sql.Connection; |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class JsonUpdate { |
| | | |
| | | private final Connection connection; |
| | | private final Map<Long, Object> matchedData; |
| | | private final List<ColumnDefinition> columnsDefinition; |
| | | private final String rootTableName; |
| | | private final Map<String, Object> dataToSet; |
| | | private final CommonDataProduction dataProduction; |
| | | |
| | | public JsonUpdate(Connection connection, Map<Long, Object> matchedData, List<ColumnDefinition> columnsDefinition, String rootTableName, Map<String, Object> dataToSet, CommonDataProduction dataProduction) { |
| | | this.connection = connection; |
| | | this.matchedData = matchedData; |
| | | this.columnsDefinition = columnsDefinition; |
| | | this.rootTableName = rootTableName; |
| | | this.dataToSet = dataToSet; |
| | | this.dataProduction = dataProduction; |
| | | } |
| | | |
| | | public void update() throws ColumnNotFoundException, SQLException, BadDataValueException, LocalDateTimeValueParseError, Exception { |
| | | Map<String, Map<String, Object>> tableToDataRow = new JsonDataRowToUpdate(dataToSet, rootTableName, columnsDefinition).dataRow(); |
| | | Map<String, Set<Long>> tableToMatchingIndexes = new JsonDataUtil().tableToMatchingIndexes(matchedData, rootTableName); |
| | | |
| | | for (Map.Entry<String, Map<String, Object>> entry : tableToDataRow.entrySet()) { |
| | | Set<Long> indexes = tableToMatchingIndexes.get(entry.getKey()); |
| | | |
| | | if (indexes != null) { |
| | | QueryCriterion queryCriterion = queryCriterion(indexes); |
| | | List<QueryParam> params = parameters(entry.getValue(), queryCriterion); |
| | | |
| | | new UpdateQuery(connection, queryCriterion, entry.getKey(), columnsName(entry.getValue()), params).execute(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private List<QueryParam> parameters(Map<String, Object> updateData, QueryCriterion queryCriterion) throws Exception { |
| | | List<QueryParam> params = new ArrayList<>(); |
| | | |
| | | //On ajoute les paramètres de la clause SET |
| | | updateData.forEach((k, v) -> { |
| | | params.add(new QueryParam(k, v)); |
| | | }); |
| | | |
| | | //On ajoute les paramètres de l'application |
| | | params.add(new QueryParam(new DataProductionUpdateIdColumnDefinition().name(), dataProduction.getId())); |
| | | params.add(new QueryParam(new DateMiseAJourColumnDefinition().name(), dataProduction.getDateProduction())); |
| | | //On ajoute ensuite les paramètre de la clause WHERE |
| | | params.addAll(new WhereQueryParameters(queryCriterion).parameters()); |
| | | |
| | | return params; |
| | | } |
| | | |
| | | private QueryCriterion queryCriterion(Set<Long> indexes) { |
| | | List<QueryCriterion> criteria = new ArrayList<>(); |
| | | indexes.stream().forEach(i -> criteria.add(new QueryCriterion(new IndexColumnDefinition().name(), i, Operateur.EQUALS, null, Arrays.asList()))); |
| | | |
| | | return new QueryCriterion(null, null, null, CriteriaLogicConnector.OR, criteria); |
| | | } |
| | | |
| | | private List<String> columnsName(Map<String, Object> data) { |
| | | List<String> columnsName = new ArrayList<>(); |
| | | columnsName.addAll(data.keySet().stream().collect(Collectors.toList())); |
| | | columnsName.add(new DataProductionUpdateIdColumnDefinition().name()); |
| | | columnsName.add(new DateMiseAJourColumnDefinition().name()); |
| | | |
| | | return columnsName; |
| | | } |
| | | } |
| 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.fdxcommons.tools.database.queries; |
| | | |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class LatestDataProductionTokenQuery { |
| | | |
| | | private final Connection connection; |
| | | private final String referentielVersion; |
| | | private final String codeTypeFichier; |
| | | |
| | | public LatestDataProductionTokenQuery(Connection connection, String referentielVersion, String codeTypeFichier) { |
| | | this.connection = connection; |
| | | this.referentielVersion = referentielVersion; |
| | | this.codeTypeFichier = codeTypeFichier; |
| | | } |
| | | |
| | | public String execute() throws SQLException { |
| | | try ( PreparedStatement stmt = connection.prepareStatement(queryString())) { |
| | | stmt.setString(1, codeTypeFichier); |
| | | stmt.setString(2, referentielVersion); |
| | | stmt.setString(3, codeTypeFichier); |
| | | stmt.setString(4, referentielVersion); |
| | | |
| | | ResultSet result = stmt.executeQuery(); |
| | | |
| | | if (result.next()) { |
| | | return result.getString(1); |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | private String queryString() { |
| | | String subQuery = "SELECT MAX(id) FROM dataproduction WHERE codetypefichier = ?" |
| | | + " AND referentielversion = ? "; |
| | | return "SELECT token FROM dataproduction WHERE codetypefichier = ?" |
| | | + " AND referentielversion = ? AND ID IN (" + subQuery + ")"; |
| | | } |
| | | } |
| 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.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.StatutDataProduction; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.DataProductionIdColumnDefinition; |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class MaxDataProductionIdQuery { |
| | | |
| | | private final String tableName; |
| | | private final Connection connection; |
| | | |
| | | public MaxDataProductionIdQuery(String tableName, Connection connection) { |
| | | this.tableName = tableName; |
| | | this.connection = connection; |
| | | } |
| | | |
| | | public Long execute() throws SQLException { |
| | | Long max = 0L; |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(maxQueryString())) { |
| | | ResultSet resultSet = statement.executeQuery(); |
| | | |
| | | if (resultSet.next()) { |
| | | max = resultSet.getLong(1); |
| | | } |
| | | } |
| | | return max; |
| | | } |
| | | |
| | | private String maxQueryString() { |
| | | return "SELECT id FROM dataproduction" |
| | | + " WHERE statutdataproduction IN('" + StatutDataProduction.A_CONSOMMER + "', '" + StatutDataProduction.CONSOMME + "')" |
| | | + " AND id IN (SELECT DISTINCT " + new DataProductionIdColumnDefinition().name() + " FROM " + tableName + ")" |
| | | + " ORDER BY id DESC"; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.contrat.DefaultPreparedStatementProcessor; |
| | | import com.megatim.fdxcommons.tools.database.contrat.QueryMetaData; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryCriterion; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.WhereQueryParameters; |
| | | |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | |
| | | /** |
| | | * @author Gabuntu |
| | | */ |
| | | public class PermanentDeleteQuery implements QueryMetaData<Void> { |
| | | |
| | | private final Connection connection; |
| | | private final QueryCriterion queryCriterion; |
| | | private final String tableName; |
| | | |
| | | public PermanentDeleteQuery(String tableName, Connection connection, QueryCriterion queryCriterion) { |
| | | this.connection = connection; |
| | | this.queryCriterion = queryCriterion; |
| | | this.tableName = tableName; |
| | | } |
| | | |
| | | @Override |
| | | public Void execute() throws Exception { |
| | | |
| | | System.out.println("<----------------------------------------------------------------------------------------------------------->"); |
| | | System.out.println(permanentDeleteQuery()); |
| | | System.out.println("<----------------------------------------------------------------------------------------------------------->"); |
| | | |
| | | try (PreparedStatement statement = connection.prepareStatement(permanentDeleteQuery())) { |
| | | |
| | | connection.setAutoCommit(false); |
| | | |
| | | new DefaultPreparedStatementProcessor().process(statement, new WhereQueryParameters(queryCriterion).parameters()); |
| | | statement.execute(); |
| | | |
| | | connection.commit(); |
| | | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | private String permanentDeleteQuery() throws Exception { |
| | | return "DELETE FROM " + tableName + " " + new WhereQueryString(queryCriterion).query(); |
| | | } |
| | | |
| | | } |
| 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.fdxcommons.tools.database.queries; |
| | | |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class SelectDataProductionQuery { |
| | | |
| | | private final Connection connection; |
| | | |
| | | public SelectDataProductionQuery(Connection connection) { |
| | | this.connection = connection; |
| | | } |
| | | |
| | | public boolean dataProductionExists(Long id) throws SQLException { |
| | | String query = "SELECT COUNT(*) FROM DATAPRODUCTION WHERE id = " + id; |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(query)) { |
| | | ResultSet resultSet = statement.executeQuery(); |
| | | if (resultSet.next()) { |
| | | return resultSet.getLong(1) > 0; |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryCriterion; |
| | | import com.megatim.fdxcommons.tools.database.contrat.DefaultPreparedStatementProcessor; |
| | | import com.megatim.fdxcommons.tools.database.tables.FdxTableRow; |
| | | import com.megatim.fdxcommons.tools.database.contrat.QueryMetaData; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.SelectQueryResult; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.WhereQueryParameters; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.FdxApiColumnDefinitions; |
| | | import com.megatim.fdxcommons.tools.database.tables.FdxTableColumnData; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.FdxConsultationColumnDefinitions; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.IndexColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.TokenColumnDefinition; |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | import java.sql.ResultSetMetaData; |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import javax.naming.NamingException; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class SelectQuery implements QueryMetaData<SelectQueryResult> { |
| | | |
| | | private final String tableName; |
| | | private final Connection connection; |
| | | private final QueryCriterion queryCriterion; |
| | | private final List<String> selectColumns; |
| | | private final int limit; |
| | | private final boolean withCustomColumns; |
| | | private final int offset; |
| | | |
| | | public SelectQuery(String tableName, Connection connection, QueryCriterion queryCriterion, List<String> selectColumns, boolean withCustomColumns) { |
| | | this(tableName, connection, queryCriterion, selectColumns, -1, -1, withCustomColumns); |
| | | } |
| | | |
| | | public SelectQuery(String tableName, Connection connection, QueryCriterion queryCriterion, List<String> selectColumns, int limit, int offset, boolean withCustomColumns) { |
| | | this.tableName = tableName; |
| | | this.connection = connection; |
| | | this.queryCriterion = queryCriterion; |
| | | this.selectColumns = selectColumns; |
| | | this.limit = limit; |
| | | this.offset = offset; |
| | | this.withCustomColumns = withCustomColumns; |
| | | } |
| | | |
| | | @Override |
| | | public SelectQueryResult execute() throws Exception { |
| | | return result(); |
| | | } |
| | | |
| | | private SelectQueryResult result() throws NamingException, SQLException { |
| | | String query = selectQuery(); |
| | | System.out.println("------------------------------------------"); |
| | | System.out.println(query); |
| | | System.out.println("------------------------------------------------"); |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(query)) { |
| | | |
| | | new DefaultPreparedStatementProcessor().process(statement, new WhereQueryParameters(queryCriterion).parameters()); |
| | | |
| | | long rowCount = 1; |
| | | |
| | | ResultSet resultSet = statement.executeQuery(); |
| | | ResultSetMetaData metaData = resultSet.getMetaData(); |
| | | int columnCount = metaData.getColumnCount(); |
| | | |
| | | List<FdxTableRow> rows = new ArrayList<>(); |
| | | |
| | | int lastIndexRead = 0; |
| | | |
| | | FdxApiColumnDefinitions apiColumnDefinitions = new FdxApiColumnDefinitions(); |
| | | FdxConsultationColumnDefinitions fdxConsColumnDefinitions = new FdxConsultationColumnDefinitions(); |
| | | final String tokenColumn = new TokenColumnDefinition().name(); |
| | | |
| | | while (resultSet.next()) { |
| | | |
| | | List<FdxTableColumnData> data = new ArrayList<>(); |
| | | |
| | | for (int i = 1; i <= columnCount; i++) { |
| | | |
| | | String name = metaData.getColumnName(i).trim(); |
| | | Object value = resultSet.getObject(i); |
| | | // int sqlDataType = metaData.getColumnType(i); |
| | | |
| | | if (!name.equals(tokenColumn)) { |
| | | if (withCustomColumns) { |
| | | data.add(new FdxTableColumnData(value, name, i)); |
| | | } else { |
| | | if (!apiColumnDefinitions.isAppColumnDefinition(name) && !fdxConsColumnDefinitions.isAppColumnDefinition(name)) { |
| | | data.add(new FdxTableColumnData(value, name, i)); |
| | | } |
| | | } |
| | | if (apiColumnDefinitions.isIndexColumn(name)) { |
| | | int currentIndex = Integer.parseInt(value.toString()); |
| | | if (currentIndex > lastIndexRead) { |
| | | lastIndexRead = currentIndex; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | rows.add(new FdxTableRow(rowCount++, data)); |
| | | } |
| | | return new SelectQueryResult(lastIndexRead, rows); |
| | | } |
| | | } |
| | | |
| | | private String selectQuery() { |
| | | |
| | | StringBuilder query = new StringBuilder("SELECT "); |
| | | |
| | | if (selectColumns.isEmpty()) { |
| | | |
| | | query.append(" * "); |
| | | |
| | | } else { |
| | | |
| | | selectColumns.forEach(c -> query.append(c.toLowerCase()).append(",")); |
| | | query.replace(query.length() - 1, query.length(), ""); //retirer la sernière virgule |
| | | |
| | | } |
| | | |
| | | query |
| | | .append(" FROM ") |
| | | .append(tableName); |
| | | |
| | | query.append(new WhereQueryString(queryCriterion).query()); |
| | | query.append(" ORDER BY ").append(new IndexColumnDefinition().name()); |
| | | |
| | | if (limit > 0 && offset >= 0) { |
| | | |
| | | query |
| | | .append(" LIMIT ") |
| | | .append(limit) |
| | | .append(" OFFSET ") |
| | | .append(offset); |
| | | } |
| | | return query.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.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.contrat.AppColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.FdxConsultationIndexColumnDefinition; |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.sql.Statement; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class TableDefinitionQueries { |
| | | |
| | | private final String tableName; |
| | | private final Connection connection; |
| | | |
| | | public TableDefinitionQueries(String tableName, Connection connection) { |
| | | this.tableName = tableName; |
| | | this.connection = connection; |
| | | } |
| | | |
| | | public boolean tableExists() throws SQLException { |
| | | Long nb = 0L; |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(tableExistsQuery())) { |
| | | ResultSet resultSet = statement.executeQuery(); |
| | | |
| | | if (resultSet.next()) { |
| | | nb = resultSet.getLong(1); |
| | | } |
| | | } |
| | | return nb == 1; |
| | | } |
| | | |
| | | public boolean constraintExists(String constraintName) throws SQLException { |
| | | Long nb = 0L; |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(constraintExistsQuery(constraintName))) { |
| | | ResultSet resultSet = statement.executeQuery(); |
| | | |
| | | if (resultSet.next()) { |
| | | nb = resultSet.getLong(1); |
| | | } |
| | | } |
| | | return nb == 1; |
| | | } |
| | | |
| | | public boolean columnExists(String columnName) throws SQLException { |
| | | Long nb = 0L; |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(columnExistsQuery(columnName))) { |
| | | ResultSet resultSet = statement.executeQuery(); |
| | | |
| | | if (resultSet.next()) { |
| | | nb = resultSet.getLong(1); |
| | | } |
| | | } |
| | | return nb == 1; |
| | | } |
| | | |
| | | private String columnExistsQuery(String columnName) { |
| | | return "SELECT COUNT(column_name)" |
| | | + " FROM information_schema.columns" |
| | | + " WHERE table_name = '" + tableName + "' AND column_name = '" + columnName + "'"; |
| | | } |
| | | |
| | | private String constraintExistsQuery(String constraintName) { |
| | | return "SELECT COUNT(*) FROM pg_constraint WHERE conname = '" + constraintName + "'"; |
| | | } |
| | | |
| | | private String tableExistsQuery() { |
| | | return "SELECT COUNT(table_name)" |
| | | + " FROM information_schema.tables" |
| | | + " WHERE table_schema LIKE 'public' AND table_type LIKE 'BASE TABLE' AND table_name = '" + tableName + "'"; |
| | | } |
| | | |
| | | public void addAppColumn(AppColumnDefinition appColumn) throws SQLException { |
| | | |
| | | try ( Statement stmt = connection.createStatement()) { |
| | | String query = addAppColumnQuery(appColumn).toString(); |
| | | stmt.execute(query); |
| | | } |
| | | } |
| | | |
| | | public void dropAppColumn(AppColumnDefinition appColumn) throws SQLException { |
| | | String query = dropColumnQuery(appColumn); |
| | | |
| | | try ( Statement stmt = connection.createStatement()) { |
| | | stmt.execute(query); |
| | | } |
| | | } |
| | | |
| | | public void dropConstraint(String constraintName) throws SQLException { |
| | | String query = dropConstraintQuery(constraintName); |
| | | |
| | | try ( Statement stmt = connection.createStatement()) { |
| | | stmt.execute(query); |
| | | } |
| | | } |
| | | |
| | | public void addPkConstraint(String constraintName) throws SQLException { |
| | | String query = addPkConstraintQuery(constraintName); |
| | | |
| | | try ( Statement stmt = connection.createStatement()) { |
| | | stmt.execute(query); |
| | | } |
| | | } |
| | | |
| | | private String dropColumnQuery(AppColumnDefinition column) { |
| | | StringBuilder query = new StringBuilder("ALTER TABLE "); |
| | | |
| | | query |
| | | .append(tableName) |
| | | .append(" DROP COLUMN IF EXISTS ") |
| | | .append(column.name()) |
| | | .append(";"); |
| | | |
| | | return query.toString(); |
| | | } |
| | | |
| | | private String dropConstraintQuery(String constraintName) { |
| | | StringBuilder query = new StringBuilder(); |
| | | |
| | | query.append("ALTER TABLE ") |
| | | .append(tableName) |
| | | .append(" DROP CONSTRAINT IF EXISTS ") |
| | | .append(constraintName) |
| | | .append(";"); |
| | | |
| | | return query.toString(); |
| | | } |
| | | |
| | | private String addPkConstraintQuery(String constraintName) { |
| | | StringBuilder query = new StringBuilder(); |
| | | |
| | | query.append("ALTER TABLE ") |
| | | .append(tableName) |
| | | .append(" ADD CONSTRAINT ") |
| | | .append(constraintName) |
| | | .append(" PRIMARY KEY(") |
| | | .append(new FdxConsultationIndexColumnDefinition().name()) |
| | | .append(");"); |
| | | |
| | | return query.toString(); |
| | | } |
| | | |
| | | private StringBuilder addAppColumnQuery(AppColumnDefinition column) { |
| | | StringBuilder query = new StringBuilder("ALTER TABLE "); |
| | | query |
| | | .append(tableName) |
| | | .append(" ADD COLUMN IF NOT EXISTS ") |
| | | .append(column.name()) |
| | | .append(" ") |
| | | .append(column.type()) |
| | | .append(column.isNull() ? " NULL " : " NOT NULL "); |
| | | |
| | | if (column.defaultValue() != null) { |
| | | query.append("DEFAULT ").append(column.defaultValue()); |
| | | } |
| | | return query; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.model.dataproduction.CommonDataProduction; |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.SQLException; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class UpdateDataProductionQuery { |
| | | |
| | | private final Connection connection; |
| | | private final CommonDataProduction dataProduction; |
| | | |
| | | public UpdateDataProductionQuery(CommonDataProduction dataProduction, Connection connection) { |
| | | this.connection = connection; |
| | | this.dataProduction = dataProduction; |
| | | } |
| | | |
| | | public void execute() throws SQLException { |
| | | try (PreparedStatement statement = connection.prepareStatement(queryString())) { |
| | | statement.setString(1, dataProduction.getStatutDataProduction().name()); |
| | | statement.setLong(2, dataProduction.getNbreElements()); |
| | | statement.setLong(3, dataProduction.getId()); |
| | | statement.executeUpdate(); |
| | | } |
| | | } |
| | | |
| | | private String queryString() { |
| | | String query = "UPDATE dataproduction SET statutdataproduction = ? , nbreelements = ? WHERE id = ?"; |
| | | return query; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryCriterion; |
| | | import com.megatim.fdxcommons.tools.database.contrat.DefaultPreparedStatementProcessor; |
| | | import com.megatim.fdxcommons.tools.database.contrat.QueryMetaData; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryParam; |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class UpdateQuery implements QueryMetaData<Void> { |
| | | |
| | | private final Connection connection; |
| | | private final QueryCriterion queryCriterion; |
| | | private final String tableName; |
| | | private final List<String> columnNames; |
| | | private final List<QueryParam> params; |
| | | |
| | | public UpdateQuery(Connection connection, QueryCriterion queryCriterion, String tableName, List<String> columnNames, List<QueryParam> params) { |
| | | this.connection = connection; |
| | | this.queryCriterion = queryCriterion; |
| | | this.tableName = tableName; |
| | | this.columnNames = columnNames; |
| | | this.params = params; |
| | | } |
| | | |
| | | @Override |
| | | public Void execute() throws Exception { |
| | | |
| | | System.out.println("<----------------------------------------------------------------------------------------------------------->"); |
| | | System.out.println(updateQuery()); |
| | | System.out.println("<----------------------------------------------------------------------------------------------------------->"); |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(updateQuery())) { |
| | | new DefaultPreparedStatementProcessor().process(statement, params); |
| | | statement.execute(); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | private String updateQuery() throws Exception { |
| | | return "UPDATE " + tableName + " " + setQueryPart() + " " + new WhereQueryString(queryCriterion).query(); |
| | | } |
| | | |
| | | private String setQueryPart() throws Exception { |
| | | |
| | | List<String> columnsToUpdate = new ArrayList<>(columnNames); |
| | | |
| | | StringBuilder query = new StringBuilder("SET "); |
| | | int index = 0; |
| | | |
| | | for (String column : columnsToUpdate) { |
| | | if ((index + 1) < columnsToUpdate.size()) { |
| | | query.append(column).append(" = ? ,"); |
| | | } else { |
| | | query.append(column).append(" = ?"); |
| | | } |
| | | index++; |
| | | } |
| | | return query.toString(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryCriterion; |
| | | import com.megatim.fdxcommons.model.enumeration.CriteriaLogicConnector; |
| | | import com.megatim.fdxcommons.model.enumeration.Operateur; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.BETWEEN; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.EQUALS; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.GREATER_OR_EQUALS_THAN; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.GREATER_THAN; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.IN; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.IS_NOT_NULL; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.IS_NULL; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.LIKE; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.LOWER_OR_EQUALS_THAN; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.LOWER_THAN; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.NOT_BETWEEN; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.NOT_EQUALS; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.NOT_IN; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class WhereQueryString { |
| | | |
| | | private final QueryCriterion queryCriterion; |
| | | |
| | | public WhereQueryString(QueryCriterion queryCriterion) { |
| | | this.queryCriterion = queryCriterion; |
| | | } |
| | | |
| | | public String query() { |
| | | StringBuilder query = new StringBuilder(""); |
| | | if (queryCriterion != null) { |
| | | query |
| | | .append(" WHERE ") |
| | | .append(buildQuery(queryCriterion)); |
| | | } |
| | | return query.toString(); |
| | | } |
| | | |
| | | private String buildQuery(QueryCriterion criterion) { |
| | | StringBuilder query = new StringBuilder(); |
| | | |
| | | if (criterion.getSubCriteria().isEmpty()) { |
| | | |
| | | switch (criterion.getOperateur()) { |
| | | case EQUALS: |
| | | case NOT_EQUALS: |
| | | case LIKE: |
| | | case GREATER_OR_EQUALS_THAN: |
| | | case GREATER_THAN: |
| | | case LOWER_OR_EQUALS_THAN: |
| | | case LOWER_THAN: |
| | | query.append(buildQueryWithSingleParameter(criterion)); |
| | | break; |
| | | case BETWEEN: |
| | | case NOT_BETWEEN: |
| | | query.append(buildBetweenQuery(criterion)); |
| | | break; |
| | | case IS_NOT_NULL: |
| | | case IS_NULL: |
| | | query.append(buildQueryWithoutParameter(criterion)); |
| | | break; |
| | | case NOT_IN: |
| | | case IN: |
| | | query.append(buildQueryWithMultipleParameters(criterion)); |
| | | break; |
| | | } |
| | | |
| | | } else { |
| | | |
| | | CriteriaLogicConnector criteriaLogicConnector = criterion.getCriteriaLogicConnector(); |
| | | int size = criterion.getSubCriteria().size(); |
| | | int index = 0; |
| | | |
| | | for (QueryCriterion c : criterion.getSubCriteria()) { |
| | | query |
| | | .append("(") |
| | | .append(buildQuery(c)) |
| | | .append(")"); |
| | | |
| | | if ((++index) < size) { |
| | | query.append(criteriaLogicConnector.equals(CriteriaLogicConnector.AND) ? " AND " : " OR "); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | return query.toString(); |
| | | } |
| | | |
| | | private String buildQueryWithoutParameter(QueryCriterion criterion) { |
| | | StringBuilder query = new StringBuilder(""); |
| | | query |
| | | .append(criterion.getNomColonne()) |
| | | .append(" ") |
| | | .append(criterion.getOperateur().getValue()); |
| | | return query.toString(); |
| | | } |
| | | |
| | | private String buildQueryWithSingleParameter(QueryCriterion criterion) { |
| | | StringBuilder query = new StringBuilder(""); |
| | | if (criterion.getOperateur().equals(Operateur.LIKE)) { |
| | | query |
| | | .append("LOWER(") |
| | | .append(criterion.getNomColonne()) |
| | | .append(") LIKE LOWER(?)"); |
| | | } else { |
| | | query |
| | | .append(criterion.getNomColonne()) |
| | | .append(" ") |
| | | .append(criterion.getOperateur().getValue()) |
| | | .append(" ?"); |
| | | } |
| | | |
| | | return query.toString(); |
| | | } |
| | | |
| | | private String buildBetweenQuery(QueryCriterion criterion) { |
| | | StringBuilder query = new StringBuilder(""); |
| | | query |
| | | .append(criterion.getNomColonne()) |
| | | .append(" ") |
| | | .append(criterion.getOperateur().getValue()) |
| | | .append(" ? ") |
| | | .append(" AND ") |
| | | .append(" ? "); |
| | | return query.toString(); |
| | | } |
| | | |
| | | private String buildQueryWithMultipleParameters(QueryCriterion criterion) { |
| | | StringBuilder query = new StringBuilder(""); |
| | | |
| | | query |
| | | .append(criterion.getNomColonne()) |
| | | .append(" ") |
| | | .append(criterion.getOperateur().getValue()) |
| | | .append("("); |
| | | |
| | | List values = (List) criterion.getCriteriaValue(); |
| | | |
| | | int size = values.size(); |
| | | for (int i = 0; i < size; i++) { |
| | | |
| | | if ((i + 1) < size) { |
| | | query.append("?,"); |
| | | } else { |
| | | query.append("?"); |
| | | } |
| | | |
| | | } |
| | | |
| | | query.append(")"); |
| | | |
| | | return query.toString(); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries.jpql; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.CriteriaLogicConnector; |
| | | import com.megatim.fdxcommons.model.enumeration.Operateur; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.BETWEEN; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.EQUALS; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.GREATER_OR_EQUALS_THAN; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.GREATER_THAN; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.IN; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.IS_NOT_NULL; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.IS_NULL; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.LIKE; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.LOWER_OR_EQUALS_THAN; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.LOWER_THAN; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.NOT_BETWEEN; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.NOT_EQUALS; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.NOT_IN; |
| | | import com.megatim.fdxcommons.tools.database.exceptions.BadQueryCriteriaException; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.jpql.JpqlQueryCriterion; |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | | /** |
| | | * |
| | | * @author lenovo |
| | | */ |
| | | public class JpqlWhereQueryString { |
| | | |
| | | private final JpqlQueryCriterion queryCriterion; |
| | | private final String classAlias; |
| | | private final AtomicInteger rang = new AtomicInteger(1); |
| | | |
| | | public JpqlWhereQueryString(JpqlQueryCriterion queryCriterion, String classAlias) { |
| | | this.queryCriterion = queryCriterion; |
| | | this.classAlias = classAlias; |
| | | } |
| | | |
| | | public String query() throws BadQueryCriteriaException { |
| | | StringBuilder query = new StringBuilder(""); |
| | | |
| | | if (queryCriterion != null) { |
| | | query |
| | | .append(" WHERE ") |
| | | .append(buildQuery(queryCriterion)); |
| | | } |
| | | return query.toString(); |
| | | } |
| | | |
| | | private String buildQuery(JpqlQueryCriterion criterion) throws BadQueryCriteriaException { |
| | | StringBuilder query = new StringBuilder(); |
| | | |
| | | if (criterion.getSubCriteria().isEmpty()) { |
| | | |
| | | switch (criterion.getOperateur()) { |
| | | case EQUALS: |
| | | case NOT_EQUALS: |
| | | case LIKE: |
| | | case GREATER_OR_EQUALS_THAN: |
| | | case GREATER_THAN: |
| | | case LOWER_OR_EQUALS_THAN: |
| | | case LOWER_THAN: |
| | | query.append(buildQueryWithSingleParameter(criterion)); |
| | | break; |
| | | case BETWEEN: |
| | | case NOT_BETWEEN: |
| | | query.append(buildBetweenQuery(criterion)); |
| | | break; |
| | | case IS_NOT_NULL: |
| | | case IS_NULL: |
| | | query.append(buildQueryWithoutParameter(criterion)); |
| | | break; |
| | | case NOT_IN: |
| | | case IN: |
| | | query.append(buildQueryWithMultipleParameters(criterion)); |
| | | break; |
| | | } |
| | | |
| | | } else { |
| | | |
| | | CriteriaLogicConnector criteriaLogicConnector = criterion.getCriteriaLogicConnector(); |
| | | if (criteriaLogicConnector == null) { |
| | | throw new BadQueryCriteriaException("Critère non valide : Connecteur logique absent"); |
| | | } |
| | | int size = criterion.getSubCriteria().size(); |
| | | int index = 0; |
| | | |
| | | for (JpqlQueryCriterion c : criterion.getSubCriteria()) { |
| | | query |
| | | .append("(") |
| | | .append(buildQuery(c)) |
| | | .append(")"); |
| | | |
| | | if ((++index) < size) { |
| | | query.append(criteriaLogicConnector.equals(CriteriaLogicConnector.AND) ? " AND " : " OR "); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | return query.toString(); |
| | | } |
| | | |
| | | private String buildQueryWithoutParameter(JpqlQueryCriterion criterion) { |
| | | StringBuilder query = new StringBuilder(""); |
| | | query |
| | | .append(classAlias) |
| | | .append(".") |
| | | .append(criterion.getNomColonne()) |
| | | .append(" ") |
| | | .append(criterion.getOperateur().getValue()); |
| | | return query.toString(); |
| | | } |
| | | |
| | | private String buildQueryWithSingleParameter(JpqlQueryCriterion criterion) { |
| | | StringBuilder query = new StringBuilder(""); |
| | | if (criterion.getOperateur().equals(Operateur.LIKE)) { |
| | | query |
| | | .append("LOWER(") |
| | | .append(classAlias) |
| | | .append(".") |
| | | .append(criterion.getNomColonne()) |
| | | .append(") LIKE LOWER(?") |
| | | .append(rang.getAndIncrement()) |
| | | .append(")"); |
| | | } else { |
| | | query |
| | | .append(classAlias) |
| | | .append(".") |
| | | .append(criterion.getNomColonne()) |
| | | .append(" ") |
| | | .append(criterion.getOperateur().getValue()) |
| | | .append(" ?") |
| | | .append(rang.getAndIncrement()) |
| | | .append(" "); |
| | | } |
| | | |
| | | return query.toString(); |
| | | } |
| | | |
| | | private String buildBetweenQuery(JpqlQueryCriterion criterion) { |
| | | StringBuilder query = new StringBuilder(""); |
| | | query |
| | | .append(classAlias) |
| | | .append(".") |
| | | .append(criterion.getNomColonne()) |
| | | .append(" ") |
| | | .append(criterion.getOperateur().getValue()) |
| | | .append(" ?") |
| | | .append(rang.getAndIncrement()) |
| | | .append(" AND ") |
| | | .append(" ?") |
| | | .append(rang.getAndIncrement()) |
| | | .append(" "); |
| | | return query.toString(); |
| | | } |
| | | |
| | | private String buildQueryWithMultipleParameters(JpqlQueryCriterion criterion) { |
| | | StringBuilder query = new StringBuilder(""); |
| | | |
| | | query |
| | | .append(classAlias) |
| | | .append(".") |
| | | .append(criterion.getNomColonne()) |
| | | .append(" ") |
| | | .append(criterion.getOperateur().getValue()) |
| | | .append("("); |
| | | |
| | | List values = (List) criterion.getCriteriaValue(); |
| | | |
| | | int size = values.size(); |
| | | for (int i = 0; i < size; i++) { |
| | | |
| | | if ((i + 1) < size) { |
| | | query.append("?").append(rang.getAndIncrement()).append(", "); |
| | | } else { |
| | | query.append("?").append(rang.getAndIncrement()); |
| | | } |
| | | |
| | | } |
| | | |
| | | query.append(")"); |
| | | |
| | | return query.toString(); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries.jpql; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.OrderByType; |
| | | import com.megatim.fdxcommons.model.pojo.OrderByDefinition; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.jpql.JpqlQueryCriterion; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class JqplQueryString { |
| | | |
| | | private final String simpleClassName; |
| | | |
| | | private final JpqlQueryCriterion queryCriterion; |
| | | |
| | | public JqplQueryString(String simpleClassName, JpqlQueryCriterion queryCriterion) { |
| | | this.simpleClassName = simpleClassName; |
| | | this.queryCriterion = queryCriterion; |
| | | } |
| | | |
| | | public String selectQuery(List<OrderByDefinition> orderByFields) throws Exception { |
| | | String classAlias = simpleClassName.toLowerCase().charAt(0) + ""; |
| | | String selectFromQueryPart = "SELECT " + classAlias + " FROM " + simpleClassName + " " + classAlias + " "; |
| | | String whereQueryPart = new JpqlWhereQueryString(queryCriterion, classAlias).query(); |
| | | String query = selectFromQueryPart + " " + whereQueryPart + " " + orderByClause(classAlias, orderByFields); |
| | | return query; |
| | | } |
| | | |
| | | public String countQuery() throws Exception { |
| | | String classAlias = simpleClassName.toLowerCase().charAt(0) + ""; |
| | | String selectFromQueryPart = "SELECT COUNT(*) FROM " + simpleClassName + " " + classAlias + " "; |
| | | String whereQueryPart = new JpqlWhereQueryString(queryCriterion, classAlias).query(); |
| | | String query = selectFromQueryPart + " " + whereQueryPart; |
| | | return query; |
| | | } |
| | | |
| | | private String orderByClause(String classAlias, List<OrderByDefinition> orderByFields) { |
| | | StringBuilder orderBy = new StringBuilder("ORDER BY "); |
| | | if (orderByFields == null || orderByFields.isEmpty()) { |
| | | return ""; |
| | | } |
| | | |
| | | for (OrderByDefinition def : orderByFields) { |
| | | if (def.getFieldName() != null && !def.getFieldName().isEmpty()) { |
| | | String orderByType = def.getOrderByType() != null ? def.getOrderByType().name() : OrderByType.ASC.name(); |
| | | orderBy.append(classAlias).append(".").append(def.getFieldName()).append(" ").append(orderByType).append(","); |
| | | } |
| | | } |
| | | orderBy.replace(orderBy.length() - 1, orderBy.length(), "");//retirer la dernière virgule |
| | | return orderBy.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.fdxcommons.tools.database.queries.json; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.TypeDonnee; |
| | | import static com.megatim.fdxcommons.model.enumeration.TypeDonnee.ALPHANUMERIQUE; |
| | | import static com.megatim.fdxcommons.model.enumeration.TypeDonnee.DATE; |
| | | import static com.megatim.fdxcommons.model.enumeration.TypeDonnee.DECIMAL; |
| | | import static com.megatim.fdxcommons.model.enumeration.TypeDonnee.NUMERIQUE; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.contrat.AppColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.contrat.QueryMetaData; |
| | | import com.megatim.fdxcommons.tools.database.exceptions.BadColumnTypeException; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.AppColumnDefinitions; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.IndexColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.ParentIdColumnDefinition; |
| | | import com.megatim.fdxcommons.model.pojo.JsonTableDefinition; |
| | | import java.sql.Connection; |
| | | import java.sql.JDBCType; |
| | | import java.sql.Statement; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class CreateJsonTableIfNotExistQuery implements QueryMetaData<Void> { |
| | | |
| | | private final Connection connection; |
| | | private final AppColumnDefinitions appColumnDefinitions; |
| | | private final JsonTableDefinition tableDefinition; |
| | | private final List<String> queries = new ArrayList<>(); |
| | | |
| | | public CreateJsonTableIfNotExistQuery(Connection connection, AppColumnDefinitions appColumnDefinitions, JsonTableDefinition tableDefinition) { |
| | | this.connection = connection; |
| | | this.appColumnDefinitions = appColumnDefinitions; |
| | | this.tableDefinition = tableDefinition; |
| | | } |
| | | |
| | | @Override |
| | | public Void execute() throws Exception { |
| | | query(tableDefinition); |
| | | |
| | | for (String query : queries) { |
| | | System.out.println(query); |
| | | } |
| | | |
| | | try ( Statement stmt = connection.createStatement()) { |
| | | for (String query : queries) { |
| | | stmt.execute(query); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private void query(JsonTableDefinition jsonTableDefinition) throws BadColumnTypeException { |
| | | StringBuilder query = new StringBuilder("CREATE TABLE IF NOT EXISTS " + jsonTableDefinition.getTableName() + "("); |
| | | List<AppColumnDefinition> primaryKeys = new ArrayList<>(); |
| | | |
| | | for (ColumnDefinition colDef : jsonTableDefinition.getColumnDefs()) { |
| | | query.append(colDef.getName().toLowerCase()).append(" ").append(sqlColumnType(colDef)); |
| | | if (colDef.isRequired()) { |
| | | query.append(" NOT NULL"); |
| | | } |
| | | query.append(", "); |
| | | } |
| | | |
| | | for (AppColumnDefinition appColumnDefinition : appColumnDefinitions.appColumns()) { |
| | | query.append(columnDefinitonString(appColumnDefinition)).append(", "); |
| | | |
| | | if (appColumnDefinition.isPrimaryKey()) { |
| | | primaryKeys.add(appColumnDefinition); |
| | | } |
| | | } |
| | | //Defintion de la colonne fdx_parent_id |
| | | if (jsonTableDefinition.getParentTableName() != null) { |
| | | query.append(columnDefinitonString(new ParentIdColumnDefinition())).append(", "); |
| | | } |
| | | |
| | | if (!primaryKeys.isEmpty()) { |
| | | query.append(" PRIMARY KEY("); |
| | | primaryKeys.stream().forEach(pk -> query.append(pk.name()).append(", ")); |
| | | |
| | | //Retirer la dernière virgule |
| | | query.replace(query.length() - 2, query.length(), ")"); |
| | | } else { |
| | | //Retirer la dernière virgule |
| | | query.replace(query.length() - 2, query.length(), ""); |
| | | } |
| | | |
| | | //Contrainte de clé étrangère sur fdx_parent_id |
| | | if (jsonTableDefinition.getParentTableName() != null) { |
| | | query.append(parentIdDefintion(jsonTableDefinition.getParentTableName(), new ParentIdColumnDefinition().name(), new IndexColumnDefinition().name())); |
| | | } |
| | | query.append(");"); |
| | | |
| | | queries.add(query.toString()); |
| | | |
| | | if (!jsonTableDefinition.getTablesDefinition().isEmpty()) { |
| | | for (JsonTableDefinition tableDef : jsonTableDefinition.getTablesDefinition()) { |
| | | query(tableDef); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private String parentIdDefintion(String parentTableName, String parentIdColumnName, String indexColumnName) { |
| | | StringBuilder builder = new StringBuilder(""); |
| | | builder.append(", FOREIGN KEY (").append(parentIdColumnName).append(") REFERENCES ").append(parentTableName).append("(").append(indexColumnName).append(")"); |
| | | |
| | | return builder.toString(); |
| | | } |
| | | |
| | | private String sqlColumnType(ColumnDefinition colDef) throws BadColumnTypeException { |
| | | switch (TypeDonnee.fromValeur(colDef.getTypeDonnee())) { |
| | | case ALPHANUMERIQUE: |
| | | return jdbcType(colDef) + "(" + colDef.getTaille() + ")"; |
| | | case NUMERIQUE: |
| | | return jdbcType(colDef).getName(); |
| | | case DATE: |
| | | String requiredDefinition = colDef.isRequired() ? " NOT NULL" : " NULL"; |
| | | return jdbcType(colDef).getName() + requiredDefinition; |
| | | case DECIMAL: |
| | | return jdbcType(colDef) + "(" + colDef.getTaille() + "," + 4 + ")"; |
| | | } |
| | | throw new BadColumnTypeException("Type de colonne incorrect " + colDef.getTypeDonnee()); |
| | | } |
| | | |
| | | private JDBCType jdbcType(ColumnDefinition colDef) throws BadColumnTypeException { |
| | | switch (TypeDonnee.fromValeur(colDef.getTypeDonnee())) { |
| | | case NUMERIQUE: |
| | | return colDef.getTaille() < 5 ? JDBCType.SMALLINT : JDBCType.BIGINT; |
| | | case DECIMAL: |
| | | return JDBCType.DECIMAL; |
| | | case DATE: |
| | | return JDBCType.TIMESTAMP; |
| | | case ALPHANUMERIQUE: |
| | | return JDBCType.VARCHAR; |
| | | } |
| | | throw new BadColumnTypeException("Type de colonne incorrect " + colDef.getName()); |
| | | } |
| | | |
| | | private String columnDefinitonString(AppColumnDefinition column) throws BadColumnTypeException { |
| | | StringBuilder definition = new StringBuilder(); |
| | | definition |
| | | .append(column.name().toLowerCase()) |
| | | .append(" ") |
| | | .append(column.type()) |
| | | .append(" ") |
| | | .append(column.isNull() ? "NULL " : "NOT NULL "); |
| | | |
| | | if (column.defaultValue() != null) { |
| | | definition |
| | | .append("DEFAULT ") |
| | | .append(column.defaultValue()); |
| | | } |
| | | return definition.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.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.model.pojo.JsonTableDefinition; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.FdxApiColumnDefinitions; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.FdxConsultationColumnDefinitions; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class AliasedQueryCriterion { |
| | | |
| | | private final JsonTableDefinition tableDefinition; |
| | | private final QueryCriterion queryCriterion; |
| | | private final Map<String, String> tablesNameToAlias; |
| | | private final FdxApiColumnDefinitions apiColumnDefinitions = new FdxApiColumnDefinitions(); |
| | | private final FdxConsultationColumnDefinitions fdxConsColumnDefinitions = new FdxConsultationColumnDefinitions(); |
| | | |
| | | public AliasedQueryCriterion(JsonTableDefinition tableDefinition, QueryCriterion queryCriterion, Map<String, String> tablesNameToAlias) { |
| | | this.tableDefinition = tableDefinition; |
| | | this.queryCriterion = queryCriterion; |
| | | this.tablesNameToAlias = tablesNameToAlias; |
| | | } |
| | | |
| | | public QueryCriterion aliasedQueryCriterion() { |
| | | return queryCriterion != null ? aliasedQueryCriterion(queryCriterion) : null; |
| | | } |
| | | |
| | | private QueryCriterion aliasedQueryCriterion(QueryCriterion criterion) { |
| | | if (criterion == null) { |
| | | return null; |
| | | } |
| | | if (criterion.getSubCriteria() != null && !criterion.getSubCriteria().isEmpty() && criterion.getCriteriaLogicConnector() != null) { |
| | | List<QueryCriterion> subCriteria = new ArrayList<>(); |
| | | |
| | | for (QueryCriterion qc : criterion.getSubCriteria()) { |
| | | QueryCriterion parseCriterion = aliasedQueryCriterion(qc); |
| | | |
| | | if (parseCriterion != null) { |
| | | subCriteria.add(parseCriterion); |
| | | } |
| | | } |
| | | if (!subCriteria.isEmpty()) { |
| | | return new QueryCriterion(null, |
| | | null, |
| | | null, |
| | | criterion.getCriteriaLogicConnector(), |
| | | subCriteria |
| | | ); |
| | | } |
| | | } else if ((criterion.getSubCriteria() == null || criterion.getSubCriteria().isEmpty())) { |
| | | return new QueryCriterion(columnFullQualifiedName(criterion.getNomColonne()), |
| | | criterion.getCriteriaValue(), |
| | | criterion.getOperateur(), |
| | | null, |
| | | Arrays.asList() |
| | | ); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private String tableName(String nomColonne) { |
| | | if (apiColumnDefinitions.isAppColumnDefinition(nomColonne) || fdxConsColumnDefinitions.isAppColumnDefinition(nomColonne)) { |
| | | return tableDefinition.getTableName(); |
| | | } else if (tableDefinition.getColumnDefs().stream().filter(c -> c.getName().equalsIgnoreCase(nomColonne)).findFirst().isPresent()) { |
| | | return tableDefinition.getTableName(); |
| | | } else { |
| | | return tableName(nomColonne, tableDefinition.getTablesDefinition()); |
| | | } |
| | | } |
| | | |
| | | private String tableName(String nomColonne, List<JsonTableDefinition> tablesDef) { |
| | | String tableName = null; |
| | | for (JsonTableDefinition t : tablesDef) { |
| | | tableName = tableName(nomColonne, t); |
| | | |
| | | if (tableName != null) { |
| | | return tableName; |
| | | } |
| | | } |
| | | return tableName; |
| | | } |
| | | |
| | | private String columnFullQualifiedName(String nomColonne) { |
| | | String[] nomColonneArray = nomColonne.split("\\."); |
| | | String finalNomColonne = nomColonneArray[nomColonneArray.length - 1]; |
| | | String tableName = tableName(finalNomColonne); |
| | | |
| | | return tablesNameToAlias.get(tableName) + "." + finalNomColonne; |
| | | } |
| | | |
| | | private String tableName(String nomColonne, JsonTableDefinition t) { |
| | | if (apiColumnDefinitions.isAppColumnDefinition(nomColonne) || fdxConsColumnDefinitions.isAppColumnDefinition(nomColonne)) { |
| | | return t.getTableName(); |
| | | } else if (t.getColumnDefs().stream().filter(c -> c.getName().equalsIgnoreCase(nomColonne)).findFirst().isPresent()) { |
| | | return t.getTableName(); |
| | | } else { |
| | | if (t.getTablesDefinition().isEmpty()) { |
| | | return null; |
| | | } else { |
| | | return tableName(nomColonne, t.getTablesDefinition()); |
| | | } |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.contrat.TypeFichierDataColumn; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class ApiTypeFichierDataColumn implements TypeFichierDataColumn { |
| | | |
| | | final String columnName; |
| | | final Object value; |
| | | |
| | | public ApiTypeFichierDataColumn(String columnName, Object value) { |
| | | this.columnName = columnName; |
| | | this.value = value; |
| | | } |
| | | |
| | | @Override |
| | | public String column() { |
| | | return columnName; |
| | | } |
| | | |
| | | @Override |
| | | public Object value() { |
| | | return value; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.contrat.TypeFichierDataColumn; |
| | | import com.megatim.fdxcommons.tools.database.contrat.TypeFichierDataRow; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class ApiTypeFichierDataRow implements TypeFichierDataRow { |
| | | |
| | | private final LinkedHashMap<String, Object> entity; |
| | | private final List<TypeFichierDataColumn> columns = new ArrayList<>(); |
| | | |
| | | public ApiTypeFichierDataRow(LinkedHashMap<String, Object> entity) { |
| | | this.entity = entity; |
| | | } |
| | | |
| | | @Override |
| | | public List<TypeFichierDataColumn> columns() { |
| | | return entity |
| | | .entrySet() |
| | | .stream() |
| | | .map(e -> new ApiTypeFichierDataColumn(e.getKey(), e.getValue())) |
| | | .sorted((c1, c2) -> c1.column().compareTo(c2.column())) //On se rassure de classer le résultat |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | 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.contrat.TypeFichierDataRow; |
| | | import com.megatim.fdxcommons.tools.database.contrat.TypeFichierInsertMetaData; |
| | | import com.megatim.fdxcommons.tools.database.exceptions.TypeFichierDataBadRequest; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class ApiTypeFichierInsertData implements TypeFichierInsertMetaData { |
| | | |
| | | private final FdxParsedData fdxParsedData; |
| | | private final String tableName; |
| | | |
| | | public ApiTypeFichierInsertData(String tableName, FdxParsedData fdxParsedData) { |
| | | this.tableName = tableName; |
| | | this.fdxParsedData = fdxParsedData; |
| | | } |
| | | |
| | | @Override |
| | | public String tableName() { |
| | | return tableName; |
| | | } |
| | | |
| | | @Override |
| | | public List<String> columnNames() throws TypeFichierDataBadRequest, BadDataValueException, LocalDateTimeValueParseError, ColumnNotFoundException { |
| | | //On retourne les colonnes de l'entité |
| | | return fdxParsedData.data().get(0) |
| | | .entrySet() |
| | | .stream() |
| | | .map(e -> e.getKey()) |
| | | .sorted((e1, e2) -> e1.compareTo(e2)) //On se rassure de classer le résultat |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Override |
| | | public List<TypeFichierDataRow> rows() throws TypeFichierDataBadRequest, BadDataValueException, LocalDateTimeValueParseError, ColumnNotFoundException { |
| | | List<TypeFichierDataRow> rows = new ArrayList<>(); |
| | | for (Map<String, Object> entity : fdxParsedData.data()) { |
| | | rows.add(new DefaultTypeFichierDataRow(entity)); |
| | | } |
| | | return rows; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | 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.contrat.TypeFichierDataRow; |
| | | import com.megatim.fdxcommons.tools.database.contrat.TypeFichierUpdateMetaData; |
| | | import com.megatim.fdxcommons.tools.database.exceptions.TypeFichierDataBadRequest; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class ApiUpdateTypeFichierData implements TypeFichierUpdateMetaData { |
| | | |
| | | private final String tableName; |
| | | private final FdxParsedDataRow fdxParsedDataRow; |
| | | |
| | | public ApiUpdateTypeFichierData(String tableName, FdxParsedDataRow fdxParsedDataRow) { |
| | | this.tableName = tableName; |
| | | this.fdxParsedDataRow = fdxParsedDataRow; |
| | | } |
| | | |
| | | @Override |
| | | public String tableName() { |
| | | return tableName; |
| | | } |
| | | |
| | | @Override |
| | | public List<String> columnNames() throws TypeFichierDataBadRequest, ColumnNotFoundException, BadDataValueException, LocalDateTimeValueParseError { |
| | | //NB On itère selon l'ordre des champs dans l'entité |
| | | return fdxParsedDataRow.dataRow() |
| | | .entrySet() |
| | | .stream() |
| | | .map(e -> e.getKey()) |
| | | .sorted((e1, e2) -> e1.compareTo(e2)) //On se rassure de classer le résultat |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Override |
| | | public TypeFichierDataRow row() throws ColumnNotFoundException, BadDataValueException, LocalDateTimeValueParseError { |
| | | return new DefaultTypeFichierDataRow(fdxParsedDataRow.dataRow()); |
| | | } |
| | | |
| | | } |
| 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.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.contrat.TypeFichierDataRow; |
| | | import com.megatim.fdxcommons.tools.database.contrat.TypeFichierInsertMetaData; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class ConsultationTypeFichierInsertData implements TypeFichierInsertMetaData { |
| | | |
| | | private final List<TypeFichierDataRow> rows; |
| | | private final String tableName; |
| | | |
| | | public ConsultationTypeFichierInsertData(List<TypeFichierDataRow> rows, String tableName) { |
| | | this.rows = rows; |
| | | this.tableName = tableName; |
| | | } |
| | | |
| | | @Override |
| | | public List<String> columnNames() throws Exception { |
| | | return rows.get(0).columns() |
| | | .stream() |
| | | .map(e -> e.column()) |
| | | .sorted((e1, e2) -> e1.compareTo(e2)) //On se rassure de classer le résultat |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Override |
| | | public String tableName() { |
| | | return tableName; |
| | | } |
| | | |
| | | @Override |
| | | public List<TypeFichierDataRow> rows() throws Exception { |
| | | return rows; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.exceptions.LocalDateTimeValueParseError; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.YearMonth; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.format.DateTimeParseException; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class CriteriaLocalDateTimeValue { |
| | | |
| | | private final String format; |
| | | private final Object value; |
| | | |
| | | public CriteriaLocalDateTimeValue(String format, Object value) { |
| | | this.format = format; |
| | | this.value = value; |
| | | } |
| | | |
| | | public LocalDateTime value() throws LocalDateTimeValueParseError { |
| | | final String stringValue = value.toString(); |
| | | |
| | | try { |
| | | if ((format.length() == 8 || format.length() == 10) && format.contains("yyyy") && format.contains("MM") && format.contains("dd")) { |
| | | |
| | | LocalDate localDate = LocalDate.parse(stringValue, DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | return localDate.atTime(LocalTime.MIN); |
| | | |
| | | } else if ((format.length() == 6 || format.length() == 8) && format.contains("yyyy") && format.contains("MM")) { |
| | | YearMonth yearMonth = YearMonth.parse(stringValue, DateTimeFormatter.ofPattern("yyyy-MM")); |
| | | return LocalDateTime.from(yearMonth.atDay(1)); |
| | | |
| | | } else if (format.length() == 4 && format.equals("yyyy")) { |
| | | return LocalDateTime.of(Integer.parseInt(stringValue), 1, 1, 0, 0, 0, 0); |
| | | } |
| | | |
| | | } catch (DateTimeParseException e) { |
| | | throw new LocalDateTimeValueParseError("Impossible de parser la valeur " + value + " au format " + format); |
| | | } |
| | | |
| | | throw new LocalDateTimeValueParseError("Impossible de parser la valeur " + value + " au format " + format); |
| | | } |
| | | |
| | | } |
| 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.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.contrat.JsonTypeFichierDataRow; |
| | | import com.megatim.fdxcommons.tools.database.contrat.TypeFichierDataColumn; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class DefaultJsonTypeFichierDataRow implements JsonTypeFichierDataRow { |
| | | |
| | | private final Map<String, Object> entity; |
| | | |
| | | public DefaultJsonTypeFichierDataRow(Map<String, Object> entity) { |
| | | this.entity = entity; |
| | | } |
| | | |
| | | @Override |
| | | public List<TypeFichierDataColumn> columns() throws Exception { |
| | | return entity |
| | | .entrySet() |
| | | .stream() |
| | | .filter(v -> !(v.getValue() instanceof Map)) |
| | | .map(e -> new DefaultTypeFichierDataColumn(e.getKey(), e.getValue())) |
| | | .sorted((c1, c2) -> c1.column().compareTo(c2.column())) //On se rassure de classer le résultat |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Override |
| | | public List<JsonTypeFichierDataRow> children() { |
| | | throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.contrat.TypeFichierDataColumn; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class DefaultTypeFichierDataColumn implements TypeFichierDataColumn { |
| | | |
| | | private final String column; |
| | | private final Object value; |
| | | |
| | | public DefaultTypeFichierDataColumn(String column, Object value) { |
| | | this.column = column; |
| | | this.value = value; |
| | | } |
| | | |
| | | @Override |
| | | public String column() { |
| | | return column; |
| | | } |
| | | |
| | | @Override |
| | | public Object value() throws Exception { |
| | | return value; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.contrat.TypeFichierDataColumn; |
| | | import com.megatim.fdxcommons.tools.database.contrat.TypeFichierDataRow; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class DefaultTypeFichierDataRow implements TypeFichierDataRow { |
| | | |
| | | private final Map<String, Object> entity; |
| | | |
| | | public DefaultTypeFichierDataRow(Map<String, Object> entity) { |
| | | this.entity = entity; |
| | | } |
| | | |
| | | @Override |
| | | public List<TypeFichierDataColumn> columns() { |
| | | return entity |
| | | .entrySet() |
| | | .stream() |
| | | .map(e -> new DefaultTypeFichierDataColumn(e.getKey(), e.getValue())) |
| | | .sorted((c1, c2) -> c1.column().compareTo(c2.column())) //On se rassure de classer le résultat |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.model.integration.TableDefinition; |
| | | 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.utils.FdxParsedDataAction; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ForkJoinPool; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class FdxParsedData { |
| | | |
| | | private final List<LinkedHashMap<String, Object>> sourceData; |
| | | private final TableDefinition tableDefinition; |
| | | |
| | | public FdxParsedData(List<LinkedHashMap<String, Object>> sourceData, TableDefinition tableDefinition) { |
| | | this.sourceData = sourceData; |
| | | this.tableDefinition = tableDefinition; |
| | | } |
| | | |
| | | public List<Map<String, Object>> data() throws BadDataValueException, LocalDateTimeValueParseError, ColumnNotFoundException { |
| | | ForkJoinPool pool = new ForkJoinPool(); |
| | | return pool.invoke(new FdxParsedDataAction(sourceData, tableDefinition)); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.TypeDonnee; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.model.integration.TableDefinition; |
| | | 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.math.BigDecimal; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | import org.apache.commons.validator.GenericValidator; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class FdxParsedDataRow { |
| | | |
| | | private final Map<String, Object> data; |
| | | private final Map<String, ColumnDefinition> columnNameToColumnDefinition; |
| | | private final TableDefinition tableDefinition; |
| | | private final Map<String, Object> row = new LinkedHashMap<>(); |
| | | |
| | | public FdxParsedDataRow(Map<String, Object> data, TableDefinition tableDefinition) { |
| | | this.data = data; |
| | | this.tableDefinition = tableDefinition; |
| | | this.columnNameToColumnDefinition |
| | | = tableDefinition.getColumnDefinitions() |
| | | .stream() |
| | | .collect(Collectors.toMap(c -> c.getName().trim().toLowerCase(), c -> c)); |
| | | } |
| | | |
| | | public Map<String, Object> dataRow() throws ColumnNotFoundException, BadDataValueException, LocalDateTimeValueParseError { |
| | | |
| | | if (row.isEmpty()) { |
| | | |
| | | for (Map.Entry<String, Object> entry : data.entrySet()) { |
| | | |
| | | String key = entry.getKey(); |
| | | Object value = entry.getValue(); |
| | | |
| | | ColumnDefinition columnDefinition = columnNameToColumnDefinition.get(key.trim().toLowerCase()); |
| | | if (columnDefinition == null) { |
| | | throw new ColumnNotFoundException("La colonne " + key + " n'est pas présente pour ce fichier"); |
| | | } |
| | | row.put(key.trim(), parse(columnDefinition, value)); |
| | | } |
| | | } |
| | | |
| | | return row; |
| | | } |
| | | |
| | | private Object parse(ColumnDefinition columnDefinition, Object value) throws BadDataValueException, LocalDateTimeValueParseError { |
| | | |
| | | String columnType = columnDefinition.getTypeDonnee(); |
| | | |
| | | if (columnType.equals(TypeDonnee.ALPHANUMERIQUE.toString()) && (value == null |
| | | || (value instanceof String && lengthLowerOrEquals(((String) value).trim(), columnDefinition.getTaille())))) { |
| | | |
| | | return value != null ? value.toString().trim() : value; |
| | | |
| | | } else if (columnType.equals(TypeDonnee.NUMERIQUE.toString())) { |
| | | |
| | | if (value == null || value.toString().trim().isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | String stringValue = value.toString().trim() |
| | | .replaceAll("\\s+", "") |
| | | .replaceAll("\\u00A0", "")//nbsp |
| | | .replaceAll(" ", ""); |
| | | if (lengthLowerOrEquals(stringValue, columnDefinition.getTaille()) && GenericValidator.isLong(stringValue)) { |
| | | return Long.valueOf(stringValue); |
| | | } |
| | | |
| | | } else if (columnType.equals(TypeDonnee.DECIMAL.toString())) { |
| | | |
| | | if (value == null || value.toString().trim().isEmpty()) { |
| | | return null; |
| | | } |
| | | String stringValue = value |
| | | .toString() |
| | | .trim() |
| | | .replaceAll("\\s+", "") |
| | | .replaceAll("\\u00A0", "")//nbsp |
| | | .replaceAll(" ", ""); |
| | | |
| | | if (lengthLowerOrEquals(stringValue, columnDefinition.getTaille() + columnDefinition.getTaillePartieDecimale() + 1)) { |
| | | try { |
| | | return new BigDecimal(stringValue); |
| | | } catch (Exception ex) { |
| | | } |
| | | } |
| | | |
| | | } else if (columnType.equals(TypeDonnee.DATE.toString())) { |
| | | |
| | | if (value == null || value.toString().trim().isEmpty()) { |
| | | return null; |
| | | } |
| | | String stringValue = value.toString().trim() |
| | | .replaceAll("\\s+", "") |
| | | .replaceAll("\\u00A0", "")//nbsp |
| | | .replaceAll(" ", ""); |
| | | |
| | | if (lengthEquals(stringValue, columnDefinition.getTaille()) && GenericValidator.isDate(stringValue, columnDefinition.getFormatDate(), true)) { |
| | | return new InsertionLocalDateTimeValue(columnDefinition.getFormatDate(), value).value(); |
| | | } |
| | | } |
| | | |
| | | throw new BadDataValueException("La valeur " + value + " ne correspond pas au format attendu pour la colonne " + columnDefinition.getName()); |
| | | } |
| | | |
| | | private boolean lengthEquals(String value, int columnMaxLength) { |
| | | return value.trim().length() == columnMaxLength; |
| | | } |
| | | |
| | | private boolean lengthLowerOrEquals(String value, int columnMaxLength) { |
| | | return value.trim().length() <= columnMaxLength; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.model.integration.TableDefinition; |
| | | import com.megatim.fdxcommons.model.integration.enums.FileExtension; |
| | | import com.megatim.fdxcommons.model.referentiel.natureproduction.NatureProduction; |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import javax.naming.NamingException; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class FdxTableDefinition { |
| | | |
| | | private final String referentielVersion; |
| | | private final String codeTypeFichier; |
| | | private final Connection connection; |
| | | private TableDefinition tableDefinition; |
| | | private final List<Boolean> cachedNatureProduction = new ArrayList<>(1); |
| | | |
| | | public FdxTableDefinition(String referentielVersion, String codeTypeFichier, Connection connection) { |
| | | this.referentielVersion = referentielVersion; |
| | | this.codeTypeFichier = codeTypeFichier; |
| | | this.connection = connection; |
| | | } |
| | | |
| | | public TableDefinition tableDefinition() throws SQLException, NamingException { |
| | | if (tableDefinition == null) { |
| | | tableDefinition = tableDefinition(columnDefinitions()); |
| | | } |
| | | return tableDefinition; |
| | | } |
| | | |
| | | public boolean isReferentiel() throws NamingException, SQLException { |
| | | |
| | | if (cachedNatureProduction.isEmpty()) { |
| | | |
| | | String query = "SELECT natureproduction " |
| | | + "FROM natureproductionfichier " |
| | | + "WHERE typefichier_code = ? AND referentiel_version = ?"; |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(query)) { |
| | | |
| | | statement.setString(1, codeTypeFichier); |
| | | statement.setString(2, referentielVersion); |
| | | |
| | | try ( ResultSet resultSet = statement.executeQuery()) { |
| | | if (resultSet.next()) { |
| | | cachedNatureProduction.add(resultSet.getString("natureproduction").equals(NatureProduction.REFERENTIELLE.getValue())); |
| | | } else { |
| | | cachedNatureProduction.add(Boolean.TRUE); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | return cachedNatureProduction.get(0); |
| | | } |
| | | |
| | | private List<ColumnDefinition> columnDefinitions() throws NamingException, SQLException { |
| | | List<ColumnDefinition> columnDefinitions = new ArrayList<>(); |
| | | |
| | | String query = "SELECT name, formatdate, position, taille, taillepartiedecimale, typedonnee " |
| | | + "FROM columndefinition " |
| | | + "WHERE codetypefichier = ? AND referentielversion = ?"; |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(query)) { |
| | | |
| | | statement.setString(1, codeTypeFichier); |
| | | statement.setString(2, referentielVersion); |
| | | |
| | | try ( ResultSet resultSet = statement.executeQuery()) { |
| | | |
| | | while (resultSet.next()) { |
| | | |
| | | String name = resultSet.getString("name"); |
| | | String typeDonnee = resultSet.getString("typedonnee"); |
| | | String formatDate = resultSet.getString("formatdate"); |
| | | int position = resultSet.getInt("position"); |
| | | int taille = resultSet.getInt("taille"); |
| | | int taillePartieDecimale = resultSet.getInt("taillepartiedecimale"); |
| | | |
| | | columnDefinitions.add(new ColumnDefinition(codeTypeFichier, referentielVersion, name, typeDonnee, taille, taillePartieDecimale, formatDate, position)); |
| | | } |
| | | } |
| | | } |
| | | Collections.sort(columnDefinitions, (ColumnDefinition c1, ColumnDefinition c2) -> Integer.valueOf(c1.getPosition()).compareTo(c2.getPosition())); |
| | | return columnDefinitions; |
| | | } |
| | | |
| | | private TableDefinition tableDefinition(List<ColumnDefinition> colDefs) throws SQLException { |
| | | String query = "SELECT columndelimiter, linedelimiter, extension, headerpresent" |
| | | + " FROM tableDefinition" |
| | | + " WHERE codetypefichier = ? AND referentielversion = ?"; |
| | | |
| | | try ( PreparedStatement statement = connection.prepareStatement(query)) { |
| | | |
| | | statement.setString(1, codeTypeFichier); |
| | | statement.setString(2, referentielVersion); |
| | | |
| | | try ( ResultSet resultSet = statement.executeQuery()) { |
| | | |
| | | if (resultSet.next()) { |
| | | String columndelimiter = resultSet.getString("columndelimiter"); |
| | | String linedelimiter = resultSet.getString("linedelimiter"); |
| | | String extension = resultSet.getString("extension"); |
| | | Boolean headerpresent = resultSet.getBoolean("headerpresent"); |
| | | |
| | | return new TableDefinition(referentielVersion, codeTypeFichier, headerpresent, |
| | | columndelimiter, linedelimiter, FileExtension.fromValeur(extension), colDefs); |
| | | } |
| | | } |
| | | } |
| | | return new TableDefinition(referentielVersion, codeTypeFichier, null, null, null, null, colDefs); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.exceptions.LocalDateTimeValueParseError; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeParseException; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class InsertionLocalDateTimeValue { |
| | | |
| | | private final String format; |
| | | private final Object value; |
| | | |
| | | public InsertionLocalDateTimeValue(String format, Object value) { |
| | | this.format = format; |
| | | this.value = value; |
| | | } |
| | | |
| | | public LocalDateTime value() throws LocalDateTimeValueParseError { |
| | | final String stringValue = value.toString().trim(); |
| | | |
| | | try { |
| | | |
| | | if (format.length() == 4 && format.equals("yyyy") && stringValue.matches("\\d{4}")) { |
| | | return LocalDateTime.of(Integer.parseInt(stringValue), 1, 1, 0, 0, 0); |
| | | |
| | | } else if ((format.length() == 6 && stringValue.length() == 6) || (format.length() == 7) && stringValue.length() == 7) { |
| | | |
| | | int monthIndex = index(format, "MM"); |
| | | int yearIndex = index(format, "yyyy"); |
| | | |
| | | return date(yearIndex, monthIndex, stringValue); |
| | | |
| | | } else if ((format.length() == 8 && stringValue.length() == 8) |
| | | || (format.length() == 10 && stringValue.length() == 10)) { |
| | | |
| | | int dayIndex = index(format, "dd"); |
| | | int monthIndex = index(format, "MM"); |
| | | int yearIndex = index(format, "yyyy"); |
| | | |
| | | return date(yearIndex, monthIndex, dayIndex, stringValue); |
| | | } |
| | | |
| | | } catch (DateTimeParseException e) { |
| | | throw new LocalDateTimeValueParseError("Impossible de parser la valeur " + value + " au format " + format); |
| | | } |
| | | |
| | | throw new LocalDateTimeValueParseError("Impossible de parser la valeur " + value + " au format " + format); |
| | | } |
| | | |
| | | private int index(String format, String subSequence) { |
| | | return format.indexOf(subSequence); |
| | | } |
| | | private LocalDateTime date(int yearIndex, int monthIdex, int dayIndex, String stringValue) throws LocalDateTimeValueParseError { |
| | | |
| | | if (yearIndex >= 0 && monthIdex >= 0 && dayIndex >= 0) { |
| | | int annee = Integer.parseInt(stringValue.substring(yearIndex, yearIndex + 4)); |
| | | int mois = Integer.parseInt(stringValue.substring(monthIdex, monthIdex + 2)); |
| | | int jour = Integer.parseInt(stringValue.substring(dayIndex, dayIndex + 2)); |
| | | |
| | | if (mois >= 1 && mois <= 12 && jour >= 1 && jour <= 31) { |
| | | if ((mois == 1 || mois == 3 || mois == 5 || mois == 7 || mois == 8 || mois == 10 || mois == 12) && jour <= 31//Les mois ayant 31 jours |
| | | || ((mois == 4 || mois == 6 || mois == 9 || mois == 11) && jour <= 30)//les ayant 30 jours |
| | | || (mois == 2 && (annee % 4 == 0 && jour <= 29 || jour <= 28))) { //Le mois de février |
| | | |
| | | return LocalDateTime.of(annee, mois, jour, 0, 0, 0, 0); |
| | | } |
| | | } |
| | | } |
| | | throw new LocalDateTimeValueParseError("Impossible de parser la valeur " + stringValue + " au format " + format); |
| | | } |
| | | |
| | | private LocalDateTime date(int yearIndex, int monthIdex, String stringValue) throws LocalDateTimeValueParseError { |
| | | |
| | | if (yearIndex >= 0 && monthIdex >= 0) { |
| | | int annee = Integer.parseInt(stringValue.substring(yearIndex, yearIndex + 4)); |
| | | int mois = Integer.parseInt(stringValue.substring(monthIdex, monthIdex + 2)); |
| | | int jour = 1; |
| | | |
| | | if (mois >= 1 && mois <= 12) { |
| | | return LocalDateTime.of(annee, mois, jour, 0, 0, 0, 0); |
| | | } |
| | | } |
| | | throw new LocalDateTimeValueParseError("Impossible de parser la valeur " + stringValue + " au format " + format); |
| | | } |
| | | } |
| 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.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.contrat.JsonTypeFichierInsertMetaData; |
| | | import com.megatim.fdxcommons.tools.database.contrat.TypeFichierDataRow; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class JsonApiTypeFichierInsertData implements JsonTypeFichierInsertMetaData { |
| | | |
| | | private final String tableName; |
| | | private final Map<String, Object> entity; |
| | | |
| | | public JsonApiTypeFichierInsertData(String tableName, Map<String, Object> entity) { |
| | | this.tableName = tableName; |
| | | this.entity = entity; |
| | | } |
| | | |
| | | @Override |
| | | public String tableName() { |
| | | return tableName; |
| | | } |
| | | |
| | | /** |
| | | * Dans cette méthode on ne s'intéresse qu'aux champs de type primitif |
| | | * |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public TypeFichierDataRow row() throws Exception { |
| | | return primitiveValues(entity); |
| | | } |
| | | |
| | | @Override |
| | | public List<String> columnNames() throws Exception { |
| | | return entity.entrySet() |
| | | .stream() |
| | | .filter(p -> !(p.getValue() instanceof Map) && !(p.getValue() instanceof List)) |
| | | .map(e -> e.getKey()) |
| | | .sorted((e1, e2) -> e1.compareTo(e2)) //On se rassure de classer le résultat |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * Dans cette méthode on ne s'intéresse qu'aux champs de type Map ou List |
| | | * |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public List<JsonTypeFichierInsertMetaData> children() throws Exception { |
| | | Map<String, Object> mapOfObjectElts = new HashMap<>(); |
| | | |
| | | for (Map.Entry<String, Object> e : entity.entrySet()) { |
| | | if ((e.getValue() instanceof Map) || (e.getValue() instanceof List)) { |
| | | mapOfObjectElts.put(e.getKey(), e.getValue()); |
| | | } |
| | | } |
| | | return children(mapOfObjectElts); |
| | | } |
| | | |
| | | private TypeFichierDataRow primitiveValues(Map<String, Object> entity) { |
| | | Map<String, Object> mapOfPrimitiveElts = new HashMap<>(); |
| | | |
| | | for (Map.Entry<String, Object> e : entity.entrySet()) { |
| | | if (!(e.getValue() instanceof Map) && !(e.getValue() instanceof List)) { |
| | | mapOfPrimitiveElts.put(e.getKey(), e.getValue()); |
| | | } |
| | | } |
| | | if (!mapOfPrimitiveElts.isEmpty()) { |
| | | return new DefaultTypeFichierDataRow(mapOfPrimitiveElts); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private List<JsonTypeFichierInsertMetaData> children(Map<String, Object> mapOfObjectElts) { |
| | | List<JsonTypeFichierInsertMetaData> children = new ArrayList<>(); |
| | | |
| | | for (Map.Entry<String, Object> entry : mapOfObjectElts.entrySet()) { |
| | | |
| | | if (entry.getValue() instanceof List) { |
| | | children.addAll(listValues(entry.getKey(), entry.getValue())); |
| | | } else if (entry.getValue() instanceof Map) { |
| | | JsonTypeFichierInsertMetaData metaData = new JsonApiTypeFichierInsertData(tableName + "_" + entry.getKey().toLowerCase(), (Map<String, Object>) entry.getValue()); |
| | | children.add(metaData); |
| | | } |
| | | } |
| | | return children; |
| | | } |
| | | |
| | | private List<JsonTypeFichierInsertMetaData> listValues(String key, Object value) { |
| | | List<JsonTypeFichierInsertMetaData> children = new ArrayList<>(); |
| | | List valueList = (List) value; |
| | | |
| | | if (!valueList.isEmpty()) { |
| | | Object obj = valueList.get(0); |
| | | |
| | | //Liste d'objets |
| | | if (obj instanceof Map) { |
| | | for (Object o : valueList) { |
| | | JsonTypeFichierInsertMetaData metaData = new JsonApiTypeFichierInsertData(tableName + "_" + key.toLowerCase(), (Map<String, Object>) o); |
| | | children.add(metaData); |
| | | } |
| | | } else { |
| | | //Liste de primitifs |
| | | for (Object o : valueList) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put(key.toLowerCase(), o); |
| | | JsonTypeFichierInsertMetaData metaData = new JsonApiTypeFichierInsertData(tableName + "_" + key.toLowerCase(), map); |
| | | children.add(metaData); |
| | | } |
| | | } |
| | | } |
| | | return children; |
| | | } |
| | | } |
| 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.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.TypeDonnee; |
| | | 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 java.sql.SQLException; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import org.apache.commons.validator.GenericValidator; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class JsonDataRowToUpdate { |
| | | |
| | | private final Map<String, Object> dataToSet; |
| | | private final String parentTableName; |
| | | private final List<ColumnDefinition> columnsDefinition; |
| | | |
| | | public JsonDataRowToUpdate(Map<String, Object> data, String parentTableName, List<ColumnDefinition> columnsDefinition) { |
| | | this.dataToSet = data; |
| | | this.parentTableName = parentTableName; |
| | | this.columnsDefinition = columnsDefinition; |
| | | } |
| | | |
| | | public Map<String, Map<String, Object>> dataRow() throws ColumnNotFoundException, SQLException, BadDataValueException, LocalDateTimeValueParseError { |
| | | Map<String, Map<String, Object>> tableToDataRow = new HashMap<>(); |
| | | |
| | | for (Map.Entry<String, Object> entry : dataToSet.entrySet()) { |
| | | |
| | | if (nomColonneIsValid(entry.getKey())) { |
| | | String tableName = tableName(parentTableName, entry.getKey()); |
| | | Map<String, Object> dataToSetToTable = tableToDataRow.get(tableName); |
| | | |
| | | if (dataToSetToTable == null) { |
| | | dataToSetToTable = new HashMap<>(); |
| | | } |
| | | ColumnDefinition columnDefinition = columnsDefinition.stream().filter(c -> c.getName().equalsIgnoreCase(entry.getKey())).findFirst().get(); |
| | | |
| | | Object data = parse(columnDefinition, entry.getValue()); |
| | | dataToSetToTable.put(cleanFieldName(entry.getKey()), data); |
| | | tableToDataRow.put(tableName, dataToSetToTable); |
| | | } else { |
| | | throw new ColumnNotFoundException("La colonne " + entry.getKey() + " n'est pas présente pour cette strcuture JSON"); |
| | | } |
| | | } |
| | | return tableToDataRow; |
| | | } |
| | | |
| | | private String cleanFieldName(String fieldName) { |
| | | int index = fieldName.lastIndexOf("."); |
| | | if (index > 0) { |
| | | String cleanFieldName = fieldName.substring(index + 1); |
| | | return cleanFieldName; |
| | | } else { |
| | | return fieldName; |
| | | } |
| | | |
| | | } |
| | | |
| | | private String tableName(String rootTable, String fieldName) { |
| | | int index = fieldName.lastIndexOf("."); |
| | | ColumnDefinition columnDefinition = columnsDefinition.stream().filter(c -> c.getName().equalsIgnoreCase(fieldName)).findFirst().get(); |
| | | |
| | | if (columnDefinition.isCollection()) { |
| | | if (index <= 0) { |
| | | return (rootTable + "_" + fieldName).toLowerCase(); |
| | | } else { |
| | | String name = fieldName.substring(index); |
| | | return (rootTable + "_" + name).toLowerCase(); |
| | | } |
| | | } else { |
| | | if (index <= 0) { |
| | | return rootTable; |
| | | } else { |
| | | String name = fieldName.subSequence(0, index).toString().replaceAll("\\.", "_"); |
| | | return (rootTable + "_" + name).toLowerCase(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | private boolean nomColonneIsValid(String nomColonne) { |
| | | return nomColonne != null |
| | | && columnsDefinition |
| | | .stream() |
| | | .filter(c -> c.getName().equalsIgnoreCase(nomColonne)) |
| | | .findFirst() |
| | | .isPresent(); |
| | | } |
| | | |
| | | private Object parse(ColumnDefinition columnDefinition, Object value) throws BadDataValueException, LocalDateTimeValueParseError { |
| | | |
| | | String typeDonnee = columnDefinition.getTypeDonnee(); |
| | | |
| | | if (typeDonnee.equals(TypeDonnee.ALPHANUMERIQUE.toString()) |
| | | && (value == null || (value instanceof String && lengthLowerOrEquals((String) value, columnDefinition.getTaille())))) { |
| | | |
| | | return value != null ? value.toString().trim() : value; |
| | | |
| | | } else if (typeDonnee.equals(TypeDonnee.NUMERIQUE.toString())) { |
| | | |
| | | if (value == null) { |
| | | return 0L; |
| | | } |
| | | |
| | | String stringValue = value.toString(); |
| | | if (lengthLowerOrEquals(stringValue, columnDefinition.getTaille()) && GenericValidator.isLong(stringValue)) { |
| | | return Long.valueOf(stringValue); |
| | | } |
| | | |
| | | } else if (typeDonnee.equals(TypeDonnee.DECIMAL.toString())) { |
| | | |
| | | if (value == null) { |
| | | return 0.0; |
| | | } |
| | | |
| | | String stringValue = value.toString(); |
| | | if (lengthLowerOrEquals(stringValue, columnDefinition.getTaille()) && GenericValidator.isDouble(stringValue)) { |
| | | return Double.valueOf(stringValue); |
| | | } |
| | | |
| | | } else if (typeDonnee.equals(TypeDonnee.DATE.toString())) { |
| | | |
| | | if (value == null) { |
| | | return null; |
| | | } |
| | | String stringValue = value.toString(); |
| | | |
| | | if (lengthEquals(stringValue, columnDefinition.getTaille()) && GenericValidator.isDate(stringValue, columnDefinition.getFormatDate(), true)) { |
| | | return new InsertionLocalDateTimeValue(columnDefinition.getFormatDate(), value).value(); |
| | | } |
| | | } |
| | | |
| | | throw new BadDataValueException("La valeur " + value + " ne correspond pas au format attendu pour la colonne " + columnDefinition.getName()); |
| | | } |
| | | |
| | | private boolean lengthEquals(String value, int columnMaxLength) { |
| | | return value.trim().length() == columnMaxLength; |
| | | } |
| | | |
| | | private boolean lengthLowerOrEquals(String value, int columnMaxLength) { |
| | | return value.trim().length() <= columnMaxLength; |
| | | } |
| | | } |
| 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.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.model.integration.json.JsonStructure; |
| | | 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.utils.JsonFdxParsedDataAction; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ForkJoinPool; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class JsonFdxParsedData { |
| | | |
| | | private final List<LinkedHashMap<String, Object>> sourceData; |
| | | private final JsonStructure jsonStructure; |
| | | |
| | | public JsonFdxParsedData(List<LinkedHashMap<String, Object>> sourceData, JsonStructure jsonStructure) { |
| | | this.sourceData = sourceData; |
| | | this.jsonStructure = jsonStructure; |
| | | } |
| | | |
| | | public List<Map<String, Object>> data() throws BadDataValueException, LocalDateTimeValueParseError, ColumnNotFoundException { |
| | | ForkJoinPool pool = new ForkJoinPool(); |
| | | return pool.invoke(new JsonFdxParsedDataAction(sourceData, jsonStructure)); |
| | | } |
| | | |
| | | } |
| 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.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class JsonFdxParsedDataIterator { |
| | | |
| | | private final JsonFdxParsedData fdxParsedData; |
| | | private final String tableName; |
| | | private List<Map<String, Object>> data = null; |
| | | |
| | | public JsonFdxParsedDataIterator(String tableName, JsonFdxParsedData fdxParsedData) { |
| | | this.fdxParsedData = fdxParsedData; |
| | | this.tableName = tableName; |
| | | } |
| | | |
| | | public List<JsonApiTypeFichierInsertData> rows() throws Exception { |
| | | List<JsonApiTypeFichierInsertData> rows = new ArrayList<>(); |
| | | data = fdxParsedData.data(); |
| | | |
| | | for (Map<String, Object> entity : data) { |
| | | rows.add(new JsonApiTypeFichierInsertData(tableName, entity)); |
| | | } |
| | | |
| | | return rows; |
| | | } |
| | | } |
| 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.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.TypeDonnee; |
| | | import com.megatim.fdxcommons.model.integration.json.JsonStructure; |
| | | import com.megatim.fdxcommons.model.pojo.JsonColumnDefinition; |
| | | 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.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import org.apache.commons.validator.GenericValidator; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class JsonFdxParsedDataRow { |
| | | |
| | | private final Map<String, Object> data; |
| | | private final Map<String, Object> row = new LinkedHashMap<>(); |
| | | private final Map<String, JsonColumnDefinition> columnNameToColumnDefinition = new HashMap<>(); |
| | | |
| | | public JsonFdxParsedDataRow(Map<String, Object> data, JsonStructure jsonStructure) { |
| | | this.data = data; |
| | | columnNameToJsonColumnDefinition(jsonStructure); |
| | | } |
| | | |
| | | public Map<String, Object> dataRow() throws ColumnNotFoundException, BadDataValueException, LocalDateTimeValueParseError { |
| | | Set<String> foundColumns = new HashSet<>(); |
| | | |
| | | if (row.isEmpty()) { |
| | | |
| | | for (Map.Entry<String, Object> entry : data.entrySet()) { |
| | | |
| | | String key = entry.getKey(); |
| | | Object value = entry.getValue(); |
| | | |
| | | JsonColumnDefinition jsonColumnDefinition = columnNameToColumnDefinition.get(key.trim().toLowerCase()); |
| | | |
| | | if (jsonColumnDefinition == null) { |
| | | throw new ColumnNotFoundException("La colonne " + key + " n'est pas une colonne de ce type de fichier"); |
| | | } |
| | | foundColumns.add(key.toLowerCase()); |
| | | |
| | | if (value == null) { |
| | | |
| | | if (jsonColumnDefinition.isRequired()) { |
| | | throw new BadDataValueException("La valeur de la colonne " + jsonColumnDefinition.getName() + " est obligatoire"); |
| | | } |
| | | return row; |
| | | } |
| | | if (jsonColumnDefinition.getTypeDonnee().equals(TypeDonnee.OBJET)) { |
| | | if (jsonColumnDefinition.isCollection()) { |
| | | if (value instanceof List) { |
| | | List<Object> objectsList = (List<Object>) value; |
| | | List<Object> parsedValues = new ArrayList<>(); |
| | | int i = 0; |
| | | |
| | | for (Object obj : objectsList) { |
| | | parsedValues.add(dataRow((Map<String, Object>) obj, jsonColumnDefinition.getColumnNameToColumnDefinition(), jsonColumnDefinition.getName(), i + 1)); |
| | | i++; |
| | | } |
| | | row.put(key.trim(), parsedValues); |
| | | } else { |
| | | throw new BadDataValueException("La valeur de la colonne " + jsonColumnDefinition.getName() + " doit être une liste de données"); |
| | | } |
| | | } else { |
| | | row.put(key.trim(), dataRow((Map<String, Object>) value, jsonColumnDefinition.getColumnNameToColumnDefinition(), jsonColumnDefinition.getName(), 0)); |
| | | } |
| | | } else { |
| | | if (jsonColumnDefinition.isCollection()) { |
| | | if (value instanceof List) { |
| | | List<Object> objectsList = (List<Object>) value; |
| | | List<Object> parsedValues = new ArrayList<>(); |
| | | int i = 0; |
| | | |
| | | for (Object obj : objectsList) { |
| | | parsedValues.add(parse(jsonColumnDefinition, obj, "", i + 1)); |
| | | i++; |
| | | } |
| | | row.put(key.trim(), parsedValues); |
| | | } else { |
| | | throw new BadDataValueException("La valeur de la colonne " + jsonColumnDefinition.getName() + " doit être un tableau de données"); |
| | | } |
| | | } else { |
| | | row.put(key.trim(), parse(jsonColumnDefinition, value, "", 0)); |
| | | } |
| | | } |
| | | } |
| | | //Cherche les colonnes obligatoires qui sont absentes |
| | | stopIfRequiredColumnIsAbsent(foundColumns, columnNameToColumnDefinition, ""); |
| | | } |
| | | return row; |
| | | } |
| | | |
| | | private void columnNameToJsonColumnDefinition(JsonStructure jsonStructure) { |
| | | for (JsonStructure j : jsonStructure.getFields()) { |
| | | if (j.getTypeDonnee().equals(TypeDonnee.OBJET)) { |
| | | JsonColumnDefinition jsonCol = new JsonColumnDefinition(j.getTypeDonnee(), j.getName(), j.getLengthh(), j.getFormatDate(), j.isRequired(), j.isCollection()); |
| | | |
| | | for (JsonStructure field : j.getFields()) { |
| | | jsonCol.getColumnNameToColumnDefinition().put(field.getName().toLowerCase(), jsonColumnDefinition(field)); |
| | | } |
| | | columnNameToColumnDefinition.put(j.getName().toLowerCase(), jsonCol); |
| | | } else { |
| | | columnNameToColumnDefinition.put(j.getName().toLowerCase(), new JsonColumnDefinition(j.getTypeDonnee(), j.getName(), j.getLengthh(), j.getFormatDate(), j.isRequired(), j.isCollection())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private JsonColumnDefinition jsonColumnDefinition(JsonStructure jsonStruct) { |
| | | JsonColumnDefinition jsonCol = new JsonColumnDefinition(jsonStruct.getTypeDonnee(), jsonStruct.getName(), jsonStruct.getLengthh(), jsonStruct.getFormatDate(), jsonStruct.isRequired(), jsonStruct.isCollection()); |
| | | |
| | | if (jsonStruct.getTypeDonnee().equals(TypeDonnee.OBJET)) { |
| | | for (JsonStructure j : jsonStruct.getFields()) { |
| | | jsonCol.getColumnNameToColumnDefinition().put(j.getName().toLowerCase(), jsonColumnDefinition(j)); |
| | | } |
| | | } |
| | | return jsonCol; |
| | | } |
| | | |
| | | private Map<String, Object> dataRow(Map<String, Object> subData, Map<String, JsonColumnDefinition> subColumnNameToColumnDefinition, String parentName, int rangElement) throws ColumnNotFoundException, BadDataValueException, LocalDateTimeValueParseError { |
| | | Map<String, Object> subRow = new LinkedHashMap<>(); |
| | | Set<String> foundColumns = new HashSet<>(); |
| | | |
| | | for (Map.Entry<String, Object> entry : subData.entrySet()) { |
| | | |
| | | String key = entry.getKey(); |
| | | Object value = entry.getValue(); |
| | | |
| | | JsonColumnDefinition jsonColumnDefinition = subColumnNameToColumnDefinition.get(key.trim().toLowerCase()); |
| | | |
| | | if (jsonColumnDefinition == null) { |
| | | throw new ColumnNotFoundException("La colonne " + key + " n'est pas présente pour ce fichier"); |
| | | } |
| | | foundColumns.add(key.toLowerCase()); |
| | | |
| | | if (value == null) { |
| | | |
| | | if (jsonColumnDefinition.isRequired()) { |
| | | throw new BadDataValueException("La valeur de la colonne " + jsonColumnDefinition.getName() + " est obligatoire"); |
| | | } |
| | | return subRow; |
| | | } |
| | | |
| | | if (jsonColumnDefinition.getTypeDonnee().equals(TypeDonnee.OBJET)) { |
| | | parentName += "." + jsonColumnDefinition.getName(); |
| | | |
| | | if (jsonColumnDefinition.isCollection()) { |
| | | if (value instanceof List) { |
| | | List<Object> objectsList = (List<Object>) value; |
| | | List<Object> parsedValues = new ArrayList<>(); |
| | | int i = 0; |
| | | |
| | | for (Object obj : objectsList) { |
| | | parsedValues.add(dataRow((Map<String, Object>) obj, jsonColumnDefinition.getColumnNameToColumnDefinition(), parentName, rangElement)); |
| | | i++; |
| | | } |
| | | subRow.put(key.trim(), parsedValues); |
| | | } else { |
| | | throw new BadDataValueException("La valeur de la colonne " + jsonColumnDefinition.getName() + " doit être une liste de données"); |
| | | } |
| | | } else { |
| | | subRow.put(key.trim(), dataRow((Map<String, Object>) value, jsonColumnDefinition.getColumnNameToColumnDefinition(), parentName, rangElement)); |
| | | } |
| | | } else { |
| | | if (jsonColumnDefinition.isCollection()) { |
| | | if (value instanceof List) { |
| | | List<Object> objectsList = (List<Object>) value; |
| | | List<Object> parsedValues = new ArrayList<>(); |
| | | int i = 0; |
| | | |
| | | for (Object obj : objectsList) { |
| | | parsedValues.add(parse(jsonColumnDefinition, obj, "", i + 1)); |
| | | i++; |
| | | } |
| | | subRow.put(key.trim(), parsedValues); |
| | | } else { |
| | | throw new BadDataValueException("La valeur de la colonne " + jsonColumnDefinition.getName() + " doit être un tableau de données"); |
| | | } |
| | | } else { |
| | | subRow.put(key.trim(), parse(jsonColumnDefinition, value, parentName, rangElement)); |
| | | } |
| | | } |
| | | } |
| | | //Cherche les colonnes obligatoires qui sont absentes |
| | | stopIfRequiredColumnIsAbsent(foundColumns, subColumnNameToColumnDefinition, parentName); |
| | | |
| | | return subRow; |
| | | } |
| | | |
| | | private Object parse(JsonColumnDefinition columnDefinition, Object value, String parentName, int rangElement) throws BadDataValueException, LocalDateTimeValueParseError { |
| | | |
| | | TypeDonnee typeDonnee = columnDefinition.getTypeDonnee(); |
| | | |
| | | if (typeDonnee.equals(TypeDonnee.ALPHANUMERIQUE) && (value == null |
| | | || (value instanceof String && lengthLowerOrEquals((String) value, columnDefinition.getLengthh())))) { |
| | | |
| | | return value != null ? value.toString().trim() : value; |
| | | |
| | | } else if (typeDonnee.equals(TypeDonnee.NUMERIQUE)) { |
| | | |
| | | if (value == null) { |
| | | return 0L; |
| | | } |
| | | |
| | | String stringValue = value.toString(); |
| | | if (lengthLowerOrEquals(stringValue, columnDefinition.getLengthh()) && GenericValidator.isLong(stringValue)) { |
| | | return Long.valueOf(stringValue); |
| | | } |
| | | |
| | | } else if (typeDonnee.equals(TypeDonnee.DECIMAL)) { |
| | | |
| | | if (value == null) { |
| | | return 0.0; |
| | | } |
| | | |
| | | String stringValue = value.toString(); |
| | | if (lengthLowerOrEquals(stringValue, columnDefinition.getLengthh()) && GenericValidator.isDouble(stringValue)) { |
| | | return Double.valueOf(stringValue); |
| | | } |
| | | |
| | | } else if (typeDonnee.equals(TypeDonnee.DATE)) { |
| | | |
| | | if (value == null) { |
| | | return null; |
| | | } |
| | | String stringValue = value.toString(); |
| | | |
| | | if (lengthEquals(stringValue, columnDefinition.getLengthh()) && GenericValidator.isDate(stringValue, columnDefinition.getFormatDate(), true)) { |
| | | return new InsertionLocalDateTimeValue(columnDefinition.getFormatDate(), value).value(); |
| | | } |
| | | } |
| | | String rangDescription = rangElement == 0 ? "" : "le " + rangElement + "ème élément de "; |
| | | String fullQualifiedNameOfColumn = parentName == null || parentName.isEmpty() ? columnDefinition.getName() : parentName + "." + columnDefinition.getName(); |
| | | |
| | | throw new BadDataValueException("La valeur " + value + " ne correspond pas au format attendu pour " + rangDescription + " la colonne " + fullQualifiedNameOfColumn); |
| | | } |
| | | |
| | | private boolean lengthEquals(String value, int columnMaxLength) { |
| | | return value.trim().length() == columnMaxLength; |
| | | } |
| | | |
| | | private boolean lengthLowerOrEquals(String value, int columnMaxLength) { |
| | | return value.trim().length() <= columnMaxLength; |
| | | } |
| | | |
| | | private void stopIfRequiredColumnIsAbsent(Set<String> foundColumns, Map<String, JsonColumnDefinition> allColumns, String parentName) throws BadDataValueException { |
| | | |
| | | for (String columnName : allColumns.keySet()) { |
| | | String fullQualifiedName = parentName.isEmpty() ? columnName : parentName + "." + columnName; |
| | | |
| | | if (allColumns.get(columnName).isRequired() && !foundColumns.contains(columnName.toLowerCase())) { |
| | | throw new BadDataValueException("La valeur de la colonne " + fullQualifiedName + " est obligatoire"); |
| | | } |
| | | } |
| | | } |
| | | } |
| 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.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.TypeDonnee; |
| | | import com.megatim.fdxcommons.model.integration.json.JsonStructure; |
| | | import java.sql.Connection; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import javax.naming.NamingException; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class JsonFdxTableStructure { |
| | | |
| | | private final String referentielVersion; |
| | | private final String codeTypeFichier; |
| | | private final Connection connection; |
| | | |
| | | public JsonFdxTableStructure(String referentielVersion, String codeTypeFichier, Connection connection) { |
| | | this.referentielVersion = referentielVersion; |
| | | this.codeTypeFichier = codeTypeFichier; |
| | | this.connection = connection; |
| | | } |
| | | |
| | | public JsonStructure jsonStructure() throws NamingException, SQLException { |
| | | JsonStructure jsonStructure = null; |
| | | Long jsonStructureId = jsonStructureId(); |
| | | |
| | | if (jsonStructureId != null) { |
| | | String query = "SELECT * FROM JsonStructure j where j.id = ?"; |
| | | |
| | | try ( PreparedStatement stmt = connection.prepareStatement(query)) { |
| | | stmt.setLong(1, jsonStructureId); |
| | | ResultSet resultSet = stmt.executeQuery(); |
| | | |
| | | if (resultSet.next()) { |
| | | jsonStructure = new JsonStructure(); |
| | | jsonStructure.setId(resultSet.getLong("id")); |
| | | jsonStructure.setLengthh(resultSet.getInt("lengthh")); |
| | | jsonStructure.setTypeDonnee(TypeDonnee.fromValeur(resultSet.getString("typedonnee"))); |
| | | jsonStructure.setName(resultSet.getString("name")); |
| | | jsonStructure.setRequired(resultSet.getBoolean("required")); |
| | | jsonStructure.setCollection(resultSet.getBoolean("collection")); |
| | | jsonStructure.setFormatDate(resultSet.getString("formatdate")); |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | return jsonStructure; |
| | | } |
| | | |
| | | private Long jsonStructureId() throws SQLException { |
| | | String query = "SELECT json_structure_id FROM typeFichierJson t WHERE t.type_fichier_code = ? AND t.referentiel_version = ?"; |
| | | |
| | | try ( PreparedStatement stmt = connection.prepareStatement(query)) { |
| | | stmt.setString(1, codeTypeFichier); |
| | | stmt.setString(2, referentielVersion); |
| | | ResultSet resultSet = stmt.executeQuery(); |
| | | |
| | | if (resultSet.next()) { |
| | | return resultSet.getLong(1); |
| | | |
| | | } |
| | | |
| | | } |
| | | 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.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.Operateur; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.tools.database.exceptions.BadQueryCriteriaException; |
| | | import com.megatim.fdxcommons.tools.database.exceptions.LocalDateTimeValueParseError; |
| | | import com.megatim.fdxcommons.tools.database.tables.FdxTableColumn; |
| | | import com.megatim.fdxcommons.tools.database.tables.JsonFdxTableColumns; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.AppColumnDefinitions; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.FdxApiColumnDefinitions; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.FdxConsultationColumnDefinitions; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class JsonParsedQueryCriterion { |
| | | |
| | | private final QueryCriterion queryCriterion; |
| | | private final JsonFdxTableColumns fdxTableColumns; |
| | | private final List<ColumnDefinition> columnDefinitionsWithFullQualifiedName; |
| | | private final FdxApiColumnDefinitions apiColumnDefinitions = new FdxApiColumnDefinitions(); |
| | | private final FdxConsultationColumnDefinitions fdxConsColumnDefinitions = new FdxConsultationColumnDefinitions(); |
| | | |
| | | public JsonParsedQueryCriterion(QueryCriterion queryCriterion, JsonFdxTableColumns fdxTableColumns, List<ColumnDefinition> columnDefinitionsWithFullQualifiedName) { |
| | | this.queryCriterion = queryCriterion; |
| | | this.fdxTableColumns = fdxTableColumns; |
| | | this.columnDefinitionsWithFullQualifiedName = columnDefinitionsWithFullQualifiedName; |
| | | } |
| | | |
| | | public QueryCriterion parsedCriterion() throws LocalDateTimeValueParseError, BadQueryCriteriaException { |
| | | return queryCriterion != null |
| | | ? parsedCriterion(queryCriterion) |
| | | : null; |
| | | } |
| | | |
| | | private QueryCriterion parsedCriterion(QueryCriterion criterion) throws LocalDateTimeValueParseError, BadQueryCriteriaException { |
| | | |
| | | if (criterion == null) { |
| | | return null; |
| | | } |
| | | |
| | | if (criterion.getSubCriteria() != null && !criterion.getSubCriteria().isEmpty() && criterion.getCriteriaLogicConnector() != null) { |
| | | List<QueryCriterion> subCriteria = new ArrayList<>(); |
| | | |
| | | for (QueryCriterion qc : criterion.getSubCriteria()) { |
| | | QueryCriterion parseCriterion = parsedCriterion(qc); |
| | | |
| | | if (parseCriterion != null) { |
| | | subCriteria.add(parseCriterion); |
| | | } |
| | | } |
| | | if (!subCriteria.isEmpty()) { |
| | | return new QueryCriterion(null, |
| | | null, |
| | | null, |
| | | criterion.getCriteriaLogicConnector(), |
| | | subCriteria |
| | | ); |
| | | } |
| | | |
| | | } else if ((criterion.getSubCriteria() == null || criterion.getSubCriteria().isEmpty()) |
| | | && nomColonneIsValid(criterion.getNomColonne()) |
| | | && criterion.getOperateur() != null) { |
| | | Object correctValue = correctValue(criterion.getNomColonne(), criterion.getCriteriaValue(), criterion.getOperateur()); |
| | | |
| | | if (isUnaryOperator(criterion.getOperateur()) || (correctValue != null && !correctValue.toString().isEmpty())) { |
| | | return new QueryCriterion(criterion.getNomColonne(), |
| | | correctValue, |
| | | criterion.getOperateur(), |
| | | null, |
| | | Arrays.asList() |
| | | ); |
| | | } |
| | | } |
| | | |
| | | throw new BadQueryCriteriaException("Critère non valide"); |
| | | } |
| | | |
| | | private boolean nomColonneIsValid(String nomColonne) { |
| | | return apiColumnDefinitions.isAppColumnDefinition(nomColonne) |
| | | || fdxConsColumnDefinitions.isAppColumnDefinition(nomColonne) |
| | | || nomColonne != null && fdxTableColumns |
| | | .columns() |
| | | .stream() |
| | | .filter(c -> c.getName().equalsIgnoreCase(nomColonne)) |
| | | .findFirst() |
| | | .isPresent(); |
| | | } |
| | | |
| | | private Object correctValue(String nomColonne, Object value, Operateur operateur) throws LocalDateTimeValueParseError, BadQueryCriteriaException { |
| | | |
| | | if (value == null) { |
| | | return null; |
| | | } |
| | | |
| | | AppColumnDefinitions appColumnDefinitions = new AppColumnDefinitions(); |
| | | |
| | | for (FdxTableColumn column : fdxTableColumns.columns()) { |
| | | |
| | | if (column.getName().equalsIgnoreCase(nomColonne)) { |
| | | |
| | | boolean isDateCreationColumn = appColumnDefinitions.isDateCreationColumn(column.getName()); |
| | | |
| | | String dateFormat = columnDefinitionsWithFullQualifiedName |
| | | .stream() |
| | | .filter(cD -> cD.getName().equalsIgnoreCase(nomColonne) && cD.getTypeDonnee().equals("DATE")) |
| | | .findFirst() |
| | | .map(cD -> cD.getFormatDate()) |
| | | .orElse(""); |
| | | |
| | | QueryCriteriaCorrectValue queryCriteriaCorrectValue = new QueryCriteriaCorrectValue( |
| | | column.getType(), |
| | | value, |
| | | operateur, |
| | | dateFormat, |
| | | isDateCreationColumn |
| | | ); |
| | | |
| | | return queryCriteriaCorrectValue.value(); |
| | | } |
| | | } |
| | | |
| | | throw new BadQueryCriteriaException("Critères mal formattés"); |
| | | } |
| | | |
| | | private boolean isUnaryOperator(Operateur operateur) { |
| | | return operateur.equals(Operateur.IS_NOT_NULL) || operateur.equals(Operateur.IS_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.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class JsonSelectQueryResult { |
| | | |
| | | private final int lastIndexRead; |
| | | private final List<Map<String, Object>> rows; |
| | | private String token; |
| | | |
| | | public JsonSelectQueryResult(int lastIndexRead, List<Map<String, Object>> rows) { |
| | | this.lastIndexRead = lastIndexRead; |
| | | this.rows = rows; |
| | | } |
| | | |
| | | public int lastIndexRead() { |
| | | return lastIndexRead; |
| | | } |
| | | |
| | | public List<Map<String, Object>> rows() { |
| | | return rows; |
| | | } |
| | | |
| | | public String getToken() { |
| | | return token; |
| | | } |
| | | |
| | | public void setToken(String token) { |
| | | this.token = token; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.Operateur; |
| | | import com.megatim.fdxcommons.model.integration.ColumnDefinition; |
| | | import com.megatim.fdxcommons.model.integration.TableDefinition; |
| | | import com.megatim.fdxcommons.tools.database.exceptions.BadQueryCriteriaException; |
| | | import com.megatim.fdxcommons.tools.database.exceptions.LocalDateTimeValueParseError; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.AppColumnDefinitions; |
| | | import com.megatim.fdxcommons.tools.database.tables.FdxTableColumn; |
| | | import com.megatim.fdxcommons.tools.database.tables.FdxTableColumns; |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import javax.naming.NamingException; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class ParsedQueryCriterion { |
| | | |
| | | private final QueryCriterion queryCriterion; |
| | | private final FdxTableColumns fdxTableColumns; |
| | | private final List<ColumnDefinition> columnDefinitions; |
| | | |
| | | public ParsedQueryCriterion(QueryCriterion queryCriterion, FdxTableColumns fdxTableColumns, List<ColumnDefinition> columnDefinitions) { |
| | | this.queryCriterion = queryCriterion; |
| | | this.fdxTableColumns = fdxTableColumns; |
| | | this.columnDefinitions = columnDefinitions; |
| | | } |
| | | |
| | | public QueryCriterion parsedCriterion() throws SQLException, NamingException, LocalDateTimeValueParseError, BadQueryCriteriaException { |
| | | return queryCriterion != null |
| | | ? parsedCriterion(queryCriterion) |
| | | : null; |
| | | } |
| | | |
| | | private QueryCriterion parsedCriterion(QueryCriterion criterion) throws SQLException, NamingException, LocalDateTimeValueParseError, BadQueryCriteriaException { |
| | | |
| | | if (criterion == null) { |
| | | return null; |
| | | } |
| | | |
| | | if (criterion.getSubCriteria() != null && !criterion.getSubCriteria().isEmpty() && criterion.getCriteriaLogicConnector() != null) { |
| | | List<QueryCriterion> subCriteria = new ArrayList<>(); |
| | | |
| | | for (QueryCriterion qc : criterion.getSubCriteria()) { |
| | | QueryCriterion parseCriterion = parsedCriterion(qc); |
| | | |
| | | if (parseCriterion != null) { |
| | | subCriteria.add(parseCriterion); |
| | | } |
| | | } |
| | | if (!subCriteria.isEmpty()) { |
| | | return new QueryCriterion(null, |
| | | null, |
| | | null, |
| | | criterion.getCriteriaLogicConnector(), |
| | | subCriteria |
| | | ); |
| | | } |
| | | |
| | | } else if ((criterion.getSubCriteria() == null || criterion.getSubCriteria().isEmpty()) |
| | | && nomColonneIsValid(criterion.getNomColonne()) |
| | | && criterion.getOperateur() != null) { |
| | | Object correctValue = correctValue(criterion.getNomColonne(), criterion.getCriteriaValue(), criterion.getOperateur()); |
| | | |
| | | if (isUnaryOperator(criterion.getOperateur()) || (correctValue != null && !correctValue.toString().isEmpty())) { |
| | | return new QueryCriterion(criterion.getNomColonne(), |
| | | correctValue, |
| | | criterion.getOperateur(), |
| | | null, |
| | | Arrays.asList() |
| | | ); |
| | | } |
| | | } |
| | | |
| | | throw new BadQueryCriteriaException("Critère non valide"); |
| | | } |
| | | |
| | | private boolean nomColonneIsValid(String nomColonne) throws SQLException, NamingException { |
| | | return nomColonne != null && fdxTableColumns |
| | | .columns() |
| | | .stream() |
| | | .filter(c -> c.getName().equalsIgnoreCase(nomColonne)) |
| | | .findFirst() |
| | | .isPresent(); |
| | | } |
| | | |
| | | private Object correctValue(String nomColonne, Object value, Operateur operateur) throws SQLException, NamingException, LocalDateTimeValueParseError, BadQueryCriteriaException { |
| | | |
| | | if (value == null) { |
| | | return null; |
| | | } |
| | | |
| | | AppColumnDefinitions appColumnDefinitions = new AppColumnDefinitions(); |
| | | |
| | | for (FdxTableColumn column : fdxTableColumns.columns()) { |
| | | |
| | | if (column.getName().equalsIgnoreCase(nomColonne)) { |
| | | |
| | | boolean isDateCreationColumn = appColumnDefinitions.isDateCreationColumn(column.getName()); |
| | | |
| | | String dateFormat = columnDefinitions |
| | | .stream() |
| | | .filter(cD -> cD.getName().equalsIgnoreCase(nomColonne) && cD.getTypeDonnee().equals("DATE")) |
| | | .findFirst() |
| | | .map(cD -> cD.getFormatDate()) |
| | | .orElse(""); |
| | | |
| | | QueryCriteriaCorrectValue queryCriteriaCorrectValue = new QueryCriteriaCorrectValue( |
| | | column.getType(), |
| | | value, |
| | | operateur, |
| | | dateFormat, |
| | | isDateCreationColumn |
| | | ); |
| | | |
| | | return queryCriteriaCorrectValue.value(); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | throw new BadQueryCriteriaException("Critères mal formattés"); |
| | | } |
| | | |
| | | private boolean isUnaryOperator(Operateur operateur) { |
| | | return operateur.equals(Operateur.IS_NOT_NULL) || operateur.equals(Operateur.IS_NULL); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.Operateur; |
| | | import com.megatim.fdxcommons.model.pojo.BetweenOperatorValues; |
| | | import com.megatim.fdxcommons.tools.database.exceptions.BadQueryCriteriaException; |
| | | import com.megatim.fdxcommons.tools.database.exceptions.LocalDateTimeValueParseError; |
| | | import com.megatim.fdxcommons.tools.database.tables.appcolumns.DateCreationColumnDefinition; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.LinkedHashMap; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class QueryCriteriaCorrectValue { |
| | | |
| | | private final int dataType; |
| | | private final Object criteriaValue; |
| | | private final Operateur operateur; |
| | | private final String dateFormat; |
| | | private final boolean isDateActionColumn; |
| | | |
| | | public QueryCriteriaCorrectValue(int dataType, Object criteriaValue, Operateur operateur, String dateFormat, boolean isDateActionColumn) { |
| | | this.dataType = dataType; |
| | | this.criteriaValue = criteriaValue; |
| | | this.operateur = operateur; |
| | | this.dateFormat = dateFormat; |
| | | this.isDateActionColumn = isDateActionColumn; |
| | | } |
| | | |
| | | public Object value() throws LocalDateTimeValueParseError, BadQueryCriteriaException { |
| | | if (operateurWithBetween()) { |
| | | Object lowerBound = null; |
| | | Object upperBound = null; |
| | | |
| | | if (criteriaValue instanceof BetweenOperatorValues) { |
| | | BetweenOperatorValues values = (BetweenOperatorValues) criteriaValue; |
| | | if (values != null) { |
| | | lowerBound = values.getLowerBound(); |
| | | upperBound = values.getUpperBound(); |
| | | } |
| | | } else { |
| | | LinkedHashMap map = (LinkedHashMap) criteriaValue; |
| | | |
| | | if (map != null) { |
| | | lowerBound = map.get("lowerBound"); |
| | | upperBound = map.get("upperBound"); |
| | | } |
| | | } |
| | | if (lowerBound != null && upperBound != null) { |
| | | if (dataTypeIsInt()) { |
| | | return new BetweenOperatorValues(intValue(lowerBound), intValue(upperBound)); |
| | | } else if (dataTypeIsDecimal()) { |
| | | return new BetweenOperatorValues(decimalValue(lowerBound), decimalValue(upperBound)); |
| | | } else if (dataTypeIsString()) { |
| | | return new BetweenOperatorValues(stringValue(lowerBound), stringValue(upperBound)); |
| | | } else if (dataTypeIsTimeStamp()) { |
| | | return new BetweenOperatorValues(dateValue(lowerBound), dateValue(upperBound)); |
| | | } |
| | | } |
| | | } else if (operateurWithIn()) { |
| | | if (criteriaValue instanceof Collection<?>) { |
| | | Collection<?> collection = (Collection<?>) criteriaValue; |
| | | return collectionValues(collection); |
| | | } |
| | | } else if (operateurWithComparison()) { |
| | | if (dataTypeIsInt()) { |
| | | return intValue(criteriaValue); |
| | | } else if (dataTypeIsDecimal()) { |
| | | return decimalValue(criteriaValue); |
| | | } else if (dataTypeIsString()) { |
| | | return stringValue(criteriaValue); |
| | | } else if (dataTypeIsTimeStamp()) { |
| | | return dateValue(criteriaValue); |
| | | } else if(dataTypeIsBoolean()) { |
| | | return booleanValue(criteriaValue); |
| | | } |
| | | } else if (operateurWithLike()) { |
| | | if (dataTypeIsString()) { |
| | | return stringValue(criteriaValue); |
| | | } |
| | | |
| | | } else if (operateurWithoutValue()) { |
| | | return null; |
| | | } |
| | | |
| | | throw new BadQueryCriteriaException( |
| | | "Opérateur inconnu"); |
| | | } |
| | | |
| | | private boolean operateurWithoutValue() { |
| | | return this.operateur.equals(Operateur.IS_NOT_NULL) |
| | | || this.operateur.equals(Operateur.IS_NULL); |
| | | } |
| | | |
| | | private boolean operateurWithBetween() { |
| | | return this.operateur.equals(Operateur.BETWEEN) |
| | | || this.operateur.equals(Operateur.NOT_BETWEEN); |
| | | } |
| | | |
| | | private boolean operateurWithIn() { |
| | | return this.operateur.equals(Operateur.IN) |
| | | || this.operateur.equals(Operateur.NOT_IN); |
| | | } |
| | | |
| | | private boolean operateurWithComparison() { |
| | | return this.operateur.equals(Operateur.EQUALS) |
| | | || this.operateur.equals(Operateur.NOT_EQUALS) |
| | | || this.operateur.equals(Operateur.GREATER_OR_EQUALS_THAN) |
| | | || this.operateur.equals(Operateur.GREATER_THAN) |
| | | || this.operateur.equals(Operateur.LOWER_OR_EQUALS_THAN) |
| | | || this.operateur.equals(Operateur.LOWER_THAN); |
| | | } |
| | | |
| | | private boolean operateurWithLike() { |
| | | return this.operateur.equals(Operateur.LIKE); |
| | | } |
| | | |
| | | private boolean dataTypeIsString() { |
| | | return this.dataType == 12; |
| | | } |
| | | |
| | | private boolean dataTypeIsTimeStamp() { |
| | | return this.dataType == 93; |
| | | } |
| | | |
| | | private boolean dataTypeIsInt() { |
| | | return this.dataType == 4 || this.dataType == 5 || this.dataType == -5; |
| | | } |
| | | |
| | | private boolean dataTypeIsBoolean() { |
| | | return this.dataType == -7; |
| | | } |
| | | |
| | | private boolean dataTypeIsDecimal() { |
| | | return this.dataType == 3; |
| | | } |
| | | |
| | | private Collection<?> collectionValues(Collection<?> collection) throws LocalDateTimeValueParseError, BadQueryCriteriaException { |
| | | if (dataTypeIsInt()) { |
| | | return collectionOfInt(collection); |
| | | } else if (dataTypeIsDecimal()) { |
| | | return collectionOfBigDecimal(collection); |
| | | } else if (dataTypeIsTimeStamp()) { |
| | | return collectionOfLocalDateTime(collection); |
| | | } else if (dataTypeIsString()) { |
| | | return collectionOfString(collection); |
| | | } |
| | | throw new BadQueryCriteriaException("La valeur de ce critère doit une liste"); |
| | | } |
| | | |
| | | private Collection<String> collectionOfString(Collection<?> collection) throws BadQueryCriteriaException { |
| | | Collection<String> cleanValues = new ArrayList<>(); |
| | | for (Object elt : collection) { |
| | | cleanValues.add(stringValue(elt)); |
| | | } |
| | | return cleanValues; |
| | | } |
| | | |
| | | private String stringValue(Object element) throws BadQueryCriteriaException { |
| | | if (!(element instanceof String)) { |
| | | throw new BadQueryCriteriaException("Les critères associés à cette requête sont incorrects."); |
| | | } |
| | | return (String) element; |
| | | } |
| | | |
| | | private boolean booleanValue(Object element) throws BadQueryCriteriaException { |
| | | if (!(element instanceof Boolean)) { |
| | | throw new BadQueryCriteriaException("Les critères associés à cette requête sont incorrects."); |
| | | } |
| | | return (Boolean) element; |
| | | } |
| | | |
| | | private Collection<LocalDateTime> collectionOfLocalDateTime(Collection<?> collection) throws LocalDateTimeValueParseError { |
| | | Collection cleanValues = new ArrayList<>(); |
| | | for (Object element : collection) { |
| | | cleanValues.add(dateValue(element)); |
| | | } |
| | | return cleanValues; |
| | | } |
| | | |
| | | private LocalDateTime dateValue(Object value) throws LocalDateTimeValueParseError { |
| | | if (isDateActionColumn) { |
| | | if (!(value instanceof LocalDateTime)) { |
| | | throw new LocalDateTimeValueParseError("Impossible de parser la valeur " + value + " pour la colonne " + new DateCreationColumnDefinition().name()); |
| | | } |
| | | return (LocalDateTime) value; |
| | | } else { |
| | | return new CriteriaLocalDateTimeValue(dateFormat, value).value(); |
| | | } |
| | | } |
| | | |
| | | private Long intValue(Object value) throws BadQueryCriteriaException { |
| | | try { |
| | | return Long.valueOf(value.toString()); |
| | | } catch (Exception ex) { |
| | | throw new BadQueryCriteriaException("La valeur de ce critère doit être un nombre entier "); |
| | | } |
| | | } |
| | | |
| | | private BigDecimal decimalValue(Object value) throws BadQueryCriteriaException { |
| | | try { |
| | | return new BigDecimal(value.toString()); |
| | | } catch (Exception ex) { |
| | | throw new BadQueryCriteriaException("La valeur de ce critère doit être un nombre décimal "); |
| | | } |
| | | } |
| | | |
| | | private Collection<BigDecimal> collectionOfBigDecimal(Collection<?> collection) throws BadQueryCriteriaException { |
| | | Collection cleanValues = new ArrayList<>(); |
| | | for (Object element : collection) { |
| | | cleanValues.add(decimalValue(element)); |
| | | } |
| | | return cleanValues; |
| | | } |
| | | |
| | | private Collection<Long> collectionOfInt(Collection<?> collection) throws BadQueryCriteriaException { |
| | | Collection cleanValues = new ArrayList<>(); |
| | | for (Object element : collection) { |
| | | cleanValues.add(intValue(element)); |
| | | } |
| | | return cleanValues; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.CriteriaLogicConnector; |
| | | import com.megatim.fdxcommons.model.enumeration.Operateur; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class QueryCriterion { |
| | | |
| | | private final String nomColonne; |
| | | private final Object criteriaValue; |
| | | private final Operateur operateur; |
| | | private final CriteriaLogicConnector criteriaLogicConnector; |
| | | private final List<QueryCriterion> subCriteria; |
| | | |
| | | public QueryCriterion(String nomColonne, Object criteriaValue, Operateur operateur, CriteriaLogicConnector criteriaLogicConnector, List<QueryCriterion> subCriteria) { |
| | | this.nomColonne = nomColonne; |
| | | this.criteriaValue = criteriaValue; |
| | | this.operateur = operateur; |
| | | this.criteriaLogicConnector = criteriaLogicConnector; |
| | | this.subCriteria = subCriteria; |
| | | } |
| | | |
| | | public String getNomColonne() { |
| | | return nomColonne; |
| | | } |
| | | |
| | | public Object getCriteriaValue() { |
| | | return criteriaValue; |
| | | } |
| | | |
| | | public Operateur getOperateur() { |
| | | return operateur; |
| | | } |
| | | |
| | | public CriteriaLogicConnector getCriteriaLogicConnector() { |
| | | return criteriaLogicConnector; |
| | | } |
| | | |
| | | public List<QueryCriterion> getSubCriteria() { |
| | | return subCriteria; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class QueryParam { |
| | | |
| | | private final String nomColonne; |
| | | private final Object paramValue; |
| | | |
| | | public QueryParam(String nomColonne, Object paramValue) { |
| | | this.nomColonne = nomColonne; |
| | | this.paramValue = paramValue; |
| | | } |
| | | |
| | | public String getNomColonne() { |
| | | return nomColonne; |
| | | } |
| | | |
| | | public Object getParamValue() { |
| | | return paramValue; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import com.megatim.fdxcommons.tools.database.tables.FdxTableRow; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class SelectQueryResult { |
| | | |
| | | private final int lastIndexRead; |
| | | private final List<FdxTableRow> rows; |
| | | private String token; |
| | | |
| | | public SelectQueryResult(int lastIndexRead, List<FdxTableRow> rows) { |
| | | this.lastIndexRead = lastIndexRead; |
| | | this.rows = rows; |
| | | } |
| | | |
| | | public int lastIndexRead() { |
| | | return lastIndexRead; |
| | | } |
| | | |
| | | public List<FdxTableRow> rows() { |
| | | return rows; |
| | | } |
| | | |
| | | public String getToken() { |
| | | return token; |
| | | } |
| | | |
| | | public void setToken(String token) { |
| | | this.token = token; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries.metadata; |
| | | |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.BETWEEN; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.EQUALS; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.GREATER_OR_EQUALS_THAN; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.GREATER_THAN; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.IN; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.IS_NOT_NULL; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.IS_NULL; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.LIKE; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.LOWER_OR_EQUALS_THAN; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.LOWER_THAN; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.NOT_BETWEEN; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.NOT_EQUALS; |
| | | import static com.megatim.fdxcommons.model.enumeration.Operateur.NOT_IN; |
| | | import com.megatim.fdxcommons.model.pojo.BetweenOperatorValues; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class WhereQueryParameters { |
| | | |
| | | private final QueryCriterion queryCriterion; |
| | | |
| | | public WhereQueryParameters(QueryCriterion queryCriterion) { |
| | | this.queryCriterion = queryCriterion; |
| | | } |
| | | |
| | | public List<QueryParam> parameters() { |
| | | return buildedParameters(queryCriterion); |
| | | } |
| | | |
| | | private List<QueryParam> buildedParameters(QueryCriterion criterion) { |
| | | |
| | | List<QueryParam> params = new ArrayList<>(); |
| | | |
| | | if (criterion == null) { |
| | | return params; |
| | | } |
| | | |
| | | if (criterion.getSubCriteria().isEmpty()) { |
| | | |
| | | switch (criterion.getOperateur()) { |
| | | |
| | | case EQUALS: |
| | | case NOT_EQUALS: |
| | | case LIKE: |
| | | case GREATER_OR_EQUALS_THAN: |
| | | case GREATER_THAN: |
| | | case LOWER_OR_EQUALS_THAN: |
| | | case LOWER_THAN: |
| | | params.add(new QueryParam(criterion.getNomColonne(), getParameterValue(criterion))); |
| | | break; |
| | | |
| | | case BETWEEN: |
| | | case NOT_BETWEEN: |
| | | BetweenOperatorValues betweenOperatorValues = (BetweenOperatorValues) criterion.getCriteriaValue(); |
| | | params.add(new QueryParam(criterion.getNomColonne(), betweenOperatorValues.getLowerBound())); |
| | | params.add(new QueryParam(criterion.getNomColonne(), betweenOperatorValues.getUpperBound())); |
| | | break; |
| | | |
| | | case NOT_IN: |
| | | case IN: |
| | | List<?> values = (List<?>) criterion.getCriteriaValue(); |
| | | for (Object value : values) { |
| | | params.add(new QueryParam(criterion.getNomColonne(), value)); |
| | | } |
| | | break; |
| | | |
| | | case IS_NOT_NULL: |
| | | case IS_NULL: |
| | | break; |
| | | } |
| | | |
| | | } else { |
| | | |
| | | for (QueryCriterion c : criterion.getSubCriteria()) { |
| | | params.addAll(buildedParameters(c)); |
| | | } |
| | | |
| | | } |
| | | |
| | | return params; |
| | | } |
| | | |
| | | private Object getParameterValue(QueryCriterion criterion) { |
| | | switch (criterion.getOperateur()) { |
| | | case LIKE: |
| | | return "%" + criterion.getCriteriaValue() + "%"; |
| | | } |
| | | return criterion.getCriteriaValue(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries.metadata.dataproduction; |
| | | |
| | | import com.megatim.fdxcommons.model.dataproduction.DataProductionType; |
| | | import com.megatim.fdxcommons.tools.database.queries.metadata.QueryCriterion; |
| | | import java.time.LocalDateTime; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public class DataProductionTaskInfo { |
| | | |
| | | private DataProductionTaskType dataProductionTaskType; |
| | | private String codeTypeFichier; |
| | | private String referentielVersion; |
| | | private String participant; |
| | | private String token; |
| | | private DataProductionType dataProductionType = DataProductionType.ADD; |
| | | |
| | | //Pour les production de type fichier nous aurons besoin du chemin du fichier |
| | | private String fileProductionPath; |
| | | |
| | | //Pour les production de type API |
| | | private List<LinkedHashMap<String, Object>> datas; |
| | | |
| | | //Pour les opération de mise à jour et d'update depuis l'API |
| | | private QueryCriterion queryCriterion; |
| | | private LinkedHashMap<String, Object> dataToUpdate; |
| | | |
| | | private String fileName; |
| | | private LocalDateTime fileDate; |
| | | |
| | | public DataProductionTaskType getDataProductionTaskType() { |
| | | return dataProductionTaskType; |
| | | } |
| | | |
| | | public void setDataProductionTaskType(DataProductionTaskType dataProductionTaskType) { |
| | | this.dataProductionTaskType = dataProductionTaskType; |
| | | } |
| | | |
| | | public String getCodeTypeFichier() { |
| | | return codeTypeFichier; |
| | | } |
| | | |
| | | public void setCodeTypeFichier(String codeTypeFichier) { |
| | | this.codeTypeFichier = codeTypeFichier; |
| | | } |
| | | |
| | | public String getReferentielVersion() { |
| | | return referentielVersion; |
| | | } |
| | | |
| | | public void setReferentielVersion(String referentielVersion) { |
| | | this.referentielVersion = referentielVersion; |
| | | } |
| | | |
| | | public String getParticipant() { |
| | | return participant; |
| | | } |
| | | |
| | | public void setParticipant(String participant) { |
| | | this.participant = participant; |
| | | } |
| | | |
| | | public String getFileProductionPath() { |
| | | return fileProductionPath; |
| | | } |
| | | |
| | | public void setFileProductionPath(String fileProductionPath) { |
| | | this.fileProductionPath = fileProductionPath; |
| | | } |
| | | |
| | | public List<LinkedHashMap<String, Object>> getDatas() { |
| | | return datas; |
| | | } |
| | | |
| | | public void setDatas(List<LinkedHashMap<String, Object>> datas) { |
| | | this.datas = datas; |
| | | } |
| | | |
| | | public QueryCriterion getQueryCriterion() { |
| | | return queryCriterion; |
| | | } |
| | | |
| | | public void setQueryCriterion(QueryCriterion queryCriterion) { |
| | | this.queryCriterion = queryCriterion; |
| | | } |
| | | |
| | | public DataProductionType getDataProductionType() { |
| | | return dataProductionType; |
| | | } |
| | | |
| | | public void setDataProductionType(DataProductionType dataProductionType) { |
| | | this.dataProductionType = dataProductionType; |
| | | } |
| | | |
| | | public LinkedHashMap<String, Object> getDataToUpdate() { |
| | | return dataToUpdate; |
| | | } |
| | | |
| | | public void setDataToUpdate(LinkedHashMap<String, Object> dataToUpdate) { |
| | | this.dataToUpdate = dataToUpdate; |
| | | } |
| | | |
| | | public String getToken() { |
| | | return token; |
| | | } |
| | | |
| | | public void setToken(String token) { |
| | | this.token = token; |
| | | } |
| | | |
| | | public String getFileName() { |
| | | return fileName; |
| | | } |
| | | |
| | | public void setFileName(String fileName) { |
| | | this.fileName = fileName; |
| | | } |
| | | |
| | | public LocalDateTime getFileDate() { |
| | | return fileDate; |
| | | } |
| | | |
| | | public void setFileDate(LocalDateTime fileDate) { |
| | | this.fileDate = fileDate; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.megatim.fdxcommons.tools.database.queries.metadata.dataproduction; |
| | | |
| | | /** |
| | | * |
| | | * @author Gabuntu |
| | | */ |
| | | public enum DataProductionTaskType { |
| | | FICHIER, API, BATCH_TOKEN_JSON, BATCH_TOKEN_FILE, COMPOSED_JSON_OBJECT; |
| | | } |
| 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.fdxcommons.tools.database.queries.metadata.jpql; |
| | | |
| | | import com.megatim.fdxcommons.model.enumeration.Operateur; |
| | | import com.megatim.fdxcommons.model.search.EnumValue; |
| | | import com.megatim.fdxcommons.tools.database.exceptions.BadQueryCriteriaException; |
| | | import java.lang.reflect.Field; |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.lang.reflect.Method; |
| | | import java.lang.reflect.Modifier; |
| | | import java.sql.Timestamp; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.ZonedDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.logging.Level; |
| | | import java.util.logging.Logger; |
| | | |
| | | /** |
| | | * |
| | | * @author ASUS |
| | | */ |
| | | public class JpqlParsedQueryCriterion { |
| | | |
| | | private final JpqlQueryCriterion queryCriterion; |
| | | private final Class<?> classe; |
| | | |
| | | public JpqlParsedQueryCriterion(JpqlQueryCriterion queryCriterion, Class<?> classe) { |
| | | this.queryCriterion = queryCriterion; |
| | | this.classe = classe; |
| | | } |
| | | |
| | | public JpqlQueryCriterion parsedCriterion() throws Exception { |
| | | return queryCriterion != null |
| | | ? parsedCriterion(queryCriterion) |
| | | : null; |
| | | } |
| | | |
| | | private JpqlQueryCriterion parsedCriterion(JpqlQueryCriterion criterion) throws Exception { |
| | | |
| | | if (criterion.getSubCriteria() != null && !criterion.getSubCriteria().isEmpty() && criterion.getCriteriaLogicConnector() != null) { |
| | | List<JpqlQueryCriterion> subCriteria = new ArrayList<>(); |
| | | |
| | | for (JpqlQueryCriterion qc : criterion.getSubCriteria()) { |
| | | JpqlQueryCriterion parsedCriterion = parsedCriterion(qc); |
| | | |
| | | if (parsedCriterion != null) { |
| | | subCriteria.add(parsedCriterion); |
| | | } |
| | | } |
| | | if (!subCriteria.isEmpty()) { |
| | | return new JpqlQueryCriterion(null, |
| | | null, |
| | | null, |
| | | criterion.getCriteriaLogicConnector(), |
| | | subCriteria, |
| | | criterion.isEndOfTheDay() |
| | | ); |
| | | } |
| | | } else if ((criterion.getSubCriteria() == null || criterion.getSubCriteria().isEmpty()) |
| | | && criterion.getNomColonne() != null && !criterion.getNomColonne().isEmpty() && criterion.getOperateur() != null) { |
| | | Class<?> clazz = columnType(criterion.getNomColonne()); |
| | | |
| | | if (clazz != null) { |
| | | |
| | | Object correctValue = correctValue(clazz, criterion); |
| | | |
| | | if (isUnaryOperator(criterion.getOperateur()) || (correctValue != null && !correctValue.toString().isEmpty())) { |
| | | return new JpqlQueryCriterion(criterion.getNomColonne(), |
| | | correctValue, |
| | | criterion.getOperateur(), |
| | | null, |
| | | Arrays.asList(), |
| | | criterion.isEndOfTheDay() |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private Class<?> columnType(String nomColonne) { |
| | | Field[] fields = classe.getDeclaredFields(); |
| | | String[] fieldPath = nomColonne.split("\\."); |
| | | try { |
| | | return columnType(fieldPath, fields); |
| | | } catch (BadQueryCriteriaException ex) { |
| | | Logger.getLogger(JpqlParsedQueryCriterion.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | private Class<?> columnType(String[] fieldPath, Field[] fields) throws BadQueryCriteriaException { |
| | | Optional<Field> optField = Arrays.asList(fields).stream().filter(f -> f.getName().equals(fieldPath[0])).findFirst(); |
| | | |
| | | if (optField.isPresent()) { |
| | | if (fieldPath.length == 1) { |
| | | return optField.get().getType(); |
| | | } else { |
| | | return columnType(Arrays.copyOfRange(fieldPath, 1, fieldPath.length), optField.get().getType().getDeclaredFields()); |
| | | } |
| | | } else { |
| | | throw new BadQueryCriteriaException("Colonne " + fields[0] + " introuvable dans la classe " + optField.get().getDeclaringClass().getName()); |
| | | |
| | | } |
| | | } |
| | | |
| | | private Object correctValue(Class<?> clazz, JpqlQueryCriterion criterion) throws IllegalAccessException, BadQueryCriteriaException, IllegalArgumentException, InvocationTargetException { |
| | | |
| | | Object criteriaValue = criterion.getCriteriaValue(); |
| | | if (criteriaValue == null) { |
| | | return null; |
| | | } |
| | | |
| | | if (clazz.isEnum()) { |
| | | |
| | | Method[] methods = clazz.getMethods(); |
| | | Optional<Method> optionalMethod = Arrays.asList(methods) |
| | | .stream() |
| | | .filter(m -> m.getAnnotation(EnumValue.class) != null && Modifier.isStatic(m.getModifiers())).findFirst(); |
| | | |
| | | if (optionalMethod.isPresent()) { |
| | | Method method = optionalMethod.get(); |
| | | return method.invoke(null, criteriaValue.toString()); |
| | | } |
| | | |
| | | return criteriaValue; |
| | | |
| | | } else if (clazz.isAssignableFrom(LocalDateTime.class)) { |
| | | return dateTimeValue(criteriaValue.toString(), criterion.isEndOfTheDay()); |
| | | |
| | | } else { |
| | | return clazz.cast(criteriaValue); |
| | | } |
| | | } |
| | | |
| | | private Object dateTimeValue(String criteriaValue, boolean endOfTheDay) { |
| | | ZonedDateTime zonedDateTime = ZonedDateTime.parse(criteriaValue, DateTimeFormatter.ISO_DATE_TIME); |
| | | LocalDateTime date = Timestamp.from(zonedDateTime.toInstant()).toLocalDateTime(); |
| | | |
| | | return endOfTheDay |
| | | ? date.toLocalDate().atTime(LocalTime.MAX) |
| | | : date.toLocalDate().atTime(LocalTime.MIN); |
| | | } |
| | | |
| | | private boolean isUnaryOperator(Operateur operateur) { |
| | | return operateur.equals(Operateur.IS_NOT_NULL) || operateur.equals(Operateur.IS_NULL); |
| | | } |
| | | } |
| fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/queries/metadata/jpql/JpqlQueryCriterion.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/queries/metadata/jpql/JpqlQueryParam.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/queries/metadata/jpql/JpqlWhereQueryParameters.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/queries/validation/JsonDataValidationError.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/queries/validation/TableDataValidationError.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/ApiJsonFdxTable.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/FdxApiTable.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/FdxConsultationTable.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/FdxTable.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/FdxTableColumn.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/FdxTableColumnData.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/FdxTableColumns.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/FdxTableName.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/FdxTableRow.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/JpqlTable.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/JsonFdxTable.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/JsonFdxTableColumns.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/appcolumns/AppColumnDefinitions.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/appcolumns/DataProductionIdColumnDefinition.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/appcolumns/DataProductionUpdateIdColumnDefinition.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/appcolumns/DateCreationColumnDefinition.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/appcolumns/DateMiseAJourColumnDefinition.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/appcolumns/DeletedColumnDefinition.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/appcolumns/EnCoursProductionColumnDefinition.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/appcolumns/FdxApiColumnDefinitions.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/appcolumns/FdxConsultationColumnDefinitions.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/appcolumns/FdxConsultationIndexColumnDefinition.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/appcolumns/IndexColumnDefinition.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/appcolumns/ParentIdColumnDefinition.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/appcolumns/TokenColumnDefinition.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/dto/FdxTableColumnDataDto.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/dto/FdxTableRowDto.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/tables/dto/JpqlQueryElement.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/exceptions/ApplicationForbidenException.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/exceptions/CommonAlredyExistException.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/exceptions/CommonApplicationServerException.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/exceptions/CommonApplicationValidationException.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/exceptions/CommonAttributNotExistException.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/exceptions/CommonRessourceNotFoundException.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/exceptions/CommonValidationExceptionMapperCustom.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/exceptions/FdxColumnNotFoundException.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/exceptions/ImportReferentielException.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/exceptions/TypeFichierExistNotException.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/integration/FdxConsultationIntegrationData.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/integration/JsonFdxConsultationIntegrationData.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/integration/dto/ApiIntegrationDataDto.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/jaxb/util/JaxBUtil.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/resolvers/JacksonMapperFormat.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/utils/ConnectionUtil.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/utils/CriteriaEntityFromViewToJqplQueryCriterion.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/utils/CriteriaEntityFromViewToQueryCriterion.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/utils/CustomColumns.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/utils/FdxParsedDataAction.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/utils/JsonDataUtil.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/utils/JsonFdxParsedDataAction.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/utils/JsonTableUtil.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/utils/ParserUtils.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/utils/SearchColumnUtil.java
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/utils/SqlUtilities.java
fdx-commons/nb-configuration.xml
fdx-commons/pom.xml
fdx-consultation/README.md
fdx-consultation/fdxconsulation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/referentiel/RoutageRSImpl.java
fdx-consultation/fdxconsultation-core-ifaces/.gitignore
fdx-consultation/fdxconsultation-core-ifaces/nb-configuration.xml
fdx-consultation/fdxconsultation-core-ifaces/pom.xml
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/abtracts/AbstractCrudManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/abtracts/CommonReadManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/abtracts/ExportExcelGenerator.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/abtracts/GeneriConsultingManagerIFaces.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/abtracts/GenericCrudManagerIFaces.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/abtracts/GenericReportingManagerIFaces.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/abtracts/ManagerWithCriteriaEntityIFaces.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/abtracts/PaginationWithCriteriaEntity.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/abtracts/PaginationWithSearchEntity.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/abtracts/TypeFichierReportingManagerIFaces.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/administration/ActionManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/administration/HistoriqueMotDePasseManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/administration/JournalActionUtilisateurManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/administration/JournalConnexionUtilisateurManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/administration/RoleManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/administration/UserManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/api/token/ApiTokenManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/configuration/CodeStatutHttpManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/customtypefichier/CustomTypeFichierManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/dataproduction/DataProductionManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/dataproduction/DataProductionToDeleteManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/dataproduction/metadata/ProductionMetaDataManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/documents/CategoryManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/documents/DocumentManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/favoritessearch/FavoriteSearchManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/helper/DataConsumptionOperations.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/helper/RequestHandler.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/helper/RoutingChecker.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/helper/TableInsert.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/helper/TableauBordHandler.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/integration/AppColumnDeleter.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/integration/ColumnDefinitionManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/integration/EchecIntegrationManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/integration/TableDefinitionManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/log/ApiUserActionLogManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/log/UserActionLogManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/message/systeme/MessageSystemeManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/referentiel/ApplicationSourceManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/referentiel/ExtensionFichierManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/referentiel/GroupeNoeudManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/referentiel/GroupeParticipantManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/referentiel/NoeudManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/referentiel/ParticipantManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/referentiel/PaysManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/referentiel/ReferentielManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/referentiel/RoutageManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/referentiel/StructureLigneManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/referentiel/TypeFichierManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/referentiel/ValidateurFichierConfigurationManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/referentiel/ValidateurFichierManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/referentiel/historique/ReferentielIntegrationHistoriqueManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/referentiel/natureproduction/NatureProductionFichierManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/remoteaction/PlanificationManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/remoteaction/RemoteConfigurationManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/searchs/DashboardFichierManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/searchs/TypeFichierReferentielManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/searchs/UserParticipantManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/searchs/UserTypeFichierManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/settings/DisplayOptionsManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/settings/SettingsManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/stats/CriteriaEntityPersistedManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/stats/TableConfigurationManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/stats/TableauBordColumnManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/stats/TableauBordGlobalSearchManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/stats/TableauBordManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/stats/TableauBordUserSpecificSearchManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/supervision/AgentConfigurationEntityManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/supervision/StandaloneServerStateEntityManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/supervision/TransfertManager.java
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/tools/SourceCompiler.java
fdx-consultation/fdxconsultation-core-impl/.gitignore
fdx-consultation/fdxconsultation-core-impl/nb-configuration.xml
fdx-consultation/fdxconsultation-core-impl/pom.xml
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/administration/ActionManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/administration/HistoriqueMotDePasseManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/administration/JournalActionUtilisateurManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/administration/JournalConnexionUtilisateurManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/administration/RoleManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/administration/UserManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/api/supervision/TransfertDataMessageToTransfert.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/api/supervision/TransfertManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/api/token/ApiTokenManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/camel/CustomCamelContext.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/camel/helper/FileInsertionProcess.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/configuration/CodeStatutHttpManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/customtypefichier/CustomTypeFichierManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/customtypefichier/DynamicClassCreatorImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/dataproduction/DataProductionHandlerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/dataproduction/DataProductionManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/dataproduction/DataProductionToDeleteManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/dataproduction/metadata/ProductionMetaDataManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/dataproductionworker/DataProductionTask.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/dataproductionworker/DataProductionTaskFactory.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/dataproductionworker/DataProductionWorker.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/dataproductionworker/DataProductionWorkerGroup.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/dataproductionworker/DefaultDataProductionWorkerGroup.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/dataproductionworker/DeleteDataProductionTask.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/dataproductionworker/FileDataProductionTask.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/db/ReferentielDataSaverImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/documents/CategoryManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/documents/DocumentManageImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/factory/FdxConsultationTableFactory.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/favoritessearch/FavoriteSearchManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/helper/DataConsumptionOperationsImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/helper/DataInMemoryHandlerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/helper/FdxConsultationTableInsert.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/helper/ReferentielConsumptionHelperImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/helper/RequestHandlerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/helper/RoutingCheckerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/helper/TableauBordHandlerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/integration/AppColumnCreatorImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/integration/AppColumnDeleterImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/integration/ColumnDefinitionManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/integration/DynamicTableCreatorImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/integration/EchecIntegrationManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/integration/TableDefinitionManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/log/ApiUserActionLogManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/log/UserActionLogManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/message/systeme/MessageSystemeManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/referentiel/ApplicationSourceManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/referentiel/ExtensionFichierManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/referentiel/GroupeNoeudManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/referentiel/GroupeParticipantManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/referentiel/NoeudManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/referentiel/ParticipantManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/referentiel/PaysManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/referentiel/ReferentielManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/referentiel/RoutageManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/referentiel/StructureLigneManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/referentiel/TypeFichierManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/referentiel/ValidateurFichierConfigurationManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/referentiel/ValidateurFichierManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/referentiel/historique/ReferentielIntegrationHistoriqueManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/referentiel/natureproduction/NatureProductionFichierManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/remoteaction/PlanificationManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/remoteaction/RemoteConfigurationManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/searchs/DashboardFichierManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/searchs/TypeFichierReferentielManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/searchs/UserParticipantManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/searchs/UserTypeFichierManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/settings/DisplayOptionsManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/settings/SettingsManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/sockets/DataProductionSessionHandler.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/stats/ConvertedCriteriaEntityFromView.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/stats/ConvertedCriteriaEntityPersisted.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/stats/ConvertedTableConfiguration.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/stats/ConvertedTableConfigurationResponse.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/stats/ConvertedTableauBord.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/stats/ConvertedTableauBordResponse.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/stats/CriteriaEntityPersistedManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/stats/TableConfigurationManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/stats/TableauBordColumnManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/stats/TableauBordGlobalSearchManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/stats/TableauBordManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/stats/TableauBordRequestError.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/stats/TableauBordResult.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/stats/TableauBordUserSpecificSearchManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/supervision/AgentConfigurationEntityManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/supervision/StandaloneServerStateEntityManagerImpl.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/utils/CriteriaEntitySearchUtil.java
fdx-consultation/fdxconsultation-core-impl/src/main/java/com/megatim/fdxconsultation/core/impl/utils/FdxTableUtils.java
fdx-consultation/fdxconsultation-dao-ifaces/.gitignore
fdx-consultation/fdxconsultation-dao-ifaces/nb-configuration.xml
fdx-consultation/fdxconsultation-dao-ifaces/pom.xml
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/abstracts/CustomDAOWithCriteriaEntityIfaces.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/abstracts/PaginationWithCriteriaEntityDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/abstracts/PaginationWithSearchEnityDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/administration/ActionDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/administration/HistoriqueMotDePasseDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/administration/JournalActionUtilisateurDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/administration/JournalConnexionUtilisateurDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/administration/RoleDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/administration/UserDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/api/token/ApiTokenDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/configuration/CodeStatutHttpDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/dataproduction/DataProductionDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/dataproduction/DataProductionToDeleteDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/dataproduction/metadata/ProductionMetaDataDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/documents/CategoryDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/documents/DocumentDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/favoritessearch/FavoriteSearchDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/integration/EchecIntegrationDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/log/ApiUserActionLogDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/log/UserActionLogDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/message/systeme/MessageSystemeDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/referentiel/ApplicationSourceDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/referentiel/ExtensionFichierDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/referentiel/GroupeNoeudDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/referentiel/GroupeParticipantDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/referentiel/NoeudDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/referentiel/ParticipantDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/referentiel/PaysDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/referentiel/ReferentielDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/referentiel/RoutageDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/referentiel/StructureLigneDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/referentiel/TypeFichierConsultationDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/referentiel/TypeFichierDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/referentiel/ValidateurFichierConfigurationDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/referentiel/ValidateurFichierDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/remoteaction/PlanificationDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/remoteaction/RemoteConfigurationDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/searchs/TypeFichierReferentielSearchDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/searchs/UserParticipantDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/searchs/UserTypeFichierDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/settings/DisplayOptionsDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/stats/CriteriaEntityPersistedDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/stats/StatististiquesDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/stats/TableConfigurationDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/stats/TableauBordColumnDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/stats/TableauBordDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/stats/TableauBordGlobalSearchDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/stats/TableauBordUserSpecificSearchDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/supervision/AgentConfigurationEntityDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/supervision/StandaloneServerStateEntityDAO.java
fdx-consultation/fdxconsultation-dao-ifaces/src/main/java/com/megatim/fdxconsultation/dao/ifaces/supervision/TransfertDAO.java
fdx-consultation/fdxconsultation-dao-impl/.gitignore
fdx-consultation/fdxconsultation-dao-impl/nb-configuration.xml
fdx-consultation/fdxconsultation-dao-impl/pom.xml
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/api/token/ApiTokenDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/administration/ActionDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/administration/HistoriqueMotDePasseDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/administration/JournalActionUtilisateurDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/administration/JournalConnexionUtilisateurDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/administration/RoleDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/administration/UserDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/configuration/CodeStatutHttpDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/dataproduction/DataProductionDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/dataproduction/DataProductionToDeleteDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/dataproduction/metadata/CreateDataProductionQuery.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/dataproduction/metadata/CreateProductionMetaDataQuery.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/dataproduction/metadata/ProductionMetaDataDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/integration/ColumnDefinitionDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/integration/EchecIntegrationDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/integration/TableDefinitionDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/log/ApiUserActionLogDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/log/UserActionLogDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/log/util/QueryExtendsWithApiUserActionSummarySearch.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/message/systeme/MessageSystemeDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/referentiel/ApplicationSourceDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/referentiel/ExtensionFichierDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/referentiel/GroupeNoeudDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/referentiel/GroupeParticipantDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/referentiel/NoeudDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/referentiel/ParticipantDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/referentiel/PaysDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/referentiel/ReferentielDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/referentiel/RoutageDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/referentiel/StructureLigneDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/referentiel/TypeFichierDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/referentiel/ValidateurFichierConfigurationDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/referentiel/ValidateurFichierDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/referentiel/historique/ReferentielIntegrationHistoriqueDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/referentiel/natureproduction/NatureProductionFichierDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/remoteaction/PlanificationDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/remoteaction/RemoteConfigurationDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/settings/DisplayOptionsDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/stats/CriteriaEntityPersistedDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/stats/TableConfigurationDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/stats/TableauBordColumnDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/stats/TableauBordDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/stats/TableauBordGlobalSearchDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/stats/TableauBordUserSpecificSearchDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/supervision/AgentConfigurationEntityDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/supervision/StandaloneServerStateEntityDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/supervision/TransfertDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/supervision/TransfertDaoDynamicWhereString.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/supervision/TransfertMessageKey.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/impl/utils/BaseEntityUtil.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/searchs/TypeFichierReferentielSearchDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/searchs/UserParticipantDAOIml.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/dao/searchs/UserTypeFichierDAOIml.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/daoimpl/documents/CategoryDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/daoimpl/documents/DocumentDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/java/com/megatim/fdxconsultation/daoimpl/favoritessearch/FavoriteSearchDAOImpl.java
fdx-consultation/fdxconsultation-dao-impl/src/main/resources/META-INF/persistence.xml
fdx-consultation/fdxconsultation-model/.gitignore
fdx-consultation/fdxconsultation-model/nb-configuration.xml
fdx-consultation/fdxconsultation-model/pom.xml
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/adapters/LocalDateTimeAdapter.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/administration/Action.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/administration/HistoriqueMotDePasse.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/administration/JournalActionUtilisateur.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/administration/JournalConnexionUtilisateur.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/administration/Role.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/administration/User.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/administration/security/ActionSecurity.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/administration/security/RoleSecurity.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/administration/security/UserSecurity.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/api/token/ApiToken.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/api/token/ApiTokenStatut.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/authentification/LoginRequest.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/base/BaseEntity.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/configuration/CodeStatutHttp.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dataproduction/DataProduction.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/documents/Category.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/documents/Document.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/ActionDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/ActionSlimDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/AdministrationNumberDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/ApiTokenDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/BaseEntityDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/CategoryDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/CategorySlimDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/CodeStatutHttpDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/DocumentDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/EditPasswordDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/FavoriteSearchDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/InformationGeneraleDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/JournalActionUtilisateurDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/JournalConnexionUtilisateurDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/MessageSystemeDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/ParticipantToFichierDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/RoleDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/RoleSlimDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/UserDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/UserSlimDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/log/UserActionLogDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/log/UserActionStatData.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/log/UserActionStatDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/stats/FonctionAggregationCriterionDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/stats/GroupingColumnDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/stats/StatListResult.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/stats/StatResultDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/stats/StatScalarResult.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/stats/TableConfigurationDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/stats/TableConfigurationSlimDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/stats/TableauBordColumnDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/stats/TableauBordDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/stats/TableauBordQueryPojo.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dto/stats/TableauBordSlimDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dtos/reporting/CustomFieldDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dtos/reporting/CustomTypeFichierReportConfiguration.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dtos/reporting/CustomTypeFichierReportConfigurationFromView.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/dtos/reporting/ReportingDto.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/enums/FonctionAggregationOperateur.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/enums/StatResultType.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/enums/TypeConfigurationTableauBord.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/enums/TypeResultatConfiguration.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/favoritessearch/FavoriteSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/formodel/RoleFormModel.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/formodel/UserFormModel.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/integration/EchecIntegration.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/log/ApiUserActionLog.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/log/dtos/ApiUserActionSummarySearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/mappers/MapStructMapper.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/message/systeme/ApplicationData.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/message/systeme/MessageDecoder.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/message/systeme/MessageEncoder.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/message/systeme/MessageSysteme.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/message/systeme/UserSesionApplication.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/message/systeme/UserWebSocket.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/referentiel/dtos/ExtensionFichierSlimResponse.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/referentiel/dtos/GroupeNoeudSlimResponse.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/referentiel/dtos/GroupeParticipantSlimResponse.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/referentiel/dtos/NoeudSlimResponse.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/referentiel/dtos/ParticipantSlimResponse.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/referentiel/dtos/PaysSlimResponse.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/referentiel/dtos/ReferentielSlimResponse.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/referentiel/dtos/RoutageDetailsResponse.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/referentiel/dtos/RoutageSlimResponse.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/referentiel/dtos/TypeFichierSlimResponse.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/remoteaction/Planification.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/remoteaction/RemoteConfiguration.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/ApiTokenSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/ApplicationSourceSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/CodeStatutHttpSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/ExtensionFichierSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/GroupeNoeudSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/GroupeParticipantSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/JournalActionUtilisateurSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/JournalConnexionUtilisateurSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/NoeudSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/ParticipantSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/PaysSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/ReferentielSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/RoleSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/RoutageSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/StructureLigneSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/TableauBordGlobalSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/TableauBordSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/TableauBordSpecificSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/TransfertSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/TypeFichierReferentielSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/TypeFichierSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/UserSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/ValidateurFichierConfigurationSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/searchentities/ValidateurFichierSearch.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/settings/DisplayOptions.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/stats/CriteriaEntityPersisted.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/stats/FonctionAggregationCriterion.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/stats/TableConfiguration.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/stats/TableauBord.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/stats/TableauBordColumn.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/stats/dto/TableConfigurationResponse.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/stats/dto/TableauBordColumnResponse.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/stats/dto/TableauBordFlatResponse.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/stats/dto/TableauBordRequest.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/stats/dto/TableauBordResponse.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/supervision/AgentConfigurationEntity.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/supervision/EtatTransfert.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/supervision/SensTransfert.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/supervision/StandaloneServerStateEntity.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/supervision/StatutConfiguration.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/supervision/SupervisionData.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/supervision/Transfert.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/supervision/dto/StandaloneDashboardRequest.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/supervision/dto/StandaloneDashboardResponse.java
fdx-consultation/fdxconsultation-model/src/main/java/com/megatim/fdxconsultation/model/supervision/dto/SupervisionFilterModalFormRequest.java
fdx-consultation/fdxconsultation-reporting/.gitignore
fdx-consultation/fdxconsultation-reporting/nb-configuration.xml
fdx-consultation/fdxconsultation-reporting/pom.xml
fdx-consultation/fdxconsultation-reporting/src/main/java/com/megatim/fdxconsultation/reporting/model/administration/JournalActionUtilisateurReporting.java
fdx-consultation/fdxconsultation-reporting/src/main/java/com/megatim/fdxconsultation/reporting/model/administration/JournalConnexionUtilisateurReporting.java
fdx-consultation/fdxconsultation-reporting/src/main/java/com/megatim/fdxconsultation/reporting/model/administration/RoleReporting.java
fdx-consultation/fdxconsultation-reporting/src/main/java/com/megatim/fdxconsultation/reporting/model/administration/UserReporting.java
fdx-consultation/fdxconsultation-reporting/src/main/java/com/megatim/fdxconsultation/reporting/model/api/token/ApiTokenReporting.java
fdx-consultation/fdxconsultation-reporting/src/main/java/com/megatim/fdxconsultation/reporting/model/configuration/CodeStatutHttpReporting.java
fdx-consultation/fdxconsultation-reporting/src/main/java/com/megatim/fdxconsultation/reporting/model/log/ApiUserActionLogReporting.java
fdx-consultation/fdxconsultation-reporting/src/main/java/com/megatim/fdxconsultation/reporting/model/referentiel/ExtensionFichierReporting.java
fdx-consultation/fdxconsultation-reporting/src/main/java/com/megatim/fdxconsultation/reporting/model/referentiel/GroupeNoeudReporting.java
fdx-consultation/fdxconsultation-reporting/src/main/java/com/megatim/fdxconsultation/reporting/model/referentiel/GroupeParticipantReporting.java
fdx-consultation/fdxconsultation-reporting/src/main/java/com/megatim/fdxconsultation/reporting/model/referentiel/NoeudReporting.java
fdx-consultation/fdxconsultation-reporting/src/main/java/com/megatim/fdxconsultation/reporting/model/referentiel/ParticipantReporting.java
fdx-consultation/fdxconsultation-reporting/src/main/java/com/megatim/fdxconsultation/reporting/model/referentiel/PaysReporting.java
fdx-consultation/fdxconsultation-reporting/src/main/java/com/megatim/fdxconsultation/reporting/model/referentiel/ReferentielReporting.java
fdx-consultation/fdxconsultation-reporting/src/main/java/com/megatim/fdxconsultation/reporting/model/referentiel/RoutageReporting.java
fdx-consultation/fdxconsultation-reporting/src/main/java/com/megatim/fdxconsultation/reporting/model/referentiel/TypeFichierReporting.java
fdx-consultation/fdxconsultation-service-ifaces/.gitignore
fdx-consultation/fdxconsultation-service-ifaces/nb-configuration.xml
fdx-consultation/fdxconsultation-service-ifaces/pom.xml
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/abstracts/AbstractCUDWithCriteriaEntityIFaces.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/abstracts/AbstractFormDataIFaces.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/abstracts/AbstractFormModelIFaces.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/abstracts/AbstractGenericConsultingCompositePKResourceIFaces.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/abstracts/AbstractGenericCrudResourceIFaces.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/abstracts/AbstractGenericReportingIFaces.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/abstracts/AbstractGenericValidationIFaces.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/abstracts/AbstractReadWithCriteriaEntityIFaces.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/abstracts/AbstractUniqueElementIFace.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/administration/ActionRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/administration/JournalActionUtilisateurRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/administration/JournalConnexionUtilisateurRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/administration/RoleRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/administration/RoleValidationRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/administration/UserRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/administration/UserValidationRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/api/token/ApiTokenRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/authentication/AuthenticationRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/chat/UserChatListRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/consumption/DataConsumptionOperationsRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/dataproduction/DataProductionRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/documents/CategoryRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/documents/DocumentRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/favoritessearch/FavoriteSearchRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/integration/ColumnDefinitionResource.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/log/ApiUserActionLogRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/log/UserActionLogRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/referentiel/ExtensionFichierRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/referentiel/GroupeNoeudRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/referentiel/GroupeParticipantRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/referentiel/NoeudRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/referentiel/ParticipantRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/referentiel/PaysRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/referentiel/ReferentielRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/referentiel/RoutageRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/referentiel/TestRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/referentiel/TypeFichierRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/remoteaction/RemoteConfigurationRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/searchs/DasboardTypeFichierSearchRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/searchs/GlobalDasboardSearchRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/searchs/ParticipantSearchRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/searchs/ReferentielSearchRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/searchs/RoleSearchRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/searchs/TableauBordSearchRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/searchs/TypeFichierReferentielSearchRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/searchs/TypeFichierSearchRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/searchs/UserParticipantSearchRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/searchs/UserTypeFichierSearchRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/searchs/UserTypeFichierWithReferentielSearchRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/settings/DisplayOptionsRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/settings/SettingRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/stats/TableauBordGlobalRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/stats/TableauBordRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/supervision/SupervisionRS.java
fdx-consultation/fdxconsultation-service-ifaces/src/main/java/com/megatim/fdxconsultation/service/ifaces/timer/processor/DeleteDataProductionJob.java
fdx-consultation/fdxconsultation-service-impl/.gitignore
fdx-consultation/fdxconsultation-service-impl/nb-configuration.xml
fdx-consultation/fdxconsultation-service-impl/pom.xml
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/JAXRSConfiguration.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/Utils.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/administration/JournalActionUtilisateurRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/administration/JournalConnexionUtilisateurRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/administration/RoleRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/administration/RoleValidationRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/administration/UserRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/administration/UserValidationRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/api/token/ApiTokenRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/authentication/AuthenticationRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/camel/CamelBootstrap.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/camel/consumer/ApiUserActionLogConsumer.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/camel/consumer/ConnexionStatutConsumer.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/camel/consumer/ProductionMetaDaConsumer.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/camel/consumer/ReferentielDataConsumer.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/camel/consumer/StandaloneServerStateConsumer.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/camel/consumer/TransfertDataMessageConsumer.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/camel/consumer/UserActionLogConsumer.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/camel/routes/UserActionsRoute.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/camel/routes/in/ApiUserActionsRoute.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/camel/routes/in/ConnectedStatutsRoute.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/camel/routes/in/ProductionMetaDataRoute.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/camel/routes/in/ReferentialConsumerRoute.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/camel/routes/in/StandaloneServerStateConsumerRoute.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/camel/routes/in/TransfertDataMessageRoute.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/camel/routes/out/DirectToTokenGenerationKafkaRoute.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/camel/routes/out/RemoteConfigurationRoute.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/camel/routes/timers/DataIntegrationTimer.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/camel/routes/timers/DeleteDataProductionTimer.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/camel/routes/timers/processor/DataIntegrationProcessor.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/camel/routes/timers/processor/DeleteDataProductionJobImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/chat/UserChatListRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/consumption/DataConsumptionOperationsRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/dataproduction/DataProductionRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/documents/CategoryRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/documents/DocumentRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/favoritessearch/FavoriteSearchRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/filters/AfterUserActionFilter.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/filters/BeforeUserActionFilter.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/filters/CORSFilter.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/filters/SecurityFilter.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/integration/ColumnDefinitionResourceImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/log/ApiUserActionLogRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/log/UserActionLogRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/referentiel/ExtensionFichierRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/referentiel/GroupeNoeudRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/referentiel/GroupeParticipantRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/referentiel/NoeudRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/referentiel/ParticipantRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/referentiel/PaysRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/referentiel/ReferentielRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/referentiel/RoutageRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/referentiel/TypeFichierRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/remoteaction/RemoteConfigurationRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/searchs/DasboardTypeFichierSearchRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/searchs/GlobalDasboardTypeFichierSearchRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/searchs/ParticipantSearchRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/searchs/ReferentielSearchRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/searchs/RoleSearchRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/searchs/TableauBordGlobalSearchRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/searchs/TableauBordSearchRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/searchs/TypeFichierReferentielForUserSearchRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/searchs/TypeFichierReferentielSearchRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/searchs/TypeFichierSearchRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/searchs/UserParticipantSearchRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/searchs/UserTypeFichierSearchRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/searchs/UserTypeFichierWithReferentielSearchRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/settings/DisplayOptionsRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/settings/SettingRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/AdministrationCronBean.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/ApplicationEndpoint.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/ConnexionStatutEndpoint.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/DataProductionEndpoint.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/FichiersEndpoint.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/MessageSystemeEndpoint.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/MessagesSystemeCronBean.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/StandaloneServerStateEndpoint.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/TableauBordsEndpoint.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/TableauBordsGlobalEndpoint.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/TransfertEndpoint.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/UserSessionBean.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/encoders/ConnexionStatutsDecoder.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/encoders/ConnexionStatutsEncoder.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/encoders/DataProductionDecoder.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/encoders/DataProductionEncoder.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/encoders/ParticipantToFichiersDecoder.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/encoders/ParticipantToFichiersEncoder.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/encoders/StandaloneServerStateEntityDecoder.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/encoders/StandaloneServerStateEntityEncoder.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/encoders/TranfertDecoder.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/encoders/TransfertEncoder.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/helpers/ConnexionStatutSessionHandler.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/helpers/StandaloneServerStateSessionHandler.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/helpers/TableauBordGlobalSessionHandler.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/sockets/helpers/TransfertDataMessageSessionHandler.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/startup/StartupBean.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/stats/TableauBordGlobalRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/stats/TableauBordRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/resolvers/JacksonMapperFormat.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/resolvers/ObjectMapperContextResolver.java
fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/supervision/SupervisionRSImpl.java
fdx-consultation/fdxconsultation-service-impl/src/main/resources/application.properties
fdx-consultation/fdxconsultation-service-impl/src/main/resources/natureProductionFichiers.xml
fdx-consultation/fdxconsultation-service-impl/src/main/webapp/WEB-INF/beans.xml
fdx-consultation/fdxconsultation-service-impl/src/main/webapp/WEB-INF/web.xml
fdx-consultation/fdxconsultation-service-impl/src/main/webapp/index.html
fdx-consultation/fdxconsultation-tools-module/fdxconsultation-tools-entities/pom.xml
fdx-consultation/fdxconsultation-tools-module/fdxconsultation-tools-entities/src/main/java/com/megatim/fdxconsultation/tools/CommonsToolsEntity.java
fdx-consultation/fdxconsultation-tools-module/fdxconsultation-tools-entities/src/main/java/com/megatim/fdxconsultation/tools/context/AppContextEntity.java
fdx-consultation/fdxconsultation-tools-module/fdxconsultation-tools/pom.xml
fdx-consultation/fdxconsultation-tools-module/fdxconsultation-tools/src/main/java/com/megatim/fdxconsultation/tools/CommonTools.java
fdx-consultation/fdxconsultation-tools-module/fdxconsultation-tools/src/main/java/com/megatim/fdxconsultation/tools/context/AppCommonContext.java
fdx-consultation/fdxconsultation-tools-module/pom.xml
fdx-consultation/nb-configuration.xml
fdx-consultation/pom.xml |