Skip to content
Snippets Groups Projects
Commit c9be059e authored by LEMERCIER Denis's avatar LEMERCIER Denis
Browse files

Merge branch 'nettoyage' into 'develop'

[SOY] Nettoyage

See merge request !21
parents 592aecd2 05ca9353
No related branches found
No related tags found
2 merge requests!35preparation release 2.1.0,!21[SOY] Nettoyage
Pipeline #326855 passed
Showing
with 4 additions and 548 deletions
......@@ -3,6 +3,7 @@
Tous les changements de ce projet seront documentés dans ce document.
## [Non livré]
- Nettoyage : Supression des tables, Entities et Repositories plus utilisés (pour MixElectrique, ImpactEquipement, ImpactReseau & TypeEquipement)
## [2.0.0] - 2024-06-14
......
package org.mte.numecoeval.referentiel.infrastructure.init;
import jakarta.annotation.PostConstruct;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.mte.numecoeval.referentiel.domain.exception.ReferentielException;
import org.mte.numecoeval.referentiel.infrastructure.jpa.adapter.ImpactEquipementJpaAdapter;
import org.mte.numecoeval.referentiel.infrastructure.jpa.adapter.ImpactReseauJpaAdapter;
import org.mte.numecoeval.referentiel.infrastructure.jpa.adapter.MixElectriqueJpaAdapter;
import org.mte.numecoeval.referentiel.infrastructure.jpa.repository.ImpactEquipementRepository;
import org.mte.numecoeval.referentiel.infrastructure.jpa.repository.ImpactReseauRepository;
import org.mte.numecoeval.referentiel.infrastructure.jpa.repository.MixElectriqueRepository;
import org.mte.numecoeval.referentiel.infrastructure.mapper.ImpactEquipementMapper;
import org.mte.numecoeval.referentiel.infrastructure.mapper.ImpactReseauMapper;
import org.mte.numecoeval.referentiel.infrastructure.mapper.MixElectriqueMapper;
import org.springframework.stereotype.Service;
@Service
@Slf4j
@AllArgsConstructor
public class FusionFacteurCaracterisationService {
private MixElectriqueJpaAdapter mixElectriqueJpaAdapter;
private MixElectriqueRepository mixElectriqueRepository;
private MixElectriqueMapper mixElectriqueMapper;
private ImpactReseauJpaAdapter impactReseauJpaAdapter;
private ImpactReseauRepository impactReseauRepository;
private ImpactReseauMapper impactReseauMapper;
private ImpactEquipementJpaAdapter impactEquipementJpaAdapter;
private ImpactEquipementRepository impactEquipementRepository;
private ImpactEquipementMapper impactEquipementMapper;
@PostConstruct
public void init() throws ReferentielException {
log.info("démarrage de la fusion des tables vers ref_facteurcaracterisation");
var mixelecs = mixElectriqueRepository.findAll();
if (!mixelecs.isEmpty()) {
log.info("migration des mix électriques vers la nouvelle table");
mixElectriqueJpaAdapter.saveAll(mixElectriqueMapper.toDomains(mixelecs));
mixElectriqueRepository.deleteAll();
log.info("fin de la migration des mix électriques vers la nouvelle table");
}
var impactReseaux = impactReseauRepository.findAll();
if (!impactReseaux.isEmpty()) {
log.info("migration des impact réseaux vers la nouvelle table");
impactReseauJpaAdapter.saveAll(impactReseauMapper.toDomains(impactReseaux));
impactReseauRepository.deleteAll();
log.info("fin de la migration des impact réseaux vers la nouvelle table");
}
var impactEquipements = impactEquipementRepository.findAll();
if (!impactEquipements.isEmpty()) {
log.info("migration des impacts équipements vers la nouvelle table");
impactEquipementJpaAdapter.saveAll(impactEquipementMapper.toDomains(impactEquipements));
impactEquipementRepository.deleteAll();
log.info("fin de la migration des impacts équipements vers la nouvelle table");
}
}
}
package org.mte.numecoeval.referentiel.infrastructure.init;
import jakarta.annotation.PostConstruct;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.mte.numecoeval.referentiel.domain.exception.ReferentielException;
import org.mte.numecoeval.referentiel.infrastructure.jpa.adapter.TypeItemJpaAdapter;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.TypeEquipementEntity;
import org.mte.numecoeval.referentiel.infrastructure.jpa.repository.TypeEquipementRepository;
import org.mte.numecoeval.referentiel.infrastructure.mapper.TypeEquipementMapper;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@Slf4j
@AllArgsConstructor
public class MigrationToRefTypeItem {
private TypeEquipementRepository typeEquipementRepository;
private TypeEquipementMapper typeEquipementMapper;
private TypeItemJpaAdapter typeItemJpaAdapter;
@PostConstruct
public void init() throws ReferentielException {
log.info("démarrage de la migration de la table ref_type_equipement vers ref_type_item");
List<TypeEquipementEntity> typesEquipement = typeEquipementRepository.findAll();
if (!typesEquipement.isEmpty()) {
log.info("migration des référentiels de types d'équipements existants vers la nouvelle table");
typeItemJpaAdapter.saveAll(typeEquipementMapper.toTypesItem(typeEquipementMapper.toDomaines(typesEquipement)));
typeEquipementRepository.deleteAll();
log.info("fin de la migration de la table ref_type_equipement vers ref_type_item");
}
}
}
package org.mte.numecoeval.referentiel.infrastructure.jpa.entity;
import jakarta.persistence.*;
import lombok.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.id.ImpactEquipementIdEntity;
@Getter
@Setter
@Accessors(chain = true)
@FieldDefaults(level = AccessLevel.PRIVATE)
@Entity
@IdClass(ImpactEquipementIdEntity.class)
@Table(name = "REF_IMPACTEQUIPEMENT")
@EqualsAndHashCode
public class ImpactEquipementEntity implements AbstractReferentielEntity {
@Id
@Column(name = "REFEQUIPEMENT")
String refEquipement;
@Id
@Column(name = "ETAPEACV")
String etape;
@Id
@Column(name = "NOMCRITERE")
String critere;
String source;
String type;
Double valeur;
Double consoElecMoyenne;
String description;
}
package org.mte.numecoeval.referentiel.infrastructure.jpa.entity;
import jakarta.persistence.*;
import lombok.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.id.ImpactReseauIdEntity;
@Getter
@Setter
@Accessors(chain = true)
@FieldDefaults(level = AccessLevel.PRIVATE)
@Entity
@IdClass(ImpactReseauIdEntity.class)
@Table(name = "REF_IMPACTRESEAU")
@EqualsAndHashCode
public class ImpactReseauEntity implements AbstractReferentielEntity {
@Id
@Column(name = "REFRESEAU", nullable = false)
String refReseau;
@Id
@Column(name = "ETAPEACV", nullable = false)
String etape;
@Id
@Column(name = "NOMCRITERE", nullable = false)
String critere;
String source;
Double valeur;
@Column(name = "CONSOELECMOYENNE")
Double consoElecMoyenne;
}
package org.mte.numecoeval.referentiel.infrastructure.jpa.entity;
import jakarta.persistence.*;
import lombok.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.id.MixElectriqueIdEntity;
@Getter
@Setter
@Accessors(chain = true)
@FieldDefaults(level = AccessLevel.PRIVATE)
@Entity
@IdClass(MixElectriqueIdEntity.class)
@Table(name = "REF_MIXELEC")
@EqualsAndHashCode
public class MixElectriqueEntity implements AbstractReferentielEntity {
@Id
String pays;
@Id
@Column(name = "NOMCRITERE")
String critere;
@Column(name = "RACCOURCISANGLAIS")
String raccourcisAnglais;
String source;
Double valeur;
}
package org.mte.numecoeval.referentiel.infrastructure.jpa.entity;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
@Builder
@Getter
@Setter
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Entity(name = "REF_TYPE_EQUIPEMENT")
public class TypeEquipementEntity implements AbstractReferentielEntity {
@Id
String type;
boolean serveur;
String commentaire;
Double dureeVieDefaut;
String source;
// Référence de l'équipement par défaut, permet des correspondances en cas d'absence de correspondance direct.
String refEquipementParDefaut;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TypeEquipementEntity that = (TypeEquipementEntity) o;
return new EqualsBuilder().append(serveur, that.serveur).append(type, that.type).append(commentaire, that.commentaire).append(dureeVieDefaut, that.dureeVieDefaut).append(source, that.source).isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37).append(type).append(serveur).append(commentaire).append(dureeVieDefaut).append(source).toHashCode();
}
}
package org.mte.numecoeval.referentiel.infrastructure.jpa.entity.id;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
@Getter
@Setter
@Accessors(chain = true)
@FieldDefaults(level = AccessLevel.PRIVATE)
@NoArgsConstructor
public class ImpactEquipementIdEntity implements AbstractReferentieIdEntity {
String refEquipement;
String etape;
String critere;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ImpactEquipementIdEntity that = (ImpactEquipementIdEntity) o;
return new EqualsBuilder().append(refEquipement, that.refEquipement).append(etape, that.etape).append(critere, that.critere).isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37).append(refEquipement).append(etape).append(critere).toHashCode();
}
}
package org.mte.numecoeval.referentiel.infrastructure.jpa.entity.id;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
@Getter
@Setter
@Accessors(chain = true)
@FieldDefaults(level = AccessLevel.PRIVATE)
@NoArgsConstructor
public class ImpactReseauIdEntity implements AbstractReferentieIdEntity {
String refReseau;
String etape;
String critere;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ImpactReseauIdEntity that = (ImpactReseauIdEntity) o;
return new EqualsBuilder().append(refReseau, that.refReseau).append(etape, that.etape).append(critere, that.critere).isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37).append(refReseau).append(etape).append(critere).toHashCode();
}
}
package org.mte.numecoeval.referentiel.infrastructure.jpa.entity.id;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
@Getter
@Setter
@Accessors(chain = true)
@FieldDefaults(level = AccessLevel.PRIVATE)
@NoArgsConstructor
public class MixElectriqueIdEntity implements AbstractReferentieIdEntity {
String pays;
String critere;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MixElectriqueIdEntity that = (MixElectriqueIdEntity) o;
return new EqualsBuilder().append(pays, that.pays).append(critere, that.critere).isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37).append(pays).append(critere).toHashCode();
}
}
package org.mte.numecoeval.referentiel.infrastructure.jpa.repository;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.ImpactEquipementEntity;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.id.ImpactEquipementIdEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(path = "ImpactEquipement" , itemResourceRel = "ImpactEquipements")
@Tag(name = "ImpactEquipement - CRUD/Spring Data REST")
public interface ImpactEquipementRepository extends JpaRepository<ImpactEquipementEntity, ImpactEquipementIdEntity> {
}
package org.mte.numecoeval.referentiel.infrastructure.jpa.repository;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.ImpactReseauEntity;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.id.ImpactReseauIdEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(path = "ImpactReseau" , itemResourceRel = "ImpactReseaux")
@Tag(name = "ImpactReseau - CRUD/Spring Data REST")
public interface ImpactReseauRepository extends JpaRepository<ImpactReseauEntity, ImpactReseauIdEntity> {
}
package org.mte.numecoeval.referentiel.infrastructure.jpa.repository;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.MixElectriqueEntity;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.id.MixElectriqueIdEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(path = "MixElectrique" , itemResourceRel = "MixElectriques")
@Tag(name = "MixElectrique - CRUD/Spring Data REST")
public interface MixElectriqueRepository extends JpaRepository<MixElectriqueEntity, MixElectriqueIdEntity> {
}
package org.mte.numecoeval.referentiel.infrastructure.jpa.repository;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.TypeEquipementEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(path = "TypeEquipement" , itemResourceRel = "TypesEquipements")
@Tag(name = "TypeEquipement - CRUD/Spring Data REST")
public interface TypeEquipementRepository extends JpaRepository<TypeEquipementEntity,String> {
}
......@@ -5,28 +5,15 @@ import org.mapstruct.Mapping;
import org.mte.numecoeval.referentiel.domain.model.FacteurCaracterisation;
import org.mte.numecoeval.referentiel.domain.model.ImpactEquipement;
import org.mte.numecoeval.referentiel.domain.model.id.ImpactEquipementId;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.ImpactEquipementEntity;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.id.ImpactEquipementIdEntity;
import org.mte.numecoeval.referentiel.infrastructure.restapi.dto.ImpactEquipementDTO;
import org.mte.numecoeval.referentiel.infrastructure.restapi.dto.id.ImpactEquipementIdDTO;
import java.util.Collection;
import java.util.List;
@Mapper(componentModel = "spring")
public interface ImpactEquipementMapper {
ImpactEquipementId toDomainId(ImpactEquipementIdDTO id);
ImpactEquipementEntity toEntity(ImpactEquipement referentiel);
List<ImpactEquipementEntity> toEntities(Collection<ImpactEquipement> referentiel);
ImpactEquipementIdEntity toEntityId(ImpactEquipementId id);
ImpactEquipement toDomain(ImpactEquipementEntity entity);
List<ImpactEquipement> toDomains(List<ImpactEquipementEntity> entities);
ImpactEquipement toDomain(ImpactEquipementDTO dto);
List<ImpactEquipement> toDomainsFromDTO(List<ImpactEquipementDTO> iesDTO);
......
......@@ -5,37 +5,24 @@ import org.mapstruct.Mapping;
import org.mte.numecoeval.referentiel.domain.model.FacteurCaracterisation;
import org.mte.numecoeval.referentiel.domain.model.ImpactReseau;
import org.mte.numecoeval.referentiel.domain.model.id.ImpactReseauId;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.ImpactReseauEntity;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.id.ImpactReseauIdEntity;
import org.mte.numecoeval.referentiel.infrastructure.restapi.dto.ImpactReseauDTO;
import org.mte.numecoeval.referentiel.infrastructure.restapi.dto.id.ImpactReseauIdDTO;
import java.util.Collection;
import java.util.List;
@Mapper(componentModel = "spring")
public interface ImpactReseauMapper {
ImpactReseauEntity toEntity(ImpactReseau impactReseau);
@Mapping(source = "etape", target = "etapeACV")
ImpactReseauDTO toDTO(ImpactReseau impactReseau);
ImpactReseauIdEntity toEntityId(ImpactReseauId reseauId);
ImpactReseau toDomain(ImpactReseauEntity reseauEntity);
@Mapping(source = "etapeACV", target = "etape")
ImpactReseau toDomain(ImpactReseauDTO impactReseauDTO);
@Mapping(source = "etapeACV", target = "etape")
ImpactReseauId toDomainId(ImpactReseauIdDTO idImpactReseauDTO);
List<ImpactReseauEntity> toEntity(Collection<ImpactReseau> facteursImpacts);
List<ImpactReseau> toDomains(List<ImpactReseauEntity> entities);
List<ImpactReseau> toDomainsFromDTO(List<ImpactReseauDTO> dtos);
@Mapping(target = "nom", source = "refReseau")
......
......@@ -5,12 +5,9 @@ import org.mapstruct.Mapping;
import org.mte.numecoeval.referentiel.domain.model.FacteurCaracterisation;
import org.mte.numecoeval.referentiel.domain.model.MixElectrique;
import org.mte.numecoeval.referentiel.domain.model.id.MixElectriqueId;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.MixElectriqueEntity;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.id.MixElectriqueIdEntity;
import org.mte.numecoeval.referentiel.infrastructure.restapi.dto.MixElectriqueDTO;
import org.mte.numecoeval.referentiel.infrastructure.restapi.dto.id.MixElectriqueIdDTO;
import java.util.Collection;
import java.util.List;
@Mapper(componentModel = "spring")
......@@ -18,16 +15,6 @@ public interface MixElectriqueMapper {
MixElectriqueId toDomainId(MixElectriqueIdDTO id);
MixElectriqueEntity toEntity(MixElectrique mixElecs);
List<MixElectriqueEntity> toEntities(Collection<MixElectrique> mixElecs);
MixElectriqueIdEntity toEntityId(MixElectriqueId id);
MixElectrique toDomain(MixElectriqueEntity mixElec);
List<MixElectrique> toDomains(List<MixElectriqueEntity> mixElec);
List<MixElectrique> toDomainsFromDTO(List<MixElectriqueDTO> mixElecs);
MixElectriqueDTO toDTO(MixElectrique mixElectrique);
......
......@@ -4,25 +4,15 @@ import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mte.numecoeval.referentiel.domain.model.TypeEquipement;
import org.mte.numecoeval.referentiel.domain.model.TypeItem;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.TypeEquipementEntity;
import org.mte.numecoeval.referentiel.infrastructure.restapi.dto.TypeEquipementDTO;
import java.util.Collection;
import java.util.List;
@Mapper(componentModel = "spring")
public interface TypeEquipementMapper {
TypeEquipement toDomaine(TypeEquipementEntity typeEquipementEntity);
List<TypeEquipement> toDomaines(List<TypeEquipementEntity> typeEquipementEntities);
TypeEquipement toDomaine(TypeEquipementDTO typeEquipementDTO);
TypeEquipementEntity toEntity(TypeEquipement typeEquipement);
List<TypeEquipementEntity> toEntities(Collection<TypeEquipement> typeEquipements);
TypeEquipementDTO toDto(TypeEquipement typeEquipement);
@Mapping(target = "refItemParDefaut", source = "refEquipementParDefaut")
......
......@@ -22,17 +22,6 @@ CREATE TABLE IF NOT EXISTS ref_hypothese
CONSTRAINT ref_hypothese_pkey PRIMARY KEY (code)
);
CREATE TABLE IF NOT EXISTS ref_type_equipement
(
"type" varchar(255) NOT NULL,
commentaire varchar(255) NULL,
duree_vie_defaut float8 NULL,
serveur bool NOT NULL,
"source" varchar(255) NULL,
ref_equipement_par_defaut varchar(255) NULL,
CONSTRAINT ref_type_equipement_pkey PRIMARY KEY (type)
);
CREATE TABLE IF NOT EXISTS ref_type_item
(
"type" varchar(255) NOT NULL,
......@@ -61,40 +50,6 @@ CREATE TABLE IF NOT EXISTS ref_correspondance_ref_eqp
ref_equipement_cible varchar(255) NULL,
CONSTRAINT ref_correspondance_ref_eqp_pkey PRIMARY KEY (modele_equipement_source)
);
CREATE TABLE IF NOT EXISTS ref_impactequipement
(
refequipement varchar(255) NOT NULL,
conso_elec_moyenne float8 NULL,
"source" varchar(255) NULL,
"type" varchar(255) NULL,
valeur float8 NULL,
etapeacv varchar(255) NOT NULL,
nomcritere varchar(255) NOT NULL,
description varchar(255) NULL,
CONSTRAINT ref_impactequipement_pkey PRIMARY KEY (nomcritere, etapeacv, refequipement)
);
CREATE TABLE IF NOT EXISTS ref_impactreseau
(
refreseau varchar(255) NOT NULL,
consoelecmoyenne float8 NULL,
"source" varchar(255) NULL,
valeur float8 NULL,
etapeacv varchar(255) NOT NULL,
nomcritere varchar(255) NOT NULL,
CONSTRAINT ref_impactreseau_pkey PRIMARY KEY (nomcritere, etapeacv, refreseau)
);
CREATE TABLE IF NOT EXISTS ref_mixelec
(
pays varchar(255) NOT NULL,
raccourcisanglais varchar(255) NULL,
"source" varchar(255) NULL,
valeur float8 NULL,
nomcritere varchar(255) NOT NULL,
CONSTRAINT ref_mixelec_pkey PRIMARY KEY (nomcritere, pays)
);
CREATE TABLE IF NOT EXISTS ref_facteurcaracterisation
(
nom varchar(255) NOT NULL,
......@@ -112,9 +67,4 @@ CREATE TABLE IF NOT EXISTS ref_mixelec
CONSTRAINT ref_facteurcaracterisation_pkey PRIMARY KEY (nom, etapeacv, nomcritere)
);
-- suppression des contraintes de clés étrangères
ALTER TABLE ref_impactequipement DROP CONSTRAINT IF EXISTS fk5iuiwnk7rymtob1fku71uuj52;
ALTER TABLE ref_impactequipement DROP CONSTRAINT IF EXISTS fksfjum8kagn7q6vsv5uqn6kimx;
ALTER TABLE ref_impactreseau DROP CONSTRAINT IF EXISTS fk31ykp7xtj41win3ptqlr3us9s;
ALTER TABLE ref_impactreseau DROP CONSTRAINT IF EXISTS fkb8tkreu8c8s8pqqnft6vr4pnf;
ALTER TABLE ref_mixelec DROP CONSTRAINT IF EXISTS fkdncd4m2je6fbno7pkn850u1fs;
ALTER TABLE ref_impact_messagerie DROP CONSTRAINT IF EXISTS fkohnlpwfp0ebk7dswmfbe5l3k0;
......@@ -3,7 +3,9 @@ package org.mte.numecoeval.referentiel.factory;
import org.mte.numecoeval.referentiel.domain.model.*;
import org.mte.numecoeval.referentiel.domain.model.id.*;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.*;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.id.*;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.id.CritereIdEntity;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.id.EtapeIdEntity;
import org.mte.numecoeval.referentiel.infrastructure.jpa.entity.id.HypotheseIdEntity;
import org.mte.numecoeval.referentiel.infrastructure.restapi.dto.*;
import org.mte.numecoeval.referentiel.infrastructure.restapi.dto.id.*;
......@@ -141,9 +143,6 @@ public class TestDataFactory {
.build();
}
public static TypeEquipementEntity entity(String type, boolean estUnServeur, Double dureeVieDefaut, String commentaire, String source, String refEquipementParDefaut) {
return new TypeEquipementEntity(type, estUnServeur, commentaire, dureeVieDefaut, source, refEquipementParDefaut);
}
}
public static class TypeItemFactory {
......@@ -200,15 +199,6 @@ public class TestDataFactory {
.setSource(source);
}
public static MixElectriqueEntity entity(CritereEntity critere, String pays, String raccourcisAnglais, Double valeur, String source) {
return new MixElectriqueEntity()
.setCritere(critere.getNomCritere())
.setPays(pays)
.setRaccourcisAnglais(raccourcisAnglais)
.setValeur(valeur)
.setSource(source);
}
public static MixElectriqueIdDTO idDTO(CritereIdDTO critereId, String pays) {
return MixElectriqueIdDTO
.builder()
......@@ -222,12 +212,6 @@ public class TestDataFactory {
.setCritere(critereId.getNomCritere())
.setPays(pays);
}
public static MixElectriqueIdEntity idEntity(CritereIdEntity critereId, String pays) {
return new MixElectriqueIdEntity()
.setCritere(critereId.getNomCritere())
.setPays(pays);
}
}
public static class ImpactEquipementFactory {
......@@ -256,17 +240,6 @@ public class TestDataFactory {
.setConsoElecMoyenne(consoElecMoyenne);
}
public static ImpactEquipementEntity entity(EtapeEntity etape, CritereEntity critere, String refEquipement, String source, String type, Double valeur, Double consoElecMoyenne) {
return new ImpactEquipementEntity()
.setEtape(etape.getCode())
.setCritere(critere.getNomCritere())
.setRefEquipement(refEquipement)
.setSource(source)
.setType(type)
.setValeur(valeur)
.setConsoElecMoyenne(consoElecMoyenne);
}
public static ImpactEquipementIdDTO idDTO(String etapeIdDTO, String critereId, String refEquipement) {
return ImpactEquipementIdDTO
.builder()
......@@ -379,16 +352,6 @@ public class TestDataFactory {
.setConsoElecMoyenne(consoElecMoyenne);
}
public static ImpactReseauEntity entity(EtapeEntity etape, CritereEntity critere, String refReseau, String source, Double valeur, Double consoElecMoyenne) {
return new ImpactReseauEntity()
.setEtape(etape.getCode())
.setCritere(critere.getNomCritere())
.setRefReseau(refReseau)
.setSource(source)
.setValeur(valeur)
.setConsoElecMoyenne(consoElecMoyenne);
}
public static ImpactReseauIdDTO idDTO(EtapeIdDTO etapeIdDTO, CritereIdDTO critereId, String refReseau) {
return ImpactReseauIdDTO
.builder()
......@@ -404,13 +367,6 @@ public class TestDataFactory {
.setCritere(critereId.getNomCritere())
.setRefReseau(refReseau);
}
public static ImpactReseauIdEntity idEntity(EtapeIdEntity etapeIdEntity, CritereIdEntity critereId, String refReseau) {
return new ImpactReseauIdEntity()
.setEtape(etapeIdEntity.getCode())
.setCritere(critereId.getNomCritere())
.setRefReseau(refReseau);
}
}
public static class ImpactMessagerieFactory {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment