Commit 02794d8d authored by PECQUOT's avatar PECQUOT
Browse files

refactoring pass 3

git-svn-id: https://scmforge.ifremer.fr/authscm/lp1ee9d/svn/reefdb/trunk@1269 cd918a83-917d-4a2a-92d7-bc1d03929fc5
parent bca3a6dc
......@@ -24,20 +24,20 @@ package fr.ifremer.reefdb.dao.system.rule;
*/
import java.util.List;
import fr.ifremer.reefdb.dto.configuration.reglescontroles.ListeReglesDTO;
import fr.ifremer.reefdb.dto.configuration.control.RuleListDTO;
import fr.ifremer.reefdb.dto.system.FunctionDTO;
import java.util.List;
/**
*
* @author Ludovic
*/
public interface ReefDbRuleListDao {
List<ListeReglesDTO> getAllRuleList();
List<RuleListDTO> getAllRuleList();
ListeReglesDTO getRuleList(String ruleListCode);
RuleListDTO getRuleList(String ruleListCode);
List<FunctionDTO> getAllFunction();
}
......@@ -32,11 +32,14 @@ import fr.ifremer.quadrige2.core.dao.technical.Daos;
import fr.ifremer.reefdb.config.ReefDbConfiguration;
import fr.ifremer.reefdb.dao.referential.ReefDbReferentialDao;
import fr.ifremer.reefdb.dao.referential.pmfm.ReefDbPmfmDao;
import fr.ifremer.reefdb.dto.configuration.reglescontroles.*;
import fr.ifremer.reefdb.dto.ReefDbBeanFactory;
import fr.ifremer.reefdb.dto.configuration.control.ControlElementDTO;
import fr.ifremer.reefdb.dto.configuration.control.ControlRuleDTO;
import fr.ifremer.reefdb.dto.configuration.control.RuleListDTO;
import fr.ifremer.reefdb.dto.configuration.programStrategy.ProgramDTO;
import fr.ifremer.reefdb.dto.referential.DepartmentDTO;
import fr.ifremer.reefdb.dto.referential.DepartmentDTOs;
import fr.ifremer.reefdb.dto.system.ElementControlDTO;
import fr.ifremer.reefdb.dto.system.ElementControlDTOs;
import fr.ifremer.reefdb.dto.referential.pmfm.PmfmDTO;
import fr.ifremer.reefdb.dto.system.FunctionDTO;
import fr.ifremer.reefdb.dto.system.FunctionDTOs;
import org.apache.commons.lang3.StringUtils;
......@@ -100,32 +103,32 @@ public class ReefDbRuleListDaoImpl extends RuleListDaoImpl implements ReefDbRule
}
@Override
public List<ListeReglesDTO> getAllRuleList() {
public List<RuleListDTO> getAllRuleList() {
Iterator<Object[]> it = queryIterator("allRuleList");
List<ListeReglesDTO> result = Lists.newArrayList();
List<RuleListDTO> result = Lists.newArrayList();
while (it.hasNext()) {
Object[] source = it.next();
result.add(toRuleListDTO(Arrays.asList(source).iterator()));
}
for (ListeReglesDTO ruleList : result) {
for (RuleListDTO ruleList : result) {
// add programs
ruleList.setProgramme(getProgramsByRuleListCode(ruleList.getCode()));
ruleList.setProgram(getProgramsByRuleListCode(ruleList.getCode()));
// add services
ruleList.setDepartment(getControlledDepartmentsByRuleListCode(ruleList.getCode()));
// add rules
ruleList.setReglesControle(getRulesByRuleListCode(ruleList.getCode()));
ruleList.setControlRule(getRulesByRuleListCode(ruleList.getCode()));
}
return result;
}
@Override
public ListeReglesDTO getRuleList(String ruleListCode) {
public RuleListDTO getRuleList(String ruleListCode) {
Preconditions.checkArgument(StringUtils.isNotBlank(ruleListCode));
Object[] source = queryUnique("ruleListByCode", "ruleListCode", StringType.INSTANCE, ruleListCode);
......@@ -134,16 +137,16 @@ public class ReefDbRuleListDaoImpl extends RuleListDaoImpl implements ReefDbRule
throw new DataRetrievalFailureException("can't load rule list with code = " + ruleListCode);
}
ListeReglesDTO result = toRuleListDTO(Arrays.asList(source).iterator());
RuleListDTO result = toRuleListDTO(Arrays.asList(source).iterator());
// add programs
result.setProgramme(getProgramsByRuleListCode(result.getCode()));
result.setProgram(getProgramsByRuleListCode(result.getCode()));
// add services
result.setDepartment(getControlledDepartmentsByRuleListCode(result.getCode()));
// add rules
result.setReglesControle(getRulesByRuleListCode(result.getCode()));
result.setControlRule(getRulesByRuleListCode(result.getCode()));
return result;
}
......@@ -164,13 +167,13 @@ public class ReefDbRuleListDaoImpl extends RuleListDaoImpl implements ReefDbRule
return result;
}
protected List<ProgrammesControleDTO> getProgramsByRuleListCode(String ruleListCode) {
protected List<ProgramDTO> getProgramsByRuleListCode(String ruleListCode) {
Preconditions.checkArgument(StringUtils.isNotBlank(ruleListCode));
Iterator<Object[]> it = queryIterator("programByRuleListCode",
"ruleListCode", StringType.INSTANCE, ruleListCode);
List<ProgrammesControleDTO> result = Lists.newArrayList();
List<ProgramDTO> result = Lists.newArrayList();
while (it.hasNext()) {
Object[] source = it.next();
result.add(toProgramRuleDTO(Arrays.asList(source).iterator()));
......@@ -194,7 +197,7 @@ public class ReefDbRuleListDaoImpl extends RuleListDaoImpl implements ReefDbRule
return result;
}
protected List<ReglesControleDTO> getRulesByRuleListCode(String ruleListCode) {
protected List<ControlRuleDTO> getRulesByRuleListCode(String ruleListCode) {
Preconditions.checkArgument(StringUtils.isNotBlank(ruleListCode));
Iterator<Object[]> it = queryIterator("ruleByRuleListCode",
......@@ -205,28 +208,28 @@ public class ReefDbRuleListDaoImpl extends RuleListDaoImpl implements ReefDbRule
"functionIdIn", IntegerType.INSTANCE, functionIdIn,
"functionParameterIdIn", IntegerType.INSTANCE, functionParameterIdIn);
List<ReglesControleDTO> result = Lists.newArrayList();
List<ControlRuleDTO> result = Lists.newArrayList();
while (it.hasNext()) {
Object[] source = it.next();
result.add(toRuleDTO(Arrays.asList(source).iterator()));
}
for (ReglesControleDTO rule : result) {
for (ControlRuleDTO rule : result) {
// add pmfm list
rule.setPsfm(getRulePmfmByRuleCode(rule.getCode()));
rule.setPmfm(getRulePmfmByRuleCode(rule.getCode()));
}
return result;
}
protected List<PSFMControleDTO> getRulePmfmByRuleCode(String ruleCode) {
protected List<PmfmDTO> getRulePmfmByRuleCode(String ruleCode) {
Preconditions.checkNotNull(ruleCode);
Iterator<Object[]> it = queryIterator("rulePmfmByRuleCode",
"ruleCode", StringType.INSTANCE, ruleCode);
List<PSFMControleDTO> result = Lists.newArrayList();
List<PmfmDTO> result = Lists.newArrayList();
while (it.hasNext()) {
Object[] source = it.next();
result.add(toRulePmfmDTO(Arrays.asList(source).iterator()));
......@@ -236,12 +239,12 @@ public class ReefDbRuleListDaoImpl extends RuleListDaoImpl implements ReefDbRule
}
// INTERNAL METHODS
private ListeReglesDTO toRuleListDTO(Iterator<Object> source) {
ListeReglesDTO result = ListeReglesDTOs.newListeReglesDTO();
private RuleListDTO toRuleListDTO(Iterator<Object> source) {
RuleListDTO result = ReefDbBeanFactory.newRuleListDTO();
result.setCode((String) source.next());
result.setActif(Daos.convertToBoolean(source.next()));
result.setMoisDeDebutApplication(toMonth(Daos.convertToDate(source.next())));
result.setMoisDeFinApplication(toMonth(Daos.convertToDate(source.next())));
result.setActive(Daos.convertToBoolean(source.next()));
result.setStartMonth(toMonth(Daos.convertToDate(source.next())));
result.setEndMonth(toMonth(Daos.convertToDate(source.next())));
result.setDescription((String) source.next());
return result;
}
......@@ -253,11 +256,11 @@ public class ReefDbRuleListDaoImpl extends RuleListDaoImpl implements ReefDbRule
return String.format("%1$tB %1$tY", date);
}
private ProgrammesControleDTO toProgramRuleDTO(Iterator<Object> source) {
ProgrammesControleDTO result = ProgrammesControleDTOs.newProgrammesControleDTO();
private ProgramDTO toProgramRuleDTO(Iterator<Object> source) {
ProgramDTO result = ReefDbBeanFactory.newProgramDTO();
result.setCode((String) source.next());
result.setLibelle((String) source.next());
result.setDescription((String) source.next());
result.setName((String) source.next());
result.setComment((String) source.next());
return result;
}
......@@ -269,28 +272,28 @@ public class ReefDbRuleListDaoImpl extends RuleListDaoImpl implements ReefDbRule
return result;
}
private ReglesControleDTO toRuleDTO(Iterator<Object> source) {
ReglesControleDTO result = ReglesControleDTOs.newReglesControleDTO();
private ControlRuleDTO toRuleDTO(Iterator<Object> source) {
ControlRuleDTO result = ReefDbBeanFactory.newControlRuleDTO();
result.setCode((String) source.next());
// TODO : make it easier
ElementControlDTO elementControle = ElementControlDTOs.newElementControlDTO();
elementControle.setLibelle((String) source.next());
result.setElementControle(elementControle);
ControlElementDTO elementControle = ReefDbBeanFactory.newControlElementDTO();
elementControle.setName((String) source.next());
result.setControlElement(elementControle);
result.setDescription((String) source.next());
result.setActif(Daos.convertToBoolean(source.next()));
result.setBloquante(Daos.convertToBoolean(source.next()));
result.setMessageAffiche((String) source.next());
result.setActive(Daos.convertToBoolean(source.next()));
result.setBlocking(Daos.convertToBoolean(source.next()));
result.setMessage((String) source.next());
// function entity
Function function = (Function) source.next();
result.setFonction(toFunctionDTO(function));
result.setFunction(toFunctionDTO(function));
// function parameters
result.setMin(((String) source.next()));
result.setMax(((String) source.next()));
result.setValeursAutorisees((String) source.next());
result.setAllowedValues((String) source.next());
return result;
}
......@@ -302,8 +305,8 @@ public class ReefDbRuleListDaoImpl extends RuleListDaoImpl implements ReefDbRule
return result;
}
private PSFMControleDTO toRulePmfmDTO(Iterator<Object> source) {
PSFMControleDTO result = PSFMControleDTOs.newPSFMControleDTO();
private PmfmDTO toRulePmfmDTO(Iterator<Object> source) {
PmfmDTO result = ReefDbBeanFactory.newPmfmDTO();
result.setId((Integer) source.next());
String parameterCode = (String) source.next();
......@@ -312,20 +315,20 @@ public class ReefDbRuleListDaoImpl extends RuleListDaoImpl implements ReefDbRule
Integer methodId = (Integer) source.next();
// only parameter is mandatory
result.setParametre(pmfmDao.getParameterByCode(parameterCode));
result.setParameter(pmfmDao.getParameterByCode(parameterCode));
if (matrixId != null) {
result.setSupport(pmfmDao.getMatrixById(matrixId));
result.setMatrix(pmfmDao.getMatrixById(matrixId));
}
if (fractionId != null) {
result.setFraction(pmfmDao.getFractionById(fractionId));
}
if (methodId != null) {
result.setMethode(pmfmDao.getMethodById(methodId));
result.setMethod(pmfmDao.getMethodById(methodId));
}
// no Unit in the entity
result.setUnite(null);
result.setUnit(null);
return result;
}
......
......@@ -26,14 +26,17 @@ package fr.ifremer.reefdb.decorator;
import fr.ifremer.reefdb.dto.VirtualDTO;
import fr.ifremer.reefdb.dto.configuration.context.ContextDTO;
import fr.ifremer.reefdb.dto.configuration.context.FilterDTO;
import fr.ifremer.reefdb.dto.configuration.control.ControlElementDTO;
import fr.ifremer.reefdb.dto.configuration.control.ControlFeatureDTO;
import fr.ifremer.reefdb.dto.configuration.control.RuleListDTO;
import fr.ifremer.reefdb.dto.configuration.programStrategy.ProgramDTO;
import fr.ifremer.reefdb.dto.configuration.reglescontroles.ListeReglesDTO;
import fr.ifremer.reefdb.dto.observation.CampaignDTO;
import fr.ifremer.reefdb.dto.observation.OccasionDTO;
import fr.ifremer.reefdb.dto.photo.PrelevementPhotoDTO;
import fr.ifremer.reefdb.dto.prelevement.PrelevementDetailDTO;
import fr.ifremer.reefdb.dto.referential.*;
import fr.ifremer.reefdb.dto.referential.pmfm.*;
import fr.ifremer.reefdb.dto.referential.pmfm.ParameterDTO;
import fr.ifremer.reefdb.dto.referential.pmfm.PmfmDTO;
import fr.ifremer.reefdb.dto.system.*;
import fr.ifremer.reefdb.util.HeureUtil;
import org.nuiton.decorator.Decorator;
......@@ -86,7 +89,7 @@ public class DecoratorServiceImpl implements DecoratorService {
// configuration
registerReefDbDecorator(ContextDTO.class, "${name}$s", TOKEN_SEPARATOR, SEPARATOR);
registerReefDbDecorator(FilterDTO.class, "${name}$s", TOKEN_SEPARATOR, SEPARATOR);
registerReefDbDecorator(ListeReglesDTO.class, "${code}$s", TOKEN_SEPARATOR, SEPARATOR);
registerReefDbDecorator(RuleListDTO.class, "${code}$s", TOKEN_SEPARATOR, SEPARATOR);
registerReefDbDecorator(ProgramDTO.class, "${code}$s#${name}$s", TOKEN_SEPARATOR, SEPARATOR);
registerReefDbDecorator(ProgramDTO.class, ONLY_NAME, "${name}$s", TOKEN_SEPARATOR, SEPARATOR);
registerReefDbDecorator(ProgramDTO.class, CODE, "${code}$s", TOKEN_SEPARATOR, SEPARATOR);
......@@ -104,8 +107,8 @@ public class DecoratorServiceImpl implements DecoratorService {
registerReefDbDecorator(CoordinateDTO.class, LONGITUDE_MAX, "${maxLongitude}$s", TOKEN_SEPARATOR, SEPARATOR);
registerReefDbDecorator(CoordinateDTO.class, LATITUDE_MIN, "${minLatitude}$s", TOKEN_SEPARATOR, SEPARATOR);
registerReefDbDecorator(CoordinateDTO.class, LONGITUDE_MIN, "${minLongitude}$s", TOKEN_SEPARATOR, SEPARATOR);
registerReefDbDecorator(ElementControlDTO.class, "${libelle}$s", TOKEN_SEPARATOR, SEPARATOR);
registerReefDbDecorator(FeatureControlDTO.class, "${libelle}$s", TOKEN_SEPARATOR, SEPARATOR);
registerReefDbDecorator(ControlElementDTO.class, "${name}$s", TOKEN_SEPARATOR, SEPARATOR);
registerReefDbDecorator(ControlFeatureDTO.class, "${name}$s", TOKEN_SEPARATOR, SEPARATOR);
registerReefDbDecorator(ParameterTypeDTO.class, "${label}$s", TOKEN_SEPARATOR, SEPARATOR);
registerReefDbDecorator(EtatDTO.class, "${libelle}$s", TOKEN_SEPARATOR, SEPARATOR);
registerReefDbDecorator(FunctionDTO.class, "${libelle}$s", TOKEN_SEPARATOR, SEPARATOR);
......
......@@ -23,9 +23,8 @@ package fr.ifremer.reefdb.dto;
* #L%
*/
import fr.ifremer.reefdb.dto.configuration.programStrategy.ProgramDTO;
import fr.ifremer.reefdb.dto.configuration.reglescontroles.ListeReglesDTO;
import fr.ifremer.reefdb.dto.configuration.reglescontroles.ProgrammesControleDTO;
import fr.ifremer.reefdb.dto.configuration.reglescontroles.ReglesControleDTO;
import fr.ifremer.reefdb.dto.configuration.control.RuleListDTO;
import fr.ifremer.reefdb.dto.configuration.control.ControlRuleDTO;
import fr.ifremer.reefdb.dto.referential.StatusDTO;
import fr.ifremer.reefdb.dto.referential.pmfm.ParameterDTO;
import org.apache.commons.lang3.ObjectUtils;
......@@ -68,14 +67,11 @@ public abstract class ReefDbAbstractBean extends AbstractBean implements ReefDbB
else if (this instanceof ParameterDTO) {
return Objects.hashCode(((ParameterDTO) this).getCode());
}
else if (this instanceof ProgrammesControleDTO) {
return Objects.hashCode(((ProgrammesControleDTO) this).getCode());
else if (this instanceof RuleListDTO) {
return Objects.hashCode(((RuleListDTO) this).getCode());
}
else if (this instanceof ListeReglesDTO) {
return Objects.hashCode(((ListeReglesDTO) this).getCode());
}
else if (this instanceof ReglesControleDTO) {
return Objects.hashCode(((ReglesControleDTO) this).getCode());
else if (this instanceof ControlRuleDTO) {
return Objects.hashCode(((ControlRuleDTO) this).getCode());
}
else if (this instanceof StatusDTO) {
return Objects.hashCode(((StatusDTO) this).getCode());
......
......@@ -26,16 +26,16 @@ package fr.ifremer.reefdb.service.mock;
import fr.ifremer.quadrige2.core.dao.referential.StatusCode;
import fr.ifremer.reefdb.dao.Daos;
import fr.ifremer.reefdb.dto.ReefDbBeanFactory;
import fr.ifremer.reefdb.dto.configuration.control.ControlRuleDTO;
import fr.ifremer.reefdb.dto.configuration.control.RuleListDTO;
import fr.ifremer.reefdb.dto.configuration.programStrategy.ProgramDTO;
import fr.ifremer.reefdb.dto.configuration.reglescontroles.ListeReglesDTO;
import fr.ifremer.reefdb.dto.configuration.reglescontroles.PSFMControleDTO;
import fr.ifremer.reefdb.dto.configuration.reglescontroles.ProgrammesControleDTO;
import fr.ifremer.reefdb.dto.configuration.reglescontroles.ReglesControleDTO;
import fr.ifremer.reefdb.dto.referential.AnalysisInstrumentDTO;
import fr.ifremer.reefdb.dto.referential.DepartmentDTO;
import fr.ifremer.reefdb.dto.referential.GroupingDTO;
import fr.ifremer.reefdb.dto.referential.LocationDTO;
import fr.ifremer.reefdb.dto.referential.pmfm.PmfmDTO;
import fr.ifremer.reefdb.service.ReefDbServiceLocator;
import fr.ifremer.reefdb.service.StatusFilter;
import fr.ifremer.reefdb.service.referential.ReferentialService;
import fr.ifremer.reefdb.service.system.SystemeService;
......@@ -70,7 +70,7 @@ public class GestionMock {
/**
* La liste de liste de regles
*/
private List<ListeReglesDTO> listeRegles;
private List<RuleListDTO> listeRegles;
/**
* La liste de liste des referentiels lieu local
......@@ -228,7 +228,7 @@ public class GestionMock {
// Instance des objets
// setObservations(new ArrayList<ObservationEntity>());
// setGroupeTaxons(new ArrayList<TaxonGroupDTO>());
setListeRegles(new ArrayList<ListeReglesDTO>());
setListeRegles(new ArrayList<RuleListDTO>());
// setProgrammesStrategies(new ArrayList<ProgramDTO>());
// setDepartements(new ArrayList<DepartmentDTO>());
setLieux(new ArrayList<LocationDTO>());
......@@ -304,10 +304,10 @@ public class GestionMock {
// getAnalysisInstruments().add(createAnalysisInstruments(3));
// getAnalysisInstruments().add(createAnalysisInstruments(4));
// getGroupingList().add(createGrouping(0));
// getGroupingList().add(createGrouping(1));
// getGroupingList().add(createGrouping(2));
// getGroupingList().add(createGrouping(3));
getGroupingList().add(createGrouping(0));
getGroupingList().add(createGrouping(1));
getGroupingList().add(createGrouping(2));
getGroupingList().add(createGrouping(3));
creerLieuxFiltre();
// creerDepartementDetailFiltre();
......@@ -820,64 +820,64 @@ public class GestionMock {
* @param indice
* @return
*/
private ListeReglesDTO creerListeRegles(final int indice) {
private RuleListDTO creerListeRegles(final int indice) {
final ListeReglesDTO listeDesRegles = ReefDbBeanFactory.newListeReglesDTO();
final RuleListDTO listeDesRegles = ReefDbBeanFactory.newRuleListDTO();
listeDesRegles.setId(indice);
//listeDesRegles.setActif((indice % 2) == 0 ? true : false);
listeDesRegles.setActif(true);
listeDesRegles.setActive(true);
switch (indice) {
case 1:
listeDesRegles.setCode("Contrôle Belt Poisson");
listeDesRegles.setDescription("Controle divers sur les poissons");
listeDesRegles.setMoisDeDebutApplication("Janvier");
listeDesRegles.setMoisDeFinApplication("Avril");
listeDesRegles.addProgramme(creerProgrammesControle(indice, listeDesRegles));
listeDesRegles.setStartMonth("Janvier");
listeDesRegles.setEndMonth("Avril");
listeDesRegles.addProgram(creerProgrammesControle(indice, listeDesRegles));
listeDesRegles.addDepartment(getDepartements().get(indice - 1));
listeDesRegles.addAllReglesControle(creerReglesControle(indice, listeDesRegles));
listeDesRegles.addAllControlRule(creerReglesControle(indice, listeDesRegles));
break;
case 2:
listeDesRegles.setCode("Contrôle Lit Poisson");
listeDesRegles.setDescription("Controle divers sur les algues");
listeDesRegles.setMoisDeDebutApplication("Septembre");
listeDesRegles.setMoisDeFinApplication("Novembre");
listeDesRegles.addProgramme(creerProgrammesControle(indice, listeDesRegles));
listeDesRegles.setStartMonth("Septembre");
listeDesRegles.setEndMonth("Novembre");
listeDesRegles.addProgram(creerProgrammesControle(indice, listeDesRegles));
listeDesRegles.addDepartment(getDepartements().get(indice - 1));
listeDesRegles.addAllReglesControle(creerReglesControle(indice, listeDesRegles));
listeDesRegles.addAllControlRule(creerReglesControle(indice, listeDesRegles));
break;
default:
listeDesRegles.setCode("Contrôle générique");
listeDesRegles.setDescription("Contrôle générique, aucune description particulière");
listeDesRegles.setMoisDeDebutApplication("Janvier");
listeDesRegles.setMoisDeFinApplication("Decembre");
listeDesRegles.addProgramme(creerProgrammesControle(indice, listeDesRegles));
listeDesRegles.setStartMonth("Janvier");
listeDesRegles.setEndMonth("Decembre");
listeDesRegles.addProgram(creerProgrammesControle(indice, listeDesRegles));
listeDesRegles.addDepartment(getDepartements().get(0));
listeDesRegles.addAllReglesControle(creerReglesControle(indice, listeDesRegles));
listeDesRegles.addAllControlRule(creerReglesControle(indice, listeDesRegles));
break;
}
return listeDesRegles;
}
private ProgrammesControleDTO creerProgrammesControle(final int indice, final ListeReglesDTO listeRegle) {
private ProgramDTO creerProgrammesControle(final int indice, final RuleListDTO listeRegle) {
final ProgrammesControleDTO programmeControle = ReefDbBeanFactory.newProgrammesControleDTO();
final ProgramDTO programmeControle = ReefDbBeanFactory.newProgramDTO();
switch (indice) {
case 1:
programmeControle.setCode(getProgrammes().get(0).getCode());
programmeControle.setLibelle("Global Reef Monitoring");
programmeControle.setDescription("Suivi des poissons conchylicoles");
programmeControle.setName("Global Reef Monitoring");
programmeControle.setComment("Suivi des poissons conchylicoles");
break;
case 2:
programmeControle.setCode(getProgrammes().get(1).getCode());
programmeControle.setLibelle("Global Sand Monitoring");
programmeControle.setDescription("Suivi des poissons sabulicoles");
programmeControle.setName("Global Sand Monitoring");
programmeControle.setComment("Suivi des poissons sabulicoles");
break;
default:
programmeControle.setCode(getProgrammes().get(2).getCode());
programmeControle.setLibelle("Global Rock Monitoring");
programmeControle.setDescription("Suivi des poissons petricoles");
programmeControle.setName("Global Rock Monitoring");
programmeControle.setComment("Suivi des poissons petricoles");
break;
}
return programmeControle;
......@@ -886,22 +886,22 @@ public class GestionMock {
/**
*
*/
private List<ReglesControleDTO> creerReglesControle(final int indice, final ListeReglesDTO listeRegle) {
private List<ControlRuleDTO> creerReglesControle(final int indice, final RuleListDTO listeRegle) {
final List<ReglesControleDTO> reglesControles = new ArrayList<ReglesControleDTO>();
final List<ControlRuleDTO> reglesControles = new ArrayList<ControlRuleDTO>();
for (int a = 0; a < indice; a++) {
ReglesControleDTO reglesControle = ReefDbBeanFactory.newReglesControleDTO();
ControlRuleDTO reglesControle = ReefDbBeanFactory.newControlRuleDTO();
reglesControle.setId(indice);
reglesControle.setCode(listeRegle.getCode() + "_" + String.valueOf(a));
// reglesControle.setActif((a % 2) == 0 ? true : false);
reglesControle.setBloquante((a % 2) == 0 ? false : true);
reglesControle.setActif(true);
reglesControle.setBlocking((a % 2) == 0 ? false : true);
reglesControle.setActive(true);
// reglesControle.setBloquante(true);
reglesControle.setPsfm(creerPSFMControle(a));
reglesControle.setPmfm(creerPSFMControle(a));
// reglesControle.setDescription("Ceci est une règle de contrôle bloquante");
reglesControle.setDescription("Ceci est une règle de contrôle " +
(reglesControle.isBloquante() == true ? "Bloquante" : "Non Bloquante"));
(reglesControle.isBlocking() == true ? "Bloquante" : "Non Bloquante"));
switch (a) {
......@@ -916,16 +916,16 @@ public class GestionMock {
// reglesControle.setMessageAffiche("La valeur doit être composée exclusivement des caractères suivants : "
// + reglesControle.getValeursAutorisees());
// break;
reglesControle.setFonction(getServiceSystem().getFunctionsControlSystem().get(4));
reglesControle.setElementControle(getServiceSystem().getElementsControlSystem().get(3));
reglesControle.setCaracteristiqueControle(
getServiceSystem().getFeatureControlSystem(reglesControle.getElementControle()).get(18));
reglesControle.setFunction(getServiceSystem().getFunctionsControlSystem().get(4));
reglesControle.setControlElement(getServiceSystem().getElementsControlSystem().get(3));
reglesControle.setControlFeature(
getServiceSystem().getFeatureControlSystem(reglesControle.getControlElement()).get(18));
reglesControle.setMin(null);
reglesControle.setMax(null);
reglesControle.setValeursAutorisees(null);
reglesControle.setMessageAffiche("Anomalie sur "
+ getServiceSystem().getFeatureControlSystem(reglesControle.getElementControle()).get(18).getLibelle()
+ ": La valeur doit être non vide");
reglesControle.setAllowedValues(null);
reglesControle.setMessage("Anomalie sur "
+ getServiceSystem().getFeatureControlSystem(reglesControle.getControlElement()).get(18).getName()
+ ": La valeur doit être non vide");
break;
case 1:
// reglesControle.setFonction(getServiceSystem().getFunctionsControlSystem().get(2));
......@@ -939,31 +939,31 @@ public class GestionMock {
// + String.valueOf(reglesControle.getMin())
// + " et " + String.valueOf(reglesControle.getMax()));
// break;
reglesControle.setFonction(getServiceSystem().getFunctionsControlSystem().get(2));
reglesControle.setElementControle(getServiceSystem().getElementsControlSystem().get(3));
reglesControle.setCaracteristiqueControle(
getServiceSystem().getFeatureControlSystem(reglesControle.getElementControle()).get(21));
reglesControle.setFunction(getServiceSystem().getFunctionsControlSystem().get(2));
reglesControle.setControlElement(getServiceSystem().getElementsControlSystem().get(3));
reglesControle.setControlFeature(
getServiceSystem().getFeatureControlSystem(reglesControle.getControlElement()).get(21));
reglesControle.setMin("2");
reglesControle.setMax("10");
reglesControle.setValeursAutorisees(null);
reglesControle.setMessageAffiche("Anomalie sur "
+ getServiceSystem().getFeatureControlSystem(reglesControle.getElementControle()).get(21).getLibelle()
+ ": La valeur doit être comprise entre "
+ String.valueOf(reglesControle.getMin())
+ " et " + String.valueOf(reglesControle.getMax()));
reglesControle.setAllowedValues(null);
reglesControle.setMessage("Anomalie sur "
+ getServiceSystem().getFeatureControlSystem(reglesControle.getControlElement()).get(21).getName()