From fd5f5845f1c883fd27210be2436e7b77c672d3fe Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Fri, 18 Mar 2022 15:05:00 +0100 Subject: [PATCH 01/41] Supprime CheckerTarget comme passe-plat --- .../inra/oresing/checker/CheckerFactory.java | 20 ++--- ...ckerOnOneVariableComponentLineChecker.java | 8 +- .../inra/oresing/checker/CheckerTarget.java | 85 ++----------------- .../inra/oresing/checker/DateLineChecker.java | 2 +- .../fr/inra/oresing/checker/FloatChecker.java | 2 +- .../inra/oresing/checker/IntegerChecker.java | 10 ++- .../oresing/checker/ReferenceLineChecker.java | 3 +- .../checker/RegularExpressionChecker.java | 2 +- .../inra/oresing/model/ReferenceColumn.java | 13 ++- .../oresing/model/VariableComponentKey.java | 13 ++- .../oresing/rest/DownloadDatasetQuery.java | 3 +- .../fr/inra/oresing/rest/OreSiService.java | 20 ++--- .../inra/oresing/rest/ReferenceImporter.java | 4 +- .../inra/oresing/rest/RelationalService.java | 8 +- .../TransformOneLineElementTransformer.java | 4 +- .../oresing/checker/CheckerTargetTest.java | 8 +- .../oresing/checker/DateLineCheckerTest.java | 2 +- 17 files changed, 80 insertions(+), 127 deletions(-) diff --git a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java index 1084dfb51..33c642473 100644 --- a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java +++ b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java @@ -9,7 +9,6 @@ import fr.inra.oresing.model.Application; import fr.inra.oresing.model.Configuration; import fr.inra.oresing.model.ReferenceColumn; import fr.inra.oresing.model.VariableComponentKey; -import fr.inra.oresing.model.internationalization.InternationalizationDisplay; import fr.inra.oresing.persistence.DataRepository; import fr.inra.oresing.persistence.Ltree; import fr.inra.oresing.persistence.OreSiRepository; @@ -54,7 +53,7 @@ public class CheckerFactory { return getLineCheckers(app, dataType).stream() .filter(lineChecker -> lineChecker instanceof ReferenceLineChecker) .map(lineChecker -> (ReferenceLineChecker) lineChecker) - .collect(ImmutableMap.toImmutableMap(rlc -> (VariableComponentKey) rlc.getTarget().getTarget(), Function.identity())); + .collect(ImmutableMap.toImmutableMap(rlc -> (VariableComponentKey) rlc.getTarget(), Function.identity())); } public ImmutableSet<LineChecker> getReferenceValidationLineCheckers(Application app, String reference) { @@ -102,31 +101,30 @@ public class CheckerFactory { } else { Configuration.CheckerDescription checkerDescription = variableDescription.getComponents().get(component).getChecker(); CheckerOnOneVariableComponentLineChecker variableComponentChecker; - CheckerTarget checkerTarget = CheckerTarget.getInstance(variableComponentKey, app, repository.getRepository(app)); LineTransformer transformer = Optional.ofNullable(checkerDescription.getParams()) - .map(transformationConfiguration -> transformerFactory.newTransformer(transformationConfiguration, app, checkerTarget)) + .map(transformationConfiguration -> transformerFactory.newTransformer(transformationConfiguration, app, variableComponentKey)) .orElseGet(transformerFactory::getNullTransformer); if ("Reference".equals(checkerDescription.getName())) { - variableComponentChecker = getCheckerOnReferenceChecker(app, dataType, locale, checkerDescription, checkerTarget, transformer); + variableComponentChecker = getCheckerOnReferenceChecker(app, dataType, locale, checkerDescription, variableComponentKey, transformer); } else { final Configuration.CheckerConfigurationDescription configuration = checkerDescription.getParams(); if ("Date".equals(checkerDescription.getName())) { String pattern = configuration.getPattern(); - variableComponentChecker = new DateLineChecker(checkerTarget, pattern, configuration, transformer); + variableComponentChecker = new DateLineChecker(variableComponentKey, pattern, configuration, transformer); } else if ("Integer".equals(checkerDescription.getName())) { Preconditions.checkState(configuration == null || !configuration.isCodify(), "codify avec checker " + checkerDescription.getName() + " sur le composant " + component + " de la variable " + variable + " du type de données " + dataType + " de l'application " + app.getName()); - variableComponentChecker = new IntegerChecker(checkerTarget, configuration, transformer); + variableComponentChecker = new IntegerChecker(variableComponentKey, configuration, transformer); } else if ("Float".equals(checkerDescription.getName())) { Preconditions.checkState(configuration == null || !configuration.isCodify(), "codify avec checker " + checkerDescription.getName() + " sur le composant " + component + " de la variable " + variable + " du type de données " + dataType + " de l'application " + app.getName()); - variableComponentChecker = new FloatChecker(checkerTarget, configuration, transformer); + variableComponentChecker = new FloatChecker(variableComponentKey, configuration, transformer); } else if ("RegularExpression".equals(checkerDescription.getName())) { String pattern = configuration.getPattern(); - variableComponentChecker = new RegularExpressionChecker(checkerTarget, pattern, configuration, transformer); + variableComponentChecker = new RegularExpressionChecker(variableComponentKey, pattern, configuration, transformer); } else { throw new IllegalArgumentException("checker inconnu " + checkerDescription.getName()); } } - Preconditions.checkState(variableComponentChecker.getTarget().getTarget().equals(variableComponentKey)); + Preconditions.checkState(variableComponentChecker.getTarget().equals(variableComponentKey)); checkersBuilder.add(variableComponentChecker); } } @@ -215,12 +213,10 @@ public class CheckerFactory { if (!Strings.isNullOrEmpty(columnsString)) { return Stream.of(columnsString.split(",")) .map(ReferenceColumn::new) - .map(referenceColumn -> CheckerTarget.getInstance(referenceColumn, application, repository.getRepository(application))) .collect(Collectors.toList()); } else if (!Strings.isNullOrEmpty(variableComponentKeyParam) || !variableComponentKeyParam.matches("_")) { String[] split = variableComponentKeyParam.split("_"); Stream.of(new VariableComponentKey(split[0], split[1])) - .map(variableComponentKey -> CheckerTarget.getInstance(variableComponentKey, application, repository.getRepository(application))) .collect(Collectors.toList()); } diff --git a/src/main/java/fr/inra/oresing/checker/CheckerOnOneVariableComponentLineChecker.java b/src/main/java/fr/inra/oresing/checker/CheckerOnOneVariableComponentLineChecker.java index 893df7e61..e4445fa66 100644 --- a/src/main/java/fr/inra/oresing/checker/CheckerOnOneVariableComponentLineChecker.java +++ b/src/main/java/fr/inra/oresing/checker/CheckerOnOneVariableComponentLineChecker.java @@ -23,13 +23,13 @@ public interface CheckerOnOneVariableComponentLineChecker<C extends LineCheckerC default ValidationCheckResult check(Datum datum) { Datum transformedDatum = getTransformer().transform(datum); - VariableComponentKey variableComponentKey = (VariableComponentKey) getTarget().getTarget(); + VariableComponentKey variableComponentKey = (VariableComponentKey) getTarget(); String value = transformedDatum.get(variableComponentKey); ValidationCheckResult validationCheckResult; if (Strings.isNullOrEmpty(value)) { if (getConfiguration().isRequired()) { CheckerTarget target = getTarget(); - validationCheckResult = DefaultValidationCheckResult.error(target.getInternationalizedKey("requiredValue"), ImmutableMap.of("target", target.getTarget())); + validationCheckResult = DefaultValidationCheckResult.error(target.getInternationalizedKey("requiredValue"), ImmutableMap.of("target", target)); } else { validationCheckResult = DefaultValidationCheckResult.success(); } @@ -42,7 +42,7 @@ public interface CheckerOnOneVariableComponentLineChecker<C extends LineCheckerC @Override default Set<ValidationCheckResult> checkReference(ReferenceDatum referenceDatum) { ReferenceDatum transformedReferenceDatum = getTransformer().transform(referenceDatum); - final ReferenceColumn column = (ReferenceColumn) getTarget().getTarget(); + final ReferenceColumn column = (ReferenceColumn) getTarget(); final Collection<String> valuesToCheck = transformedReferenceDatum.getValuesToCheck(column); final Set<ValidationCheckResult> validationCheckResults = valuesToCheck.stream() .map(this::checkRequiredThenCheck) @@ -55,7 +55,7 @@ public interface CheckerOnOneVariableComponentLineChecker<C extends LineCheckerC if (Strings.isNullOrEmpty(value)) { if (getConfiguration().isRequired()) { CheckerTarget target = getTarget(); - validationCheckResult = DefaultValidationCheckResult.error(target.getInternationalizedKey("requiredValue"), ImmutableMap.of("target", target.getTarget())); + validationCheckResult = DefaultValidationCheckResult.error(target.getInternationalizedKey("requiredValue"), ImmutableMap.of("target", target)); } else { validationCheckResult = DefaultValidationCheckResult.success(); } diff --git a/src/main/java/fr/inra/oresing/checker/CheckerTarget.java b/src/main/java/fr/inra/oresing/checker/CheckerTarget.java index 7950d40c0..ab75c9827 100644 --- a/src/main/java/fr/inra/oresing/checker/CheckerTarget.java +++ b/src/main/java/fr/inra/oresing/checker/CheckerTarget.java @@ -1,47 +1,16 @@ package fr.inra.oresing.checker; -import com.fasterxml.jackson.annotation.JsonIgnore; -import fr.inra.oresing.model.Application; -import fr.inra.oresing.model.ReferenceColumn; -import fr.inra.oresing.model.VariableComponentKey; -import fr.inra.oresing.persistence.OreSiRepository; -import lombok.Getter; -import lombok.Setter; +public interface CheckerTarget { -import java.util.Objects; + String getInternationalizedKey(String key); -@Getter -@Setter -abstract public class CheckerTarget<T>{ - private T target; - @JsonIgnore - private Application application; - @JsonIgnore - private OreSiRepository.RepositoryForApplication repository; - private CheckerTargetType type; + /** + * @deprecated utilisé dans le front? On devrait plutôt utilisé l'héritage. + */ + @Deprecated + CheckerTargetType getType(); - public static CheckerTarget getInstance(VariableComponentKey target, Application application, OreSiRepository.RepositoryForApplication repository){ - CheckerTarget checkerTarget = new VariableComponentKeyCheckerTarget(target); - checkerTarget.application = application; - checkerTarget.repository = repository; - return checkerTarget; - } - - public static CheckerTarget getInstance(ReferenceColumn target, Application application, OreSiRepository.RepositoryForApplication repository){ - CheckerTarget checkerTarget = new ColumnCheckerTarget(target); - checkerTarget.application = application; - checkerTarget.repository = repository; - return checkerTarget; - } - - public abstract String getInternationalizedKey(String key); - - public CheckerTarget(CheckerTargetType type, T target) { - this.type = type; - this.target = target; - } - - public enum CheckerTargetType{ + enum CheckerTargetType { PARAM_VARIABLE_COMPONENT_KEY("variableComponentKey"),PARAM_COLUMN("column"); private final String type; @@ -50,7 +19,7 @@ abstract public class CheckerTarget<T>{ this.type = type; } - String getType(){ + String getType() { return this.type; } @@ -59,40 +28,4 @@ abstract public class CheckerTarget<T>{ return type; } } - - public static class ColumnCheckerTarget extends CheckerTarget<ReferenceColumn> { - - private ColumnCheckerTarget(ReferenceColumn column) { - super(CheckerTargetType.PARAM_COLUMN, column); - } - - @Override - public String getInternationalizedKey(String key){ - return key+"WithColumn"; - } - } - public static class VariableComponentKeyCheckerTarget extends CheckerTarget<VariableComponentKey> { - - private VariableComponentKeyCheckerTarget(VariableComponentKey variableComponentKey) { - super(CheckerTargetType.PARAM_VARIABLE_COMPONENT_KEY, variableComponentKey); - } - - @Override - public String getInternationalizedKey(String key){ - return key; - } - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - CheckerTarget<?> that = (CheckerTarget<?>) o; - return Objects.equals(target, that.target) && type == that.type; - } - - @Override - public int hashCode() { - return Objects.hash(target, type); - } } diff --git a/src/main/java/fr/inra/oresing/checker/DateLineChecker.java b/src/main/java/fr/inra/oresing/checker/DateLineChecker.java index c2565d47f..6dc47d1da 100644 --- a/src/main/java/fr/inra/oresing/checker/DateLineChecker.java +++ b/src/main/java/fr/inra/oresing/checker/DateLineChecker.java @@ -53,7 +53,7 @@ public class DateLineChecker implements CheckerOnOneVariableComponentLineChecker validationCheckResult = DateValidationCheckResult.error( target, getTarget().getInternationalizedKey("invalidDate"), ImmutableMap.of( - "target", target.getTarget(), + "target", target, "pattern", pattern, "value", value)); } diff --git a/src/main/java/fr/inra/oresing/checker/FloatChecker.java b/src/main/java/fr/inra/oresing/checker/FloatChecker.java index 7038e6b8b..93757d83a 100644 --- a/src/main/java/fr/inra/oresing/checker/FloatChecker.java +++ b/src/main/java/fr/inra/oresing/checker/FloatChecker.java @@ -33,7 +33,7 @@ public class FloatChecker implements CheckerOnOneVariableComponentLineChecker<Fl } catch (NumberFormatException e) { validationCheckResult = DefaultValidationCheckResult.error( getTarget().getInternationalizedKey("invalidFloat"), ImmutableMap.of( - "target", target.getTarget(), + "target", target, "value", value)); } return validationCheckResult; diff --git a/src/main/java/fr/inra/oresing/checker/IntegerChecker.java b/src/main/java/fr/inra/oresing/checker/IntegerChecker.java index d5693c1ef..44a4c33ed 100644 --- a/src/main/java/fr/inra/oresing/checker/IntegerChecker.java +++ b/src/main/java/fr/inra/oresing/checker/IntegerChecker.java @@ -30,9 +30,13 @@ public class IntegerChecker implements CheckerOnOneVariableComponentLineChecker< Integer.parseInt(value); validationCheckResult = DefaultValidationCheckResult.success(); } catch (NumberFormatException e) { - validationCheckResult = DefaultValidationCheckResult.error(getTarget().getInternationalizedKey("invalidInteger"), - ImmutableMap.of("target",target.getTarget(), - "value", value)); + validationCheckResult = DefaultValidationCheckResult.error( + getTarget().getInternationalizedKey("invalidInteger"), + ImmutableMap.of( + "target", target, + "value", value + ) + ); } return validationCheckResult; } diff --git a/src/main/java/fr/inra/oresing/checker/ReferenceLineChecker.java b/src/main/java/fr/inra/oresing/checker/ReferenceLineChecker.java index 87d2f5b2c..0daaefac4 100644 --- a/src/main/java/fr/inra/oresing/checker/ReferenceLineChecker.java +++ b/src/main/java/fr/inra/oresing/checker/ReferenceLineChecker.java @@ -2,7 +2,6 @@ package fr.inra.oresing.checker; import com.fasterxml.jackson.annotation.JsonIgnore; import com.google.common.collect.ImmutableMap; -import fr.inra.oresing.model.ReferenceDatum; import fr.inra.oresing.persistence.Ltree; import fr.inra.oresing.persistence.SqlPrimitiveType; import fr.inra.oresing.rest.validationcheckresults.ReferenceValidationCheckResult; @@ -48,7 +47,7 @@ public class ReferenceLineChecker implements CheckerOnOneVariableComponentLineCh validationCheckResult = ReferenceValidationCheckResult.success(target, rawValue, valueAsLtree, referenceValues.get(valueAsLtree)); } else { validationCheckResult = ReferenceValidationCheckResult.error(target, rawValue, getTarget().getInternationalizedKey("invalidReference"), ImmutableMap.of( - "target", target.getTarget(), + "target", target, "referenceValues", referenceValues, "refType", reference, "value", rawValue)); diff --git a/src/main/java/fr/inra/oresing/checker/RegularExpressionChecker.java b/src/main/java/fr/inra/oresing/checker/RegularExpressionChecker.java index e0cd07418..3564cf75d 100644 --- a/src/main/java/fr/inra/oresing/checker/RegularExpressionChecker.java +++ b/src/main/java/fr/inra/oresing/checker/RegularExpressionChecker.java @@ -40,7 +40,7 @@ public class RegularExpressionChecker implements CheckerOnOneVariableComponentLi } else { validationCheckResult = DefaultValidationCheckResult.error( getTarget().getInternationalizedKey("patternNotMatched"), ImmutableMap.of( - "target", target.getTarget(), + "target", target, "pattern", patternString, "value", value)); } diff --git a/src/main/java/fr/inra/oresing/model/ReferenceColumn.java b/src/main/java/fr/inra/oresing/model/ReferenceColumn.java index 6469219b7..ee5f87a9e 100644 --- a/src/main/java/fr/inra/oresing/model/ReferenceColumn.java +++ b/src/main/java/fr/inra/oresing/model/ReferenceColumn.java @@ -1,9 +1,10 @@ package fr.inra.oresing.model; +import fr.inra.oresing.checker.CheckerTarget; import lombok.Value; @Value -public class ReferenceColumn implements SomethingToBeStoredAsJsonInDatabase<String> { +public class ReferenceColumn implements CheckerTarget, SomethingToBeStoredAsJsonInDatabase<String> { String column; public static ReferenceColumn forDisplay(String locale) { @@ -18,4 +19,14 @@ public class ReferenceColumn implements SomethingToBeStoredAsJsonInDatabase<Stri public String toJsonForDatabase() { return column; } + + @Override + public String getInternationalizedKey(String key) { + return key + "WithColumn"; + } + + @Override + public CheckerTargetType getType() { + return CheckerTargetType.PARAM_COLUMN; + } } diff --git a/src/main/java/fr/inra/oresing/model/VariableComponentKey.java b/src/main/java/fr/inra/oresing/model/VariableComponentKey.java index f366fe13e..09417bf2b 100644 --- a/src/main/java/fr/inra/oresing/model/VariableComponentKey.java +++ b/src/main/java/fr/inra/oresing/model/VariableComponentKey.java @@ -1,10 +1,11 @@ package fr.inra.oresing.model; +import fr.inra.oresing.checker.CheckerTarget; import lombok.Value; import org.apache.commons.lang3.StringUtils; @Value -public class VariableComponentKey { +public class VariableComponentKey implements CheckerTarget { private static final String SEPARATOR = "_"; @@ -20,4 +21,14 @@ public class VariableComponentKey { public String getId() { return variable + SEPARATOR + component; } + + @Override + public String getInternationalizedKey(String key) { + return key; + } + + @Override + public CheckerTargetType getType() { + return CheckerTargetType.PARAM_VARIABLE_COMPONENT_KEY; + } } \ No newline at end of file diff --git a/src/main/java/fr/inra/oresing/rest/DownloadDatasetQuery.java b/src/main/java/fr/inra/oresing/rest/DownloadDatasetQuery.java index 81fb69342..852f9129c 100644 --- a/src/main/java/fr/inra/oresing/rest/DownloadDatasetQuery.java +++ b/src/main/java/fr/inra/oresing/rest/DownloadDatasetQuery.java @@ -1,6 +1,5 @@ package fr.inra.oresing.rest; -import fr.inra.oresing.checker.CheckerTarget; import fr.inra.oresing.checker.DateLineChecker; import fr.inra.oresing.model.Application; import fr.inra.oresing.model.VariableComponentKey; @@ -157,7 +156,7 @@ public class DownloadDatasetQuery { } else if (vck.intervalValues != null && List.of("date", "time", "datetime").contains(vck.type)) { if (!Strings.isNullOrEmpty(vck.intervalValues.from) || !Strings.isNullOrEmpty(vck.intervalValues.to)) { DateLineChecker dateLineChecker = new DateLineChecker( - CheckerTarget.getInstance(vck.variableComponentKey, null, null), + vck.variableComponentKey, vck.format, null, null); filters.add( String.format( diff --git a/src/main/java/fr/inra/oresing/rest/OreSiService.java b/src/main/java/fr/inra/oresing/rest/OreSiService.java index f562a091b..6f82deb7a 100644 --- a/src/main/java/fr/inra/oresing/rest/OreSiService.java +++ b/src/main/java/fr/inra/oresing/rest/OreSiService.java @@ -334,7 +334,7 @@ public class OreSiService { ImmutableMap<ReferenceColumn, Multiplicity> multiplicityPerColumns = lineCheckers.stream() .filter(lineChecker -> lineChecker instanceof ReferenceLineChecker) .map(lineChecker -> (ReferenceLineChecker) lineChecker) - .collect(ImmutableMap.toImmutableMap(referenceLineChecker -> (ReferenceColumn) referenceLineChecker.getTarget().getTarget(), referenceLineChecker -> referenceLineChecker.getConfiguration().getMultiplicity())); + .collect(ImmutableMap.toImmutableMap(referenceLineChecker -> (ReferenceColumn) referenceLineChecker.getTarget(), referenceLineChecker -> referenceLineChecker.getConfiguration().getMultiplicity())); Configuration.ReferenceDescription referenceDescription = conf.getReferences().get(refType); @@ -620,7 +620,7 @@ public class OreSiService { DateLineChecker timeScopeDateLineChecker = lineCheckers.stream() .filter(lineChecker -> lineChecker instanceof DateLineChecker) .map(lineChecker -> (DateLineChecker) lineChecker) - .filter(dateLineChecker -> dateLineChecker.getTarget().getTarget().equals(dataTypeDescription.getAuthorization().getTimeScope())) + .filter(dateLineChecker -> dateLineChecker.getTarget().equals(dataTypeDescription.getAuthorization().getTimeScope())) .collect(MoreCollectors.onlyElement()); @@ -634,16 +634,16 @@ public class OreSiService { ValidationCheckResult validationCheckResult = lineChecker.check(datum); if (validationCheckResult.isSuccess()) { if (validationCheckResult instanceof DateValidationCheckResult) { - VariableComponentKey variableComponentKey = (VariableComponentKey) ((DateValidationCheckResult) validationCheckResult).getTarget().getTarget(); + VariableComponentKey variableComponentKey = (VariableComponentKey) ((DateValidationCheckResult) validationCheckResult).getTarget(); dateValidationCheckResultImmutableMap.put(variableComponentKey, (DateValidationCheckResult) validationCheckResult); } if (validationCheckResult instanceof ReferenceValidationCheckResult) { ReferenceLineCheckerConfiguration configuration = (ReferenceLineCheckerConfiguration) lineChecker.getConfiguration(); if (configuration.getGroovy() != null) { - datum.put((VariableComponentKey) ((ReferenceValidationCheckResult) validationCheckResult).getTarget().getTarget(), ((ReferenceValidationCheckResult) validationCheckResult).getMatchedReferenceHierarchicalKey().getSql()); + datum.put((VariableComponentKey) ((ReferenceValidationCheckResult) validationCheckResult).getTarget(), ((ReferenceValidationCheckResult) validationCheckResult).getMatchedReferenceHierarchicalKey().getSql()); } ReferenceValidationCheckResult referenceValidationCheckResult = (ReferenceValidationCheckResult) validationCheckResult; - VariableComponentKey variableComponentKey = (VariableComponentKey) referenceValidationCheckResult.getTarget().getTarget(); + VariableComponentKey variableComponentKey = (VariableComponentKey) referenceValidationCheckResult.getTarget(); UUID referenceId = referenceValidationCheckResult.getMatchedReferenceId(); refsLinkedTo.put(variableComponentKey, referenceId); } @@ -1107,7 +1107,7 @@ public class OreSiService { List<String> dateLineCheckerVariableComponentKeyIdList = checkerFactory.getLineCheckers(getApplication(nameOrId), dataType).stream() .filter(ch -> ch instanceof DateLineChecker) .map(ch -> (DateLineChecker) ch) - .map(ch -> ((VariableComponentKey) ch.getTarget().getTarget()).getId()) + .map(ch -> ((VariableComponentKey) ch.getTarget()).getId()) .collect(Collectors.toList()); if (CollectionUtils.isEmpty(downloadDatasetQueryCopy.getVariableComponentOrderBy())) { columns = allColumns; @@ -1175,13 +1175,13 @@ public class OreSiService { c -> { VariableComponentKey vc; if (c instanceof DateLineChecker) { - vc = (VariableComponentKey) ((DateLineChecker) c).getTarget().getTarget(); + vc = (VariableComponentKey) ((DateLineChecker) c).getTarget(); } else if (c instanceof IntegerChecker) { - vc = (VariableComponentKey) ((IntegerChecker) c).getTarget().getTarget(); + vc = (VariableComponentKey) ((IntegerChecker) c).getTarget(); } else if (c instanceof FloatChecker) { - vc = (VariableComponentKey) ((FloatChecker) c).getTarget().getTarget(); + vc = (VariableComponentKey) ((FloatChecker) c).getTarget(); } else { - vc = (VariableComponentKey) ((ReferenceLineChecker) c).getTarget().getTarget(); + vc = (VariableComponentKey) ((ReferenceLineChecker) c).getTarget(); } return vc.getId(); }, diff --git a/src/main/java/fr/inra/oresing/rest/ReferenceImporter.java b/src/main/java/fr/inra/oresing/rest/ReferenceImporter.java index 8ea34b7ef..5505a5713 100644 --- a/src/main/java/fr/inra/oresing/rest/ReferenceImporter.java +++ b/src/main/java/fr/inra/oresing/rest/ReferenceImporter.java @@ -205,7 +205,7 @@ abstract class ReferenceImporter { .filter(DateValidationCheckResult.class::isInstance) .map(DateValidationCheckResult.class::cast) .forEach(dateValidationCheckResult -> { - ReferenceColumn referenceColumn = (ReferenceColumn) dateValidationCheckResult.getTarget().getTarget(); + ReferenceColumn referenceColumn = (ReferenceColumn) dateValidationCheckResult.getTarget(); ReferenceColumnValue referenceColumnRawValue = referenceDatumBeforeChecking.get(referenceColumn); ReferenceColumnValue valueToStoreInDatabase = referenceColumnRawValue .transform(rawValue -> @@ -215,7 +215,7 @@ abstract class ReferenceImporter { }); } else if (lineChecker instanceof ReferenceLineChecker) { ReferenceLineChecker referenceLineChecker = (ReferenceLineChecker) lineChecker; - ReferenceColumn referenceColumn = (ReferenceColumn) referenceLineChecker.getTarget().getTarget(); + ReferenceColumn referenceColumn = (ReferenceColumn) referenceLineChecker.getTarget(); SetMultimap<ReferenceColumn, String> rawValueReplacedByKeys = HashMultimap.create(); String reference = referenceLineChecker.getRefType(); validationCheckResults.stream() diff --git a/src/main/java/fr/inra/oresing/rest/RelationalService.java b/src/main/java/fr/inra/oresing/rest/RelationalService.java index 524421912..81f9f14ff 100644 --- a/src/main/java/fr/inra/oresing/rest/RelationalService.java +++ b/src/main/java/fr/inra/oresing/rest/RelationalService.java @@ -186,7 +186,7 @@ public class RelationalService implements InitializingBean, DisposableBean { ImmutableMap<VariableComponentKey, CheckerOnOneVariableComponentLineChecker> checkerPerVariableComponentKeys = checkerFactory.getLineCheckers(application, dataType).stream() .filter(lineChecker -> lineChecker instanceof CheckerOnOneVariableComponentLineChecker) .map(lineChecker -> (CheckerOnOneVariableComponentLineChecker) lineChecker) - .collect(ImmutableMap.toImmutableMap(rlc -> (VariableComponentKey) rlc.getTarget().getTarget(), Function.identity())); + .collect(ImmutableMap.toImmutableMap(rlc -> (VariableComponentKey) rlc.getTarget(), Function.identity())); Map<VariableComponentKey, ReferenceLineChecker> referenceCheckers = Maps.transformValues( Maps.filterValues(checkerPerVariableComponentKeys, checker -> checker instanceof ReferenceLineChecker), @@ -275,7 +275,7 @@ public class RelationalService implements InitializingBean, DisposableBean { for (ReferenceLineChecker referenceChecker : referenceCheckers.values()) { String referenceType = referenceChecker.getRefType(); // especes - VariableComponentKey variableComponentKey = (VariableComponentKey) referenceChecker.getTarget().getTarget(); + VariableComponentKey variableComponentKey = (VariableComponentKey) referenceChecker.getTarget(); String quotedViewName = sqlSchema.forReferenceType(referenceType).getSqlIdentifier(); String foreignKeyColumnName = getTechnicalIdColumnName(variableComponentKey); @@ -336,12 +336,12 @@ public class RelationalService implements InitializingBean, DisposableBean { ImmutableMap<ReferenceColumn, SqlPrimitiveType> sqlTypePerColumns = checkerFactory.getReferenceValidationLineCheckers(app, referenceType).stream() .filter(CheckerOnOneVariableComponentLineChecker.class::isInstance) .map(CheckerOnOneVariableComponentLineChecker.class::cast) - .collect(ImmutableMap.toImmutableMap(rlc -> (ReferenceColumn) rlc.getTarget().getTarget(), CheckerOnOneVariableComponentLineChecker::getSqlType)); + .collect(ImmutableMap.toImmutableMap(rlc -> (ReferenceColumn) rlc.getTarget(), CheckerOnOneVariableComponentLineChecker::getSqlType)); ImmutableMap<ReferenceColumn, Multiplicity> declaredMultiplicityPerReferenceColumns = checkerFactory.getReferenceValidationLineCheckers(app, referenceType).stream() .filter(ReferenceLineChecker.class::isInstance) .map(ReferenceLineChecker.class::cast) - .collect(ImmutableMap.toImmutableMap(rlc -> (ReferenceColumn) rlc.getTarget().getTarget(), referenceLineChecker -> referenceLineChecker.getConfiguration().getMultiplicity())); + .collect(ImmutableMap.toImmutableMap(rlc -> (ReferenceColumn) rlc.getTarget(), referenceLineChecker -> referenceLineChecker.getConfiguration().getMultiplicity())); ImmutableSetMultimap<Multiplicity, ReferenceColumn> allReferenceColumnsPerMultiplicity = referenceDescription.getColumns().keySet().stream() .map(ReferenceColumn::new) diff --git a/src/main/java/fr/inra/oresing/transformer/TransformOneLineElementTransformer.java b/src/main/java/fr/inra/oresing/transformer/TransformOneLineElementTransformer.java index 8044177a2..2b58ee1d7 100644 --- a/src/main/java/fr/inra/oresing/transformer/TransformOneLineElementTransformer.java +++ b/src/main/java/fr/inra/oresing/transformer/TransformOneLineElementTransformer.java @@ -17,7 +17,7 @@ public interface TransformOneLineElementTransformer extends LineTransformer { @Override default Datum transform(Datum datum) { - VariableComponentKey variableComponentKey = (VariableComponentKey) getTarget().getTarget(); + VariableComponentKey variableComponentKey = (VariableComponentKey) getTarget(); String value = datum.get(variableComponentKey); String transformedValue = transform(datum, value); Datum transformedDatum = Datum.copyOf(datum); @@ -27,7 +27,7 @@ public interface TransformOneLineElementTransformer extends LineTransformer { @Override default ReferenceDatum transform(ReferenceDatum referenceDatum) { - ReferenceColumn referenceColumn = (ReferenceColumn) getTarget().getTarget(); + ReferenceColumn referenceColumn = (ReferenceColumn) getTarget(); ReferenceColumnValue referenceColumnValue; if (referenceDatum.contains(referenceColumn)) { referenceColumnValue = referenceDatum.get(referenceColumn); diff --git a/src/test/java/fr/inra/oresing/checker/CheckerTargetTest.java b/src/test/java/fr/inra/oresing/checker/CheckerTargetTest.java index e17722fde..bc76d49b8 100644 --- a/src/test/java/fr/inra/oresing/checker/CheckerTargetTest.java +++ b/src/test/java/fr/inra/oresing/checker/CheckerTargetTest.java @@ -9,18 +9,18 @@ public class CheckerTargetTest { @Test public void testBuildColumnChecker(){ ReferenceColumn referenceColumn = new ReferenceColumn("bonjour"); - CheckerTarget checkerTarget= CheckerTarget.getInstance(referenceColumn,null, null); + CheckerTarget checkerTarget= referenceColumn; Assert.assertEquals(CheckerTarget.CheckerTargetType.PARAM_COLUMN, checkerTarget.getType()); - Assert.assertEquals(referenceColumn, checkerTarget.getTarget()); + Assert.assertEquals(referenceColumn, checkerTarget); String key = checkerTarget.getInternationalizedKey("key"); Assert.assertEquals("keyWithColumn", key); } @Test public void testBuildVariableComponentChecker(){ VariableComponentKey variableComponentKey = new VariableComponentKey("Variable", "component"); - CheckerTarget checkerTarget= CheckerTarget.getInstance( variableComponentKey, null, null); + CheckerTarget checkerTarget= variableComponentKey; Assert.assertEquals(CheckerTarget.CheckerTargetType.PARAM_VARIABLE_COMPONENT_KEY, checkerTarget.getType()); - Assert.assertEquals(variableComponentKey, checkerTarget.getTarget()); + Assert.assertEquals(variableComponentKey, checkerTarget); String key = checkerTarget.getInternationalizedKey("key"); Assert.assertEquals("key", key); } diff --git a/src/test/java/fr/inra/oresing/checker/DateLineCheckerTest.java b/src/test/java/fr/inra/oresing/checker/DateLineCheckerTest.java index 014bbc073..1d21fe062 100644 --- a/src/test/java/fr/inra/oresing/checker/DateLineCheckerTest.java +++ b/src/test/java/fr/inra/oresing/checker/DateLineCheckerTest.java @@ -9,7 +9,7 @@ public class DateLineCheckerTest { @Test public void testCheck() { - DateLineChecker dateLineChecker = new DateLineChecker(CheckerTarget.getInstance(new VariableComponentKey("ignored", "ignored"), null, null), "dd/MM/yyyy", null, null); + DateLineChecker dateLineChecker = new DateLineChecker(new VariableComponentKey("ignored", "ignored"), "dd/MM/yyyy", null, null); Assert.assertTrue(dateLineChecker.check("12/01/2021").isSuccess()); Assert.assertFalse(dateLineChecker.check("06/21").isSuccess()); Assert.assertFalse(dateLineChecker.check("04/03/10").isSuccess()); -- GitLab From 8065d40941a00eb2d3c146e933e7619aee30989e Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Mon, 21 Mar 2022 14:11:44 +0100 Subject: [PATCH 02/41] =?UTF-8?q?Corrige=20la=20validation=20des=20param?= =?UTF-8?q?=C3=A8tres=20"colonnes"=20dans=20la=20configuration=20d'un=20Ch?= =?UTF-8?q?ecker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inra/oresing/checker/CheckerFactory.java | 46 ++++++------------- .../fr/inra/oresing/model/Configuration.java | 30 +++++++++++- .../rest/ApplicationConfigurationService.java | 37 +++------------ .../rest/ConfigurationParsingResult.java | 4 +- 4 files changed, 51 insertions(+), 66 deletions(-) diff --git a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java index 33c642473..f2ae58fb1 100644 --- a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java +++ b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java @@ -1,7 +1,6 @@ package fr.inra.oresing.checker; import com.google.common.base.Preconditions; -import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import fr.inra.oresing.groovy.GroovyContextHelper; @@ -28,7 +27,6 @@ import java.util.Set; import java.util.UUID; import java.util.function.Function; import java.util.stream.Collectors; -import java.util.stream.Stream; @Component @Slf4j @@ -153,7 +151,6 @@ public class CheckerFactory { for (Map.Entry<String, Configuration.LineValidationRuleDescription> validationEntry : lineValidationDescriptions.entrySet()) { Configuration.LineValidationRuleDescription lineValidationRuleDescription = validationEntry.getValue(); Configuration.CheckerDescription checkerDescription = lineValidationRuleDescription.getChecker(); - LineChecker lineChecker; Configuration.CheckerConfigurationDescription configurationDescription = checkerDescription.getParams(); if (GroovyLineChecker.NAME.equals(checkerDescription.getName())) { String expression = configurationDescription.getGroovy().getExpression(); @@ -166,61 +163,46 @@ public class CheckerFactory { .putAll(groovyContextForDataTypes) .put("application", app) .build(); - lineChecker = GroovyLineChecker.forExpression(expression, context, configurationDescription); + LineChecker lineChecker = GroovyLineChecker.forExpression(expression, context, configurationDescription); checkersBuilder.add(lineChecker); } else { - List<CheckerTarget> checkerTargets = buildCheckerTarget(configurationDescription, app); - if (checkerTargets != null) { - checkerTargets.forEach(checkerTarget -> buildCheckers(app, checkerDescription, checkerTarget, checkersBuilder)); - } else { - throw new IllegalArgumentException(String.format("Pour le checker de ligne %s, le paramètre %s doit être fourni.", checkerDescription.getName(), param)); - } + List<CheckerOnOneVariableComponentLineChecker> lineCheckers = configurationDescription.doGetColumnsAsCollection().stream() + .map(ReferenceColumn::new) + .map(checkerTarget -> newChecker(app, checkerDescription, checkerTarget)) + .collect(Collectors.toList()); + checkersBuilder.addAll(lineCheckers); } checkersBuilder.build(); } } - private void buildCheckers(Application app, Configuration.CheckerDescription checkerDescription, CheckerTarget target, ImmutableSet.Builder<LineChecker> checkersBuilder) { + private CheckerOnOneVariableComponentLineChecker newChecker(Application app, Configuration.CheckerDescription checkerDescription, CheckerTarget target) { LineTransformer transformer = transformerFactory.newTransformer(checkerDescription.getParams(), app, target); Configuration.CheckerConfigurationDescription checkerConfigurationDescription = checkerDescription.getParams(); + CheckerOnOneVariableComponentLineChecker lineChecker; switch (checkerDescription.getName()) { case "Date": - checkersBuilder.add(new DateLineChecker(target, checkerConfigurationDescription.getPattern(), checkerConfigurationDescription, transformer)); + lineChecker = new DateLineChecker(target, checkerConfigurationDescription.getPattern(), checkerConfigurationDescription, transformer); break; case "Integer": - checkersBuilder.add(new IntegerChecker(target, checkerConfigurationDescription, transformer)); + lineChecker = new IntegerChecker(target, checkerConfigurationDescription, transformer); break; case "Float": - checkersBuilder.add(new FloatChecker(target, checkerConfigurationDescription, transformer)); + lineChecker = new FloatChecker(target, checkerConfigurationDescription, transformer); break; case "RegularExpression": - checkersBuilder.add(new RegularExpressionChecker(target, checkerConfigurationDescription.getPattern(), checkerConfigurationDescription, transformer)); + lineChecker = new RegularExpressionChecker(target, checkerConfigurationDescription.getPattern(), checkerConfigurationDescription, transformer); break; case "Reference": String refType = checkerConfigurationDescription.getRefType(); ReferenceValueRepository referenceValueRepository = repository.getRepository(app).referenceValue(); ImmutableMap<Ltree, UUID> referenceValues = referenceValueRepository.getReferenceIdPerKeys(refType); - checkersBuilder.add(new ReferenceLineChecker(target, refType, referenceValues, checkerConfigurationDescription, transformer)); + lineChecker = new ReferenceLineChecker(target, refType, referenceValues, checkerConfigurationDescription, transformer); break; default: throw new IllegalArgumentException("checker inconnu " + checkerDescription.getName()); } - } - - private List<CheckerTarget> buildCheckerTarget(Configuration.CheckerConfigurationDescription params, Application application) { - String columnsString = params.getColumns(); - String variableComponentKeyParam = params.getVariableComponentKey(); - if (!Strings.isNullOrEmpty(columnsString)) { - return Stream.of(columnsString.split(",")) - .map(ReferenceColumn::new) - .collect(Collectors.toList()); - } else if (!Strings.isNullOrEmpty(variableComponentKeyParam) || !variableComponentKeyParam.matches("_")) { - String[] split = variableComponentKeyParam.split("_"); - Stream.of(new VariableComponentKey(split[0], split[1])) - .collect(Collectors.toList()); - - } - return null; + return lineChecker; } enum Type { diff --git a/src/main/java/fr/inra/oresing/model/Configuration.java b/src/main/java/fr/inra/oresing/model/Configuration.java index 70fc0eac6..7664ac464 100644 --- a/src/main/java/fr/inra/oresing/model/Configuration.java +++ b/src/main/java/fr/inra/oresing/model/Configuration.java @@ -4,7 +4,14 @@ import com.google.common.base.Splitter; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.collect.MoreCollectors; -import fr.inra.oresing.checker.*; +import com.google.common.collect.Sets; +import fr.inra.oresing.checker.DateLineCheckerConfiguration; +import fr.inra.oresing.checker.FloatCheckerConfiguration; +import fr.inra.oresing.checker.GroovyLineCheckerConfiguration; +import fr.inra.oresing.checker.IntegerCheckerConfiguration; +import fr.inra.oresing.checker.Multiplicity; +import fr.inra.oresing.checker.ReferenceLineCheckerConfiguration; +import fr.inra.oresing.checker.RegularExpressionCheckerConfiguration; import fr.inra.oresing.model.internationalization.Internationalization; import fr.inra.oresing.model.internationalization.InternationalizationMap; import lombok.Getter; @@ -15,6 +22,7 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import javax.annotation.Nullable; +import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; @@ -25,6 +33,7 @@ import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.TreeMap; +import java.util.stream.Collectors; @Getter @Setter @@ -103,6 +112,24 @@ public class Configuration { private LinkedHashMap<String, ReferenceColumnDescription> columns = new LinkedHashMap<>(); private LinkedHashMap<String, ReferenceDynamicColumnDescription> dynamicColumns = new LinkedHashMap<>(); private LinkedHashMap<String, LineValidationRuleDescription> validations = new LinkedHashMap<>(); + + public ImmutableSet<ReferenceColumn> doGetStaticColumns() { + return columns.keySet().stream() + .map(ReferenceColumn::new). + collect(ImmutableSet.toImmutableSet()); + } + + public ImmutableSet<ReferenceColumn> doGetComputedColumns() { + Set<ReferenceColumn> usedInTransformationColumns = validations.values().stream() + .map(LineValidationRuleDescription::getChecker) + .map(CheckerDescription::getParams) + .map(CheckerConfigurationDescription::doGetColumnsAsCollection) + .flatMap(Collection::stream) + .map(ReferenceColumn::new) + .collect(Collectors.toUnmodifiableSet()); + ImmutableSet<ReferenceColumn> computedColumns = Sets.difference(usedInTransformationColumns, doGetStaticColumns()).immutableCopy(); + return computedColumns; + } } @Getter @@ -278,7 +305,6 @@ public class Configuration { String refType; GroovyConfiguration groovy; String columns; - String variableComponentKey; String duration; boolean codify; boolean required; diff --git a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java index 8b48f2f8d..5c34f3e04 100644 --- a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java +++ b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java @@ -6,7 +6,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.exc.InvalidFormatException; import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException; import com.fasterxml.jackson.dataformat.yaml.YAMLMapper; -import com.google.common.base.MoreObjects; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Multiset; import com.google.common.collect.Sets; @@ -26,12 +25,10 @@ import lombok.Setter; import lombok.ToString; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.assertj.core.util.Strings; import org.springframework.stereotype.Component; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; -import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -43,7 +40,6 @@ import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; -import java.util.stream.Stream; @Component @Slf4j @@ -650,17 +646,6 @@ public class ApplicationConfigurationService { continue; } ImmutableSet<String> variableComponentCheckers = ImmutableSet.of("Date", "Float", "Integer", "RegularExpression", "Reference"); - String columns = checker.getParams().getColumns(); - Set<String> groovyColumn = Optional.ofNullable(checker) - .map(check->check.getParams()) - .filter(params->params.getGroovy() != null) - .map(params-> MoreObjects.firstNonNull(params.getColumns(), "")) - - // autant mettre une collection dans le YAML directement - .map(values-> values.split(",")) - .map(values-> Arrays.stream(values).collect(Collectors.toSet())) - .orElse(Set.of()); - if (GroovyLineChecker.NAME.equals(checker.getName())) { String expression =Optional.of(checker) .map(Configuration.CheckerDescription::getParams) @@ -674,22 +659,14 @@ public class ApplicationConfigurationService { compileResult.ifPresent(compilationError -> builder.recordIllegalGroovyExpression(validationRuleDescriptionEntryKey, expression, compilationError)); } } else if (variableComponentCheckers.contains(checker.getName())) { - if (Strings.isNullOrEmpty(columns)) + if (checker.getParams().doGetColumnsAsCollection().isEmpty()) { builder.missingParamColumnReferenceForCheckerInReference(validationRuleDescriptionEntryKey, reference); - else { - List<String> columnsList = Stream.of(columns.split(",")).collect(Collectors.toList()); - Set<String> referencesColumns = referenceDescription.getColumns().keySet(); - ImmutableSet availablesColumns = new ImmutableSet.Builder<>() - .addAll(referencesColumns) - .addAll(groovyColumn) - .build(); - - List<String> missingColumns = columnsList.stream() - .filter(c -> !availablesColumns.contains(c)) - .collect(Collectors.toList()); - - if (!missingColumns.isEmpty()) { - builder.missingColumnReferenceForCheckerInReference(validationRuleDescriptionEntryKey, availablesColumns, checker.getName(), missingColumns, reference); + } else { + ImmutableSet<String> columnsDeclaredInCheckerConfiguration = checker.getParams().doGetColumnsAsCollection(); + Set<String> knownColumns = referenceDescription.getColumns().keySet(); + ImmutableSet<String> missingColumns = Sets.difference(columnsDeclaredInCheckerConfiguration, knownColumns).immutableCopy(); + if (false && !missingColumns.isEmpty()) { + builder.missingColumnReferenceForCheckerInReference(validationRuleDescriptionEntryKey, knownColumns, checker.getName(), missingColumns, reference); } } if ("Reference".equals(checker.getName())) { diff --git a/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java b/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java index f73238e41..f8df01cd5 100644 --- a/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java +++ b/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java @@ -283,11 +283,11 @@ public class ConfigurationParsingResult { )); } - public Builder missingColumnReferenceForCheckerInReference(String validationRuleDescriptionEntryKey, Set<String> availablesColumns, String name, List<String> missingColumns, String reference) { + public Builder missingColumnReferenceForCheckerInReference(String validationRuleDescriptionEntryKey, Set<String> knownColumns, String name, ImmutableSet<String> missingColumns, String reference) { return recordError("missingColumnReferenceForCheckerInReference", ImmutableMap.of( "reference", reference, "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, - "knownColumns", availablesColumns, + "knownColumns", knownColumns, "checkerName", name, "missingColumns", missingColumns )); -- GitLab From f54f803c44063632ed0a69d9300af5ef9bdc5e4c Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Mon, 21 Mar 2022 14:53:33 +0100 Subject: [PATCH 03/41] =?UTF-8?q?Supprime=20un=20param=C3=A8tre=20inutilis?= =?UTF-8?q?=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/fr/inra/oresing/checker/CheckerFactory.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java index 2bcf0751d..a96c23fbb 100644 --- a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java +++ b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java @@ -104,7 +104,7 @@ public class CheckerFactory { .map(transformationConfiguration -> transformerFactory.newTransformer(transformationConfiguration, app, variableComponentKey)) .orElseGet(transformerFactory::getNullTransformer); if ("Reference".equals(checkerDescription.getName())) { - variableComponentChecker = getCheckerOnReferenceChecker(app, dataType, locale, checkerDescription, variableComponentKey, transformer); + variableComponentChecker = getCheckerOnReferenceChecker(app, locale, checkerDescription, variableComponentKey, transformer); } else { final Configuration.CheckerConfigurationDescription configuration = checkerDescription.getParams(); if ("Date".equals(checkerDescription.getName())) { @@ -128,8 +128,7 @@ public class CheckerFactory { } } - private CheckerOnOneVariableComponentLineChecker getCheckerOnReferenceChecker(Application app, String dataType, Locale locale, Configuration.CheckerDescription checkerDescription, CheckerTarget checkerTarget, LineTransformer transformer) { - CheckerOnOneVariableComponentLineChecker variableComponentChecker; + private CheckerOnOneVariableComponentLineChecker getCheckerOnReferenceChecker(Application app, Locale locale, Configuration.CheckerDescription checkerDescription, CheckerTarget checkerTarget, LineTransformer transformer) { String refType = checkerDescription.getParams().getRefType(); ReferenceValueRepository referenceValueRepository = repository.getRepository(app).referenceValue(); ImmutableMap<Ltree, UUID> referenceValues; @@ -142,7 +141,7 @@ public class CheckerFactory { .collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue().getUuid())) ); } - variableComponentChecker = new ReferenceLineChecker(checkerTarget, refType, referenceValues, checkerDescription.getParams(), transformer); + CheckerOnOneVariableComponentLineChecker variableComponentChecker = new ReferenceLineChecker(checkerTarget, refType, referenceValues, checkerDescription.getParams(), transformer); return variableComponentChecker; } -- GitLab From ca1428c03268b8806aa0157e49161114815d174f Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Mon, 21 Mar 2022 15:30:04 +0100 Subject: [PATCH 04/41] =?UTF-8?q?Supprime=20le=20param=C3=A8tre=20locale?= =?UTF-8?q?=20qui=20n'est=20pas=20r=C3=A9ellement=20utilis=C3=A9=20(if=20e?= =?UTF-8?q?t=20else=20font=20la=20m=C3=AAme=20chose)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inra/oresing/checker/CheckerFactory.java | 25 ++++--------------- .../fr/inra/oresing/rest/OreSiResources.java | 2 +- .../fr/inra/oresing/rest/OreSiService.java | 4 +-- 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java index a96c23fbb..e43bc839d 100644 --- a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java +++ b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java @@ -12,7 +12,6 @@ import fr.inra.oresing.persistence.DataRepository; import fr.inra.oresing.persistence.Ltree; import fr.inra.oresing.persistence.OreSiRepository; import fr.inra.oresing.persistence.ReferenceValueRepository; -import fr.inra.oresing.rest.ApplicationResult; import fr.inra.oresing.transformer.LineTransformer; import fr.inra.oresing.transformer.TransformerFactory; import lombok.extern.slf4j.Slf4j; @@ -21,7 +20,6 @@ import org.springframework.stereotype.Component; import java.util.LinkedHashMap; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.Optional; import java.util.Set; @@ -68,10 +66,6 @@ public class CheckerFactory { } public ImmutableSet<LineChecker> getLineCheckers(Application app, String dataType) { - return getLineCheckers(app, dataType, null); - } - - public ImmutableSet<LineChecker> getLineCheckers(Application app, String dataType, Locale locale) { Preconditions.checkArgument(app.getConfiguration().getDataTypes().containsKey(dataType), "Pas de type de données " + dataType + " dans " + app); Configuration.DataTypeDescription dataTypeDescription = app.getConfiguration().getDataTypes().get(dataType); ImmutableSet.Builder<LineChecker> checkersBuilder = ImmutableSet.builder(); @@ -79,7 +73,7 @@ public class CheckerFactory { String variable = variableEntry.getKey(); Configuration.ColumnDescription variableDescription = variableEntry.getValue(); for (Map.Entry<String, Configuration.VariableComponentDescription> componentEntry : variableDescription.getComponents().entrySet()) { - parseVariableComponentdescription(app, dataType, locale, checkersBuilder, variable, variableDescription, componentEntry); + parseVariableComponentdescription(app, dataType, checkersBuilder, variable, variableDescription, componentEntry); } } addCheckersFromLineValidationDescriptions(app, dataTypeDescription.getValidations(), checkersBuilder, Type.DATATYPE.getParam()); //Configuration.DataTypeDescription dataTypeDescription, @@ -90,7 +84,7 @@ public class CheckerFactory { return lineCheckers; } - private void parseVariableComponentdescription(Application app, String dataType, Locale locale, ImmutableSet.Builder<LineChecker> checkersBuilder, String variable, Configuration.ColumnDescription variableDescription, Map.Entry<String, Configuration.VariableComponentDescription> componentEntry) { + private void parseVariableComponentdescription(Application app, String dataType, ImmutableSet.Builder<LineChecker> checkersBuilder, String variable, Configuration.ColumnDescription variableDescription, Map.Entry<String, Configuration.VariableComponentDescription> componentEntry) { String component = componentEntry.getKey(); VariableComponentKey variableComponentKey = new VariableComponentKey(variable, component); if (variableDescription.getComponents().get(component) == null) { @@ -104,7 +98,7 @@ public class CheckerFactory { .map(transformationConfiguration -> transformerFactory.newTransformer(transformationConfiguration, app, variableComponentKey)) .orElseGet(transformerFactory::getNullTransformer); if ("Reference".equals(checkerDescription.getName())) { - variableComponentChecker = getCheckerOnReferenceChecker(app, locale, checkerDescription, variableComponentKey, transformer); + variableComponentChecker = getCheckerOnReferenceChecker(app, checkerDescription, variableComponentKey, transformer); } else { final Configuration.CheckerConfigurationDescription configuration = checkerDescription.getParams(); if ("Date".equals(checkerDescription.getName())) { @@ -128,19 +122,10 @@ public class CheckerFactory { } } - private CheckerOnOneVariableComponentLineChecker getCheckerOnReferenceChecker(Application app, Locale locale, Configuration.CheckerDescription checkerDescription, CheckerTarget checkerTarget, LineTransformer transformer) { + private CheckerOnOneVariableComponentLineChecker getCheckerOnReferenceChecker(Application app, Configuration.CheckerDescription checkerDescription, CheckerTarget checkerTarget, LineTransformer transformer) { String refType = checkerDescription.getParams().getRefType(); ReferenceValueRepository referenceValueRepository = repository.getRepository(app).referenceValue(); - ImmutableMap<Ltree, UUID> referenceValues; - if (locale == null) { - referenceValues = referenceValueRepository.getReferenceIdPerKeys(refType); - } else { - ImmutableMap<Ltree, ApplicationResult.Reference.ReferenceUUIDAndDisplay> referenceIdAndDisplayPerKeys = referenceValueRepository.getReferenceIdAndDisplayPerKeys(refType, locale); - referenceValues = ImmutableMap.copyOf( - referenceIdAndDisplayPerKeys.entrySet().stream() - .collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue().getUuid())) - ); - } + ImmutableMap<Ltree, UUID> referenceValues = referenceValueRepository.getReferenceIdPerKeys(refType); CheckerOnOneVariableComponentLineChecker variableComponentChecker = new ReferenceLineChecker(checkerTarget, refType, referenceValues, checkerDescription.getParams(), transformer); return variableComponentChecker; } diff --git a/src/main/java/fr/inra/oresing/rest/OreSiResources.java b/src/main/java/fr/inra/oresing/rest/OreSiResources.java index b7a201afc..800fe0f26 100644 --- a/src/main/java/fr/inra/oresing/rest/OreSiResources.java +++ b/src/main/java/fr/inra/oresing/rest/OreSiResources.java @@ -272,7 +272,7 @@ public class OreSiResources { }) .collect(ImmutableSet.toImmutableSet()); Long totalRows = list.stream().limit(1).map(dataRow -> dataRow.getTotalRows()).findFirst().orElse(-1L); - Map<String, Map<String, LineChecker>> checkedFormatVariableComponents = service.getcheckedFormatVariableComponents(nameOrId, dataType, locale); + Map<String, Map<String, LineChecker>> checkedFormatVariableComponents = service.getcheckedFormatVariableComponents(nameOrId, dataType); Map<String, Map<String, Map<String, String>>> entitiesTranslation = service.getEntitiesTranslation(nameOrId, locale, dataType, checkedFormatVariableComponents); return ResponseEntity.ok(new GetDataResult(variables, list, totalRows, checkedFormatVariableComponents, entitiesTranslation)); } diff --git a/src/main/java/fr/inra/oresing/rest/OreSiService.java b/src/main/java/fr/inra/oresing/rest/OreSiService.java index 3f291cb3b..9793236aa 100644 --- a/src/main/java/fr/inra/oresing/rest/OreSiService.java +++ b/src/main/java/fr/inra/oresing/rest/OreSiService.java @@ -1224,8 +1224,8 @@ public class OreSiService { .build(); } - public Map<String, Map<String, LineChecker>> getcheckedFormatVariableComponents(String nameOrId, String dataType, Locale locale) { - return checkerFactory.getLineCheckers(getApplication(nameOrId), dataType, locale) + public Map<String, Map<String, LineChecker>> getcheckedFormatVariableComponents(String nameOrId, String dataType) { + return checkerFactory.getLineCheckers(getApplication(nameOrId), dataType) .stream() .filter(c -> (c instanceof DateLineChecker) || (c instanceof IntegerChecker) || (c instanceof FloatChecker) || (c instanceof ReferenceLineChecker)) .collect( -- GitLab From 53a30f6a3a68a84bfb488938eec8ae4d559526bb Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Mon, 21 Mar 2022 15:36:15 +0100 Subject: [PATCH 05/41] Supprime du code mort (ancien code d'i18n ?) --- .../persistence/ReferenceValueRepository.java | 27 ------------------- .../inra/oresing/rest/ApplicationResult.java | 8 ------ 2 files changed, 35 deletions(-) diff --git a/src/main/java/fr/inra/oresing/persistence/ReferenceValueRepository.java b/src/main/java/fr/inra/oresing/persistence/ReferenceValueRepository.java index 0f728a98c..3d9784aa2 100644 --- a/src/main/java/fr/inra/oresing/persistence/ReferenceValueRepository.java +++ b/src/main/java/fr/inra/oresing/persistence/ReferenceValueRepository.java @@ -1,15 +1,9 @@ package fr.inra.oresing.persistence; -import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterators; import fr.inra.oresing.model.Application; -import fr.inra.oresing.model.ReferenceColumn; -import fr.inra.oresing.model.ReferenceColumnSingleValue; -import fr.inra.oresing.model.ReferenceColumnValue; -import fr.inra.oresing.model.ReferenceDatum; import fr.inra.oresing.model.ReferenceValue; -import fr.inra.oresing.rest.ApplicationResult; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; @@ -20,11 +14,8 @@ import org.springframework.util.MultiValueMap; import java.sql.PreparedStatement; import java.util.List; -import java.util.Locale; -import java.util.Map; import java.util.UUID; import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -104,24 +95,6 @@ public class ReferenceValueRepository extends JsonTableInApplicationSchemaReposi return result; } - public ImmutableMap<Ltree, ApplicationResult.Reference.ReferenceUUIDAndDisplay> getReferenceIdAndDisplayPerKeys(String referenceType, Locale locale) { - Function<ReferenceValue, ApplicationResult.Reference.ReferenceUUIDAndDisplay> referenceValueToReferenceUuidAndDisplayFunction = result -> { - ReferenceDatum referenceDatum = result.getRefValues(); - ReferenceColumn referenceColumnForDisplay = ReferenceColumn.forDisplay(locale); - String display; - if (referenceDatum.contains(referenceColumnForDisplay)) { - ReferenceColumnValue referenceColumnValueForDisplay = referenceDatum.get(referenceColumnForDisplay); - Preconditions.checkState(referenceColumnValueForDisplay instanceof ReferenceColumnSingleValue); - display = ((ReferenceColumnSingleValue) referenceColumnValueForDisplay).getValue(); - } else { - display = null; - } - Map<String, String> values = referenceDatum.toJsonForFrontend(); - return new ApplicationResult.Reference.ReferenceUUIDAndDisplay(display, result.getId(), values); - }; - return findAllByReferenceType(referenceType).stream().collect(ImmutableMap.toImmutableMap(ReferenceValue::getHierarchicalKey, referenceValueToReferenceUuidAndDisplayFunction)); - } - public ImmutableMap<Ltree, UUID> getReferenceIdPerKeys(String referenceType) { return findAllByReferenceType(referenceType).stream().collect(ImmutableMap.toImmutableMap(ReferenceValue::getHierarchicalKey, ReferenceValue::getId)); } diff --git a/src/main/java/fr/inra/oresing/rest/ApplicationResult.java b/src/main/java/fr/inra/oresing/rest/ApplicationResult.java index c792940ab..49821480c 100644 --- a/src/main/java/fr/inra/oresing/rest/ApplicationResult.java +++ b/src/main/java/fr/inra/oresing/rest/ApplicationResult.java @@ -5,7 +5,6 @@ import lombok.Value; import java.util.Map; import java.util.Set; -import java.util.UUID; @Value public class ApplicationResult { @@ -31,13 +30,6 @@ public class ApplicationResult { boolean key; String linkedTo; } - - @Value - public static class ReferenceUUIDAndDisplay { - String display; - UUID uuid; - Map<String, String> values; - } } @Value -- GitLab From dd08cc4e27494d3375a68fba0c8602d6ec400f49 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Mon, 21 Mar 2022 15:58:36 +0100 Subject: [PATCH 06/41] Factorise l'instanciation des checkers --- .../inra/oresing/checker/CheckerFactory.java | 72 +++++-------------- 1 file changed, 17 insertions(+), 55 deletions(-) diff --git a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java index e43bc839d..e81f2f374 100644 --- a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java +++ b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java @@ -73,7 +73,12 @@ public class CheckerFactory { String variable = variableEntry.getKey(); Configuration.ColumnDescription variableDescription = variableEntry.getValue(); for (Map.Entry<String, Configuration.VariableComponentDescription> componentEntry : variableDescription.getComponents().entrySet()) { - parseVariableComponentdescription(app, dataType, checkersBuilder, variable, variableDescription, componentEntry); + String component = componentEntry.getKey(); + VariableComponentKey variableComponentKey = new VariableComponentKey(variable, component); + Configuration.VariableComponentDescription variableComponentDescription = componentEntry.getValue(); + Optional.ofNullable(variableComponentDescription.getChecker()) + .map(checkerDescription -> newChecker(app, checkerDescription, variableComponentKey)) + .ifPresent(checkersBuilder::add); } } addCheckersFromLineValidationDescriptions(app, dataTypeDescription.getValidations(), checkersBuilder, Type.DATATYPE.getParam()); //Configuration.DataTypeDescription dataTypeDescription, @@ -84,52 +89,6 @@ public class CheckerFactory { return lineCheckers; } - private void parseVariableComponentdescription(Application app, String dataType, ImmutableSet.Builder<LineChecker> checkersBuilder, String variable, Configuration.ColumnDescription variableDescription, Map.Entry<String, Configuration.VariableComponentDescription> componentEntry) { - String component = componentEntry.getKey(); - VariableComponentKey variableComponentKey = new VariableComponentKey(variable, component); - if (variableDescription.getComponents().get(component) == null) { - if (log.isDebugEnabled()) { - //log.debug("pas de règle de validation pour " + variableComponentKey); - } - } else { - Configuration.CheckerDescription checkerDescription = variableDescription.getComponents().get(component).getChecker(); - CheckerOnOneVariableComponentLineChecker variableComponentChecker; - LineTransformer transformer = Optional.ofNullable(checkerDescription.getParams()) - .map(transformationConfiguration -> transformerFactory.newTransformer(transformationConfiguration, app, variableComponentKey)) - .orElseGet(transformerFactory::getNullTransformer); - if ("Reference".equals(checkerDescription.getName())) { - variableComponentChecker = getCheckerOnReferenceChecker(app, checkerDescription, variableComponentKey, transformer); - } else { - final Configuration.CheckerConfigurationDescription configuration = checkerDescription.getParams(); - if ("Date".equals(checkerDescription.getName())) { - String pattern = configuration.getPattern(); - variableComponentChecker = new DateLineChecker(variableComponentKey, pattern, configuration, transformer); - } else if ("Integer".equals(checkerDescription.getName())) { - Preconditions.checkState(configuration == null || !configuration.isCodify(), "codify avec checker " + checkerDescription.getName() + " sur le composant " + component + " de la variable " + variable + " du type de données " + dataType + " de l'application " + app.getName()); - variableComponentChecker = new IntegerChecker(variableComponentKey, configuration, transformer); - } else if ("Float".equals(checkerDescription.getName())) { - Preconditions.checkState(configuration == null || !configuration.isCodify(), "codify avec checker " + checkerDescription.getName() + " sur le composant " + component + " de la variable " + variable + " du type de données " + dataType + " de l'application " + app.getName()); - variableComponentChecker = new FloatChecker(variableComponentKey, configuration, transformer); - } else if ("RegularExpression".equals(checkerDescription.getName())) { - String pattern = configuration.getPattern(); - variableComponentChecker = new RegularExpressionChecker(variableComponentKey, pattern, configuration, transformer); - } else { - throw new IllegalArgumentException("checker inconnu " + checkerDescription.getName()); - } - } - Preconditions.checkState(variableComponentChecker.getTarget().equals(variableComponentKey)); - checkersBuilder.add(variableComponentChecker); - } - } - - private CheckerOnOneVariableComponentLineChecker getCheckerOnReferenceChecker(Application app, Configuration.CheckerDescription checkerDescription, CheckerTarget checkerTarget, LineTransformer transformer) { - String refType = checkerDescription.getParams().getRefType(); - ReferenceValueRepository referenceValueRepository = repository.getRepository(app).referenceValue(); - ImmutableMap<Ltree, UUID> referenceValues = referenceValueRepository.getReferenceIdPerKeys(refType); - CheckerOnOneVariableComponentLineChecker variableComponentChecker = new ReferenceLineChecker(checkerTarget, refType, referenceValues, checkerDescription.getParams(), transformer); - return variableComponentChecker; - } - private void addCheckersFromLineValidationDescriptions(Application app, LinkedHashMap<String, Configuration.LineValidationRuleDescription> lineValidationDescriptions, ImmutableSet.Builder<LineChecker> checkersBuilder, String param) { ReferenceValueRepository referenceValueRepository = repository.getRepository(app).referenceValue(); DataRepository dataRepository = repository.getRepository(app).data(); @@ -162,31 +121,34 @@ public class CheckerFactory { } private CheckerOnOneVariableComponentLineChecker newChecker(Application app, Configuration.CheckerDescription checkerDescription, CheckerTarget target) { - LineTransformer transformer = transformerFactory.newTransformer(checkerDescription.getParams(), app, target); - Configuration.CheckerConfigurationDescription checkerConfigurationDescription = checkerDescription.getParams(); + Configuration.CheckerConfigurationDescription configuration = checkerDescription.getParams(); + LineTransformer transformer = Optional.ofNullable(configuration) + .map(transformationConfiguration -> transformerFactory.newTransformer(transformationConfiguration, app, target)) + .orElseGet(transformerFactory::getNullTransformer); CheckerOnOneVariableComponentLineChecker lineChecker; switch (checkerDescription.getName()) { case "Date": - lineChecker = new DateLineChecker(target, checkerConfigurationDescription.getPattern(), checkerConfigurationDescription, transformer); + lineChecker = new DateLineChecker(target, configuration.getPattern(), configuration, transformer); break; case "Integer": - lineChecker = new IntegerChecker(target, checkerConfigurationDescription, transformer); + lineChecker = new IntegerChecker(target, configuration, transformer); break; case "Float": - lineChecker = new FloatChecker(target, checkerConfigurationDescription, transformer); + lineChecker = new FloatChecker(target, configuration, transformer); break; case "RegularExpression": - lineChecker = new RegularExpressionChecker(target, checkerConfigurationDescription.getPattern(), checkerConfigurationDescription, transformer); + lineChecker = new RegularExpressionChecker(target, configuration.getPattern(), configuration, transformer); break; case "Reference": - String refType = checkerConfigurationDescription.getRefType(); + String refType = configuration.getRefType(); ReferenceValueRepository referenceValueRepository = repository.getRepository(app).referenceValue(); ImmutableMap<Ltree, UUID> referenceValues = referenceValueRepository.getReferenceIdPerKeys(refType); - lineChecker = new ReferenceLineChecker(target, refType, referenceValues, checkerConfigurationDescription, transformer); + lineChecker = new ReferenceLineChecker(target, refType, referenceValues, configuration, transformer); break; default: throw new IllegalArgumentException("checker inconnu " + checkerDescription.getName()); } + Preconditions.checkState(lineChecker.getTarget().equals(target)); return lineChecker; } -- GitLab From e4bdddfd35618938abddd934d6e30566c0cdecc7 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Mon, 21 Mar 2022 16:00:51 +0100 Subject: [PATCH 07/41] Supprime du code mort --- .../inra/oresing/checker/CheckerFactory.java | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java index e81f2f374..63401e40e 100644 --- a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java +++ b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java @@ -57,7 +57,7 @@ public class CheckerFactory { Preconditions.checkArgument(app.getConfiguration().getReferences().containsKey(reference), "Pas de référence " + reference + " dans " + app); Configuration.ReferenceDescription referenceDescription = app.getConfiguration().getReferences().get(reference); ImmutableSet.Builder<LineChecker> checkersBuilder = ImmutableSet.builder(); - addCheckersFromLineValidationDescriptions(app, referenceDescription.getValidations(), checkersBuilder, Type.REFERENCE.getParam()); //Configuration.DataTypeDescription dataTypeDescription, + addCheckersFromLineValidationDescriptions(app, referenceDescription.getValidations(), checkersBuilder); //Configuration.DataTypeDescription dataTypeDescription, ImmutableSet<LineChecker> lineCheckers = checkersBuilder.build(); if (log.isTraceEnabled()) { log.trace("pour " + app.getName() + ", " + reference + ", on validera avec " + lineCheckers); @@ -81,7 +81,7 @@ public class CheckerFactory { .ifPresent(checkersBuilder::add); } } - addCheckersFromLineValidationDescriptions(app, dataTypeDescription.getValidations(), checkersBuilder, Type.DATATYPE.getParam()); //Configuration.DataTypeDescription dataTypeDescription, + addCheckersFromLineValidationDescriptions(app, dataTypeDescription.getValidations(), checkersBuilder); //Configuration.DataTypeDescription dataTypeDescription, ImmutableSet<LineChecker> lineCheckers = checkersBuilder.build(); if (log.isTraceEnabled()) { log.trace("pour " + app.getName() + ", " + dataType + ", on validera avec " + lineCheckers); @@ -89,7 +89,7 @@ public class CheckerFactory { return lineCheckers; } - private void addCheckersFromLineValidationDescriptions(Application app, LinkedHashMap<String, Configuration.LineValidationRuleDescription> lineValidationDescriptions, ImmutableSet.Builder<LineChecker> checkersBuilder, String param) { + private void addCheckersFromLineValidationDescriptions(Application app, LinkedHashMap<String, Configuration.LineValidationRuleDescription> lineValidationDescriptions, ImmutableSet.Builder<LineChecker> checkersBuilder) { ReferenceValueRepository referenceValueRepository = repository.getRepository(app).referenceValue(); DataRepository dataRepository = repository.getRepository(app).data(); for (Map.Entry<String, Configuration.LineValidationRuleDescription> validationEntry : lineValidationDescriptions.entrySet()) { @@ -151,18 +151,4 @@ public class CheckerFactory { Preconditions.checkState(lineChecker.getTarget().equals(target)); return lineChecker; } - - enum Type { - REFERENCE(COLUMNS), DATATYPE(VARIABLE_COMPONENT_KEY); - - private final String param; - - Type(String requiredAttributeForCheckerOnOneVariableComponentLineChecker) { - this.param = requiredAttributeForCheckerOnOneVariableComponentLineChecker; - } - - public String getParam() { - return param; - } - } } \ No newline at end of file -- GitLab From 96d9bd606e6c6f6c9e2dec243aae2d23a307908d Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Mon, 21 Mar 2022 16:35:52 +0100 Subject: [PATCH 08/41] =?UTF-8?q?=C3=89vite=20d'avoir=20un=20checker=20ave?= =?UTF-8?q?c=20params=20null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/fr/inra/oresing/checker/CheckerFactory.java | 4 +--- .../java/fr/inra/oresing/model/Configuration.java | 11 ++++------- .../oresing/rest/ApplicationConfigurationService.java | 6 +++--- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java index 63401e40e..939cff48c 100644 --- a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java +++ b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java @@ -122,9 +122,7 @@ public class CheckerFactory { private CheckerOnOneVariableComponentLineChecker newChecker(Application app, Configuration.CheckerDescription checkerDescription, CheckerTarget target) { Configuration.CheckerConfigurationDescription configuration = checkerDescription.getParams(); - LineTransformer transformer = Optional.ofNullable(configuration) - .map(transformationConfiguration -> transformerFactory.newTransformer(transformationConfiguration, app, target)) - .orElseGet(transformerFactory::getNullTransformer); + LineTransformer transformer = transformerFactory.newTransformer(configuration, app, target); CheckerOnOneVariableComponentLineChecker lineChecker; switch (checkerDescription.getName()) { case "Date": diff --git a/src/main/java/fr/inra/oresing/model/Configuration.java b/src/main/java/fr/inra/oresing/model/Configuration.java index 75e03818f..dd5e84e5f 100644 --- a/src/main/java/fr/inra/oresing/model/Configuration.java +++ b/src/main/java/fr/inra/oresing/model/Configuration.java @@ -25,9 +25,9 @@ import fr.inra.oresing.model.internationalization.InternationalizationReferenceM import lombok.Getter; import lombok.Setter; import lombok.ToString; +import org.apache.commons.lang3.StringUtils; import org.assertj.core.util.Streams; import org.springframework.util.CollectionUtils; -import org.springframework.util.StringUtils; import javax.annotation.Nullable; import java.util.Collection; @@ -93,11 +93,8 @@ public class Configuration { for (Map.Entry<String, LineValidationRuleDescription> validation : validations.entrySet()) { CheckerDescription checker = validation.getValue().getChecker(); if (checker != null) { - String refType = Optional.of(checker) - .map(CheckerDescription::getParams) - .map(CheckerConfigurationDescription::getRefType) - .orElse(null); - if ("Reference".equals(checker.getName()) && refType != null) { + String refType = checker.getParams().getRefType(); + if ("Reference".equals(checker.getName()) && StringUtils.isNotEmpty(refType)) { DependencyNode node = nodes.computeIfAbsent(refType, k -> new DependencyNode(refType)); dependencyNode.addDependance(node); } @@ -366,7 +363,7 @@ public class Configuration { @ToString public static class CheckerDescription { String name; - CheckerConfigurationDescription params; + CheckerConfigurationDescription params = new CheckerConfigurationDescription(); } @Getter diff --git a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java index 36a5296b0..04724d83b 100644 --- a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java +++ b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java @@ -357,7 +357,7 @@ public class ApplicationConfigurationService { builder.recordTimeScopeVariableComponentWrongChecker(timeScopeVariableComponentKey, "Date"); } Optional.ofNullable(timeScopeVariableComponentChecker) - .map(checkerDescription -> checkerDescription.getParams()) + .map(Configuration.CheckerDescription::getParams) .map(Configuration.CheckerConfigurationDescription::getPattern) .ifPresent(pattern -> { if (!LocalDateTimeRange.getKnownPatterns().contains(pattern)) { @@ -427,7 +427,7 @@ public class ApplicationConfigurationService { if (variableComponentDescription != null) { Configuration.CheckerDescription checkerDescription = variableComponentDescription.getChecker(); if ("Reference".equals(checkerDescription.getName())) { - if (checkerDescription.getParams() != null && checkerDescription.getParams().getRefType() != null) { + if (checkerDescription.getParams().getRefType() != null) { String refType = checkerDescription.getParams().getRefType(); if (!references.contains(refType)) { builder.unknownReferenceForChecker(dataType, datum, component, refType, references); @@ -610,7 +610,7 @@ public class ApplicationConfigurationService { } } if ("Reference".equals(checker.getName())) { - if (checker.getParams() != null && checker.getParams().getRefType() != null) { + if (checker.getParams().getRefType() != null) { String refType = checker.getParams().getRefType(); if (!references.contains(refType)) { builder.unknownReferenceForCheckerInReference(validationRuleDescriptionEntryKey, reference, refType, references); -- GitLab From cee040e4a9b08e085531b992b07d130980ad5a7c Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Wed, 23 Mar 2022 10:59:22 +0100 Subject: [PATCH 09/41] Corrige NPE --- src/main/java/fr/inra/oresing/checker/CheckerFactory.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java index 939cff48c..e5bfa9f58 100644 --- a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java +++ b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java @@ -75,8 +75,8 @@ public class CheckerFactory { for (Map.Entry<String, Configuration.VariableComponentDescription> componentEntry : variableDescription.getComponents().entrySet()) { String component = componentEntry.getKey(); VariableComponentKey variableComponentKey = new VariableComponentKey(variable, component); - Configuration.VariableComponentDescription variableComponentDescription = componentEntry.getValue(); - Optional.ofNullable(variableComponentDescription.getChecker()) + Optional.ofNullable(componentEntry.getValue()) + .map(Configuration.VariableComponentDescription::getChecker) .map(checkerDescription -> newChecker(app, checkerDescription, variableComponentKey)) .ifPresent(checkersBuilder::add); } -- GitLab From 7b77caf43a224c99c02be383ae58414739f8f0a7 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Wed, 23 Mar 2022 11:12:55 +0100 Subject: [PATCH 10/41] Corrige NPE --- src/main/java/fr/inra/oresing/checker/CheckerFactory.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java index e5bfa9f58..60f38b902 100644 --- a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java +++ b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java @@ -1,5 +1,6 @@ package fr.inra.oresing.checker; +import com.google.common.base.MoreObjects; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -121,7 +122,11 @@ public class CheckerFactory { } private CheckerOnOneVariableComponentLineChecker newChecker(Application app, Configuration.CheckerDescription checkerDescription, CheckerTarget target) { - Configuration.CheckerConfigurationDescription configuration = checkerDescription.getParams(); + Configuration.CheckerConfigurationDescription configuration = + MoreObjects.firstNonNull( + checkerDescription.getParams(), + new Configuration.CheckerConfigurationDescription() + ); LineTransformer transformer = transformerFactory.newTransformer(configuration, app, target); CheckerOnOneVariableComponentLineChecker lineChecker; switch (checkerDescription.getName()) { -- GitLab From 1b2b8be63e856458afd2e38c0cfbfae7486f3dbf Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Wed, 23 Mar 2022 11:37:16 +0100 Subject: [PATCH 11/41] Corrige NPE --- .../fr/inra/oresing/rest/ApplicationConfigurationService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java index 04724d83b..d920df90b 100644 --- a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java +++ b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java @@ -427,7 +427,7 @@ public class ApplicationConfigurationService { if (variableComponentDescription != null) { Configuration.CheckerDescription checkerDescription = variableComponentDescription.getChecker(); if ("Reference".equals(checkerDescription.getName())) { - if (checkerDescription.getParams().getRefType() != null) { + if (checkerDescription.getParams() != null && checkerDescription.getParams().getRefType() != null) { String refType = checkerDescription.getParams().getRefType(); if (!references.contains(refType)) { builder.unknownReferenceForChecker(dataType, datum, component, refType, references); -- GitLab From 5d3b52fe944581705efb45c50a08eecc545a9de6 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Wed, 23 Mar 2022 16:32:07 +0100 Subject: [PATCH 12/41] =?UTF-8?q?R=C3=A9tulise=20la=20structure=20de=20con?= =?UTF-8?q?figuration=20expression=20groovy=20+=20param=C3=A8tres=20pour?= =?UTF-8?q?=20defaultValue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Documentation_fichier_Yaml.md | 8 +- .../fr/inra/oresing/model/Configuration.java | 6 +- .../fr/inra/oresing/rest/OreSiService.java | 24 +- src/test/resources/data/acbb/acbb.yaml | 95 ++-- .../resources/data/foret/foret_essai.yaml | 448 ++++++++++++------ .../data/foret/multiyaml/configuration.yaml | 60 ++- .../foret/multiyaml/dataTypes/smp_infraj.yaml | 20 +- .../foret/multiyaml/dataTypes/ts_infraj.yaml | 20 +- .../data/monsore/monsore-with-repository.yaml | 31 +- src/test/resources/data/monsore/monsore.yaml | 31 +- src/test/resources/data/olac/olac.yaml | 5 +- 11 files changed, 478 insertions(+), 270 deletions(-) diff --git a/Documentation_fichier_Yaml.md b/Documentation_fichier_Yaml.md index 48a9a0149..65a5e0cce 100644 --- a/Documentation_fichier_Yaml.md +++ b/Documentation_fichier_Yaml.md @@ -392,8 +392,9 @@ On décrit un format pour stocker les données sous la forment components: datetime: #calcul d'une valeur par défaut date+time avec une expression groovy - defaultValue: > - return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" + defaultValue: + expression: > + return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" day: checker: name: Date @@ -747,7 +748,8 @@ On declare cette variable dans la section data params: required: false unit: - defaultValue: return "percentage" + defaultValue: + expression: return "percentage" checker: name: Reference params: diff --git a/src/main/java/fr/inra/oresing/model/Configuration.java b/src/main/java/fr/inra/oresing/model/Configuration.java index dd5e84e5f..1791e065a 100644 --- a/src/main/java/fr/inra/oresing/model/Configuration.java +++ b/src/main/java/fr/inra/oresing/model/Configuration.java @@ -345,14 +345,14 @@ public class Configuration { public static class VariableComponentDescription { CheckerDescription checker; @Nullable - String defaultValue; - VariableComponentDescriptionConfiguration params; + VariableComponentDefaultValueDescription defaultValue; } @Getter @Setter @ToString - public static class VariableComponentDescriptionConfiguration implements GroovyDataInjectionConfiguration { + public static class VariableComponentDefaultValueDescription implements fr.inra.oresing.checker.GroovyConfiguration { + String expression; Set<String> references = new LinkedHashSet<>(); Set<String> datatypes = new LinkedHashSet<>(); boolean replace; diff --git a/src/main/java/fr/inra/oresing/rest/OreSiService.java b/src/main/java/fr/inra/oresing/rest/OreSiService.java index 9793236aa..efce5eb40 100644 --- a/src/main/java/fr/inra/oresing/rest/OreSiService.java +++ b/src/main/java/fr/inra/oresing/rest/OreSiService.java @@ -836,12 +836,12 @@ public class OreSiService { for (Map.Entry<VariableComponentKey, Expression<String>> entry : defaultValueExpressions.entrySet()) { VariableComponentKey variableComponentKey = entry.getKey(); Expression<String> expression = entry.getValue(); - Configuration.VariableComponentDescriptionConfiguration params = Optional.ofNullable(data) + Configuration.VariableComponentDefaultValueDescription params = Optional.ofNullable(data) .map(columnDescriptionLinkedHashMap -> columnDescriptionLinkedHashMap.get(variableComponentKey.getVariable())) .map(columnDescription -> columnDescription.getComponents()) .map(variableComponentDescriptionLinkedHashMap -> variableComponentDescriptionLinkedHashMap.get(variableComponentKey.getComponent())) - .map(variableComponentDescription -> variableComponentDescription.getParams()) - .orElseGet(Configuration.VariableComponentDescriptionConfiguration::new); + .map(Configuration.VariableComponentDescription::getDefaultValue) + .orElseGet(Configuration.VariableComponentDefaultValueDescription::new); Set<String> configurationReferences = params.getReferences(); ImmutableMap<String, Object> contextForExpression = groovyContextHelper.getGroovyContextForReferences(referenceValueRepository, configurationReferences); Preconditions.checkState(params.getDatatypes().isEmpty(), "à ce stade, on ne gère pas la chargement de données"); @@ -1129,17 +1129,13 @@ public class OreSiService { if (variableComponentsFromRepository.contains(variableComponentKey.getId())) { continue; } - Expression<String> defaultValueExpression; - if (componentDescription == null) { - defaultValueExpression = CommonExpression.EMPTY_STRING; - } else { - String defaultValue = componentDescription.getDefaultValue(); - if (StringUtils.isEmpty(defaultValue)) { - defaultValueExpression = CommonExpression.EMPTY_STRING; - } else { - defaultValueExpression = StringGroovyExpression.forExpression(defaultValue); - } - } + Expression<String> defaultValueExpression = Optional.ofNullable(componentDescription) + .map(Configuration.VariableComponentDescription::getDefaultValue) + .map(Configuration.VariableComponentDefaultValueDescription::getExpression) + .filter(StringUtils::isNotEmpty) + .map(StringGroovyExpression::forExpression) + .map(x -> (Expression<String>) x) + .orElse(CommonExpression.EMPTY_STRING); defaultValueExpressionsBuilder.put(variableComponentKey, defaultValueExpression); } } diff --git a/src/test/resources/data/acbb/acbb.yaml b/src/test/resources/data/acbb/acbb.yaml index 914b6522c..0326bc9ca 100644 --- a/src/test/resources/data/acbb/acbb.yaml +++ b/src/test/resources/data/acbb/acbb.yaml @@ -154,10 +154,11 @@ dataTypes: parcelle: components: chemin: - defaultValue: > - String site = datumByVariableAndComponent.get("site").get("chemin"); - String parcelle = datumByVariableAndComponent.get("parcelle").get("name"); - return site+"."+site+"__"+parcelle; + defaultValue: + expression: > + String site = datumByVariableAndComponent.get("site").get("chemin"); + String parcelle = datumByVariableAndComponent.get("parcelle").get("name"); + return site+"."+site+"__"+parcelle; checker: name: Reference params: @@ -178,7 +179,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"micromole_par_mole\"" + defaultValue: + expression: "\"micromole_par_mole\"" checker: name: Reference params: @@ -197,7 +199,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"millimole_par_mole\"" + defaultValue: + expression: "\"millimole_par_mole\"" checker: name: Reference params: @@ -216,7 +219,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"pas_d_unite\"" + defaultValue: + expression: "\"pas_d_unite\"" checker: name: Reference params: @@ -229,7 +233,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"micromole_par_mettre_carre_et_par_seconde\"" + defaultValue: + expression: "\"micromole_par_mettre_carre_et_par_seconde\"" checker: name: Reference params: @@ -247,7 +252,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"watt_par_metre_carre\"" + defaultValue: + expression: "\"watt_par_metre_carre\"" checker: name: Reference params: @@ -265,7 +271,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"watt_par_metre_carre\"" + defaultValue: + expression: "\"watt_par_metre_carre\"" checker: name: Reference params: @@ -283,7 +290,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"kilogramme_par_metre_et_par_seconde\"" + defaultValue: + expression: "\"kilogramme_par_metre_et_par_seconde\"" checker: name: Reference params: @@ -301,7 +309,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"metre_par_seconde\"" + defaultValue: + expression: "\"metre_par_seconde\"" checker: name: Reference params: @@ -319,7 +328,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"micromole_par_mettre_carre_et_par_seconde\"" + defaultValue: + expression: "\"micromole_par_mettre_carre_et_par_seconde\"" checker: name: Reference params: @@ -515,7 +525,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"gramme_par_kilo\"" + defaultValue: + expression: "\"gramme_par_kilo\"" checker: name: Reference params: @@ -548,7 +559,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"gramme_par_kilo\"" + defaultValue: + expression: "\"gramme_par_kilo\"" checker: name: Reference params: @@ -581,7 +593,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"pourcentage\"" + defaultValue: + expression: "\"pourcentage\"" checker: name: Reference params: @@ -614,7 +627,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"gramme_par_kilo\"" + defaultValue: + expression: "\"gramme_par_kilo\"" checker: name: Reference params: @@ -647,7 +661,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"gramme_par_kilo\"" + defaultValue: + expression: "\"gramme_par_kilo\"" checker: name: Reference params: @@ -680,7 +695,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"gramme_par_kilo\"" + defaultValue: + expression: "\"gramme_par_kilo\"" checker: name: Reference params: @@ -713,7 +729,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"gramme_par_kilo\"" + defaultValue: + expression: "\"gramme_par_kilo\"" checker: name: Reference params: @@ -746,7 +763,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"milligramme_par_kilogramme\"" + defaultValue: + expression: "\"milligramme_par_kilogramme\"" checker: name: Reference params: @@ -779,7 +797,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"milligramme_par_kilogramme\"" + defaultValue: + expression: "\"milligramme_par_kilogramme\"" checker: name: Reference params: @@ -812,7 +831,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"milligramme_par_kilogramme\"" + defaultValue: + expression: "\"milligramme_par_kilogramme\"" checker: name: Reference params: @@ -845,7 +865,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"milligramme_par_kilogramme\"" + defaultValue: + expression: "\"milligramme_par_kilogramme\"" checker: name: Reference params: @@ -878,7 +899,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"milligramme_par_kilogramme\"" + defaultValue: + expression: "\"milligramme_par_kilogramme\"" checker: name: Reference params: @@ -911,7 +933,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"gramme_par_kilo\"" + defaultValue: + expression: "\"gramme_par_kilo\"" checker: name: Reference params: @@ -944,7 +967,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"milligramme_par_kilogramme\"" + defaultValue: + expression: "\"milligramme_par_kilogramme\"" checker: name: Reference params: @@ -977,7 +1001,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"pourcentage\"" + defaultValue: + expression: "\"pourcentage\"" checker: name: Reference params: @@ -1010,7 +1035,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"pourcentage\"" + defaultValue: + expression: "\"pourcentage\"" checker: name: Reference params: @@ -1043,7 +1069,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"pourcentage\"" + defaultValue: + expression: "\"pourcentage\"" checker: name: Reference params: @@ -1526,8 +1553,9 @@ dataTypes: params: pattern: HH:mm:ss datetime: - defaultValue: > - return datumByVariableAndComponent.get("Date").get("day") +" " +datumByVariableAndComponent.get("Date").get("time") + defaultValue: + expression: > + return datumByVariableAndComponent.get("Date").get("day") +" " +datumByVariableAndComponent.get("Date").get("time") checker: name: Date params: @@ -1556,7 +1584,8 @@ dataTypes: params: required: false unite: - defaultValue: "\"pourcentage\"" + defaultValue: + expression: "\"pourcentage\"" checker: name: Reference params: diff --git a/src/test/resources/data/foret/foret_essai.yaml b/src/test/resources/data/foret/foret_essai.yaml index d0a61ce79..4937676e2 100644 --- a/src/test/resources/data/foret/foret_essai.yaml +++ b/src/test/resources/data/foret/foret_essai.yaml @@ -793,7 +793,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "climat du sol" + defaultValue: + expression: return "climat du sol" checker: name: Reference params: @@ -840,8 +841,9 @@ dataTypes: params: pattern: HH:mm datetime: - defaultValue: > - return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" + defaultValue: + expression: > + return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" checker: name: Date params: @@ -862,7 +864,8 @@ dataTypes: params: required: false unit: - defaultValue: return "degre celcius" + defaultValue: + expression: return "degre celcius" checker: name: Reference params: @@ -1028,7 +1031,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "climat du sol" + defaultValue: + expression: return "climat du sol" checker: name: Reference params: @@ -1075,8 +1079,9 @@ dataTypes: params: pattern: HH:mm datetime: - defaultValue: > - return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" + defaultValue: + expression: > + return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" checker: name: Date params: @@ -1097,7 +1102,8 @@ dataTypes: params: required: false unit: - defaultValue: return "kilopascal" + defaultValue: + expression: return "kilopascal" checker: name: Reference params: @@ -1263,7 +1269,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "climat du sol" + defaultValue: + expression: return "climat du sol" checker: name: Reference params: @@ -1310,8 +1317,9 @@ dataTypes: params: pattern: HH:mm datetime: - defaultValue: > - return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" + defaultValue: + expression: > + return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" checker: name: Date params: @@ -1332,7 +1340,8 @@ dataTypes: params: required: false unit: - defaultValue: return "mètre" + defaultValue: + expression: return "mètre" checker: name: Reference params: @@ -1498,7 +1507,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "climat du sol" + defaultValue: + expression: return "climat du sol" checker: name: Reference params: @@ -1545,8 +1555,9 @@ dataTypes: params: pattern: HH:mm datetime: - defaultValue: > - return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" + defaultValue: + expression: > + return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" checker: name: Date params: @@ -1567,7 +1578,8 @@ dataTypes: params: required: false unit: - defaultValue: return "watt_par_metre_carre" + defaultValue: + expression: return "watt_par_metre_carre" checker: name: Reference params: @@ -1733,7 +1745,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "climat du sol" + defaultValue: + expression: return "climat du sol" checker: name: Reference params: @@ -1780,8 +1793,9 @@ dataTypes: params: pattern: HH:mm datetime: - defaultValue: > - return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" + defaultValue: + expression: > + return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" checker: name: Date params: @@ -1802,7 +1816,8 @@ dataTypes: params: required: false unit: - defaultValue: return "percentage" + defaultValue: + expression: return "percentage" checker: name: Reference params: @@ -1968,7 +1983,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "climat du sol" + defaultValue: + expression: return "climat du sol" checker: name: Reference params: @@ -2024,7 +2040,8 @@ dataTypes: params: required: false unit: - defaultValue: return "degre celcius" + defaultValue: + expression: return "degre celcius" checker: name: Reference params: @@ -2186,7 +2203,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "climat du sol" + defaultValue: + expression: return "climat du sol" checker: name: Reference params: @@ -2242,7 +2260,8 @@ dataTypes: params: required: false unit: - defaultValue: return "kilopascal" + defaultValue: + expression: return "kilopascal" checker: name: Reference params: @@ -2404,7 +2423,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "climat du sol" + defaultValue: + expression: return "climat du sol" checker: name: Reference params: @@ -2460,7 +2480,8 @@ dataTypes: params: required: false unit: - defaultValue: return "mètre" + defaultValue: + expression: return "mètre" checker: name: Reference params: @@ -2622,7 +2643,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "climat du sol" + defaultValue: + expression: return "climat du sol" checker: name: Reference params: @@ -2678,7 +2700,8 @@ dataTypes: params: required: false unit: - defaultValue: return "watt_par_metre_carre" + defaultValue: + expression: return "watt_par_metre_carre" checker: name: Reference params: @@ -2840,7 +2863,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "climat du sol" + defaultValue: + expression: return "climat du sol" checker: name: Reference params: @@ -2896,7 +2920,8 @@ dataTypes: params: required: false unit: - defaultValue: return "percentage" + defaultValue: + expression: return "percentage" checker: name: Reference params: @@ -3059,7 +3084,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "flux gazeux" + defaultValue: + expression: return "flux gazeux" checker: name: Reference params: @@ -3111,8 +3137,9 @@ dataTypes: checker: name: Integer datetime: - defaultValue: > - return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" + defaultValue: + expression: > + return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" checker: name: Date params: @@ -3131,7 +3158,8 @@ dataTypes: params: required: null unit: - defaultValue: return "micromole par mètre carré et par seconde" + defaultValue: + expression: return "micromole par mètre carré et par seconde" checker: name: Reference params: @@ -3151,7 +3179,8 @@ dataTypes: params: required: null unit: - defaultValue: return "nanomole par mètre carré et par seconde" + defaultValue: + expression: return "nanomole par mètre carré et par seconde" checker: name: Reference params: @@ -3305,7 +3334,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "flux gazeux" + defaultValue: + expression: return "flux gazeux" checker: name: Reference params: @@ -3376,7 +3406,8 @@ dataTypes: params: required: null unit: - defaultValue: return "micromole par mètre carré et par seconde" + defaultValue: + expression: return "micromole par mètre carré et par seconde" checker: name: Reference params: @@ -3396,7 +3427,8 @@ dataTypes: params: required: null unit: - defaultValue: return "micromole par mole" + defaultValue: + expression: return "micromole par mole" checker: name: Reference params: @@ -3553,7 +3585,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "flux gazeux" + defaultValue: + expression: return "flux gazeux" checker: name: Reference params: @@ -3614,7 +3647,8 @@ dataTypes: params: required: null unit: - defaultValue: return "micromole par mètre carré et par seconde" + defaultValue: + expression: return "micromole par mètre carré et par seconde" checker: name: Reference params: @@ -3768,7 +3802,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "Tour à flux" + defaultValue: + expression: return "Tour à flux" checker: name: Reference params: @@ -3805,8 +3840,9 @@ dataTypes: params: pattern: HH:mm datetime: - defaultValue: > - return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" + defaultValue: + expression: > + return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" checker: name: Date params: @@ -3820,7 +3856,8 @@ dataTypes: params: required: null unit: - defaultValue: return "micromole par mole" + defaultValue: + expression: return "micromole par mole" checker: name: Reference params: @@ -3835,7 +3872,8 @@ dataTypes: params: required: null unit: - defaultValue: return "micromole par mole" + defaultValue: + expression: return "micromole par mole" checker: name: Reference params: @@ -3850,7 +3888,8 @@ dataTypes: params: required: null unit: - defaultValue: return "sans unité" + defaultValue: + expression: return "sans unité" checker: name: Reference params: @@ -3872,7 +3911,8 @@ dataTypes: required: true codify: false unit: - defaultValue: return "micromole par mètre carré et par seconde" + defaultValue: + expression: return "micromole par mètre carré et par seconde" checker: name: Reference params: @@ -3894,7 +3934,8 @@ dataTypes: required: true codify: false unit: - defaultValue: return "watt par mètre carré" + defaultValue: + expression: return "watt par mètre carré" checker: name: Reference params: @@ -3916,7 +3957,8 @@ dataTypes: required: true codify: false unit: - defaultValue: return "watt par mètre carré" + defaultValue: + expression: return "watt par mètre carré" checker: name: Reference params: @@ -3938,7 +3980,8 @@ dataTypes: required: true codify: false unit: - defaultValue: return "kilogramme par mètre et par seconde" + defaultValue: + expression: return "kilogramme par mètre et par seconde" checker: name: Reference params: @@ -3953,7 +3996,8 @@ dataTypes: params: required: true unit: - defaultValue: return "mètre par seconde" + defaultValue: + expression: return "mètre par seconde" checker: name: Reference params: @@ -3968,7 +4012,8 @@ dataTypes: params: required: true unit: - defaultValue: return "millimètre par demi-heure" + defaultValue: + expression: return "millimètre par demi-heure" checker: name: Reference params: @@ -3983,7 +4028,8 @@ dataTypes: params: required: null unit: - defaultValue: return "watt par mètre carré" + defaultValue: + expression: return "watt par mètre carré" checker: name: Reference params: @@ -3998,7 +4044,8 @@ dataTypes: params: required: null unit: - defaultValue: return "micromole par mètre carré et par seconde" + defaultValue: + expression: return "micromole par mètre carré et par seconde" checker: name: Reference params: @@ -4013,7 +4060,8 @@ dataTypes: params: required: null unit: - defaultValue: return "watt par mètre carré" + defaultValue: + expression: return "watt par mètre carré" checker: name: Reference params: @@ -4028,7 +4076,8 @@ dataTypes: params: required: null unit: - defaultValue: return "watt par mètre carré" + defaultValue: + expression: return "watt par mètre carré" checker: name: Reference params: @@ -4043,7 +4092,8 @@ dataTypes: params: required: null unit: - defaultValue: return "micromole par mètre carré et par seconde" + defaultValue: + expression: return "micromole par mètre carré et par seconde" checker: name: Reference params: @@ -4253,7 +4303,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "Tour à flux" + defaultValue: + expression: return "Tour à flux" checker: name: Reference params: @@ -4292,7 +4343,8 @@ dataTypes: params: required: null unit: - defaultValue: return "micromole par mole" + defaultValue: + expression: return "micromole par mole" checker: name: Reference params: @@ -4307,7 +4359,8 @@ dataTypes: params: required: null unit: - defaultValue: return "millimole par mole" + defaultValue: + expression: return "millimole par mole" checker: name: Reference params: @@ -4322,7 +4375,8 @@ dataTypes: params: required: null unit: - defaultValue: return "sans unité" + defaultValue: + expression: return "sans unité" checker: name: Reference params: @@ -4337,7 +4391,8 @@ dataTypes: params: required: null unit: - defaultValue: return "gramme de carbone par mètre carré et par jour" + defaultValue: + expression: return "gramme de carbone par mètre carré et par jour" checker: name: Reference params: @@ -4352,7 +4407,8 @@ dataTypes: params: required: null unit: - defaultValue: return "mégajoule par mètre et par jour" + defaultValue: + expression: return "mégajoule par mètre et par jour" checker: name: Reference params: @@ -4367,7 +4423,8 @@ dataTypes: params: required: true unit: - defaultValue: return "mégajoule par mètre et par jour" + defaultValue: + expression: return "mégajoule par mètre et par jour" checker: name: Reference params: @@ -4382,7 +4439,8 @@ dataTypes: params: required: true unit: - defaultValue: return "kilogramme par mètre et par seconde" + defaultValue: + expression: return "kilogramme par mètre et par seconde" checker: name: Reference params: @@ -4397,7 +4455,8 @@ dataTypes: params: required: true unit: - defaultValue: return "mètre par seconde" + defaultValue: + expression: return "mètre par seconde" checker: name: Reference params: @@ -4412,7 +4471,8 @@ dataTypes: params: required: true unit: - defaultValue: return "millilitre par jour" + defaultValue: + expression: return "millilitre par jour" checker: name: Reference params: @@ -4427,7 +4487,8 @@ dataTypes: params: required: null unit: - defaultValue: return "mégajoule par mètre et par jour" + defaultValue: + expression: return "mégajoule par mètre et par jour" checker: name: Reference params: @@ -4442,7 +4503,8 @@ dataTypes: params: required: null unit: - defaultValue: return "gramme de carbone par mètre carré et par jour" + defaultValue: + expression: return "gramme de carbone par mètre carré et par jour" checker: name: Reference params: @@ -4457,7 +4519,8 @@ dataTypes: params: required: null unit: - defaultValue: return "mégajoule par mètre et par jour" + defaultValue: + expression: return "mégajoule par mètre et par jour" checker: name: Reference params: @@ -4472,7 +4535,8 @@ dataTypes: params: required: null unit: - defaultValue: return "mégajoule par mètre et par jour" + defaultValue: + expression: return "mégajoule par mètre et par jour" checker: name: Reference params: @@ -4487,7 +4551,8 @@ dataTypes: params: required: null unit: - defaultValue: return "gramme de carbone par mètre carré et par jour" + defaultValue: + expression: return "gramme de carbone par mètre carré et par jour" checker: name: Reference params: @@ -4677,7 +4742,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "Tour à flux" + defaultValue: + expression: return "Tour à flux" checker: name: Reference params: @@ -4716,7 +4782,8 @@ dataTypes: params: required: null unit: - defaultValue: return "micromole par mole" + defaultValue: + expression: return "micromole par mole" checker: name: Reference params: @@ -4731,7 +4798,8 @@ dataTypes: params: required: null unit: - defaultValue: return "millimole par mole" + defaultValue: + expression: return "millimole par mole" checker: name: Reference params: @@ -4746,7 +4814,8 @@ dataTypes: params: required: null unit: - defaultValue: return "sans unité" + defaultValue: + expression: return "sans unité" checker: name: Reference params: @@ -4761,7 +4830,8 @@ dataTypes: params: required: null unit: - defaultValue: return "gramme de carbone par mètre carré et par mois" + defaultValue: + expression: return "gramme de carbone par mètre carré et par mois" checker: name: Reference params: @@ -4776,7 +4846,8 @@ dataTypes: params: required: null unit: - defaultValue: return "mégajoule par mètre et par mois" + defaultValue: + expression: return "mégajoule par mètre et par mois" checker: name: Reference params: @@ -4791,7 +4862,8 @@ dataTypes: params: required: true unit: - defaultValue: return "mégajoule par mètre et par mois" + defaultValue: + expression: return "mégajoule par mètre et par mois" checker: name: Reference params: @@ -4806,7 +4878,8 @@ dataTypes: params: required: true unit: - defaultValue: return "kilogramme par mètre et par seconde" + defaultValue: + expression: return "kilogramme par mètre et par seconde" checker: name: Reference params: @@ -4821,7 +4894,8 @@ dataTypes: params: required: true unit: - defaultValue: return "mètre par seconde" + defaultValue: + expression: return "mètre par seconde" checker: name: Reference params: @@ -4836,7 +4910,8 @@ dataTypes: params: required: true unit: - defaultValue: return "litre par mois" + defaultValue: + expression: return "litre par mois" checker: name: Reference params: @@ -4851,7 +4926,8 @@ dataTypes: params: required: null unit: - defaultValue: return "mégajoule par mètre et par mois" + defaultValue: + expression: return "mégajoule par mètre et par mois" checker: name: Reference params: @@ -4866,7 +4942,8 @@ dataTypes: params: required: null unit: - defaultValue: return "gramme de carbone par mètre carré et par mois" + defaultValue: + expression: return "gramme de carbone par mètre carré et par mois" checker: name: Reference params: @@ -4881,7 +4958,8 @@ dataTypes: params: required: null unit: - defaultValue: return "mégajoule par mètre et par mois" + defaultValue: + expression: return "mégajoule par mètre et par mois" checker: name: Reference params: @@ -4896,7 +4974,8 @@ dataTypes: params: required: null unit: - defaultValue: return "mégajoule par mètre et par mois" + defaultValue: + expression: return "mégajoule par mètre et par mois" checker: name: Reference params: @@ -4911,7 +4990,8 @@ dataTypes: params: required: null unit: - defaultValue: return "gramme de carbone par mètre carré et par mois" + defaultValue: + expression: return "gramme de carbone par mètre carré et par mois" checker: name: Reference params: @@ -5107,7 +5187,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "meteorologie" + defaultValue: + expression: return "meteorologie" checker: name: Reference params: @@ -5144,8 +5225,9 @@ dataTypes: params: pattern: HH:mm datetime: - defaultValue: > - return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" + defaultValue: + expression: > + return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" checker: name: Date params: @@ -5159,7 +5241,8 @@ dataTypes: params: required: null unit: - defaultValue: return "millimètre" + defaultValue: + expression: return "millimètre" checker: name: Reference params: @@ -5174,7 +5257,8 @@ dataTypes: params: required: null unit: - defaultValue: return "watt par mètre carré" + defaultValue: + expression: return "watt par mètre carré" checker: name: Reference params: @@ -5189,7 +5273,8 @@ dataTypes: params: required: null unit: - defaultValue: return "watt par mètre carré" + defaultValue: + expression: return "watt par mètre carré" checker: name: Reference params: @@ -5204,7 +5289,8 @@ dataTypes: params: required: null unit: - defaultValue: return "watt par mètre carré" + defaultValue: + expression: return "watt par mètre carré" checker: name: Reference params: @@ -5219,7 +5305,8 @@ dataTypes: params: required: null unit: - defaultValue: return "watt par mètre carré" + defaultValue: + expression: return "watt par mètre carré" checker: name: Reference params: @@ -5234,7 +5321,8 @@ dataTypes: params: required: true unit: - defaultValue: return "watt par mètre carré" + defaultValue: + expression: return "watt par mètre carré" checker: name: Reference params: @@ -5249,7 +5337,8 @@ dataTypes: params: required: true unit: - defaultValue: return "watt par mètre carré" + defaultValue: + expression: return "watt par mètre carré" checker: name: Reference params: @@ -5264,7 +5353,8 @@ dataTypes: params: required: true unit: - defaultValue: return "micromole par mètre carré et par seconde" + defaultValue: + expression: return "micromole par mètre carré et par seconde" checker: name: Reference params: @@ -5279,7 +5369,8 @@ dataTypes: params: required: true unit: - defaultValue: return "micromole par mètre carré et par seconde" + defaultValue: + expression: return "micromole par mètre carré et par seconde" checker: name: Reference params: @@ -5294,7 +5385,8 @@ dataTypes: params: required: null unit: - defaultValue: return "micromole par mètre carré et par seconde" + defaultValue: + expression: return "micromole par mètre carré et par seconde" checker: name: Reference params: @@ -5309,7 +5401,8 @@ dataTypes: params: required: null unit: - defaultValue: return "micromole par mètre carré et par seconde" + defaultValue: + expression: return "micromole par mètre carré et par seconde" checker: name: Reference params: @@ -5324,7 +5417,8 @@ dataTypes: params: required: null unit: - defaultValue: return "micromole par mètre carré et par seconde" + defaultValue: + expression: return "micromole par mètre carré et par seconde" checker: name: Reference params: @@ -5339,7 +5433,8 @@ dataTypes: params: required: null unit: - defaultValue: return "degré Celsius" + defaultValue: + expression: return "degré Celsius" checker: name: Reference params: @@ -5354,7 +5449,8 @@ dataTypes: params: required: null unit: - defaultValue: return "kilopascal" + defaultValue: + expression: return "kilopascal" checker: name: Reference params: @@ -5369,7 +5465,8 @@ dataTypes: params: required: null unit: - defaultValue: return "degré Celsius" + defaultValue: + expression: return "degré Celsius" checker: name: Reference params: @@ -5384,7 +5481,8 @@ dataTypes: params: required: null unit: - defaultValue: return "degré Celsius" + defaultValue: + expression: return "degré Celsius" checker: name: Reference params: @@ -5399,7 +5497,8 @@ dataTypes: params: required: null unit: - defaultValue: return "watt par mètre carré" + defaultValue: + expression: return "watt par mètre carré" checker: name: Reference params: @@ -5414,7 +5513,8 @@ dataTypes: params: required: null unit: - defaultValue: return "percentage" + defaultValue: + expression: return "percentage" checker: name: Reference params: @@ -5429,7 +5529,8 @@ dataTypes: params: required: null unit: - defaultValue: return "degré" + defaultValue: + expression: return "degré" checker: name: Reference params: @@ -5444,7 +5545,8 @@ dataTypes: params: required: null unit: - defaultValue: return "mètre par seconde" + defaultValue: + expression: return "mètre par seconde" checker: name: Reference params: @@ -5668,7 +5770,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "meteorologie" + defaultValue: + expression: return "meteorologie" checker: name: Reference params: @@ -5707,7 +5810,8 @@ dataTypes: params: required: null unit: - defaultValue: return "millimètre" + defaultValue: + expression: return "millimètre" checker: name: Reference params: @@ -5722,7 +5826,8 @@ dataTypes: params: required: null unit: - defaultValue: return "watt par mètre carré" + defaultValue: + expression: return "watt par mètre carré" checker: name: Reference params: @@ -5737,7 +5842,8 @@ dataTypes: params: required: null unit: - defaultValue: return "watt par mètre carré" + defaultValue: + expression: return "watt par mètre carré" checker: name: Reference params: @@ -5752,7 +5858,8 @@ dataTypes: params: required: null unit: - defaultValue: return "watt par mètre carré" + defaultValue: + expression: return "watt par mètre carré" checker: name: Reference params: @@ -5767,7 +5874,8 @@ dataTypes: params: required: null unit: - defaultValue: return "watt par mètre carré" + defaultValue: + expression: return "watt par mètre carré" checker: name: Reference params: @@ -5782,7 +5890,8 @@ dataTypes: params: required: true unit: - defaultValue: return "watt par mètre carré" + defaultValue: + expression: return "watt par mètre carré" checker: name: Reference params: @@ -5797,7 +5906,8 @@ dataTypes: params: required: true unit: - defaultValue: return "watt par mètre carré" + defaultValue: + expression: return "watt par mètre carré" checker: name: Reference params: @@ -5812,7 +5922,8 @@ dataTypes: params: required: true unit: - defaultValue: return "micromole par mètre carré et par jour" + defaultValue: + expression: return "micromole par mètre carré et par jour" checker: name: Reference params: @@ -5827,7 +5938,8 @@ dataTypes: params: required: true unit: - defaultValue: return "micromole par mètre carré et par jour" + defaultValue: + expression: return "micromole par mètre carré et par jour" checker: name: Reference params: @@ -5842,7 +5954,8 @@ dataTypes: params: required: null unit: - defaultValue: return "micromole par mètre carré et par jour" + defaultValue: + expression: return "micromole par mètre carré et par jour" checker: name: Reference params: @@ -5857,7 +5970,8 @@ dataTypes: params: required: null unit: - defaultValue: return "micromole par mètre carré et par jour" + defaultValue: + expression: return "micromole par mètre carré et par jour" checker: name: Reference params: @@ -5872,7 +5986,8 @@ dataTypes: params: required: null unit: - defaultValue: return "micromole par mètre carré et par jour" + defaultValue: + expression: return "micromole par mètre carré et par jour" checker: name: Reference params: @@ -5887,7 +6002,8 @@ dataTypes: params: required: null unit: - defaultValue: return "degré" + defaultValue: + expression: return "degré" checker: name: Reference params: @@ -5902,7 +6018,8 @@ dataTypes: params: required: null unit: - defaultValue: return "kilopascal" + defaultValue: + expression: return "kilopascal" checker: name: Reference params: @@ -5917,7 +6034,8 @@ dataTypes: params: required: null unit: - defaultValue: return "degré Celsius" + defaultValue: + expression: return "degré Celsius" checker: name: Reference params: @@ -5932,7 +6050,8 @@ dataTypes: params: required: null unit: - defaultValue: return "degré Celsius" + defaultValue: + expression: return "degré Celsius" checker: name: Reference params: @@ -5947,7 +6066,8 @@ dataTypes: params: required: null unit: - defaultValue: return "mégajoule par mètre et par jour" + defaultValue: + expression: return "mégajoule par mètre et par jour" checker: name: Reference params: @@ -5962,7 +6082,8 @@ dataTypes: params: required: null unit: - defaultValue: return "percentage" + defaultValue: + expression: return "percentage" checker: name: Reference params: @@ -5977,7 +6098,8 @@ dataTypes: params: required: null unit: - defaultValue: return "degré" + defaultValue: + expression: return "degré" checker: name: Reference params: @@ -5992,7 +6114,8 @@ dataTypes: params: required: null unit: - defaultValue: return "mètre par seconde" + defaultValue: + expression: return "mètre par seconde" checker: name: Reference params: @@ -6212,7 +6335,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "meteorologie" + defaultValue: + expression: return "meteorologie" checker: name: Reference params: @@ -6251,7 +6375,8 @@ dataTypes: params: required: null unit: - defaultValue: return "mètre" + defaultValue: + expression: return "mètre" checker: name: Reference params: @@ -6266,7 +6391,8 @@ dataTypes: params: required: null unit: - defaultValue: return "mégajoule par mètre et par mois" + defaultValue: + expression: return "mégajoule par mètre et par mois" checker: name: Reference params: @@ -6281,7 +6407,8 @@ dataTypes: params: required: null unit: - defaultValue: return "mégajoule par mètre et par mois" + defaultValue: + expression: return "mégajoule par mètre et par mois" checker: name: Reference params: @@ -6296,7 +6423,8 @@ dataTypes: params: required: null unit: - defaultValue: return "mégajoule par mètre et par mois" + defaultValue: + expression: return "mégajoule par mètre et par mois" checker: name: Reference params: @@ -6311,7 +6439,8 @@ dataTypes: params: required: null unit: - defaultValue: return "mégajoule par mètre et par mois" + defaultValue: + expression: return "mégajoule par mètre et par mois" checker: name: Reference params: @@ -6326,7 +6455,8 @@ dataTypes: params: required: true unit: - defaultValue: return "mégajoule par mètre et par mois" + defaultValue: + expression: return "mégajoule par mètre et par mois" checker: name: Reference params: @@ -6341,7 +6471,8 @@ dataTypes: params: required: true unit: - defaultValue: return "mégajoule par mètre et par mois" + defaultValue: + expression: return "mégajoule par mètre et par mois" checker: name: Reference params: @@ -6356,7 +6487,8 @@ dataTypes: params: required: true unit: - defaultValue: return "micromole par mètre carré et par mois" + defaultValue: + expression: return "micromole par mètre carré et par mois" checker: name: Reference params: @@ -6371,7 +6503,8 @@ dataTypes: params: required: true unit: - defaultValue: return "micromole par mètre carré et par mois" + defaultValue: + expression: return "micromole par mètre carré et par mois" checker: name: Reference params: @@ -6386,7 +6519,8 @@ dataTypes: params: required: null unit: - defaultValue: return "micromole par mètre carré et par mois" + defaultValue: + expression: return "micromole par mètre carré et par mois" checker: name: Reference params: @@ -6401,7 +6535,8 @@ dataTypes: params: required: null unit: - defaultValue: return "micromole par mètre carré et par mois" + defaultValue: + expression: return "micromole par mètre carré et par mois" checker: name: Reference params: @@ -6416,7 +6551,8 @@ dataTypes: params: required: null unit: - defaultValue: return "micromole par mètre carré et par mois" + defaultValue: + expression: return "micromole par mètre carré et par mois" checker: name: Reference params: @@ -6431,7 +6567,8 @@ dataTypes: params: required: null unit: - defaultValue: return "degré Celsius" + defaultValue: + expression: return "degré Celsius" checker: name: Reference params: @@ -6446,7 +6583,8 @@ dataTypes: params: required: null unit: - defaultValue: return "kilopascal" + defaultValue: + expression: return "kilopascal" checker: name: Reference params: @@ -6461,7 +6599,8 @@ dataTypes: params: required: null unit: - defaultValue: return "degré Celsius" + defaultValue: + expression: return "degré Celsius" checker: name: Reference params: @@ -6476,7 +6615,8 @@ dataTypes: params: required: null unit: - defaultValue: return "degré Celsius" + defaultValue: + expression: return "degré Celsius" checker: name: Reference params: @@ -6491,7 +6631,8 @@ dataTypes: params: required: null unit: - defaultValue: return "mégajoule par mètre et par mois" + defaultValue: + expression: return "mégajoule par mètre et par mois" checker: name: Reference params: @@ -6506,7 +6647,8 @@ dataTypes: params: required: null unit: - defaultValue: return "percentage" + defaultValue: + expression: return "percentage" checker: name: Reference params: @@ -6521,7 +6663,8 @@ dataTypes: params: required: null unit: - defaultValue: return "degré" + defaultValue: + expression: return "degré" checker: name: Reference params: @@ -6536,7 +6679,8 @@ dataTypes: params: required: null unit: - defaultValue: return "mètre par seconde" + defaultValue: + expression: return "mètre par seconde" checker: name: Reference params: diff --git a/src/test/resources/data/foret/multiyaml/configuration.yaml b/src/test/resources/data/foret/multiyaml/configuration.yaml index 0b6ba8857..bda2ab5c2 100644 --- a/src/test/resources/data/foret/multiyaml/configuration.yaml +++ b/src/test/resources/data/foret/multiyaml/configuration.yaml @@ -22,7 +22,8 @@ dataTypes: ${variable}: components: variable: - defaultValue: return "GWD" + defaultValue: + expression: return "GWD" checker: name: Reference params: @@ -35,7 +36,8 @@ dataTypes: params: required: false unit: - defaultValue: return "degre celcius" + defaultValue: + expression: return "degre celcius" checker: name: Reference params: @@ -43,13 +45,15 @@ dataTypes: required: true codify: true profondeur: - defaultValue: return "${profondeur}" + defaultValue: + expression: return "${profondeur}" checker: name: Float params: required: false repetition: - defaultValue: return "${répétition}" + defaultValue: + expression: return "${répétition}" checker: name: Integer params: @@ -111,7 +115,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "climat du sol" + defaultValue: + expression: return "climat du sol" checker: name: Reference params: @@ -158,8 +163,9 @@ dataTypes: params: pattern: HH:mm datetime: - defaultValue: > - return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" + defaultValue: + expression: > + return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" checker: name: Date params: @@ -247,7 +253,8 @@ dataTypes: ${variable}: components: variable: - defaultValue: return "SMP" + defaultValue: + expression: return "SMP" checker: name: Reference params: @@ -260,7 +267,8 @@ dataTypes: params: required: false unit: - defaultValue: return "kilopascal" + defaultValue: + expression: return "kilopascal" checker: name: Reference params: @@ -268,13 +276,15 @@ dataTypes: required: true codify: true profondeur: - defaultValue: return "${profondeur}" + defaultValue: + expression: return "${profondeur}" checker: name: Float params: required: false repetition: - defaultValue: return "${répétition}" + defaultValue: + expression: return "${répétition}" checker: name: Integer params: @@ -336,7 +346,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "climat du sol" + defaultValue: + expression: return "climat du sol" checker: name: Reference params: @@ -383,8 +394,9 @@ dataTypes: params: pattern: HH:mm datetime: - defaultValue: > - return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" + defaultValue: + expression: > + return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" checker: name: Date params: @@ -473,7 +485,8 @@ dataTypes: ${variable}: components: variable: - defaultValue: return "GWD" + defaultValue: + expression: return "GWD" checker: name: Reference params: @@ -486,7 +499,8 @@ dataTypes: params: required: false unit: - defaultValue: return "degre celcius" + defaultValue: + expression: return "degre celcius" checker: name: Reference params: @@ -494,13 +508,15 @@ dataTypes: required: true codify: true profondeur: - defaultValue: return "${profondeur}" + defaultValue: + expression: return "${profondeur}" checker: name: Float params: required: false repetition: - defaultValue: return "${répétition}" + defaultValue: + expression: return "${répétition}" checker: name: Integer params: @@ -562,7 +578,8 @@ dataTypes: informations: components: thematic: - defaultValue: return "climat du sol" + defaultValue: + expression: return "climat du sol" checker: name: Reference params: @@ -609,8 +626,9 @@ dataTypes: params: pattern: HH:mm datetime: - defaultValue: > - return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" + defaultValue: + expression: > + return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" checker: name: Date params: diff --git a/src/test/resources/data/foret/multiyaml/dataTypes/smp_infraj.yaml b/src/test/resources/data/foret/multiyaml/dataTypes/smp_infraj.yaml index 5a5b81385..8e3fc838c 100644 --- a/src/test/resources/data/foret/multiyaml/dataTypes/smp_infraj.yaml +++ b/src/test/resources/data/foret/multiyaml/dataTypes/smp_infraj.yaml @@ -19,7 +19,8 @@ ${variable}: components: variable: - defaultValue: return "SMP" + defaultValue: + expression: return "SMP" checker: name: Reference params: @@ -32,7 +33,8 @@ params: required: false unit: - defaultValue: return "kilopascal" + defaultValue: + expression: return "kilopascal" checker: name: Reference params: @@ -40,13 +42,15 @@ required: true codify: true profondeur: - defaultValue: return "${profondeur}" + defaultValue: + expression: return "${profondeur}" checker: name: Float params: required: false repetition: - defaultValue: return "${répétition}" + defaultValue: + expression: return "${répétition}" checker: name: Integer params: @@ -108,7 +112,8 @@ informations: components: thematic: - defaultValue: return "climat du sol" + defaultValue: + expression: return "climat du sol" checker: name: Reference params: @@ -155,8 +160,9 @@ params: pattern: HH:mm datetime: - defaultValue: > - return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" + defaultValue: + expression: > + return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" checker: name: Date params: diff --git a/src/test/resources/data/foret/multiyaml/dataTypes/ts_infraj.yaml b/src/test/resources/data/foret/multiyaml/dataTypes/ts_infraj.yaml index f2ab72175..9f1683846 100644 --- a/src/test/resources/data/foret/multiyaml/dataTypes/ts_infraj.yaml +++ b/src/test/resources/data/foret/multiyaml/dataTypes/ts_infraj.yaml @@ -19,7 +19,8 @@ ${variable}: components: variable: - defaultValue: return "TS" + defaultValue: + expression: return "TS" checker: name: Reference params: @@ -32,7 +33,8 @@ params: required: false unit: - defaultValue: return "degre celcius" + defaultValue: + expression: return "degre celcius" checker: name: Reference params: @@ -40,13 +42,15 @@ required: true codify: true profondeur: - defaultValue: return "${profondeur}" + defaultValue: + expression: return "${profondeur}" checker: name: Float params: required: false repetition: - defaultValue: return "${répétition}" + defaultValue: + expression: return "${répétition}" checker: name: Integer params: @@ -108,7 +112,8 @@ informations: components: thematic: - defaultValue: return "climat du sol" + defaultValue: + expression: return "climat du sol" checker: name: Reference params: @@ -155,8 +160,9 @@ params: pattern: HH:mm datetime: - defaultValue: > - return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" + defaultValue: + expression: > + return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" checker: name: Date params: diff --git a/src/test/resources/data/monsore/monsore-with-repository.yaml b/src/test/resources/data/monsore/monsore-with-repository.yaml index 93086b457..60b4bd373 100644 --- a/src/test/resources/data/monsore/monsore-with-repository.yaml +++ b/src/test/resources/data/monsore/monsore-with-repository.yaml @@ -349,27 +349,27 @@ dataTypes: site: components: bassin: - params: + defaultValue: + expression: > + return references.get("sites") + .find{it.getNaturalKey().equals(datumByVariableAndComponent.get("site").get("bassin"))} + .getHierarchicalKey(); references: - sites replace: true - defaultValue: > - return references.get("sites") - .find{it.getNaturalKey().equals(datumByVariableAndComponent.get("site").get("bassin"))} - .getHierarchicalKey(); checker: name: Reference params: refType: sites plateforme: chemin: - params: + defaultValue: + expression: > + return references.get("sites") + .find{it.getRefValues().get("zet_chemin_parent").equals(datumByVariableAndComponent.get("site").get("bassin")) && it.getRefValues().get("zet_nom_key").equals(datumByVariableAndComponent.get("site").get("plateforme"))} + .getHierarchicalKey(); references: - - sites - defaultValue: > - return references.get("sites") - .find{it.getRefValues().get("zet_chemin_parent").equals(datumByVariableAndComponent.get("site").get("bassin")) && it.getRefValues().get("zet_nom_key").equals(datumByVariableAndComponent.get("site").get("plateforme"))} - .getHierarchicalKey(); + - sites checker: name: Reference params: @@ -397,7 +397,8 @@ dataTypes: params: refType: valeurs_qualitatives unit: - defaultValue: "return \"sans_unite\"" + defaultValue: + expression: "return \"sans_unite\"" checker: name: Reference params: @@ -406,13 +407,15 @@ dataTypes: Nombre d'individus: components: value: - defaultValue: "return 0" + defaultValue: + expression: "return 0" checker: name: Integer params: required: unit: - defaultValue: "return \"sans_unite\"" + defaultValue: + expression: "return \"sans_unite\"" checker: name: Reference params: diff --git a/src/test/resources/data/monsore/monsore.yaml b/src/test/resources/data/monsore/monsore.yaml index 22bbfa9de..557be0ba0 100644 --- a/src/test/resources/data/monsore/monsore.yaml +++ b/src/test/resources/data/monsore/monsore.yaml @@ -347,27 +347,27 @@ dataTypes: site: components: bassin: - params: + defaultValue: + expression: > + return references.get("sites") + .find{it.getNaturalKey().equals(datumByVariableAndComponent.get("site").get("bassin"))} + .getHierarchicalKey(); references: - sites replace: true - defaultValue: > - return references.get("sites") - .find{it.getNaturalKey().equals(datumByVariableAndComponent.get("site").get("bassin"))} - .getHierarchicalKey(); checker: name: Reference params: refType: sites plateforme: chemin: - params: + defaultValue: + expression: > + return references.get("sites") + .find{it.getRefValues().get("zet_chemin_parent").equals(datumByVariableAndComponent.get("site").get("bassin")) && it.getRefValues().get("zet_nom_key").equals(datumByVariableAndComponent.get("site").get("plateforme"))} + .getHierarchicalKey(); references: - - sites - defaultValue: > - return references.get("sites") - .find{it.getRefValues().get("zet_chemin_parent").equals(datumByVariableAndComponent.get("site").get("bassin")) && it.getRefValues().get("zet_nom_key").equals(datumByVariableAndComponent.get("site").get("plateforme"))} - .getHierarchicalKey(); + - sites checker: name: Reference params: @@ -395,7 +395,8 @@ dataTypes: params: refType: valeurs_qualitatives unit: - defaultValue: "return \"sans_unite\"" + defaultValue: + expression: "return \"sans_unite\"" checker: name: Reference params: @@ -404,13 +405,15 @@ dataTypes: Nombre d'individus: components: value: - defaultValue: "return 0" + defaultValue: + expression: "return 0" checker: name: Integer params: required: unit: - defaultValue: "return \"sans_unite\"" + defaultValue: + expression: "return \"sans_unite\"" checker: name: Reference params: diff --git a/src/test/resources/data/olac/olac.yaml b/src/test/resources/data/olac/olac.yaml index 18297bdc7..19757d769 100644 --- a/src/test/resources/data/olac/olac.yaml +++ b/src/test/resources/data/olac/olac.yaml @@ -165,8 +165,9 @@ dataTypes: date: components: datetime: - defaultValue: > - return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" + defaultValue: + expression: > + return datumByVariableAndComponent.get("date").get("day") +" " +datumByVariableAndComponent.get("date").get("time")+ ":00" checker: name: Date params: -- GitLab From 90e0cd6950fa27ea36c08bd7b3faeb90ae7d2938 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Wed, 23 Mar 2022 17:42:21 +0100 Subject: [PATCH 13/41] Distingue le champs de configuration "groovy" entre l'expression de transformation et celle de check --- .../inra/oresing/checker/CheckerFactory.java | 2 +- .../checker/LineCheckerConfiguration.java | 7 +- .../fr/inra/oresing/model/Configuration.java | 11 +- .../fr/inra/oresing/rest/OreSiService.java | 2 +- .../checker/GroovyLineCheckerTest.java | 4 +- .../oresing/model/LocalDateTimeRangeTest.java | 9 +- src/test/resources/data/acbb/acbb.yaml | 3 +- .../data/duplication/duplication.yaml | 3 +- .../resources/data/foret/foret_essai.yaml | 1521 ++++++++++------- .../data/foret/multiyaml/configuration.yaml | 150 +- .../foret/multiyaml/dataTypes/smp_infraj.yaml | 50 +- .../foret/multiyaml/dataTypes/ts_infraj.yaml | 50 +- .../multiyaml/references/zones_etudes.yaml | 6 +- .../data/recursivite/recusivite.yaml | 6 +- 14 files changed, 1049 insertions(+), 775 deletions(-) diff --git a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java index 60f38b902..74fc714a3 100644 --- a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java +++ b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java @@ -127,7 +127,7 @@ public class CheckerFactory { checkerDescription.getParams(), new Configuration.CheckerConfigurationDescription() ); - LineTransformer transformer = transformerFactory.newTransformer(configuration, app, target); + LineTransformer transformer = transformerFactory.newTransformer(configuration.getTransformation(), app, target); CheckerOnOneVariableComponentLineChecker lineChecker; switch (checkerDescription.getName()) { case "Date": diff --git a/src/main/java/fr/inra/oresing/checker/LineCheckerConfiguration.java b/src/main/java/fr/inra/oresing/checker/LineCheckerConfiguration.java index 3460a2e2b..c42730d99 100644 --- a/src/main/java/fr/inra/oresing/checker/LineCheckerConfiguration.java +++ b/src/main/java/fr/inra/oresing/checker/LineCheckerConfiguration.java @@ -5,10 +5,15 @@ import fr.inra.oresing.transformer.TransformationConfiguration; /** * Indique qu'un objet a vocation à contenir des paramètres de configuration pour configurer un {@link LineChecker} */ -public interface LineCheckerConfiguration extends TransformationConfiguration { +public interface LineCheckerConfiguration { /** * Indique la valeur est obligatoire. */ boolean isRequired(); + + /** + * Les transformation à appliquer avant de faire le contrôle + */ + TransformationConfiguration getTransformation(); } diff --git a/src/main/java/fr/inra/oresing/model/Configuration.java b/src/main/java/fr/inra/oresing/model/Configuration.java index 1791e065a..ca9eb733a 100644 --- a/src/main/java/fr/inra/oresing/model/Configuration.java +++ b/src/main/java/fr/inra/oresing/model/Configuration.java @@ -22,6 +22,7 @@ import fr.inra.oresing.model.internationalization.InternationalizationImpl; import fr.inra.oresing.model.internationalization.InternationalizationMap; import fr.inra.oresing.model.internationalization.InternationalizationMapDisplayImpl; import fr.inra.oresing.model.internationalization.InternationalizationReferenceMap; +import fr.inra.oresing.transformer.TransformationConfiguration; import lombok.Getter; import lombok.Setter; import lombok.ToString; @@ -381,7 +382,7 @@ public class Configuration { GroovyConfiguration groovy; String columns; String duration; - boolean codify; + TransformationConfigurationDescription transformation = new TransformationConfigurationDescription(); boolean required; Multiplicity multiplicity = Multiplicity.ONE; @@ -393,6 +394,14 @@ public class Configuration { } } + @Getter + @Setter + @ToString + public static class TransformationConfigurationDescription implements TransformationConfiguration { + boolean codify; + GroovyConfiguration groovy; + } + @Getter @Setter @ToString diff --git a/src/main/java/fr/inra/oresing/rest/OreSiService.java b/src/main/java/fr/inra/oresing/rest/OreSiService.java index efce5eb40..e6e4c8031 100644 --- a/src/main/java/fr/inra/oresing/rest/OreSiService.java +++ b/src/main/java/fr/inra/oresing/rest/OreSiService.java @@ -697,7 +697,7 @@ public class OreSiService { } if (validationCheckResult instanceof ReferenceValidationCheckResult) { ReferenceLineCheckerConfiguration configuration = (ReferenceLineCheckerConfiguration) lineChecker.getConfiguration(); - if (configuration.getGroovy() != null) { + if (configuration.getTransformation().getGroovy() != null) { datum.put((VariableComponentKey) ((ReferenceValidationCheckResult) validationCheckResult).getTarget(), ((ReferenceValidationCheckResult) validationCheckResult).getMatchedReferenceHierarchicalKey().getSql()); } ReferenceValidationCheckResult referenceValidationCheckResult = (ReferenceValidationCheckResult) validationCheckResult; diff --git a/src/test/java/fr/inra/oresing/checker/GroovyLineCheckerTest.java b/src/test/java/fr/inra/oresing/checker/GroovyLineCheckerTest.java index 5e59a5c86..6cd7292da 100644 --- a/src/test/java/fr/inra/oresing/checker/GroovyLineCheckerTest.java +++ b/src/test/java/fr/inra/oresing/checker/GroovyLineCheckerTest.java @@ -6,6 +6,7 @@ import fr.inra.oresing.groovy.GroovyExpression; import fr.inra.oresing.model.Datum; import fr.inra.oresing.model.VariableComponentKey; import fr.inra.oresing.rest.ValidationCheckResult; +import fr.inra.oresing.transformer.TransformationConfiguration; import lombok.extern.slf4j.Slf4j; import org.junit.Assert; import org.junit.Test; @@ -98,9 +99,8 @@ public class GroovyLineCheckerTest { private GroovyLineCheckerConfiguration getConfiguration(String expression) { return new GroovyLineCheckerConfiguration() { - @Override - public boolean isCodify() { + public TransformationConfiguration getTransformation() { throw new UnsupportedOperationException("doublure de test"); } diff --git a/src/test/java/fr/inra/oresing/model/LocalDateTimeRangeTest.java b/src/test/java/fr/inra/oresing/model/LocalDateTimeRangeTest.java index 225b46a88..702dd9119 100644 --- a/src/test/java/fr/inra/oresing/model/LocalDateTimeRangeTest.java +++ b/src/test/java/fr/inra/oresing/model/LocalDateTimeRangeTest.java @@ -2,7 +2,7 @@ package fr.inra.oresing.model; import fr.inra.oresing.checker.DateLineChecker; import fr.inra.oresing.checker.DateLineCheckerConfiguration; -import fr.inra.oresing.checker.GroovyConfiguration; +import fr.inra.oresing.transformer.TransformationConfiguration; import org.junit.Assert; import org.junit.Test; @@ -61,18 +61,13 @@ public class LocalDateTimeRangeTest { return duration; } - @Override - public boolean isCodify() { - throw new UnsupportedOperationException("doublure de test"); - } - @Override public boolean isRequired() { throw new UnsupportedOperationException("doublure de test"); } @Override - public GroovyConfiguration getGroovy() { + public TransformationConfiguration getTransformation() { throw new UnsupportedOperationException("doublure de test"); } }; diff --git a/src/test/resources/data/acbb/acbb.yaml b/src/test/resources/data/acbb/acbb.yaml index 0326bc9ca..14f5f8ae0 100644 --- a/src/test/resources/data/acbb/acbb.yaml +++ b/src/test/resources/data/acbb/acbb.yaml @@ -113,7 +113,8 @@ references: params: refType: modalites columns: modalites - codify: true + transformation: + codify: true multiplicity: MANY compositeReferences: localizations: diff --git a/src/test/resources/data/duplication/duplication.yaml b/src/test/resources/data/duplication/duplication.yaml index cae0e427e..b69dcebfe 100644 --- a/src/test/resources/data/duplication/duplication.yaml +++ b/src/test/resources/data/duplication/duplication.yaml @@ -22,7 +22,8 @@ references: refType: zones_etudes columns: parent required: false - codify: true + transformation: + codify: true keyColumns: [nom] columns: nom: diff --git a/src/test/resources/data/foret/foret_essai.yaml b/src/test/resources/data/foret/foret_essai.yaml index 4937676e2..03bcb7e9d 100644 --- a/src/test/resources/data/foret/foret_essai.yaml +++ b/src/test/resources/data/foret/foret_essai.yaml @@ -40,7 +40,8 @@ references: refType: types_de_zones_etudes columns: type de site required: true - codify: true + transformation: + codify: true parent_ref: description: référence au parent checker: @@ -49,7 +50,8 @@ references: refType: zones_etudes columns: parent required: false - codify: true + transformation: + codify: true date début: description: date de début checker: @@ -209,7 +211,8 @@ references: refType: variables columns: nom de la variable required: true - codify: true + transformation: + codify: true uniteRef: description: référence à l'unité' checker: @@ -218,7 +221,8 @@ references: refType: unites columns: nom de l'unité required: true - codify: true + transformation: + codify: true internationalizationName: fr: Thèmes et types de données par zone d'étude en: Thematics and data types by study area @@ -245,7 +249,8 @@ references: refType: zones_etudes columns: nom du site required: true - codify: false + transformation: + codify: false internationalizationName: fr: Traitements en: Treatments @@ -326,7 +331,8 @@ references: refType: instruments columns: code de l'instrument required: true - codify: true + transformation: + codify: true DOIRef: description: référence à la référence checker: @@ -335,7 +341,8 @@ references: refType: reference columns: doi de la référence required: true - codify: true + transformation: + codify: true internationalizationName: fr: Références des instruments en: Instruments references @@ -359,7 +366,8 @@ references: refType: instruments columns: Code de l'instrument required: true - codify: true + transformation: + codify: true checkSiteThemeDatatype: description: référence au siteThemeDatatype checker: @@ -367,18 +375,19 @@ references: params: refType: theme_types_de_donnees_par_zone_etudes columns: theme_types_de_donnees_par_zone_etudes - groovy: - expression: > - String[] tab = datum.get("Nom du Thème-Type de - données-Variable").split("-"); String site = tab[0].strip(); - String theme = tab[1].strip(); String datatype = tab[2].strip(); - return references["theme_types_de_donnees_par_zone_etudes"] - .findAll {it.refValues["nom du site"].equals(site)} .findAll - {it.refValues["nom du thème"].equals(theme)} .find - {it.refValues["nom du type de données"].equals(datatype)} - .naturalKey - references: - - theme_types_de_donnees_par_zone_etudes + transformation: + groovy: + expression: > + String[] tab = datum.get("Nom du Thème-Type de + données-Variable").split("-"); String site = tab[0].strip(); + String theme = tab[1].strip(); String datatype = tab[2].strip(); + return references["theme_types_de_donnees_par_zone_etudes"] + .findAll {it.refValues["nom du site"].equals(site)} .findAll + {it.refValues["nom du thème"].equals(theme)} .find + {it.refValues["nom du type de données"].equals(datatype)} + .naturalKey + references: + - theme_types_de_donnees_par_zone_etudes checkDataypeVariableUnite: description: référence au DataypeVariableUnite checker: @@ -387,21 +396,22 @@ references: refType: variables_par_types_de_donnees columns: variables_par_types_de_donnees required: true - groovy: - expression: > - String[] tab = datum.get("Nom du Thème-Type de - données-Variable").split("-"); String datatype = - fr.inra.oresing.rest.OreSiService.escapeKeyComponent( - tab[2].strip()); String variable = - fr.inra.oresing.rest.OreSiService.escapeKeyComponent( - tab[3].strip()); return - references.find{it.key.equals("variables_par_types_de_donnees")}.value - .findAll {it.refValues["nom de la variable"].equals(variable)} - .find {it.refValues["nom du type de données"].equals(datatype)} - .naturalKey - references: - - variables_par_types_de_donnees - codify: true + transformation: + groovy: + expression: > + String[] tab = datum.get("Nom du Thème-Type de + données-Variable").split("-"); String datatype = + fr.inra.oresing.rest.OreSiService.escapeKeyComponent( + tab[2].strip()); String variable = + fr.inra.oresing.rest.OreSiService.escapeKeyComponent( + tab[3].strip()); return + references.find{it.key.equals("variables_par_types_de_donnees")}.value + .findAll {it.refValues["nom de la variable"].equals(variable)} + .find {it.refValues["nom du type de données"].equals(datatype)} + .naturalKey + references: + - variables_par_types_de_donnees + codify: true date début: description: date de début checker: @@ -463,7 +473,8 @@ references: refType: methodes columns: code de la méthode de calcul required: true - codify: true + transformation: + codify: true DOIRef: description: référence à la référence checker: @@ -472,7 +483,8 @@ references: refType: reference columns: doi de la référence required: true - codify: true + transformation: + codify: true internationalizationName: fr: Références des méthodes en: Methods references @@ -496,7 +508,8 @@ references: refType: methodes columns: Code de la méthode de calcul required: true - codify: true + transformation: + codify: true checkSiteThemeDatatype: description: référence au siteThemeDatatype checker: @@ -504,18 +517,19 @@ references: params: refType: theme_types_de_donnees_par_zone_etudes columns: theme_types_de_donnees_par_zone_etudes - groovy: - expression: > - String[] tab = datum.get("Nom du Thème-Type de - données-Variable").split("-"); String site = tab[0].strip(); - String theme = tab[1].strip(); String datatype = tab[2].strip(); - return references["theme_types_de_donnees_par_zone_etudes"] - .findAll {it.refValues["nom du site"].equals(site)} .findAll - {it.refValues["nom du thème"].equals(theme)} .find - {it.refValues["nom du type de données"].equals(datatype)} - .naturalKey - references: - - theme_types_de_donnees_par_zone_etudes + transformation: + groovy: + expression: > + String[] tab = datum.get("Nom du Thème-Type de + données-Variable").split("-"); String site = tab[0].strip(); + String theme = tab[1].strip(); String datatype = tab[2].strip(); + return references["theme_types_de_donnees_par_zone_etudes"] + .findAll {it.refValues["nom du site"].equals(site)} .findAll + {it.refValues["nom du thème"].equals(theme)} .find + {it.refValues["nom du type de données"].equals(datatype)} + .naturalKey + references: + - theme_types_de_donnees_par_zone_etudes checkDataypeVariableUnite: description: référence au DataypeVariableUnite checker: @@ -524,21 +538,22 @@ references: refType: variables_par_types_de_donnees columns: variables_par_types_de_donnees required: true - groovy: - expression: > - String[] tab = datum.get("Nom du Thème-Type de - données-Variable").split("-"); String datatype = - fr.inra.oresing.rest.OreSiService.escapeKeyComponent( - tab[2].strip()); String variable = - fr.inra.oresing.rest.OreSiService.escapeKeyComponent( - tab[3].strip()); return - references.find{it.key.equals("variables_par_types_de_donnees")}.value - .findAll {it.refValues["nom de la variable"].equals(variable)} - .find {it.refValues["nom du type de données"].equals(datatype)} - .naturalKey - references: - - variables_par_types_de_donnees - codify: true + transformation: + groovy: + expression: > + String[] tab = datum.get("Nom du Thème-Type de + données-Variable").split("-"); String datatype = + fr.inra.oresing.rest.OreSiService.escapeKeyComponent( + tab[2].strip()); String variable = + fr.inra.oresing.rest.OreSiService.escapeKeyComponent( + tab[3].strip()); return + references.find{it.key.equals("variables_par_types_de_donnees")}.value + .findAll {it.refValues["nom de la variable"].equals(variable)} + .find {it.refValues["nom du type de données"].equals(datatype)} + .naturalKey + references: + - variables_par_types_de_donnees + codify: true date début: description: date de début checker: @@ -604,7 +619,8 @@ references: params: refType: listes_infos_complementaires columns: nom de la liste - codify: true + transformation: + codify: true keyColumns: - nom de la liste - libellé d'une valeur_fr @@ -622,7 +638,8 @@ references: params: refType: listes_infos_complementaires columns: nom de la liste de valeurs d'informations complémentaires - codify: true + transformation: + codify: true required: false internationalizationName: fr: Informations complementaires @@ -656,18 +673,19 @@ references: params: refType: theme_types_de_donnees_par_zone_etudes columns: theme_types_de_donnees_par_zone_etudes - groovy: - expression: > - String[] tab = datum.get("Nom du Thème-Type de - données-Variable").split("-"); String site = tab[0].strip(); - String theme = tab[1].strip(); String datatype = tab[2].strip(); - return references["theme_types_de_donnees_par_zone_etudes"] - .findAll {it.refValues["nom du site"].equals(site)} .findAll - {it.refValues["nom du thème"].equals(theme)} .find - {it.refValues["nom du type de données"].equals(datatype)} - .naturalKey - references: - - theme_types_de_donnees_par_zone_etudes + transformation: + groovy: + expression: > + String[] tab = datum.get("Nom du Thème-Type de + données-Variable").split("-"); String site = tab[0].strip(); + String theme = tab[1].strip(); String datatype = tab[2].strip(); + return references["theme_types_de_donnees_par_zone_etudes"] + .findAll {it.refValues["nom du site"].equals(site)} .findAll + {it.refValues["nom du thème"].equals(theme)} .find + {it.refValues["nom du type de données"].equals(datatype)} + .naturalKey + references: + - theme_types_de_donnees_par_zone_etudes checkDataypeVariableUnite: description: référence au DataypeVariableUnite checker: @@ -676,21 +694,22 @@ references: refType: variables_par_types_de_donnees columns: variables_par_types_de_donnees required: true - groovy: - expression: > - String[] tab = datum.get("Nom du Thème-Type de - données-Variable").split("-"); String datatype = - fr.inra.oresing.rest.OreSiService.escapeKeyComponent( - tab[2].strip()); String variable = - fr.inra.oresing.rest.OreSiService.escapeKeyComponent( - tab[3].strip()); return - references.find{it.key.equals("variables_par_types_de_donnees")}.value - .findAll {it.refValues["nom de la variable"].equals(variable)} - .find {it.refValues["nom du type de données"].equals(datatype)} - .naturalKey - references: - - variables_par_types_de_donnees - codify: true + transformation: + groovy: + expression: > + String[] tab = datum.get("Nom du Thème-Type de + données-Variable").split("-"); String datatype = + fr.inra.oresing.rest.OreSiService.escapeKeyComponent( + tab[2].strip()); String variable = + fr.inra.oresing.rest.OreSiService.escapeKeyComponent( + tab[3].strip()); return + references.find{it.key.equals("variables_par_types_de_donnees")}.value + .findAll {it.refValues["nom de la variable"].equals(variable)} + .find {it.refValues["nom du type de données"].equals(datatype)} + .naturalKey + references: + - variables_par_types_de_donnees + codify: true internationalizationName: fr: >- Informations complémentaires par site, thème, type de données et @@ -762,32 +781,34 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: - expression: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: - - zones_etudes - codify: true + transformation: + groovy: + expression: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: + - zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -799,14 +820,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: infrajournalier required: true - codify: true + transformation: + codify: true start date: checker: name: Date @@ -857,7 +880,8 @@ dataTypes: params: refType: variables required: true - codify: true + transformation: + codify: true value: checker: name: Float @@ -871,7 +895,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true profondeur: checker: name: Float @@ -1000,32 +1025,34 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: - expression: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: - - zones_etudes - codify: true + transformation: + groovy: + expression: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: + - zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -1037,14 +1064,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: infrajournalier required: true - codify: true + transformation: + codify: true start date: checker: name: Date @@ -1095,7 +1124,8 @@ dataTypes: params: refType: variables required: true - codify: true + transformation: + codify: true value: checker: name: Float @@ -1109,7 +1139,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true profondeur: checker: name: Float @@ -1238,32 +1269,34 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: - expression: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: - - zones_etudes - codify: true + transformation: + groovy: + expression: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: + - zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -1275,14 +1308,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: infrajournalier required: true - codify: true + transformation: + codify: true start date: checker: name: Date @@ -1333,7 +1368,8 @@ dataTypes: params: refType: variables required: true - codify: true + transformation: + codify: true value: checker: name: Float @@ -1347,7 +1383,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true profondeur: checker: name: Float @@ -1476,32 +1513,34 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: - expression: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: - - zones_etudes - codify: true + transformation: + groovy: + expression: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: + - zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -1513,14 +1552,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: infrajournalier required: true - codify: true + transformation: + codify: true start date: checker: name: Date @@ -1571,7 +1612,8 @@ dataTypes: params: refType: variables required: true - codify: true + transformation: + codify: true value: checker: name: Float @@ -1585,7 +1627,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true profondeur: checker: name: Float @@ -1714,32 +1757,34 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: - expression: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: - - zones_etudes - codify: true + transformation: + groovy: + expression: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: + - zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -1751,14 +1796,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: infrajournalier required: true - codify: true + transformation: + codify: true start date: checker: name: Date @@ -1809,7 +1856,8 @@ dataTypes: params: refType: variables required: true - codify: true + transformation: + codify: true value: checker: name: Float @@ -1823,7 +1871,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true profondeur: checker: name: Float @@ -1952,32 +2001,34 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: - expression: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: - - zones_etudes - codify: true + transformation: + groovy: + expression: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: + - zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -1989,14 +2040,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: journalier required: true - codify: true + transformation: + codify: true start date: checker: name: Date @@ -2033,7 +2086,8 @@ dataTypes: params: refType: variables required: true - codify: true + transformation: + codify: true value: checker: name: Float @@ -2047,7 +2101,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true profondeur: checker: name: Float @@ -2172,32 +2227,34 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: - expression: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: - - zones_etudes - codify: true + transformation: + groovy: + expression: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: + - zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -2209,14 +2266,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: journalier required: true - codify: true + transformation: + codify: true start date: checker: name: Date @@ -2253,7 +2312,8 @@ dataTypes: params: refType: variables required: true - codify: true + transformation: + codify: true value: checker: name: Float @@ -2267,7 +2327,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true profondeur: checker: name: Float @@ -2392,32 +2453,34 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: - expression: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: - - zones_etudes - codify: true + transformation: + groovy: + expression: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: + - zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -2429,14 +2492,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: journalier required: true - codify: true + transformation: + codify: true start date: checker: name: Date @@ -2473,7 +2538,8 @@ dataTypes: params: refType: variables required: true - codify: true + transformation: + codify: true value: checker: name: Float @@ -2487,7 +2553,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true profondeur: checker: name: Float @@ -2612,32 +2679,34 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: - expression: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: - - zones_etudes - codify: true + transformation: + groovy: + expression: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: + - zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -2649,14 +2718,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: journalier required: true - codify: true + transformation: + codify: true start date: checker: name: Date @@ -2693,7 +2764,8 @@ dataTypes: params: refType: variables required: true - codify: true + transformation: + codify: true value: checker: name: Float @@ -2707,7 +2779,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true profondeur: checker: name: Float @@ -2832,32 +2905,34 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: - expression: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: - - zones_etudes - codify: true + transformation: + groovy: + expression: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: + - zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -2869,14 +2944,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: journalier required: true - codify: true + transformation: + codify: true start date: checker: name: Date @@ -2913,7 +2990,8 @@ dataTypes: params: refType: variables required: true - codify: true + transformation: + codify: true value: checker: name: Float @@ -2927,7 +3005,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true profondeur: checker: name: Float @@ -3053,32 +3132,34 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: - expression: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: - - zones_etudes - codify: true + transformation: + groovy: + expression: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: + - zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -3090,14 +3171,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: Infra-journalier required: true - codify: false + transformation: + codify: false start date: checker: name: Date @@ -3115,7 +3198,8 @@ dataTypes: params: refType: traitements required: true - codify: true + transformation: + codify: true no_chamber: checker: name: Integer @@ -3165,7 +3249,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true FCH4: components: value: @@ -3186,7 +3271,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true format: constants: - rowNumber: 1 @@ -3303,32 +3389,34 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: - expression: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: - - zones_etudes - codify: true + transformation: + groovy: + expression: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: + - zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -3340,14 +3428,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: journalier required: true - codify: false + transformation: + codify: false start date: checker: name: Date @@ -3365,7 +3455,8 @@ dataTypes: params: refType: traitements required: true - codify: true + transformation: + codify: true no_chamber: checker: name: Integer @@ -3413,7 +3504,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Ta: components: value: @@ -3434,7 +3526,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true format: constants: - rowNumber: 1 @@ -3554,32 +3647,34 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: - expression: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: - - zones_etudes - codify: true + transformation: + groovy: + expression: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: + - zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -3591,14 +3686,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: mensuel required: true - codify: false + transformation: + codify: false start date: checker: name: Date @@ -3616,7 +3713,8 @@ dataTypes: params: refType: traitements required: true - codify: true + transformation: + codify: true no_chamber: checker: name: Integer @@ -3654,7 +3752,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true format: constants: - rowNumber: 1 @@ -3771,32 +3870,34 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: - expression: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: - - zones_etudes - codify: true + transformation: + groovy: + expression: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: + - zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -3808,14 +3909,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: semi-horaire required: true - codify: false + transformation: + codify: false start date: checker: name: Date @@ -3863,7 +3966,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true H2O: components: value: @@ -3879,7 +3983,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true ZL: components: value: @@ -3895,7 +4000,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true FCO2: components: value: @@ -3909,7 +4015,8 @@ dataTypes: params: pattern: "0|1|2" required: true - codify: false + transformation: + codify: false unit: defaultValue: expression: return "micromole par mètre carré et par seconde" @@ -3918,7 +4025,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true H: components: value: @@ -3932,7 +4040,8 @@ dataTypes: params: pattern: "0|1|2" required: true - codify: false + transformation: + codify: false unit: defaultValue: expression: return "watt par mètre carré" @@ -3941,7 +4050,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true LE: components: value: @@ -3955,7 +4065,8 @@ dataTypes: params: pattern: "0|1|2" required: true - codify: false + transformation: + codify: false unit: defaultValue: expression: return "watt par mètre carré" @@ -3964,7 +4075,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true T: components: value: @@ -3978,7 +4090,8 @@ dataTypes: params: pattern: "0|1|2" required: true - codify: false + transformation: + codify: false unit: defaultValue: expression: return "kilogramme par mètre et par seconde" @@ -3987,7 +4100,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true u*: components: value: @@ -4003,7 +4117,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true TR: components: value: @@ -4019,7 +4134,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Sb: components: value: @@ -4035,7 +4151,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Sc: components: value: @@ -4051,7 +4168,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Sw: components: value: @@ -4067,7 +4185,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Sa: components: value: @@ -4083,7 +4202,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true FCO2_gf: components: value: @@ -4099,7 +4219,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true format: constants: - rowNumber: 1 @@ -4272,32 +4393,34 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: - expression: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: - - zones_etudes - codify: true + transformation: + groovy: + expression: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: + - zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -4309,14 +4432,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: journalier required: true - codify: false + transformation: + codify: false start date: checker: name: Date @@ -4350,7 +4475,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true H2O: components: value: @@ -4366,7 +4492,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true ZL: components: value: @@ -4382,7 +4509,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true FCO2: components: value: @@ -4398,7 +4526,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true H: components: value: @@ -4414,7 +4543,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true LE: components: value: @@ -4430,7 +4560,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true T: components: value: @@ -4446,7 +4577,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true u*: components: value: @@ -4462,7 +4594,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true TR: components: value: @@ -4478,7 +4611,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Sb: components: value: @@ -4494,7 +4628,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Sc: components: value: @@ -4510,7 +4645,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Sw: components: value: @@ -4526,7 +4662,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Sa: components: value: @@ -4542,7 +4679,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true FCO2_gf: components: value: @@ -4558,7 +4696,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true format: constants: - rowNumber: 1 @@ -4711,32 +4850,34 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: - expression: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: - - zones_etudes - codify: true + transformation: + groovy: + expression: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: + - zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -4748,14 +4889,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: mensuel required: true - codify: false + transformation: + codify: false start date: checker: name: Date @@ -4789,7 +4932,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true H2O: components: value: @@ -4805,7 +4949,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true ZL: components: value: @@ -4821,7 +4966,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true FCO2: components: value: @@ -4837,7 +4983,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true H: components: value: @@ -4853,7 +5000,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true LE: components: value: @@ -4869,7 +5017,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true T: components: value: @@ -4885,7 +5034,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true u*: components: value: @@ -4901,7 +5051,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true TR: components: value: @@ -4917,7 +5068,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Sb: components: value: @@ -4933,7 +5085,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Sc: components: value: @@ -4949,7 +5102,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Sw: components: value: @@ -4965,7 +5119,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Sa: components: value: @@ -4981,7 +5136,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true FCO2_gf: components: value: @@ -4997,7 +5153,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true format: constants: - rowNumber: 1 @@ -5156,32 +5313,34 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: - expression: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: - - zones_etudes - codify: true + transformation: + groovy: + expression: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: + - zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -5193,14 +5352,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: semi-horaire required: true - codify: false + transformation: + codify: false start date: checker: name: Date @@ -5248,7 +5409,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Rg: components: value: @@ -5264,7 +5426,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Rr: components: value: @@ -5280,7 +5443,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true LWin: components: value: @@ -5296,7 +5460,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true LWout: components: value: @@ -5312,7 +5477,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Rn: components: value: @@ -5328,7 +5494,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Rd: components: value: @@ -5344,7 +5511,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true PPFD: components: value: @@ -5360,7 +5528,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true PPFDd: components: value: @@ -5376,7 +5545,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true PPFDr: components: value: @@ -5392,7 +5562,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true PPFDbc: components: value: @@ -5408,7 +5579,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true APAR: components: value: @@ -5424,7 +5596,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Ta: components: value: @@ -5440,7 +5613,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Pa: components: value: @@ -5456,7 +5630,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Tc: components: value: @@ -5472,7 +5647,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Tarbre: components: value: @@ -5488,7 +5664,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true G: components: value: @@ -5504,7 +5681,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Rh: components: value: @@ -5520,7 +5698,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true WD: components: value: @@ -5536,7 +5715,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true WS: components: value: @@ -5552,7 +5732,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true format: constants: - rowNumber: 1 @@ -5739,32 +5920,34 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: - expression: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: - - zones_etudes - codify: true + transformation: + groovy: + expression: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: + - zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -5776,14 +5959,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: journalier required: true - codify: true + transformation: + codify: true start date: checker: name: Date @@ -5817,7 +6002,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Rg: components: value: @@ -5833,7 +6019,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Rr: components: value: @@ -5849,7 +6036,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Lwin: components: value: @@ -5865,7 +6053,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Lwout: components: value: @@ -5881,7 +6070,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Rn: components: value: @@ -5897,7 +6087,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Rd: components: value: @@ -5913,7 +6104,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true PPFD: components: value: @@ -5929,7 +6121,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true PPFDd: components: value: @@ -5945,7 +6138,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true PPFDr: components: value: @@ -5961,7 +6155,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true PPFDbc: components: value: @@ -5977,7 +6172,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true APAR: components: value: @@ -5993,7 +6189,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Ta: components: value: @@ -6009,7 +6206,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Pa: components: value: @@ -6025,7 +6223,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Tc: components: value: @@ -6041,7 +6240,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Tarbre: components: value: @@ -6057,7 +6257,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true G: components: value: @@ -6073,7 +6274,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Rh: components: value: @@ -6089,7 +6291,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true WD: components: value: @@ -6105,7 +6308,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true WS: components: value: @@ -6121,7 +6325,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true format: constants: - rowNumber: 1 @@ -6304,32 +6509,34 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: - expression: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: - - zones_etudes - codify: true + transformation: + groovy: + expression: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: + - zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -6341,14 +6548,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: mensuel required: true - codify: true + transformation: + codify: true start date: checker: name: Date @@ -6382,7 +6591,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Rg: components: value: @@ -6398,7 +6608,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Rr: components: value: @@ -6414,7 +6625,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Lwin: components: value: @@ -6430,7 +6642,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Lwout: components: value: @@ -6446,7 +6659,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Rn: components: value: @@ -6462,7 +6676,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Rd: components: value: @@ -6478,7 +6693,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true PPFD: components: value: @@ -6494,7 +6710,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true PPFDd: components: value: @@ -6510,7 +6727,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true PPFDr: components: value: @@ -6526,7 +6744,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true PPFDbc: components: value: @@ -6542,7 +6761,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true APAR: components: value: @@ -6558,7 +6778,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Ta: components: value: @@ -6574,7 +6795,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Pa: components: value: @@ -6590,7 +6812,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Tc: components: value: @@ -6606,7 +6829,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Tarbre: components: value: @@ -6622,7 +6846,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true G: components: value: @@ -6638,7 +6863,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true Rh: components: value: @@ -6654,7 +6880,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true WD: components: value: @@ -6670,7 +6897,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true WS: components: value: @@ -6686,7 +6914,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true format: constants: - rowNumber: 1 diff --git a/src/test/resources/data/foret/multiyaml/configuration.yaml b/src/test/resources/data/foret/multiyaml/configuration.yaml index bda2ab5c2..27ad5e23b 100644 --- a/src/test/resources/data/foret/multiyaml/configuration.yaml +++ b/src/test/resources/data/foret/multiyaml/configuration.yaml @@ -29,7 +29,8 @@ dataTypes: params: refType: variables required: true - codify: true + transformation: + codify: true value: checker: name: Float @@ -43,7 +44,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true profondeur: defaultValue: expression: return "${profondeur}" @@ -86,30 +88,32 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: zones_etudes - codify: true + transformation: + groovy: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -121,14 +125,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: infrajournalier required: true - codify: true + transformation: + codify: true start date: checker: name: Date @@ -260,7 +266,8 @@ dataTypes: params: refType: variables required: true - codify: true + transformation: + codify: true value: checker: name: Float @@ -274,7 +281,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true profondeur: defaultValue: expression: return "${profondeur}" @@ -317,30 +325,32 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: zones_etudes - codify: true + transformation: + groovy: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -352,14 +362,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: infrajournalier required: true - codify: true + transformation: + codify: true start date: checker: name: Date @@ -492,7 +504,8 @@ dataTypes: params: refType: variables required: true - codify: true + transformation: + codify: true value: checker: name: Float @@ -506,7 +519,8 @@ dataTypes: params: refType: unites required: true - codify: true + transformation: + codify: true profondeur: defaultValue: expression: return "${profondeur}" @@ -549,30 +563,32 @@ dataTypes: checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: zones_etudes - codify: true + transformation: + groovy: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -584,14 +600,16 @@ dataTypes: name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: infrajournalier required: true - codify: true + transformation: + codify: true start date: checker: name: Date diff --git a/src/test/resources/data/foret/multiyaml/dataTypes/smp_infraj.yaml b/src/test/resources/data/foret/multiyaml/dataTypes/smp_infraj.yaml index 8e3fc838c..582c3da95 100644 --- a/src/test/resources/data/foret/multiyaml/dataTypes/smp_infraj.yaml +++ b/src/test/resources/data/foret/multiyaml/dataTypes/smp_infraj.yaml @@ -26,7 +26,8 @@ params: refType: variables required: true - codify: true + transformation: + codify: true value: checker: name: Float @@ -40,7 +41,8 @@ params: refType: unites required: true - codify: true + transformation: + codify: true profondeur: defaultValue: expression: return "${profondeur}" @@ -83,30 +85,32 @@ checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: zones_etudes - codify: true + transformation: + groovy: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -118,14 +122,16 @@ name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: infrajournalier required: true - codify: true + transformation: + codify: true start date: checker: name: Date diff --git a/src/test/resources/data/foret/multiyaml/dataTypes/ts_infraj.yaml b/src/test/resources/data/foret/multiyaml/dataTypes/ts_infraj.yaml index 9f1683846..449d9534f 100644 --- a/src/test/resources/data/foret/multiyaml/dataTypes/ts_infraj.yaml +++ b/src/test/resources/data/foret/multiyaml/dataTypes/ts_infraj.yaml @@ -26,7 +26,8 @@ params: refType: variables required: true - codify: true + transformation: + codify: true value: checker: name: Float @@ -40,7 +41,8 @@ params: refType: unites required: true - codify: true + transformation: + codify: true profondeur: defaultValue: expression: return "${profondeur}" @@ -83,30 +85,32 @@ checker: name: Reference params: - codify: true + transformation: + codify: true refType: zones_etudes required: false zones_etudes: checker: name: Reference params: - groovy: > - String parent = datumByVariableAndComponent.localization.zones_etudes_parent; - String nom = datumByVariableAndComponent.localization.zones_etudes; - String hierarchicalKey = ""; - if ("".equals(nom)){ - hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); - }else{ - parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) - nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) - hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) - } - - return references - .find{it.key.equals("zones_etudes")}.value - .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey - references: zones_etudes - codify: true + transformation: + groovy: > + String parent = datumByVariableAndComponent.localization.zones_etudes_parent; + String nom = datumByVariableAndComponent.localization.zones_etudes; + String hierarchicalKey = ""; + if ("".equals(nom)){ + hierarchicalKey = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent); + }else{ + parent = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(parent) + nom = fr.inra.oresing.rest.OreSiService.escapeKeyComponent(nom) + hierarchicalKey = String.format("%s.%s__%s", parent, parent, nom) + } + + return references + .find{it.key.equals("zones_etudes")}.value + .find {it.hierarchicalKey.equals(hierarchicalKey)} .hierarchicalKey + references: zones_etudes + codify: true refType: zones_etudes required: true informations: @@ -118,14 +122,16 @@ name: Reference params: refType: themes - codify: true + transformation: + codify: true frequency: checker: name: RegularExpression params: pattern: infrajournalier required: true - codify: true + transformation: + codify: true start date: checker: name: Date diff --git a/src/test/resources/data/foret/multiyaml/references/zones_etudes.yaml b/src/test/resources/data/foret/multiyaml/references/zones_etudes.yaml index cca65af77..854da1b27 100644 --- a/src/test/resources/data/foret/multiyaml/references/zones_etudes.yaml +++ b/src/test/resources/data/foret/multiyaml/references/zones_etudes.yaml @@ -7,7 +7,8 @@ validations: refType: types_de_zones_etudes columns: type de site required: true - codify: true + transformation: + codify: true parent_ref: description: référence au parent checker: @@ -16,7 +17,8 @@ validations: refType: zones_etudes columns: parent required: false - codify: true + transformation: + codify: true date début: description: date de début checker: diff --git a/src/test/resources/data/recursivite/recusivite.yaml b/src/test/resources/data/recursivite/recusivite.yaml index 413548f57..fabc259c3 100644 --- a/src/test/resources/data/recursivite/recusivite.yaml +++ b/src/test/resources/data/recursivite/recusivite.yaml @@ -35,7 +35,8 @@ references: params: pattern: .* required: true - codify: true + transformation: + codify: true columns: nom du taxon déterminé nom du taxon superieur: description: "nom du taxon superieur" @@ -43,7 +44,8 @@ references: name: Reference params: required: false - codify: true + transformation: + codify: true refType: taxon columns: nom du taxon superieur columns: -- GitLab From 84fe08648b253fefaff7bcddb64838097bf414f4 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Wed, 23 Mar 2022 17:48:42 +0100 Subject: [PATCH 14/41] =?UTF-8?q?Met=20=C3=A0=20jour=20la=20documentation?= =?UTF-8?q?=20pour=20distinguer=20expression=20d'un=20checker=20groovy=20e?= =?UTF-8?q?t=20transformation=20Groovy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Documentation_fichier_Yaml.md | 37 +++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/Documentation_fichier_Yaml.md b/Documentation_fichier_Yaml.md index 65a5e0cce..837908175 100644 --- a/Documentation_fichier_Yaml.md +++ b/Documentation_fichier_Yaml.md @@ -164,16 +164,19 @@ Elle comporte une description et un checker (Reference, Integer, Float, RegularE | columns | X | X | X | | X | La colonne dans laquelle on prend la valeur | | refTypes | X | | | | | Le référentiels de jointure | | pattern | | | | | X | Le pattern pour une expression régulière | -| codify | X | X | X | | X | Le contenu de la colonne est codifié | | required | X | X | X | | X | Le contenu de la colonne ne peut être vide | -| groovy | | | | X | | une section pour le traitement d'une expression groovy | | replace | | | | X | | l'expression groovy renvoie un résultat au lieu d'un booléen | La section groovy accepte trois paramètres -expression : une expression groovy (pour le checker GroovyExpression doit renvoyer true. Ou remplace la valeur actuelle pour les autres checkers) +expression : une expression groovy (pour le checker GroovyExpression doit renvoyer true si la valeur est valide) references : une liste de référentiels pour lesquels on veut disposer des valeurs dans l'expression datatypes : une liste de datatypes pour lesquels on veut disposer des valeurs dans l'expression +transformation: la configuration de la transformation à appliquer avant le contrôle + +Cette transformation peut être configurée avec +- codify : la valeur sera alors échappée pour être transformée en clé naturelle +- groovy : permet de déclarer une transformation de la valeur avec une expression Groovy (qui doit retourner une chaîne de caractère) Pour les checkers GroovyExpression, on récupère dans le script des informations : @@ -442,8 +445,8 @@ Les *variables/components* sont passés dans la map *datum*. On récupère la va name: GroovyExpression params: groovy: - expression: > - Set.of("", "0", "1", "2").contains(datum.get("SWC").get("qualité")) + expression: > + Set.of("", "0", "1", "2").contains(datum.get("SWC").get("qualité")) ``` Cette formulation vérifie que la valeur du component qualité de la variable SWC est vide ou égale à 0,1 ou 2 @@ -472,18 +475,18 @@ Pour les checkers GroovyExpression, on récupère dans le script des information checker: name: GroovyExpression params: - groovy: - expression: > - String datatype= "piegeage_en_montee" - String variable= "Nombre d'individus" - String codeVariable= "nombre_d_individus" - String component= "unit" - return referencesValues.get("variables_et_unites_par_types_de_donnees") - .findAll{it.get("nom du type de données").equals(datatype)} - .find{it.get("nom de la variable").equals(codeVariable)} - .get("nom de l'unité").equals(datum.variable.component); - references: - - variables_et_unites_par_types_de_donnees + groovy: + expression: > + String datatype= "piegeage_en_montee" + String variable= "Nombre d'individus" + String codeVariable= "nombre_d_individus" + String component= "unit" + return referencesValues.get("variables_et_unites_par_types_de_donnees") + .findAll{it.get("nom du type de données").equals(datatype)} + .find{it.get("nom de la variable").equals(codeVariable)} + .get("nom de l'unité").equals(datum.variable.component); + references: + - variables_et_unites_par_types_de_donnees ``` Des valeurs peuvent être définies dans l'expression. -- GitLab From d55768dfe17488ee497826daab7206d7bec0db18 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Wed, 23 Mar 2022 18:22:03 +0100 Subject: [PATCH 15/41] =?UTF-8?q?=C3=89crit=20les=20colonnes=20concern?= =?UTF-8?q?=C3=A9es=20par=20un=20checker=20comme=20collection=20dans=20le?= =?UTF-8?q?=20YAML?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inra/oresing/checker/CheckerFactory.java | 2 +- .../fr/inra/oresing/model/Configuration.java | 13 +---- .../rest/ApplicationConfigurationService.java | 4 +- src/test/resources/data/acbb/acbb.yaml | 6 +-- .../data/duplication/duplication.yaml | 2 +- .../resources/data/foret/foret_essai.yaml | 54 +++++++++---------- .../data/monsore/monsore-with-repository.yaml | 14 ++--- src/test/resources/data/monsore/monsore.yaml | 14 ++--- .../data/recursivite/recusivite.yaml | 4 +- 9 files changed, 52 insertions(+), 61 deletions(-) diff --git a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java index 74fc714a3..f42530fe2 100644 --- a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java +++ b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java @@ -111,7 +111,7 @@ public class CheckerFactory { LineChecker lineChecker = GroovyLineChecker.forExpression(expression, context, configurationDescription); checkersBuilder.add(lineChecker); } else { - List<CheckerOnOneVariableComponentLineChecker> lineCheckers = configurationDescription.doGetColumnsAsCollection().stream() + List<CheckerOnOneVariableComponentLineChecker> lineCheckers = configurationDescription.getColumns().stream() .map(ReferenceColumn::new) .map(checkerTarget -> newChecker(app, checkerDescription, checkerTarget)) .collect(Collectors.toList()); diff --git a/src/main/java/fr/inra/oresing/model/Configuration.java b/src/main/java/fr/inra/oresing/model/Configuration.java index ca9eb733a..890d05057 100644 --- a/src/main/java/fr/inra/oresing/model/Configuration.java +++ b/src/main/java/fr/inra/oresing/model/Configuration.java @@ -1,6 +1,5 @@ package fr.inra.oresing.model; -import com.google.common.base.Splitter; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.collect.MoreCollectors; @@ -27,7 +26,6 @@ import lombok.Getter; import lombok.Setter; import lombok.ToString; import org.apache.commons.lang3.StringUtils; -import org.assertj.core.util.Streams; import org.springframework.util.CollectionUtils; import javax.annotation.Nullable; @@ -139,7 +137,7 @@ public class Configuration { Set<ReferenceColumn> usedInTransformationColumns = validations.values().stream() .map(LineValidationRuleDescription::getChecker) .map(CheckerDescription::getParams) - .map(CheckerConfigurationDescription::doGetColumnsAsCollection) + .map(checkerConfigurationDescription -> checkerConfigurationDescription.getColumns()) .flatMap(Collection::stream) .map(ReferenceColumn::new) .collect(Collectors.toUnmodifiableSet()); @@ -380,18 +378,11 @@ public class Configuration { String pattern; String refType; GroovyConfiguration groovy; - String columns; + Set<String> columns; String duration; TransformationConfigurationDescription transformation = new TransformationConfigurationDescription(); boolean required; Multiplicity multiplicity = Multiplicity.ONE; - - public ImmutableSet<String> doGetColumnsAsCollection() { - if (StringUtils.isEmpty(getColumns())) { - return ImmutableSet.of(); - } - return Streams.stream(Splitter.on(",").split(getColumns())).collect(ImmutableSet.toImmutableSet()); - } } @Getter diff --git a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java index d920df90b..dc3781601 100644 --- a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java +++ b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java @@ -599,10 +599,10 @@ public class ApplicationConfigurationService { compileResult.ifPresent(compilationError -> builder.recordIllegalGroovyExpression(validationRuleDescriptionEntryKey, expression, compilationError)); } } else if (variableComponentCheckers.contains(checker.getName())) { - if (checker.getParams().doGetColumnsAsCollection().isEmpty()) { + if (checker.getParams().getColumns().isEmpty()) { builder.missingParamColumnReferenceForCheckerInReference(validationRuleDescriptionEntryKey, reference); } else { - ImmutableSet<String> columnsDeclaredInCheckerConfiguration = checker.getParams().doGetColumnsAsCollection(); + Set<String> columnsDeclaredInCheckerConfiguration = checker.getParams().getColumns(); Set<String> knownColumns = referenceDescription.getColumns().keySet(); ImmutableSet<String> missingColumns = Sets.difference(columnsDeclaredInCheckerConfiguration, knownColumns).immutableCopy(); if (false && !missingColumns.isEmpty()) { diff --git a/src/test/resources/data/acbb/acbb.yaml b/src/test/resources/data/acbb/acbb.yaml index 14f5f8ae0..d01af3fcd 100644 --- a/src/test/resources/data/acbb/acbb.yaml +++ b/src/test/resources/data/acbb/acbb.yaml @@ -20,7 +20,7 @@ references: name: Reference params: refType: agroecosystemes - columns: Agroécosystème + columns: [ Agroécosystème ] checkDateMiseEnService: description: "validation de date" checker: @@ -67,7 +67,7 @@ references: name: Date params: pattern: dd/MM/yyyy - columns: date creation + columns: [ date creation ] keyColumns: [site,nom_du_bloc,répétition] columns: site: @@ -112,7 +112,7 @@ references: name: Reference params: refType: modalites - columns: modalites + columns: [ modalites ] transformation: codify: true multiplicity: MANY diff --git a/src/test/resources/data/duplication/duplication.yaml b/src/test/resources/data/duplication/duplication.yaml index b69dcebfe..02d0b2623 100644 --- a/src/test/resources/data/duplication/duplication.yaml +++ b/src/test/resources/data/duplication/duplication.yaml @@ -20,7 +20,7 @@ references: name: Reference params: refType: zones_etudes - columns: parent + columns: [ parent ] required: false transformation: codify: true diff --git a/src/test/resources/data/foret/foret_essai.yaml b/src/test/resources/data/foret/foret_essai.yaml index 03bcb7e9d..bb7365f7b 100644 --- a/src/test/resources/data/foret/foret_essai.yaml +++ b/src/test/resources/data/foret/foret_essai.yaml @@ -38,7 +38,7 @@ references: name: Reference params: refType: types_de_zones_etudes - columns: type de site + columns: [ type de site ] required: true transformation: codify: true @@ -48,7 +48,7 @@ references: name: Reference params: refType: zones_etudes - columns: parent + columns: [ parent ] required: false transformation: codify: true @@ -58,14 +58,14 @@ references: name: Date params: pattern: dd/MM/yyyy - columns: date début + columns: [ date début ] date fin: description: date de fin checker: name: Date params: pattern: dd/MM/yyyy - columns: date fin + columns: [ date fin ] internationalizationName: fr: Zones d'études en: Study areas @@ -136,14 +136,14 @@ references: name: Reference params: refType: zones_etudes - columns: nom du site + columns: [ nom du site ] themeRef: description: référence au thème checker: name: Reference params: refType: themes - columns: nom du thème + columns: [ nom du thème ] internationalizationName: fr: Thèmes et types de données par zone d'étude en: Thematics and data types by study area @@ -209,7 +209,7 @@ references: name: Reference params: refType: variables - columns: nom de la variable + columns: [ nom de la variable ] required: true transformation: codify: true @@ -219,7 +219,7 @@ references: name: Reference params: refType: unites - columns: nom de l'unité + columns: [ nom de l'unité ] required: true transformation: codify: true @@ -247,7 +247,7 @@ references: name: Reference params: refType: zones_etudes - columns: nom du site + columns: [ nom du site ] required: true transformation: codify: false @@ -329,7 +329,7 @@ references: name: Reference params: refType: instruments - columns: code de l'instrument + columns: [ code de l'instrument ] required: true transformation: codify: true @@ -339,7 +339,7 @@ references: name: Reference params: refType: reference - columns: doi de la référence + columns: [ doi de la référence ] required: true transformation: codify: true @@ -364,7 +364,7 @@ references: name: Reference params: refType: instruments - columns: Code de l'instrument + columns: [ Code de l'instrument ] required: true transformation: codify: true @@ -374,7 +374,7 @@ references: name: Reference params: refType: theme_types_de_donnees_par_zone_etudes - columns: theme_types_de_donnees_par_zone_etudes + columns: [ theme_types_de_donnees_par_zone_etudes ] transformation: groovy: expression: > @@ -394,7 +394,7 @@ references: name: Reference params: refType: variables_par_types_de_donnees - columns: variables_par_types_de_donnees + columns: [ variables_par_types_de_donnees ] required: true transformation: groovy: @@ -418,14 +418,14 @@ references: name: Date params: pattern: dd/MM/yyyy - columns: Date de début + columns: [ Date de début ] date fin: description: date de fin checker: name: Date params: pattern: dd/MM/yyyy - columns: Date de fin + columns: [ Date de fin ] internationalizationName: fr: Périodes d'application des instruments en: Application periods of the instruments @@ -471,7 +471,7 @@ references: name: Reference params: refType: methodes - columns: code de la méthode de calcul + columns: [ code de la méthode de calcul ] required: true transformation: codify: true @@ -481,7 +481,7 @@ references: name: Reference params: refType: reference - columns: doi de la référence + columns: [ doi de la référence ] required: true transformation: codify: true @@ -506,7 +506,7 @@ references: name: Reference params: refType: methodes - columns: Code de la méthode de calcul + columns: [ Code de la méthode de calcul ] required: true transformation: codify: true @@ -516,7 +516,7 @@ references: name: Reference params: refType: theme_types_de_donnees_par_zone_etudes - columns: theme_types_de_donnees_par_zone_etudes + columns: [ theme_types_de_donnees_par_zone_etudes ] transformation: groovy: expression: > @@ -536,7 +536,7 @@ references: name: Reference params: refType: variables_par_types_de_donnees - columns: variables_par_types_de_donnees + columns: [ variables_par_types_de_donnees ] required: true transformation: groovy: @@ -560,14 +560,14 @@ references: name: Date params: pattern: dd/MM/yyyy - columns: Date de début + columns: [ Date de début ] date fin: description: date de fin checker: name: Date params: pattern: dd/MM/yyyy - columns: Date de fin + columns: [ Date de fin ] internationalizationName: fr: Périodes d'application des méthodes en: Application periods of methods @@ -618,7 +618,7 @@ references: name: Reference params: refType: listes_infos_complementaires - columns: nom de la liste + columns: [ nom de la liste ] transformation: codify: true keyColumns: @@ -637,7 +637,7 @@ references: name: Reference params: refType: listes_infos_complementaires - columns: nom de la liste de valeurs d'informations complémentaires + columns: [ nom de la liste de valeurs d'informations complémentaires ] transformation: codify: true required: false @@ -672,7 +672,7 @@ references: name: Reference params: refType: theme_types_de_donnees_par_zone_etudes - columns: theme_types_de_donnees_par_zone_etudes + columns: [ theme_types_de_donnees_par_zone_etudes ] transformation: groovy: expression: > @@ -692,7 +692,7 @@ references: name: Reference params: refType: variables_par_types_de_donnees - columns: variables_par_types_de_donnees + columns: [ variables_par_types_de_donnees ] required: true transformation: groovy: diff --git a/src/test/resources/data/monsore/monsore-with-repository.yaml b/src/test/resources/data/monsore/monsore-with-repository.yaml index 60b4bd373..9d0b92baf 100644 --- a/src/test/resources/data/monsore/monsore-with-repository.yaml +++ b/src/test/resources/data/monsore/monsore-with-repository.yaml @@ -68,14 +68,14 @@ references: name: Reference params: refType: type_de_sites - columns: tze_type_nom + columns: [ tze_type_nom ] siteParentRef: description: "référence à la colonne parent" checker: name: Reference params: refType: sites - columns: zet_chemin_parent + columns: [ zet_chemin_parent ] keyColumns: [zet_chemin_parent,zet_nom_key] internationalizationName: fr: Site @@ -184,21 +184,21 @@ references: name: Reference params: refType: projet - columns: nom du projet + columns: [ nom du projet ] sitesRef: description: "référence au site" checker: name: Reference params: refType: sites - columns: nom du site + columns: [ nom du site ] themesRef: description: "référence au theme" checker: name: Reference params: refType: themes - columns: nom du thème + columns: [ nom du thème ] checkDatatype: description: "test" @@ -296,14 +296,14 @@ references: name: Reference params: refType: variables - columns: nom de la variable + columns: [ nom de la variable ] uniteRef: description: "référence à l'unité'" checker: name: Reference params: refType: unites - columns: nom de l'unité + columns: [ nom de l'unité ] checkDatatype: description: "test" checker: diff --git a/src/test/resources/data/monsore/monsore.yaml b/src/test/resources/data/monsore/monsore.yaml index 557be0ba0..78bd83a17 100644 --- a/src/test/resources/data/monsore/monsore.yaml +++ b/src/test/resources/data/monsore/monsore.yaml @@ -68,14 +68,14 @@ references: name: Reference params: refType: type_de_sites - columns: tze_type_nom + columns: [ tze_type_nom ] siteParentRef: description: "référence à la colonne parent" checker: name: Reference params: refType: sites - columns: zet_chemin_parent + columns: [ zet_chemin_parent ] keyColumns: [zet_chemin_parent,zet_nom_key] internationalizationName: fr: Site @@ -184,21 +184,21 @@ references: name: Reference params: refType: projet - columns: nom du projet + columns: [ nom du projet ] sitesRef: description: "référence au site" checker: name: Reference params: refType: sites - columns: nom du site + columns: [ nom du site ] themesRef: description: "référence au theme" checker: name: Reference params: refType: themes - columns: nom du thème + columns: [ nom du thème ] checkDatatype: description: "test" @@ -296,14 +296,14 @@ references: name: Reference params: refType: variables - columns: nom de la variable + columns: [ nom de la variable ] uniteRef: description: "référence à l'unité'" checker: name: Reference params: refType: unites - columns: nom de l'unité + columns: [ nom de l'unité ] checkDatatype: description: "test" checker: diff --git a/src/test/resources/data/recursivite/recusivite.yaml b/src/test/resources/data/recursivite/recusivite.yaml index fabc259c3..b076c5769 100644 --- a/src/test/resources/data/recursivite/recusivite.yaml +++ b/src/test/resources/data/recursivite/recusivite.yaml @@ -37,7 +37,7 @@ references: required: true transformation: codify: true - columns: nom du taxon déterminé + columns: [ nom du taxon déterminé ] nom du taxon superieur: description: "nom du taxon superieur" checker: @@ -47,7 +47,7 @@ references: transformation: codify: true refType: taxon - columns: nom du taxon superieur + columns: [ nom du taxon superieur ] columns: nom du taxon déterminé: theme: -- GitLab From 2a8c379ca22a169c51ac1f49cd75a123dd5ef998 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Wed, 23 Mar 2022 18:22:25 +0100 Subject: [PATCH 16/41] =?UTF-8?q?Les=20colonnes=20des=20r=C3=A9f=C3=A9rent?= =?UTF-8?q?iels=20ont=20une=20valeur=20requise=20par=20d=C3=A9faut?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/fr/inra/oresing/model/Configuration.java | 2 +- src/test/resources/data/foret/foret_essai.yaml | 1 + src/test/resources/data/monsore/monsore.yaml | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/inra/oresing/model/Configuration.java b/src/main/java/fr/inra/oresing/model/Configuration.java index 890d05057..1b1884521 100644 --- a/src/main/java/fr/inra/oresing/model/Configuration.java +++ b/src/main/java/fr/inra/oresing/model/Configuration.java @@ -381,7 +381,7 @@ public class Configuration { Set<String> columns; String duration; TransformationConfigurationDescription transformation = new TransformationConfigurationDescription(); - boolean required; + boolean required = true; Multiplicity multiplicity = Multiplicity.ONE; } diff --git a/src/test/resources/data/foret/foret_essai.yaml b/src/test/resources/data/foret/foret_essai.yaml index bb7365f7b..442fdb370 100644 --- a/src/test/resources/data/foret/foret_essai.yaml +++ b/src/test/resources/data/foret/foret_essai.yaml @@ -65,6 +65,7 @@ references: name: Date params: pattern: dd/MM/yyyy + required: false columns: [ date fin ] internationalizationName: fr: Zones d'études diff --git a/src/test/resources/data/monsore/monsore.yaml b/src/test/resources/data/monsore/monsore.yaml index 78bd83a17..07356b24c 100644 --- a/src/test/resources/data/monsore/monsore.yaml +++ b/src/test/resources/data/monsore/monsore.yaml @@ -75,6 +75,7 @@ references: name: Reference params: refType: sites + required: false columns: [ zet_chemin_parent ] keyColumns: [zet_chemin_parent,zet_nom_key] internationalizationName: -- GitLab From a77d8af2eaca2ad1325e0704569e3d6ba2b0edc8 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Wed, 23 Mar 2022 18:29:06 +0100 Subject: [PATCH 17/41] =?UTF-8?q?fixup!=20=C3=89crit=20les=20colonnes=20co?= =?UTF-8?q?ncern=C3=A9es=20par=20un=20checker=20comme=20collection=20dans?= =?UTF-8?q?=20le=20YAML?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Documentation_fichier_Yaml.md | 8 ++++---- src/test/resources/data/acbb/acbb.yaml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation_fichier_Yaml.md b/Documentation_fichier_Yaml.md index 837908175..a35de3b89 100644 --- a/Documentation_fichier_Yaml.md +++ b/Documentation_fichier_Yaml.md @@ -131,21 +131,21 @@ Elle comporte une description et un checker (Reference, Integer, Float, RegularE name: Reference #Le checker à utiliser params: #liste de paramètres (dépend du checker choisi) refType: projet #pour le checker référence la donnée référencée - columns: nom du projet #liste des colonnes sur lequel s'applique le checker + columns: [nom du projet] #liste des colonnes sur lequel s'applique le checker sitesRef: description: "référence au site" checker: name: Reference params: refType: sites - columns: nom du site + columns: [nom du site] themesRef: description: "référence au theme" checker: name: Reference params: refType: themes - columns: nom du thème + columns: [nom du thème] checkDatatype: description: "test" @@ -311,7 +311,7 @@ references: name: Reference params: refType: modalites - columns: modalites + columns: [ modalites ] codify: true multiplicity: MANY ``` diff --git a/src/test/resources/data/acbb/acbb.yaml b/src/test/resources/data/acbb/acbb.yaml index d01af3fcd..e1becc639 100644 --- a/src/test/resources/data/acbb/acbb.yaml +++ b/src/test/resources/data/acbb/acbb.yaml @@ -27,7 +27,7 @@ references: name: Date params: pattern : "dd/MM/yyyy" - columns : "date mise en service du dispositif" + columns: [ "date mise en service du dispositif" ] columns: Agroécosystème: nom du site_key: -- GitLab From e5d495b0f6d0ad308a4a137eecf4d8859f9562e3 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Wed, 23 Mar 2022 19:11:30 +0100 Subject: [PATCH 18/41] =?UTF-8?q?Emp=C3=AAche=20de=20d=C3=A9clarer=20des?= =?UTF-8?q?=20colonnes=20sur=20un=20checker=20quand=20le=20contexte=20n'es?= =?UTF-8?q?t=20pas=20appropri=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Documentation_fichier_Yaml.md | 8 +- .../inra/oresing/checker/CheckerFactory.java | 75 ++++++++++--------- .../fr/inra/oresing/model/Configuration.java | 18 +++-- .../rest/ApplicationConfigurationService.java | 8 +- src/test/resources/data/acbb/acbb.yaml | 8 +- .../data/duplication/duplication.yaml | 2 +- .../resources/data/foret/foret_essai.yaml | 54 ++++++------- .../data/monsore/monsore-with-repository.yaml | 14 ++-- src/test/resources/data/monsore/monsore.yaml | 14 ++-- .../data/recursivite/recusivite.yaml | 4 +- 10 files changed, 108 insertions(+), 97 deletions(-) diff --git a/Documentation_fichier_Yaml.md b/Documentation_fichier_Yaml.md index a35de3b89..b710772f1 100644 --- a/Documentation_fichier_Yaml.md +++ b/Documentation_fichier_Yaml.md @@ -131,21 +131,21 @@ Elle comporte une description et un checker (Reference, Integer, Float, RegularE name: Reference #Le checker à utiliser params: #liste de paramètres (dépend du checker choisi) refType: projet #pour le checker référence la donnée référencée - columns: [nom du projet] #liste des colonnes sur lequel s'applique le checker + columns: [nom du projet] #liste des colonnes sur lequel s'applique le checker sitesRef: description: "référence au site" checker: name: Reference params: refType: sites - columns: [nom du site] + columns: [nom du site] themesRef: description: "référence au theme" checker: name: Reference params: refType: themes - columns: [nom du thème] + columns: [nom du thème] checkDatatype: description: "test" @@ -311,7 +311,7 @@ references: name: Reference params: refType: modalites - columns: [ modalites ] + columns: [ modalites ] codify: true multiplicity: MANY ``` diff --git a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java index f42530fe2..4b805fe9f 100644 --- a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java +++ b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java @@ -19,7 +19,6 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Optional; @@ -58,7 +57,20 @@ public class CheckerFactory { Preconditions.checkArgument(app.getConfiguration().getReferences().containsKey(reference), "Pas de référence " + reference + " dans " + app); Configuration.ReferenceDescription referenceDescription = app.getConfiguration().getReferences().get(reference); ImmutableSet.Builder<LineChecker> checkersBuilder = ImmutableSet.builder(); - addCheckersFromLineValidationDescriptions(app, referenceDescription.getValidations(), checkersBuilder); //Configuration.DataTypeDescription dataTypeDescription, + for (Map.Entry<String, Configuration.LineValidationRuleWithColumnsDescription> validationEntry : referenceDescription.getValidations().entrySet()) { + Configuration.LineValidationRuleWithColumnsDescription lineValidationRuleDescription = validationEntry.getValue(); + Configuration.CheckerDescription checkerDescription = lineValidationRuleDescription.getChecker(); + if (GroovyLineChecker.NAME.equals(checkerDescription.getName())) { + LineChecker lineChecker = newLineChecker(app, lineValidationRuleDescription); + checkersBuilder.add(lineChecker); + } else { + List<CheckerOnOneVariableComponentLineChecker> lineCheckers = lineValidationRuleDescription.getColumns().stream() + .map(ReferenceColumn::new) + .map(checkerTarget -> newChecker(app, checkerDescription, checkerTarget)) + .collect(Collectors.toList()); + checkersBuilder.addAll(lineCheckers); + } + } ImmutableSet<LineChecker> lineCheckers = checkersBuilder.build(); if (log.isTraceEnabled()) { log.trace("pour " + app.getName() + ", " + reference + ", on validera avec " + lineCheckers); @@ -82,7 +94,9 @@ public class CheckerFactory { .ifPresent(checkersBuilder::add); } } - addCheckersFromLineValidationDescriptions(app, dataTypeDescription.getValidations(), checkersBuilder); //Configuration.DataTypeDescription dataTypeDescription, + dataTypeDescription.getValidations().values().stream() + .map(lineValidationRuleDescription -> newLineChecker(app, lineValidationRuleDescription)) + .forEach(checkersBuilder::add); ImmutableSet<LineChecker> lineCheckers = checkersBuilder.build(); if (log.isTraceEnabled()) { log.trace("pour " + app.getName() + ", " + dataType + ", on validera avec " + lineCheckers); @@ -90,37 +104,6 @@ public class CheckerFactory { return lineCheckers; } - private void addCheckersFromLineValidationDescriptions(Application app, LinkedHashMap<String, Configuration.LineValidationRuleDescription> lineValidationDescriptions, ImmutableSet.Builder<LineChecker> checkersBuilder) { - ReferenceValueRepository referenceValueRepository = repository.getRepository(app).referenceValue(); - DataRepository dataRepository = repository.getRepository(app).data(); - for (Map.Entry<String, Configuration.LineValidationRuleDescription> validationEntry : lineValidationDescriptions.entrySet()) { - Configuration.LineValidationRuleDescription lineValidationRuleDescription = validationEntry.getValue(); - Configuration.CheckerDescription checkerDescription = lineValidationRuleDescription.getChecker(); - Configuration.CheckerConfigurationDescription configurationDescription = checkerDescription.getParams(); - if (GroovyLineChecker.NAME.equals(checkerDescription.getName())) { - String expression = configurationDescription.getGroovy().getExpression(); - Set<String> references = configurationDescription.getGroovy().getReferences(); - Set<String> dataTypes = configurationDescription.getGroovy().getDatatypes(); - ImmutableMap<String, Object> groovyContextForReferences = groovyContextHelper.getGroovyContextForReferences(referenceValueRepository, references); - ImmutableMap<String, Object> groovyContextForDataTypes = groovyContextHelper.getGroovyContextForDataTypes(dataRepository, dataTypes, app); - ImmutableMap<String, Object> context = ImmutableMap.<String, Object>builder() - .putAll(groovyContextForReferences) - .putAll(groovyContextForDataTypes) - .put("application", app) - .build(); - LineChecker lineChecker = GroovyLineChecker.forExpression(expression, context, configurationDescription); - checkersBuilder.add(lineChecker); - } else { - List<CheckerOnOneVariableComponentLineChecker> lineCheckers = configurationDescription.getColumns().stream() - .map(ReferenceColumn::new) - .map(checkerTarget -> newChecker(app, checkerDescription, checkerTarget)) - .collect(Collectors.toList()); - checkersBuilder.addAll(lineCheckers); - } - checkersBuilder.build(); - } - } - private CheckerOnOneVariableComponentLineChecker newChecker(Application app, Configuration.CheckerDescription checkerDescription, CheckerTarget target) { Configuration.CheckerConfigurationDescription configuration = MoreObjects.firstNonNull( @@ -154,4 +137,28 @@ public class CheckerFactory { Preconditions.checkState(lineChecker.getTarget().equals(target)); return lineChecker; } + + private LineChecker newLineChecker(Application app, Configuration.LineValidationRuleDescription lineValidationRuleDescription) { + Configuration.CheckerDescription checkerDescription = lineValidationRuleDescription.getChecker(); + Configuration.CheckerConfigurationDescription configurationDescription = checkerDescription.getParams(); + LineChecker lineChecker; + if (GroovyLineChecker.NAME.equals(checkerDescription.getName())) { + String expression = configurationDescription.getGroovy().getExpression(); + Set<String> references = configurationDescription.getGroovy().getReferences(); + Set<String> dataTypes = configurationDescription.getGroovy().getDatatypes(); + ReferenceValueRepository referenceValueRepository = repository.getRepository(app).referenceValue(); + ImmutableMap<String, Object> groovyContextForReferences = groovyContextHelper.getGroovyContextForReferences(referenceValueRepository, references); + DataRepository dataRepository = repository.getRepository(app).data(); + ImmutableMap<String, Object> groovyContextForDataTypes = groovyContextHelper.getGroovyContextForDataTypes(dataRepository, dataTypes, app); + ImmutableMap<String, Object> context = ImmutableMap.<String, Object>builder() + .putAll(groovyContextForReferences) + .putAll(groovyContextForDataTypes) + .put("application", app) + .build(); + lineChecker = GroovyLineChecker.forExpression(expression, context, configurationDescription); + } else { + throw new IllegalArgumentException("checker " + checkerDescription.getName()); + } + return lineChecker; + } } \ No newline at end of file diff --git a/src/main/java/fr/inra/oresing/model/Configuration.java b/src/main/java/fr/inra/oresing/model/Configuration.java index 1b1884521..79771f988 100644 --- a/src/main/java/fr/inra/oresing/model/Configuration.java +++ b/src/main/java/fr/inra/oresing/model/Configuration.java @@ -87,9 +87,9 @@ public class Configuration { private void addDependencyNodesForReference(Map<String, DependencyNode> nodes, Map.Entry<String, ReferenceDescription> reference) { DependencyNode dependencyNode = nodes.computeIfAbsent(reference.getKey(), k -> new DependencyNode(reference.getKey())); - LinkedHashMap<String, LineValidationRuleDescription> validations = reference.getValue().getValidations(); + LinkedHashMap<String, LineValidationRuleWithColumnsDescription> validations = reference.getValue().getValidations(); if (!CollectionUtils.isEmpty(validations)) { - for (Map.Entry<String, LineValidationRuleDescription> validation : validations.entrySet()) { + for (Map.Entry<String, LineValidationRuleWithColumnsDescription> validation : validations.entrySet()) { CheckerDescription checker = validation.getValue().getChecker(); if (checker != null) { String refType = checker.getParams().getRefType(); @@ -125,7 +125,7 @@ public class Configuration { private List<String> keyColumns = new LinkedList<>(); private LinkedHashMap<String, ReferenceColumnDescription> columns = new LinkedHashMap<>(); private LinkedHashMap<String, ReferenceDynamicColumnDescription> dynamicColumns = new LinkedHashMap<>(); - private LinkedHashMap<String, LineValidationRuleDescription> validations = new LinkedHashMap<>(); + private LinkedHashMap<String, LineValidationRuleWithColumnsDescription> validations = new LinkedHashMap<>(); public ImmutableSet<ReferenceColumn> doGetStaticColumns() { return columns.keySet().stream() @@ -135,9 +135,7 @@ public class Configuration { public ImmutableSet<ReferenceColumn> doGetComputedColumns() { Set<ReferenceColumn> usedInTransformationColumns = validations.values().stream() - .map(LineValidationRuleDescription::getChecker) - .map(CheckerDescription::getParams) - .map(checkerConfigurationDescription -> checkerConfigurationDescription.getColumns()) + .map(LineValidationRuleWithColumnsDescription::getColumns) .flatMap(Collection::stream) .map(ReferenceColumn::new) .collect(Collectors.toUnmodifiableSet()); @@ -234,6 +232,13 @@ public class Configuration { CheckerDescription checker; } + @Getter + @Setter + @ToString + public static class LineValidationRuleWithColumnsDescription extends LineValidationRuleDescription { + Set<String> columns; + } + @Getter @Setter @ToString @@ -378,7 +383,6 @@ public class Configuration { String pattern; String refType; GroovyConfiguration groovy; - Set<String> columns; String duration; TransformationConfigurationDescription transformation = new TransformationConfigurationDescription(); boolean required = true; diff --git a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java index dc3781601..e65cefc73 100644 --- a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java +++ b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java @@ -578,9 +578,9 @@ public class ApplicationConfigurationService { private void verifyValidationCheckersAreValids(Configuration configuration, ConfigurationParsingResult.Builder builder, Map.Entry<String, Configuration.ReferenceDescription> referenceEntry, Set<String> references) { String reference = referenceEntry.getKey(); Configuration.ReferenceDescription referenceDescription = referenceEntry.getValue(); - for (Map.Entry<String, Configuration.LineValidationRuleDescription> validationRuleDescriptionEntry : referenceDescription.getValidations().entrySet()) { + for (Map.Entry<String, Configuration.LineValidationRuleWithColumnsDescription> validationRuleDescriptionEntry : referenceDescription.getValidations().entrySet()) { String validationRuleDescriptionEntryKey = validationRuleDescriptionEntry.getKey(); - Configuration.LineValidationRuleDescription lineValidationRuleDescription = validationRuleDescriptionEntry.getValue(); + Configuration.LineValidationRuleWithColumnsDescription lineValidationRuleDescription = validationRuleDescriptionEntry.getValue(); Configuration.CheckerDescription checker = lineValidationRuleDescription.getChecker(); if (checker == null) { continue; @@ -599,10 +599,10 @@ public class ApplicationConfigurationService { compileResult.ifPresent(compilationError -> builder.recordIllegalGroovyExpression(validationRuleDescriptionEntryKey, expression, compilationError)); } } else if (variableComponentCheckers.contains(checker.getName())) { - if (checker.getParams().getColumns().isEmpty()) { + if (lineValidationRuleDescription.getColumns().isEmpty()) { builder.missingParamColumnReferenceForCheckerInReference(validationRuleDescriptionEntryKey, reference); } else { - Set<String> columnsDeclaredInCheckerConfiguration = checker.getParams().getColumns(); + Set<String> columnsDeclaredInCheckerConfiguration = lineValidationRuleDescription.getColumns(); Set<String> knownColumns = referenceDescription.getColumns().keySet(); ImmutableSet<String> missingColumns = Sets.difference(columnsDeclaredInCheckerConfiguration, knownColumns).immutableCopy(); if (false && !missingColumns.isEmpty()) { diff --git a/src/test/resources/data/acbb/acbb.yaml b/src/test/resources/data/acbb/acbb.yaml index e1becc639..eb5ab5c17 100644 --- a/src/test/resources/data/acbb/acbb.yaml +++ b/src/test/resources/data/acbb/acbb.yaml @@ -20,14 +20,14 @@ references: name: Reference params: refType: agroecosystemes - columns: [ Agroécosystème ] + columns: [ Agroécosystème ] checkDateMiseEnService: description: "validation de date" checker: name: Date params: pattern : "dd/MM/yyyy" - columns: [ "date mise en service du dispositif" ] + columns: [ "date mise en service du dispositif" ] columns: Agroécosystème: nom du site_key: @@ -67,7 +67,7 @@ references: name: Date params: pattern: dd/MM/yyyy - columns: [ date creation ] + columns: [ date creation ] keyColumns: [site,nom_du_bloc,répétition] columns: site: @@ -108,11 +108,11 @@ references: validations: modalitesRef: description: "référence aux modalités" + columns: [ modalites ] checker: name: Reference params: refType: modalites - columns: [ modalites ] transformation: codify: true multiplicity: MANY diff --git a/src/test/resources/data/duplication/duplication.yaml b/src/test/resources/data/duplication/duplication.yaml index 02d0b2623..b6aa49415 100644 --- a/src/test/resources/data/duplication/duplication.yaml +++ b/src/test/resources/data/duplication/duplication.yaml @@ -16,11 +16,11 @@ references: validations: parent_ref: description: référence au parent + columns: [ parent ] checker: name: Reference params: refType: zones_etudes - columns: [ parent ] required: false transformation: codify: true diff --git a/src/test/resources/data/foret/foret_essai.yaml b/src/test/resources/data/foret/foret_essai.yaml index 442fdb370..ca9df9efd 100644 --- a/src/test/resources/data/foret/foret_essai.yaml +++ b/src/test/resources/data/foret/foret_essai.yaml @@ -34,21 +34,21 @@ references: validations: typeSitesRef: description: référence au type de site + columns: [ type de site ] checker: name: Reference params: refType: types_de_zones_etudes - columns: [ type de site ] required: true transformation: codify: true parent_ref: description: référence au parent + columns: [ parent ] checker: name: Reference params: refType: zones_etudes - columns: [ parent ] required: false transformation: codify: true @@ -58,7 +58,7 @@ references: name: Date params: pattern: dd/MM/yyyy - columns: [ date début ] + columns: [ date début ] date fin: description: date de fin checker: @@ -66,7 +66,7 @@ references: params: pattern: dd/MM/yyyy required: false - columns: [ date fin ] + columns: [ date fin ] internationalizationName: fr: Zones d'études en: Study areas @@ -133,18 +133,18 @@ references: validations: siteRef: description: référence au site + columns: [ nom du site ] checker: name: Reference params: refType: zones_etudes - columns: [ nom du site ] themeRef: description: référence au thème + columns: [ nom du thème ] checker: name: Reference params: refType: themes - columns: [ nom du thème ] internationalizationName: fr: Thèmes et types de données par zone d'étude en: Thematics and data types by study area @@ -206,21 +206,21 @@ references: validations: variableRef: description: référence à la variable + columns: [ nom de la variable ] checker: name: Reference params: refType: variables - columns: [ nom de la variable ] required: true transformation: codify: true uniteRef: description: référence à l'unité' + columns: [ nom de l'unité ] checker: name: Reference params: refType: unites - columns: [ nom de l'unité ] required: true transformation: codify: true @@ -244,11 +244,11 @@ references: validations: siteRef: description: référence au site + columns: [ nom du site ] checker: name: Reference params: refType: zones_etudes - columns: [ nom du site ] required: true transformation: codify: false @@ -326,21 +326,21 @@ references: validations: instrumentRef: description: référence à l'instrument + columns: [ code de l'instrument ] checker: name: Reference params: refType: instruments - columns: [ code de l'instrument ] required: true transformation: codify: true DOIRef: description: référence à la référence + columns: [ doi de la référence ] checker: name: Reference params: refType: reference - columns: [ doi de la référence ] required: true transformation: codify: true @@ -361,21 +361,21 @@ references: validations: instrumentRef: description: référence à l'instrument + columns: [ Code de l'instrument ] checker: name: Reference params: refType: instruments - columns: [ Code de l'instrument ] required: true transformation: codify: true checkSiteThemeDatatype: description: référence au siteThemeDatatype + columns: [ theme_types_de_donnees_par_zone_etudes ] checker: name: Reference params: refType: theme_types_de_donnees_par_zone_etudes - columns: [ theme_types_de_donnees_par_zone_etudes ] transformation: groovy: expression: > @@ -391,11 +391,11 @@ references: - theme_types_de_donnees_par_zone_etudes checkDataypeVariableUnite: description: référence au DataypeVariableUnite + columns: [ variables_par_types_de_donnees ] checker: name: Reference params: refType: variables_par_types_de_donnees - columns: [ variables_par_types_de_donnees ] required: true transformation: groovy: @@ -419,14 +419,14 @@ references: name: Date params: pattern: dd/MM/yyyy - columns: [ Date de début ] + columns: [ Date de début ] date fin: description: date de fin checker: name: Date params: pattern: dd/MM/yyyy - columns: [ Date de fin ] + columns: [ Date de fin ] internationalizationName: fr: Périodes d'application des instruments en: Application periods of the instruments @@ -468,21 +468,21 @@ references: validations: instrumentRef: description: référence à la méthode + columns: [ code de la méthode de calcul ] checker: name: Reference params: refType: methodes - columns: [ code de la méthode de calcul ] required: true transformation: codify: true DOIRef: description: référence à la référence + columns: [ doi de la référence ] checker: name: Reference params: refType: reference - columns: [ doi de la référence ] required: true transformation: codify: true @@ -503,21 +503,21 @@ references: validations: methodeRef: description: référence à la méthode + columns: [ Code de la méthode de calcul ] checker: name: Reference params: refType: methodes - columns: [ Code de la méthode de calcul ] required: true transformation: codify: true checkSiteThemeDatatype: description: référence au siteThemeDatatype + columns: [ theme_types_de_donnees_par_zone_etudes ] checker: name: Reference params: refType: theme_types_de_donnees_par_zone_etudes - columns: [ theme_types_de_donnees_par_zone_etudes ] transformation: groovy: expression: > @@ -533,11 +533,11 @@ references: - theme_types_de_donnees_par_zone_etudes checkDataypeVariableUnite: description: référence au DataypeVariableUnite + columns: [ variables_par_types_de_donnees ] checker: name: Reference params: refType: variables_par_types_de_donnees - columns: [ variables_par_types_de_donnees ] required: true transformation: groovy: @@ -561,14 +561,14 @@ references: name: Date params: pattern: dd/MM/yyyy - columns: [ Date de début ] + columns: [ Date de début ] date fin: description: date de fin checker: name: Date params: pattern: dd/MM/yyyy - columns: [ Date de fin ] + columns: [ Date de fin ] internationalizationName: fr: Périodes d'application des méthodes en: Application periods of methods @@ -615,11 +615,11 @@ references: validations: listeRef: description: référence à la liste de valeurs d'informations complémentaires + columns: [ nom de la liste ] checker: name: Reference params: refType: listes_infos_complementaires - columns: [ nom de la liste ] transformation: codify: true keyColumns: @@ -634,11 +634,11 @@ references: validations: methodeRef: description: référence à la liste de valeurs d'informations complémentaires + columns: [ nom de la liste de valeurs d'informations complémentaires ] checker: name: Reference params: refType: listes_infos_complementaires - columns: [ nom de la liste de valeurs d'informations complémentaires ] transformation: codify: true required: false @@ -669,11 +669,11 @@ references: validations: checkSiteThemeDatatype: description: référence au siteThemeDatatype + columns: [ theme_types_de_donnees_par_zone_etudes ] checker: name: Reference params: refType: theme_types_de_donnees_par_zone_etudes - columns: [ theme_types_de_donnees_par_zone_etudes ] transformation: groovy: expression: > @@ -689,11 +689,11 @@ references: - theme_types_de_donnees_par_zone_etudes checkDataypeVariableUnite: description: référence au DataypeVariableUnite + columns: [ variables_par_types_de_donnees ] checker: name: Reference params: refType: variables_par_types_de_donnees - columns: [ variables_par_types_de_donnees ] required: true transformation: groovy: diff --git a/src/test/resources/data/monsore/monsore-with-repository.yaml b/src/test/resources/data/monsore/monsore-with-repository.yaml index 9d0b92baf..0417f1310 100644 --- a/src/test/resources/data/monsore/monsore-with-repository.yaml +++ b/src/test/resources/data/monsore/monsore-with-repository.yaml @@ -68,14 +68,14 @@ references: name: Reference params: refType: type_de_sites - columns: [ tze_type_nom ] + columns: [ tze_type_nom ] siteParentRef: description: "référence à la colonne parent" checker: name: Reference params: refType: sites - columns: [ zet_chemin_parent ] + columns: [ zet_chemin_parent ] keyColumns: [zet_chemin_parent,zet_nom_key] internationalizationName: fr: Site @@ -184,21 +184,21 @@ references: name: Reference params: refType: projet - columns: [ nom du projet ] + columns: [ nom du projet ] sitesRef: description: "référence au site" checker: name: Reference params: refType: sites - columns: [ nom du site ] + columns: [ nom du site ] themesRef: description: "référence au theme" checker: name: Reference params: refType: themes - columns: [ nom du thème ] + columns: [ nom du thème ] checkDatatype: description: "test" @@ -296,14 +296,14 @@ references: name: Reference params: refType: variables - columns: [ nom de la variable ] + columns: [ nom de la variable ] uniteRef: description: "référence à l'unité'" checker: name: Reference params: refType: unites - columns: [ nom de l'unité ] + columns: [ nom de l'unité ] checkDatatype: description: "test" checker: diff --git a/src/test/resources/data/monsore/monsore.yaml b/src/test/resources/data/monsore/monsore.yaml index 07356b24c..10d08e298 100644 --- a/src/test/resources/data/monsore/monsore.yaml +++ b/src/test/resources/data/monsore/monsore.yaml @@ -68,7 +68,7 @@ references: name: Reference params: refType: type_de_sites - columns: [ tze_type_nom ] + columns: [ tze_type_nom ] siteParentRef: description: "référence à la colonne parent" checker: @@ -76,7 +76,7 @@ references: params: refType: sites required: false - columns: [ zet_chemin_parent ] + columns: [ zet_chemin_parent ] keyColumns: [zet_chemin_parent,zet_nom_key] internationalizationName: fr: Site @@ -185,21 +185,21 @@ references: name: Reference params: refType: projet - columns: [ nom du projet ] + columns: [ nom du projet ] sitesRef: description: "référence au site" checker: name: Reference params: refType: sites - columns: [ nom du site ] + columns: [ nom du site ] themesRef: description: "référence au theme" checker: name: Reference params: refType: themes - columns: [ nom du thème ] + columns: [ nom du thème ] checkDatatype: description: "test" @@ -297,14 +297,14 @@ references: name: Reference params: refType: variables - columns: [ nom de la variable ] + columns: [ nom de la variable ] uniteRef: description: "référence à l'unité'" checker: name: Reference params: refType: unites - columns: [ nom de l'unité ] + columns: [ nom de l'unité ] checkDatatype: description: "test" checker: diff --git a/src/test/resources/data/recursivite/recusivite.yaml b/src/test/resources/data/recursivite/recusivite.yaml index b076c5769..b6c723e0b 100644 --- a/src/test/resources/data/recursivite/recusivite.yaml +++ b/src/test/resources/data/recursivite/recusivite.yaml @@ -37,7 +37,7 @@ references: required: true transformation: codify: true - columns: [ nom du taxon déterminé ] + columns: [ nom du taxon déterminé ] nom du taxon superieur: description: "nom du taxon superieur" checker: @@ -47,7 +47,7 @@ references: transformation: codify: true refType: taxon - columns: [ nom du taxon superieur ] + columns: [ nom du taxon superieur ] columns: nom du taxon déterminé: theme: -- GitLab From be655243aca692d182c5d0b3fe56b21a228395a4 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Mon, 28 Mar 2022 16:22:01 +0200 Subject: [PATCH 19/41] =?UTF-8?q?Remaniement=20du=20calcul=20des=20express?= =?UTF-8?q?ions=20qui=20s'appliquent=20comme=20valeurs=20par=20d=C3=A9faut?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/inra/oresing/rest/OreSiService.java | 90 ++++++++----------- 1 file changed, 38 insertions(+), 52 deletions(-) diff --git a/src/main/java/fr/inra/oresing/rest/OreSiService.java b/src/main/java/fr/inra/oresing/rest/OreSiService.java index b5748933d..95d79df0b 100644 --- a/src/main/java/fr/inra/oresing/rest/OreSiService.java +++ b/src/main/java/fr/inra/oresing/rest/OreSiService.java @@ -30,7 +30,6 @@ import fr.inra.oresing.checker.LineChecker; import fr.inra.oresing.checker.Multiplicity; import fr.inra.oresing.checker.ReferenceLineChecker; import fr.inra.oresing.checker.ReferenceLineCheckerConfiguration; -import fr.inra.oresing.groovy.CommonExpression; import fr.inra.oresing.groovy.Expression; import fr.inra.oresing.groovy.GroovyContextHelper; import fr.inra.oresing.groovy.StringGroovyExpression; @@ -892,41 +891,13 @@ public class OreSiService { * Si des valeurs par défaut ont été définies dans le YAML, la donnée doit les avoir. */ private Function<RowWithData, RowWithData> buildReplaceMissingValuesByDefaultValuesFn(Application app, String dataType, Map<String, String> requiredAuthorizations) { - ReferenceValueRepository referenceValueRepository = repo.getRepository(app).referenceValue(); - Configuration.DataTypeDescription dataTypeDescription = app.getConfiguration().getDataTypes().get(dataType); - ImmutableMap<VariableComponentKey, Expression<String>> defaultValueExpressions = getDefaultValueExpressions(dataTypeDescription, requiredAuthorizations); - Map<String, Configuration.ColumnDescription> data = dataTypeDescription.getData(); - Map<VariableComponentKey, Function<Datum, String>> defaultValueFns = new LinkedHashMap<>(); - Set<VariableComponentKey> replaceEnabled = new LinkedHashSet<>(); - for (Map.Entry<VariableComponentKey, Expression<String>> entry : defaultValueExpressions.entrySet()) { - VariableComponentKey variableComponentKey = entry.getKey(); - Expression<String> expression = entry.getValue(); - Configuration.VariableComponentDefaultValueDescription params = Optional.ofNullable(data) - .map(columnDescriptionLinkedHashMap -> columnDescriptionLinkedHashMap.get(variableComponentKey.getVariable())) - .map(columnDescription -> columnDescription.getComponents()) - .map(variableComponentDescriptionLinkedHashMap -> variableComponentDescriptionLinkedHashMap.get(variableComponentKey.getComponent())) - .map(Configuration.VariableComponentDescription::getDefaultValue) - .orElseGet(Configuration.VariableComponentDefaultValueDescription::new); - Set<String> configurationReferences = params.getReferences(); - ImmutableMap<String, Object> contextForExpression = groovyContextHelper.getGroovyContextForReferences(referenceValueRepository, configurationReferences); - Preconditions.checkState(params.getDatatypes().isEmpty(), "à ce stade, on ne gère pas la chargement de données"); - Function<Datum, String> computeDefaultValueFn = datum -> { - ImmutableMap<String, Object> evaluationContext = ImmutableMap.<String, Object>builder() - .putAll(contextForExpression) - .putAll(datum.getEvaluationContext()) - .build(); - String evaluate = expression.evaluate(evaluationContext); - return evaluate; - }; - defaultValueFns.put(variableComponentKey, computeDefaultValueFn); - if (params.isReplace()) { - replaceEnabled.add(variableComponentKey); - } - } + ComputedValuesContext computedValuesContext = getComputedValuesContext(app, dataType, requiredAuthorizations); + ImmutableMap<VariableComponentKey, Function<Datum, String>> defaultValueFns = computedValuesContext.getDefaultValueFns(); + ImmutableSet<VariableComponentKey> replaceEnabled = computedValuesContext.getReplaceEnabled(); return rowWithData -> { Map<VariableComponentKey, String> rowWithDefaults = new LinkedHashMap<>(); Map<VariableComponentKey, String> rowWithValues = new LinkedHashMap<>(rowWithData.getDatum().asMap()); - defaultValueFns.entrySet().stream() + defaultValueFns.entrySet() .forEach(variableComponentKeyExpressionEntry -> { VariableComponentKey variableComponentKey = variableComponentKeyExpressionEntry.getKey(); Function<Datum, String> computeDefaultValueFn = variableComponentKeyExpressionEntry.getValue(); @@ -1174,17 +1145,19 @@ public class OreSiService { } } - private ImmutableMap<VariableComponentKey, Expression<String>> getDefaultValueExpressions(Configuration.DataTypeDescription dataTypeDescription, Map<String, String> requiredAuthorizations) { - ImmutableMap.Builder<VariableComponentKey, Expression<String>> defaultValueExpressionsBuilder = ImmutableMap.builder(); - - List<String> variableComponentsFromRepository = new LinkedList<>(); + private ComputedValuesContext getComputedValuesContext(Application app, String dataType, Map<String, String> requiredAuthorizations) { + ReferenceValueRepository referenceValueRepository = repo.getRepository(app).referenceValue(); + Configuration.DataTypeDescription dataTypeDescription = app.getConfiguration().getDataTypes().get(dataType); + ImmutableMap.Builder<VariableComponentKey, Function<Datum, String>> defaultValueFns = ImmutableMap.builder(); + ImmutableSet.Builder<VariableComponentKey> replaceEnabledBuilder = ImmutableSet.builder(); + Set<VariableComponentKey> variableComponentsFromRepository = new LinkedHashSet<>(); if (requiredAuthorizations != null) { for (Map.Entry<String, String> entry : requiredAuthorizations.entrySet()) { Configuration.AuthorizationScopeDescription authorizationScopeDescription = dataTypeDescription.getAuthorization().getAuthorizationScopes().get(entry.getKey()); VariableComponentKey variableComponentKey = authorizationScopeDescription.getVariableComponentKey(); String value = entry.getValue(); - defaultValueExpressionsBuilder.put(variableComponentKey, StringGroovyExpression.forExpression("\"" + value + "\"")); - variableComponentsFromRepository.add(variableComponentKey.getId()); + defaultValueFns.put(variableComponentKey, datum -> value); + variableComponentsFromRepository.add(variableComponentKey); } } for (Map.Entry<String, Configuration.ColumnDescription> variableEntry : dataTypeDescription.getData().entrySet()) { @@ -1194,24 +1167,37 @@ public class OreSiService { String component = componentEntry.getKey(); Configuration.VariableComponentDescription componentDescription = componentEntry.getValue(); VariableComponentKey variableComponentKey = new VariableComponentKey(variable, component); - if (variableComponentsFromRepository.contains(variableComponentKey.getId())) { + if (variableComponentsFromRepository.contains(variableComponentKey)) { continue; } - Expression<String> defaultValueExpression = Optional.ofNullable(componentDescription) + Configuration.VariableComponentDefaultValueDescription params = Optional.ofNullable(componentDescription) .map(Configuration.VariableComponentDescription::getDefaultValue) - .map(Configuration.VariableComponentDefaultValueDescription::getExpression) - .filter(StringUtils::isNotEmpty) - .map(StringGroovyExpression::forExpression) - .map(x -> (Expression<String>) x) - .orElse(CommonExpression.EMPTY_STRING); - defaultValueExpressionsBuilder.put(variableComponentKey, defaultValueExpression); + .orElseGet(Configuration.VariableComponentDefaultValueDescription::new); + Expression<String> defaultValueExpression = StringGroovyExpression.forExpression(params.getExpression()); + Set<String> configurationReferences = params.getReferences(); + ImmutableMap<String, Object> contextForExpression = groovyContextHelper.getGroovyContextForReferences(referenceValueRepository, configurationReferences); + Preconditions.checkState(params.getDatatypes().isEmpty(), "à ce stade, on ne gère pas la chargement de données"); + Function<Datum, String> computeDefaultValueFn = datum -> { + ImmutableMap<String, Object> evaluationContext = ImmutableMap.<String, Object>builder() + .putAll(contextForExpression) + .putAll(datum.getEvaluationContext()) + .build(); + String evaluate = defaultValueExpression.evaluate(evaluationContext); + return evaluate; + }; + defaultValueFns.put(variableComponentKey, computeDefaultValueFn); + if (params.isReplace()) { + replaceEnabledBuilder.add(variableComponentKey); + } } } - ImmutableMap<VariableComponentKey, Expression<String>> defaultValueExpressions = defaultValueExpressionsBuilder.build(); - if (log.isDebugEnabled()) { - //log.debug("expressions des valeurs par défaut détectées pour " + dataTypeDescription + " = " + defaultValueExpressions); - } - return defaultValueExpressions; + return new ComputedValuesContext(defaultValueFns.build(), replaceEnabledBuilder.build()); + } + + @Value + private static class ComputedValuesContext { + ImmutableMap<VariableComponentKey, Function<Datum, String>> defaultValueFns; + ImmutableSet<VariableComponentKey> replaceEnabled; } public String getDataCsv(DownloadDatasetQuery downloadDatasetQuery, String nameOrId, String dataType, String locale) { -- GitLab From efdd6608a630eb6312ffbe1e5823caa8558c1024 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Mon, 28 Mar 2022 18:46:25 +0200 Subject: [PATCH 20/41] Supprime "replace" dans defaultValue et introduit computedComponents dans le YAML --- .../inra/oresing/checker/CheckerFactory.java | 2 +- .../fr/inra/oresing/model/Configuration.java | 36 +- .../rest/ApplicationConfigurationService.java | 22 +- .../fr/inra/oresing/rest/OreSiResources.java | 2 +- .../fr/inra/oresing/rest/OreSiService.java | 65 ++- .../inra/oresing/rest/RelationalService.java | 2 +- .../resources/data/monsore/compare/export.csv | 546 +++++++++--------- .../data/monsore/monsore-with-repository.yaml | 19 +- src/test/resources/data/monsore/monsore.yaml | 19 +- 9 files changed, 374 insertions(+), 339 deletions(-) diff --git a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java index 4b805fe9f..5655034a0 100644 --- a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java +++ b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java @@ -85,7 +85,7 @@ public class CheckerFactory { for (Map.Entry<String, Configuration.ColumnDescription> variableEntry : dataTypeDescription.getData().entrySet()) { String variable = variableEntry.getKey(); Configuration.ColumnDescription variableDescription = variableEntry.getValue(); - for (Map.Entry<String, Configuration.VariableComponentDescription> componentEntry : variableDescription.getComponents().entrySet()) { + for (Map.Entry<String, Configuration.VariableComponentDescription> componentEntry : variableDescription.doGetAllComponentDescriptions().entrySet()) { String component = componentEntry.getKey(); VariableComponentKey variableComponentKey = new VariableComponentKey(variable, component); Optional.ofNullable(componentEntry.getValue()) diff --git a/src/main/java/fr/inra/oresing/model/Configuration.java b/src/main/java/fr/inra/oresing/model/Configuration.java index 9755efd30..446f0c125 100644 --- a/src/main/java/fr/inra/oresing/model/Configuration.java +++ b/src/main/java/fr/inra/oresing/model/Configuration.java @@ -342,7 +342,23 @@ public class Configuration { @ToString public static class ColumnDescription { Chart chartDescription; - LinkedHashMap<String, VariableComponentDescription> components = new LinkedHashMap<>(); + LinkedHashMap<String, VariableComponentWithDefaultValueDescription> components = new LinkedHashMap<>(); + LinkedHashMap<String, ComputedVariableComponentDescription> computedComponents = new LinkedHashMap<>(); + + public Set<String> doGetAllComponents() { + return doGetAllComponentDescriptions().keySet(); + } + + public Map<String, VariableComponentDescription> doGetAllComponentDescriptions() { + Map<String, VariableComponentDescription> allComponentDescriptions = new LinkedHashMap<>(); + allComponentDescriptions.putAll(components); + allComponentDescriptions.putAll(computedComponents); + return allComponentDescriptions; + } + + public boolean hasComponent(String component) { + return doGetAllComponents().contains(component); + } } @Getter @@ -387,21 +403,23 @@ public class Configuration { @Getter @Setter - @ToString - public static class VariableComponentDescription { + public abstract static class VariableComponentDescription { CheckerDescription checker; + } + + @Getter + @Setter + @ToString + public static class VariableComponentWithDefaultValueDescription extends VariableComponentDescription { @Nullable - VariableComponentDefaultValueDescription defaultValue; + GroovyConfiguration defaultValue; } @Getter @Setter @ToString - public static class VariableComponentDefaultValueDescription implements fr.inra.oresing.checker.GroovyConfiguration { - String expression; - Set<String> references = new LinkedHashSet<>(); - Set<String> datatypes = new LinkedHashSet<>(); - boolean replace; + public static class ComputedVariableComponentDescription extends VariableComponentDescription { + GroovyConfiguration computation; } @Getter diff --git a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java index 920153ff8..a58e9254d 100644 --- a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java +++ b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java @@ -158,7 +158,7 @@ public class ApplicationConfigurationService { final Configuration.Chart chartDescription = entry.getValue().getChartDescription(); if (chartDescription != null) { final String valueComponent = chartDescription.getValue(); - final LinkedHashMap<String, Configuration.VariableComponentDescription> components = entry.getValue().getComponents(); + final Map<String, Configuration.VariableComponentDescription> components = entry.getValue().doGetAllComponentDescriptions(); if (Strings.isNullOrEmpty(valueComponent)) { builder.recordUndeclaredValueForChart(datatype, variable, components.keySet()); } else { @@ -169,7 +169,7 @@ public class ApplicationConfigurationService { if (aggregation != null) { if (!dataTypeDescription.getData().containsKey(aggregation.getVariable())) { builder.recordMissingAggregationVariableForChart(datatype, variable, aggregation, dataTypeDescription.getData().keySet()); - } else if (!dataTypeDescription.getData().get(aggregation.getVariable()).getComponents().containsKey(aggregation.getComponent())) { + } else if (!dataTypeDescription.getData().get(aggregation.getVariable()).hasComponent(aggregation.getComponent())) { builder.recordMissingAggregationComponentForChart(datatype, variable, aggregation, components.keySet()); } @@ -340,14 +340,14 @@ public class ApplicationConfigurationService { builder.recordAuthorizationScopeVariableComponentKeyUnknownVariable(authorizationScopeVariableComponentKey, variables); } else { String component = authorizationScopeVariableComponentKey.getComponent(); - LinkedHashMap<String, Configuration.VariableComponentDescription> componentsInDescription = variableInDescription.getComponents(); + Map<String, Configuration.VariableComponentDescription> componentsInDescription = variableInDescription.doGetAllComponentDescriptions(); if (component == null) { builder.recordAuthorizationVariableComponentKeyMissingComponent(dataType, authorizationScopeName, variable, componentsInDescription.keySet()); } else { if (!componentsInDescription.containsKey(component)) { builder.recordAuthorizationVariableComponentKeyUnknownComponent(authorizationScopeVariableComponentKey, componentsInDescription.keySet()); } else { - Configuration.CheckerDescription authorizationScopeVariableComponentChecker = dataTypeDescription.getData().get(variable).getComponents().get(authorizationScopeVariableComponentKey.getComponent()).getChecker(); + Configuration.CheckerDescription authorizationScopeVariableComponentChecker = dataTypeDescription.getData().get(variable).doGetAllComponentDescriptions().get(authorizationScopeVariableComponentKey.getComponent()).getChecker(); if (authorizationScopeVariableComponentChecker == null || !"Reference".equals(authorizationScopeVariableComponentChecker.getName())) { builder.recordAuthorizationScopeVariableComponentWrongChecker(authorizationScopeVariableComponentKey, "Date"); } @@ -393,12 +393,12 @@ public class ApplicationConfigurationService { builder.recordTimeScopeVariableComponentKeyUnknownVariable(timeScopeVariableComponentKey, variables); } else { if (timeScopeVariableComponentKey.getComponent() == null) { - builder.recordTimeVariableComponentKeyMissingComponent(dataType, timeScopeVariableComponentKey.getVariable(), dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).getComponents().keySet()); + builder.recordTimeVariableComponentKeyMissingComponent(dataType, timeScopeVariableComponentKey.getVariable(), dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).doGetAllComponents()); } else { - if (!dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).getComponents().containsKey(timeScopeVariableComponentKey.getComponent())) { - builder.recordTimeVariableComponentKeyUnknownComponent(timeScopeVariableComponentKey, dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).getComponents().keySet()); + if (!dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).hasComponent(timeScopeVariableComponentKey.getComponent())) { + builder.recordTimeVariableComponentKeyUnknownComponent(timeScopeVariableComponentKey, dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).doGetAllComponents()); } else { - Configuration.CheckerDescription timeScopeVariableComponentChecker = dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).getComponents().get(timeScopeVariableComponentKey.getComponent()).getChecker(); + Configuration.CheckerDescription timeScopeVariableComponentChecker = dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).doGetAllComponentDescriptions().get(timeScopeVariableComponentKey.getComponent()).getChecker(); if (timeScopeVariableComponentChecker == null || !"Date".equals(timeScopeVariableComponentChecker.getName())) { builder.recordTimeScopeVariableComponentWrongChecker(timeScopeVariableComponentKey, "Date"); } @@ -421,7 +421,7 @@ public class ApplicationConfigurationService { for (Map.Entry<String, Configuration.ColumnDescription> columnDescriptionEntry : dataTypeDescription.getData().entrySet()) { Configuration.ColumnDescription columnDescription = columnDescriptionEntry.getValue(); String variable = columnDescriptionEntry.getKey(); - for (Map.Entry<String, Configuration.VariableComponentDescription> variableComponentDescriptionEntry : columnDescription.getComponents().entrySet()) { + for (Map.Entry<String, Configuration.VariableComponentDescription> variableComponentDescriptionEntry : columnDescription.doGetAllComponentDescriptions().entrySet()) { Configuration.VariableComponentDescription variableComponentDescription = variableComponentDescriptionEntry.getValue(); if (variableComponentDescription == null) { continue; @@ -467,7 +467,7 @@ public class ApplicationConfigurationService { for (Map.Entry<String, Configuration.ColumnDescription> dataEntry : dataTypeDescription.getData().entrySet()) { String datum = dataEntry.getKey(); Configuration.ColumnDescription datumDescription = dataEntry.getValue(); - for (Map.Entry<String, Configuration.VariableComponentDescription> componentEntry : datumDescription.getComponents().entrySet()) { + for (Map.Entry<String, Configuration.VariableComponentDescription> componentEntry : datumDescription.doGetAllComponentDescriptions().entrySet()) { String component = componentEntry.getKey(); Configuration.VariableComponentDescription variableComponentDescription = componentEntry.getValue(); if (variableComponentDescription != null) { @@ -599,7 +599,7 @@ public class ApplicationConfigurationService { private void verifyUniquenessComponentKeysInDatatype(String dataType, Configuration.DataTypeDescription dataTypeDescription, ConfigurationParsingResult.Builder builder) { final List<VariableComponentKey> uniqueness = dataTypeDescription.getUniqueness(); final Set<String> availableVariableComponents = dataTypeDescription.getData().entrySet().stream() - .flatMap(entry -> entry.getValue().getComponents().keySet().stream() + .flatMap(entry -> entry.getValue().doGetAllComponents().stream() .map(componentName -> new VariableComponentKey(entry.getKey(), componentName).getId())) .collect(Collectors.<String>toSet()); Set<String> variableComponentsKeyInUniqueness = new HashSet<>(); diff --git a/src/main/java/fr/inra/oresing/rest/OreSiResources.java b/src/main/java/fr/inra/oresing/rest/OreSiResources.java index 3530e5db8..176efa036 100644 --- a/src/main/java/fr/inra/oresing/rest/OreSiResources.java +++ b/src/main/java/fr/inra/oresing/rest/OreSiResources.java @@ -125,7 +125,7 @@ public class OreSiResources { }); Map<String, ApplicationResult.DataType> dataTypes = Maps.transformEntries(application.getConfiguration().getDataTypes(), (dataType, dataTypeDescription) -> { Map<String, ApplicationResult.DataType.Variable> variables = Maps.transformEntries(dataTypeDescription.getData(), (variable, variableDescription) -> { - Map<String, ApplicationResult.DataType.Variable.Component> components = Maps.transformEntries(variableDescription.getComponents(), (component, componentDescription) -> { + Map<String, ApplicationResult.DataType.Variable.Component> components = Maps.transformEntries(variableDescription.doGetAllComponentDescriptions(), (component, componentDescription) -> { return new ApplicationResult.DataType.Variable.Component(component, component); }); Configuration.Chart chartDescription = variableDescription.getChartDescription(); diff --git a/src/main/java/fr/inra/oresing/rest/OreSiService.java b/src/main/java/fr/inra/oresing/rest/OreSiService.java index 95d79df0b..e65197d34 100644 --- a/src/main/java/fr/inra/oresing/rest/OreSiService.java +++ b/src/main/java/fr/inra/oresing/rest/OreSiService.java @@ -1146,9 +1146,8 @@ public class OreSiService { } private ComputedValuesContext getComputedValuesContext(Application app, String dataType, Map<String, String> requiredAuthorizations) { - ReferenceValueRepository referenceValueRepository = repo.getRepository(app).referenceValue(); Configuration.DataTypeDescription dataTypeDescription = app.getConfiguration().getDataTypes().get(dataType); - ImmutableMap.Builder<VariableComponentKey, Function<Datum, String>> defaultValueFns = ImmutableMap.builder(); + ImmutableMap.Builder<VariableComponentKey, Function<Datum, String>> defaultValueFnsBuilder = ImmutableMap.builder(); ImmutableSet.Builder<VariableComponentKey> replaceEnabledBuilder = ImmutableSet.builder(); Set<VariableComponentKey> variableComponentsFromRepository = new LinkedHashSet<>(); if (requiredAuthorizations != null) { @@ -1156,42 +1155,58 @@ public class OreSiService { Configuration.AuthorizationScopeDescription authorizationScopeDescription = dataTypeDescription.getAuthorization().getAuthorizationScopes().get(entry.getKey()); VariableComponentKey variableComponentKey = authorizationScopeDescription.getVariableComponentKey(); String value = entry.getValue(); - defaultValueFns.put(variableComponentKey, datum -> value); + defaultValueFnsBuilder.put(variableComponentKey, datum -> value); variableComponentsFromRepository.add(variableComponentKey); } } for (Map.Entry<String, Configuration.ColumnDescription> variableEntry : dataTypeDescription.getData().entrySet()) { String variable = variableEntry.getKey(); Configuration.ColumnDescription variableDescription = variableEntry.getValue(); - for (Map.Entry<String, Configuration.VariableComponentDescription> componentEntry : variableDescription.getComponents().entrySet()) { + for (Map.Entry<String, Configuration.VariableComponentWithDefaultValueDescription> componentEntry : variableDescription.getComponents().entrySet()) { String component = componentEntry.getKey(); - Configuration.VariableComponentDescription componentDescription = componentEntry.getValue(); + Configuration.VariableComponentWithDefaultValueDescription componentDescription = componentEntry.getValue(); VariableComponentKey variableComponentKey = new VariableComponentKey(variable, component); if (variableComponentsFromRepository.contains(variableComponentKey)) { continue; } - Configuration.VariableComponentDefaultValueDescription params = Optional.ofNullable(componentDescription) - .map(Configuration.VariableComponentDescription::getDefaultValue) - .orElseGet(Configuration.VariableComponentDefaultValueDescription::new); - Expression<String> defaultValueExpression = StringGroovyExpression.forExpression(params.getExpression()); - Set<String> configurationReferences = params.getReferences(); - ImmutableMap<String, Object> contextForExpression = groovyContextHelper.getGroovyContextForReferences(referenceValueRepository, configurationReferences); - Preconditions.checkState(params.getDatatypes().isEmpty(), "à ce stade, on ne gère pas la chargement de données"); - Function<Datum, String> computeDefaultValueFn = datum -> { - ImmutableMap<String, Object> evaluationContext = ImmutableMap.<String, Object>builder() - .putAll(contextForExpression) - .putAll(datum.getEvaluationContext()) - .build(); - String evaluate = defaultValueExpression.evaluate(evaluationContext); - return evaluate; - }; - defaultValueFns.put(variableComponentKey, computeDefaultValueFn); - if (params.isReplace()) { - replaceEnabledBuilder.add(variableComponentKey); + Optional.ofNullable(componentDescription) + .map(Configuration.VariableComponentWithDefaultValueDescription::getDefaultValue) + .map(defaultValueConfiguration -> getEvaluateGroovyWithContextFunction(app, defaultValueConfiguration)) + .ifPresent(computeDefaultValueFn -> defaultValueFnsBuilder.put(variableComponentKey, computeDefaultValueFn)); + } + for (Map.Entry<String, Configuration.ComputedVariableComponentDescription> computedComponentEntry : variableDescription.getComputedComponents().entrySet()) { + String component = computedComponentEntry.getKey(); + Configuration.ComputedVariableComponentDescription componentDescription = computedComponentEntry.getValue(); + VariableComponentKey variableComponentKey = new VariableComponentKey(variable, component); + if (variableComponentsFromRepository.contains(variableComponentKey)) { + continue; } + Configuration.GroovyConfiguration computation = Optional.ofNullable(componentDescription) + .map(Configuration.ComputedVariableComponentDescription::getComputation) + .orElseThrow(); + Function<Datum, String> computeDefaultValueFn = getEvaluateGroovyWithContextFunction(app, computation); + defaultValueFnsBuilder.put(variableComponentKey, computeDefaultValueFn); + replaceEnabledBuilder.add(variableComponentKey); } } - return new ComputedValuesContext(defaultValueFns.build(), replaceEnabledBuilder.build()); + return new ComputedValuesContext(defaultValueFnsBuilder.build(), replaceEnabledBuilder.build()); + } + + private Function<Datum, String> getEvaluateGroovyWithContextFunction(Application app, Configuration.GroovyConfiguration computation) { + ReferenceValueRepository referenceValueRepository = repo.getRepository(app).referenceValue(); + Expression<String> defaultValueExpression = StringGroovyExpression.forExpression(computation.getExpression()); + Set<String> configurationReferences = computation.getReferences(); + ImmutableMap<String, Object> contextForExpression = groovyContextHelper.getGroovyContextForReferences(referenceValueRepository, configurationReferences); + Preconditions.checkState(computation.getDatatypes().isEmpty(), "à ce stade, on ne gère pas la chargement de données"); + Function<Datum, String> computeDefaultValueFn = datum -> { + ImmutableMap<String, Object> evaluationContext = ImmutableMap.<String, Object>builder() + .putAll(contextForExpression) + .putAll(datum.getEvaluationContext()) + .build(); + String evaluate = defaultValueExpression.evaluate(evaluationContext); + return evaluate; + }; + return computeDefaultValueFn; } @Value @@ -1559,7 +1574,7 @@ public class OreSiService { } private Stream<VariableComponentKey> getVariableComponentKeys(Map.Entry<String, Configuration.ColumnDescription> entry) { - return entry.getValue().getComponents().keySet().stream() + return entry.getValue().doGetAllComponents().stream() .map(componentName -> new VariableComponentKey(entry.getKey(), componentName)); } diff --git a/src/main/java/fr/inra/oresing/rest/RelationalService.java b/src/main/java/fr/inra/oresing/rest/RelationalService.java index 81f9f14ff..375551ea3 100644 --- a/src/main/java/fr/inra/oresing/rest/RelationalService.java +++ b/src/main/java/fr/inra/oresing/rest/RelationalService.java @@ -254,7 +254,7 @@ public class RelationalService implements InitializingBean, DisposableBean { Set<VariableComponentKey> references = new LinkedHashSet<>(); for (Map.Entry<String, Configuration.ColumnDescription> variableEntry : dataTypeDescription.getData().entrySet()) { String variable = variableEntry.getKey(); - for (String component : variableEntry.getValue().getComponents().keySet()) { + for (String component : variableEntry.getValue().doGetAllComponents()) { references.add(new VariableComponentKey(variable, component)); } } diff --git a/src/test/resources/data/monsore/compare/export.csv b/src/test/resources/data/monsore/compare/export.csv index 5eba68c29..2e03525e7 100644 --- a/src/test/resources/data/monsore/compare/export.csv +++ b/src/test/resources/data/monsore/compare/export.csv @@ -1,273 +1,273 @@ -date;site;projet;espece;Nombre d'individus;plateforme;Couleur des individus -01/01/1984;bassin_versant.nivelle;projet_atlantique;sat;39;p1;couleur_des_individus__bleu -01/01/1984;bassin_versant.nivelle;projet_atlantique;alo;15;p1;couleur_des_individus__bleu -01/01/1984;bassin_versant.nivelle;projet_atlantique;ang;38;p1;couleur_des_individus__vert -01/01/1984;bassin_versant.nivelle;projet_atlantique;trf;18;p1;couleur_des_individus__rouge -01/01/1984;bassin_versant.nivelle;projet_atlantique;lpm;27;p1;couleur_des_individus__rouge -01/01/1984;bassin_versant.nivelle;projet_atlantique;lpf;54;p1;couleur_des_individus__bleu -01/01/1984;bassin_versant.nivelle;projet_atlantique;trm;25;p1;couleur_des_individus__vert -01/01/1984;plateforme.oir.oir__p1;projet_atlantique;lpm;27;a;couleur_des_individus__rouge -01/01/1984;plateforme.oir.oir__p1;projet_atlantique;trf;18;a;couleur_des_individus__rouge -01/01/1984;plateforme.oir.oir__p1;projet_atlantique;sat;39;a;couleur_des_individus__bleu -01/01/1984;plateforme.oir.oir__p1;projet_atlantique;ang;38;a;couleur_des_individus__vert -01/01/1984;plateforme.oir.oir__p1;projet_atlantique;alo;15;a;couleur_des_individus__bleu -01/01/1984;plateforme.oir.oir__p1;projet_atlantique;trm;25;a;couleur_des_individus__vert -01/01/1984;plateforme.oir.oir__p1;projet_atlantique;lpf;54;a;couleur_des_individus__bleu -01/01/1984;bassin_versant.oir;projet_atlantique;trm;25;p2;couleur_des_individus__vert -01/01/1984;bassin_versant.oir;projet_atlantique;trf;18;p2;couleur_des_individus__rouge -01/01/1984;bassin_versant.oir;projet_atlantique;ang;38;p2;couleur_des_individus__vert -01/01/1984;bassin_versant.oir;projet_atlantique;lpf;54;p2;couleur_des_individus__bleu -01/01/1984;bassin_versant.oir;projet_atlantique;alo;15;p2;couleur_des_individus__bleu -01/01/1984;bassin_versant.oir;projet_atlantique;sat;39;p2;couleur_des_individus__bleu -01/01/1984;bassin_versant.oir;projet_atlantique;lpm;27;p2;couleur_des_individus__rouge -01/01/1984;bassin_versant.scarff;projet_atlantique;sat;39;p1;couleur_des_individus__bleu -01/01/1984;bassin_versant.scarff;projet_atlantique;lpf;54;p1;couleur_des_individus__bleu -01/01/1984;bassin_versant.scarff;projet_atlantique;ang;38;p1;couleur_des_individus__vert -01/01/1984;bassin_versant.scarff;projet_atlantique;trm;25;p1;couleur_des_individus__vert -01/01/1984;bassin_versant.scarff;projet_atlantique;lpm;27;p1;couleur_des_individus__rouge -01/01/1984;bassin_versant.scarff;projet_atlantique;trf;18;p1;couleur_des_individus__rouge -01/01/1984;bassin_versant.scarff;projet_atlantique;alo;15;p1;couleur_des_individus__bleu -01/01/1984;bassin_versant.nivelle;projet_manche;trf;18;p1;couleur_des_individus__rouge -01/01/1984;bassin_versant.nivelle;projet_manche;alo;15;p1;couleur_des_individus__bleu -01/01/1984;bassin_versant.nivelle;projet_manche;lpf;54;p1;couleur_des_individus__bleu -01/01/1984;bassin_versant.nivelle;projet_manche;lpm;27;p1;couleur_des_individus__rouge -01/01/1984;bassin_versant.nivelle;projet_manche;sat;39;p1;couleur_des_individus__bleu -01/01/1984;bassin_versant.nivelle;projet_manche;trm;25;p1;couleur_des_individus__vert -01/01/1984;bassin_versant.nivelle;projet_manche;ang;38;p1;couleur_des_individus__vert -01/01/1984;bassin_versant.oir;projet_manche;lpm;27;p1;couleur_des_individus__rouge -01/01/1984;bassin_versant.oir;projet_manche;lpf;54;p1;couleur_des_individus__bleu -01/01/1984;bassin_versant.oir;projet_manche;sat;39;p1;couleur_des_individus__bleu -01/01/1984;bassin_versant.oir;projet_manche;trf;18;p1;couleur_des_individus__rouge -01/01/1984;bassin_versant.oir;projet_manche;alo;15;p1;couleur_des_individus__bleu -01/01/1984;bassin_versant.oir;projet_manche;ang;38;p1;couleur_des_individus__vert -01/01/1984;bassin_versant.oir;projet_manche;trm;25;p1;couleur_des_individus__vert -01/01/1984;bassin_versant.oir;projet_manche;lpf;54;p2;couleur_des_individus__bleu -01/01/1984;bassin_versant.oir;projet_manche;alo;15;p2;couleur_des_individus__bleu -01/01/1984;bassin_versant.oir;projet_manche;trf;18;p2;couleur_des_individus__rouge -01/01/1984;bassin_versant.oir;projet_manche;sat;39;p2;couleur_des_individus__bleu -01/01/1984;bassin_versant.oir;projet_manche;lpm;27;p2;couleur_des_individus__rouge -01/01/1984;bassin_versant.oir;projet_manche;ang;38;p2;couleur_des_individus__vert -01/01/1984;bassin_versant.oir;projet_manche;trm;25;p2;couleur_des_individus__vert -01/01/1984;bassin_versant.scarff;projet_manche;ang;38;p1;couleur_des_individus__vert -01/01/1984;bassin_versant.scarff;projet_manche;lpm;27;p1;couleur_des_individus__rouge -01/01/1984;bassin_versant.scarff;projet_manche;trm;25;p1;couleur_des_individus__vert -01/01/1984;bassin_versant.scarff;projet_manche;alo;15;p1;couleur_des_individus__bleu -01/01/1984;bassin_versant.scarff;projet_manche;trf;18;p1;couleur_des_individus__rouge -01/01/1984;bassin_versant.scarff;projet_manche;lpf;54;p1;couleur_des_individus__bleu -01/01/1984;bassin_versant.scarff;projet_manche;sat;39;p1;couleur_des_individus__bleu -02/01/1984;bassin_versant.nivelle;projet_atlantique;alo;18;p1;couleur_des_individus__vert -02/01/1984;bassin_versant.nivelle;projet_atlantique;lpm;32;p1;couleur_des_individus__bleu -02/01/1984;bassin_versant.nivelle;projet_atlantique;ang;25;p1;couleur_des_individus__rouge -02/01/1984;bassin_versant.nivelle;projet_atlantique;lpf;;p1;couleur_des_individus__vert -02/01/1984;bassin_versant.nivelle;projet_atlantique;trm;25;p1;couleur_des_individus__rouge -02/01/1984;bassin_versant.nivelle;projet_atlantique;sat;15;p1;couleur_des_individus__vert -02/01/1984;bassin_versant.nivelle;projet_atlantique;trf;14;p1;couleur_des_individus__bleu -02/01/1984;plateforme.oir.oir__p1;projet_atlantique;sat;15;a;couleur_des_individus__vert -02/01/1984;plateforme.oir.oir__p1;projet_atlantique;alo;18;a;couleur_des_individus__vert -02/01/1984;plateforme.oir.oir__p1;projet_atlantique;ang;25;a;couleur_des_individus__rouge -02/01/1984;plateforme.oir.oir__p1;projet_atlantique;trf;14;a;couleur_des_individus__bleu -02/01/1984;plateforme.oir.oir__p1;projet_atlantique;lpm;32;a;couleur_des_individus__bleu -02/01/1984;plateforme.oir.oir__p1;projet_atlantique;lpf;;a;couleur_des_individus__vert -02/01/1984;plateforme.oir.oir__p1;projet_atlantique;trm;25;a;couleur_des_individus__rouge -02/01/1984;bassin_versant.oir;projet_atlantique;trm;25;p2;couleur_des_individus__rouge -02/01/1984;bassin_versant.oir;projet_atlantique;trf;14;p2;couleur_des_individus__bleu -02/01/1984;bassin_versant.oir;projet_atlantique;lpf;;p2;couleur_des_individus__vert -02/01/1984;bassin_versant.oir;projet_atlantique;ang;25;p2;couleur_des_individus__rouge -02/01/1984;bassin_versant.oir;projet_atlantique;lpm;32;p2;couleur_des_individus__bleu -02/01/1984;bassin_versant.oir;projet_atlantique;alo;18;p2;couleur_des_individus__vert -02/01/1984;bassin_versant.oir;projet_atlantique;sat;15;p2;couleur_des_individus__vert -02/01/1984;bassin_versant.scarff;projet_atlantique;alo;18;p1;couleur_des_individus__vert -02/01/1984;bassin_versant.scarff;projet_atlantique;trf;14;p1;couleur_des_individus__bleu -02/01/1984;bassin_versant.scarff;projet_atlantique;ang;25;p1;couleur_des_individus__rouge -02/01/1984;bassin_versant.scarff;projet_atlantique;lpf;;p1;couleur_des_individus__vert -02/01/1984;bassin_versant.scarff;projet_atlantique;lpm;32;p1;couleur_des_individus__bleu -02/01/1984;bassin_versant.scarff;projet_atlantique;sat;15;p1;couleur_des_individus__vert -02/01/1984;bassin_versant.scarff;projet_atlantique;trm;25;p1;couleur_des_individus__rouge -02/01/1984;bassin_versant.nivelle;projet_manche;ang;25;p1;couleur_des_individus__rouge -02/01/1984;bassin_versant.nivelle;projet_manche;alo;18;p1;couleur_des_individus__vert -02/01/1984;bassin_versant.nivelle;projet_manche;sat;15;p1;couleur_des_individus__vert -02/01/1984;bassin_versant.nivelle;projet_manche;trf;14;p1;couleur_des_individus__bleu -02/01/1984;bassin_versant.nivelle;projet_manche;lpm;32;p1;couleur_des_individus__bleu -02/01/1984;bassin_versant.nivelle;projet_manche;trm;25;p1;couleur_des_individus__rouge -02/01/1984;bassin_versant.nivelle;projet_manche;lpf;;p1;couleur_des_individus__vert -02/01/1984;bassin_versant.oir;projet_manche;ang;25;p1;couleur_des_individus__rouge -02/01/1984;bassin_versant.oir;projet_manche;trm;25;p1;couleur_des_individus__rouge -02/01/1984;bassin_versant.oir;projet_manche;trf;14;p1;couleur_des_individus__bleu -02/01/1984;bassin_versant.oir;projet_manche;lpf;50;p1;couleur_des_individus__vert -02/01/1984;bassin_versant.oir;projet_manche;lpm;32;p1;couleur_des_individus__bleu -02/01/1984;bassin_versant.oir;projet_manche;sat;15;p1;couleur_des_individus__vert -02/01/1984;bassin_versant.oir;projet_manche;alo;18;p1;couleur_des_individus__vert -02/01/1984;bassin_versant.oir;projet_manche;trf;14;p2;couleur_des_individus__bleu -02/01/1984;bassin_versant.oir;projet_manche;sat;15;p2;couleur_des_individus__vert -02/01/1984;bassin_versant.oir;projet_manche;lpm;32;p2;couleur_des_individus__bleu -02/01/1984;bassin_versant.oir;projet_manche;alo;18;p2;couleur_des_individus__vert -02/01/1984;bassin_versant.oir;projet_manche;ang;25;p2;couleur_des_individus__rouge -02/01/1984;bassin_versant.oir;projet_manche;lpf;;p2;couleur_des_individus__vert -02/01/1984;bassin_versant.oir;projet_manche;trm;25;p2;couleur_des_individus__rouge -02/01/1984;bassin_versant.scarff;projet_manche;trf;14;p1;couleur_des_individus__bleu -02/01/1984;bassin_versant.scarff;projet_manche;sat;15;p1;couleur_des_individus__vert -02/01/1984;bassin_versant.scarff;projet_manche;lpf;;p1;couleur_des_individus__vert -02/01/1984;bassin_versant.scarff;projet_manche;lpm;32;p1;couleur_des_individus__bleu -02/01/1984;bassin_versant.scarff;projet_manche;ang;25;p1;couleur_des_individus__rouge -02/01/1984;bassin_versant.scarff;projet_manche;alo;18;p1;couleur_des_individus__vert -02/01/1984;bassin_versant.scarff;projet_manche;trm;25;p1;couleur_des_individus__rouge -03/01/1984;bassin_versant.nivelle;projet_atlantique;ang;;p1;couleur_des_individus__bleu -03/01/1984;bassin_versant.nivelle;projet_atlantique;alo;16;p1;couleur_des_individus__rouge -03/01/1984;bassin_versant.nivelle;projet_atlantique;lpm;41;p1;couleur_des_individus__vert -03/01/1984;bassin_versant.nivelle;projet_atlantique;trf;;p1;couleur_des_individus__vert -03/01/1984;bassin_versant.nivelle;projet_atlantique;lpf;45;p1;couleur_des_individus__rouge -03/01/1984;bassin_versant.nivelle;projet_atlantique;trm;27;p1;couleur_des_individus__bleu -03/01/1984;plateforme.oir.oir__p1;projet_atlantique;lpf;45;a;couleur_des_individus__rouge -03/01/1984;plateforme.oir.oir__p1;projet_atlantique;ang;;a;couleur_des_individus__bleu -03/01/1984;plateforme.oir.oir__p1;projet_atlantique;lpm;41;a;couleur_des_individus__vert -03/01/1984;plateforme.oir.oir__p1;projet_atlantique;trm;27;a;couleur_des_individus__bleu -03/01/1984;plateforme.oir.oir__p1;projet_atlantique;alo;16;a;couleur_des_individus__rouge -03/01/1984;plateforme.oir.oir__p1;projet_atlantique;trf;;a;couleur_des_individus__vert -03/01/1984;bassin_versant.oir;projet_atlantique;ang;;p2;couleur_des_individus__bleu -03/01/1984;bassin_versant.oir;projet_atlantique;lpm;41;p2;couleur_des_individus__vert -03/01/1984;bassin_versant.oir;projet_atlantique;lpf;45;p2;couleur_des_individus__rouge -03/01/1984;bassin_versant.oir;projet_atlantique;trf;;p2;couleur_des_individus__vert -03/01/1984;bassin_versant.oir;projet_atlantique;alo;16;p2;couleur_des_individus__rouge -03/01/1984;bassin_versant.oir;projet_atlantique;trm;27;p2;couleur_des_individus__bleu -03/01/1984;bassin_versant.scarff;projet_atlantique;trm;27;p1;couleur_des_individus__bleu -03/01/1984;bassin_versant.scarff;projet_atlantique;lpf;45;p1;couleur_des_individus__rouge -03/01/1984;bassin_versant.scarff;projet_atlantique;alo;16;p1;couleur_des_individus__rouge -03/01/1984;bassin_versant.scarff;projet_atlantique;ang;;p1;couleur_des_individus__bleu -03/01/1984;bassin_versant.scarff;projet_atlantique;lpm;41;p1;couleur_des_individus__vert -03/01/1984;bassin_versant.scarff;projet_atlantique;trf;;p1;couleur_des_individus__vert -03/01/1984;bassin_versant.nivelle;projet_manche;ang;;p1;couleur_des_individus__bleu -03/01/1984;bassin_versant.nivelle;projet_manche;lpm;41;p1;couleur_des_individus__vert -03/01/1984;bassin_versant.nivelle;projet_manche;trm;27;p1;couleur_des_individus__bleu -03/01/1984;bassin_versant.nivelle;projet_manche;lpf;45;p1;couleur_des_individus__rouge -03/01/1984;bassin_versant.nivelle;projet_manche;alo;16;p1;couleur_des_individus__rouge -03/01/1984;bassin_versant.nivelle;projet_manche;trf;;p1;couleur_des_individus__vert -03/01/1984;bassin_versant.oir;projet_manche;lpf;45;p1;couleur_des_individus__rouge -03/01/1984;bassin_versant.oir;projet_manche;alo;16;p1;couleur_des_individus__rouge -03/01/1984;bassin_versant.oir;projet_manche;trf;20;p1;couleur_des_individus__vert -03/01/1984;bassin_versant.oir;projet_manche;lpm;41;p1;couleur_des_individus__vert -03/01/1984;bassin_versant.oir;projet_manche;ang;20;p1;couleur_des_individus__bleu -03/01/1984;bassin_versant.oir;projet_manche;trm;27;p1;couleur_des_individus__bleu -03/01/1984;bassin_versant.oir;projet_manche;trm;27;p2;couleur_des_individus__bleu -03/01/1984;bassin_versant.oir;projet_manche;ang;;p2;couleur_des_individus__bleu -03/01/1984;bassin_versant.oir;projet_manche;trf;;p2;couleur_des_individus__vert -03/01/1984;bassin_versant.oir;projet_manche;lpf;45;p2;couleur_des_individus__rouge -03/01/1984;bassin_versant.oir;projet_manche;alo;16;p2;couleur_des_individus__rouge -03/01/1984;bassin_versant.oir;projet_manche;lpm;41;p2;couleur_des_individus__vert -03/01/1984;bassin_versant.scarff;projet_manche;trf;;p1;couleur_des_individus__vert -03/01/1984;bassin_versant.scarff;projet_manche;ang;;p1;couleur_des_individus__bleu -03/01/1984;bassin_versant.scarff;projet_manche;alo;16;p1;couleur_des_individus__rouge -03/01/1984;bassin_versant.scarff;projet_manche;trm;27;p1;couleur_des_individus__bleu -03/01/1984;bassin_versant.scarff;projet_manche;lpf;45;p1;couleur_des_individus__rouge -03/01/1984;bassin_versant.scarff;projet_manche;lpm;41;p1;couleur_des_individus__vert -04/01/1984;bassin_versant.nivelle;projet_atlantique;alo;15;p1;couleur_des_individus__bleu -04/01/1984;bassin_versant.nivelle;projet_atlantique;sat;24;p1;couleur_des_individus__bleu -04/01/1984;bassin_versant.nivelle;projet_atlantique;trf;;p1;couleur_des_individus__rouge -04/01/1984;bassin_versant.nivelle;projet_atlantique;trm;27;p1;couleur_des_individus__vert -04/01/1984;bassin_versant.nivelle;projet_atlantique;lpf;51;p1;couleur_des_individus__bleu -04/01/1984;bassin_versant.nivelle;projet_atlantique;ang;22;p1;couleur_des_individus__vert -04/01/1984;bassin_versant.nivelle;projet_atlantique;lpm;43;p1;couleur_des_individus__rouge -04/01/1984;plateforme.oir.oir__p1;projet_atlantique;lpm;43;a;couleur_des_individus__rouge -04/01/1984;plateforme.oir.oir__p1;projet_atlantique;sat;24;a;couleur_des_individus__bleu -04/01/1984;plateforme.oir.oir__p1;projet_atlantique;trf;;a;couleur_des_individus__rouge -04/01/1984;plateforme.oir.oir__p1;projet_atlantique;lpf;51;a;couleur_des_individus__bleu -04/01/1984;plateforme.oir.oir__p1;projet_atlantique;ang;22;a;couleur_des_individus__vert -04/01/1984;plateforme.oir.oir__p1;projet_atlantique;alo;15;a;couleur_des_individus__bleu -04/01/1984;plateforme.oir.oir__p1;projet_atlantique;trm;27;a;couleur_des_individus__vert -04/01/1984;bassin_versant.oir;projet_atlantique;trm;27;p2;couleur_des_individus__vert -04/01/1984;bassin_versant.oir;projet_atlantique;sat;24;p2;couleur_des_individus__bleu -04/01/1984;bassin_versant.oir;projet_atlantique;alo;15;p2;couleur_des_individus__bleu -04/01/1984;bassin_versant.oir;projet_atlantique;ang;22;p2;couleur_des_individus__vert -04/01/1984;bassin_versant.oir;projet_atlantique;lpf;51;p2;couleur_des_individus__bleu -04/01/1984;bassin_versant.oir;projet_atlantique;trf;;p2;couleur_des_individus__rouge -04/01/1984;bassin_versant.oir;projet_atlantique;lpm;43;p2;couleur_des_individus__rouge -04/01/1984;bassin_versant.scarff;projet_atlantique;lpm;43;p1;couleur_des_individus__rouge -04/01/1984;bassin_versant.scarff;projet_atlantique;trf;;p1;couleur_des_individus__rouge -04/01/1984;bassin_versant.scarff;projet_atlantique;ang;22;p1;couleur_des_individus__vert -04/01/1984;bassin_versant.scarff;projet_atlantique;sat;24;p1;couleur_des_individus__bleu -04/01/1984;bassin_versant.scarff;projet_atlantique;lpf;51;p1;couleur_des_individus__bleu -04/01/1984;bassin_versant.scarff;projet_atlantique;alo;15;p1;couleur_des_individus__bleu -04/01/1984;bassin_versant.scarff;projet_atlantique;trm;27;p1;couleur_des_individus__vert -04/01/1984;bassin_versant.nivelle;projet_manche;sat;24;p1;couleur_des_individus__bleu -04/01/1984;bassin_versant.nivelle;projet_manche;alo;15;p1;couleur_des_individus__bleu -04/01/1984;bassin_versant.nivelle;projet_manche;lpm;43;p1;couleur_des_individus__rouge -04/01/1984;bassin_versant.nivelle;projet_manche;trm;27;p1;couleur_des_individus__vert -04/01/1984;bassin_versant.nivelle;projet_manche;lpf;51;p1;couleur_des_individus__bleu -04/01/1984;bassin_versant.nivelle;projet_manche;trf;;p1;couleur_des_individus__rouge -04/01/1984;bassin_versant.nivelle;projet_manche;ang;22;p1;couleur_des_individus__vert -04/01/1984;bassin_versant.oir;projet_manche;lpf;51;p1;couleur_des_individus__bleu -04/01/1984;bassin_versant.oir;projet_manche;trf;20;p1;couleur_des_individus__rouge -04/01/1984;bassin_versant.oir;projet_manche;alo;15;p1;couleur_des_individus__bleu -04/01/1984;bassin_versant.oir;projet_manche;ang;22;p1;couleur_des_individus__vert -04/01/1984;bassin_versant.oir;projet_manche;sat;24;p1;couleur_des_individus__bleu -04/01/1984;bassin_versant.oir;projet_manche;trm;27;p1;couleur_des_individus__vert -04/01/1984;bassin_versant.oir;projet_manche;lpm;43;p1;couleur_des_individus__rouge -04/01/1984;bassin_versant.oir;projet_manche;trm;27;p2;couleur_des_individus__vert -04/01/1984;bassin_versant.oir;projet_manche;ang;22;p2;couleur_des_individus__vert -04/01/1984;bassin_versant.oir;projet_manche;alo;15;p2;couleur_des_individus__bleu -04/01/1984;bassin_versant.oir;projet_manche;lpf;51;p2;couleur_des_individus__bleu -04/01/1984;bassin_versant.oir;projet_manche;trf;;p2;couleur_des_individus__rouge -04/01/1984;bassin_versant.oir;projet_manche;lpm;43;p2;couleur_des_individus__rouge -04/01/1984;bassin_versant.oir;projet_manche;sat;24;p2;couleur_des_individus__bleu -04/01/1984;bassin_versant.scarff;projet_manche;ang;22;p1;couleur_des_individus__vert -04/01/1984;bassin_versant.scarff;projet_manche;lpf;51;p1;couleur_des_individus__bleu -04/01/1984;bassin_versant.scarff;projet_manche;trf;;p1;couleur_des_individus__rouge -04/01/1984;bassin_versant.scarff;projet_manche;lpm;43;p1;couleur_des_individus__rouge -04/01/1984;bassin_versant.scarff;projet_manche;alo;15;p1;couleur_des_individus__bleu -04/01/1984;bassin_versant.scarff;projet_manche;sat;24;p1;couleur_des_individus__bleu -04/01/1984;bassin_versant.scarff;projet_manche;trm;27;p1;couleur_des_individus__vert -05/01/1984;bassin_versant.nivelle;projet_atlantique;lpm;49;p1;couleur_des_individus__bleu -05/01/1984;bassin_versant.nivelle;projet_atlantique;trm;25;p1;couleur_des_individus__rouge -05/01/1984;bassin_versant.nivelle;projet_atlantique;alo;17;p1;couleur_des_individus__vert -05/01/1984;bassin_versant.nivelle;projet_atlantique;sat;24;p1;couleur_des_individus__vert -05/01/1984;bassin_versant.nivelle;projet_atlantique;lpf;59;p1;couleur_des_individus__vert -05/01/1984;bassin_versant.nivelle;projet_atlantique;trf;21;p1;couleur_des_individus__bleu -05/01/1984;bassin_versant.nivelle;projet_atlantique;ang;27;p1;couleur_des_individus__rouge -05/01/1984;plateforme.oir.oir__p1;projet_atlantique;trf;21;a;couleur_des_individus__bleu -05/01/1984;plateforme.oir.oir__p1;projet_atlantique;alo;17;a;couleur_des_individus__vert -05/01/1984;plateforme.oir.oir__p1;projet_atlantique;ang;27;a;couleur_des_individus__rouge -05/01/1984;plateforme.oir.oir__p1;projet_atlantique;trm;25;a;couleur_des_individus__rouge -05/01/1984;plateforme.oir.oir__p1;projet_atlantique;lpm;49;a;couleur_des_individus__bleu -05/01/1984;plateforme.oir.oir__p1;projet_atlantique;lpf;59;a;couleur_des_individus__vert -05/01/1984;plateforme.oir.oir__p1;projet_atlantique;sat;24;a;couleur_des_individus__vert -05/01/1984;bassin_versant.oir;projet_atlantique;trf;21;p2;couleur_des_individus__bleu -05/01/1984;bassin_versant.oir;projet_atlantique;lpf;59;p2;couleur_des_individus__vert -05/01/1984;bassin_versant.oir;projet_atlantique;trm;25;p2;couleur_des_individus__rouge -05/01/1984;bassin_versant.oir;projet_atlantique;sat;24;p2;couleur_des_individus__vert -05/01/1984;bassin_versant.oir;projet_atlantique;lpm;49;p2;couleur_des_individus__bleu -05/01/1984;bassin_versant.oir;projet_atlantique;alo;17;p2;couleur_des_individus__vert -05/01/1984;bassin_versant.oir;projet_atlantique;ang;27;p2;couleur_des_individus__rouge -05/01/1984;bassin_versant.scarff;projet_atlantique;ang;27;p1;couleur_des_individus__rouge -05/01/1984;bassin_versant.scarff;projet_atlantique;trm;25;p1;couleur_des_individus__rouge -05/01/1984;bassin_versant.scarff;projet_atlantique;lpm;49;p1;couleur_des_individus__bleu -05/01/1984;bassin_versant.scarff;projet_atlantique;sat;24;p1;couleur_des_individus__vert -05/01/1984;bassin_versant.scarff;projet_atlantique;trf;21;p1;couleur_des_individus__bleu -05/01/1984;bassin_versant.scarff;projet_atlantique;alo;17;p1;couleur_des_individus__vert -05/01/1984;bassin_versant.scarff;projet_atlantique;lpf;59;p1;couleur_des_individus__vert -05/01/1984;bassin_versant.nivelle;projet_manche;ang;27;p1;couleur_des_individus__rouge -05/01/1984;bassin_versant.nivelle;projet_manche;alo;17;p1;couleur_des_individus__vert -05/01/1984;bassin_versant.nivelle;projet_manche;lpf;59;p1;couleur_des_individus__vert -05/01/1984;bassin_versant.nivelle;projet_manche;sat;24;p1;couleur_des_individus__vert -05/01/1984;bassin_versant.nivelle;projet_manche;lpm;49;p1;couleur_des_individus__bleu -05/01/1984;bassin_versant.nivelle;projet_manche;trf;21;p1;couleur_des_individus__bleu -05/01/1984;bassin_versant.nivelle;projet_manche;trm;25;p1;couleur_des_individus__rouge -05/01/1984;bassin_versant.oir;projet_manche;trf;21;p1;couleur_des_individus__bleu -05/01/1984;bassin_versant.oir;projet_manche;lpm;49;p1;couleur_des_individus__bleu -05/01/1984;bassin_versant.oir;projet_manche;trm;25;p1;couleur_des_individus__rouge -05/01/1984;bassin_versant.oir;projet_manche;ang;27;p1;couleur_des_individus__rouge -05/01/1984;bassin_versant.oir;projet_manche;lpf;59;p1;couleur_des_individus__vert -05/01/1984;bassin_versant.oir;projet_manche;alo;17;p1;couleur_des_individus__vert -05/01/1984;bassin_versant.oir;projet_manche;sat;24;p1;couleur_des_individus__vert -05/01/1984;bassin_versant.oir;projet_manche;alo;17;p2;couleur_des_individus__vert -05/01/1984;bassin_versant.oir;projet_manche;ang;27;p2;couleur_des_individus__rouge -05/01/1984;bassin_versant.oir;projet_manche;trf;21;p2;couleur_des_individus__bleu -05/01/1984;bassin_versant.oir;projet_manche;trm;25;p2;couleur_des_individus__rouge -05/01/1984;bassin_versant.oir;projet_manche;sat;24;p2;couleur_des_individus__vert -05/01/1984;bassin_versant.oir;projet_manche;lpm;49;p2;couleur_des_individus__bleu -05/01/1984;bassin_versant.oir;projet_manche;lpf;59;p2;couleur_des_individus__vert -05/01/1984;bassin_versant.scarff;projet_manche;lpm;49;p1;couleur_des_individus__bleu -05/01/1984;bassin_versant.scarff;projet_manche;trm;25;p1;couleur_des_individus__rouge -05/01/1984;bassin_versant.scarff;projet_manche;alo;17;p1;couleur_des_individus__vert -05/01/1984;bassin_versant.scarff;projet_manche;trf;21;p1;couleur_des_individus__bleu -05/01/1984;bassin_versant.scarff;projet_manche;lpf;59;p1;couleur_des_individus__vert -05/01/1984;bassin_versant.scarff;projet_manche;ang;27;p1;couleur_des_individus__rouge -05/01/1984;bassin_versant.scarff;projet_manche;sat;24;p1;couleur_des_individus__vert \ No newline at end of file +date;site;projet;espece;Nombre d'individus;plateforme;Couleur des individus +01/01/1984;nivelle;projet_atlantique;ang;38;p1;couleur_des_individus__vert +01/01/1984;nivelle;projet_atlantique;lpm;27;p1;couleur_des_individus__rouge +01/01/1984;nivelle;projet_atlantique;sat;39;p1;couleur_des_individus__bleu +01/01/1984;nivelle;projet_atlantique;alo;15;p1;couleur_des_individus__bleu +01/01/1984;nivelle;projet_atlantique;trf;18;p1;couleur_des_individus__rouge +01/01/1984;nivelle;projet_atlantique;trm;25;p1;couleur_des_individus__vert +01/01/1984;nivelle;projet_atlantique;lpf;54;p1;couleur_des_individus__bleu +01/01/1984;oir__p1;projet_atlantique;ang;38;a;couleur_des_individus__vert +01/01/1984;oir__p1;projet_atlantique;trf;18;a;couleur_des_individus__rouge +01/01/1984;oir__p1;projet_atlantique;lpm;27;a;couleur_des_individus__rouge +01/01/1984;oir__p1;projet_atlantique;trm;25;a;couleur_des_individus__vert +01/01/1984;oir__p1;projet_atlantique;lpf;54;a;couleur_des_individus__bleu +01/01/1984;oir__p1;projet_atlantique;sat;39;a;couleur_des_individus__bleu +01/01/1984;oir__p1;projet_atlantique;alo;15;a;couleur_des_individus__bleu +01/01/1984;oir;projet_atlantique;lpf;54;p2;couleur_des_individus__bleu +01/01/1984;oir;projet_atlantique;alo;15;p2;couleur_des_individus__bleu +01/01/1984;oir;projet_atlantique;trm;25;p2;couleur_des_individus__vert +01/01/1984;oir;projet_atlantique;ang;38;p2;couleur_des_individus__vert +01/01/1984;oir;projet_atlantique;sat;39;p2;couleur_des_individus__bleu +01/01/1984;oir;projet_atlantique;lpm;27;p2;couleur_des_individus__rouge +01/01/1984;oir;projet_atlantique;trf;18;p2;couleur_des_individus__rouge +01/01/1984;scarff;projet_atlantique;trf;18;p1;couleur_des_individus__rouge +01/01/1984;scarff;projet_atlantique;trm;25;p1;couleur_des_individus__vert +01/01/1984;scarff;projet_atlantique;sat;39;p1;couleur_des_individus__bleu +01/01/1984;scarff;projet_atlantique;alo;15;p1;couleur_des_individus__bleu +01/01/1984;scarff;projet_atlantique;ang;38;p1;couleur_des_individus__vert +01/01/1984;scarff;projet_atlantique;lpm;27;p1;couleur_des_individus__rouge +01/01/1984;scarff;projet_atlantique;lpf;54;p1;couleur_des_individus__bleu +01/01/1984;nivelle;projet_manche;trm;25;p1;couleur_des_individus__vert +01/01/1984;nivelle;projet_manche;lpf;54;p1;couleur_des_individus__bleu +01/01/1984;nivelle;projet_manche;lpm;27;p1;couleur_des_individus__rouge +01/01/1984;nivelle;projet_manche;ang;38;p1;couleur_des_individus__vert +01/01/1984;nivelle;projet_manche;alo;15;p1;couleur_des_individus__bleu +01/01/1984;nivelle;projet_manche;trf;18;p1;couleur_des_individus__rouge +01/01/1984;nivelle;projet_manche;sat;39;p1;couleur_des_individus__bleu +01/01/1984;oir;projet_manche;ang;38;p1;couleur_des_individus__vert +01/01/1984;oir;projet_manche;alo;15;p1;couleur_des_individus__bleu +01/01/1984;oir;projet_manche;lpf;54;p1;couleur_des_individus__bleu +01/01/1984;oir;projet_manche;sat;39;p1;couleur_des_individus__bleu +01/01/1984;oir;projet_manche;trf;18;p1;couleur_des_individus__rouge +01/01/1984;oir;projet_manche;trm;25;p1;couleur_des_individus__vert +01/01/1984;oir;projet_manche;lpm;27;p1;couleur_des_individus__rouge +01/01/1984;oir;projet_manche;lpf;54;p2;couleur_des_individus__bleu +01/01/1984;oir;projet_manche;alo;15;p2;couleur_des_individus__bleu +01/01/1984;oir;projet_manche;sat;39;p2;couleur_des_individus__bleu +01/01/1984;oir;projet_manche;lpm;27;p2;couleur_des_individus__rouge +01/01/1984;oir;projet_manche;trm;25;p2;couleur_des_individus__vert +01/01/1984;oir;projet_manche;trf;18;p2;couleur_des_individus__rouge +01/01/1984;oir;projet_manche;ang;38;p2;couleur_des_individus__vert +01/01/1984;scarff;projet_manche;sat;39;p1;couleur_des_individus__bleu +01/01/1984;scarff;projet_manche;alo;15;p1;couleur_des_individus__bleu +01/01/1984;scarff;projet_manche;ang;38;p1;couleur_des_individus__vert +01/01/1984;scarff;projet_manche;lpf;54;p1;couleur_des_individus__bleu +01/01/1984;scarff;projet_manche;trf;18;p1;couleur_des_individus__rouge +01/01/1984;scarff;projet_manche;trm;25;p1;couleur_des_individus__vert +01/01/1984;scarff;projet_manche;lpm;27;p1;couleur_des_individus__rouge +02/01/1984;nivelle;projet_atlantique;sat;15;p1;couleur_des_individus__vert +02/01/1984;nivelle;projet_atlantique;lpm;32;p1;couleur_des_individus__bleu +02/01/1984;nivelle;projet_atlantique;alo;18;p1;couleur_des_individus__vert +02/01/1984;nivelle;projet_atlantique;ang;25;p1;couleur_des_individus__rouge +02/01/1984;nivelle;projet_atlantique;trm;25;p1;couleur_des_individus__rouge +02/01/1984;nivelle;projet_atlantique;lpf;;p1;couleur_des_individus__vert +02/01/1984;nivelle;projet_atlantique;trf;14;p1;couleur_des_individus__bleu +02/01/1984;oir__p1;projet_atlantique;lpf;;a;couleur_des_individus__vert +02/01/1984;oir__p1;projet_atlantique;trf;14;a;couleur_des_individus__bleu +02/01/1984;oir__p1;projet_atlantique;sat;15;a;couleur_des_individus__vert +02/01/1984;oir__p1;projet_atlantique;trm;25;a;couleur_des_individus__rouge +02/01/1984;oir__p1;projet_atlantique;ang;25;a;couleur_des_individus__rouge +02/01/1984;oir__p1;projet_atlantique;alo;18;a;couleur_des_individus__vert +02/01/1984;oir__p1;projet_atlantique;lpm;32;a;couleur_des_individus__bleu +02/01/1984;oir;projet_atlantique;lpm;32;p2;couleur_des_individus__bleu +02/01/1984;oir;projet_atlantique;alo;18;p2;couleur_des_individus__vert +02/01/1984;oir;projet_atlantique;trf;14;p2;couleur_des_individus__bleu +02/01/1984;oir;projet_atlantique;lpf;;p2;couleur_des_individus__vert +02/01/1984;oir;projet_atlantique;ang;25;p2;couleur_des_individus__rouge +02/01/1984;oir;projet_atlantique;trm;25;p2;couleur_des_individus__rouge +02/01/1984;oir;projet_atlantique;sat;15;p2;couleur_des_individus__vert +02/01/1984;scarff;projet_atlantique;trm;25;p1;couleur_des_individus__rouge +02/01/1984;scarff;projet_atlantique;alo;18;p1;couleur_des_individus__vert +02/01/1984;scarff;projet_atlantique;lpm;32;p1;couleur_des_individus__bleu +02/01/1984;scarff;projet_atlantique;sat;15;p1;couleur_des_individus__vert +02/01/1984;scarff;projet_atlantique;lpf;;p1;couleur_des_individus__vert +02/01/1984;scarff;projet_atlantique;ang;25;p1;couleur_des_individus__rouge +02/01/1984;scarff;projet_atlantique;trf;14;p1;couleur_des_individus__bleu +02/01/1984;nivelle;projet_manche;ang;25;p1;couleur_des_individus__rouge +02/01/1984;nivelle;projet_manche;trm;25;p1;couleur_des_individus__rouge +02/01/1984;nivelle;projet_manche;lpm;32;p1;couleur_des_individus__bleu +02/01/1984;nivelle;projet_manche;sat;15;p1;couleur_des_individus__vert +02/01/1984;nivelle;projet_manche;alo;18;p1;couleur_des_individus__vert +02/01/1984;nivelle;projet_manche;trf;14;p1;couleur_des_individus__bleu +02/01/1984;nivelle;projet_manche;lpf;;p1;couleur_des_individus__vert +02/01/1984;oir;projet_manche;ang;25;p1;couleur_des_individus__rouge +02/01/1984;oir;projet_manche;trm;25;p1;couleur_des_individus__rouge +02/01/1984;oir;projet_manche;lpm;32;p1;couleur_des_individus__bleu +02/01/1984;oir;projet_manche;lpf;50;p1;couleur_des_individus__vert +02/01/1984;oir;projet_manche;sat;15;p1;couleur_des_individus__vert +02/01/1984;oir;projet_manche;trf;14;p1;couleur_des_individus__bleu +02/01/1984;oir;projet_manche;alo;18;p1;couleur_des_individus__vert +02/01/1984;oir;projet_manche;sat;15;p2;couleur_des_individus__vert +02/01/1984;oir;projet_manche;lpf;;p2;couleur_des_individus__vert +02/01/1984;oir;projet_manche;ang;25;p2;couleur_des_individus__rouge +02/01/1984;oir;projet_manche;lpm;32;p2;couleur_des_individus__bleu +02/01/1984;oir;projet_manche;trm;25;p2;couleur_des_individus__rouge +02/01/1984;oir;projet_manche;alo;18;p2;couleur_des_individus__vert +02/01/1984;oir;projet_manche;trf;14;p2;couleur_des_individus__bleu +02/01/1984;scarff;projet_manche;lpf;;p1;couleur_des_individus__vert +02/01/1984;scarff;projet_manche;trm;25;p1;couleur_des_individus__rouge +02/01/1984;scarff;projet_manche;sat;15;p1;couleur_des_individus__vert +02/01/1984;scarff;projet_manche;lpm;32;p1;couleur_des_individus__bleu +02/01/1984;scarff;projet_manche;ang;25;p1;couleur_des_individus__rouge +02/01/1984;scarff;projet_manche;alo;18;p1;couleur_des_individus__vert +02/01/1984;scarff;projet_manche;trf;14;p1;couleur_des_individus__bleu +03/01/1984;nivelle;projet_atlantique;ang;;p1;couleur_des_individus__bleu +03/01/1984;nivelle;projet_atlantique;lpm;41;p1;couleur_des_individus__vert +03/01/1984;nivelle;projet_atlantique;trm;27;p1;couleur_des_individus__bleu +03/01/1984;nivelle;projet_atlantique;alo;16;p1;couleur_des_individus__rouge +03/01/1984;nivelle;projet_atlantique;trf;;p1;couleur_des_individus__vert +03/01/1984;nivelle;projet_atlantique;lpf;45;p1;couleur_des_individus__rouge +03/01/1984;oir__p1;projet_atlantique;trm;27;a;couleur_des_individus__bleu +03/01/1984;oir__p1;projet_atlantique;ang;;a;couleur_des_individus__bleu +03/01/1984;oir__p1;projet_atlantique;trf;;a;couleur_des_individus__vert +03/01/1984;oir__p1;projet_atlantique;lpf;45;a;couleur_des_individus__rouge +03/01/1984;oir__p1;projet_atlantique;lpm;41;a;couleur_des_individus__vert +03/01/1984;oir__p1;projet_atlantique;alo;16;a;couleur_des_individus__rouge +03/01/1984;oir;projet_atlantique;lpm;41;p2;couleur_des_individus__vert +03/01/1984;oir;projet_atlantique;trf;;p2;couleur_des_individus__vert +03/01/1984;oir;projet_atlantique;trm;27;p2;couleur_des_individus__bleu +03/01/1984;oir;projet_atlantique;ang;;p2;couleur_des_individus__bleu +03/01/1984;oir;projet_atlantique;lpf;45;p2;couleur_des_individus__rouge +03/01/1984;oir;projet_atlantique;alo;16;p2;couleur_des_individus__rouge +03/01/1984;scarff;projet_atlantique;trf;;p1;couleur_des_individus__vert +03/01/1984;scarff;projet_atlantique;alo;16;p1;couleur_des_individus__rouge +03/01/1984;scarff;projet_atlantique;lpm;41;p1;couleur_des_individus__vert +03/01/1984;scarff;projet_atlantique;trm;27;p1;couleur_des_individus__bleu +03/01/1984;scarff;projet_atlantique;ang;;p1;couleur_des_individus__bleu +03/01/1984;scarff;projet_atlantique;lpf;45;p1;couleur_des_individus__rouge +03/01/1984;nivelle;projet_manche;ang;;p1;couleur_des_individus__bleu +03/01/1984;nivelle;projet_manche;trf;;p1;couleur_des_individus__vert +03/01/1984;nivelle;projet_manche;alo;16;p1;couleur_des_individus__rouge +03/01/1984;nivelle;projet_manche;lpm;41;p1;couleur_des_individus__vert +03/01/1984;nivelle;projet_manche;trm;27;p1;couleur_des_individus__bleu +03/01/1984;nivelle;projet_manche;lpf;45;p1;couleur_des_individus__rouge +03/01/1984;oir;projet_manche;alo;16;p1;couleur_des_individus__rouge +03/01/1984;oir;projet_manche;lpf;45;p1;couleur_des_individus__rouge +03/01/1984;oir;projet_manche;trm;27;p1;couleur_des_individus__bleu +03/01/1984;oir;projet_manche;ang;20;p1;couleur_des_individus__bleu +03/01/1984;oir;projet_manche;lpm;41;p1;couleur_des_individus__vert +03/01/1984;oir;projet_manche;trf;20;p1;couleur_des_individus__vert +03/01/1984;oir;projet_manche;lpf;45;p2;couleur_des_individus__rouge +03/01/1984;oir;projet_manche;lpm;41;p2;couleur_des_individus__vert +03/01/1984;oir;projet_manche;trm;27;p2;couleur_des_individus__bleu +03/01/1984;oir;projet_manche;ang;;p2;couleur_des_individus__bleu +03/01/1984;oir;projet_manche;trf;;p2;couleur_des_individus__vert +03/01/1984;oir;projet_manche;alo;16;p2;couleur_des_individus__rouge +03/01/1984;scarff;projet_manche;trf;;p1;couleur_des_individus__vert +03/01/1984;scarff;projet_manche;alo;16;p1;couleur_des_individus__rouge +03/01/1984;scarff;projet_manche;ang;;p1;couleur_des_individus__bleu +03/01/1984;scarff;projet_manche;lpf;45;p1;couleur_des_individus__rouge +03/01/1984;scarff;projet_manche;lpm;41;p1;couleur_des_individus__vert +03/01/1984;scarff;projet_manche;trm;27;p1;couleur_des_individus__bleu +04/01/1984;nivelle;projet_atlantique;sat;24;p1;couleur_des_individus__bleu +04/01/1984;nivelle;projet_atlantique;lpm;43;p1;couleur_des_individus__rouge +04/01/1984;nivelle;projet_atlantique;trm;27;p1;couleur_des_individus__vert +04/01/1984;nivelle;projet_atlantique;lpf;51;p1;couleur_des_individus__bleu +04/01/1984;nivelle;projet_atlantique;ang;22;p1;couleur_des_individus__vert +04/01/1984;nivelle;projet_atlantique;alo;15;p1;couleur_des_individus__bleu +04/01/1984;nivelle;projet_atlantique;trf;;p1;couleur_des_individus__rouge +04/01/1984;oir__p1;projet_atlantique;trm;27;a;couleur_des_individus__vert +04/01/1984;oir__p1;projet_atlantique;trf;;a;couleur_des_individus__rouge +04/01/1984;oir__p1;projet_atlantique;ang;22;a;couleur_des_individus__vert +04/01/1984;oir__p1;projet_atlantique;alo;15;a;couleur_des_individus__bleu +04/01/1984;oir__p1;projet_atlantique;lpm;43;a;couleur_des_individus__rouge +04/01/1984;oir__p1;projet_atlantique;sat;24;a;couleur_des_individus__bleu +04/01/1984;oir__p1;projet_atlantique;lpf;51;a;couleur_des_individus__bleu +04/01/1984;oir;projet_atlantique;lpf;51;p2;couleur_des_individus__bleu +04/01/1984;oir;projet_atlantique;trm;27;p2;couleur_des_individus__vert +04/01/1984;oir;projet_atlantique;ang;22;p2;couleur_des_individus__vert +04/01/1984;oir;projet_atlantique;trf;;p2;couleur_des_individus__rouge +04/01/1984;oir;projet_atlantique;alo;15;p2;couleur_des_individus__bleu +04/01/1984;oir;projet_atlantique;sat;24;p2;couleur_des_individus__bleu +04/01/1984;oir;projet_atlantique;lpm;43;p2;couleur_des_individus__rouge +04/01/1984;scarff;projet_atlantique;lpm;43;p1;couleur_des_individus__rouge +04/01/1984;scarff;projet_atlantique;trf;;p1;couleur_des_individus__rouge +04/01/1984;scarff;projet_atlantique;alo;15;p1;couleur_des_individus__bleu +04/01/1984;scarff;projet_atlantique;sat;24;p1;couleur_des_individus__bleu +04/01/1984;scarff;projet_atlantique;lpf;51;p1;couleur_des_individus__bleu +04/01/1984;scarff;projet_atlantique;ang;22;p1;couleur_des_individus__vert +04/01/1984;scarff;projet_atlantique;trm;27;p1;couleur_des_individus__vert +04/01/1984;nivelle;projet_manche;trm;27;p1;couleur_des_individus__vert +04/01/1984;nivelle;projet_manche;trf;;p1;couleur_des_individus__rouge +04/01/1984;nivelle;projet_manche;sat;24;p1;couleur_des_individus__bleu +04/01/1984;nivelle;projet_manche;alo;15;p1;couleur_des_individus__bleu +04/01/1984;nivelle;projet_manche;ang;22;p1;couleur_des_individus__vert +04/01/1984;nivelle;projet_manche;lpf;51;p1;couleur_des_individus__bleu +04/01/1984;nivelle;projet_manche;lpm;43;p1;couleur_des_individus__rouge +04/01/1984;oir;projet_manche;trf;20;p1;couleur_des_individus__rouge +04/01/1984;oir;projet_manche;sat;24;p1;couleur_des_individus__bleu +04/01/1984;oir;projet_manche;lpf;51;p1;couleur_des_individus__bleu +04/01/1984;oir;projet_manche;trm;27;p1;couleur_des_individus__vert +04/01/1984;oir;projet_manche;lpm;43;p1;couleur_des_individus__rouge +04/01/1984;oir;projet_manche;ang;22;p1;couleur_des_individus__vert +04/01/1984;oir;projet_manche;alo;15;p1;couleur_des_individus__bleu +04/01/1984;oir;projet_manche;ang;22;p2;couleur_des_individus__vert +04/01/1984;oir;projet_manche;trm;27;p2;couleur_des_individus__vert +04/01/1984;oir;projet_manche;alo;15;p2;couleur_des_individus__bleu +04/01/1984;oir;projet_manche;lpf;51;p2;couleur_des_individus__bleu +04/01/1984;oir;projet_manche;trf;;p2;couleur_des_individus__rouge +04/01/1984;oir;projet_manche;sat;24;p2;couleur_des_individus__bleu +04/01/1984;oir;projet_manche;lpm;43;p2;couleur_des_individus__rouge +04/01/1984;scarff;projet_manche;lpm;43;p1;couleur_des_individus__rouge +04/01/1984;scarff;projet_manche;alo;15;p1;couleur_des_individus__bleu +04/01/1984;scarff;projet_manche;trf;;p1;couleur_des_individus__rouge +04/01/1984;scarff;projet_manche;trm;27;p1;couleur_des_individus__vert +04/01/1984;scarff;projet_manche;sat;24;p1;couleur_des_individus__bleu +04/01/1984;scarff;projet_manche;lpf;51;p1;couleur_des_individus__bleu +04/01/1984;scarff;projet_manche;ang;22;p1;couleur_des_individus__vert +05/01/1984;nivelle;projet_atlantique;ang;27;p1;couleur_des_individus__rouge +05/01/1984;nivelle;projet_atlantique;trf;21;p1;couleur_des_individus__bleu +05/01/1984;nivelle;projet_atlantique;lpm;49;p1;couleur_des_individus__bleu +05/01/1984;nivelle;projet_atlantique;alo;17;p1;couleur_des_individus__vert +05/01/1984;nivelle;projet_atlantique;trm;25;p1;couleur_des_individus__rouge +05/01/1984;nivelle;projet_atlantique;lpf;59;p1;couleur_des_individus__vert +05/01/1984;nivelle;projet_atlantique;sat;24;p1;couleur_des_individus__vert +05/01/1984;oir__p1;projet_atlantique;trm;25;a;couleur_des_individus__rouge +05/01/1984;oir__p1;projet_atlantique;trf;21;a;couleur_des_individus__bleu +05/01/1984;oir__p1;projet_atlantique;ang;27;a;couleur_des_individus__rouge +05/01/1984;oir__p1;projet_atlantique;lpf;59;a;couleur_des_individus__vert +05/01/1984;oir__p1;projet_atlantique;sat;24;a;couleur_des_individus__vert +05/01/1984;oir__p1;projet_atlantique;lpm;49;a;couleur_des_individus__bleu +05/01/1984;oir__p1;projet_atlantique;alo;17;a;couleur_des_individus__vert +05/01/1984;oir;projet_atlantique;lpm;49;p2;couleur_des_individus__bleu +05/01/1984;oir;projet_atlantique;sat;24;p2;couleur_des_individus__vert +05/01/1984;oir;projet_atlantique;lpf;59;p2;couleur_des_individus__vert +05/01/1984;oir;projet_atlantique;trm;25;p2;couleur_des_individus__rouge +05/01/1984;oir;projet_atlantique;ang;27;p2;couleur_des_individus__rouge +05/01/1984;oir;projet_atlantique;alo;17;p2;couleur_des_individus__vert +05/01/1984;oir;projet_atlantique;trf;21;p2;couleur_des_individus__bleu +05/01/1984;scarff;projet_atlantique;lpf;59;p1;couleur_des_individus__vert +05/01/1984;scarff;projet_atlantique;trf;21;p1;couleur_des_individus__bleu +05/01/1984;scarff;projet_atlantique;trm;25;p1;couleur_des_individus__rouge +05/01/1984;scarff;projet_atlantique;ang;27;p1;couleur_des_individus__rouge +05/01/1984;scarff;projet_atlantique;lpm;49;p1;couleur_des_individus__bleu +05/01/1984;scarff;projet_atlantique;sat;24;p1;couleur_des_individus__vert +05/01/1984;scarff;projet_atlantique;alo;17;p1;couleur_des_individus__vert +05/01/1984;nivelle;projet_manche;sat;24;p1;couleur_des_individus__vert +05/01/1984;nivelle;projet_manche;trf;21;p1;couleur_des_individus__bleu +05/01/1984;nivelle;projet_manche;lpf;59;p1;couleur_des_individus__vert +05/01/1984;nivelle;projet_manche;lpm;49;p1;couleur_des_individus__bleu +05/01/1984;nivelle;projet_manche;ang;27;p1;couleur_des_individus__rouge +05/01/1984;nivelle;projet_manche;alo;17;p1;couleur_des_individus__vert +05/01/1984;nivelle;projet_manche;trm;25;p1;couleur_des_individus__rouge +05/01/1984;oir;projet_manche;sat;24;p1;couleur_des_individus__vert +05/01/1984;oir;projet_manche;alo;17;p1;couleur_des_individus__vert +05/01/1984;oir;projet_manche;trm;25;p1;couleur_des_individus__rouge +05/01/1984;oir;projet_manche;lpf;59;p1;couleur_des_individus__vert +05/01/1984;oir;projet_manche;trf;21;p1;couleur_des_individus__bleu +05/01/1984;oir;projet_manche;ang;27;p1;couleur_des_individus__rouge +05/01/1984;oir;projet_manche;lpm;49;p1;couleur_des_individus__bleu +05/01/1984;oir;projet_manche;ang;27;p2;couleur_des_individus__rouge +05/01/1984;oir;projet_manche;lpf;59;p2;couleur_des_individus__vert +05/01/1984;oir;projet_manche;trf;21;p2;couleur_des_individus__bleu +05/01/1984;oir;projet_manche;alo;17;p2;couleur_des_individus__vert +05/01/1984;oir;projet_manche;lpm;49;p2;couleur_des_individus__bleu +05/01/1984;oir;projet_manche;sat;24;p2;couleur_des_individus__vert +05/01/1984;oir;projet_manche;trm;25;p2;couleur_des_individus__rouge +05/01/1984;scarff;projet_manche;lpf;59;p1;couleur_des_individus__vert +05/01/1984;scarff;projet_manche;sat;24;p1;couleur_des_individus__vert +05/01/1984;scarff;projet_manche;trf;21;p1;couleur_des_individus__bleu +05/01/1984;scarff;projet_manche;alo;17;p1;couleur_des_individus__vert +05/01/1984;scarff;projet_manche;ang;27;p1;couleur_des_individus__rouge +05/01/1984;scarff;projet_manche;lpm;49;p1;couleur_des_individus__bleu +05/01/1984;scarff;projet_manche;trm;25;p1;couleur_des_individus__rouge diff --git a/src/test/resources/data/monsore/monsore-with-repository.yaml b/src/test/resources/data/monsore/monsore-with-repository.yaml index 8dde5b921..c3c70c07c 100644 --- a/src/test/resources/data/monsore/monsore-with-repository.yaml +++ b/src/test/resources/data/monsore/monsore-with-repository.yaml @@ -364,27 +364,28 @@ dataTypes: refType: projet site: components: - bassin: + bassin: null + plateforme: null + chemin: defaultValue: expression: > return references.get("sites") - .find{it.getNaturalKey().equals(datumByVariableAndComponent.get("site").get("bassin"))} + .find{it.getRefValues().get("zet_chemin_parent").equals(datumByVariableAndComponent.get("site").get("bassin")) + && + it.getRefValues().get("zet_nom_key").equals(datumByVariableAndComponent.get("site").get("plateforme"))} .getHierarchicalKey(); references: - sites - replace: true checker: name: Reference params: refType: sites - plateforme: null - chemin: - defaultValue: + computedComponents: + site_bassin: + computation: expression: > return references.get("sites") - .find{it.getRefValues().get("zet_chemin_parent").equals(datumByVariableAndComponent.get("site").get("bassin")) - && - it.getRefValues().get("zet_nom_key").equals(datumByVariableAndComponent.get("site").get("plateforme"))} + .find{it.getNaturalKey().equals(datumByVariableAndComponent.get("site").get("bassin"))} .getHierarchicalKey(); references: - sites diff --git a/src/test/resources/data/monsore/monsore.yaml b/src/test/resources/data/monsore/monsore.yaml index 1a68136de..c4ba4a440 100644 --- a/src/test/resources/data/monsore/monsore.yaml +++ b/src/test/resources/data/monsore/monsore.yaml @@ -363,27 +363,28 @@ dataTypes: refType: projet site: components: - bassin: + bassin: null + plateforme: null + chemin: defaultValue: expression: > return references.get("sites") - .find{it.getNaturalKey().equals(datumByVariableAndComponent.get("site").get("bassin"))} + .find{it.getRefValues().get("zet_chemin_parent").equals(datumByVariableAndComponent.get("site").get("bassin")) + && + it.getRefValues().get("zet_nom_key").equals(datumByVariableAndComponent.get("site").get("plateforme"))} .getHierarchicalKey(); references: - sites - replace: true checker: name: Reference params: refType: sites - plateforme: null - chemin: - defaultValue: + computedComponents: + site_bassin: + computation: expression: > return references.get("sites") - .find{it.getRefValues().get("zet_chemin_parent").equals(datumByVariableAndComponent.get("site").get("bassin")) - && - it.getRefValues().get("zet_nom_key").equals(datumByVariableAndComponent.get("site").get("plateforme"))} + .find{it.getNaturalKey().equals(datumByVariableAndComponent.get("site").get("bassin"))} .getHierarchicalKey(); references: - sites -- GitLab From 79ffdfcbe4aa9a446bd7c6bc583c7a164ddce1f0 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Tue, 29 Mar 2022 10:30:18 +0200 Subject: [PATCH 21/41] =?UTF-8?q?Introduit=20une=20classe=20abstraite=20co?= =?UTF-8?q?mmune=20pour=20les=20diff=C3=A9rents=20types=20de=20colonnes=20?= =?UTF-8?q?de=20r=C3=A9f=C3=A9rentiels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/fr/inra/oresing/model/Configuration.java | 14 +++++++++----- .../java/fr/inra/oresing/rest/OreSiService.java | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/fr/inra/oresing/model/Configuration.java b/src/main/java/fr/inra/oresing/model/Configuration.java index 446f0c125..06218ec33 100644 --- a/src/main/java/fr/inra/oresing/model/Configuration.java +++ b/src/main/java/fr/inra/oresing/model/Configuration.java @@ -123,7 +123,7 @@ public class Configuration { public static class ReferenceDescription extends InternationalizationDisplayImpl { private char separator = ';'; private List<String> keyColumns = new LinkedList<>(); - private LinkedHashMap<String, ReferenceColumnDescription> columns = new LinkedHashMap<>(); + private LinkedHashMap<String, ReferenceStaticColumnDescription> columns = new LinkedHashMap<>(); private LinkedHashMap<String, ReferenceDynamicColumnDescription> dynamicColumns = new LinkedHashMap<>(); private LinkedHashMap<String, LineValidationRuleWithColumnsDescription> validations = new LinkedHashMap<>(); @@ -160,19 +160,23 @@ public class Configuration { @Getter @Setter - @ToString - public static class ReferenceColumnDescription { + public static abstract class ReferenceColumnDescription { private ColumnPresenceConstraint presenceConstraint = ColumnPresenceConstraint.MANDATORY; } @Getter @Setter @ToString - public static class ReferenceDynamicColumnDescription { + public static class ReferenceStaticColumnDescription extends ReferenceColumnDescription { + } + + @Getter + @Setter + @ToString + public static class ReferenceDynamicColumnDescription extends ReferenceColumnDescription { private String headerPrefix = ""; private String reference; private String referenceColumnToLookForHeader; - private ColumnPresenceConstraint presenceConstraint = ColumnPresenceConstraint.MANDATORY; } @Getter diff --git a/src/main/java/fr/inra/oresing/rest/OreSiService.java b/src/main/java/fr/inra/oresing/rest/OreSiService.java index e65197d34..aee4c85bd 100644 --- a/src/main/java/fr/inra/oresing/rest/OreSiService.java +++ b/src/main/java/fr/inra/oresing/rest/OreSiService.java @@ -408,7 +408,7 @@ public class OreSiService { .map(entry -> { ReferenceColumn referenceColumn = new ReferenceColumn(entry.getKey()); Multiplicity multiplicity = multiplicityPerColumns.getOrDefault(referenceColumn, Multiplicity.ONE); - ColumnPresenceConstraint presenceConstraint = MoreObjects.firstNonNull(entry.getValue(), new Configuration.ReferenceColumnDescription()).getPresenceConstraint(); + ColumnPresenceConstraint presenceConstraint = MoreObjects.firstNonNull(entry.getValue(), new Configuration.ReferenceStaticColumnDescription()).getPresenceConstraint(); ReferenceImporterContext.Column column; if (multiplicity == Multiplicity.ONE) { column = new ReferenceImporterContext.OneValueStaticColumn(referenceColumn, presenceConstraint); -- GitLab From 88946f271edd62eaf61e6517c52deebbb1603ef2 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Tue, 29 Mar 2022 17:29:06 +0200 Subject: [PATCH 22/41] =?UTF-8?q?Corrige=20une=20expression=20r=C3=A9guli?= =?UTF-8?q?=C3=A8re=20suite=20=C3=A0=20changement=20des=20fins=20de=20lign?= =?UTF-8?q?es=20d'un=20fichier=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/fr/inra/oresing/rest/OreSiResourcesTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/fr/inra/oresing/rest/OreSiResourcesTest.java b/src/test/java/fr/inra/oresing/rest/OreSiResourcesTest.java index 2bff3689f..f0612fed7 100644 --- a/src/test/java/fr/inra/oresing/rest/OreSiResourcesTest.java +++ b/src/test/java/fr/inra/oresing/rest/OreSiResourcesTest.java @@ -285,9 +285,9 @@ public class OreSiResourcesTest { // .andExpect(content().string(expectedCsv)) .andReturn().getResponse().getContentAsString(); log.debug(StringUtils.abbreviate(actualCsv, 50)); - List<String> actualCsvToList = Arrays.stream(actualCsv.split("\r+\n")) + List<String> actualCsvToList = Arrays.stream(actualCsv.split("\r?\n")) .collect(Collectors.toList()); - List<String> expectedCsvToList = Arrays.stream(expectedCsv.split("\r+\n")) + List<String> expectedCsvToList = Arrays.stream(expectedCsv.split("\r?\n")) .collect(Collectors.toList()); Assert.assertEquals(expectedCsvToList.size(), actualCsvToList.size()); actualCsvToList.forEach(expectedCsvToList::remove); -- GitLab From 53e9d5999810f02ec8c1ce3fee524b06b901b6f7 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Tue, 29 Mar 2022 18:39:43 +0200 Subject: [PATCH 23/41] =?UTF-8?q?Permet=20de=20d=C3=A9clarer=20des=20colon?= =?UTF-8?q?nes=20calcul=C3=A9es=20dans=20les=20r=C3=A9f=C3=A9rentiels,=20d?= =?UTF-8?q?es=20valeurs=20par=20d=C3=A9faut=20et=20checkers=20sur=20les=20?= =?UTF-8?q?colonnes=20non=20calcul=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inra/oresing/checker/CheckerFactory.java | 9 + .../groovy/StringSetGroovyExpression.java | 53 ++++ .../model/ColumnPresenceConstraint.java | 14 +- .../oresing/model/ComputedValueUsage.java | 14 + .../fr/inra/oresing/model/Configuration.java | 54 +++- .../rest/ApplicationConfigurationService.java | 18 +- .../fr/inra/oresing/rest/OreSiResources.java | 2 +- .../fr/inra/oresing/rest/OreSiService.java | 205 +++++++++++++- .../inra/oresing/rest/ReferenceImporter.java | 40 ++- .../rest/ReferenceImporterContext.java | 63 +++-- .../inra/oresing/rest/RelationalService.java | 4 +- .../inra/oresing/rest/OreSiResourcesTest.java | 12 +- .../resources/data/foret/foret_essai.yaml | 262 ++++++++---------- 13 files changed, 546 insertions(+), 204 deletions(-) create mode 100644 src/main/java/fr/inra/oresing/groovy/StringSetGroovyExpression.java create mode 100644 src/main/java/fr/inra/oresing/model/ComputedValueUsage.java diff --git a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java index 5655034a0..cbe36b379 100644 --- a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java +++ b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java @@ -57,6 +57,15 @@ public class CheckerFactory { Preconditions.checkArgument(app.getConfiguration().getReferences().containsKey(reference), "Pas de référence " + reference + " dans " + app); Configuration.ReferenceDescription referenceDescription = app.getConfiguration().getReferences().get(reference); ImmutableSet.Builder<LineChecker> checkersBuilder = ImmutableSet.builder(); + for (Map.Entry<String, Configuration.ReferenceStaticColumnDescription> variableEntry : referenceDescription.doGetStaticColumnDescriptions().entrySet()) { + String column = variableEntry.getKey(); + ReferenceColumn referenceColumn = new ReferenceColumn(column); + Configuration.ReferenceStaticColumnDescription variableDescription = variableEntry.getValue(); + Optional.ofNullable(variableEntry.getValue()) + .map(Configuration.ReferenceStaticColumnDescription::getChecker) + .map(checkerDescription -> newChecker(app, checkerDescription, referenceColumn)) + .ifPresent(checkersBuilder::add); + } for (Map.Entry<String, Configuration.LineValidationRuleWithColumnsDescription> validationEntry : referenceDescription.getValidations().entrySet()) { Configuration.LineValidationRuleWithColumnsDescription lineValidationRuleDescription = validationEntry.getValue(); Configuration.CheckerDescription checkerDescription = lineValidationRuleDescription.getChecker(); diff --git a/src/main/java/fr/inra/oresing/groovy/StringSetGroovyExpression.java b/src/main/java/fr/inra/oresing/groovy/StringSetGroovyExpression.java new file mode 100644 index 000000000..6ef751147 --- /dev/null +++ b/src/main/java/fr/inra/oresing/groovy/StringSetGroovyExpression.java @@ -0,0 +1,53 @@ +package fr.inra.oresing.groovy; + +import com.google.common.base.MoreObjects; +import fr.inra.oresing.OreSiTechnicalException; + +import java.util.Collections; +import java.util.LinkedHashSet; +import java.util.Map; +import java.util.Set; + +public class StringSetGroovyExpression implements Expression<Set<String>> { + + private final GroovyExpression expression; + + private StringSetGroovyExpression(GroovyExpression expression) { + this.expression = expression; + } + + public static StringSetGroovyExpression forExpression(String expression) { + return new StringSetGroovyExpression(GroovyExpression.forExpression(expression)); + } + + @Override + public Set<String> evaluate(Map<String, Object> context) { + Object evaluation = expression.evaluate(context); + if (evaluation == null) { + return null; + } else if (evaluation instanceof String) { + return Collections.singleton((String) evaluation); + } else if (evaluation instanceof Iterable) { + Set<String> result = new LinkedHashSet<>(); + for (Object unknownElement : (Iterable) evaluation) { + if (unknownElement instanceof String) { + result.add((String) evaluation); + } else if (unknownElement instanceof Number) { + result.add(unknownElement.toString()); + } else { + throw new OreSiTechnicalException("L'évaluation de l’expression a bien retourné une collection mais elle contient un élément " + unknownElement + " qui n'est pas de type chaîne de caractères. Expression = " + expression + ", donnée = " + context); + } + } + return result; + } else { + throw new OreSiTechnicalException("L'évaluation de l’expression n'a pas retourné une collection de chaîne de caractères mais " + evaluation + ". Expression = " + expression + ", donnée = " + context); + } + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(this) + .add("expression", expression) + .toString(); + } +} diff --git a/src/main/java/fr/inra/oresing/model/ColumnPresenceConstraint.java b/src/main/java/fr/inra/oresing/model/ColumnPresenceConstraint.java index 2c6b226da..731d9a7f8 100644 --- a/src/main/java/fr/inra/oresing/model/ColumnPresenceConstraint.java +++ b/src/main/java/fr/inra/oresing/model/ColumnPresenceConstraint.java @@ -13,9 +13,21 @@ public enum ColumnPresenceConstraint { /** * Facultatif, la colonne peut être absente du fichier CSV. */ - OPTIONAL; + OPTIONAL, + + /** + * La colonne doit être absente, c'est une donnée calculée. + */ + ABSENT; public boolean isMandatory() { return MANDATORY == this; } + + /** + * Si une colonne est attendue dans le fichier CSV + */ + public boolean isExpected() { + return ABSENT != this; + } } diff --git a/src/main/java/fr/inra/oresing/model/ComputedValueUsage.java b/src/main/java/fr/inra/oresing/model/ComputedValueUsage.java new file mode 100644 index 000000000..5253f984c --- /dev/null +++ b/src/main/java/fr/inra/oresing/model/ComputedValueUsage.java @@ -0,0 +1,14 @@ +package fr.inra.oresing.model; + +/** + * Exprime s'il est possible de calculer une valeur pour une donnée et si oui, qu'en faire. + */ +public enum ComputedValueUsage { + + NOT_COMPUTED, + + USE_COMPUTED_AS_DEFAULT_VALUE, + + USE_COMPUTED_VALUE; + +} diff --git a/src/main/java/fr/inra/oresing/model/Configuration.java b/src/main/java/fr/inra/oresing/model/Configuration.java index 06218ec33..7f61b6be9 100644 --- a/src/main/java/fr/inra/oresing/model/Configuration.java +++ b/src/main/java/fr/inra/oresing/model/Configuration.java @@ -123,14 +123,39 @@ public class Configuration { public static class ReferenceDescription extends InternationalizationDisplayImpl { private char separator = ';'; private List<String> keyColumns = new LinkedList<>(); - private LinkedHashMap<String, ReferenceStaticColumnDescription> columns = new LinkedHashMap<>(); + private LinkedHashMap<String, ReferenceStaticNotComputedColumnDescription> columns = new LinkedHashMap<>(); + private LinkedHashMap<String, ReferenceStaticComputedColumnDescription> computedColumns = new LinkedHashMap<>(); private LinkedHashMap<String, ReferenceDynamicColumnDescription> dynamicColumns = new LinkedHashMap<>(); private LinkedHashMap<String, LineValidationRuleWithColumnsDescription> validations = new LinkedHashMap<>(); - public ImmutableSet<ReferenceColumn> doGetStaticColumns() { - return columns.keySet().stream() - .map(ReferenceColumn::new). - collect(ImmutableSet.toImmutableSet()); + public Set<String> doGetAllColumns() { + return doGetAllColumnDescriptions().keySet(); + } + + public Set<String> doGetStaticColumns() { + return doGetStaticColumnDescriptions().keySet(); + } + + public Map<String, ReferenceColumnDescription> doGetAllColumnDescriptions() { + Map<String, ReferenceColumnDescription> allColumnDescriptions = new LinkedHashMap<>(); + allColumnDescriptions.putAll(doGetStaticColumnDescriptions()); + allColumnDescriptions.putAll(dynamicColumns); + return allColumnDescriptions; + } + + public Map<String, ReferenceStaticColumnDescription> doGetStaticColumnDescriptions() { + Map<String, ReferenceStaticColumnDescription> staticColumnDescriptions = new LinkedHashMap<>(); + staticColumnDescriptions.putAll(columns); + staticColumnDescriptions.putAll(computedColumns); + return staticColumnDescriptions; + } + + public boolean hasStaticColumn(String column) { + return doGetStaticColumns().contains(column); + } + + public boolean hasColumn(String column) { + return doGetAllColumns().contains(column); } public ImmutableSet<ReferenceColumn> doGetComputedColumns() { @@ -161,13 +186,28 @@ public class Configuration { @Getter @Setter public static abstract class ReferenceColumnDescription { - private ColumnPresenceConstraint presenceConstraint = ColumnPresenceConstraint.MANDATORY; + ColumnPresenceConstraint presenceConstraint = ColumnPresenceConstraint.MANDATORY; + } + + @Getter + @Setter + public static abstract class ReferenceStaticColumnDescription extends ReferenceColumnDescription { + CheckerDescription checker; } @Getter @Setter @ToString - public static class ReferenceStaticColumnDescription extends ReferenceColumnDescription { + public static class ReferenceStaticNotComputedColumnDescription extends ReferenceStaticColumnDescription { + @Nullable + GroovyConfiguration defaultValue; + } + + @Getter + @Setter + @ToString + public static class ReferenceStaticComputedColumnDescription extends ReferenceStaticColumnDescription { + GroovyConfiguration computation; } @Getter diff --git a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java index a58e9254d..72bb6656f 100644 --- a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java +++ b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java @@ -222,7 +222,7 @@ public class ApplicationConfigurationService { String reference = component.getReference(); if (parentKeyColumn == null) { builder.recordRequiredParentKeyColumnInCompositeReferenceForReference(compositeReferenceName, reference, previousReference); - } else if (!configuration.getReferences().get(reference).getColumns().containsKey(parentKeyColumn)) { + } else if (!configuration.getReferences().get(reference).hasStaticColumn(parentKeyColumn)) { builder.recordMissingParentColumnForReferenceInCompositeReferenceFor(compositeReferenceName, reference, parentKeyColumn); } } @@ -239,7 +239,7 @@ public class ApplicationConfigurationService { continue; } String parentRecursiveKey = component.getParentRecursiveKey(); - if (parentRecursiveKey != null && !configuration.getReferences().get(reference).getColumns().containsKey(parentRecursiveKey)) { + if (parentRecursiveKey != null && !configuration.getReferences().get(reference).hasStaticColumn(parentRecursiveKey)) { builder.recordMissingParentRecursiveKeyColumnForReferenceInCompositeReference(compositeReferenceName, reference, parentRecursiveKey); } } @@ -494,7 +494,7 @@ public class ApplicationConfigurationService { if (keyColumns.isEmpty()) { builder.recordMissingKeyColumnsForReference(reference); } else { - Set<String> columns = referenceDescription.getColumns().keySet(); + Set<String> columns = referenceDescription.doGetStaticColumns(); ImmutableSet<String> keyColumnsSet = ImmutableSet.copyOf(keyColumns); ImmutableSet<String> unknownUsedAsKeyElementColumns = Sets.difference(keyColumnsSet, columns).immutableCopy(); if (!unknownUsedAsKeyElementColumns.isEmpty()) { @@ -529,7 +529,7 @@ public class ApplicationConfigurationService { } Set<String> internationalizedColumns = getInternationalizedColumns(configuration, reference); Set<String> columns = Optional.ofNullable(referenceDescription) - .map(Configuration.ReferenceDescription::getColumns) + .map(Configuration.ReferenceDescription::doGetStaticColumnDescriptions) .map(c -> new LinkedHashSet(c.keySet())) .orElseGet(LinkedHashSet::new); columns.addAll(internationalizedColumns); @@ -583,7 +583,7 @@ public class ApplicationConfigurationService { Set<String> internationalizedColumns = getInternationalizedColumns(configuration, reference); Configuration.ReferenceDescription referenceDescription = configuration.getReferences().getOrDefault(reference, null); LinkedHashSet columns = Optional.ofNullable(referenceDescription) - .map(Configuration.ReferenceDescription::getColumns) + .map(Configuration.ReferenceDescription::doGetStaticColumnDescriptions) .map(c -> new LinkedHashSet(c.keySet())) .orElseGet(LinkedHashSet::new); columns.addAll(internationalizedColumns); @@ -618,8 +618,8 @@ public class ApplicationConfigurationService { Configuration.ReferenceDescription referenceDescription = referenceEntry.getValue(); Set<String> internationalizedColumns = getInternationalizedColumns(configuration, reference); Set<String> columns = Optional.ofNullable(referenceDescription) - .map(Configuration.ReferenceDescription::getColumns) - .map(LinkedHashMap::keySet) + .map(Configuration.ReferenceDescription::doGetStaticColumnDescriptions) + .map(Map::keySet) .orElse(new HashSet<>()); ImmutableSet<String> internationalizedColumnsSet = ImmutableSet.copyOf(internationalizedColumns); @@ -657,9 +657,9 @@ public class ApplicationConfigurationService { builder.missingParamColumnReferenceForCheckerInReference(validationRuleDescriptionEntryKey, reference); } else { Set<String> columnsDeclaredInCheckerConfiguration = lineValidationRuleDescription.getColumns(); - Set<String> knownColumns = referenceDescription.getColumns().keySet(); + Set<String> knownColumns = referenceDescription.doGetAllColumns(); ImmutableSet<String> missingColumns = Sets.difference(columnsDeclaredInCheckerConfiguration, knownColumns).immutableCopy(); - if (false && !missingColumns.isEmpty()) { + if (!missingColumns.isEmpty()) { builder.missingColumnReferenceForCheckerInReference(validationRuleDescriptionEntryKey, knownColumns, checker.getName(), missingColumns, reference); } } diff --git a/src/main/java/fr/inra/oresing/rest/OreSiResources.java b/src/main/java/fr/inra/oresing/rest/OreSiResources.java index 176efa036..93181ce63 100644 --- a/src/main/java/fr/inra/oresing/rest/OreSiResources.java +++ b/src/main/java/fr/inra/oresing/rest/OreSiResources.java @@ -119,7 +119,7 @@ public class OreSiResources { }); }); Map<String, ApplicationResult.Reference> references = Maps.transformEntries(application.getConfiguration().getReferences(), (reference, referenceDescription) -> { - Map<String, ApplicationResult.Reference.Column> columns = Maps.transformEntries(referenceDescription.getColumns(), (column, columnDescription) -> new ApplicationResult.Reference.Column(column, column, referenceDescription.getKeyColumns().contains(column), null)); + Map<String, ApplicationResult.Reference.Column> columns = Maps.transformEntries(referenceDescription.doGetStaticColumnDescriptions(), (column, columnDescription) -> new ApplicationResult.Reference.Column(column, column, referenceDescription.getKeyColumns().contains(column), null)); Set<String> children = childrenPerReferences.get(reference); return new ApplicationResult.Reference(reference, reference, children, columns); }); diff --git a/src/main/java/fr/inra/oresing/rest/OreSiService.java b/src/main/java/fr/inra/oresing/rest/OreSiService.java index aee4c85bd..16418dc8b 100644 --- a/src/main/java/fr/inra/oresing/rest/OreSiService.java +++ b/src/main/java/fr/inra/oresing/rest/OreSiService.java @@ -33,16 +33,19 @@ import fr.inra.oresing.checker.ReferenceLineCheckerConfiguration; import fr.inra.oresing.groovy.Expression; import fr.inra.oresing.groovy.GroovyContextHelper; import fr.inra.oresing.groovy.StringGroovyExpression; +import fr.inra.oresing.groovy.StringSetGroovyExpression; import fr.inra.oresing.model.Application; import fr.inra.oresing.model.Authorization; import fr.inra.oresing.model.BinaryFile; import fr.inra.oresing.model.BinaryFileDataset; import fr.inra.oresing.model.ColumnPresenceConstraint; +import fr.inra.oresing.model.ComputedValueUsage; import fr.inra.oresing.model.Configuration; import fr.inra.oresing.model.Data; import fr.inra.oresing.model.Datum; import fr.inra.oresing.model.LocalDateTimeRange; import fr.inra.oresing.model.ReferenceColumn; +import fr.inra.oresing.model.ReferenceColumnMultipleValue; import fr.inra.oresing.model.ReferenceColumnSingleValue; import fr.inra.oresing.model.ReferenceColumnValue; import fr.inra.oresing.model.ReferenceDatum; @@ -404,23 +407,181 @@ public class OreSiService { Configuration.ReferenceDescription referenceDescription = conf.getReferences().get(refType); - Stream<ReferenceImporterContext.Column> staticColumns = referenceDescription.getColumns().entrySet().stream() + ImmutableSet<ReferenceImporterContext.Column> staticColumns = referenceDescription.getColumns().entrySet().stream() .map(entry -> { + Configuration.ReferenceStaticNotComputedColumnDescription referenceStaticNotComputedColumnDescription = MoreObjects.firstNonNull(entry.getValue(), new Configuration.ReferenceStaticNotComputedColumnDescription()); ReferenceColumn referenceColumn = new ReferenceColumn(entry.getKey()); Multiplicity multiplicity = multiplicityPerColumns.getOrDefault(referenceColumn, Multiplicity.ONE); - ColumnPresenceConstraint presenceConstraint = MoreObjects.firstNonNull(entry.getValue(), new Configuration.ReferenceStaticColumnDescription()).getPresenceConstraint(); + ColumnPresenceConstraint presenceConstraint = referenceStaticNotComputedColumnDescription.getPresenceConstraint(); ReferenceImporterContext.Column column; if (multiplicity == Multiplicity.ONE) { - column = new ReferenceImporterContext.OneValueStaticColumn(referenceColumn, presenceConstraint); + column = Optional.ofNullable(referenceStaticNotComputedColumnDescription.getDefaultValue()).map(defaultValueConfiguration -> { + Expression<String> computationExpression = StringGroovyExpression.forExpression(defaultValueConfiguration.getExpression()); + Set<String> configurationReferences = defaultValueConfiguration.getReferences(); + ImmutableMap<String, Object> contextForExpression = groovyContextHelper.getGroovyContextForReferences(referenceValueRepository, configurationReferences); + Preconditions.checkState(defaultValueConfiguration.getDatatypes().isEmpty(), "à ce stade, on ne gère pas la chargement de données"); + ReferenceImporterContext.Column oneValueStaticColumn = new ReferenceImporterContext.OneValueStaticColumn(referenceColumn, presenceConstraint) { + @Override + String getExpectedHeader() { + return referenceColumn.getColumn(); + } + + @Override + Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { + ImmutableMap<String, Object> evaluationContext = ImmutableMap.<String, Object>builder() + .putAll(contextForExpression) + .putAll(referenceDatum.getEvaluationContext()) + .build(); + String evaluate = computationExpression.evaluate(evaluationContext); + Optional<ReferenceColumnValue> computedValue = Optional.ofNullable(evaluate) + .filter(StringUtils::isNotEmpty) + .map(evaluationResult -> new ReferenceColumnSingleValue(evaluate)); + return computedValue; + } + + @Override + ComputedValueUsage getComputedValueUsage() { + return ComputedValueUsage.USE_COMPUTED_AS_DEFAULT_VALUE; + } + }; + return oneValueStaticColumn; + }).orElseGet(() -> new ReferenceImporterContext.OneValueStaticColumn(referenceColumn, presenceConstraint) { + @Override + String getExpectedHeader() { + return referenceColumn.getColumn(); + } + + @Override + Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { + throw new UnsupportedOperationException("pas de valeur par défaut pour " + referenceColumn); + } + + @Override + ComputedValueUsage getComputedValueUsage() { + return ComputedValueUsage.NOT_COMPUTED; + } + }); } else if (multiplicity == Multiplicity.MANY) { - column = new ReferenceImporterContext.ManyValuesStaticColumn(referenceColumn, presenceConstraint); + column = Optional.ofNullable(referenceStaticNotComputedColumnDescription.getDefaultValue()).map(defaultValueConfiguration -> { + Expression<Set<String>> computationExpression = StringSetGroovyExpression.forExpression(defaultValueConfiguration.getExpression()); + Set<String> configurationReferences = defaultValueConfiguration.getReferences(); + ImmutableMap<String, Object> contextForExpression = groovyContextHelper.getGroovyContextForReferences(referenceValueRepository, configurationReferences); + Preconditions.checkState(defaultValueConfiguration.getDatatypes().isEmpty(), "à ce stade, on ne gère pas la chargement de données"); + ReferenceImporterContext.Column manyValuesStaticColumn = new ReferenceImporterContext.ManyValuesStaticColumn(referenceColumn, presenceConstraint) { + @Override + String getExpectedHeader() { + return referenceColumn.getColumn(); + } + + @Override + Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { + ImmutableMap<String, Object> evaluationContext = ImmutableMap.<String, Object>builder() + .putAll(contextForExpression) + .putAll(referenceDatum.getEvaluationContext()) + .build(); + Set<String> evaluate = computationExpression.evaluate(evaluationContext); + Optional<ReferenceColumnValue> computedValue = Optional.ofNullable(evaluate) + .map(evaluationResult -> new ReferenceColumnMultipleValue(evaluate)); + return computedValue; + } + + @Override + ComputedValueUsage getComputedValueUsage() { + return ComputedValueUsage.USE_COMPUTED_AS_DEFAULT_VALUE; + } + }; + return manyValuesStaticColumn; + }).orElseGet(() -> new ReferenceImporterContext.ManyValuesStaticColumn(referenceColumn, presenceConstraint) { + @Override + String getExpectedHeader() { + return referenceColumn.getColumn(); + } + + @Override + Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { + throw new UnsupportedOperationException("pas de valeur par défaut pour " + referenceColumn); + } + + @Override + ComputedValueUsage getComputedValueUsage() { + return ComputedValueUsage.NOT_COMPUTED; + } + }); } else { throw new IllegalStateException("multiplicity = " + multiplicity); } return column; - }); + }).collect(ImmutableSet.toImmutableSet()); - Stream<ReferenceImporterContext.Column> dynamicColumns = referenceDescription.getDynamicColumns().entrySet().stream() + ImmutableSet<ReferenceImporterContext.Column> computedColumns = referenceDescription.getComputedColumns().entrySet().stream() + .map(entry -> { + Configuration.ReferenceStaticComputedColumnDescription referenceStaticComputedColumnDescription = entry.getValue(); + Configuration.GroovyConfiguration computation = referenceStaticComputedColumnDescription.getComputation(); + ReferenceColumn referenceColumn = new ReferenceColumn(entry.getKey()); + Multiplicity multiplicity = multiplicityPerColumns.getOrDefault(referenceColumn, Multiplicity.ONE); + ColumnPresenceConstraint presenceConstraint = ColumnPresenceConstraint.ABSENT; + ReferenceImporterContext.Column column; + Set<String> configurationReferences = computation.getReferences(); + ImmutableMap<String, Object> contextForExpression = groovyContextHelper.getGroovyContextForReferences(referenceValueRepository, configurationReferences); + Preconditions.checkState(computation.getDatatypes().isEmpty(), "à ce stade, on ne gère pas la chargement de données"); + if (multiplicity == Multiplicity.ONE) { + Expression<String> computationExpression = StringGroovyExpression.forExpression(computation.getExpression()); + column = new ReferenceImporterContext.OneValueStaticColumn(referenceColumn, presenceConstraint) { + @Override + String getExpectedHeader() { + throw new UnsupportedOperationException("la colonne " + referenceColumn + " est calculée, il n'y a pas d'entête spécifié"); + } + + @Override + Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { + ImmutableMap<String, Object> evaluationContext = ImmutableMap.<String, Object>builder() + .putAll(contextForExpression) + .putAll(referenceDatum.getEvaluationContext()) + .build(); + String evaluate = computationExpression.evaluate(evaluationContext); + Optional<ReferenceColumnValue> computedValue = Optional.ofNullable(evaluate) + .filter(StringUtils::isNotEmpty) + .map(evaluationResult -> new ReferenceColumnSingleValue(evaluate)); + return computedValue; + } + + @Override + ComputedValueUsage getComputedValueUsage() { + return ComputedValueUsage.USE_COMPUTED_VALUE; + } + }; + } else if (multiplicity == Multiplicity.MANY) { + Expression<Set<String>> computationExpression = StringSetGroovyExpression.forExpression(computation.getExpression()); + column = new ReferenceImporterContext.ManyValuesStaticColumn(referenceColumn, presenceConstraint) { + @Override + String getExpectedHeader() { + throw new UnsupportedOperationException("la colonne " + referenceColumn + " est calculée, il n'y a pas d'entête spécifié car elle ne doit pas être dans le CSV"); + } + + @Override + Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { + ImmutableMap<String, Object> evaluationContext = ImmutableMap.<String, Object>builder() + .putAll(contextForExpression) + .putAll(referenceDatum.getEvaluationContext()) + .build(); + Set<String> evaluate = computationExpression.evaluate(evaluationContext); + Optional<ReferenceColumnValue> computedValue = Optional.ofNullable(evaluate) + .map(evaluationResult -> new ReferenceColumnMultipleValue(evaluate)); + return computedValue; + } + + @Override + ComputedValueUsage getComputedValueUsage() { + return ComputedValueUsage.USE_COMPUTED_VALUE; + } + }; + } else { + throw new IllegalStateException("multiplicity = " + multiplicity); + } + return column; + }).collect(ImmutableSet.toImmutableSet()); + + ImmutableSet<ReferenceImporterContext.Column> dynamicColumns = referenceDescription.getDynamicColumns().entrySet().stream() .flatMap(entry -> { ReferenceColumn referenceColumn = new ReferenceColumn(entry.getKey()); Configuration.ReferenceDynamicColumnDescription value = entry.getValue(); @@ -437,21 +598,35 @@ public class OreSiService { ColumnPresenceConstraint presenceConstraint = value.getPresenceConstraint(); return new ReferenceImporterContext.DynamicColumn( referenceColumn, - fullHeader, presenceConstraint, hierarchicalKey, Map.entry(reference, referenceValue.getId()) - ); + ) { + @Override + String getExpectedHeader() { + return fullHeader; + } + + @Override + Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { + throw new UnsupportedOperationException("pas de valeur calculable pour " + referenceColumn); + } + + @Override + ComputedValueUsage getComputedValueUsage() { + return ComputedValueUsage.NOT_COMPUTED; + } + }; }); return valuedDynamicColumns; - }); + }).collect(ImmutableSet.toImmutableSet()); + + ImmutableSet<ReferenceImporterContext.Column> columns = ImmutableSet.<ReferenceImporterContext.Column>builder() + .addAll(staticColumns) + .addAll(computedColumns) + .addAll(dynamicColumns) + .build(); - ImmutableMap<String, ReferenceImporterContext.Column> columns = - Stream.concat(staticColumns, dynamicColumns) - .collect(ImmutableMap.toImmutableMap( - ReferenceImporterContext.Column::getExpectedHeader, - Function.identity() - )); final ReferenceImporterContext.Constants constants = new ReferenceImporterContext.Constants( app.getId(), conf, diff --git a/src/main/java/fr/inra/oresing/rest/ReferenceImporter.java b/src/main/java/fr/inra/oresing/rest/ReferenceImporter.java index 9004ee0f0..98369d9a9 100644 --- a/src/main/java/fr/inra/oresing/rest/ReferenceImporter.java +++ b/src/main/java/fr/inra/oresing/rest/ReferenceImporter.java @@ -20,6 +20,7 @@ import fr.inra.oresing.checker.DateLineChecker; import fr.inra.oresing.checker.InvalidDatasetContentException; import fr.inra.oresing.checker.Multiplicity; import fr.inra.oresing.checker.ReferenceLineChecker; +import fr.inra.oresing.model.ComputedValueUsage; import fr.inra.oresing.model.ReferenceColumn; import fr.inra.oresing.model.ReferenceColumnMultipleValue; import fr.inra.oresing.model.ReferenceColumnSingleValue; @@ -44,7 +45,18 @@ import org.springframework.web.multipart.MultipartFile; import java.io.IOException; import java.io.InputStream; import java.time.format.DateTimeFormatter; -import java.util.*; +import java.util.Collection; +import java.util.Comparator; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; +import java.util.UUID; import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Collectors; @@ -97,7 +109,9 @@ abstract class ReferenceImporter { checkHeader(columns, Ints.checkedCast(headerRow.getRecordNumber())); Stream<CSVRecord> csvRecordsStream = Streams.stream(csvParser); Function<CSVRecord, RowWithReferenceDatum> csvRecordToReferenceDatumFn = csvRecord -> csvRecordToRowWithReferenceDatum(columns, csvRecord); - final Stream<RowWithReferenceDatum> recordStreamBeforePreloading = csvRecordsStream.map(csvRecordToReferenceDatumFn); + final Stream<RowWithReferenceDatum> recordStreamBeforePreloading = + csvRecordsStream.map(csvRecordToReferenceDatumFn) + .map(this::computeComputedColumns); final Stream<RowWithReferenceDatum> recordStream = recursionStrategy.firstPass(recordStreamBeforePreloading); Stream<ReferenceValue> referenceValuesStream = recordStream .map(this::check) @@ -120,6 +134,28 @@ abstract class ReferenceImporter { InvalidDatasetContentException.checkErrorsIsEmpty(allErrors); } + private RowWithReferenceDatum computeComputedColumns(RowWithReferenceDatum rowWithReferenceDatum) { + ReferenceDatum rowWithDefaults = new ReferenceDatum(); + ReferenceDatum rowWithValues = ReferenceDatum.copyOf(rowWithReferenceDatum.getReferenceDatum()); + referenceImporterContext.getColumns().stream() + .filter(column -> column.getComputedValueUsage() != ComputedValueUsage.NOT_COMPUTED) + .forEach(column -> { + ReferenceColumn referenceColumn = column.getReferenceColumn(); + Optional<ReferenceColumnValue> evaluate = column.computeValue(rowWithReferenceDatum.getReferenceDatum()); + evaluate.ifPresent(presentEvaluate -> { + if (column.getComputedValueUsage() == ComputedValueUsage.USE_COMPUTED_VALUE) { + rowWithValues.put(referenceColumn, presentEvaluate); + } else if (column.getComputedValueUsage() == ComputedValueUsage.USE_COMPUTED_AS_DEFAULT_VALUE){ + rowWithDefaults.put(referenceColumn, presentEvaluate); + } else { + throw new IllegalArgumentException("on ne sait comment utiliser la valeur calculée de " + referenceColumn + " → " + column.getComputedValueUsage()); + } + }); + }); + rowWithDefaults.putAll(rowWithValues); + return new RowWithReferenceDatum(rowWithReferenceDatum.getLineNumber(), rowWithDefaults, rowWithReferenceDatum.getRefsLinkedTo()); + } + private void checkHeader(ImmutableList<String> columns, int headerLineNumber) { ImmutableSet<String> expectedHeaders = referenceImporterContext.getExpectedHeaders(); ImmutableSet<String> mandatoryHeaders = referenceImporterContext.getMandatoryHeaders(); diff --git a/src/main/java/fr/inra/oresing/rest/ReferenceImporterContext.java b/src/main/java/fr/inra/oresing/rest/ReferenceImporterContext.java index 9bf8885d6..d72493017 100644 --- a/src/main/java/fr/inra/oresing/rest/ReferenceImporterContext.java +++ b/src/main/java/fr/inra/oresing/rest/ReferenceImporterContext.java @@ -15,6 +15,7 @@ import fr.inra.oresing.persistence.ReferenceValueRepository; import lombok.AllArgsConstructor; import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; /** @@ -37,7 +38,8 @@ public class ReferenceImporterContext { */ private final ImmutableMap<Ltree, UUID> storedReferences; - private final ImmutableMap<String, Column> columnsPerHeader; + private final ImmutableSet<Column> columns; + Map<String, Map<String, Map<String, String>>> displayByReferenceAndNaturalKey; public String getDisplayByReferenceAndNaturalKey(String referencedColumn, String naturalKey, String locale){ @@ -152,24 +154,42 @@ public class ReferenceImporterContext { return Optional.ofNullable(storedReferences.get(hierarchicalKey)); } + /** + * @deprecated ne devrait pas être exposé + */ + @Deprecated + public ImmutableSet<Column> getColumns() { + return columns; + } + + private ImmutableMap<String, Column> getExpectedColumnsPerHeaders() { + ImmutableMap<String, ReferenceImporterContext.Column> expectedColumnsPerHeaders = columns.stream() + .filter(Column::isExpected) + .collect(ImmutableMap.toImmutableMap( + ReferenceImporterContext.Column::getExpectedHeader, + Function.identity() + )); + return expectedColumnsPerHeaders; + } + public void pushValue(ReferenceDatum referenceDatum, String header, String cellContent, SetMultimap<String, UUID> refsLinkedTo) { - Column column = columnsPerHeader.get(header); + Column column = getExpectedColumnsPerHeaders().get(header); column.pushValue(cellContent, referenceDatum, refsLinkedTo); } public ImmutableSet<String> getExpectedHeaders() { - return columnsPerHeader.keySet(); + return getExpectedColumnsPerHeaders().keySet(); } public ImmutableSet<String> getMandatoryHeaders() { - return columnsPerHeader.values().stream() + return getExpectedColumnsPerHeaders().values().stream() .filter(Column::isMandatory) .map(Column::getExpectedHeader) .collect(ImmutableSet.toImmutableSet()); } public String getCsvCellContent(ReferenceDatum referenceDatum, String header) { - Column column = columnsPerHeader.get(header); + Column column = getExpectedColumnsPerHeaders().get(header); return column.getCsvCellContent(referenceDatum); } @@ -401,20 +421,17 @@ public class ReferenceImporterContext { public abstract static class Column { - private final String expectedHeader; - private final ReferenceColumn referenceColumn; private final ColumnPresenceConstraint presenceConstraint; - public Column(ReferenceColumn referenceColumn, String expectedHeader, ColumnPresenceConstraint presenceConstraint) { + public Column(ReferenceColumn referenceColumn, ColumnPresenceConstraint presenceConstraint) { this.referenceColumn = referenceColumn; - this.expectedHeader = expectedHeader; this.presenceConstraint = presenceConstraint; } public boolean canHandle(String header) { - return expectedHeader.equals(header); + return isExpected() && getExpectedHeader().equals(header); } abstract void pushValue(String cellContent, ReferenceDatum referenceDatum, SetMultimap<String, UUID> refsLinkedTo); @@ -425,9 +442,7 @@ public class ReferenceImporterContext { return referenceColumn; } - public String getExpectedHeader() { - return expectedHeader; - } + abstract String getExpectedHeader(); public ColumnPresenceConstraint getPresenceConstraint() { return presenceConstraint; @@ -436,12 +451,20 @@ public class ReferenceImporterContext { public boolean isMandatory() { return getPresenceConstraint().isMandatory(); } + + public boolean isExpected() { + return getPresenceConstraint().isExpected(); + } + + abstract Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum); + + abstract ComputedValueUsage getComputedValueUsage(); } - public static class OneValueStaticColumn extends Column { + public static abstract class OneValueStaticColumn extends Column { public OneValueStaticColumn(ReferenceColumn referenceColumn, ColumnPresenceConstraint presenceConstraint) { - super(referenceColumn, referenceColumn.getColumn(), presenceConstraint); + super(referenceColumn, presenceConstraint); } @Override @@ -457,12 +480,12 @@ public class ReferenceImporterContext { } } - public static class ManyValuesStaticColumn extends Column { + public static abstract class ManyValuesStaticColumn extends Column { private static final String CSV_CELL_SEPARATOR = ","; public ManyValuesStaticColumn(ReferenceColumn referenceColumn, ColumnPresenceConstraint presenceConstraint) { - super(referenceColumn, referenceColumn.getColumn(), presenceConstraint); + super(referenceColumn, presenceConstraint); } @Override @@ -484,7 +507,7 @@ public class ReferenceImporterContext { } } - public static class DynamicColumn extends Column { + public static abstract class DynamicColumn extends Column { /** * Les colonnes dynamiques sont représentées sous forme de Map dont la clé est la clé hiérarchique correspondant au référentiel qui décrit cette colonne dynamique @@ -496,8 +519,8 @@ public class ReferenceImporterContext { */ private final Map.Entry<String, UUID> refsLinkedToEntryToAdd; - public DynamicColumn(ReferenceColumn referenceColumn, String expectedHeader, ColumnPresenceConstraint presenceConstraint, Ltree expectedHierarchicalKey, Map.Entry<String, UUID> refsLinkedToEntryToAdd) { - super(referenceColumn, expectedHeader, presenceConstraint); + public DynamicColumn(ReferenceColumn referenceColumn, ColumnPresenceConstraint presenceConstraint, Ltree expectedHierarchicalKey, Map.Entry<String, UUID> refsLinkedToEntryToAdd) { + super(referenceColumn, presenceConstraint); this.expectedHierarchicalKey = expectedHierarchicalKey; this.refsLinkedToEntryToAdd = refsLinkedToEntryToAdd; } diff --git a/src/main/java/fr/inra/oresing/rest/RelationalService.java b/src/main/java/fr/inra/oresing/rest/RelationalService.java index 375551ea3..1a17e162a 100644 --- a/src/main/java/fr/inra/oresing/rest/RelationalService.java +++ b/src/main/java/fr/inra/oresing/rest/RelationalService.java @@ -281,7 +281,7 @@ public class RelationalService implements InitializingBean, DisposableBean { String foreignKeyColumnName = getTechnicalIdColumnName(variableComponentKey); String alias = getAliasForColumnName(variableComponentKey); - application.getConfiguration().getReferences().get(referenceType).getColumns().keySet().stream() + application.getConfiguration().getReferences().get(referenceType).doGetStaticColumns().stream() .map(referenceColumn -> alias + "." + quoteSqlIdentifier(referenceColumn) + " as " + getColumnName("ref", variableComponentKey.getVariable(), variableComponentKey.getComponent(), referenceColumn)) .forEach(selectClauseReferenceElements::add); fromClauseJoinElements.add("left outer join " + quotedViewName + " " + alias + " on " + dataTableName + "." + foreignKeyColumnName + "::uuid = " + alias + "." + quoteSqlIdentifier(referenceType + "_id") + "::uuid"); @@ -343,7 +343,7 @@ public class RelationalService implements InitializingBean, DisposableBean { .map(ReferenceLineChecker.class::cast) .collect(ImmutableMap.toImmutableMap(rlc -> (ReferenceColumn) rlc.getTarget(), referenceLineChecker -> referenceLineChecker.getConfiguration().getMultiplicity())); - ImmutableSetMultimap<Multiplicity, ReferenceColumn> allReferenceColumnsPerMultiplicity = referenceDescription.getColumns().keySet().stream() + ImmutableSetMultimap<Multiplicity, ReferenceColumn> allReferenceColumnsPerMultiplicity = referenceDescription.doGetStaticColumns().stream() .map(ReferenceColumn::new) .collect(ImmutableSetMultimap.toImmutableSetMultimap(referenceColumn -> declaredMultiplicityPerReferenceColumns.getOrDefault(referenceColumn, Multiplicity.ONE), Function.identity())); diff --git a/src/test/java/fr/inra/oresing/rest/OreSiResourcesTest.java b/src/test/java/fr/inra/oresing/rest/OreSiResourcesTest.java index f0612fed7..304026d5a 100644 --- a/src/test/java/fr/inra/oresing/rest/OreSiResourcesTest.java +++ b/src/test/java/fr/inra/oresing/rest/OreSiResourcesTest.java @@ -49,13 +49,21 @@ import java.io.InputStream; import java.net.URL; import java.nio.charset.StandardCharsets; import java.nio.file.Path; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.UUID; import java.util.stream.Collectors; import java.util.stream.Stream; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringRunner.class) @SpringBootTest(classes = OreSiNg.class) diff --git a/src/test/resources/data/foret/foret_essai.yaml b/src/test/resources/data/foret/foret_essai.yaml index 65871e38d..8e9b1323d 100644 --- a/src/test/resources/data/foret/foret_essai.yaml +++ b/src/test/resources/data/foret/foret_essai.yaml @@ -358,75 +358,56 @@ references: code de l'instrument: null doi de la référence: null instruments_periodes: - validations: - instrumentRef: - description: référence à l'instrument - columns: [ Code de l'instrument ] + computedColumns: + theme_types_de_donnees_par_zone_etudes: + computation: + expression: > + String[] tab = datum.get("Nom du Thème-Type de + données-Variable").split("-"); String site = tab[0].strip(); + String theme = tab[1].strip(); String datatype = tab[2].strip(); + return references["theme_types_de_donnees_par_zone_etudes"] + .findAll {it.refValues["nom du site"].equals(site)} .findAll + {it.refValues["nom du thème"].equals(theme)} .find + {it.refValues["nom du type de données"].equals(datatype)} + .naturalKey + references: + - theme_types_de_donnees_par_zone_etudes checker: name: Reference params: - refType: instruments - required: true - transformation: - codify: true - checkSiteThemeDatatype: - description: référence au siteThemeDatatype - columns: [ theme_types_de_donnees_par_zone_etudes ] + refType: theme_types_de_donnees_par_zone_etudes + variables_par_types_de_donnees: + computation: + expression: > + String[] tab = datum.get("Nom du Thème-Type de + données-Variable").split("-"); String datatype = + fr.inra.oresing.rest.OreSiService.escapeKeyComponent( + tab[2].strip()); String variable = + fr.inra.oresing.rest.OreSiService.escapeKeyComponent( + tab[3].strip()); return + references.find{it.key.equals("variables_par_types_de_donnees")}.value + .findAll {it.refValues["nom de la variable"].equals(variable)} + .find {it.refValues["nom du type de données"].equals(datatype)} + .naturalKey + references: + - variables_par_types_de_donnees checker: name: Reference params: - refType: theme_types_de_donnees_par_zone_etudes + refType: variables_par_types_de_donnees transformation: - groovy: - expression: > - String[] tab = datum.get("Nom du Thème-Type de - données-Variable").split("-"); String site = tab[0].strip(); - String theme = tab[1].strip(); String datatype = tab[2].strip(); - return references["theme_types_de_donnees_par_zone_etudes"] - .findAll {it.refValues["nom du site"].equals(site)} .findAll - {it.refValues["nom du thème"].equals(theme)} .find - {it.refValues["nom du type de données"].equals(datatype)} - .naturalKey - references: - - theme_types_de_donnees_par_zone_etudes - checkDataypeVariableUnite: - description: référence au DataypeVariableUnite - columns: [ variables_par_types_de_donnees ] + codify: true + validations: + instrumentRef: + description: référence à l'instrument + columns: [ Code de l'instrument ] checker: name: Reference params: - refType: variables_par_types_de_donnees + refType: instruments required: true transformation: - groovy: - expression: > - String[] tab = datum.get("Nom du Thème-Type de - données-Variable").split("-"); String datatype = - fr.inra.oresing.rest.OreSiService.escapeKeyComponent( - tab[2].strip()); String variable = - fr.inra.oresing.rest.OreSiService.escapeKeyComponent( - tab[3].strip()); return - references.find{it.key.equals("variables_par_types_de_donnees")}.value - .findAll {it.refValues["nom de la variable"].equals(variable)} - .find {it.refValues["nom du type de données"].equals(datatype)} - .naturalKey - references: - - variables_par_types_de_donnees codify: true - date début: - description: date de début - checker: - name: Date - params: - pattern: dd/MM/yyyy - columns: [ Date de début ] - date fin: - description: date de fin - checker: - name: Date - params: - pattern: dd/MM/yyyy - columns: [ Date de fin ] internationalizationName: fr: Périodes d'application des instruments en: Application periods of the instruments @@ -439,8 +420,16 @@ references: columns: Nom du Thème-Type de données-Variable: null Code de l'instrument: null - Date de début: null - Date de fin: null + Date de début: + checker: + name: Date + params: + pattern: dd/MM/yyyy + Date de fin: + checker: + name: Date + params: + pattern: dd/MM/yyyy methodes: internationalizationName: fr: Méthodes @@ -500,75 +489,64 @@ references: code de la méthode de calcul: null doi de la référence: null methodes_periodes: - validations: - methodeRef: - description: référence à la méthode - columns: [ Code de la méthode de calcul ] - checker: - name: Reference - params: - refType: methodes - required: true - transformation: - codify: true - checkSiteThemeDatatype: - description: référence au siteThemeDatatype - columns: [ theme_types_de_donnees_par_zone_etudes ] + computedColumns: + theme_types_de_donnees_par_zone_etudes: + computation: + expression: > + String[] tab = datum.get("Nom du Thème-Type de + données-Variable").split("-"); String site = tab[0].strip(); + String theme = tab[1].strip(); String datatype = tab[2].strip(); + return references["theme_types_de_donnees_par_zone_etudes"] + .findAll {it.refValues["nom du site"].equals(site)} .findAll + {it.refValues["nom du thème"].equals(theme)} .find + {it.refValues["nom du type de données"].equals(datatype)} + .naturalKey + references: + - theme_types_de_donnees_par_zone_etudes checker: name: Reference params: refType: theme_types_de_donnees_par_zone_etudes - transformation: - groovy: - expression: > - String[] tab = datum.get("Nom du Thème-Type de - données-Variable").split("-"); String site = tab[0].strip(); - String theme = tab[1].strip(); String datatype = tab[2].strip(); - return references["theme_types_de_donnees_par_zone_etudes"] - .findAll {it.refValues["nom du site"].equals(site)} .findAll - {it.refValues["nom du thème"].equals(theme)} .find - {it.refValues["nom du type de données"].equals(datatype)} - .naturalKey - references: - - theme_types_de_donnees_par_zone_etudes - checkDataypeVariableUnite: - description: référence au DataypeVariableUnite - columns: [ variables_par_types_de_donnees ] + variables_par_types_de_donnees: + computation: + expression: > + String[] tab = datum.get("Nom du Thème-Type de + données-Variable").split("-"); String datatype = + fr.inra.oresing.rest.OreSiService.escapeKeyComponent( + tab[2].strip()); String variable = + fr.inra.oresing.rest.OreSiService.escapeKeyComponent( + tab[3].strip()); return + references.find{it.key.equals("variables_par_types_de_donnees")}.value + .findAll {it.refValues["nom de la variable"].equals(variable)} + .find {it.refValues["nom du type de données"].equals(datatype)} + .naturalKey + references: + - variables_par_types_de_donnees checker: name: Reference params: refType: variables_par_types_de_donnees required: true transformation: - groovy: - expression: > - String[] tab = datum.get("Nom du Thème-Type de - données-Variable").split("-"); String datatype = - fr.inra.oresing.rest.OreSiService.escapeKeyComponent( - tab[2].strip()); String variable = - fr.inra.oresing.rest.OreSiService.escapeKeyComponent( - tab[3].strip()); return - references.find{it.key.equals("variables_par_types_de_donnees")}.value - .findAll {it.refValues["nom de la variable"].equals(variable)} - .find {it.refValues["nom du type de données"].equals(datatype)} - .naturalKey - references: - - variables_par_types_de_donnees codify: true - date début: - description: date de début + validations: + methodeRef: + description: référence à la méthode + columns: [ Code de la méthode de calcul ] checker: - name: Date + name: Reference params: - pattern: dd/MM/yyyy - columns: [ Date de début ] - date fin: - description: date de fin + refType: methodes + required: true + transformation: + codify: true + dates: + description: Les dates sont des jours + columns: [ Date de début, Date de fin ] checker: name: Date params: pattern: dd/MM/yyyy - columns: [ Date de fin ] internationalizationName: fr: Périodes d'application des méthodes en: Application periods of methods @@ -666,50 +644,44 @@ references: description de l'information complémentaire_en: null nom de la liste de valeurs d'informations complémentaires: null ic_site_theme_dataype_variable: - validations: - checkSiteThemeDatatype: - description: référence au siteThemeDatatype - columns: [ theme_types_de_donnees_par_zone_etudes ] + computedColumns: + theme_types_de_donnees_par_zone_etudes: + computation: + expression: > + String[] tab = datum.get("Nom du Thème-Type de + données-Variable").split("-"); String site = tab[0].strip(); + String theme = tab[1].strip(); String datatype = tab[2].strip(); + return references["theme_types_de_donnees_par_zone_etudes"] + .findAll {it.refValues["nom du site"].equals(site)} .findAll + {it.refValues["nom du thème"].equals(theme)} .find + {it.refValues["nom du type de données"].equals(datatype)} + .naturalKey + references: + - theme_types_de_donnees_par_zone_etudes checker: name: Reference params: refType: theme_types_de_donnees_par_zone_etudes - transformation: - groovy: - expression: > - String[] tab = datum.get("Nom du Thème-Type de - données-Variable").split("-"); String site = tab[0].strip(); - String theme = tab[1].strip(); String datatype = tab[2].strip(); - return references["theme_types_de_donnees_par_zone_etudes"] - .findAll {it.refValues["nom du site"].equals(site)} .findAll - {it.refValues["nom du thème"].equals(theme)} .find - {it.refValues["nom du type de données"].equals(datatype)} - .naturalKey - references: - - theme_types_de_donnees_par_zone_etudes - checkDataypeVariableUnite: - description: référence au DataypeVariableUnite - columns: [ variables_par_types_de_donnees ] + variables_par_types_de_donnees: + computation: + expression: > + String[] tab = datum.get("Nom du Thème-Type de + données-Variable").split("-"); String datatype = + fr.inra.oresing.rest.OreSiService.escapeKeyComponent( + tab[2].strip()); String variable = + fr.inra.oresing.rest.OreSiService.escapeKeyComponent( + tab[3].strip()); return + references.find{it.key.equals("variables_par_types_de_donnees")}.value + .findAll {it.refValues["nom de la variable"].equals(variable)} + .find {it.refValues["nom du type de données"].equals(datatype)} + .naturalKey + references: + - variables_par_types_de_donnees checker: name: Reference params: refType: variables_par_types_de_donnees - required: true transformation: - groovy: - expression: > - String[] tab = datum.get("Nom du Thème-Type de - données-Variable").split("-"); String datatype = - fr.inra.oresing.rest.OreSiService.escapeKeyComponent( - tab[2].strip()); String variable = - fr.inra.oresing.rest.OreSiService.escapeKeyComponent( - tab[3].strip()); return - references.find{it.key.equals("variables_par_types_de_donnees")}.value - .findAll {it.refValues["nom de la variable"].equals(variable)} - .find {it.refValues["nom du type de données"].equals(datatype)} - .naturalKey - references: - - variables_par_types_de_donnees codify: true internationalizationName: fr: >- -- GitLab From 4cf8004137396f16652f32d05e7c2de83cb624b2 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Wed, 30 Mar 2022 11:02:57 +0200 Subject: [PATCH 24/41] =?UTF-8?q?Introduit=20un=20service=20d=C3=A9di?= =?UTF-8?q?=C3=A9=20aux=20r=C3=A9f=C3=A9rentiels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/inra/oresing/rest/OreSiService.java | 333 +-------------- .../rest/ReferenceImporterContext.java | 21 +- .../inra/oresing/rest/ReferenceService.java | 378 ++++++++++++++++++ 3 files changed, 397 insertions(+), 335 deletions(-) create mode 100644 src/main/java/fr/inra/oresing/rest/ReferenceService.java diff --git a/src/main/java/fr/inra/oresing/rest/OreSiService.java b/src/main/java/fr/inra/oresing/rest/OreSiService.java index 16418dc8b..4b8154d5f 100644 --- a/src/main/java/fr/inra/oresing/rest/OreSiService.java +++ b/src/main/java/fr/inra/oresing/rest/OreSiService.java @@ -1,7 +1,6 @@ package fr.inra.oresing.rest; import com.google.common.base.Charsets; -import com.google.common.base.MoreObjects; import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.base.Strings; @@ -27,25 +26,20 @@ import fr.inra.oresing.checker.FloatChecker; import fr.inra.oresing.checker.IntegerChecker; import fr.inra.oresing.checker.InvalidDatasetContentException; import fr.inra.oresing.checker.LineChecker; -import fr.inra.oresing.checker.Multiplicity; import fr.inra.oresing.checker.ReferenceLineChecker; import fr.inra.oresing.checker.ReferenceLineCheckerConfiguration; import fr.inra.oresing.groovy.Expression; import fr.inra.oresing.groovy.GroovyContextHelper; import fr.inra.oresing.groovy.StringGroovyExpression; -import fr.inra.oresing.groovy.StringSetGroovyExpression; import fr.inra.oresing.model.Application; import fr.inra.oresing.model.Authorization; import fr.inra.oresing.model.BinaryFile; import fr.inra.oresing.model.BinaryFileDataset; -import fr.inra.oresing.model.ColumnPresenceConstraint; -import fr.inra.oresing.model.ComputedValueUsage; import fr.inra.oresing.model.Configuration; import fr.inra.oresing.model.Data; import fr.inra.oresing.model.Datum; import fr.inra.oresing.model.LocalDateTimeRange; import fr.inra.oresing.model.ReferenceColumn; -import fr.inra.oresing.model.ReferenceColumnMultipleValue; import fr.inra.oresing.model.ReferenceColumnSingleValue; import fr.inra.oresing.model.ReferenceColumnValue; import fr.inra.oresing.model.ReferenceDatum; @@ -69,7 +63,6 @@ import fr.inra.oresing.persistence.roles.OreSiUserRole; import fr.inra.oresing.rest.validationcheckresults.DateValidationCheckResult; import fr.inra.oresing.rest.validationcheckresults.DefaultValidationCheckResult; import fr.inra.oresing.rest.validationcheckresults.ReferenceValidationCheckResult; -import fr.inra.oresing.transformer.TransformerFactory; import lombok.Value; import lombok.extern.slf4j.Slf4j; import org.apache.commons.csv.CSVFormat; @@ -139,9 +132,6 @@ public class OreSiService { @Autowired private AuthenticationService authenticationService; - @Autowired - private TransformerFactory transformerFactory; - @Autowired private CheckerFactory checkerFactory; @@ -163,6 +153,9 @@ public class OreSiService { @Autowired private GroovyContextHelper groovyContextHelper; + @Autowired + private ReferenceService referenceService; + /** * @deprecated utiliser directement {@link Ltree#escapeToLabel(String)} */ @@ -379,288 +372,12 @@ public class OreSiService { } public UUID addReference(Application app, String refType, MultipartFile file) throws IOException { - ReferenceValueRepository referenceValueRepository = repo.getRepository(app).referenceValue(); authenticationService.setRoleForClient(); UUID fileId = storeFile(app, file, ""); - final ReferenceImporterContext referenceImporterContext = getReferenceImporterContext(app, refType); - ReferenceImporter referenceImporter = new ReferenceImporter(referenceImporterContext) { - @Override - void storeAll(Stream<ReferenceValue> stream) { - final List<UUID> uuids = referenceValueRepository.storeAll(stream); - referenceValueRepository.updateConstraintForeignReferences(uuids); - } - }; - referenceImporter.doImport(file, fileId); + referenceService.addReference(app, refType, file, fileId); return fileId; } - private ReferenceImporterContext getReferenceImporterContext(Application app, String refType) { - ReferenceValueRepository referenceValueRepository = repo.getRepository(app).referenceValue(); - Configuration conf = app.getConfiguration(); - ImmutableSet<LineChecker> lineCheckers = checkerFactory.getReferenceValidationLineCheckers(app, refType); - final ImmutableMap<Ltree, UUID> storedReferences = referenceValueRepository.getReferenceIdPerKeys(refType); - - ImmutableMap<ReferenceColumn, Multiplicity> multiplicityPerColumns = lineCheckers.stream() - .filter(lineChecker -> lineChecker instanceof ReferenceLineChecker) - .map(lineChecker -> (ReferenceLineChecker) lineChecker) - .collect(ImmutableMap.toImmutableMap(referenceLineChecker -> (ReferenceColumn) referenceLineChecker.getTarget(), referenceLineChecker -> referenceLineChecker.getConfiguration().getMultiplicity())); - - Configuration.ReferenceDescription referenceDescription = conf.getReferences().get(refType); - - ImmutableSet<ReferenceImporterContext.Column> staticColumns = referenceDescription.getColumns().entrySet().stream() - .map(entry -> { - Configuration.ReferenceStaticNotComputedColumnDescription referenceStaticNotComputedColumnDescription = MoreObjects.firstNonNull(entry.getValue(), new Configuration.ReferenceStaticNotComputedColumnDescription()); - ReferenceColumn referenceColumn = new ReferenceColumn(entry.getKey()); - Multiplicity multiplicity = multiplicityPerColumns.getOrDefault(referenceColumn, Multiplicity.ONE); - ColumnPresenceConstraint presenceConstraint = referenceStaticNotComputedColumnDescription.getPresenceConstraint(); - ReferenceImporterContext.Column column; - if (multiplicity == Multiplicity.ONE) { - column = Optional.ofNullable(referenceStaticNotComputedColumnDescription.getDefaultValue()).map(defaultValueConfiguration -> { - Expression<String> computationExpression = StringGroovyExpression.forExpression(defaultValueConfiguration.getExpression()); - Set<String> configurationReferences = defaultValueConfiguration.getReferences(); - ImmutableMap<String, Object> contextForExpression = groovyContextHelper.getGroovyContextForReferences(referenceValueRepository, configurationReferences); - Preconditions.checkState(defaultValueConfiguration.getDatatypes().isEmpty(), "à ce stade, on ne gère pas la chargement de données"); - ReferenceImporterContext.Column oneValueStaticColumn = new ReferenceImporterContext.OneValueStaticColumn(referenceColumn, presenceConstraint) { - @Override - String getExpectedHeader() { - return referenceColumn.getColumn(); - } - - @Override - Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { - ImmutableMap<String, Object> evaluationContext = ImmutableMap.<String, Object>builder() - .putAll(contextForExpression) - .putAll(referenceDatum.getEvaluationContext()) - .build(); - String evaluate = computationExpression.evaluate(evaluationContext); - Optional<ReferenceColumnValue> computedValue = Optional.ofNullable(evaluate) - .filter(StringUtils::isNotEmpty) - .map(evaluationResult -> new ReferenceColumnSingleValue(evaluate)); - return computedValue; - } - - @Override - ComputedValueUsage getComputedValueUsage() { - return ComputedValueUsage.USE_COMPUTED_AS_DEFAULT_VALUE; - } - }; - return oneValueStaticColumn; - }).orElseGet(() -> new ReferenceImporterContext.OneValueStaticColumn(referenceColumn, presenceConstraint) { - @Override - String getExpectedHeader() { - return referenceColumn.getColumn(); - } - - @Override - Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { - throw new UnsupportedOperationException("pas de valeur par défaut pour " + referenceColumn); - } - - @Override - ComputedValueUsage getComputedValueUsage() { - return ComputedValueUsage.NOT_COMPUTED; - } - }); - } else if (multiplicity == Multiplicity.MANY) { - column = Optional.ofNullable(referenceStaticNotComputedColumnDescription.getDefaultValue()).map(defaultValueConfiguration -> { - Expression<Set<String>> computationExpression = StringSetGroovyExpression.forExpression(defaultValueConfiguration.getExpression()); - Set<String> configurationReferences = defaultValueConfiguration.getReferences(); - ImmutableMap<String, Object> contextForExpression = groovyContextHelper.getGroovyContextForReferences(referenceValueRepository, configurationReferences); - Preconditions.checkState(defaultValueConfiguration.getDatatypes().isEmpty(), "à ce stade, on ne gère pas la chargement de données"); - ReferenceImporterContext.Column manyValuesStaticColumn = new ReferenceImporterContext.ManyValuesStaticColumn(referenceColumn, presenceConstraint) { - @Override - String getExpectedHeader() { - return referenceColumn.getColumn(); - } - - @Override - Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { - ImmutableMap<String, Object> evaluationContext = ImmutableMap.<String, Object>builder() - .putAll(contextForExpression) - .putAll(referenceDatum.getEvaluationContext()) - .build(); - Set<String> evaluate = computationExpression.evaluate(evaluationContext); - Optional<ReferenceColumnValue> computedValue = Optional.ofNullable(evaluate) - .map(evaluationResult -> new ReferenceColumnMultipleValue(evaluate)); - return computedValue; - } - - @Override - ComputedValueUsage getComputedValueUsage() { - return ComputedValueUsage.USE_COMPUTED_AS_DEFAULT_VALUE; - } - }; - return manyValuesStaticColumn; - }).orElseGet(() -> new ReferenceImporterContext.ManyValuesStaticColumn(referenceColumn, presenceConstraint) { - @Override - String getExpectedHeader() { - return referenceColumn.getColumn(); - } - - @Override - Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { - throw new UnsupportedOperationException("pas de valeur par défaut pour " + referenceColumn); - } - - @Override - ComputedValueUsage getComputedValueUsage() { - return ComputedValueUsage.NOT_COMPUTED; - } - }); - } else { - throw new IllegalStateException("multiplicity = " + multiplicity); - } - return column; - }).collect(ImmutableSet.toImmutableSet()); - - ImmutableSet<ReferenceImporterContext.Column> computedColumns = referenceDescription.getComputedColumns().entrySet().stream() - .map(entry -> { - Configuration.ReferenceStaticComputedColumnDescription referenceStaticComputedColumnDescription = entry.getValue(); - Configuration.GroovyConfiguration computation = referenceStaticComputedColumnDescription.getComputation(); - ReferenceColumn referenceColumn = new ReferenceColumn(entry.getKey()); - Multiplicity multiplicity = multiplicityPerColumns.getOrDefault(referenceColumn, Multiplicity.ONE); - ColumnPresenceConstraint presenceConstraint = ColumnPresenceConstraint.ABSENT; - ReferenceImporterContext.Column column; - Set<String> configurationReferences = computation.getReferences(); - ImmutableMap<String, Object> contextForExpression = groovyContextHelper.getGroovyContextForReferences(referenceValueRepository, configurationReferences); - Preconditions.checkState(computation.getDatatypes().isEmpty(), "à ce stade, on ne gère pas la chargement de données"); - if (multiplicity == Multiplicity.ONE) { - Expression<String> computationExpression = StringGroovyExpression.forExpression(computation.getExpression()); - column = new ReferenceImporterContext.OneValueStaticColumn(referenceColumn, presenceConstraint) { - @Override - String getExpectedHeader() { - throw new UnsupportedOperationException("la colonne " + referenceColumn + " est calculée, il n'y a pas d'entête spécifié"); - } - - @Override - Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { - ImmutableMap<String, Object> evaluationContext = ImmutableMap.<String, Object>builder() - .putAll(contextForExpression) - .putAll(referenceDatum.getEvaluationContext()) - .build(); - String evaluate = computationExpression.evaluate(evaluationContext); - Optional<ReferenceColumnValue> computedValue = Optional.ofNullable(evaluate) - .filter(StringUtils::isNotEmpty) - .map(evaluationResult -> new ReferenceColumnSingleValue(evaluate)); - return computedValue; - } - - @Override - ComputedValueUsage getComputedValueUsage() { - return ComputedValueUsage.USE_COMPUTED_VALUE; - } - }; - } else if (multiplicity == Multiplicity.MANY) { - Expression<Set<String>> computationExpression = StringSetGroovyExpression.forExpression(computation.getExpression()); - column = new ReferenceImporterContext.ManyValuesStaticColumn(referenceColumn, presenceConstraint) { - @Override - String getExpectedHeader() { - throw new UnsupportedOperationException("la colonne " + referenceColumn + " est calculée, il n'y a pas d'entête spécifié car elle ne doit pas être dans le CSV"); - } - - @Override - Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { - ImmutableMap<String, Object> evaluationContext = ImmutableMap.<String, Object>builder() - .putAll(contextForExpression) - .putAll(referenceDatum.getEvaluationContext()) - .build(); - Set<String> evaluate = computationExpression.evaluate(evaluationContext); - Optional<ReferenceColumnValue> computedValue = Optional.ofNullable(evaluate) - .map(evaluationResult -> new ReferenceColumnMultipleValue(evaluate)); - return computedValue; - } - - @Override - ComputedValueUsage getComputedValueUsage() { - return ComputedValueUsage.USE_COMPUTED_VALUE; - } - }; - } else { - throw new IllegalStateException("multiplicity = " + multiplicity); - } - return column; - }).collect(ImmutableSet.toImmutableSet()); - - ImmutableSet<ReferenceImporterContext.Column> dynamicColumns = referenceDescription.getDynamicColumns().entrySet().stream() - .flatMap(entry -> { - ReferenceColumn referenceColumn = new ReferenceColumn(entry.getKey()); - Configuration.ReferenceDynamicColumnDescription value = entry.getValue(); - String reference = value.getReference(); - ReferenceColumn referenceColumnToLookForHeader = new ReferenceColumn(value.getReferenceColumnToLookForHeader()); - List<ReferenceValue> allByReferenceType = referenceValueRepository.findAllByReferenceType(reference); - Stream<ReferenceImporterContext.Column> valuedDynamicColumns = allByReferenceType.stream() - .map(referenceValue -> { - ReferenceDatum referenceDatum = referenceValue.getRefValues(); - Ltree hierarchicalKey = referenceValue.getHierarchicalKey(); - ReferenceColumnSingleValue referenceColumnValue = (ReferenceColumnSingleValue) referenceDatum.get(referenceColumnToLookForHeader); - String header = referenceColumnValue.getValue(); - String fullHeader = value.getHeaderPrefix() + header; - ColumnPresenceConstraint presenceConstraint = value.getPresenceConstraint(); - return new ReferenceImporterContext.DynamicColumn( - referenceColumn, - presenceConstraint, - hierarchicalKey, - Map.entry(reference, referenceValue.getId()) - ) { - @Override - String getExpectedHeader() { - return fullHeader; - } - - @Override - Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { - throw new UnsupportedOperationException("pas de valeur calculable pour " + referenceColumn); - } - - @Override - ComputedValueUsage getComputedValueUsage() { - return ComputedValueUsage.NOT_COMPUTED; - } - }; - }); - return valuedDynamicColumns; - }).collect(ImmutableSet.toImmutableSet()); - - ImmutableSet<ReferenceImporterContext.Column> columns = ImmutableSet.<ReferenceImporterContext.Column>builder() - .addAll(staticColumns) - .addAll(computedColumns) - .addAll(dynamicColumns) - .build(); - - final ReferenceImporterContext.Constants constants = new ReferenceImporterContext.Constants( - app.getId(), - conf, - refType, - repo.getRepository(app).referenceValue()); - /* final Set<Object> patternColumns = constants.getPatternColumns() - .map(pt -> pt.values()) - .flatMap(Collection::stream) - .stream().collect(Collectors.toSet());*/ - Set<String> patternColumns = constants.getPatternColumns() - .map(m->m.values().stream().flatMap(List::stream).collect(Collectors.toSet())) - .orElseGet(HashSet::new); - final Map<String, String> referenceToColumnName = lineCheckers.stream() - .filter(ReferenceLineChecker.class::isInstance) - .map(ReferenceLineChecker.class::cast) - .collect(Collectors.toMap(ReferenceLineChecker::getRefType, referenceLineChecker -> ((ReferenceColumn) referenceLineChecker.getTarget()).getColumn())); - final Map<String, Map<String, Map<String, String>>> displayByReferenceAndNaturalKey = - lineCheckers.stream() - .filter(ReferenceLineChecker.class::isInstance) - .map(ReferenceLineChecker.class::cast) - .map(ReferenceLineChecker::getRefType) - .filter(rt -> patternColumns.contains(rt)) - .collect(Collectors.toMap(ref -> referenceToColumnName.getOrDefault(ref, ref), ref -> repo.getRepository(app).referenceValue().findDisplayByNaturalKey(ref))); - final ReferenceImporterContext referenceImporterContext = - new ReferenceImporterContext( - constants, - lineCheckers, - storedReferences, - columns, - displayByReferenceAndNaturalKey - ); - return referenceImporterContext; - } - HierarchicalReferenceAsTree getHierarchicalReferenceAsTree(Application application, String lowestLevelReference) { ReferenceValueRepository referenceValueRepository = repo.getRepository(application).referenceValue(); Configuration.CompositeReferenceDescription compositeReferenceDescription = application @@ -1516,50 +1233,12 @@ public class OreSiService { return repo.application().tryFindApplication(nameOrId); } - /** - * @param nameOrId l'id de l'application - * @param refType le type du referenciel - * @param params les parametres query de la requete http. 'ANY' est utiliser pour dire n'importe quelle colonne - * @return la liste qui satisfont aux criteres - */ public List<ReferenceValue> findReference(String nameOrId, String refType, MultiValueMap<String, String> params) { - authenticationService.setRoleForClient(); - List<ReferenceValue> list = repo.getRepository(nameOrId).referenceValue().findAllByReferenceType(refType, params); - return list; + return referenceService.findReference(nameOrId, refType, params); } public String getReferenceValuesCsv(String applicationNameOrId, String referenceType, MultiValueMap<String, String> params) { - Application application = getApplication(applicationNameOrId); - ReferenceImporterContext referenceImporterContext = getReferenceImporterContext(application, referenceType); - ReferenceValueRepository referenceValueRepository = repo.getRepository(applicationNameOrId).referenceValue(); - Stream<ImmutableList<String>> recordsStream = referenceValueRepository.findAllByReferenceType(referenceType, params).stream() - .map(ReferenceValue::getRefValues) - .map(referenceDatum -> { - ImmutableList<String> rowAsRecord = referenceImporterContext.getExpectedHeaders().stream() - .map(header -> referenceImporterContext.getCsvCellContent(referenceDatum, header)) - .collect(ImmutableList.toImmutableList()); - return rowAsRecord; - }); - ImmutableSet<String> headers = referenceImporterContext.getExpectedHeaders(); - CSVFormat csvFormat = CSVFormat.DEFAULT - .withDelimiter(referenceImporterContext.getCsvSeparator()) - .withSkipHeaderRecord(); - StringWriter out = new StringWriter(); - try { - CSVPrinter csvPrinter = new CSVPrinter(out, csvFormat); - csvPrinter.printRecord(headers); - recordsStream.forEach(record -> { - try { - csvPrinter.printRecord(record); - } catch (IOException e) { - throw new OreSiTechnicalException("erreur lors de la génération du fichier CSV", e); - } - }); - } catch (IOException e) { - throw new OreSiTechnicalException("erreur lors de la génération du fichier CSV", e); - } - String csv = out.toString(); - return csv; + return referenceService.getReferenceValuesCsv(applicationNameOrId, referenceType, params); } public Optional<BinaryFile> getFile(String name, UUID id) { diff --git a/src/main/java/fr/inra/oresing/rest/ReferenceImporterContext.java b/src/main/java/fr/inra/oresing/rest/ReferenceImporterContext.java index d72493017..7be81fc9a 100644 --- a/src/main/java/fr/inra/oresing/rest/ReferenceImporterContext.java +++ b/src/main/java/fr/inra/oresing/rest/ReferenceImporterContext.java @@ -425,9 +425,12 @@ public class ReferenceImporterContext { private final ColumnPresenceConstraint presenceConstraint; - public Column(ReferenceColumn referenceColumn, ColumnPresenceConstraint presenceConstraint) { + private final ComputedValueUsage computedValueUsage; + + public Column(ReferenceColumn referenceColumn, ColumnPresenceConstraint presenceConstraint, ComputedValueUsage computedValueUsage) { this.referenceColumn = referenceColumn; this.presenceConstraint = presenceConstraint; + this.computedValueUsage = computedValueUsage; } public boolean canHandle(String header) { @@ -458,13 +461,15 @@ public class ReferenceImporterContext { abstract Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum); - abstract ComputedValueUsage getComputedValueUsage(); + public ComputedValueUsage getComputedValueUsage() { + return computedValueUsage; + } } public static abstract class OneValueStaticColumn extends Column { - public OneValueStaticColumn(ReferenceColumn referenceColumn, ColumnPresenceConstraint presenceConstraint) { - super(referenceColumn, presenceConstraint); + public OneValueStaticColumn(ReferenceColumn referenceColumn, ColumnPresenceConstraint presenceConstraint, ComputedValueUsage computedValueUsage) { + super(referenceColumn, presenceConstraint, computedValueUsage); } @Override @@ -484,8 +489,8 @@ public class ReferenceImporterContext { private static final String CSV_CELL_SEPARATOR = ","; - public ManyValuesStaticColumn(ReferenceColumn referenceColumn, ColumnPresenceConstraint presenceConstraint) { - super(referenceColumn, presenceConstraint); + public ManyValuesStaticColumn(ReferenceColumn referenceColumn, ColumnPresenceConstraint presenceConstraint, ComputedValueUsage computedValueUsage) { + super(referenceColumn, presenceConstraint, computedValueUsage); } @Override @@ -519,8 +524,8 @@ public class ReferenceImporterContext { */ private final Map.Entry<String, UUID> refsLinkedToEntryToAdd; - public DynamicColumn(ReferenceColumn referenceColumn, ColumnPresenceConstraint presenceConstraint, Ltree expectedHierarchicalKey, Map.Entry<String, UUID> refsLinkedToEntryToAdd) { - super(referenceColumn, presenceConstraint); + public DynamicColumn(ReferenceColumn referenceColumn, ColumnPresenceConstraint presenceConstraint, Ltree expectedHierarchicalKey, Map.Entry<String, UUID> refsLinkedToEntryToAdd, ComputedValueUsage computedValueUsage) { + super(referenceColumn, presenceConstraint, computedValueUsage); this.expectedHierarchicalKey = expectedHierarchicalKey; this.refsLinkedToEntryToAdd = refsLinkedToEntryToAdd; } diff --git a/src/main/java/fr/inra/oresing/rest/ReferenceService.java b/src/main/java/fr/inra/oresing/rest/ReferenceService.java new file mode 100644 index 000000000..161fbe5ac --- /dev/null +++ b/src/main/java/fr/inra/oresing/rest/ReferenceService.java @@ -0,0 +1,378 @@ +package fr.inra.oresing.rest; + +import com.google.common.base.MoreObjects; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import fr.inra.oresing.OreSiTechnicalException; +import fr.inra.oresing.checker.CheckerFactory; +import fr.inra.oresing.checker.LineChecker; +import fr.inra.oresing.checker.Multiplicity; +import fr.inra.oresing.checker.ReferenceLineChecker; +import fr.inra.oresing.groovy.Expression; +import fr.inra.oresing.groovy.GroovyContextHelper; +import fr.inra.oresing.groovy.StringGroovyExpression; +import fr.inra.oresing.groovy.StringSetGroovyExpression; +import fr.inra.oresing.model.Application; +import fr.inra.oresing.model.ColumnPresenceConstraint; +import fr.inra.oresing.model.ComputedValueUsage; +import fr.inra.oresing.model.Configuration; +import fr.inra.oresing.model.ReferenceColumn; +import fr.inra.oresing.model.ReferenceColumnMultipleValue; +import fr.inra.oresing.model.ReferenceColumnSingleValue; +import fr.inra.oresing.model.ReferenceColumnValue; +import fr.inra.oresing.model.ReferenceDatum; +import fr.inra.oresing.model.ReferenceValue; +import fr.inra.oresing.persistence.AuthenticationService; +import fr.inra.oresing.persistence.Ltree; +import fr.inra.oresing.persistence.OreSiRepository; +import fr.inra.oresing.persistence.ReferenceValueRepository; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.csv.CSVFormat; +import org.apache.commons.csv.CSVPrinter; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.MultiValueMap; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.io.StringWriter; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +@Slf4j +@Component +@Transactional +public class ReferenceService { + + @Autowired + private AuthenticationService authenticationService; + + @Autowired + private GroovyContextHelper groovyContextHelper; + + @Autowired + private CheckerFactory checkerFactory; + + @Autowired + private OreSiRepository repo; + + void addReference(Application app, String refType, MultipartFile file, UUID fileId) throws IOException { + ReferenceValueRepository referenceValueRepository = repo.getRepository(app).referenceValue(); + final ReferenceImporterContext referenceImporterContext = getReferenceImporterContext(app, refType); + ReferenceImporter referenceImporter = new ReferenceImporter(referenceImporterContext) { + @Override + void storeAll(Stream<ReferenceValue> stream) { + final List<UUID> uuids = referenceValueRepository.storeAll(stream); + referenceValueRepository.updateConstraintForeignReferences(uuids); + } + }; + referenceImporter.doImport(file, fileId); + } + + private ReferenceImporterContext getReferenceImporterContext(Application app, String refType) { + ReferenceValueRepository referenceValueRepository = repo.getRepository(app).referenceValue(); + Configuration conf = app.getConfiguration(); + ImmutableSet<LineChecker> lineCheckers = checkerFactory.getReferenceValidationLineCheckers(app, refType); + final ImmutableMap<Ltree, UUID> storedReferences = referenceValueRepository.getReferenceIdPerKeys(refType); + + ImmutableMap<ReferenceColumn, Multiplicity> multiplicityPerColumns = lineCheckers.stream() + .filter(lineChecker -> lineChecker instanceof ReferenceLineChecker) + .map(lineChecker -> (ReferenceLineChecker) lineChecker) + .collect(ImmutableMap.toImmutableMap(referenceLineChecker -> (ReferenceColumn) referenceLineChecker.getTarget(), referenceLineChecker -> referenceLineChecker.getConfiguration().getMultiplicity())); + + Configuration.ReferenceDescription referenceDescription = conf.getReferences().get(refType); + + ImmutableSet<ReferenceImporterContext.Column> staticColumns = referenceDescription.getColumns().entrySet().stream() + .map(entry -> { + ReferenceColumn referenceColumn = new ReferenceColumn(entry.getKey()); + Multiplicity multiplicity = multiplicityPerColumns.getOrDefault(referenceColumn, Multiplicity.ONE); + Configuration.ReferenceStaticNotComputedColumnDescription referenceStaticNotComputedColumnDescription = MoreObjects.firstNonNull(entry.getValue(), new Configuration.ReferenceStaticNotComputedColumnDescription()); + return staticColumnDescriptionToColumn(referenceValueRepository, referenceColumn, multiplicity, referenceStaticNotComputedColumnDescription); + }).collect(ImmutableSet.toImmutableSet()); + + ImmutableSet<ReferenceImporterContext.Column> computedColumns = referenceDescription.getComputedColumns().entrySet().stream() + .map(entry -> { + ReferenceColumn referenceColumn = new ReferenceColumn(entry.getKey()); + Configuration.ReferenceStaticComputedColumnDescription referenceStaticComputedColumnDescription = entry.getValue(); + Multiplicity multiplicity = multiplicityPerColumns.getOrDefault(referenceColumn, Multiplicity.ONE); + return computedColumnDescriptionToColumn(referenceValueRepository, referenceColumn, referenceStaticComputedColumnDescription, multiplicity); + }).collect(ImmutableSet.toImmutableSet()); + + ImmutableSet<ReferenceImporterContext.Column> dynamicColumns = referenceDescription.getDynamicColumns().entrySet().stream() + .flatMap(entry -> { + ReferenceColumn referenceColumn = new ReferenceColumn(entry.getKey()); + Configuration.ReferenceDynamicColumnDescription referenceDynamicColumnDescription = entry.getValue(); + ImmutableSet<ReferenceImporterContext.Column> valuedDynamicColumns = dynamicColumnDescriptionToColumns(referenceValueRepository, referenceColumn, referenceDynamicColumnDescription); + return valuedDynamicColumns.stream(); + }).collect(ImmutableSet.toImmutableSet()); + + ImmutableSet<ReferenceImporterContext.Column> columns = ImmutableSet.<ReferenceImporterContext.Column>builder() + .addAll(staticColumns) + .addAll(computedColumns) + .addAll(dynamicColumns) + .build(); + + final ReferenceImporterContext.Constants constants = new ReferenceImporterContext.Constants( + app.getId(), + conf, + refType, + repo.getRepository(app).referenceValue()); + /* final Set<Object> patternColumns = constants.getPatternColumns() + .map(pt -> pt.values()) + .flatMap(Collection::stream) + .stream().collect(Collectors.toSet());*/ + Set<String> patternColumns = constants.getPatternColumns() + .map(m->m.values().stream().flatMap(List::stream).collect(Collectors.toSet())) + .orElseGet(HashSet::new); + final Map<String, String> referenceToColumnName = lineCheckers.stream() + .filter(ReferenceLineChecker.class::isInstance) + .map(ReferenceLineChecker.class::cast) + .collect(Collectors.toMap(ReferenceLineChecker::getRefType, referenceLineChecker -> ((ReferenceColumn) referenceLineChecker.getTarget()).getColumn())); + final Map<String, Map<String, Map<String, String>>> displayByReferenceAndNaturalKey = + lineCheckers.stream() + .filter(ReferenceLineChecker.class::isInstance) + .map(ReferenceLineChecker.class::cast) + .map(ReferenceLineChecker::getRefType) + .filter(rt -> patternColumns.contains(rt)) + .collect(Collectors.toMap(ref -> referenceToColumnName.getOrDefault(ref, ref), ref -> repo.getRepository(app).referenceValue().findDisplayByNaturalKey(ref))); + final ReferenceImporterContext referenceImporterContext = + new ReferenceImporterContext( + constants, + lineCheckers, + storedReferences, + columns, + displayByReferenceAndNaturalKey + ); + return referenceImporterContext; + } + + private ImmutableSet<ReferenceImporterContext.Column> dynamicColumnDescriptionToColumns(ReferenceValueRepository referenceValueRepository, ReferenceColumn referenceColumn, Configuration.ReferenceDynamicColumnDescription referenceDynamicColumnDescription) { + String reference = referenceDynamicColumnDescription.getReference(); + ReferenceColumn referenceColumnToLookForHeader = new ReferenceColumn(referenceDynamicColumnDescription.getReferenceColumnToLookForHeader()); + List<ReferenceValue> allByReferenceType = referenceValueRepository.findAllByReferenceType(reference); + ImmutableSet<ReferenceImporterContext.Column> valuedDynamicColumns = allByReferenceType.stream() + .map(referenceValue -> { + ReferenceDatum referenceDatum = referenceValue.getRefValues(); + Ltree hierarchicalKey = referenceValue.getHierarchicalKey(); + ReferenceColumnSingleValue referenceColumnValue = (ReferenceColumnSingleValue) referenceDatum.get(referenceColumnToLookForHeader); + String header = referenceColumnValue.getValue(); + String fullHeader = referenceDynamicColumnDescription.getHeaderPrefix() + header; + ColumnPresenceConstraint presenceConstraint = referenceDynamicColumnDescription.getPresenceConstraint(); + return new ReferenceImporterContext.DynamicColumn( + referenceColumn, + presenceConstraint, + hierarchicalKey, + Map.entry(reference, referenceValue.getId()), + ComputedValueUsage.NOT_COMPUTED + ) { + @Override + String getExpectedHeader() { + return fullHeader; + } + + @Override + Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { + throw new UnsupportedOperationException("pas de valeur calculable pour " + referenceColumn); + } + }; + }).collect(ImmutableSet.toImmutableSet()); + return valuedDynamicColumns; + } + + private ReferenceImporterContext.Column staticColumnDescriptionToColumn(ReferenceValueRepository referenceValueRepository, ReferenceColumn referenceColumn, Multiplicity multiplicity, Configuration.ReferenceStaticNotComputedColumnDescription referenceStaticNotComputedColumnDescription) { + ColumnPresenceConstraint presenceConstraint = referenceStaticNotComputedColumnDescription.getPresenceConstraint(); + ReferenceImporterContext.Column column; + if (multiplicity == Multiplicity.ONE) { + column = Optional.ofNullable(referenceStaticNotComputedColumnDescription.getDefaultValue()).map(defaultValueConfiguration -> { + Expression<String> computationExpression = StringGroovyExpression.forExpression(defaultValueConfiguration.getExpression()); + Set<String> configurationReferences = defaultValueConfiguration.getReferences(); + ImmutableMap<String, Object> contextForExpression = groovyContextHelper.getGroovyContextForReferences(referenceValueRepository, configurationReferences); + Preconditions.checkState(defaultValueConfiguration.getDatatypes().isEmpty(), "à ce stade, on ne gère pas la chargement de données"); + ReferenceImporterContext.Column oneValueStaticColumn = new ReferenceImporterContext.OneValueStaticColumn(referenceColumn, presenceConstraint, ComputedValueUsage.USE_COMPUTED_AS_DEFAULT_VALUE) { + @Override + String getExpectedHeader() { + return referenceColumn.getColumn(); + } + + @Override + Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { + ImmutableMap<String, Object> evaluationContext = ImmutableMap.<String, Object>builder() + .putAll(contextForExpression) + .putAll(referenceDatum.getEvaluationContext()) + .build(); + String evaluate = computationExpression.evaluate(evaluationContext); + Optional<ReferenceColumnValue> computedValue = Optional.ofNullable(evaluate) + .filter(StringUtils::isNotEmpty) + .map(ReferenceColumnSingleValue::new); + return computedValue; + } + }; + return oneValueStaticColumn; + }).orElseGet(() -> new ReferenceImporterContext.OneValueStaticColumn(referenceColumn, presenceConstraint, ComputedValueUsage.NOT_COMPUTED) { + @Override + String getExpectedHeader() { + return referenceColumn.getColumn(); + } + + @Override + Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { + throw new UnsupportedOperationException("pas de valeur par défaut pour " + referenceColumn); + } + }); + } else if (multiplicity == Multiplicity.MANY) { + column = Optional.ofNullable(referenceStaticNotComputedColumnDescription.getDefaultValue()).map(defaultValueConfiguration -> { + Expression<Set<String>> computationExpression = StringSetGroovyExpression.forExpression(defaultValueConfiguration.getExpression()); + Set<String> configurationReferences = defaultValueConfiguration.getReferences(); + ImmutableMap<String, Object> contextForExpression = groovyContextHelper.getGroovyContextForReferences(referenceValueRepository, configurationReferences); + Preconditions.checkState(defaultValueConfiguration.getDatatypes().isEmpty(), "à ce stade, on ne gère pas la chargement de données"); + ReferenceImporterContext.Column manyValuesStaticColumn = new ReferenceImporterContext.ManyValuesStaticColumn(referenceColumn, presenceConstraint, ComputedValueUsage.USE_COMPUTED_AS_DEFAULT_VALUE) { + @Override + String getExpectedHeader() { + return referenceColumn.getColumn(); + } + + @Override + Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { + ImmutableMap<String, Object> evaluationContext = ImmutableMap.<String, Object>builder() + .putAll(contextForExpression) + .putAll(referenceDatum.getEvaluationContext()) + .build(); + Set<String> evaluate = computationExpression.evaluate(evaluationContext); + Optional<ReferenceColumnValue> computedValue = Optional.ofNullable(evaluate) + .map(ReferenceColumnMultipleValue::new); + return computedValue; + } + }; + return manyValuesStaticColumn; + }).orElseGet(() -> new ReferenceImporterContext.ManyValuesStaticColumn(referenceColumn, presenceConstraint, ComputedValueUsage.NOT_COMPUTED) { + @Override + String getExpectedHeader() { + return referenceColumn.getColumn(); + } + + @Override + Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { + throw new UnsupportedOperationException("pas de valeur par défaut pour " + referenceColumn); + } + }); + } else { + throw new IllegalStateException("multiplicity = " + multiplicity); + } + return column; + } + + private ReferenceImporterContext.Column computedColumnDescriptionToColumn(ReferenceValueRepository referenceValueRepository, ReferenceColumn referenceColumn, Configuration.ReferenceStaticComputedColumnDescription referenceStaticComputedColumnDescription, Multiplicity multiplicity) { + Configuration.GroovyConfiguration computation = referenceStaticComputedColumnDescription.getComputation(); + ColumnPresenceConstraint presenceConstraint = ColumnPresenceConstraint.ABSENT; + ReferenceImporterContext.Column column; + Set<String> configurationReferences = computation.getReferences(); + ImmutableMap<String, Object> contextForExpression = groovyContextHelper.getGroovyContextForReferences(referenceValueRepository, configurationReferences); + Preconditions.checkState(computation.getDatatypes().isEmpty(), "à ce stade, on ne gère pas la chargement de données"); + if (multiplicity == Multiplicity.ONE) { + Expression<String> computationExpression = StringGroovyExpression.forExpression(computation.getExpression()); + column = new ReferenceImporterContext.OneValueStaticColumn(referenceColumn, presenceConstraint, ComputedValueUsage.USE_COMPUTED_VALUE) { + @Override + String getExpectedHeader() { + throw new UnsupportedOperationException("la colonne " + referenceColumn + " est calculée, il n'y a pas d'entête spécifié"); + } + + @Override + Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { + ImmutableMap<String, Object> evaluationContext = ImmutableMap.<String, Object>builder() + .putAll(contextForExpression) + .putAll(referenceDatum.getEvaluationContext()) + .build(); + String evaluate = computationExpression.evaluate(evaluationContext); + Optional<ReferenceColumnValue> computedValue = Optional.ofNullable(evaluate) + .filter(StringUtils::isNotEmpty) + .map(ReferenceColumnSingleValue::new); + return computedValue; + } + }; + } else if (multiplicity == Multiplicity.MANY) { + Expression<Set<String>> computationExpression = StringSetGroovyExpression.forExpression(computation.getExpression()); + column = new ReferenceImporterContext.ManyValuesStaticColumn(referenceColumn, presenceConstraint, ComputedValueUsage.USE_COMPUTED_VALUE) { + @Override + String getExpectedHeader() { + throw new UnsupportedOperationException("la colonne " + referenceColumn + " est calculée, il n'y a pas d'entête spécifié car elle ne doit pas être dans le CSV"); + } + + @Override + Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { + ImmutableMap<String, Object> evaluationContext = ImmutableMap.<String, Object>builder() + .putAll(contextForExpression) + .putAll(referenceDatum.getEvaluationContext()) + .build(); + Set<String> evaluate = computationExpression.evaluate(evaluationContext); + Optional<ReferenceColumnValue> computedValue = Optional.ofNullable(evaluate) + .map(ReferenceColumnMultipleValue::new); + return computedValue; + } + }; + } else { + throw new IllegalStateException("multiplicity = " + multiplicity); + } + return column; + } + + /** + * @param nameOrId l'id de l'application + * @param refType le type du referenciel + * @param params les parametres query de la requete http. 'ANY' est utiliser pour dire n'importe quelle colonne + * @return la liste qui satisfont aux criteres + */ + List<ReferenceValue> findReference(String nameOrId, String refType, MultiValueMap<String, String> params) { + authenticationService.setRoleForClient(); + List<ReferenceValue> list = repo.getRepository(nameOrId).referenceValue().findAllByReferenceType(refType, params); + return list; + } + + String getReferenceValuesCsv(String applicationNameOrId, String referenceType, MultiValueMap<String, String> params) { + Application application = getApplication(applicationNameOrId); + ReferenceImporterContext referenceImporterContext = getReferenceImporterContext(application, referenceType); + ReferenceValueRepository referenceValueRepository = repo.getRepository(applicationNameOrId).referenceValue(); + Stream<ImmutableList<String>> recordsStream = referenceValueRepository.findAllByReferenceType(referenceType, params).stream() + .map(ReferenceValue::getRefValues) + .map(referenceDatum -> { + ImmutableList<String> rowAsRecord = referenceImporterContext.getExpectedHeaders().stream() + .map(header -> referenceImporterContext.getCsvCellContent(referenceDatum, header)) + .collect(ImmutableList.toImmutableList()); + return rowAsRecord; + }); + ImmutableSet<String> headers = referenceImporterContext.getExpectedHeaders(); + CSVFormat csvFormat = CSVFormat.DEFAULT + .withDelimiter(referenceImporterContext.getCsvSeparator()) + .withSkipHeaderRecord(); + StringWriter out = new StringWriter(); + try { + CSVPrinter csvPrinter = new CSVPrinter(out, csvFormat); + csvPrinter.printRecord(headers); + recordsStream.forEach(record -> { + try { + csvPrinter.printRecord(record); + } catch (IOException e) { + throw new OreSiTechnicalException("erreur lors de la génération du fichier CSV", e); + } + }); + } catch (IOException e) { + throw new OreSiTechnicalException("erreur lors de la génération du fichier CSV", e); + } + String csv = out.toString(); + return csv; + } + + private Application getApplication(String nameOrId) { + authenticationService.setRoleForClient(); + return repo.application().findApplication(nameOrId); + } +} \ No newline at end of file -- GitLab From 147246f3342c7d01d9b1c6e546a38a15b23fbaaf Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Wed, 30 Mar 2022 11:14:23 +0200 Subject: [PATCH 25/41] Clarifie le code dans ReferenceService --- .../inra/oresing/rest/ReferenceService.java | 157 ++++++++++-------- 1 file changed, 88 insertions(+), 69 deletions(-) diff --git a/src/main/java/fr/inra/oresing/rest/ReferenceService.java b/src/main/java/fr/inra/oresing/rest/ReferenceService.java index 161fbe5ac..45ce46672 100644 --- a/src/main/java/fr/inra/oresing/rest/ReferenceService.java +++ b/src/main/java/fr/inra/oresing/rest/ReferenceService.java @@ -18,6 +18,7 @@ import fr.inra.oresing.model.Application; import fr.inra.oresing.model.ColumnPresenceConstraint; import fr.inra.oresing.model.ComputedValueUsage; import fr.inra.oresing.model.Configuration; +import fr.inra.oresing.model.GroovyDataInjectionConfiguration; import fr.inra.oresing.model.ReferenceColumn; import fr.inra.oresing.model.ReferenceColumnMultipleValue; import fr.inra.oresing.model.ReferenceColumnSingleValue; @@ -97,7 +98,11 @@ public class ReferenceService { ReferenceColumn referenceColumn = new ReferenceColumn(entry.getKey()); Multiplicity multiplicity = multiplicityPerColumns.getOrDefault(referenceColumn, Multiplicity.ONE); Configuration.ReferenceStaticNotComputedColumnDescription referenceStaticNotComputedColumnDescription = MoreObjects.firstNonNull(entry.getValue(), new Configuration.ReferenceStaticNotComputedColumnDescription()); - return staticColumnDescriptionToColumn(referenceValueRepository, referenceColumn, multiplicity, referenceStaticNotComputedColumnDescription); + ColumnPresenceConstraint presenceConstraint = referenceStaticNotComputedColumnDescription.getPresenceConstraint(); + ReferenceImporterContext.Column column = Optional.ofNullable(referenceStaticNotComputedColumnDescription.getDefaultValue()) + .map(defaultValueConfiguration -> staticColumnDescriptionToColumn(referenceColumn, presenceConstraint, multiplicity, referenceValueRepository, defaultValueConfiguration)) + .orElseGet(() -> staticColumnDescriptionToColumn(referenceColumn, presenceConstraint, multiplicity)); + return column; }).collect(ImmutableSet.toImmutableSet()); ImmutableSet<ReferenceImporterContext.Column> computedColumns = referenceDescription.getComputedColumns().entrySet().stream() @@ -105,7 +110,7 @@ public class ReferenceService { ReferenceColumn referenceColumn = new ReferenceColumn(entry.getKey()); Configuration.ReferenceStaticComputedColumnDescription referenceStaticComputedColumnDescription = entry.getValue(); Multiplicity multiplicity = multiplicityPerColumns.getOrDefault(referenceColumn, Multiplicity.ONE); - return computedColumnDescriptionToColumn(referenceValueRepository, referenceColumn, referenceStaticComputedColumnDescription, multiplicity); + return computedColumnDescriptionToColumn(referenceValueRepository, referenceColumn, multiplicity, referenceStaticComputedColumnDescription); }).collect(ImmutableSet.toImmutableSet()); ImmutableSet<ReferenceImporterContext.Column> dynamicColumns = referenceDescription.getDynamicColumns().entrySet().stream() @@ -189,36 +194,10 @@ public class ReferenceService { return valuedDynamicColumns; } - private ReferenceImporterContext.Column staticColumnDescriptionToColumn(ReferenceValueRepository referenceValueRepository, ReferenceColumn referenceColumn, Multiplicity multiplicity, Configuration.ReferenceStaticNotComputedColumnDescription referenceStaticNotComputedColumnDescription) { - ColumnPresenceConstraint presenceConstraint = referenceStaticNotComputedColumnDescription.getPresenceConstraint(); + private ReferenceImporterContext.Column staticColumnDescriptionToColumn(ReferenceColumn referenceColumn, ColumnPresenceConstraint presenceConstraint, Multiplicity multiplicity) { ReferenceImporterContext.Column column; if (multiplicity == Multiplicity.ONE) { - column = Optional.ofNullable(referenceStaticNotComputedColumnDescription.getDefaultValue()).map(defaultValueConfiguration -> { - Expression<String> computationExpression = StringGroovyExpression.forExpression(defaultValueConfiguration.getExpression()); - Set<String> configurationReferences = defaultValueConfiguration.getReferences(); - ImmutableMap<String, Object> contextForExpression = groovyContextHelper.getGroovyContextForReferences(referenceValueRepository, configurationReferences); - Preconditions.checkState(defaultValueConfiguration.getDatatypes().isEmpty(), "à ce stade, on ne gère pas la chargement de données"); - ReferenceImporterContext.Column oneValueStaticColumn = new ReferenceImporterContext.OneValueStaticColumn(referenceColumn, presenceConstraint, ComputedValueUsage.USE_COMPUTED_AS_DEFAULT_VALUE) { - @Override - String getExpectedHeader() { - return referenceColumn.getColumn(); - } - - @Override - Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { - ImmutableMap<String, Object> evaluationContext = ImmutableMap.<String, Object>builder() - .putAll(contextForExpression) - .putAll(referenceDatum.getEvaluationContext()) - .build(); - String evaluate = computationExpression.evaluate(evaluationContext); - Optional<ReferenceColumnValue> computedValue = Optional.ofNullable(evaluate) - .filter(StringUtils::isNotEmpty) - .map(ReferenceColumnSingleValue::new); - return computedValue; - } - }; - return oneValueStaticColumn; - }).orElseGet(() -> new ReferenceImporterContext.OneValueStaticColumn(referenceColumn, presenceConstraint, ComputedValueUsage.NOT_COMPUTED) { + column = new ReferenceImporterContext.OneValueStaticColumn(referenceColumn, presenceConstraint, ComputedValueUsage.NOT_COMPUTED) { @Override String getExpectedHeader() { return referenceColumn.getColumn(); @@ -228,33 +207,9 @@ public class ReferenceService { Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { throw new UnsupportedOperationException("pas de valeur par défaut pour " + referenceColumn); } - }); + }; } else if (multiplicity == Multiplicity.MANY) { - column = Optional.ofNullable(referenceStaticNotComputedColumnDescription.getDefaultValue()).map(defaultValueConfiguration -> { - Expression<Set<String>> computationExpression = StringSetGroovyExpression.forExpression(defaultValueConfiguration.getExpression()); - Set<String> configurationReferences = defaultValueConfiguration.getReferences(); - ImmutableMap<String, Object> contextForExpression = groovyContextHelper.getGroovyContextForReferences(referenceValueRepository, configurationReferences); - Preconditions.checkState(defaultValueConfiguration.getDatatypes().isEmpty(), "à ce stade, on ne gère pas la chargement de données"); - ReferenceImporterContext.Column manyValuesStaticColumn = new ReferenceImporterContext.ManyValuesStaticColumn(referenceColumn, presenceConstraint, ComputedValueUsage.USE_COMPUTED_AS_DEFAULT_VALUE) { - @Override - String getExpectedHeader() { - return referenceColumn.getColumn(); - } - - @Override - Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { - ImmutableMap<String, Object> evaluationContext = ImmutableMap.<String, Object>builder() - .putAll(contextForExpression) - .putAll(referenceDatum.getEvaluationContext()) - .build(); - Set<String> evaluate = computationExpression.evaluate(evaluationContext); - Optional<ReferenceColumnValue> computedValue = Optional.ofNullable(evaluate) - .map(ReferenceColumnMultipleValue::new); - return computedValue; - } - }; - return manyValuesStaticColumn; - }).orElseGet(() -> new ReferenceImporterContext.ManyValuesStaticColumn(referenceColumn, presenceConstraint, ComputedValueUsage.NOT_COMPUTED) { + column = new ReferenceImporterContext.ManyValuesStaticColumn(referenceColumn, presenceConstraint, ComputedValueUsage.NOT_COMPUTED) { @Override String getExpectedHeader() { return referenceColumn.getColumn(); @@ -264,26 +219,22 @@ public class ReferenceService { Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { throw new UnsupportedOperationException("pas de valeur par défaut pour " + referenceColumn); } - }); + }; } else { throw new IllegalStateException("multiplicity = " + multiplicity); } return column; } - private ReferenceImporterContext.Column computedColumnDescriptionToColumn(ReferenceValueRepository referenceValueRepository, ReferenceColumn referenceColumn, Configuration.ReferenceStaticComputedColumnDescription referenceStaticComputedColumnDescription, Multiplicity multiplicity) { - Configuration.GroovyConfiguration computation = referenceStaticComputedColumnDescription.getComputation(); - ColumnPresenceConstraint presenceConstraint = ColumnPresenceConstraint.ABSENT; + private ReferenceImporterContext.Column staticColumnDescriptionToColumn(ReferenceColumn referenceColumn, ColumnPresenceConstraint presenceConstraint, Multiplicity multiplicity, ReferenceValueRepository referenceValueRepository, Configuration.GroovyConfiguration defaultValueConfiguration) { + ImmutableMap<String, Object> contextForExpression = computeGroovyContext(referenceValueRepository, defaultValueConfiguration); ReferenceImporterContext.Column column; - Set<String> configurationReferences = computation.getReferences(); - ImmutableMap<String, Object> contextForExpression = groovyContextHelper.getGroovyContextForReferences(referenceValueRepository, configurationReferences); - Preconditions.checkState(computation.getDatatypes().isEmpty(), "à ce stade, on ne gère pas la chargement de données"); if (multiplicity == Multiplicity.ONE) { - Expression<String> computationExpression = StringGroovyExpression.forExpression(computation.getExpression()); - column = new ReferenceImporterContext.OneValueStaticColumn(referenceColumn, presenceConstraint, ComputedValueUsage.USE_COMPUTED_VALUE) { + Expression<String> computationExpression = StringGroovyExpression.forExpression(defaultValueConfiguration.getExpression()); + column = new ReferenceImporterContext.OneValueStaticColumn(referenceColumn, presenceConstraint, ComputedValueUsage.USE_COMPUTED_AS_DEFAULT_VALUE) { @Override String getExpectedHeader() { - throw new UnsupportedOperationException("la colonne " + referenceColumn + " est calculée, il n'y a pas d'entête spécifié"); + return referenceColumn.getColumn(); } @Override @@ -300,11 +251,11 @@ public class ReferenceService { } }; } else if (multiplicity == Multiplicity.MANY) { - Expression<Set<String>> computationExpression = StringSetGroovyExpression.forExpression(computation.getExpression()); - column = new ReferenceImporterContext.ManyValuesStaticColumn(referenceColumn, presenceConstraint, ComputedValueUsage.USE_COMPUTED_VALUE) { + Expression<Set<String>> computationExpression = StringSetGroovyExpression.forExpression(defaultValueConfiguration.getExpression()); + column = new ReferenceImporterContext.ManyValuesStaticColumn(referenceColumn, presenceConstraint, ComputedValueUsage.USE_COMPUTED_AS_DEFAULT_VALUE) { @Override String getExpectedHeader() { - throw new UnsupportedOperationException("la colonne " + referenceColumn + " est calculée, il n'y a pas d'entête spécifié car elle ne doit pas être dans le CSV"); + return referenceColumn.getColumn(); } @Override @@ -325,6 +276,74 @@ public class ReferenceService { return column; } + private ReferenceImporterContext.Column computedColumnDescriptionToColumn(ReferenceValueRepository referenceValueRepository, ReferenceColumn referenceColumn, Multiplicity multiplicity, Configuration.ReferenceStaticComputedColumnDescription referenceStaticComputedColumnDescription) { + ReferenceImporterContext.Column column; + if (multiplicity == Multiplicity.ONE) { + column = newComputedColumn(referenceColumn, referenceStaticComputedColumnDescription, referenceValueRepository); + } else if (multiplicity == Multiplicity.MANY) { + column = newComputedManyColumn(referenceColumn, referenceStaticComputedColumnDescription, referenceValueRepository); + } else { + throw new IllegalStateException("multiplicity = " + multiplicity); + } + return column; + } + + private ReferenceImporterContext.Column newComputedManyColumn(ReferenceColumn referenceColumn, Configuration.ReferenceStaticComputedColumnDescription referenceStaticComputedColumnDescription, ReferenceValueRepository referenceValueRepository) { + Configuration.GroovyConfiguration computation = referenceStaticComputedColumnDescription.getComputation(); + ImmutableMap<String, Object> contextForExpression = computeGroovyContext(referenceValueRepository, computation); + Expression<Set<String>> computationExpression = StringSetGroovyExpression.forExpression(computation.getExpression()); + return new ReferenceImporterContext.ManyValuesStaticColumn(referenceColumn, ColumnPresenceConstraint.ABSENT, ComputedValueUsage.USE_COMPUTED_VALUE) { + @Override + String getExpectedHeader() { + throw new UnsupportedOperationException("la colonne " + referenceColumn + " est calculée, il n'y a pas d'entête spécifié car elle ne doit pas être dans le CSV"); + } + + @Override + Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { + ImmutableMap<String, Object> evaluationContext = ImmutableMap.<String, Object>builder() + .putAll(contextForExpression) + .putAll(referenceDatum.getEvaluationContext()) + .build(); + Set<String> evaluate = computationExpression.evaluate(evaluationContext); + Optional<ReferenceColumnValue> computedValue = Optional.ofNullable(evaluate) + .map(ReferenceColumnMultipleValue::new); + return computedValue; + } + }; + } + + private ReferenceImporterContext.Column newComputedColumn(ReferenceColumn referenceColumn, Configuration.ReferenceStaticComputedColumnDescription referenceStaticComputedColumnDescription, ReferenceValueRepository referenceValueRepository) { + Configuration.GroovyConfiguration computation = referenceStaticComputedColumnDescription.getComputation(); + ImmutableMap<String, Object> contextForExpression = computeGroovyContext(referenceValueRepository, computation); + Expression<String> computationExpression = StringGroovyExpression.forExpression(computation.getExpression()); + return new ReferenceImporterContext.OneValueStaticColumn(referenceColumn, ColumnPresenceConstraint.ABSENT, ComputedValueUsage.USE_COMPUTED_VALUE) { + @Override + String getExpectedHeader() { + throw new UnsupportedOperationException("la colonne " + referenceColumn + " est calculée, il n'y a pas d'entête spécifié"); + } + + @Override + Optional<ReferenceColumnValue> computeValue(ReferenceDatum referenceDatum) { + ImmutableMap<String, Object> evaluationContext = ImmutableMap.<String, Object>builder() + .putAll(contextForExpression) + .putAll(referenceDatum.getEvaluationContext()) + .build(); + String evaluate = computationExpression.evaluate(evaluationContext); + Optional<ReferenceColumnValue> computedValue = Optional.ofNullable(evaluate) + .filter(StringUtils::isNotEmpty) + .map(ReferenceColumnSingleValue::new); + return computedValue; + } + }; + } + + private ImmutableMap<String, Object> computeGroovyContext(ReferenceValueRepository referenceValueRepository, GroovyDataInjectionConfiguration groovyDataInjectionConfiguration) { + Set<String> configurationReferences = groovyDataInjectionConfiguration.getReferences(); + ImmutableMap<String, Object> contextForExpression = groovyContextHelper.getGroovyContextForReferences(referenceValueRepository, configurationReferences); + Preconditions.checkState(groovyDataInjectionConfiguration.getDatatypes().isEmpty(), "à ce stade, on ne gère pas le chargement de données. Les référentiels ne doivent pas dépendre des données expérimentales."); + return contextForExpression; + } + /** * @param nameOrId l'id de l'application * @param refType le type du referenciel -- GitLab From e41472af026672933f0b2c7a4f55a8b996452972 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Wed, 30 Mar 2022 15:07:02 +0200 Subject: [PATCH 26/41] =?UTF-8?q?Permet=20de=20d=C3=A9clarer=20des=20check?= =?UTF-8?q?ers=20de=20lignes=20portant=20sur=20x=20variable/composants?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inra/oresing/checker/CheckerFactory.java | 39 +++++++++++-------- .../fr/inra/oresing/model/Configuration.java | 26 +++++++++++-- .../rest/ApplicationConfigurationService.java | 12 +++--- .../resources/data/foret/foret_essai.yaml | 32 ++++++++++----- 4 files changed, 74 insertions(+), 35 deletions(-) diff --git a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java index cbe36b379..327cd8e33 100644 --- a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java +++ b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java @@ -66,20 +66,8 @@ public class CheckerFactory { .map(checkerDescription -> newChecker(app, checkerDescription, referenceColumn)) .ifPresent(checkersBuilder::add); } - for (Map.Entry<String, Configuration.LineValidationRuleWithColumnsDescription> validationEntry : referenceDescription.getValidations().entrySet()) { - Configuration.LineValidationRuleWithColumnsDescription lineValidationRuleDescription = validationEntry.getValue(); - Configuration.CheckerDescription checkerDescription = lineValidationRuleDescription.getChecker(); - if (GroovyLineChecker.NAME.equals(checkerDescription.getName())) { - LineChecker lineChecker = newLineChecker(app, lineValidationRuleDescription); - checkersBuilder.add(lineChecker); - } else { - List<CheckerOnOneVariableComponentLineChecker> lineCheckers = lineValidationRuleDescription.getColumns().stream() - .map(ReferenceColumn::new) - .map(checkerTarget -> newChecker(app, checkerDescription, checkerTarget)) - .collect(Collectors.toList()); - checkersBuilder.addAll(lineCheckers); - } - } + ImmutableMap<String, Configuration.LineValidationRuleDescription> validations = ImmutableMap.copyOf(referenceDescription.getValidations()); + checkersBuilder.addAll(validationRulesToLineCheckers(app, validations)); ImmutableSet<LineChecker> lineCheckers = checkersBuilder.build(); if (log.isTraceEnabled()) { log.trace("pour " + app.getName() + ", " + reference + ", on validera avec " + lineCheckers); @@ -103,9 +91,8 @@ public class CheckerFactory { .ifPresent(checkersBuilder::add); } } - dataTypeDescription.getValidations().values().stream() - .map(lineValidationRuleDescription -> newLineChecker(app, lineValidationRuleDescription)) - .forEach(checkersBuilder::add); + ImmutableMap<String, Configuration.LineValidationRuleDescription> validations = ImmutableMap.copyOf(dataTypeDescription.getValidations()); + checkersBuilder.addAll(validationRulesToLineCheckers(app, validations)); ImmutableSet<LineChecker> lineCheckers = checkersBuilder.build(); if (log.isTraceEnabled()) { log.trace("pour " + app.getName() + ", " + dataType + ", on validera avec " + lineCheckers); @@ -170,4 +157,22 @@ public class CheckerFactory { } return lineChecker; } + + private ImmutableSet<LineChecker> validationRulesToLineCheckers(Application app, ImmutableMap<String, Configuration.LineValidationRuleDescription> validations) { + ImmutableSet.Builder<LineChecker> checkersBuilder = ImmutableSet.builder(); + for (Map.Entry<String, Configuration.LineValidationRuleDescription> validationEntry : validations.entrySet()) { + Configuration.LineValidationRuleDescription lineValidationRuleDescription = validationEntry.getValue(); + Configuration.CheckerDescription checkerDescription = lineValidationRuleDescription.getChecker(); + if (GroovyLineChecker.NAME.equals(checkerDescription.getName())) { + LineChecker lineChecker = newLineChecker(app, lineValidationRuleDescription); + checkersBuilder.add(lineChecker); + } else { + List<CheckerOnOneVariableComponentLineChecker> lineCheckers = lineValidationRuleDescription.doGetCheckerTargets().stream() + .map(checkerTarget -> newChecker(app, checkerDescription, checkerTarget)) + .collect(Collectors.toList()); + checkersBuilder.addAll(lineCheckers); + } + } + return checkersBuilder.build(); + } } \ No newline at end of file diff --git a/src/main/java/fr/inra/oresing/model/Configuration.java b/src/main/java/fr/inra/oresing/model/Configuration.java index 7f61b6be9..03df4d0a3 100644 --- a/src/main/java/fr/inra/oresing/model/Configuration.java +++ b/src/main/java/fr/inra/oresing/model/Configuration.java @@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.collect.MoreCollectors; import com.google.common.collect.Sets; +import fr.inra.oresing.checker.CheckerTarget; import fr.inra.oresing.checker.DateLineCheckerConfiguration; import fr.inra.oresing.checker.FloatCheckerConfiguration; import fr.inra.oresing.checker.GroovyLineCheckerConfiguration; @@ -247,7 +248,7 @@ public class Configuration { public static class DataTypeDescription extends InternationalizationMapDisplayImpl { FormatDescription format; LinkedHashMap<String, ColumnDescription> data = new LinkedHashMap<>(); - LinkedHashMap<String, LineValidationRuleDescription> validations = new LinkedHashMap<>(); + LinkedHashMap<String, LineValidationRuleWithVariableComponentsDescription> validations = new LinkedHashMap<>(); List<VariableComponentKey> uniqueness = new LinkedList<>(); TreeMap<Integer, List<MigrationDescription>> migrations = new TreeMap<>(); AuthorizationDescription authorization; @@ -271,10 +272,10 @@ public class Configuration { @Getter @Setter - @ToString - public static class LineValidationRuleDescription { + public static abstract class LineValidationRuleDescription { String description; CheckerDescription checker; + public abstract Set<CheckerTarget> doGetCheckerTargets(); } @Getter @@ -282,6 +283,25 @@ public class Configuration { @ToString public static class LineValidationRuleWithColumnsDescription extends LineValidationRuleDescription { Set<String> columns; + + @Override + public Set<CheckerTarget> doGetCheckerTargets() { + return columns.stream() + .map(ReferenceColumn::new) + .collect(Collectors.toUnmodifiableSet()); + } + } + + @Getter + @Setter + @ToString + public static class LineValidationRuleWithVariableComponentsDescription extends LineValidationRuleDescription { + Set<VariableComponentKey> variableComponents; + + @Override + public Set<CheckerTarget> doGetCheckerTargets() { + return Set.copyOf(variableComponents); + } } @Getter diff --git a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java index 72bb6656f..4a9393ded 100644 --- a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java +++ b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java @@ -46,6 +46,7 @@ import java.util.stream.Collectors; @Slf4j public class ApplicationConfigurationService { public static final List INTERNATIONALIZED_FIELDS = List.of("internationalization", "internationalizationName", "internationalizedColumns", "internationalizationDisplay"); + private static final ImmutableSet<String> CHECKER_ON_TARGET_NAMES = ImmutableSet.of("Date", "Float", "Integer", "RegularExpression", "Reference"); ConfigurationParsingResult unzipConfiguration(MultipartFile file){ @@ -441,8 +442,8 @@ public class ApplicationConfigurationService { } private void verifyDatatypeCheckerGroovyExpressionExistsAndCanCompile(ConfigurationParsingResult.Builder builder, Configuration.DataTypeDescription dataTypeDescription) { - for (Map.Entry<String, Configuration.LineValidationRuleDescription> validationEntry : dataTypeDescription.getValidations().entrySet()) { - Configuration.LineValidationRuleDescription lineValidationRuleDescription = validationEntry.getValue(); + for (Map.Entry<String, Configuration.LineValidationRuleWithVariableComponentsDescription> validationEntry : dataTypeDescription.getValidations().entrySet()) { + Configuration.LineValidationRuleWithVariableComponentsDescription lineValidationRuleDescription = validationEntry.getValue(); String lineValidationRuleKey = validationEntry.getKey(); Configuration.CheckerDescription checker = lineValidationRuleDescription.getChecker(); if (GroovyLineChecker.NAME.equals(checker.getName())) { @@ -457,6 +458,8 @@ public class ApplicationConfigurationService { Optional<GroovyExpression.CompilationError> compileResult = GroovyLineChecker.validateExpression(expression); compileResult.ifPresent(compilationError -> builder.recordIllegalGroovyExpression(lineValidationRuleKey, expression, compilationError)); } + } else if (CHECKER_ON_TARGET_NAMES.contains(checker.getName())) { + // TODO } else { builder.recordUnknownCheckerName(lineValidationRuleKey, checker.getName()); } @@ -639,7 +642,6 @@ public class ApplicationConfigurationService { if (checker == null) { continue; } - ImmutableSet<String> variableComponentCheckers = ImmutableSet.of("Date", "Float", "Integer", "RegularExpression", "Reference"); if (GroovyLineChecker.NAME.equals(checker.getName())) { String expression = Optional.of(checker) .map(Configuration.CheckerDescription::getParams) @@ -652,7 +654,7 @@ public class ApplicationConfigurationService { Optional<GroovyExpression.CompilationError> compileResult = GroovyLineChecker.validateExpression(expression); compileResult.ifPresent(compilationError -> builder.recordIllegalGroovyExpression(validationRuleDescriptionEntryKey, expression, compilationError)); } - } else if (variableComponentCheckers.contains(checker.getName())) { + } else if (CHECKER_ON_TARGET_NAMES.contains(checker.getName())) { if (lineValidationRuleDescription.getColumns().isEmpty()) { builder.missingParamColumnReferenceForCheckerInReference(validationRuleDescriptionEntryKey, reference); } else { @@ -674,7 +676,7 @@ public class ApplicationConfigurationService { } } } else { - builder.recordUnknownCheckerNameForVariableComponentCheckerInReference(validationRuleDescriptionEntryKey, reference, checker.getName(), variableComponentCheckers); + builder.recordUnknownCheckerNameForVariableComponentCheckerInReference(validationRuleDescriptionEntryKey, reference, checker.getName(), CHECKER_ON_TARGET_NAMES); } } } diff --git a/src/test/resources/data/foret/foret_essai.yaml b/src/test/resources/data/foret/foret_essai.yaml index 8e9b1323d..33c1496b7 100644 --- a/src/test/resources/data/foret/foret_essai.yaml +++ b/src/test/resources/data/foret/foret_essai.yaml @@ -803,16 +803,8 @@ dataTypes: required: true transformation: codify: true - start date: - checker: - name: Date - params: - pattern: dd/MM/yyyy - end date: - checker: - name: Date - params: - pattern: dd/MM/yyyy + start date: null + end date: null comment: null profondeur max: checker: @@ -887,6 +879,26 @@ dataTypes: name: Integer params: required: true + validations: + controle du format des dates en jours: + variableComponents: + - variable: informations + component: start date + - variable: informations + component: end date + checker: + name: Date + params: + pattern: dd/MM/yyyy + controle de la chronologie: + checker: + name: GroovyExpression + params: + groovy: + expression: > + Date start = DateUtils.parseDate(datum.get("informations").get("start date"), "dd/MM/yyyy"); + Date end = DateUtils.parseDate(datum.get("informations").get("end date"), "dd/MM/yyyy"); + return start.before(end); format: constants: - rowNumber: 1 -- GitLab From 2b5ed706456af09c078f57045337c1323d3d82be Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Wed, 30 Mar 2022 16:32:14 +0200 Subject: [PATCH 27/41] Indente le fichier Configuration --- .../fr/inra/oresing/model/Configuration.java | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/src/main/java/fr/inra/oresing/model/Configuration.java b/src/main/java/fr/inra/oresing/model/Configuration.java index a971798c2..c8520be0f 100644 --- a/src/main/java/fr/inra/oresing/model/Configuration.java +++ b/src/main/java/fr/inra/oresing/model/Configuration.java @@ -48,22 +48,30 @@ import java.util.stream.Collectors; @Setter @ToString public class Configuration { + @ApiModelProperty(notes = "The set of requiredAuthorization of data.authorization section. Fill by aplication", required = false, hidden = true) private List<String> requiredAuthorizationsAttributes; + @ApiModelProperty(notes = "The version number of the yaml schema used to read the deposited yaml",required = true, example = "1") private int version; + @ApiModelProperty(notes = "The internationalization description from other sections. Fill by application", required = false, hidden = true) private InternationalizationMap internationalization; + @ApiModelProperty(notes = "A comment about this yaml",required = false, example = "Adding sites section") private String comment; + @ApiModelProperty(notes = "An Application description",required = true) private ApplicationDescription application; + @ApiModelProperty(notes = "A list of references indexed by name. A reference is used to describe other references or data..",required = true) private LinkedHashMap<String, ReferenceDescription> references = new LinkedHashMap<>(); + @ApiModelProperty(notes = "A composite reference allows you to link references according to an ''is in'' link. For example between a city and country reference.\n" + "You can define several composite references, and a composite reference can contain only one reference or contain a recursion.\n" + "All references used in a datatype.authorization.authorizationscope section must be composite.",required = true) private LinkedHashMap<String, CompositeReferenceDescription> compositeReferences = new LinkedHashMap<>(); + @ApiModelProperty(notes = "A data type describes a set of data representing a cohesive set of measurements or observations. (values can be stored in one csv file format).",required = false) private LinkedHashMap<String, DataTypeDescription> dataTypes = new LinkedHashMap<>(); @@ -131,15 +139,20 @@ public class Configuration { @Setter @ToString public static class ReferenceDescription extends InternationalizationDisplayImpl { + @ApiModelProperty(notes = "The separator in csv files", required = false) private char separator = ';'; + @ApiModelProperty(notes = "The list of columns composing the natural key of a row.", required = true) private List<String> keyColumns = new LinkedList<>(); + @ApiModelProperty(notes = "The list of columns descriptions.", required = true) private LinkedHashMap<String, ReferenceStaticNotComputedColumnDescription> columns = new LinkedHashMap<>(); private LinkedHashMap<String, ReferenceStaticComputedColumnDescription> computedColumns = new LinkedHashMap<>(); + @ApiModelProperty(notes = "The list of dynamic columns descriptions. Dynamic columns names reffers to an other reference.", required = true) private LinkedHashMap<String, ReferenceDynamicColumnDescription> dynamicColumns = new LinkedHashMap<>(); + @ApiModelProperty(notes = "The list of validations to perform on this reference.", required = false) private LinkedHashMap<String, LineValidationRuleWithColumnsDescription> validations = new LinkedHashMap<>(); @@ -201,6 +214,7 @@ public class Configuration { @Getter @Setter public static abstract class ReferenceColumnDescription { + @ApiModelProperty(notes = "If the column is or not mandatory", required = true, example = "MANDATORY", allowableValues = "MANDATORY,OPTIONAL") ColumnPresenceConstraint presenceConstraint = ColumnPresenceConstraint.MANDATORY; } @@ -230,10 +244,13 @@ public class Configuration { @Setter @ToString public static class ReferenceDynamicColumnDescription extends ReferenceColumnDescription { + @ApiModelProperty(notes = "The header prefix. All culumnsthat startswith this prefix use this description", example = "rt_", required = true) private String headerPrefix = ""; + @ApiModelProperty(notes = "The reference that contains the column names", required = true, example = "proprietes_taxon") private String reference; + @ApiModelProperty(notes = "The column in this reference that contains the column names", required = true, example = "name") private String referenceColumnToLookForHeader; } @@ -255,10 +272,13 @@ public class Configuration { @Setter @ToString public static class CompositeReferenceComponentDescription extends InternationalizationImpl { + @ApiModelProperty(notes = "The reference composing the composite reference", required = true, example = "types_sites") String reference; + @ApiModelProperty(notes = "The reference where this reference refers to", required = false, example = "name") String parentKeyColumn; + @ApiModelProperty(notes = "For recursive composite reference : the reference column that's contains parent key", required = false, example = "parent_key") String parentRecursiveKey; } @@ -267,18 +287,25 @@ public class Configuration { @Setter @ToString public static class DataTypeDescription extends InternationalizationMapDisplayImpl { + @ApiModelProperty(notes = "This section describes a binding between a file and the data", required = true) FormatDescription format; + @ApiModelProperty(notes = "This section describes the data model", required = true) LinkedHashMap<String, ColumnDescription> data = new LinkedHashMap<>(); + @ApiModelProperty(notes = "This section validate the data format", required = true) LinkedHashMap<String, LineValidationRuleWithVariableComponentsDescription> validations = new LinkedHashMap<>(); + @ApiModelProperty(notes = "This section defines the natural key of a line", required = false) List<VariableComponentKey> uniqueness = new LinkedList<>(); + @ApiModelProperty(notes = "This section defines how to migrate the data when a new version of yaml is registred", required = false) TreeMap<Integer, List<MigrationDescription>> migrations = new TreeMap<>(); + @ApiModelProperty(notes = "This section defines the autorizations for this dataType", required = true) AuthorizationDescription authorization; + @ApiModelProperty(notes = "If this section existe, the data file will be store on a repository tree", required = false) LinkedHashMap<String, String> repository = null; @@ -301,8 +328,10 @@ public class Configuration { @Getter @Setter public static abstract class LineValidationRuleDescription { + @ApiModelProperty(notes = "A description of the validation", required = false) String description; + @ApiModelProperty(notes = "A checker that can validate one or some columns. Can also build new values from other values.", required = true) CheckerDescription checker; public abstract Set<CheckerTarget> doGetCheckerTargets(); @@ -312,6 +341,7 @@ public class Configuration { @Setter @ToString public static class LineValidationRuleWithColumnsDescription extends LineValidationRuleDescription { + @ApiModelProperty(notes = "The list of columns to build natural key of reference for Reference checker", required = false) Set<String> columns; @@ -327,6 +357,7 @@ public class Configuration { @Setter @ToString public static class LineValidationRuleWithVariableComponentsDescription extends LineValidationRuleDescription { + @ApiModelProperty(notes = "the variable component key for this checkern filled by application", required = false, hidden = true) Set<VariableComponentKey> variableComponents; @@ -340,10 +371,13 @@ public class Configuration { @Setter @ToString public static class AuthorizationDescription { + @ApiModelProperty(notes = "The variable component with a checker date that identify the time scope of the line", required = true) VariableComponentKey timeScope; + @ApiModelProperty(notes = "A list of authorization scopes. An authorization scope is for example a an authorization on a location", required = true) LinkedHashMap<String, AuthorizationScopeDescription> authorizationScopes = new LinkedHashMap<>(); + @ApiModelProperty(notes = "A list of datagroups. A line wil be split into as many lines as there are data groups. Datagroups is partition of variables", required = true) LinkedHashMap<String, DataGroupDescription> dataGroups = new LinkedHashMap<>(); @@ -371,8 +405,10 @@ public class Configuration { @Setter @ToString public static class AuthorizationScopeDescription extends InternationalizationImpl { + @ApiModelProperty(notes = "The variable name", required = true, example = "temperature") String variable; + @ApiModelProperty(notes = "The component name. A component is an information about a variable", required = true, example = "unit") String component; @@ -385,16 +421,22 @@ public class Configuration { @Setter @ToString public static class FormatDescription { + @ApiModelProperty(notes = "The line with columns names", required = true, example = "1") private int headerLine = 1; + @ApiModelProperty(notes = "The first line with data", required = true, example = "2") private int firstRowLine = 2; + @ApiModelProperty(notes = "The csv separator", required = false, example = ";") private char separator = ';'; + @ApiModelProperty(notes = "The description for binding columns content to variable component", required = true) private List<ColumnBindingDescription> columns = new LinkedList<>(); + @ApiModelProperty(notes = "The description for binding repeated columns content to variable component", required = false) private List<RepeatedColumnBindingDescription> repeatedColumns = new LinkedList<>(); + @ApiModelProperty(notes = "The description of some values in header to bind to variable component", required = false) private List<HeaderConstantDescription> constants = new LinkedList<>(); } @@ -403,14 +445,19 @@ public class Configuration { @Setter @ToString public static class HeaderConstantDescription { + @ApiModelProperty(notes = "The row where is the constant value", required = true, example = "1") int rowNumber; + @ApiModelProperty(notes = "The column where is the constant value. Id empty headerName is required", required = false, example = "2") int columnNumber; + @ApiModelProperty(notes = "The header column name of column where is the constant value. Id empty columnNumber is required", required = false, example = "CO2") String headerName; + @ApiModelProperty(notes = "The variable component to bound to", required = true) VariableComponentKey boundTo; + @ApiModelProperty(notes = "The export header name", required = true, example = "CO2_unit") String exportHeader; @@ -427,8 +474,10 @@ public class Configuration { @Setter @ToString public static class ColumnBindingDescription { + @ApiModelProperty(notes = "The header name of column that contains the value to bind", required = true, example = "CO2") String header; + @ApiModelProperty(notes = "The variable component to bind to", required = true) VariableComponentKey boundTo; } @@ -437,12 +486,16 @@ public class Configuration { @Setter @ToString public static class RepeatedColumnBindingDescription { + @ApiModelProperty(notes = "The regexp pattern to find repeated columns to bind", required = true, example = "(.*)_([0-9]*)_([0-9]*)") String headerPattern; + @ApiModelProperty(notes = "The export header (for value) of these columns", required = true, example = "SMP") String exportHeader; + @ApiModelProperty(notes = "How bind the result of regexp parenthesis. $1 to first pattern, $2 is the second ...", required = false) List<HeaderPatternToken> tokens = new LinkedList<>(); + @ApiModelProperty(notes = "How bind the value column", required = true) VariableComponentKey boundTo; } @@ -451,8 +504,10 @@ public class Configuration { @Setter @ToString public static class HeaderPatternToken { + @ApiModelProperty(notes = "The variable component to bind to", required = true) VariableComponentKey boundTo; + @ApiModelProperty(notes = "The export header(for pattern) name", required = true, example = "profondeur") String exportHeader; } @@ -461,8 +516,10 @@ public class Configuration { @Setter @ToString public static class ColumnDescription { + @ApiModelProperty(notes = "A description to create disponibility charts", required = false) Chart chartDescription; + @ApiModelProperty(notes = "A list of variable component", required = true) LinkedHashMap<String, VariableComponentWithDefaultValueDescription> components = new LinkedHashMap<>(); LinkedHashMap<String, ComputedVariableComponentDescription> computedComponents = new LinkedHashMap<>(); @@ -496,14 +553,19 @@ public class Configuration { public static String VAR_SQL_DEFAULT_TEMPLATE = " (\n" + "\t '%s' -- datatype\n" + " )\n"; + @ApiModelProperty(notes = "The component contening value", required = true) String value; + @ApiModelProperty(notes = "A variable component for aggregate values", required = false) VariableComponentKey aggregation = null; + @ApiModelProperty(notes = "A variable component for unit", required = false) String unit = null; + @ApiModelProperty(notes = "An sql expression for max gap between consecutives values", required = false) String gap = null; + @ApiModelProperty(notes = "A component for standardDeviation", required = false) String standardDeviation = null; @@ -531,6 +593,7 @@ public class Configuration { @Getter @Setter public abstract static class VariableComponentDescription { + @ApiModelProperty(notes = "A checker description", required = false) CheckerDescription checker; } @@ -539,6 +602,7 @@ public class Configuration { @Setter @ToString public static class VariableComponentWithDefaultValueDescription extends VariableComponentDescription { + @ApiModelProperty(notes = "A default value if ciolumn is empty. This is a groovy expression", required = false, example = "-9999") @Nullable GroovyConfiguration defaultValue; @@ -555,8 +619,10 @@ public class Configuration { @Setter @ToString public static class CheckerDescription { + @ApiModelProperty(notes = "The name of the checker that must be used", required = true, allowableValues = "RegularExpression,Reference,Float,Integer,Date,GroovyExpression") String name; + @ApiModelProperty(notes = "The params of the checker to configure it. Required for some checkers", required = false) CheckerConfigurationDescription params = new CheckerConfigurationDescription(); } @@ -571,16 +637,21 @@ public class Configuration { DateLineCheckerConfiguration, ReferenceLineCheckerConfiguration, GroovyLineCheckerConfiguration { + @ApiModelProperty(notes = "The pattern of a regular expression for RegularExpression checker\nthe pattern of a date for Date checker", required = false, example = "dd/MM/yyyy") String pattern; + @ApiModelProperty(notes = "the name of the reference for Reference checker", required = false, example = "units") String refType; + @ApiModelProperty(notes = "A groovy expression for Reference checker, GroovyChecker", required = false) GroovyConfiguration groovy; String duration; TransformationConfigurationDescription transformation = new TransformationConfigurationDescription(); + @ApiModelProperty(notes = "If true the value can't be null", required = false, example = "true", allowableValues = "true,false") boolean required = true; + @ApiModelProperty(notes = "If MANY the value is a list of references for Reference checker", required = false, example ="MANY", allowableValues = "MANY,ONE") Multiplicity multiplicity = Multiplicity.ONE; } @@ -589,6 +660,7 @@ public class Configuration { @Setter @ToString public static class TransformationConfigurationDescription implements TransformationConfiguration { + @ApiModelProperty(notes = "If true codifies the column value", required = false, example = "true", allowableValues = "true,false") boolean codify; GroovyConfiguration groovy; @@ -598,6 +670,7 @@ public class Configuration { @Setter @ToString public static class GroovyConfiguration implements fr.inra.oresing.checker.GroovyConfiguration { + @ApiModelProperty(notes = "A groovy expression", required = false, example = ">\n" + " String dataType = Arrays.stream(datum.dataType)\n" + " .split(\"_\"))\n" + @@ -605,8 +678,10 @@ public class Configuration { " .join(); " + " return application.dataType.contains(dataType);") String expression; + @ApiModelProperty(notes = "The list of references values in database to add to groovy context", required = false) Set<String> references = new LinkedHashSet<>(); + @ApiModelProperty(notes = "The list of datatypes values in database to add to groovy context", required = false) Set<String> datatypes = new LinkedHashSet<>(); } @@ -615,8 +690,10 @@ public class Configuration { @Setter @ToString public static class DataGroupDescription extends InternationalizationImpl { + @ApiModelProperty(notes = "The name of the datagroup", required = true, example = "localizations") String label; + @ApiModelProperty(notes = "The list of variable in this datagroup", required = true) Set<String> data = new LinkedHashSet<>(); } @@ -625,10 +702,13 @@ public class Configuration { @Setter @ToString public static class ApplicationDescription extends InternationalizationImpl { + @ApiModelProperty(notes = "The unique name of the application",required = true, example = "ACBB") String name; + @ApiModelProperty(notes = "The version incremental version number of this yaml description of this application",required = true, example = "1") int version; + @ApiModelProperty(notes = "The default language if none is provided",required = false, example = "fr") Locale defaultLanguage; @@ -643,12 +723,16 @@ public class Configuration { @Setter @ToString public static class MigrationDescription { + @ApiModelProperty(notes = "The migration strategy", required = true, example = "ADD_VARIABLE", allowableValues = "ADD_VARIABLE") MigrationStrategy strategy; + @ApiModelProperty(notes = "A datagroup name", required = true, example = "variables") String dataGroup; + @ApiModelProperty(notes = "A variable in this datagroup", required = true, example = "CO2") String variable; + @ApiModelProperty(notes = "A list of component migration description for this variable", required = true) Map<String, AddVariableMigrationDescription> components = new LinkedHashMap<>(); } @@ -657,6 +741,7 @@ public class Configuration { @Setter @ToString public static class AddVariableMigrationDescription { + @ApiModelProperty(notes = "The value by default if the variable component is empty after migration", required = true, example = "-9999") String defaultValue; } -- GitLab From 5aa6e8d865c69228a02beab5da76ed8cea74752e Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Wed, 30 Mar 2022 17:07:06 +0200 Subject: [PATCH 28/41] Documentation Swagger de la configuration --- .../fr/inra/oresing/model/Configuration.java | 124 +++++++++++------- 1 file changed, 74 insertions(+), 50 deletions(-) diff --git a/src/main/java/fr/inra/oresing/model/Configuration.java b/src/main/java/fr/inra/oresing/model/Configuration.java index c8520be0f..a7839e492 100644 --- a/src/main/java/fr/inra/oresing/model/Configuration.java +++ b/src/main/java/fr/inra/oresing/model/Configuration.java @@ -148,9 +148,11 @@ public class Configuration { @ApiModelProperty(notes = "The list of columns descriptions.", required = true) private LinkedHashMap<String, ReferenceStaticNotComputedColumnDescription> columns = new LinkedHashMap<>(); + + @ApiModelProperty(notes = "The list of computed columns descriptions. Computed columns are not provided in the CSV but computed line by line when importing.", required = false) private LinkedHashMap<String, ReferenceStaticComputedColumnDescription> computedColumns = new LinkedHashMap<>(); - @ApiModelProperty(notes = "The list of dynamic columns descriptions. Dynamic columns names reffers to an other reference.", required = true) + @ApiModelProperty(notes = "The list of dynamic columns descriptions. Dynamic columns names refers to an other reference.", required = true) private LinkedHashMap<String, ReferenceDynamicColumnDescription> dynamicColumns = new LinkedHashMap<>(); @ApiModelProperty(notes = "The list of validations to perform on this reference.", required = false) @@ -215,13 +217,16 @@ public class Configuration { @Setter public static abstract class ReferenceColumnDescription { - @ApiModelProperty(notes = "If the column is or not mandatory", required = true, example = "MANDATORY", allowableValues = "MANDATORY,OPTIONAL") + @ApiModelProperty(notes = "If the column is mandatory or not", required = true, example = "MANDATORY", allowableValues = "MANDATORY,OPTIONAL") ColumnPresenceConstraint presenceConstraint = ColumnPresenceConstraint.MANDATORY; } @Getter @Setter public static abstract class ReferenceStaticColumnDescription extends ReferenceColumnDescription { + + @ApiModelProperty(notes = "Define a checker to apply for this column on each line of the CSV at import", required = false) + @Nullable CheckerDescription checker; } @@ -229,6 +234,8 @@ public class Configuration { @Setter @ToString public static class ReferenceStaticNotComputedColumnDescription extends ReferenceStaticColumnDescription { + + @ApiModelProperty(notes = "Define a default value for this column: it will be computed if the CSV contains an empty cell", required = false) @Nullable GroovyConfiguration defaultValue; } @@ -237,6 +244,8 @@ public class Configuration { @Setter @ToString public static class ReferenceStaticComputedColumnDescription extends ReferenceStaticColumnDescription { + + @ApiModelProperty(notes = "Explain how to compute the value for this column given other columns", required = false) GroovyConfiguration computation; } @@ -245,13 +254,13 @@ public class Configuration { @ToString public static class ReferenceDynamicColumnDescription extends ReferenceColumnDescription { - @ApiModelProperty(notes = "The header prefix. All culumnsthat startswith this prefix use this description", example = "rt_", required = true) + @ApiModelProperty(notes = "The header prefix. All columns that starts with this prefix use this description", example = "rt_", required = true) private String headerPrefix = ""; @ApiModelProperty(notes = "The reference that contains the column names", required = true, example = "proprietes_taxon") private String reference; - @ApiModelProperty(notes = "The column in this reference that contains the column names", required = true, example = "name") + @ApiModelProperty(notes = "The column in 'reference' that contains the column names", required = true, example = "name") private String referenceColumnToLookForHeader; } @@ -259,6 +268,7 @@ public class Configuration { @Setter @ToString public static class CompositeReferenceDescription extends InternationalizationImpl { + @ApiModelProperty(notes = "A 'composite reference' is a hierarchy of references from largest entity to the smallest", required = false) List<CompositeReferenceComponentDescription> components = new LinkedList<>(); public boolean isDependentOfReference(String reference) { @@ -273,13 +283,13 @@ public class Configuration { @ToString public static class CompositeReferenceComponentDescription extends InternationalizationImpl { - @ApiModelProperty(notes = "The reference composing the composite reference", required = true, example = "types_sites") + @ApiModelProperty(notes = "A reference composing the composite reference", required = true, example = "types_sites") String reference; - @ApiModelProperty(notes = "The reference where this reference refers to", required = false, example = "name") + @ApiModelProperty(notes = "The column of 'reference' where we can find the natural key the find the parent for this line", required = false, example = "name") String parentKeyColumn; - @ApiModelProperty(notes = "For recursive composite reference : the reference column that's contains parent key", required = false, example = "parent_key") + @ApiModelProperty(notes = "For recursive composite reference: the reference column that contains parent key", required = false, example = "parent_key") String parentRecursiveKey; } @@ -291,22 +301,22 @@ public class Configuration { @ApiModelProperty(notes = "This section describes a binding between a file and the data", required = true) FormatDescription format; - @ApiModelProperty(notes = "This section describes the data model", required = true) + @ApiModelProperty(notes = "This section describes the data model, splitting each line of data in variable/components", required = true) LinkedHashMap<String, ColumnDescription> data = new LinkedHashMap<>(); - @ApiModelProperty(notes = "This section validate the data format", required = true) + @ApiModelProperty(notes = "Some validations rules that will be checked at import. It will allow to make sure a line we import is consistent.", required = true) LinkedHashMap<String, LineValidationRuleWithVariableComponentsDescription> validations = new LinkedHashMap<>(); - @ApiModelProperty(notes = "This section defines the natural key of a line", required = false) + @ApiModelProperty(notes = "This section defines the variable/components that compose the natural key of a line", required = false) List<VariableComponentKey> uniqueness = new LinkedList<>(); - @ApiModelProperty(notes = "This section defines how to migrate the data when a new version of yaml is registred", required = false) + @ApiModelProperty(notes = "This section defines how to migrate the data when a new version of yaml is registered", required = false) TreeMap<Integer, List<MigrationDescription>> migrations = new TreeMap<>(); - @ApiModelProperty(notes = "This section defines the autorizations for this dataType", required = true) + @ApiModelProperty(notes = "This section defines the autorization model for this dataType, how we define who can access what", required = true) AuthorizationDescription authorization; - @ApiModelProperty(notes = "If this section existe, the data file will be store on a repository tree", required = false) + @ApiModelProperty(notes = "If this section exists, the data file will be store on a repository tree", required = false) LinkedHashMap<String, String> repository = null; public static Map<String, InternationalizationDataTypeMap> getInternationalization(LinkedHashMap<String, DataTypeDescription> dataTypeDescriptionMap) { @@ -329,11 +339,15 @@ public class Configuration { @Setter public static abstract class LineValidationRuleDescription { - @ApiModelProperty(notes = "A description of the validation", required = false) + @ApiModelProperty(notes = "A description of the validation. If the validation fail: this message will be shown to the user so one can fix the imported file", required = false) String description; - @ApiModelProperty(notes = "A checker that can validate one or some columns. Can also build new values from other values.", required = true) + @ApiModelProperty(notes = "The checker to apply to ensure that the rule is respected", required = true) CheckerDescription checker; + + /** + * Si le checker est un {@link fr.inra.oresing.checker.CheckerOnOneVariableComponentLineChecker}, les {@link CheckerTarget} sur lesquelles il s'applique + */ public abstract Set<CheckerTarget> doGetCheckerTargets(); } @@ -342,7 +356,7 @@ public class Configuration { @ToString public static class LineValidationRuleWithColumnsDescription extends LineValidationRuleDescription { - @ApiModelProperty(notes = "The list of columns to build natural key of reference for Reference checker", required = false) + @ApiModelProperty(notes = "The set of columns to check", required = false) Set<String> columns; @Override @@ -358,7 +372,7 @@ public class Configuration { @ToString public static class LineValidationRuleWithVariableComponentsDescription extends LineValidationRuleDescription { - @ApiModelProperty(notes = "the variable component key for this checkern filled by application", required = false, hidden = true) + @ApiModelProperty(notes = "The set of variable/components to check", required = false, hidden = true) Set<VariableComponentKey> variableComponents; @Override @@ -372,13 +386,13 @@ public class Configuration { @ToString public static class AuthorizationDescription { - @ApiModelProperty(notes = "The variable component with a checker date that identify the time scope of the line", required = true) + @ApiModelProperty(notes = "The variable component that identifies the time scope of the line (must be a variable/component with a checker of type 'Date')", required = true) VariableComponentKey timeScope; - @ApiModelProperty(notes = "A list of authorization scopes. An authorization scope is for example a an authorization on a location", required = true) + @ApiModelProperty(notes = "A list of authorization scopes. An authorization scope is for example the location, the project, or both.", required = true) LinkedHashMap<String, AuthorizationScopeDescription> authorizationScopes = new LinkedHashMap<>(); - @ApiModelProperty(notes = "A list of datagroups. A line wil be split into as many lines as there are data groups. Datagroups is partition of variables", required = true) + @ApiModelProperty(notes = "The list of 'data groups'. Each data group contains variables. People will be given a right on one or more data-group.", required = true) LinkedHashMap<String, DataGroupDescription> dataGroups = new LinkedHashMap<>(); public InternationalizationAuthorisationMap getInternationalization() { @@ -406,10 +420,10 @@ public class Configuration { @ToString public static class AuthorizationScopeDescription extends InternationalizationImpl { - @ApiModelProperty(notes = "The variable name", required = true, example = "temperature") + @ApiModelProperty(notes = "This autorization scope is defined by a variable/component, this is the variable name", required = true, example = "localization") String variable; - @ApiModelProperty(notes = "The component name. A component is an information about a variable", required = true, example = "unit") + @ApiModelProperty(notes = "This autorization scope is defined by a variable/component, this is the component name", required = true, example = "zone") String component; public VariableComponentKey getVariableComponentKey() { @@ -425,16 +439,16 @@ public class Configuration { @ApiModelProperty(notes = "The line with columns names", required = true, example = "1") private int headerLine = 1; - @ApiModelProperty(notes = "The first line with data", required = true, example = "2") + @ApiModelProperty(notes = "The number of the line that contain the first row of data", required = true, example = "2") private int firstRowLine = 2; - @ApiModelProperty(notes = "The csv separator", required = false, example = ";") + @ApiModelProperty(notes = "The CSV separator", required = false, example = ";") private char separator = ';'; - @ApiModelProperty(notes = "The description for binding columns content to variable component", required = true) + @ApiModelProperty(notes = "The description for binding columns content to variable/components", required = true) private List<ColumnBindingDescription> columns = new LinkedList<>(); - @ApiModelProperty(notes = "The description for binding repeated columns content to variable component", required = false) + @ApiModelProperty(notes = "The description of repeated colulmns patterns and their binding to variable/components", required = false) private List<RepeatedColumnBindingDescription> repeatedColumns = new LinkedList<>(); @ApiModelProperty(notes = "The description of some values in header to bind to variable component", required = false) @@ -449,13 +463,13 @@ public class Configuration { @ApiModelProperty(notes = "The row where is the constant value", required = true, example = "1") int rowNumber; - @ApiModelProperty(notes = "The column where is the constant value. Id empty headerName is required", required = false, example = "2") + @ApiModelProperty(notes = "The column where is the constant value. If empty, 'headerName' must be provided", required = false, example = "2") int columnNumber; - @ApiModelProperty(notes = "The header column name of column where is the constant value. Id empty columnNumber is required", required = false, example = "CO2") + @ApiModelProperty(notes = "The header column name of column where is the constant value. If empty, 'columnNumber' must be provided", required = false, example = "CO2") String headerName; - @ApiModelProperty(notes = "The variable component to bound to", required = true) + @ApiModelProperty(notes = "The variable/component to bound to", required = true) VariableComponentKey boundTo; @ApiModelProperty(notes = "The export header name", required = true, example = "CO2_unit") @@ -475,10 +489,10 @@ public class Configuration { @ToString public static class ColumnBindingDescription { - @ApiModelProperty(notes = "The header name of column that contains the value to bind", required = true, example = "CO2") + @ApiModelProperty(notes = "The header name of column that contains the value to bind", required = true, example = "CO2") String header; - @ApiModelProperty(notes = "The variable component to bind to", required = true) + @ApiModelProperty(notes = "The variable/component to bind to. The content of the cell from the CSV will be pushed in this variable/component", required = true) VariableComponentKey boundTo; } @@ -496,7 +510,7 @@ public class Configuration { @ApiModelProperty(notes = "How bind the result of regexp parenthesis. $1 to first pattern, $2 is the second ...", required = false) List<HeaderPatternToken> tokens = new LinkedList<>(); - @ApiModelProperty(notes = "How bind the value column", required = true) + @ApiModelProperty(notes = "The variable/component to bind to. The content of the cell from the CSV will be pushed in this variable/component", required = true) VariableComponentKey boundTo; } @@ -505,10 +519,10 @@ public class Configuration { @ToString public static class HeaderPatternToken { - @ApiModelProperty(notes = "The variable component to bind to", required = true) + @ApiModelProperty(notes = "The variable/component to bind to. The content of the cell from the CSV will be pushed in this variable/component", required = true) VariableComponentKey boundTo; - @ApiModelProperty(notes = "The export header(for pattern) name", required = true, example = "profondeur") + @ApiModelProperty(notes = "When this data will be exported as CSV, the header of the column that will contain the value", required = true, example = "profondeur") String exportHeader; } @@ -517,11 +531,13 @@ public class Configuration { @ToString public static class ColumnDescription { - @ApiModelProperty(notes = "A description to create disponibility charts", required = false) + @ApiModelProperty(notes = "A description to create disponibilité charts", required = false) Chart chartDescription; - @ApiModelProperty(notes = "A list of variable component", required = true) + @ApiModelProperty(notes = "The list of components for this variable", required = true) LinkedHashMap<String, VariableComponentWithDefaultValueDescription> components = new LinkedHashMap<>(); + + @ApiModelProperty(notes = "The list of computed components for this variable", required = true) LinkedHashMap<String, ComputedVariableComponentDescription> computedComponents = new LinkedHashMap<>(); public Set<String> doGetAllComponents() { @@ -554,16 +570,16 @@ public class Configuration { "\t '%s' -- datatype\n" + " )\n"; - @ApiModelProperty(notes = "The component contening value", required = true) + @ApiModelProperty(notes = "The component containing value", required = true) String value; @ApiModelProperty(notes = "A variable component for aggregate values", required = false) VariableComponentKey aggregation = null; - @ApiModelProperty(notes = "A variable component for unit", required = false) + @ApiModelProperty(notes = "A variable/component for unit", required = false) String unit = null; - @ApiModelProperty(notes = "An sql expression for max gap between consecutives values", required = false) + @ApiModelProperty(notes = "An sql expression for max gap between consecutive values", required = false) String gap = null; @ApiModelProperty(notes = "A component for standardDeviation", required = false) @@ -603,7 +619,7 @@ public class Configuration { @ToString public static class VariableComponentWithDefaultValueDescription extends VariableComponentDescription { - @ApiModelProperty(notes = "A default value if ciolumn is empty. This is a groovy expression", required = false, example = "-9999") + @ApiModelProperty(notes = "A default value if the cell in the imported CSV is empty", required = false) @Nullable GroovyConfiguration defaultValue; } @@ -612,6 +628,8 @@ public class Configuration { @Setter @ToString public static class ComputedVariableComponentDescription extends VariableComponentDescription { + + @ApiModelProperty(notes = "Explain how to compute the value for this computed component given other columns", required = false) GroovyConfiguration computation; } @@ -620,7 +638,7 @@ public class Configuration { @ToString public static class CheckerDescription { - @ApiModelProperty(notes = "The name of the checker that must be used", required = true, allowableValues = "RegularExpression,Reference,Float,Integer,Date,GroovyExpression") + @ApiModelProperty(notes = "The name of the checker that must be used", required = true) String name; @ApiModelProperty(notes = "The params of the checker to configure it. Required for some checkers", required = false) @@ -646,7 +664,11 @@ public class Configuration { @ApiModelProperty(notes = "A groovy expression for Reference checker, GroovyChecker", required = false) GroovyConfiguration groovy; + String duration; + + @ApiModelProperty(notes = "How to transform the value before checking it", required = false) + @Nullable TransformationConfigurationDescription transformation = new TransformationConfigurationDescription(); @ApiModelProperty(notes = "If true the value can't be null", required = false, example = "true", allowableValues = "true,false") @@ -661,8 +683,10 @@ public class Configuration { @ToString public static class TransformationConfigurationDescription implements TransformationConfiguration { - @ApiModelProperty(notes = "If true codifies the column value", required = false, example = "true", allowableValues = "true,false") + @ApiModelProperty(notes = "If true, codifies the column value. The value will be escaped to a format suitable for a naturel key. Will be applied after 'groovy' expression if both are active.", required = false, example = "true", allowableValues = "true,false") boolean codify; + + @ApiModelProperty(notes = "A groovy expression to transform the value before the checker checks it", required = false) GroovyConfiguration groovy; } @@ -682,7 +706,7 @@ public class Configuration { @ApiModelProperty(notes = "The list of references values in database to add to groovy context", required = false) Set<String> references = new LinkedHashSet<>(); - @ApiModelProperty(notes = "The list of datatypes values in database to add to groovy context", required = false) + @ApiModelProperty(notes = "The list of data types values in database to add to groovy context", required = false) Set<String> datatypes = new LinkedHashSet<>(); } @@ -691,10 +715,10 @@ public class Configuration { @ToString public static class DataGroupDescription extends InternationalizationImpl { - @ApiModelProperty(notes = "The name of the datagroup", required = true, example = "localizations") + @ApiModelProperty(notes = "The name of the data group", required = true, example = "localizations") String label; - @ApiModelProperty(notes = "The list of variable in this datagroup", required = true) + @ApiModelProperty(notes = "The list of variables in this data group", required = true) Set<String> data = new LinkedHashSet<>(); } @@ -703,13 +727,13 @@ public class Configuration { @ToString public static class ApplicationDescription extends InternationalizationImpl { - @ApiModelProperty(notes = "The unique name of the application",required = true, example = "ACBB") + @ApiModelProperty(notes = "The unique name of the application", required = true, example = "ACBB") String name; - @ApiModelProperty(notes = "The version incremental version number of this yaml description of this application",required = true, example = "1") + @ApiModelProperty(notes = "The version incremental version number of this yaml description of this application", required = true, example = "1") int version; - @ApiModelProperty(notes = "The default language if none is provided",required = false, example = "fr") + @ApiModelProperty(notes = "The default language if none is provided", required = false, example = "fr") Locale defaultLanguage; public InternationalizationApplicationMap getInternationalization() { @@ -727,10 +751,10 @@ public class Configuration { @ApiModelProperty(notes = "The migration strategy", required = true, example = "ADD_VARIABLE", allowableValues = "ADD_VARIABLE") MigrationStrategy strategy; - @ApiModelProperty(notes = "A datagroup name", required = true, example = "variables") + @ApiModelProperty(notes = "A data group name", required = true, example = "variables") String dataGroup; - @ApiModelProperty(notes = "A variable in this datagroup", required = true, example = "CO2") + @ApiModelProperty(notes = "A variable in this data group", required = true, example = "CO2") String variable; @ApiModelProperty(notes = "A list of component migration description for this variable", required = true) -- GitLab From a79315015b3f2a6afd73dd39bf8437751f436c91 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Wed, 30 Mar 2022 17:09:52 +0200 Subject: [PATCH 29/41] Indentation du fichier Configuration --- .../fr/inra/oresing/model/Configuration.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/main/java/fr/inra/oresing/model/Configuration.java b/src/main/java/fr/inra/oresing/model/Configuration.java index a7839e492..cffbd6f9e 100644 --- a/src/main/java/fr/inra/oresing/model/Configuration.java +++ b/src/main/java/fr/inra/oresing/model/Configuration.java @@ -52,27 +52,27 @@ public class Configuration { @ApiModelProperty(notes = "The set of requiredAuthorization of data.authorization section. Fill by aplication", required = false, hidden = true) private List<String> requiredAuthorizationsAttributes; - @ApiModelProperty(notes = "The version number of the yaml schema used to read the deposited yaml",required = true, example = "1") + @ApiModelProperty(notes = "The version number of the yaml schema used to read the deposited yaml", required = true, example = "1") private int version; @ApiModelProperty(notes = "The internationalization description from other sections. Fill by application", required = false, hidden = true) private InternationalizationMap internationalization; - @ApiModelProperty(notes = "A comment about this yaml",required = false, example = "Adding sites section") + @ApiModelProperty(notes = "A comment about this yaml", required = false, example = "Adding sites section") private String comment; - @ApiModelProperty(notes = "An Application description",required = true) + @ApiModelProperty(notes = "An Application description", required = true) private ApplicationDescription application; - @ApiModelProperty(notes = "A list of references indexed by name. A reference is used to describe other references or data..",required = true) + @ApiModelProperty(notes = "A list of references indexed by name. A reference is used to describe other references or data..", required = true) private LinkedHashMap<String, ReferenceDescription> references = new LinkedHashMap<>(); @ApiModelProperty(notes = "A composite reference allows you to link references according to an ''is in'' link. For example between a city and country reference.\n" + - "You can define several composite references, and a composite reference can contain only one reference or contain a recursion.\n" + - "All references used in a datatype.authorization.authorizationscope section must be composite.",required = true) + "You can define several composite references, and a composite reference can contain only one reference or contain a recursion.\n" + + "All references used in a datatype.authorization.authorizationscope section must be composite.", required = true) private LinkedHashMap<String, CompositeReferenceDescription> compositeReferences = new LinkedHashMap<>(); - @ApiModelProperty(notes = "A data type describes a set of data representing a cohesive set of measurements or observations. (values can be stored in one csv file format).",required = false) + @ApiModelProperty(notes = "A data type describes a set of data representing a cohesive set of measurements or observations. (values can be stored in one csv file format).", required = false) private LinkedHashMap<String, DataTypeDescription> dataTypes = new LinkedHashMap<>(); public InternationalizationMap getInternationalization() { @@ -198,7 +198,7 @@ public class Configuration { return computedColumns; } - public static Map<String, InternationalizationReferenceMap> getInternationalization(LinkedHashMap<String, ReferenceDescription> referenceDescriptionMap) { + public static Map<String, InternationalizationReferenceMap> getInternationalization(LinkedHashMap<String, ReferenceDescription> referenceDescriptionMap) { Map<String, InternationalizationReferenceMap> internationalizationReferenceMap = new HashMap<>(); for (Map.Entry<String, ReferenceDescription> entry : referenceDescriptionMap.entrySet()) { final String reference = entry.getKey(); @@ -560,7 +560,7 @@ public class Configuration { @Setter @ToString public static class Chart { - public static String VAR_SQL_TEMPLATE = "(\n" + + public static String VAR_SQL_TEMPLATE = "(\n" + "\t Array['%1$s','%2$s'],-- aggrégation\n" + "\t Array['%3$s','%4$s'], -- value\n" + "\t '%5$s',-- datatype\n" + @@ -597,7 +597,8 @@ public class Configuration { ); return sql; } - public static String toSQL( String dataType) { + + public static String toSQL(String dataType) { String sql = String.format( VAR_SQL_DEFAULT_TEMPLATE, dataType @@ -674,7 +675,7 @@ public class Configuration { @ApiModelProperty(notes = "If true the value can't be null", required = false, example = "true", allowableValues = "true,false") boolean required = true; - @ApiModelProperty(notes = "If MANY the value is a list of references for Reference checker", required = false, example ="MANY", allowableValues = "MANY,ONE") + @ApiModelProperty(notes = "If MANY the value is a list of references for Reference checker", required = false, example = "MANY", allowableValues = "MANY,ONE") Multiplicity multiplicity = Multiplicity.ONE; } -- GitLab From 6fa008092180aa0ef0debd1d5cfc684efa316c9d Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Wed, 30 Mar 2022 18:05:45 +0200 Subject: [PATCH 30/41] Supprime du code mort --- .../fr/inra/oresing/model/Configuration.java | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/main/java/fr/inra/oresing/model/Configuration.java b/src/main/java/fr/inra/oresing/model/Configuration.java index cffbd6f9e..d867d8ba7 100644 --- a/src/main/java/fr/inra/oresing/model/Configuration.java +++ b/src/main/java/fr/inra/oresing/model/Configuration.java @@ -1,9 +1,7 @@ package fr.inra.oresing.model; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; import com.google.common.collect.MoreCollectors; -import com.google.common.collect.Sets; import fr.inra.oresing.checker.CheckerTarget; import fr.inra.oresing.checker.DateLineCheckerConfiguration; import fr.inra.oresing.checker.FloatCheckerConfiguration; @@ -30,7 +28,6 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.util.CollectionUtils; import javax.annotation.Nullable; -import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; @@ -184,20 +181,6 @@ public class Configuration { return doGetStaticColumns().contains(column); } - public boolean hasColumn(String column) { - return doGetAllColumns().contains(column); - } - - public ImmutableSet<ReferenceColumn> doGetComputedColumns() { - Set<ReferenceColumn> usedInTransformationColumns = validations.values().stream() - .map(LineValidationRuleWithColumnsDescription::getColumns) - .flatMap(Collection::stream) - .map(ReferenceColumn::new) - .collect(Collectors.toUnmodifiableSet()); - ImmutableSet<ReferenceColumn> computedColumns = Sets.difference(usedInTransformationColumns, doGetStaticColumns()).immutableCopy(); - return computedColumns; - } - public static Map<String, InternationalizationReferenceMap> getInternationalization(LinkedHashMap<String, ReferenceDescription> referenceDescriptionMap) { Map<String, InternationalizationReferenceMap> internationalizationReferenceMap = new HashMap<>(); for (Map.Entry<String, ReferenceDescription> entry : referenceDescriptionMap.entrySet()) { -- GitLab From ac10da9d5c752879354185f8fabf3b2459db4dbb Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Thu, 31 Mar 2022 12:16:19 +0200 Subject: [PATCH 31/41] =?UTF-8?q?Renomme=20la=20description=20d'un=20varia?= =?UTF-8?q?ble=20en=20VariableDescription=20pour=20mieux=20distinguer=20du?= =?UTF-8?q?=20terme=20'Column'=20plut=C3=B4t=20pour=20les=20r=C3=A9f=C3=A9?= =?UTF-8?q?rentiels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/fr/inra/oresing/checker/CheckerFactory.java | 4 ++-- .../java/fr/inra/oresing/model/Configuration.java | 4 ++-- .../rest/ApplicationConfigurationService.java | 12 ++++++------ src/main/java/fr/inra/oresing/rest/OreSiService.java | 6 +++--- .../java/fr/inra/oresing/rest/RelationalService.java | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java index 327cd8e33..7781e9f25 100644 --- a/src/main/java/fr/inra/oresing/checker/CheckerFactory.java +++ b/src/main/java/fr/inra/oresing/checker/CheckerFactory.java @@ -79,9 +79,9 @@ public class CheckerFactory { Preconditions.checkArgument(app.getConfiguration().getDataTypes().containsKey(dataType), "Pas de type de données " + dataType + " dans " + app); Configuration.DataTypeDescription dataTypeDescription = app.getConfiguration().getDataTypes().get(dataType); ImmutableSet.Builder<LineChecker> checkersBuilder = ImmutableSet.builder(); - for (Map.Entry<String, Configuration.ColumnDescription> variableEntry : dataTypeDescription.getData().entrySet()) { + for (Map.Entry<String, Configuration.VariableDescription> variableEntry : dataTypeDescription.getData().entrySet()) { String variable = variableEntry.getKey(); - Configuration.ColumnDescription variableDescription = variableEntry.getValue(); + Configuration.VariableDescription variableDescription = variableEntry.getValue(); for (Map.Entry<String, Configuration.VariableComponentDescription> componentEntry : variableDescription.doGetAllComponentDescriptions().entrySet()) { String component = componentEntry.getKey(); VariableComponentKey variableComponentKey = new VariableComponentKey(variable, component); diff --git a/src/main/java/fr/inra/oresing/model/Configuration.java b/src/main/java/fr/inra/oresing/model/Configuration.java index d867d8ba7..8afb09959 100644 --- a/src/main/java/fr/inra/oresing/model/Configuration.java +++ b/src/main/java/fr/inra/oresing/model/Configuration.java @@ -285,7 +285,7 @@ public class Configuration { FormatDescription format; @ApiModelProperty(notes = "This section describes the data model, splitting each line of data in variable/components", required = true) - LinkedHashMap<String, ColumnDescription> data = new LinkedHashMap<>(); + LinkedHashMap<String, VariableDescription> data = new LinkedHashMap<>(); @ApiModelProperty(notes = "Some validations rules that will be checked at import. It will allow to make sure a line we import is consistent.", required = true) LinkedHashMap<String, LineValidationRuleWithVariableComponentsDescription> validations = new LinkedHashMap<>(); @@ -512,7 +512,7 @@ public class Configuration { @Getter @Setter @ToString - public static class ColumnDescription { + public static class VariableDescription { @ApiModelProperty(notes = "A description to create disponibilité charts", required = false) Chart chartDescription; diff --git a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java index 4a9393ded..8603d64ac 100644 --- a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java +++ b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java @@ -336,7 +336,7 @@ public class ApplicationConfigurationService { builder.recordAuthorizationScopeVariableComponentKeyMissingVariable(dataType, authorizationScopeName, variables); } else { String variable = authorizationScopeVariableComponentKey.getVariable(); - Configuration.ColumnDescription variableInDescription = dataTypeDescription.getData().get(variable); + Configuration.VariableDescription variableInDescription = dataTypeDescription.getData().get(variable); if (!dataTypeDescription.getData().containsKey(variable)) { builder.recordAuthorizationScopeVariableComponentKeyUnknownVariable(authorizationScopeVariableComponentKey, variables); } else { @@ -419,10 +419,10 @@ public class ApplicationConfigurationService { } private void verifyDatatypeCheckersExists(ConfigurationParsingResult.Builder builder, Configuration.DataTypeDescription dataTypeDescription, String dataType) { - for (Map.Entry<String, Configuration.ColumnDescription> columnDescriptionEntry : dataTypeDescription.getData().entrySet()) { - Configuration.ColumnDescription columnDescription = columnDescriptionEntry.getValue(); + for (Map.Entry<String, Configuration.VariableDescription> columnDescriptionEntry : dataTypeDescription.getData().entrySet()) { + Configuration.VariableDescription variableDescription = columnDescriptionEntry.getValue(); String variable = columnDescriptionEntry.getKey(); - for (Map.Entry<String, Configuration.VariableComponentDescription> variableComponentDescriptionEntry : columnDescription.doGetAllComponentDescriptions().entrySet()) { + for (Map.Entry<String, Configuration.VariableComponentDescription> variableComponentDescriptionEntry : variableDescription.doGetAllComponentDescriptions().entrySet()) { Configuration.VariableComponentDescription variableComponentDescription = variableComponentDescriptionEntry.getValue(); if (variableComponentDescription == null) { continue; @@ -467,9 +467,9 @@ public class ApplicationConfigurationService { } private void verifyDatatypeCheckerReferenceRefersToExistingReference(ConfigurationParsingResult.Builder builder, Set<String> references, String dataType, Configuration.DataTypeDescription dataTypeDescription) { - for (Map.Entry<String, Configuration.ColumnDescription> dataEntry : dataTypeDescription.getData().entrySet()) { + for (Map.Entry<String, Configuration.VariableDescription> dataEntry : dataTypeDescription.getData().entrySet()) { String datum = dataEntry.getKey(); - Configuration.ColumnDescription datumDescription = dataEntry.getValue(); + Configuration.VariableDescription datumDescription = dataEntry.getValue(); for (Map.Entry<String, Configuration.VariableComponentDescription> componentEntry : datumDescription.doGetAllComponentDescriptions().entrySet()) { String component = componentEntry.getKey(); Configuration.VariableComponentDescription variableComponentDescription = componentEntry.getValue(); diff --git a/src/main/java/fr/inra/oresing/rest/OreSiService.java b/src/main/java/fr/inra/oresing/rest/OreSiService.java index 4b8154d5f..7c74ceacf 100644 --- a/src/main/java/fr/inra/oresing/rest/OreSiService.java +++ b/src/main/java/fr/inra/oresing/rest/OreSiService.java @@ -1051,9 +1051,9 @@ public class OreSiService { variableComponentsFromRepository.add(variableComponentKey); } } - for (Map.Entry<String, Configuration.ColumnDescription> variableEntry : dataTypeDescription.getData().entrySet()) { + for (Map.Entry<String, Configuration.VariableDescription> variableEntry : dataTypeDescription.getData().entrySet()) { String variable = variableEntry.getKey(); - Configuration.ColumnDescription variableDescription = variableEntry.getValue(); + Configuration.VariableDescription variableDescription = variableEntry.getValue(); for (Map.Entry<String, Configuration.VariableComponentWithDefaultValueDescription> componentEntry : variableDescription.getComponents().entrySet()) { String component = componentEntry.getKey(); Configuration.VariableComponentWithDefaultValueDescription componentDescription = componentEntry.getValue(); @@ -1427,7 +1427,7 @@ public class OreSiService { } } - private Stream<VariableComponentKey> getVariableComponentKeys(Map.Entry<String, Configuration.ColumnDescription> entry) { + private Stream<VariableComponentKey> getVariableComponentKeys(Map.Entry<String, Configuration.VariableDescription> entry) { return entry.getValue().doGetAllComponents().stream() .map(componentName -> new VariableComponentKey(entry.getKey(), componentName)); } diff --git a/src/main/java/fr/inra/oresing/rest/RelationalService.java b/src/main/java/fr/inra/oresing/rest/RelationalService.java index 1a17e162a..da2be732d 100644 --- a/src/main/java/fr/inra/oresing/rest/RelationalService.java +++ b/src/main/java/fr/inra/oresing/rest/RelationalService.java @@ -252,7 +252,7 @@ public class RelationalService implements InitializingBean, DisposableBean { private ImmutableSet<VariableComponentKey> getVariableComponentKeys(Configuration.DataTypeDescription dataTypeDescription) { Set<VariableComponentKey> references = new LinkedHashSet<>(); - for (Map.Entry<String, Configuration.ColumnDescription> variableEntry : dataTypeDescription.getData().entrySet()) { + for (Map.Entry<String, Configuration.VariableDescription> variableEntry : dataTypeDescription.getData().entrySet()) { String variable = variableEntry.getKey(); for (String component : variableEntry.getValue().doGetAllComponents()) { references.add(new VariableComponentKey(variable, component)); -- GitLab From 4c336cb183972ee7ccb4f9939aff1221fe50e56f Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Thu, 31 Mar 2022 16:50:24 +0200 Subject: [PATCH 32/41] =?UTF-8?q?Permet=20de=20traduire=20le=20nom=20des?= =?UTF-8?q?=20r=C3=A8gles=20de=20validation=20par=20ligne=20(r=C3=A9f?= =?UTF-8?q?=C3=A9rentiels=20et=20donn=C3=A9es=20exp=C3=A9rimentales)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/inra/oresing/model/Configuration.java | 13 +++-- .../InternationalizationDataTypeMap.java | 1 + .../InternationalizationReferenceMap.java | 1 + src/test/resources/data/acbb/acbb.yaml | 18 ++++-- src/test/resources/data/acbb/acbb_v2.yaml | 3 +- .../data/duplication/duplication.yaml | 3 +- .../resources/data/foret/foret_essai.yaml | 57 ++++++++++++------- .../multiyaml/references/zones_etudes.yaml | 12 ++-- .../data/monsore/monsore-with-repository.yaml | 33 +++++++---- src/test/resources/data/monsore/monsore.yaml | 33 +++++++---- .../data/recursivite/recusivite.yaml | 6 +- .../resources/data/validation/fake-app.yaml | 3 +- 12 files changed, 123 insertions(+), 60 deletions(-) diff --git a/src/main/java/fr/inra/oresing/model/Configuration.java b/src/main/java/fr/inra/oresing/model/Configuration.java index 8afb09959..02f0f4cd4 100644 --- a/src/main/java/fr/inra/oresing/model/Configuration.java +++ b/src/main/java/fr/inra/oresing/model/Configuration.java @@ -1,6 +1,7 @@ package fr.inra.oresing.model; import com.google.common.collect.ImmutableList; +import com.google.common.collect.Maps; import com.google.common.collect.MoreCollectors; import fr.inra.oresing.checker.CheckerTarget; import fr.inra.oresing.checker.DateLineCheckerConfiguration; @@ -10,6 +11,7 @@ import fr.inra.oresing.checker.IntegerCheckerConfiguration; import fr.inra.oresing.checker.Multiplicity; import fr.inra.oresing.checker.ReferenceLineCheckerConfiguration; import fr.inra.oresing.checker.RegularExpressionCheckerConfiguration; +import fr.inra.oresing.model.internationalization.Internationalization; import fr.inra.oresing.model.internationalization.InternationalizationApplicationMap; import fr.inra.oresing.model.internationalization.InternationalizationAuthorisationMap; import fr.inra.oresing.model.internationalization.InternationalizationAuthorisationName; @@ -190,6 +192,9 @@ public class Configuration { internationalizationReference.setInternationalizationDisplay(referenceDescription.getInternationalizationDisplay()); internationalizationReference.setInternationalizationName(referenceDescription.getInternationalizationName()); internationalizationReference.setInternationalizedColumns(referenceDescription.getInternationalizedColumns()); + Map<String, Internationalization> internationalizedValidations = + Maps.transformValues(referenceDescription.getValidations(), InternationalizationImpl::getInternationalizationName); + internationalizationReference.setInternationalizedValidations(internationalizedValidations); internationalizationReferenceMap.put(reference, internationalizationReference); } return internationalizationReferenceMap; @@ -312,6 +317,9 @@ public class Configuration { internationalizationDataTypeMap.setInternationalizationName(dataTypeDescription.getInternationalizationName()); internationalizationDataTypeMap.setInternationalizedColumns(dataTypeDescription.getInternationalizedColumns()); internationalizationDataTypeMap.setAuthorization(Optional.ofNullable(dataTypeDescription.getAuthorization()).map(AuthorizationDescription::getInternationalization).orElse(null)); + Map<String, Internationalization> internationalizedValidations = + Maps.transformValues(dataTypeDescription.getValidations(), InternationalizationImpl::getInternationalizationName); + internationalizationDataTypeMap.setInternationalizedValidations(internationalizedValidations); internationalizationDataTypeMapMap.put(datatype, internationalizationDataTypeMap); } return internationalizationDataTypeMapMap; @@ -320,10 +328,7 @@ public class Configuration { @Getter @Setter - public static abstract class LineValidationRuleDescription { - - @ApiModelProperty(notes = "A description of the validation. If the validation fail: this message will be shown to the user so one can fix the imported file", required = false) - String description; + public static abstract class LineValidationRuleDescription extends InternationalizationImpl { @ApiModelProperty(notes = "The checker to apply to ensure that the rule is respected", required = true) CheckerDescription checker; diff --git a/src/main/java/fr/inra/oresing/model/internationalization/InternationalizationDataTypeMap.java b/src/main/java/fr/inra/oresing/model/internationalization/InternationalizationDataTypeMap.java index 28410175e..37f46e28c 100644 --- a/src/main/java/fr/inra/oresing/model/internationalization/InternationalizationDataTypeMap.java +++ b/src/main/java/fr/inra/oresing/model/internationalization/InternationalizationDataTypeMap.java @@ -12,4 +12,5 @@ public class InternationalizationDataTypeMap { Map<String, Internationalization> internationalizedColumns; InternationalizationAuthorisationMap authorization; Map<String, InternationalizationDisplay> internationalizationDisplay; + Map<String, Internationalization> internationalizedValidations; } \ No newline at end of file diff --git a/src/main/java/fr/inra/oresing/model/internationalization/InternationalizationReferenceMap.java b/src/main/java/fr/inra/oresing/model/internationalization/InternationalizationReferenceMap.java index 3046d6af6..d8625d9a3 100644 --- a/src/main/java/fr/inra/oresing/model/internationalization/InternationalizationReferenceMap.java +++ b/src/main/java/fr/inra/oresing/model/internationalization/InternationalizationReferenceMap.java @@ -11,4 +11,5 @@ public class InternationalizationReferenceMap { Internationalization internationalizationName; Map<String, Internationalization> internationalizedColumns; InternationalizationDisplay internationalizationDisplay; + Map<String, Internationalization> internationalizedValidations; } \ No newline at end of file diff --git a/src/test/resources/data/acbb/acbb.yaml b/src/test/resources/data/acbb/acbb.yaml index 114c82feb..f39f92860 100644 --- a/src/test/resources/data/acbb/acbb.yaml +++ b/src/test/resources/data/acbb/acbb.yaml @@ -15,14 +15,16 @@ references: keyColumns: [nom du site_key] validations: agroecosystemRef: - description: "référence à l'agroécosystème" + internationalizationName: + fr: "référence à l'agroécosystème" checker: name: Reference params: refType: agroecosystemes columns: [ Agroécosystème ] checkDateMiseEnService: - description: "validation de date" + internationalizationName: + fr: "validation de date" checker: name: Date params: @@ -62,7 +64,8 @@ references: blocs: validations: creationDate: - description: "date de création" + internationalizationName: + fr: "date de création" checker: name: Date params: @@ -119,7 +122,8 @@ references: modalites: validations: modalitesRef: - description: "référence aux modalités" + internationalizationName: + fr: "référence aux modalités" columns: [ modalites ] checker: name: Reference @@ -145,7 +149,8 @@ dataTypes: component: datetime validations: check_CO2_value: - description: check value in range + internationalizationName: + fr: check value in range checker: name: GroovyExpression params: @@ -1623,7 +1628,8 @@ dataTypes: refType: unites validations: swcQualityEnumeration: - description: "Si renseignée, la qualité du taux d'humidité vaut 1, 2 ou 3" + internationalizationName: + fr: "Si renseignée, la qualité du taux d'humidité vaut 1, 2 ou 3" checker: name: GroovyExpression params: diff --git a/src/test/resources/data/acbb/acbb_v2.yaml b/src/test/resources/data/acbb/acbb_v2.yaml index a22cf8f31..d83c935bf 100644 --- a/src/test/resources/data/acbb/acbb_v2.yaml +++ b/src/test/resources/data/acbb/acbb_v2.yaml @@ -844,7 +844,8 @@ dataTypes: qualité: validations: swcQualityEnumeration: - description: "Si renseignée, la qualité du taux d'humidité vaut 1, 2 ou 3" + internationalizationName: + fr: "Si renseignée, la qualité du taux d'humidité vaut 1, 2 ou 3" checker: name: GroovyExpression params: diff --git a/src/test/resources/data/duplication/duplication.yaml b/src/test/resources/data/duplication/duplication.yaml index 3be80c429..805d61d41 100644 --- a/src/test/resources/data/duplication/duplication.yaml +++ b/src/test/resources/data/duplication/duplication.yaml @@ -15,7 +15,8 @@ references: zones_etudes: validations: parent_ref: - description: référence au parent + internationalizationName: + fr: référence au parent columns: [ parent ] checker: name: Reference diff --git a/src/test/resources/data/foret/foret_essai.yaml b/src/test/resources/data/foret/foret_essai.yaml index 33c1496b7..5a146dbc6 100644 --- a/src/test/resources/data/foret/foret_essai.yaml +++ b/src/test/resources/data/foret/foret_essai.yaml @@ -33,7 +33,8 @@ references: zones_etudes: validations: typeSitesRef: - description: référence au type de site + internationalizationName: + fr: référence au type de site columns: [ type de site ] checker: name: Reference @@ -43,7 +44,8 @@ references: transformation: codify: true parent_ref: - description: référence au parent + internationalizationName: + fr: référence au parent columns: [ parent ] checker: name: Reference @@ -53,14 +55,16 @@ references: transformation: codify: true date début: - description: date de début + internationalizationName: + fr: date de début checker: name: Date params: pattern: dd/MM/yyyy columns: [ date début ] date fin: - description: date de fin + internationalizationName: + fr: date de fin checker: name: Date params: @@ -132,14 +136,16 @@ references: theme_types_de_donnees_par_zone_etudes: validations: siteRef: - description: référence au site + internationalizationName: + fr: référence au site columns: [ nom du site ] checker: name: Reference params: refType: zones_etudes themeRef: - description: référence au thème + internationalizationName: + fr: référence au thème columns: [ nom du thème ] checker: name: Reference @@ -205,7 +211,8 @@ references: variables_par_types_de_donnees: validations: variableRef: - description: référence à la variable + internationalizationName: + fr: référence à la variable columns: [ nom de la variable ] checker: name: Reference @@ -215,7 +222,8 @@ references: transformation: codify: true uniteRef: - description: référence à l'unité' + internationalizationName: + fr: référence à l'unité' columns: [ nom de l'unité ] checker: name: Reference @@ -243,7 +251,8 @@ references: traitements: validations: siteRef: - description: référence au site + internationalizationName: + fr: référence au site columns: [ nom du site ] checker: name: Reference @@ -325,7 +334,8 @@ references: instruments_references: validations: instrumentRef: - description: référence à l'instrument + internationalizationName: + fr: référence à l'instrument columns: [ code de l'instrument ] checker: name: Reference @@ -335,7 +345,8 @@ references: transformation: codify: true DOIRef: - description: référence à la référence + internationalizationName: + fr: référence à la référence columns: [ doi de la référence ] checker: name: Reference @@ -399,7 +410,8 @@ references: codify: true validations: instrumentRef: - description: référence à l'instrument + internationalizationName: + fr: référence à l'instrument columns: [ Code de l'instrument ] checker: name: Reference @@ -456,7 +468,8 @@ references: methodes_references: validations: instrumentRef: - description: référence à la méthode + internationalizationName: + fr: référence à la méthode columns: [ code de la méthode de calcul ] checker: name: Reference @@ -466,7 +479,8 @@ references: transformation: codify: true DOIRef: - description: référence à la référence + internationalizationName: + fr: référence à la référence columns: [ doi de la référence ] checker: name: Reference @@ -531,7 +545,8 @@ references: codify: true validations: methodeRef: - description: référence à la méthode + internationalizationName: + fr: référence à la méthode columns: [ Code de la méthode de calcul ] checker: name: Reference @@ -541,7 +556,8 @@ references: transformation: codify: true dates: - description: Les dates sont des jours + internationalizationName: + fr: Les dates sont des jours columns: [ Date de début, Date de fin ] checker: name: Date @@ -592,7 +608,8 @@ references: en: '{libellé d''une valeur_fr}' validations: listeRef: - description: référence à la liste de valeurs d'informations complémentaires + internationalizationName: + fr: référence à la liste de valeurs d'informations complémentaires columns: [ nom de la liste ] checker: name: Reference @@ -611,7 +628,8 @@ references: informations_complementaires: validations: methodeRef: - description: référence à la liste de valeurs d'informations complémentaires + internationalizationName: + fr: référence à la liste de valeurs d'informations complémentaires columns: [ nom de la liste de valeurs d'informations complémentaires ] checker: name: Reference @@ -714,7 +732,8 @@ references: - nom columns: nom: null - description: null + internationalizationName: + fr: null dataTypes: ts_infraj: internationalizationName: diff --git a/src/test/resources/data/foret/multiyaml/references/zones_etudes.yaml b/src/test/resources/data/foret/multiyaml/references/zones_etudes.yaml index 854da1b27..93f498274 100644 --- a/src/test/resources/data/foret/multiyaml/references/zones_etudes.yaml +++ b/src/test/resources/data/foret/multiyaml/references/zones_etudes.yaml @@ -1,6 +1,7 @@ validations: typeSitesRef: - description: référence au type de site + internationalizationName: + fr: référence au type de site checker: name: Reference params: @@ -10,7 +11,8 @@ validations: transformation: codify: true parent_ref: - description: référence au parent + internationalizationName: + fr: référence au parent checker: name: Reference params: @@ -20,14 +22,16 @@ validations: transformation: codify: true date début: - description: date de début + internationalizationName: + fr: date de début checker: name: Date params: pattern: dd/MM/yyyy columns: date début date fin: - description: date de fin + internationalizationName: + fr: date de fin checker: name: Date params: diff --git a/src/test/resources/data/monsore/monsore-with-repository.yaml b/src/test/resources/data/monsore/monsore-with-repository.yaml index c3c70c07c..49432b15c 100644 --- a/src/test/resources/data/monsore/monsore-with-repository.yaml +++ b/src/test/resources/data/monsore/monsore-with-repository.yaml @@ -63,14 +63,16 @@ references: sites: validations: typeSitesRef: - description: référence au type de site + internationalizationName: + fr: référence au type de site checker: name: Reference params: refType: type_de_sites columns: [ tze_type_nom ] siteParentRef: - description: référence à la colonne parent + internationalizationName: + fr: référence à la colonne parent checker: name: Reference params: @@ -185,28 +187,32 @@ references: {nom du thème}, data type name : {nom du type de données} validations: projetRef: - description: référence au projet + internationalizationName: + fr: référence au projet checker: name: Reference params: refType: projet columns: [ nom du projet ] sitesRef: - description: référence au site + internationalizationName: + fr: référence au site checker: name: Reference params: refType: sites columns: [ nom du site ] themesRef: - description: référence au theme + internationalizationName: + fr: référence au theme checker: name: Reference params: refType: themes columns: [ nom du thème ] checkDatatype: - description: test + internationalizationName: + fr: test checker: name: GroovyExpression params: @@ -301,21 +307,24 @@ references: variables_et_unites_par_types_de_donnees: validations: variableRef: - description: référence à la variable + internationalizationName: + fr: référence à la variable checker: name: Reference params: refType: variables columns: [ nom de la variable ] uniteRef: - description: référence à l'unité' + internationalizationName: + fr: référence à l'unité' checker: name: Reference params: refType: unites columns: [ nom de l'unité ] checkDatatype: - description: test + internationalizationName: + fr: test checker: name: GroovyExpression params: @@ -442,7 +451,8 @@ dataTypes: required: null validations: unitOfColor: - description: vérifie l'unité de la couleur des individus + internationalizationName: + fr: vérifie l'unité de la couleur des individus checker: name: GroovyExpression params: @@ -459,7 +469,8 @@ dataTypes: references: - variables_et_unites_par_types_de_donnees unitOfIndividus: - description: vérifie l'unité du nombre d'individus + internationalizationName: + fr: vérifie l'unité du nombre d'individus checker: name: GroovyExpression params: diff --git a/src/test/resources/data/monsore/monsore.yaml b/src/test/resources/data/monsore/monsore.yaml index c4ba4a440..b2f684fb8 100644 --- a/src/test/resources/data/monsore/monsore.yaml +++ b/src/test/resources/data/monsore/monsore.yaml @@ -63,14 +63,16 @@ references: sites: validations: typeSitesRef: - description: référence au type de site + internationalizationName: + fr: référence au type de site checker: name: Reference params: refType: type_de_sites columns: [ tze_type_nom ] siteParentRef: - description: référence à la colonne parent + internationalizationName: + fr: référence à la colonne parent checker: name: Reference params: @@ -186,28 +188,32 @@ references: {nom du thème}, data type name : {nom du type de données} validations: projetRef: - description: référence au projet + internationalizationName: + fr: référence au projet checker: name: Reference params: refType: projet columns: [ nom du projet ] sitesRef: - description: référence au site + internationalizationName: + fr: référence au site checker: name: Reference params: refType: sites columns: [ nom du site ] themesRef: - description: référence au theme + internationalizationName: + fr: référence au theme checker: name: Reference params: refType: themes columns: [ nom du thème ] checkDatatype: - description: test + internationalizationName: + fr: test checker: name: GroovyExpression params: @@ -302,21 +308,24 @@ references: variables_et_unites_par_types_de_donnees: validations: variableRef: - description: référence à la variable + internationalizationName: + fr: référence à la variable checker: name: Reference params: refType: variables columns: [ nom de la variable ] uniteRef: - description: référence à l'unité' + internationalizationName: + fr: référence à l'unité' checker: name: Reference params: refType: unites columns: [ nom de l'unité ] checkDatatype: - description: test + internationalizationName: + fr: test checker: name: GroovyExpression params: @@ -441,7 +450,8 @@ dataTypes: required: null validations: unitOfColor: - description: vérifie l'unité de la couleur des individus + internationalizationName: + fr: vérifie l'unité de la couleur des individus checker: name: GroovyExpression params: @@ -458,7 +468,8 @@ dataTypes: references: - variables_et_unites_par_types_de_donnees unitOfIndividus: - description: vérifie l'unité du nombre d'individus + internationalizationName: + fr: vérifie l'unité du nombre d'individus checker: name: GroovyExpression params: diff --git a/src/test/resources/data/recursivite/recusivite.yaml b/src/test/resources/data/recursivite/recusivite.yaml index b6c723e0b..89b0eecc3 100644 --- a/src/test/resources/data/recursivite/recusivite.yaml +++ b/src/test/resources/data/recursivite/recusivite.yaml @@ -29,7 +29,8 @@ references: keyColumns: [nom du taxon déterminé] validations: nom du taxon déterminé: - description: "nom du taxon déterminé" + internationalizationName: + fr: "nom du taxon déterminé" checker: name: RegularExpression params: @@ -39,7 +40,8 @@ references: codify: true columns: [ nom du taxon déterminé ] nom du taxon superieur: - description: "nom du taxon superieur" + internationalizationName: + fr: "nom du taxon superieur" checker: name: Reference params: diff --git a/src/test/resources/data/validation/fake-app.yaml b/src/test/resources/data/validation/fake-app.yaml index 15c6f1908..59cac1270 100644 --- a/src/test/resources/data/validation/fake-app.yaml +++ b/src/test/resources/data/validation/fake-app.yaml @@ -171,7 +171,8 @@ dataTypes: standardDeviation: validations: exempledeDeRegleDeValidation: - description: "Juste un exemple" + internationalizationName: + fr: "Juste un exemple" checker: name: GroovyExpression params: -- GitLab From 9d86484b4c31b855f7e788fcb18e9a33cae58b51 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Tue, 5 Apr 2022 15:29:47 +0200 Subject: [PATCH 33/41] Factorise la validation des checkers dans validation du YAML --- .../inra/oresing/checker/CheckerTarget.java | 2 + .../fr/inra/oresing/model/Configuration.java | 10 + .../inra/oresing/model/ReferenceColumn.java | 5 + .../oresing/model/VariableComponentKey.java | 5 + .../rest/ApplicationConfigurationService.java | 388 ++++++++++++++---- .../rest/ConfigurationParsingResult.java | 118 +++++- .../inra/oresing/rest/RelationalService.java | 16 +- .../ApplicationConfigurationServiceTest.java | 6 +- ui/src/locales/en.json | 150 +++---- ui/src/locales/fr.json | 150 +++---- ui/src/services/ErrorsService.js | 162 ++++---- 11 files changed, 681 insertions(+), 331 deletions(-) diff --git a/src/main/java/fr/inra/oresing/checker/CheckerTarget.java b/src/main/java/fr/inra/oresing/checker/CheckerTarget.java index ab75c9827..128f94109 100644 --- a/src/main/java/fr/inra/oresing/checker/CheckerTarget.java +++ b/src/main/java/fr/inra/oresing/checker/CheckerTarget.java @@ -10,6 +10,8 @@ public interface CheckerTarget { @Deprecated CheckerTargetType getType(); + String toHumanReadableString(); + enum CheckerTargetType { PARAM_VARIABLE_COMPONENT_KEY("variableComponentKey"),PARAM_COLUMN("column"); diff --git a/src/main/java/fr/inra/oresing/model/Configuration.java b/src/main/java/fr/inra/oresing/model/Configuration.java index 02f0f4cd4..c87f26ae4 100644 --- a/src/main/java/fr/inra/oresing/model/Configuration.java +++ b/src/main/java/fr/inra/oresing/model/Configuration.java @@ -1,6 +1,7 @@ package fr.inra.oresing.model; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; import com.google.common.collect.MoreCollectors; import fr.inra.oresing.checker.CheckerTarget; @@ -324,6 +325,15 @@ public class Configuration { } return internationalizationDataTypeMapMap; } + + public ImmutableSet<VariableComponentKey> doGetAllVariableComponents() { + return getData().entrySet().stream().flatMap( + variableEntry -> { + String variable = variableEntry.getKey(); + return variableEntry.getValue().doGetAllComponents().stream() + .map(component -> new VariableComponentKey(variable, component)); + }).collect(ImmutableSet.toImmutableSet()); + } } @Getter diff --git a/src/main/java/fr/inra/oresing/model/ReferenceColumn.java b/src/main/java/fr/inra/oresing/model/ReferenceColumn.java index 4eedfacc4..f6172478a 100644 --- a/src/main/java/fr/inra/oresing/model/ReferenceColumn.java +++ b/src/main/java/fr/inra/oresing/model/ReferenceColumn.java @@ -31,4 +31,9 @@ public class ReferenceColumn implements CheckerTarget, SomethingToBeStoredAsJson public CheckerTargetType getType() { return CheckerTargetType.PARAM_COLUMN; } + + @Override + public String toHumanReadableString() { + return column; + } } diff --git a/src/main/java/fr/inra/oresing/model/VariableComponentKey.java b/src/main/java/fr/inra/oresing/model/VariableComponentKey.java index c1904a8eb..319ba0c79 100644 --- a/src/main/java/fr/inra/oresing/model/VariableComponentKey.java +++ b/src/main/java/fr/inra/oresing/model/VariableComponentKey.java @@ -32,6 +32,11 @@ public class VariableComponentKey implements CheckerTarget { return CheckerTargetType.PARAM_VARIABLE_COMPONENT_KEY; } + @Override + public String toHumanReadableString() { + return String.format("%s/%s", variable, component); + } + public String toSqlExtractPattern(){ return String.format("aggreg.datavalues #>> '{%s,%s}'%n",variable.replaceAll("'", "''"), component.replaceAll("'", "''")); } diff --git a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java index 8603d64ac..b52b2dd94 100644 --- a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java +++ b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java @@ -11,11 +11,13 @@ import com.google.common.collect.Multiset; import com.google.common.collect.Sets; import com.google.common.collect.TreeMultiset; import fr.inra.oresing.OreSiTechnicalException; +import fr.inra.oresing.checker.CheckerTarget; import fr.inra.oresing.checker.GroovyConfiguration; import fr.inra.oresing.checker.GroovyLineChecker; import fr.inra.oresing.groovy.GroovyExpression; import fr.inra.oresing.model.Configuration; import fr.inra.oresing.model.LocalDateTimeRange; +import fr.inra.oresing.model.ReferenceColumn; import fr.inra.oresing.model.VariableComponentKey; import fr.inra.oresing.model.internationalization.InternationalizationDataTypeMap; import fr.inra.oresing.model.internationalization.InternationalizationDisplay; @@ -46,8 +48,14 @@ import java.util.stream.Collectors; @Slf4j public class ApplicationConfigurationService { public static final List INTERNATIONALIZED_FIELDS = List.of("internationalization", "internationalizationName", "internationalizedColumns", "internationalizationDisplay"); - private static final ImmutableSet<String> CHECKER_ON_TARGET_NAMES = ImmutableSet.of("Date", "Float", "Integer", "RegularExpression", "Reference"); + private static final ImmutableSet<String> CHECKER_ON_TARGET_NAMES = + ImmutableSet.of("Date", "Float", "Integer", "RegularExpression", "Reference"); + + private static final ImmutableSet<String> ALL_CHECKER_NAMES = ImmutableSet.<String>builder() + .addAll(CHECKER_ON_TARGET_NAMES) + .add(GroovyLineChecker.NAME) + .build(); ConfigurationParsingResult unzipConfiguration(MultipartFile file){ return null; @@ -112,15 +120,15 @@ public class ApplicationConfigurationService { verifyReferenceKeyColumns( builder, referenceEntry); verifyInternationalizedColumnsExists(configuration, builder, referenceEntry); verifyInternationalizedColumnsExistsForPattern(configuration, builder, referenceEntry); - verifyValidationCheckersAreValids( builder, referenceEntry, references); + verifyReferenceColumnsDeclarations(builder, referenceEntry, references); + verifyReferenceValidationRules(builder, referenceEntry, references); } for (Map.Entry<String, Configuration.DataTypeDescription> entry : configuration.getDataTypes().entrySet()) { String dataType = entry.getKey(); Configuration.DataTypeDescription dataTypeDescription = entry.getValue(); - verifyDatatypeCheckersExists(builder, dataTypeDescription, dataType); - verifyDatatypeCheckerReferenceRefersToExistingReference(builder, references, dataType, dataTypeDescription); - verifyDatatypeCheckerGroovyExpressionExistsAndCanCompile(builder, dataTypeDescription); + verifyDataTypeVariableComponentDeclarations(builder, references, dataType, dataTypeDescription); + verifyDataTypeValidationRules(builder, dataType, dataTypeDescription, references); verifyInternationalizedColumnsExistsForPatternInDatatype(configuration, builder, dataType); verifyUniquenessComponentKeysInDatatype(dataType, dataTypeDescription, builder); @@ -418,55 +426,72 @@ public class ApplicationConfigurationService { } } - private void verifyDatatypeCheckersExists(ConfigurationParsingResult.Builder builder, Configuration.DataTypeDescription dataTypeDescription, String dataType) { - for (Map.Entry<String, Configuration.VariableDescription> columnDescriptionEntry : dataTypeDescription.getData().entrySet()) { - Configuration.VariableDescription variableDescription = columnDescriptionEntry.getValue(); - String variable = columnDescriptionEntry.getKey(); - for (Map.Entry<String, Configuration.VariableComponentDescription> variableComponentDescriptionEntry : variableDescription.doGetAllComponentDescriptions().entrySet()) { - Configuration.VariableComponentDescription variableComponentDescription = variableComponentDescriptionEntry.getValue(); - if (variableComponentDescription == null) { - continue; - } - String component = variableComponentDescriptionEntry.getKey(); - Configuration.CheckerDescription checker = variableComponentDescription.getChecker(); - if (checker == null) { - continue; - } - ImmutableSet<String> variableComponentCheckers = ImmutableSet.of("Date", "Float", "Integer", "RegularExpression", "Reference"); + private void verifyDataTypeValidationRules(ConfigurationParsingResult.Builder builder, final String dataType, Configuration.DataTypeDescription dataTypeDescription, final Set<String> references) { + LineValidationRuleDescriptionValidationContext lineValidationRuleDescriptionValidationContext = new LineValidationRuleDescriptionValidationContext() { - if (!variableComponentCheckers.contains(checker.getName())) { - builder.recordUnknownCheckerNameForVariableComponentChecker(dataType, variable, component, checker.getName(), variableComponentCheckers); - } + @Override + public Set<String> getReferences() { + return references; } - } - } - private void verifyDatatypeCheckerGroovyExpressionExistsAndCanCompile(ConfigurationParsingResult.Builder builder, Configuration.DataTypeDescription dataTypeDescription) { - for (Map.Entry<String, Configuration.LineValidationRuleWithVariableComponentsDescription> validationEntry : dataTypeDescription.getValidations().entrySet()) { - Configuration.LineValidationRuleWithVariableComponentsDescription lineValidationRuleDescription = validationEntry.getValue(); - String lineValidationRuleKey = validationEntry.getKey(); - Configuration.CheckerDescription checker = lineValidationRuleDescription.getChecker(); - if (GroovyLineChecker.NAME.equals(checker.getName())) { - String expression = Optional.of(checker) - .map(Configuration.CheckerDescription::getParams) - .map(Configuration.CheckerConfigurationDescription::getGroovy) - .map(GroovyConfiguration::getExpression) - .orElse(null); - if (StringUtils.isBlank(expression)) { - builder.recordMissingRequiredExpression(lineValidationRuleKey); - } else { - Optional<GroovyExpression.CompilationError> compileResult = GroovyLineChecker.validateExpression(expression); - compileResult.ifPresent(compilationError -> builder.recordIllegalGroovyExpression(lineValidationRuleKey, expression, compilationError)); - } - } else if (CHECKER_ON_TARGET_NAMES.contains(checker.getName())) { - // TODO - } else { - builder.recordUnknownCheckerName(lineValidationRuleKey, checker.getName()); + @Override + public Set<CheckerTarget> getAcceptableCheckerTargets() { + return ImmutableSet.copyOf(dataTypeDescription.doGetAllVariableComponents()); + } + + @Override + public void recordUnknownCheckerNameForVariableComponentChecker(String validationRuleDescriptionEntryKey, String checkerName, ImmutableSet<String> checkerOnTargetNames) { + builder.recordUnknownCheckerNameForVariableComponentCheckerInDataType(validationRuleDescriptionEntryKey, dataType, checkerName, checkerOnTargetNames); + } + + @Override + public void unknownReferenceForChecker(String validationRuleDescriptionEntryKey, String refType, Set<String> references) { + builder.unknownReferenceForCheckerInDataType(validationRuleDescriptionEntryKey, dataType, refType, references); + } + + @Override + public void missingReferenceForChecker(String validationRuleDescriptionEntryKey, Set<String> references) { + builder.missingReferenceForCheckerInDataType(validationRuleDescriptionEntryKey, dataType, references); + } + + @Override + public void recordMissingRequiredExpression(String validationRuleDescriptionEntryKey) { + builder.missingRequiredExpressionForValidationRuleInDataType(validationRuleDescriptionEntryKey, dataType); + } + + @Override + public void recordIllegalGroovyExpression(String validationRuleDescriptionEntryKey, String expression, GroovyExpression.CompilationError compilationError) { + builder.illegalGroovyExpressionForValidationRuleInDataType(validationRuleDescriptionEntryKey, dataType, expression, compilationError); + } + + @Override + public void missingParamColumnReferenceForChecker(String validationRuleDescriptionEntryKey) { + builder.missingParamColumnReferenceForCheckerInDataType(validationRuleDescriptionEntryKey, dataType); } + + @Override + public void missingColumnReferenceForChecker(String validationRuleDescriptionEntryKey, String checkerName, Set<CheckerTarget> knownColumns, ImmutableSet<CheckerTarget> missingColumns) { + builder.missingColumnReferenceForCheckerInDataType( + validationRuleDescriptionEntryKey, + knownColumns.stream().map(CheckerTarget::toHumanReadableString).collect(ImmutableSet.toImmutableSet()), + checkerName, + missingColumns.stream().map(CheckerTarget::toHumanReadableString).collect(ImmutableSet.toImmutableSet()), + dataType); + } + + @Override + public void recordUnknownCheckerNameForValidationRule(String validationRuleDescriptionEntryKey, String checkerName, ImmutableSet<String> allCheckerNames) { + builder.recordUnknownCheckerNameForValidationRuleInDataType(validationRuleDescriptionEntryKey, dataType, checkerName, allCheckerNames); + } + }; + for (Map.Entry<String, Configuration.LineValidationRuleWithVariableComponentsDescription> validationRuleDescriptionEntry : dataTypeDescription.getValidations().entrySet()) { + String validationRuleDescriptionEntryKey = validationRuleDescriptionEntry.getKey(); + Configuration.LineValidationRuleWithVariableComponentsDescription lineValidationRuleDescription = validationRuleDescriptionEntry.getValue(); + verifyLineValidationRuleDescription(lineValidationRuleDescriptionValidationContext, validationRuleDescriptionEntryKey, lineValidationRuleDescription); } } - private void verifyDatatypeCheckerReferenceRefersToExistingReference(ConfigurationParsingResult.Builder builder, Set<String> references, String dataType, Configuration.DataTypeDescription dataTypeDescription) { + private void verifyDataTypeVariableComponentDeclarations(ConfigurationParsingResult.Builder builder, Set<String> references, String dataType, Configuration.DataTypeDescription dataTypeDescription) { for (Map.Entry<String, Configuration.VariableDescription> dataEntry : dataTypeDescription.getData().entrySet()) { String datum = dataEntry.getKey(); Configuration.VariableDescription datumDescription = dataEntry.getValue(); @@ -475,18 +500,100 @@ public class ApplicationConfigurationService { Configuration.VariableComponentDescription variableComponentDescription = componentEntry.getValue(); if (variableComponentDescription != null) { Configuration.CheckerDescription checkerDescription = variableComponentDescription.getChecker(); - if ("Reference".equals(checkerDescription.getName())) { - if (checkerDescription.getParams() != null && checkerDescription.getParams().getRefType() != null) { - String refType = checkerDescription.getParams().getRefType(); - if (!references.contains(refType)) { + if (checkerDescription != null) { + verifyCheckerOnOneTarget(new CheckerOnOneTargetValidationContext() { + @Override + public Set<String> getReferences() { + return references; + } + + @Override + public void unknownReferenceForChecker(String refType, Set<String> references) { + // OK builder.unknownReferenceForChecker(dataType, datum, component, refType, references); } - } else { - builder.missingReferenceForChecker(dataType, datum, component, references); + + @Override + public void missingReferenceForChecker(Set<String> references) { + // OK + builder.missingReferenceForChecker(dataType, datum, component, references); + } + + @Override + public void unknownCheckerOnOneTargetName(String checkerName, ImmutableSet<String> knownCheckerNames) { + // OK + builder.recordUnknownCheckerNameForVariableComponentChecker(dataType, datum, component, checkerName, knownCheckerNames); + } + }, checkerDescription); + } + } + } + } + } + + private void verifyReferenceColumnsDeclarations(ConfigurationParsingResult.Builder builder, Map.Entry<String, Configuration.ReferenceDescription> referenceEntry, Set<String> references) { + String referenceToValidate = referenceEntry.getKey(); + Configuration.ReferenceDescription referenceDescription = referenceEntry.getValue(); + for (Map.Entry<String, Configuration.ReferenceStaticColumnDescription> columnEntry : referenceDescription.doGetStaticColumnDescriptions().entrySet()) { + String column = columnEntry.getKey(); + Configuration.ReferenceStaticColumnDescription referenceStaticColumnDescription = columnEntry.getValue(); + if (referenceStaticColumnDescription != null) { + Configuration.CheckerDescription checkerDescription = referenceStaticColumnDescription.getChecker(); + if (checkerDescription != null) { + verifyCheckerOnOneTarget(new CheckerOnOneTargetValidationContext() { + @Override + public Set<String> getReferences() { + return references; + } + + @Override + public void unknownReferenceForChecker(String refType, Set<String> knownReferences) { + // OK + builder.unknownReferenceForCheckerInReferenceColumn(referenceToValidate, column, refType, knownReferences); } + + @Override + public void missingReferenceForChecker(Set<String> knownReferences) { + // OK + builder.missingReferenceForCheckerInReferenceColumn(referenceToValidate, column, knownReferences); + } + + @Override + public void unknownCheckerOnOneTargetName(String checkerName, ImmutableSet<String> knownCheckerNames) { + // OK + builder.unknownCheckerNameInReferenceColumn(referenceToValidate, column, checkerName, knownCheckerNames); + } + }, checkerDescription); + } + } + } + } + + private interface CheckerOnOneTargetValidationContext { + + Set<String> getReferences(); + + void unknownReferenceForChecker(String refType, Set<String> references); + + void missingReferenceForChecker(Set<String> references); + + void unknownCheckerOnOneTargetName(String checkerName, ImmutableSet<String> validCheckerNames); + } + + private void verifyCheckerOnOneTarget(CheckerOnOneTargetValidationContext builder, Configuration.CheckerDescription checkerDescription) { + if (CHECKER_ON_TARGET_NAMES.contains(checkerDescription.getName())) { + if ("Reference".equals(checkerDescription.getName())) { + if (checkerDescription.getParams() != null && checkerDescription.getParams().getRefType() != null) { + String refType = checkerDescription.getParams().getRefType(); + if (!builder.getReferences().contains(refType)) { + builder.unknownReferenceForChecker(refType, builder.getReferences()); } + } else { + builder.missingReferenceForChecker(builder.getReferences()); } } + } else { + builder.unknownCheckerOnOneTargetName(checkerDescription.getName(), CHECKER_ON_TARGET_NAMES); } } @@ -632,52 +739,153 @@ public class ApplicationConfigurationService { } } - private void verifyValidationCheckersAreValids(ConfigurationParsingResult.Builder builder, Map.Entry<String, Configuration.ReferenceDescription> referenceEntry, Set<String> references) { + private void verifyReferenceValidationRules(ConfigurationParsingResult.Builder builder, Map.Entry<String, Configuration.ReferenceDescription> referenceEntry, Set<String> references) { String reference = referenceEntry.getKey(); Configuration.ReferenceDescription referenceDescription = referenceEntry.getValue(); + LineValidationRuleDescriptionValidationContext lineValidationRuleDescriptionValidationContext = new LineValidationRuleDescriptionValidationContext() { + + @Override + public Set<String> getReferences() { + return references; + } + + @Override + public Set<CheckerTarget> getAcceptableCheckerTargets() { + return referenceDescription.doGetStaticColumns().stream() + .map(ReferenceColumn::new) + .collect(ImmutableSet.toImmutableSet()); + } + + @Override + public void recordUnknownCheckerNameForVariableComponentChecker(String validationRuleDescriptionEntryKey, String checkerName, ImmutableSet<String> checkerOnTargetNames) { + // OK + builder.recordUnknownCheckerNameForVariableComponentCheckerInReference(validationRuleDescriptionEntryKey, reference, checkerName, checkerOnTargetNames); + } + + @Override + public void unknownReferenceForChecker(String validationRuleDescriptionEntryKey, String refType, Set<String> references) { + // OK + builder.unknownReferenceForCheckerInReference(validationRuleDescriptionEntryKey, reference, refType, references); + } + + @Override + public void missingReferenceForChecker(String validationRuleDescriptionEntryKey, Set<String> references) { + // OK + builder.missingReferenceForCheckerInReference(validationRuleDescriptionEntryKey, reference, references); + } + + @Override + public void recordMissingRequiredExpression(String validationRuleDescriptionEntryKey) { + // OK + builder.missingRequiredExpressionForValidationRuleInReference(validationRuleDescriptionEntryKey, reference); + } + + @Override + public void recordIllegalGroovyExpression(String validationRuleDescriptionEntryKey, String expression, GroovyExpression.CompilationError compilationError) { + // OK + builder.illegalGroovyExpressionForValidationRuleInReference(validationRuleDescriptionEntryKey, reference, expression, compilationError); + } + + @Override + public void missingParamColumnReferenceForChecker(String validationRuleDescriptionEntryKey) { + // OK + builder.missingParamColumnReferenceForCheckerInReference(validationRuleDescriptionEntryKey, reference); + } + + @Override + public void missingColumnReferenceForChecker(String validationRuleDescriptionEntryKey, String checkerName, Set<CheckerTarget> knownColumns, ImmutableSet<CheckerTarget> missingColumns) { + builder.missingColumnReferenceForCheckerInReference( + validationRuleDescriptionEntryKey, + knownColumns.stream().map(CheckerTarget::toHumanReadableString).collect(ImmutableSet.toImmutableSet()), + checkerName, + missingColumns.stream().map(CheckerTarget::toHumanReadableString).collect(ImmutableSet.toImmutableSet()), + reference); + } + + @Override + public void recordUnknownCheckerNameForValidationRule(String validationRuleDescriptionEntryKey, String checkerName, ImmutableSet<String> allCheckerNames) { + // OK + builder.recordUnknownCheckerNameForValidationRuleInReference(validationRuleDescriptionEntryKey, reference, checkerName, allCheckerNames); + } + }; for (Map.Entry<String, Configuration.LineValidationRuleWithColumnsDescription> validationRuleDescriptionEntry : referenceDescription.getValidations().entrySet()) { String validationRuleDescriptionEntryKey = validationRuleDescriptionEntry.getKey(); Configuration.LineValidationRuleWithColumnsDescription lineValidationRuleDescription = validationRuleDescriptionEntry.getValue(); - Configuration.CheckerDescription checker = lineValidationRuleDescription.getChecker(); - if (checker == null) { - continue; + verifyLineValidationRuleDescription(lineValidationRuleDescriptionValidationContext, validationRuleDescriptionEntryKey, lineValidationRuleDescription); + } + } + + private interface LineValidationRuleDescriptionValidationContext { + + Set<String> getReferences(); + + Set<CheckerTarget> getAcceptableCheckerTargets(); + + void recordMissingRequiredExpression(String validationRuleDescriptionEntryKey); + + void recordIllegalGroovyExpression(String validationRuleDescriptionEntryKey, String expression, GroovyExpression.CompilationError compilationError); + + void missingParamColumnReferenceForChecker(String validationRuleDescriptionEntryKey); + + void missingColumnReferenceForChecker(String validationRuleDescriptionEntryKey, String checkerName, Set<CheckerTarget> knownColumns, ImmutableSet<CheckerTarget> missingColumns); + + void recordUnknownCheckerNameForVariableComponentChecker(String validationRuleDescriptionEntryKey, String name, ImmutableSet<String> checkerOnTargetNames); + + void unknownReferenceForChecker(String validationRuleDescriptionEntryKey, String refType, Set<String> references); + + void missingReferenceForChecker(String validationRuleDescriptionEntryKey, Set<String> references); + + void recordUnknownCheckerNameForValidationRule(String validationRuleDescriptionEntryKey, String checkerName, ImmutableSet<String> allCheckerNames); + } + + private void verifyLineValidationRuleDescription(LineValidationRuleDescriptionValidationContext builder, String validationRuleDescriptionEntryKey, Configuration.LineValidationRuleDescription lineValidationRuleDescription) { + Configuration.CheckerDescription checker = lineValidationRuleDescription.getChecker(); + if (GroovyLineChecker.NAME.equals(checker.getName())) { + String expression = Optional.of(checker) + .map(Configuration.CheckerDescription::getParams) + .map(Configuration.CheckerConfigurationDescription::getGroovy) + .map(GroovyConfiguration::getExpression) + .orElse(null); + if (StringUtils.isBlank(expression)) { + builder.recordMissingRequiredExpression(validationRuleDescriptionEntryKey); + } else { + Optional<GroovyExpression.CompilationError> compileResult = GroovyLineChecker.validateExpression(expression); + compileResult.ifPresent(compilationError -> builder.recordIllegalGroovyExpression(validationRuleDescriptionEntryKey, expression, compilationError)); } - if (GroovyLineChecker.NAME.equals(checker.getName())) { - String expression = Optional.of(checker) - .map(Configuration.CheckerDescription::getParams) - .map(Configuration.CheckerConfigurationDescription::getGroovy) - .map(GroovyConfiguration::getExpression) - .orElse(null); - if (StringUtils.isBlank(expression)) { - builder.recordMissingRequiredExpression(validationRuleDescriptionEntryKey); - } else { - Optional<GroovyExpression.CompilationError> compileResult = GroovyLineChecker.validateExpression(expression); - compileResult.ifPresent(compilationError -> builder.recordIllegalGroovyExpression(validationRuleDescriptionEntryKey, expression, compilationError)); + } else if (CHECKER_ON_TARGET_NAMES.contains(checker.getName())) { + if (lineValidationRuleDescription.doGetCheckerTargets().isEmpty()) { + builder.missingParamColumnReferenceForChecker(validationRuleDescriptionEntryKey); + } else { + Set<CheckerTarget> columnsDeclaredInCheckerConfiguration = lineValidationRuleDescription.doGetCheckerTargets(); + Set<CheckerTarget> knownColumns = builder.getAcceptableCheckerTargets(); + ImmutableSet<CheckerTarget> missingColumns = Sets.difference(columnsDeclaredInCheckerConfiguration, knownColumns).immutableCopy(); + if (!missingColumns.isEmpty()) { + builder.missingColumnReferenceForChecker(validationRuleDescriptionEntryKey, checker.getName(), knownColumns, missingColumns); } - } else if (CHECKER_ON_TARGET_NAMES.contains(checker.getName())) { - if (lineValidationRuleDescription.getColumns().isEmpty()) { - builder.missingParamColumnReferenceForCheckerInReference(validationRuleDescriptionEntryKey, reference); - } else { - Set<String> columnsDeclaredInCheckerConfiguration = lineValidationRuleDescription.getColumns(); - Set<String> knownColumns = referenceDescription.doGetAllColumns(); - ImmutableSet<String> missingColumns = Sets.difference(columnsDeclaredInCheckerConfiguration, knownColumns).immutableCopy(); - if (!missingColumns.isEmpty()) { - builder.missingColumnReferenceForCheckerInReference(validationRuleDescriptionEntryKey, knownColumns, checker.getName(), missingColumns, reference); - } + } + verifyCheckerOnOneTarget(new CheckerOnOneTargetValidationContext() { + @Override + public Set<String> getReferences() { + return builder.getReferences(); } - if ("Reference".equals(checker.getName())) { - if (checker.getParams().getRefType() != null) { - String refType = checker.getParams().getRefType(); - if (!references.contains(refType)) { - builder.unknownReferenceForCheckerInReference(validationRuleDescriptionEntryKey, reference, refType, references); - } - } else { - builder.missingReferenceForCheckerInReference(validationRuleDescriptionEntryKey, reference, references); - } + + @Override + public void unknownReferenceForChecker(String refType, Set<String> references) { + builder.unknownReferenceForChecker(validationRuleDescriptionEntryKey, refType, references); } - } else { - builder.recordUnknownCheckerNameForVariableComponentCheckerInReference(validationRuleDescriptionEntryKey, reference, checker.getName(), CHECKER_ON_TARGET_NAMES); - } + + @Override + public void missingReferenceForChecker(Set<String> references) { + builder.missingReferenceForChecker(validationRuleDescriptionEntryKey, references); + } + + @Override + public void unknownCheckerOnOneTargetName(String checkerName, ImmutableSet<String> validCheckerNames) { + builder.recordUnknownCheckerNameForVariableComponentChecker(validationRuleDescriptionEntryKey, checkerName, validCheckerNames); + } + }, checker); + } else { + builder.recordUnknownCheckerNameForValidationRule(validationRuleDescriptionEntryKey, checker.getName(), ALL_CHECKER_NAMES); } } diff --git a/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java b/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java index 278821102..5d8545b0f 100644 --- a/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java +++ b/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java @@ -80,6 +80,13 @@ public class ConfigurationParsingResult { "references", references)); } + public Builder missingReferenceForCheckerInDataType(String validationKey, String dataType, Set<String> references) { + return recordError("missingReferenceForCheckerInDataType", ImmutableMap.of( + "validationKey", validationKey, + "dataType", dataType, + "references", references)); + } + public Builder missingReferenceForChecker(String dataType, String datum, String component, Set<String> references) { return recordError("missingReferenceForChecker", ImmutableMap.of("dataType", dataType, "datum", datum, @@ -95,6 +102,14 @@ public class ConfigurationParsingResult { "references", references)); } + public Builder unknownReferenceForCheckerInDataType(String validationKey, String dataType, String refType, Set<String> references) { + return recordError("unknownReferenceForCheckerInDataType", ImmutableMap.of( + "validationKey", validationKey, + "refType", refType, + "dataType", dataType, + "references", references)); + } + public Builder unknownReferenceForChecker(String dataType, String datum, String component, String refType, Set<String> references) { return recordError("unknownReferenceForChecker", ImmutableMap.of("dataType", dataType, "datum", datum, @@ -210,34 +225,63 @@ public class ConfigurationParsingResult { )); } - public Builder recordMissingRequiredExpression(String lineValidationRuleKey) { - return recordError("missingRequiredExpression", ImmutableMap.of( - "lineValidationRuleKey", lineValidationRuleKey + public Builder missingRequiredExpressionForValidationRuleInDataType(String lineValidationRuleKey, String dataType) { + return recordError("missingRequiredExpressionForValidationRuleInDataType", ImmutableMap.of( + "lineValidationRuleKey", lineValidationRuleKey, + "dataType", dataType + )); + } + + public Builder missingRequiredExpressionForValidationRuleInReference(String lineValidationRuleKey, String reference) { + return recordError("missingRequiredExpressionForValidationRuleInReference", ImmutableMap.of( + "lineValidationRuleKey", lineValidationRuleKey, + "reference", reference )); } - public Builder recordIllegalGroovyExpression(String lineValidationRuleKey, String expression, GroovyExpression.CompilationError compilationError) { - return recordError("illegalGroovyExpression", ImmutableMap.of( + public Builder illegalGroovyExpressionForValidationRuleInDataType(String lineValidationRuleKey, String dataType, String expression, GroovyExpression.CompilationError compilationError) { + return recordError("illegalGroovyExpressionForValidationRuleInDataType", ImmutableMap.of( "lineValidationRuleKey", lineValidationRuleKey, + "dataType", dataType, "expression", expression, "compilationError", compilationError )); } - public Builder recordUnknownCheckerName(String lineValidationRuleKey, String checkerName) { - return recordError("unknownCheckerName", ImmutableMap.of( + public Builder illegalGroovyExpressionForValidationRuleInReference(String lineValidationRuleKey, String reference, String expression, GroovyExpression.CompilationError compilationError) { + return recordError("illegalGroovyExpressionForValidationRuleInReference", ImmutableMap.of( + "lineValidationRuleKey", lineValidationRuleKey, + "reference", reference, + "expression", expression, + "compilationError", compilationError + )); + } + + public Builder recordUnknownCheckerNameForValidationRuleInReference(String lineValidationRuleKey, String reference, String checkerName, ImmutableSet<String> allCheckerNames) { + return recordError("unknownCheckerNameForValidationRuleInReference", ImmutableMap.of( + "lineValidationRuleKey", lineValidationRuleKey, + "reference", reference, + "allCheckerNames", allCheckerNames, + "checkerName", checkerName + )); + } + + public Builder recordUnknownCheckerNameForValidationRuleInDataType(String lineValidationRuleKey, String dataType, String checkerName, ImmutableSet<String> allCheckerNames) { + return recordError("unknownCheckerNameForValidationRuleInDataType", ImmutableMap.of( "lineValidationRuleKey", lineValidationRuleKey, + "dataType", dataType, + "allCheckerNames", allCheckerNames, "checkerName", checkerName )); } - public Builder recordUnknownCheckerNameForVariableComponentChecker(String dataType, String variable, String component, String checkerName, ImmutableSet<String> variableComponentCheckers) { + public Builder recordUnknownCheckerNameForVariableComponentChecker(String dataType, String variable, String component, String checkerName, ImmutableSet<String> knownCheckerNames) { return recordError("unknownCheckerNameForVariableComponent", ImmutableMap.of( "datatype", dataType, "variable", variable, "component", component, "checkerName", checkerName, - "knownsCheckers", variableComponentCheckers + "knownCheckerNames", knownCheckerNames )); } @@ -301,12 +345,31 @@ public class ConfigurationParsingResult { )); } - public Builder recordUnknownCheckerNameForVariableComponentCheckerInReference(String validationRuleDescriptionEntryKey, String reference, String name, ImmutableSet<String> variableComponentCheckers) { + public Builder missingColumnReferenceForCheckerInDataType(String validationRuleDescriptionEntryKey, Set<String> knownVariableComponents, String name, ImmutableSet<String> missingVariableComponents, String dataType) { + return recordError("missingColumnReferenceForCheckerInDataType", ImmutableMap.of( + "dataType", dataType, + "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, + "knownVariableComponents", knownVariableComponents, + "checkerName", name, + "missingVariableComponents", missingVariableComponents + )); + } + + public Builder recordUnknownCheckerNameForVariableComponentCheckerInReference(String validationRuleDescriptionEntryKey, String reference, String name, ImmutableSet<String> checkerOnTargetNames) { return recordError("unknownCheckerNameForVariableComponentCheckerInReference", ImmutableMap.of( "reference", reference, "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, "name", name, - "variableComponentCheckers", variableComponentCheckers + "checkerOnTargetNames", checkerOnTargetNames + )); + } + + public Builder recordUnknownCheckerNameForVariableComponentCheckerInDataType(String validationRuleDescriptionEntryKey, String dataType, String name, ImmutableSet<String> checkerOnTargetNames) { + return recordError("unknownCheckerNameForVariableComponentCheckerInDataType", ImmutableMap.of( + "dataType", dataType, + "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, + "name", name, + "checkerOnTargetNames", checkerOnTargetNames )); } @@ -317,6 +380,13 @@ public class ConfigurationParsingResult { )); } + public Builder missingParamColumnReferenceForCheckerInDataType(String validationRuleDescriptionEntryKey, String dataType) { + return recordError("missingParamColumnReferenceForCheckerInDataType", ImmutableMap.of( + "dataType", dataType, + "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey + )); + } + public Builder missingAuthorizationsForDatatype(String dataType) { return recordError("missingAuthorizationForDatatype", ImmutableMap.of( "datatype", dataType @@ -478,5 +548,31 @@ public class ConfigurationParsingResult { "dataType", dataType )); } + + public Builder unknownReferenceForCheckerInReferenceColumn(String referenceToValidate, String column, String refType, Set<String> knownReferences) { + return recordError("unknownReferenceForCheckerInReferenceColumn", ImmutableMap.of( + "referenceToValidate", referenceToValidate, + "column", column, + "refType", refType, + "knownReferences", knownReferences + )); + } + + public Builder missingReferenceForCheckerInReferenceColumn(String referenceToValidate, String column, Set<String> knownReferences) { + return recordError("missingReferenceForCheckerInReferenceColumn", ImmutableMap.of( + "referenceToValidate", referenceToValidate, + "column", column, + "knownReferences", knownReferences + )); + } + + public Builder unknownCheckerNameInReferenceColumn(String referenceToValidate, String column, String checkerName, ImmutableSet<String> knownCheckerNames) { + return recordError("unknownCheckerNameInReferenceColumn", ImmutableMap.of( + "referenceToValidate", referenceToValidate, + "column", column, + "checkerName", checkerName, + "knownCheckerNames", knownCheckerNames + )); + } } } diff --git a/src/main/java/fr/inra/oresing/rest/RelationalService.java b/src/main/java/fr/inra/oresing/rest/RelationalService.java index da2be732d..5c88dec09 100644 --- a/src/main/java/fr/inra/oresing/rest/RelationalService.java +++ b/src/main/java/fr/inra/oresing/rest/RelationalService.java @@ -2,7 +2,6 @@ package fr.inra.oresing.rest; import com.google.common.base.Joiner; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSetMultimap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; @@ -203,7 +202,7 @@ public class RelationalService implements InitializingBean, DisposableBean { String dataAfterDataGroupsMergingQuery = repository.getRepository(application).data().getSqlToMergeData(DownloadDatasetQuery.buildDownloadDatasetQuery(null, appId.toString(), dataType, application)); String withClause = "WITH " + dataTableName + " AS (" + dataAfterDataGroupsMergingQuery + ")"; - for (VariableComponentKey variableComponentKey : getVariableComponentKeys(dataTypeDescription)) { + for (VariableComponentKey variableComponentKey : dataTypeDescription.doGetAllVariableComponents()) { String variable = variableComponentKey.getVariable(); String component = variableComponentKey.getComponent(); String escapedVariableName = StringUtils.replace(variable, "'", "''"); @@ -250,17 +249,6 @@ public class RelationalService implements InitializingBean, DisposableBean { return views; } - private ImmutableSet<VariableComponentKey> getVariableComponentKeys(Configuration.DataTypeDescription dataTypeDescription) { - Set<VariableComponentKey> references = new LinkedHashSet<>(); - for (Map.Entry<String, Configuration.VariableDescription> variableEntry : dataTypeDescription.getData().entrySet()) { - String variable = variableEntry.getKey(); - for (String component : variableEntry.getValue().doGetAllComponents()) { - references.add(new VariableComponentKey(variable, component)); - } - } - return ImmutableSet.copyOf(references); - } - private List<ViewCreationCommand> getDenormalizedViewsForDataTypes(SqlSchemaForRelationalViewsForApplication sqlSchema, Application application) { List<ViewCreationCommand> views = new LinkedList<>(); for (Map.Entry<String, Configuration.DataTypeDescription> entry : application.getConfiguration().getDataTypes().entrySet()) { @@ -289,7 +277,7 @@ public class RelationalService implements InitializingBean, DisposableBean { Set<String> selectClauseElements = new LinkedHashSet<>(selectClauseReferenceElements); - getVariableComponentKeys(dataTypeDescription).stream() + dataTypeDescription.doGetAllVariableComponents().stream() .map(this::getColumnName) .map(columnName -> dataTableName + "." + columnName) .forEach(selectClauseElements::add); diff --git a/src/test/java/fr/inra/oresing/rest/ApplicationConfigurationServiceTest.java b/src/test/java/fr/inra/oresing/rest/ApplicationConfigurationServiceTest.java index 519004526..af7a9b828 100644 --- a/src/test/java/fr/inra/oresing/rest/ApplicationConfigurationServiceTest.java +++ b/src/test/java/fr/inra/oresing/rest/ApplicationConfigurationServiceTest.java @@ -385,7 +385,7 @@ public class ApplicationConfigurationServiceTest { Assert.assertFalse(configurationParsingResult.isValid()); ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); log.debug(onlyError.getMessage()); - Assert.assertEquals("missingRequiredExpression", onlyError.getMessage()); + Assert.assertEquals("missingRequiredExpressionForValidationRuleInDataType", onlyError.getMessage()); } @Test @@ -394,7 +394,7 @@ public class ApplicationConfigurationServiceTest { Assert.assertFalse(configurationParsingResult.isValid()); ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); log.debug(onlyError.getMessage()); - Assert.assertEquals("illegalGroovyExpression", onlyError.getMessage()); + Assert.assertEquals("illegalGroovyExpressionForValidationRuleInDataType", onlyError.getMessage()); } @Test @@ -403,7 +403,7 @@ public class ApplicationConfigurationServiceTest { Assert.assertFalse(configurationParsingResult.isValid()); ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); log.debug(onlyError.getMessage()); - Assert.assertEquals("unknownCheckerName", onlyError.getMessage()); + Assert.assertEquals("unknownCheckerNameForValidationRuleInDataType", onlyError.getMessage()); } @Test diff --git a/ui/src/locales/en.json b/ui/src/locales/en.json index 282c2c26a..2f97ffcda 100644 --- a/ui/src/locales/en.json +++ b/ui/src/locales/en.json @@ -93,93 +93,105 @@ "version" : "The current version of the application <b class=\"has-text-primary\">{applicationName}</b> is <b class=\"has-text-primary\">{version}.</b>" }, "errors":{ - "emptyFile":"File is empty", - "missingReferenceForChecker":"For data type <code>{dataType}</code>, datum <code>{datum}</code>, component <code>{component}</code>, you need to one of those references : <code>{references}</code>", - "missingReferenceForCheckerInReference":"For reference <code>{reference}</code> and validation <code>{validationKey}</code>, you need to one of those references : <code>{references}</code>", - "unknownReferenceForChecker":"For data type <code>{dataType}</code>, datum <code>{datum}</code>, component <code>{component}</code>, the reference <code>{refType}</code> is not in the accepted references which are: <code>{references}</code>", - "unknownReferenceForCheckerInReference":"For reference <code>{reference}</code> and validation <code>{validationKey}</code>, the reference <code>{refType}</code> is not in the accepted references which are: <code>{references}</code>", - "unsupportedVersion":"YAML files with version <code>{actualVersion}</code> aren't currently managed, expected version : <code>{expectedVersion}</code>", - "undeclaredDataGroupForVariable":"Variable <code>{variable}</code> doesn't belong to any data group, it needs to be in one", - "variableInMultipleDataGroup":"Variable <code>{variable}</code> is declared in several data groups, it needs to be only in one", - "unknownVariablesInDataGroup":"Data group <code>{dataGroup}</code> has undeclared data : <code>{unknownVariables}</code>. <br>Known data : <code>{variables}</code>", - "unknownReferenceInCompositereference": "The composite reference <code> {compositeReference} </code> contains references that are not declared <code> {unknownReferences} </code>. Known references <code> {references} </code>" , - "requiredReferenceInCompositeReferenceForParentKeyColumn": "No reference has been declared for the <i>parentKeyColumn</i> <code> {parentKeyColumn} </code> in the composite reference <code> {compositeReference} </code>.", - "requiredParentKeyColumnInCompositeReferenceForReference": "In the composite reference <code> {compositeReference} </code> the reference <code> {reference} </code> refers to <code> {referenceTo} </code> but does not declare a < i> parentKeyColumn </i>. ", - "missingParentColumnForReferenceInCompositeReference": "In the composite reference <code> {compositeReference} </code> the <i> parentKeyColumn </i> <code> {parentKeyColumn} </code> does not exist in the reference <code> {reference } </code>. ", - "missingParentRecursiveKeyColumnForReferenceInCompositeReference": "In the composite reference <code> {compositeReference} </code> the <i> parentRecursiveKey </i> <code> {parentRecursiveKey} </code> does not exist in the reference <code> {reference } </code>. ", - "missingTimeScopeVariableComponentKey":"Mandatory indication of the variable (and its component) used for the time period for which we need to attach the data for rights management of data type : <code>{dataType}</code>", - "missingReferenceInCompositereference": "All components of the composite reference <code> {compositeReference} </code> must declare a reference.", - "timeScopeVariableComponentKeyMissingVariable":"Mandatory indication of the variable in which we collect the time period for which we need to attach the data for rights management of data type : <code>{dataType}</code>. <br>Accepted values : <code>{variables}</code>", - "timeScopeVariableComponentKeyUnknownVariable":"<code>{variable}</code> doesn't be along to any of known variables : <code>{knownVariables}</code>", - "timeVariableComponentKeyMissingComponent":"Mandatory indication of the component of : <code>{variable}</code> in which we collect the time period for which we need to attach the data for rights management of data type : <code>{dataType}</code>. <br>Accepted values : <code>{knownComponents}</code>", - "timeVariableComponentKeyUnknownComponent":"<code>{component}</code> doesn't belong to any of known variables : <code>{variable}</code>. <br>Known components : <code>{knownComponents}</code>", - "timeScopeVariableComponentWrongChecker":"The component <code>{component}</code> of variable <code>{variable}</code> can't be used for carrying time information because it's not declared as : <code>{expectedChecker}</code>", - "timeScopeVariableComponentPatternUnknown":"The component <code>{component}</code> of variable <code>{variable}</code> can't be used for carrying time information because the date format : <code>{pattern}</code> isn't managed. <br>Accepted formats : <code>{knownPatterns}</code>", - "missingAuthorizationForDatatype":"The authorization section must be present in the description of the <code> {datatype} </code> data type", - "missingAuthorizationScopeVariableComponentKey":"You must indicate at least one group of variables (and their components) in which (s) we collect the spatial information to be attached to the data for the rights management dataset <code> {dataType } </code> ", "authorizationScopeVariableComponentKeyMissingVariable":"You must indicate the variable in which to collect the spatial information to which to attach the data for the management of the rights dataset <code> {dataType} </code> for the authorization <code> {authorizationName} </code>. Possible values ​​<code> {variables} </code> ", "authorizationScopeVariableComponentKeyUnknownVariable":"<code> {variable} </code> is not one of the known columns <code> {knownVariables} </code>", + "authorizationScopeVariableComponentReftypeNull":"No reference has been defined for the <code> {component} </code> component of the variable <code> {variable} </code>. Accepted references: <code> {knownPatterns} </ code> ", + "authorizationScopeVariableComponentReftypeUnknown":"The <code> {refType} </code> reference of the <code> {component} </code> component of the <code> {variable} </code> variable has not been declared. accepted: <code> {knownPatterns} </code> ", + "authorizationScopeVariableComponentWrongChecker":"The <code> {component} </code> component of the <code> {variable} </code> variable cannot be used as carrying time information because it is not declared data like <code> {expectedChecker} </code> ", "authorizationVariableComponentKeyMissingComponent":"You must indicate the component of the variable <code> {variable} </code> in which we collect the spatial information to which to attach the data for the management of rights dataset <code> {dataType} < / code> for authorization <code> {authorizationName} </code>. Possible values ​​<code> {knownComponents} </code> ", "authorizationVariableComponentKeyUnknownComponent":"<code> {component} </code> is not one of the known components for the variable <code> {variable} </code>. Known components: <code> {knownComponents} </code>", - "authorizationScopeVariableComponentWrongChecker":"The <code> {component} </code> component of the <code> {variable} </code> variable cannot be used as carrying time information because it is not declared data like <code> {expectedChecker} </code> ", - "authorizationScopeVariableComponentReftypeUnknown":"The <code> {refType} </code> reference of the <code> {component} </code> component of the <code> {variable} </code> variable has not been declared. accepted: <code> {knownPatterns} </code> ", - "authorizationScopeVariableComponentReftypeNull":"No reference has been defined for the <code> {component} </code> component of the variable <code> {variable} </code>. Accepted references: <code> {knownPatterns} </ code> ", - "unrecognizedProperty ":" Error at line <code> {lineNumber} </code> (column <code> {columnNumber} </code>): <code> {unknownPropertyName} </code>, c ' is not a recognized property. Recognized properties are <code> {knownProperties} </code> ", - "unrecognizedProperty":"Error in line <code>{lineNumber}</code> (column : <code>{columnNumber}</code>) : <code>{unknownPropertyName}</code>, is not a known property. <br>Known properties : <code>{knownProperties}</code>", - "invalidFormat":"Error in line : <code>{lineNumber}</code> (column : <code>{columnNumber}</code>) : <code>{value}</code> doesn't have the right format. <br>Expected format : <code>{targetTypeName}</code>", - "missingRequiredExpression":"For the validation rule <code>{lineValidationRuleKey}</code>, you have to write the expression to evaluate in order to verify that the data are following the rules.", - "illegalGroovyExpression":"For the validation rule : {lineValidationRuleKey}</code>, the expression : <code>{expression}</code> is not correct. Expression compilation error at line : <code>{compilationError.lineNumber}</code> (column : <code>{compilationError.columnNumber}</code>) message '<code>{compilationError.message}</code>'", - "unknownCheckerName":"For the validation rule : <code>{lineValidationRuleKey}</code>, '<code>{checkerName}</code>' is declared but is not a known checker", - "unknownCheckerNameForVariableComponentCheckerInReference":"In the reference validation <code> {reference} </code> and the validation rule <code> {validationRuleDescriptionEntryKey} </code>, '<code> {name} </code>' is declared but not a known check: possible values ​​<code> {variableComponentCheckers} </code>. ", + "badauthorizationscopeforrepository":"Authorization <code> {authorization} </code>) must be <code> {expectedValue} / code> and not <code> {givenValue} </code>", + "checkerExpressionReturnedFalse": "The following constraint is not respected: <code> {expression} </code>", "csvBoundToUnknownVariable":"In the CSV format, header <code>{header}</code> is bound to unknown variable <code>{variable}</code>. Known variables: <code>{variables}</code>", - "unknownCheckerNameForVariableComponent":"In the description of the data type {datatype} the component <code> {component} </code> of the variable <code> {variable} </code> the value checker <code> {checkerName} </code> is declared but it is not a known control <br /> Known checkers are <code>{variableComponentCheckers}</code>", - "missingColumnReferenceForCheckerInReference":"In the reference description {reference} and the validation <code> {validationRuleDescriptionEntryKey} </code> the value checker <code> {checkerName} </code> declares unknown columns <code> {missingColumns } </code>: possible values ​​<code> {knownColumns} </code> ", - "missingParamColumnReferenceForCheckerInReference":"In the description of the <code> {reference} </code>, the validation rule <code> {validationRuleDescriptionEntryKey} </code> does not specify on which columns the rule should be executed by declaring a <code> columns </code> parameter ", "csvBoundToUnknownVariableComponent":"In the CSV format, header <code>{header}</code> is bound to <code>{variable}</code> but it has no <code>{component}</code> component. Known components: <code>{components}</code>", - "invalidKeyColumns":"In the description of reference <code>{reference}</code>, colomns <code>{unknownUsedAsKeyElementColumns}</code> are declared as components of the key but there are no such columns. Known columns are <code>{knownColumns}</code>", - "missingKeyColumnsForReference": "In the description of reference <code>{reference}</code>, you must declare the components (at least one) of the key", - "invalidInternationalizedColumns":"In the repository description <code> {reference} </code>, the columns <code> {unknownUsedAsInternationalizedColumns} </code> are declared as part of internationalizable columns when they do not exist. Known columns: <code> {knownColumns} </code> ", - "invalidInternationalizedColumnsForDataType": "In the <code> {reference} </code> repository overload of the <code> {dataType} </code> data type description, the <code> {unknownUsedAsInternationalizedColumns} </code> columns are declared as part of internationalizable columns when they do not exist. Known columns: <code> {knownColumns} </code> ", - "unknownReferenceInDatatypeReferenceDisplay": "In the repository display overload of the <code> {dataType} </code> datatype description, the <code> {reference} </code> repository is unknown. Known repositories known : <code> {references} </code> ", - "unexpectedHeaderColumn":"Unexpected column header. Expected : <code>{expectedHeaderColumn}</code> <br />Actual : <code>{actualHeaderColumn}</code>", - "headerColumnPatternNotMatching":"Column header pattern not matching. Pattern to match : <code>{expectedHeaderColumnPattern}</code><br/>Actual header : <code>{actualHeaderColumn}</code>", - "unexpectedTokenCount":"Unexpected token count. Expected : <code>{expectedTokenCount}</code><br/>Actual header : <code>{actualHeader}</code> has <code>{actualTokenCount}</code> tokens", - "invalidHeaders":"Invalid headers. Expected columns : <code>{expectedColumns}</code><br/>Actual columns : <code>{actualColumns}</code><br/>Missing columns : <code>{missingColumns}</code><br/>Unknown columns : <code>{unknownColumns}</code>", - "emptyHeader": "The file contains a column with an empty header", + "duplicateLineInDatatype": "In data file {file}, line {lineNumber} has the same identifier {duplicateKey} as lines {otherLines}", + "duplicateLineInReference": "In the repository file {file}, line {lineNumber} has the same id {duplicateKey} as lines {otherLines}", "duplicatedHeaders":"These headers are duplicated : <code>{duplicatedHeaders}</code>", - "patternNotMatched": "For the identified component: <code> {target} </code> the value <code> {value} </code> does not respect the expected format: <code> {pattern} </code>. ", - "patternNotMatchedWithColumn": "For column: <code> {target} </code> the value <code> {value} </code> does not respect the expected format: <code> {pattern} </code>." , + "emptyFile":"File is empty", + "emptyHeader": "The file contains a column with an empty header", + "headerColumnPatternNotMatching":"Column header pattern not matching. Pattern to match : <code>{expectedHeaderColumnPattern}</code><br/>Actual header : <code>{actualHeaderColumn}</code>", + "illegalGroovyExpressionForValidationRuleInDataType":"For the validation rule <code>{lineValidationRuleKey}</code> in data type <code>{dataType}</code>, the expression : <code>{expression}</code> is not correct. Expression compilation error at line : <code>{compilationError.lineNumber}</code> (column : <code>{compilationError.columnNumber}</code>) message '<code>{compilationError.message}</code>'", + "illegalGroovyExpressionForValidationRuleInReference":"For the validation rule <code>{lineValidationRuleKey}</code> in reference <code>{reference}</code>, the expression : <code>{expression}</code> is not correct. Expression compilation error at line : <code>{compilationError.lineNumber}</code> (column : <code>{compilationError.columnNumber}</code>) message '<code>{compilationError.message}</code>'", "invalidDate": "For the identified component: <code> {target} </code> the date <code> {value} </code> does not respect the expected format: <code> {pattern} </code>. ", "invalidDateWithColumn": "For column: <code> {column} </code> the date <code> {value} </code> does not respect the expected format: <code> {pattern} </code>." , - "invalidInteger": "For the identified component: <code> {target} </code> the value <code> {value} </code> must be an integer.", - "invalidIntegerWithColumn": "For column: <code> {target} </code> the value <code> {value} </code> must be an integer.", "invalidFloat": "For the identified component: <code> {target} </code> the value <code> {value} </code> must be a decimal number.", "invalidFloatWithColumn": "For column: <code> {target} </code> the value <code> {value} </code> must be a decimal number.", + "invalidFormat":"Error in line : <code>{lineNumber}</code> (column : <code>{columnNumber}</code>) : <code>{value}</code> doesn't have the right format. <br>Expected format : <code>{targetTypeName}</code>", + "invalidHeaders":"Invalid headers. Expected columns : <code>{expectedColumns}</code><br/>Actual columns : <code>{actualColumns}</code><br/>Missing columns : <code>{missingColumns}</code><br/>Unknown columns : <code>{unknownColumns}</code>", + "invalidInteger": "For the identified component: <code> {target} </code> the value <code> {value} </code> must be an integer.", + "invalidIntegerWithColumn": "For column: <code> {target} </code> the value <code> {value} </code> must be an integer.", + "invalidInternationalizedColumns":"In the repository description <code> {reference} </code>, the columns <code> {unknownUsedAsInternationalizedColumns} </code> are declared as part of internationalizable columns when they do not exist. Known columns: <code> {knownColumns} </code> ", + "invalidInternationalizedColumnsForDataType": "In the <code> {reference} </code> repository overload of the <code> {dataType} </code> data type description, the <code> {unknownUsedAsInternationalizedColumns} </code> columns are declared as part of internationalizable columns when they do not exist. Known columns: <code> {knownColumns} </code> ", + "invalidKeyColumns":"In the description of reference <code>{reference}</code>, colomns <code>{unknownUsedAsKeyElementColumns}</code> are declared as components of the key but there are no such columns. Known columns are <code>{knownColumns}</code>", "invalidReference": "For the identified component: <code> {target} </code> the value <code> {value} </code> does not exist in the reference <code> {refType} </code>. Expected values ​​<code> {referenceValues} </code>. ", "invalidReferenceWithColumn": "For column: <code> {target} </code> the value <code> {value} </code> does not exist in the reference <code> {refType} </code>. Values expected <code> {referenceValues} </code>. ", - "checkerExpressionReturnedFalse": "The following constraint is not respected: <code> {expression} </code>", - "requiredValue": "For the identified component: <code> {target} </code> the value cannot be zero.", - "requiredValueWithColumn": "For column: <code> {target} </code> the value cannot be zero.", - "timerangeoutofinterval":"The date <code> {value} </code> is incompatible with the date range of the deposit. It must be between <code> {from} </code> and <code> {to} </code>. ", - "badauthorizationscopeforrepository":"Authorization <code> {authorization} </code>) must be <code> {expectedValue} / code> and not <code> {givenValue} </code>", - "overlappingpublishedversion":"There is a deposited version in the deposit dates have an overlapping period with the deposited version. <code> {overlapingFiles] </code>", - "unDeclaredValueForChart":"In the chart description of variable <code> {variable} </code> of data type <code> {dataType} </code>, the value is not declared.<br /> Expected values ​​<code>{components}</code>", - "missingValueComponentForChart":"In the chart description of variable <code>{variable}</code> of data type <code>{dataType}</code>, value <code>{valueComponent}</code> is not a declared component.<br /> Expected Values ​​<code>{components}</code>", - "missingAggregationVariableForChart":"In the chart description of variable <code>{variable}</code> of data type <code>{dataType}</code>, aggregation variable <code>{aggregationVariable}< /code> is not declared.<br /> Expected Values ​​<code>{variables}</code>", "missingAggregationComponentForChart":"In the graph description of variable <code>{variable}</code> of data type <code>{dataType}</code>, component <code>{aggregationComponent}</code> of the aggregation variable <code>{aggregationVariable}</code> is not declared.<br /> Expected Values ​​<code>{components}</code>", + "missingAggregationVariableForChart":"In the chart description of variable <code>{variable}</code> of data type <code>{dataType}</code>, aggregation variable <code>{aggregationVariable}< /code> is not declared.<br /> Expected Values ​​<code>{variables}</code>", + "missingAuthorizationForDatatype":"The authorization section must be present in the description of the <code> {datatype} </code> data type", + "missingAuthorizationScopeVariableComponentKey":"You must indicate at least one group of variables (and their components) in which (s) we collect the spatial information to be attached to the data for the rights management dataset <code> {dataType } </code> ", + "missingBoundToForConstantDescription": "In the format->constant section of the dataType {dataType} you must fill in the boundTo section.", + "missingColumnNumberOrHeaderNameForConstantDescription": "!!TODO", + "missingColumnReferenceForCheckerInDataType":"For the validation rule : <code>{lineValidationRuleKey}</code> in data type <code>{dataType}</code>, '<code>{checkerName}</code>' is declared but is not a known checker. Known checkers are <code>{checkerOnTargetNames}</code>", + "missingColumnReferenceForCheckerInReference":"In the reference description {reference} and the validation <code> {validationRuleDescriptionEntryKey} </code> the value checker <code> {checkerName} </code> declares unknown columns <code> {missingColumns } </code>: possible values ​​<code> {knownColumns} </code> ", + "missingExportHeaderNameForConstantDescription": "In the format->constant section of dataType {dataType} you must specify an exportHeaderName.", + "missingKeyColumnsForReference": "In the description of reference <code>{reference}</code>, you must declare the components (at least one) of the key", + "missingParamColumnReferenceForCheckerInDataType":"In the description of the <code> {dataType} </code>, the validation rule <code> {validationRuleDescriptionEntryKey} </code> does not specify on which variable/components the rule should be executed by declaring a <code> variableComponents </code> parameter ", + "missingParamColumnReferenceForCheckerInReference":"In the description of the <code> {reference} </code>, the validation rule <code> {validationRuleDescriptionEntryKey} </code> does not specify on which columns the rule should be executed by declaring a <code> columns </code> parameter ", + "missingParentColumnForReferenceInCompositeReference": "In the composite reference <code> {compositeReference} </code> the <i> parentKeyColumn </i> <code> {parentKeyColumn} </code> does not exist in the reference <code> {reference } </code>. ", + "missingParentLineInRecursiveReference": "In repository file {references} the id value {missingReferencesKey} for parent does not exist. Accepted values ${knownReferences}", + "missingParentRecursiveKeyColumnForReferenceInCompositeReference": "In the composite reference <code> {compositeReference} </code> the <i> parentRecursiveKey </i> <code> {parentRecursiveKey} </code> does not exist in the reference <code> {reference } </code>. ", + "missingReferenceForChecker":"For data type <code>{dataType}</code>, datum <code>{datum}</code>, component <code>{component}</code>, you need to one of those references : <code>{references}</code>", + "missingReferenceForCheckerInDataType":"For data type <code>{dataType}</code> and validation <code>{validationKey}</code>, you need to one of those references : <code>{references}</code>", + "missingReferenceForCheckerInReference":"For reference <code>{reference}</code> and validation <code>{validationKey}</code>, you need to one of those references : <code>{references}</code>", + "missingReferenceForCheckerInReferenceColumn": "For reference <code>{referenceToValidate}≤/code>, you must provide the reference to use to check <code>{column}</code> among <code>{knownReferences}</code>", + "missingReferenceInCompositereference": "All components of the composite reference <code> {compositeReference} </code> must declare a reference.", + "missingRequiredExpressionForValidationRuleInDataType":"For the validation rule <code>{lineValidationRuleKey}</code> of data type <code>{dataType}</code>, you have to write the expression to evaluate in order to verify that the data are following the rules.", + "missingRequiredExpressionForValidationRuleInReference":"For the validation rule <code>{lineValidationRuleKey}</code> of reference <code>{reference}</code>, you have to write the expression to evaluate in order to verify that the data are following the rules.", + "missingRowLineForConstantDescription": "In the format->constant section of dataType {dataType} you must specify a line number.", "missingStandardDeviationComponentForChart":"In the chart description of variable <code> {variable} </code> of data type <code> {dataType} </code>, the standard deviation <code> {standardDeviation}</ code> is not a declared component.<br /> Expected Values ​​<code>{components}</code>", + "missingTimeScopeVariableComponentKey":"Mandatory indication of the variable (and its component) used for the time period for which we need to attach the data for rights management of data type : <code>{dataType}</code>", "missingUnitComponentForChart":"In the chart description of variable <code> {variable} </code> of data type <code> {dataType} </code>, unit <code> {unit}</code > is not a declared component.<br /> Expected Values ​​<code>{components}</code>", - "duplicateLineInReference": "In the repository file {file}, line {lineNumber} has the same id {duplicateKey} as lines {otherLines}", - "duplicateLineInDatatype": "In data file {file}, line {lineNumber} has the same identifier {duplicateKey} as lines {otherLines}", - "missingParentLineInRecursiveReference": "In repository file {references} the id value {missingReferencesKey} for parent does not exist. Accepted values ${knownReferences}", - "unknownUsedAsVariableComponentUniqueness": "In the description of data type {dataType} in the <I>uniqueness</i> section component variable descriptions {unknownUsedAsVariableComponentUniqueness} do not exist. Accepted values {availableVariableComponents}", + "missingValueComponentForChart":"In the chart description of variable <code>{variable}</code> of data type <code>{dataType}</code>, value <code>{valueComponent}</code> is not a declared component.<br /> Expected Values ​​<code>{components}</code>", + "overlappingpublishedversion":"There is a deposited version in the deposit dates have an overlapping period with the deposited version. <code> {overlapingFiles] </code>", + "patternNotMatched": "For the identified component: <code> {target} </code> the value <code> {value} </code> does not respect the expected format: <code> {pattern} </code>. ", + "patternNotMatchedWithColumn": "For column: <code> {target} </code> the value <code> {value} </code> does not respect the expected format: <code> {pattern} </code>." , + "recordCsvMissingColumnNumberOrHeaderNameForConstantDescription": "In the format->constant section of dataType {dataType} you must specify a row number or header name.", + "requiredParentKeyColumnInCompositeReferenceForReference": "In the composite reference <code> {compositeReference} </code> the reference <code> {reference} </code> refers to <code> {referenceTo} </code> but does not declare a < i> parentKeyColumn </i>. ", + "requiredReferenceInCompositeReferenceForParentKeyColumn": "No reference has been declared for the <i>parentKeyColumn</i> <code> {parentKeyColumn} </code> in the composite reference <code> {compositeReference} </code>.", + "requiredValue": "For the identified component: <code> {target} </code> the value cannot be zero.", + "requiredValueWithColumn": "For column: <code> {target} </code> the value cannot be zero.", + "sameHeaderLineAndFirstRowLineForConstantDescription": "In the format->constant section of dataType {dataType} the header row must not be equal to the data row.", + "timeScopeVariableComponentKeyMissingVariable":"Mandatory indication of the variable in which we collect the time period for which we need to attach the data for rights management of data type : <code>{dataType}</code>. <br>Accepted values : <code>{variables}</code>", + "timeScopeVariableComponentKeyUnknownVariable":"<code>{variable}</code> doesn't be along to any of known variables : <code>{knownVariables}</code>", + "timeScopeVariableComponentPatternUnknown":"The component <code>{component}</code> of variable <code>{variable}</code> can't be used for carrying time information because the date format : <code>{pattern}</code> isn't managed. <br>Accepted formats : <code>{knownPatterns}</code>", + "timeScopeVariableComponentWrongChecker":"The component <code>{component}</code> of variable <code>{variable}</code> can't be used for carrying time information because it's not declared as : <code>{expectedChecker}</code>", + "timeVariableComponentKeyMissingComponent":"Mandatory indication of the component of : <code>{variable}</code> in which we collect the time period for which we need to attach the data for rights management of data type : <code>{dataType}</code>. <br>Accepted values : <code>{knownComponents}</code>", + "timeVariableComponentKeyUnknownComponent":"<code>{component}</code> doesn't belong to any of known variables : <code>{variable}</code>. <br>Known components : <code>{knownComponents}</code>", + "timerangeoutofinterval":"The date <code> {value} </code> is incompatible with the date range of the deposit. It must be between <code> {from} </code> and <code> {to} </code>. ", "tooBigRowLineForConstantDescription": "In the format->constant section of dataType {dataType} the row number must be less than the data row.", "tooLittleRowLineForConstantDescription": "In the format->constant section of dataType {dataType} the row number must be positive.", - "missingRowLineForConstantDescription": "In the format->constant section of dataType {dataType} you must specify a line number.", - "recordCsvMissingColumnNumberOrHeaderNameForConstantDescription": "In the format->constant section of dataType {dataType} you must specify a row number or header name.", - "missingBoundToForConstantDescription": "In the format->constant section of the dataType {dataType} you must fill in the boundTo section.", - "missingExportHeaderNameForConstantDescription": "In the format->constant section of dataType {dataType} you must specify an exportHeaderName.", - "sameHeaderLineAndFirstRowLineForConstantDescription": "In the format->constant section of dataType {dataType} the header row must not be equal to the data row." + "unDeclaredValueForChart":"In the chart description of variable <code> {variable} </code> of data type <code> {dataType} </code>, the value is not declared.<br /> Expected values ​​<code>{components}</code>", + "undeclaredDataGroupForVariable":"Variable <code>{variable}</code> doesn't belong to any data group, it needs to be in one", + "unexpectedHeaderColumn":"Unexpected column header. Expected : <code>{expectedHeaderColumn}</code> <br />Actual : <code>{actualHeaderColumn}</code>", + "unexpectedTokenCount":"Unexpected token count. Expected : <code>{expectedTokenCount}</code><br/>Actual header : <code>{actualHeader}</code> has <code>{actualTokenCount}</code> tokens", + "unknownCheckerNameForValidationRuleInDataType":"For the validation rule : <code>{lineValidationRuleKey}</code> in data type <code>{dataType}</code>, '<code>{checkerName}</code>' is declared but is not a known checker. Known checkers are <code>{checkerOnTargetNames}</code>", + "unknownCheckerNameForValidationRuleInReference":"For the validation rule : <code>{lineValidationRuleKey}</code> in reference <code>{reference}</code>, '<code>{checkerName}</code>' is declared but is not a known checker. Known checkers are <code>{checkerOnTargetNames}</code>", + "unknownCheckerNameForVariableComponent":"In the description of the data type {datatype} the component <code> {component} </code> of the variable <code> {variable} </code> the value checker <code> {checkerName} </code> is declared but it is not a known control <br /> Known checkers are <code>{knownCheckerNames}</code>", + "unknownCheckerNameForVariableComponentCheckerInDataType": "For the data type <code>{dataType}</code> and validation rule <code>{validationRuleDescriptionEntryKey}</code>, '<code>{name}</code>' is declared but it's not a known checker name: possible values are <code>{checkerOnTargetNames}</code>.", + "unknownCheckerNameForVariableComponentCheckerInReference": "In the reference validation <code> {reference} </code> and the validation rule <code> {validationRuleDescriptionEntryKey} </code>, '<code> {name} </code>' is declared but not a known check: possible values ​​<code> {variableComponentCheckers} </code>. ", + "unknownCheckerNameInReferenceColumn": "For reference <code>{referenceToValidate}</code>, the checker defined for column <code>{column}</code> is <code>{checkerName}</code>. It's not a known checker. Known checkers are <code>{knownCheckerNames}</code>", + "unknownIllegalException": "Unexpected error : <code>{cause}</code>", + "unknownReferenceForChecker":"For data type <code>{dataType}</code>, datum <code>{datum}</code>, component <code>{component}</code>, the reference <code>{refType}</code> is not in the accepted references which are: <code>{references}</code>", + "unknownReferenceForCheckerInDataType":"For data type <code>{dataType}</code> and validation <code>{validationKey}</code>, the reference <code>{refType}</code> is not in the accepted references which are: <code>{references}</code>", + "unknownReferenceForCheckerInReference":"For reference <code>{reference}</code> and validation <code>{validationKey}</code>, the reference <code>{refType}</code> is not in the accepted references which are: <code>{references}</code>", + "unknownReferenceForCheckerInReferenceColumn": "For reference <code>{referenceToValidate}</code> and column <code>{column}</code>, the reference to use to check the value is <code>{refType}</code> but it's not among known references <code>{knownReferences}</code>", + "unknownReferenceInCompositereference": "The composite reference <code> {compositeReference} </code> contains references that are not declared <code> {unknownReferences} </code>. Known references <code> {references} </code>" , + "unknownReferenceInDatatypeReferenceDisplay": "In the repository display overload of the <code> {dataType} </code> datatype description, the <code> {reference} </code> repository is unknown. Known repositories known : <code> {references} </code> ", + "unknownUsedAsVariableComponentUniqueness": "In the description of data type {dataType} in the <I>uniqueness</i> section component variable descriptions {unknownUsedAsVariableComponentUniqueness} do not exist. Accepted values {availableVariableComponents}", + "unknownVariablesInDataGroup":"Data group <code>{dataGroup}</code> has undeclared data : <code>{unknownVariables}</code>. <br>Known data : <code>{variables}</code>", + "unrecognizedProperty":"Error in line <code>{lineNumber}</code> (column : <code>{columnNumber}</code>) : <code>{unknownPropertyName}</code>, is not a known property. <br>Known properties : <code>{knownProperties}</code>", + "unsupportedVersion":"YAML files with version <code>{actualVersion}</code> aren't currently managed, expected version : <code>{expectedVersion}</code>", + "variableInMultipleDataGroup":"Variable <code>{variable}</code> is declared in several data groups, it needs to be only in one" }, "referencesManagement":{ "actions":"Actions", diff --git a/ui/src/locales/fr.json b/ui/src/locales/fr.json index 423c42e8a..79c86ff5b 100644 --- a/ui/src/locales/fr.json +++ b/ui/src/locales/fr.json @@ -93,93 +93,105 @@ "version" : "La version actuelle de l'application <b class=\"has-text-primary\">{applicationName}</b> est la version <b class=\"has-text-primary\">{version}.</b>" }, "errors": { - "emptyFile": "Le fichier est vide", - "missingReferenceForChecker": "Pour le type de données <code>{dataType}</code>, la donnée <code>{datum}</code>, le composant <code>{component}</code>, il faut préciser le référentiel parmi <code>{references}</code>", - "missingReferenceForCheckerInReference": "Pour la reference <code>{reference}</code>, la validation <code>{validationKey}</code>, il faut préciser le référentiel parmi <code>{references}</code>", - "unknownReferenceForChecker": "Pour le type de données <code>{dataType}</code>, la donnée <code>{datum}</code>, le composant <code>{component}</code>, la référence <code>{refType}</code> n’est pas dans les références acceptées qui sont : <code>{references}</code>", - "unknownReferenceForCheckerInReference": "Pour la référence <code>{reference}</code>, la validation <code>{validationKey}</code>, la référence <code>{refType}</code> n’est pas dans les références acceptées qui sont : <code>{references}</code>", - "unsupportedVersion": "Les fichiers YAML de version <code>{actualVersion}</code> ne sont pas gérés, version attendue <code>{expectedVersion}</code>", - "undeclaredDataGroupForVariable": "La variable <code>{variable}</code> n’est déclarée appartenir à aucun groupe de données, elle doit être présente dans un groupe", - "variableInMultipleDataGroup": "La variable <code>{variable}</code> est déclarée dans plusieurs groupes de données, elle ne doit être présente que dans un groupe", - "unknownVariablesInDataGroup": "le groupe de données <code>{dataGroup}</code> contient des données qui ne sont pas déclarées <code>{unknownVariables}</code>. Données connues <code>{variables}</code>", - "unknownReferenceInCompositereference": "La reference composite <code>{compositeReference}</code> contient des références qui ne sont pas déclarées <code>{unknownReferences}</code>. Références connues <code>{references}</code>", - "missingReferenceInCompositereference": "Tous les composants de la reference composite <code>{compositeReference}</code> doivent déclarer une référence", - "requiredReferenceInCompositeReferenceForParentKeyColumn": "Aucune référence n'a été déclarée pour la <i>parentKeyColumn</i> <code>{parentKeyColumn}</code> dans la référence composite <code>{compositeReference}</code> .", - "requiredParentKeyColumnInCompositeReferenceForReference": "Dans la référence composite <code>{compositeReference}</code> la référence <code>{reference}</code> fait référence à <code>{referenceTo}</code> mais ne déclare pas de <i>parentKeyColumn</i> .", - "missingParentColumnForReferenceInCompositeReference": "Dans la référence composite <code>{compositeReference}</code> la <i>parentKeyColumn</i> <code>{parentKeyColumn}</code> n'existe pas dans la référence <code>{reference}</code>.", - "missingParentRecursiveKeyColumnForReferenceInCompositeReference": "Dans la référence composite <code>{compositeReference}</code> la <i>parentRecursiveKey</i> <code>{parentRecursiveKey}</code> n'existe pas dans la référence <code>{reference}</code>.", - "missingTimeScopeVariableComponentKey": "Il faut indiquer la variable (et son composant) dans laquelle on recueille la période de temps à laquelle rattacher la donnée pour le gestion des droits jeu de données <code>{dataType}</code>", - "timeScopeVariableComponentKeyMissingVariable": "Il faut indiquer la variable dans laquelle on recueille la période de temps à laquelle rattacher la donnée pour le gestion des droits jeu de données <code>{dataType}</code>. Valeurs possibles <code>{variables}</code>", - "timeScopeVariableComponentKeyUnknownVariable": "<code>{variable}</code> ne fait pas partie des colonnes connues <code>{knownVariables}</code>", - "timeVariableComponentKeyMissingComponent": "Il faut indiquer le composant de la variable <code>{variable}</code> dans laquelle on recueille la période de temps à laquelle rattacher la donnée pour le gestion des droits jeu de données <code>{dataType}</code>. Valeurs possibles <code>{knownComponents}</code>", - "timeVariableComponentKeyUnknownComponent": "<code>{component}</code> ne fait pas partie des composants connus pour la variable <code>{variable}</code>. Composants connus : <code>{knownComponents}</code>", - "timeScopeVariableComponentWrongChecker": "Le composant <code>{component}</code> de la variable <code>{variable}</code> ne peut pas être utilisé comme portant l’information temporelle car ce n’est pas une donnée déclarée comme <code>{expectedChecker}</code>", - "timeScopeVariableComponentPatternUnknown": "Le composant <code>{component}</code> de la variable <code>{variable}</code> ne peut pas être utilisé comme portant l’information temporelle car le format de date '<code>{pattern}</code>' n’est pas géré. Formats acceptés : <code>{knownPatterns}</code>", - "missingAuthorizationScopeVariableComponentKey": "Il faut indiquer au moins un groupe de variables (et leur composants) dans le(s)quel(s) on recueille les informations spatiales à rattacher la donnée pour le gestion des droits jeu de données <code>{dataType}</code>", - "missingAuthorizationForDatatype": "La section authorization doit être présente dans la description du type de données <code>{datatype}</code>", "authorizationScopeVariableComponentKeyMissingVariable": "Il faut indiquer la variable dans laquelle on recueille les informations spatiales à laquelle rattacher la donnée pour le gestion des droits jeu de données <code>{dataType}</code> pour l'autorisation <code>{authorizationName}</code>. Valeurs possibles <code>{variables}</code>", "authorizationScopeVariableComponentKeyUnknownVariable": "<code>{variable}</code> ne fait pas partie des colonnes connues <code>{knownVariables}</code>", + "authorizationScopeVariableComponentReftypeNull": "Aucune référence n'a été définie pour le composant <code>{component}</code> de la variable <code>{variable}</code>. Références acceptées : <code>{knownPatterns}</code>", + "authorizationScopeVariableComponentReftypeUnknown": "La référence <code>{refType}</code> du composant <code>{component}</code> de la variable <code>{variable}</code> n'a pas été déclarée. Références acceptées : <code>{knownPatterns}</code>", + "authorizationScopeVariableComponentWrongChecker": "Le composant <code>{component}</code> de la variable <code>{variable}</code> ne peut pas être utilisé comme portant l’information temporelle car ce n’est pas une donnée déclarée comme <code>{expectedChecker}</code>", "authorizationVariableComponentKeyMissingComponent": "Il faut indiquer le composant de la variable <code>{variable}</code> dans laquelle on recueille les informations spatiales à laquelle rattacher la donnée pour le gestion des droits jeu de données <code>{dataType}</code> pour l'autorisation <code>{authorizationName}</code>. Valeurs possibles <code>{knownComponents}</code>", "authorizationVariableComponentKeyUnknownComponent": "<code>{component}</code> ne fait pas partie des composants connus pour la variable <code>{variable}</code>. Composants connus : <code>{knownComponents}</code>", - "authorizationScopeVariableComponentWrongChecker": "Le composant <code>{component}</code> de la variable <code>{variable}</code> ne peut pas être utilisé comme portant l’information temporelle car ce n’est pas une donnée déclarée comme <code>{expectedChecker}</code>", - "authorizationScopeVariableComponentReftypeUnknown": "La référence <code>{refType}</code> du composant <code>{component}</code> de la variable <code>{variable}</code> n'a pas été déclarée. Références acceptées : <code>{knownPatterns}</code>", - "authorizationScopeVariableComponentReftypeNull": "Aucune référence n'a été définie pour le composant <code>{component}</code> de la variable <code>{variable}</code>. Références acceptées : <code>{knownPatterns}</code>", - "authorizationVariableComponentMustReferToCompositereference": "Pour le type de données <code>{dataType}</code>, la référence <code>{refType}</code> de l'authorisation <code>{authorizationName}</code> doit être définie commme une référence composite <code>compositeReferences</code>. CompositesReferences déclarée : <code>{knownCompositesReferences}</code>", - "unrecognizedProperty": "Erreur à la ligne <code>{lineNumber}</code> (colonne <code>{columnNumber}</code>) : <code>{unknownPropertyName}</code>, c’est pas une propriété reconnue. Les propriétés reconnues sont <code>{knownProperties}</code>", - "invalidFormat": "Erreur à la ligne <code>{lineNumber}</code> (colonne <code>{columnNumber}</code>) : '<code>{value}</code>' n’a pas le bon format. Le type attendu est <code>{targetTypeName}</code>", - "missingRequiredExpression": "Pour la règle de validation <code>{lineValidationRuleKey}</code>, vous devez renseigner l’expression à évaluer pour contrôler que la règle est respectée par les données", - "illegalGroovyExpression": "Pour la règle de validation <code>{lineValidationRuleKey}</code>, l’expression renseignée <code>{expression}</code> n’est pas correcte. Erreur de compilation de l’expression à la ligne <code>{compilationError.lineNumber}</code> (colonne <code>{compilationError.columnNumber}</code>) message '<code>{compilationError.message}</code>'", - "unknownCheckerName": "Pour la règle de validation <code>{lineValidationRuleKey}</code>, '<code>{checkerName}</code>' est déclaré mais ce n’est pas un contrôle connu", - "unknownCheckerNameForVariableComponentCheckerInReference": "Dans la validation de la référence <code>{reference}</code> et la règle de validation <code>{validationRuleDescriptionEntryKey}</code>, '<code>{name}</code>' est déclaré mais ce n’est pas un contrôle connu: valeurs possibles <code>{variableComponentCheckers}</code>.", + "badauthorizationscopeforrepository": "L'autorisation <code>{authorization}</code>) doit être <code>{expectedValue}/code> et non <code>{givenValue}</code>", + "checkerExpressionReturnedFalse": "La contrainte suivante n'est pas respectée : <code>{expression}</code>", "csvBoundToUnknownVariable": "Dans le format CSV, l’entête <code>{header}</code> est lié à la variable <code>{variable}</code> qui n’est pas connue. Variables connues <code>{variables}</code>", - "unknownCheckerNameForVariableComponent": "Dans la description du type de données {datatype} le composant <code>{component}</code> de la variable <code>{variable}</code> le vérificateur de valeur <code>{checkerName}</code> est déclaré mais ce n’est pas un contrôle connu<br /> Vérificateurs connues : <code>{variableComponentCheckers}</code>", - "missingColumnReferenceForCheckerInReference": "Dans la description de la référence {reference} et la validation <code>{validationRuleDescriptionEntryKey}</code> le vérificateur de valeur <code>{checkerName}</code> déclare des colonnes inconnues <code>{missingColumns}</code> : valeurs possible<code>{knownColumns}</code>", - "missingParamColumnReferenceForCheckerInReference": "Dans la description de la <code>{reference}</code>, la règle de validation <code>{validationRuleDescriptionEntryKey}</code> ne précise pas sur quelles colonnes la règle doit s'exécuter en déclarant un paramètre <code>columns</code>", "csvBoundToUnknownVariableComponent": "Dans le format CSV, l’entête <code>{header}</code> est lié à la variable <code>{variable}</code> mais elle n’a pas de composant <code>{component}</code>. Composants connus <code>{components}</code>", - "invalidKeyColumns": "Dans la description du référentiel <code>{reference}</code>, les colonnes <code>{unknownUsedAsKeyElementColumns}</code> sont déclarées comme faisant partie de la clé alors qu’elles n’existent pas. Colonnes connues : <code>{knownColumns}</code>", - "missingKeyColumnsForReference": "Dans la description du référentiel <code>{reference}</code>, vous devez déclarer les colonnes (au moins une) qui composent la clé naturelle", - "invalidInternationalizedColumns": "Dans la description du référentiel <code>{reference}</code>, les colonnes <code>{unknownUsedAsInternationalizedColumns}</code> sont déclarées comme faisant partie de colonnes internationalisables alors qu’elles n’existent pas. Colonnes connues : <code>{knownColumns}</code>", - "invalidInternationalizedColumnsForDataType": "Dans la surcharge du référentiel <code>{reference}</code> de la description du type de donnée <code>{dataType}</code>, les colonnes <code>{unknownUsedAsInternationalizedColumns}</code> sont déclarées comme faisant partie de colonnes internationalisables alors qu’elles n’existent pas. Colonnes connues : <code>{knownColumns}</code>", - "unknownReferenceInDatatypeReferenceDisplay": "Dans la surcharge de l'affichage des référentiels de la description du type de donnée <code>{dataType}</code>, le référentiel <code>{reference}</code> est inconnu . Référentiels connus connues : <code>{references}</code>", - "unexpectedHeaderColumn": "En-tête de colonne inattendu. En-tête attendu : <code>{expectedHeaderColumn}</code> <br />En-tête actuel : <code>{actualHeaderColumn}</code>", - "headerColumnPatternNotMatching": "Erreur dans le format de l'en-tête de colonne. Format à respecter : <code>{expectedHeaderColumnPattern}</code><br/>En-tête actuel : <code>{actualHeaderColumn}</code>", - "unexpectedTokenCount": "Le nombre de token est inattendu. Nombre attendu : <code>{expectedTokenCount}</code><br/>L'en-tête actuel : <code>{actualHeader}</code> comprend <code>{actualTokenCount}</code> tokens", - "invalidHeaders": "En-têtes de colonne invalides. Les colonnes attendues sont : <code>{expectedColumns}</code><br/>Les colonnes actuelles sont : <code>{actualColumns}</code><br/> Il manque les colonnes : <code>{missingColumns}</code><br/>Les colonnes suivantes sont inconnues : <code>{unknownColumns}</code>", - "emptyHeader": "Le fichier contient un en-tête de colonne vide", "duplicatedHeaders": "Les en-têtes suivants sont dupliqués : <code>{duplicatedHeaders}</code>", - "patternNotMatched": "Pour le composant identifié : <code>{target}</code> la valeur <code>{value}</code> ne respecte pas le format attendu : <code>{pattern}</code>.", - "patternNotMatchedWithColumn": "Pour la colonne : <code>{target}</code> la valeur <code>{value}</code> ne respecte pas le format attendu : <code>{pattern}</code>.", + "duplicatedLineInDatatype": "Dans le fichier de données {file}, la ligne {lineNumber} a le même identifiant {duplicateKey} que les lignes {otherLines}", + "duplicatedLineInReference": "Dans le fichier du référentiel {file}, la ligne {lineNumber} a le même identifiant {duplicateKey} que les lignes {otherLines}", + "emptyFile": "Le fichier est vide", + "emptyHeader": "Le fichier contient un en-tête de colonne vide", + "headerColumnPatternNotMatching": "Erreur dans le format de l'en-tête de colonne. Format à respecter : <code>{expectedHeaderColumnPattern}</code><br/>En-tête actuel : <code>{actualHeaderColumn}</code>", + "illegalGroovyExpressionForValidationRuleInDataType": "Pour la règle de validation <code>{lineValidationRuleKey}</code> du type de données <code>{dataType}</code>, l’expression renseignée <code>{expression}</code> n’est pas correcte. Erreur de compilation de l’expression à la ligne <code>{compilationError.lineNumber}</code> (colonne <code>{compilationError.columnNumber}</code>) message '<code>{compilationError.message}</code>'", + "illegalGroovyExpressionForValidationRuleInReference": "Pour la règle de validation <code>{lineValidationRuleKey}</code> de la référence {reference}, l’expression renseignée <code>{expression}</code> n’est pas correcte. Erreur de compilation de l’expression à la ligne <code>{compilationError.lineNumber}</code> (colonne <code>{compilationError.columnNumber}</code>) message '<code>{compilationError.message}</code>'", "invalidDate": "Pour le composant identifié : <code>{target}</code> la date <code>{value}</code> ne respecte pas le format attendu : <code>{pattern}</code>. ", "invalidDateWithColumn": "Pour la colonne : <code>{column}</code> la date <code>{value}</code> ne respecte pas le format attendu : <code>{pattern}</code>. ", - "invalidInteger": "Pour le composant identifié : <code>{target}</code> la valeur <code>{value}</code> doit être un entier.", - "invalidIntegerWithColumn": "Pour la colonne : <code>{target}</code> la valeur <code>{value}</code> doit être un entier.", "invalidFloat": "Pour le composant identifié : <code>{target}</code> la valeur <code>{value}</code> doit être un nombre décimal.", "invalidFloatWithColumn": "Pour la colonne : <code>{target}</code> la valeur <code>{value}</code> doit être un nombre décimal.", + "invalidFormat": "Erreur à la ligne <code>{lineNumber}</code> (colonne <code>{columnNumber}</code>) : '<code>{value}</code>' n’a pas le bon format. Le type attendu est <code>{targetTypeName}</code>", + "invalidHeaders": "En-têtes de colonne invalides. Les colonnes attendues sont : <code>{expectedColumns}</code><br/>Les colonnes actuelles sont : <code>{actualColumns}</code><br/> Il manque les colonnes : <code>{missingColumns}</code><br/>Les colonnes suivantes sont inconnues : <code>{unknownColumns}</code>", + "invalidInteger": "Pour le composant identifié : <code>{target}</code> la valeur <code>{value}</code> doit être un entier.", + "invalidIntegerWithColumn": "Pour la colonne : <code>{target}</code> la valeur <code>{value}</code> doit être un entier.", + "invalidInternationalizedColumns": "Dans la description du référentiel <code>{reference}</code>, les colonnes <code>{unknownUsedAsInternationalizedColumns}</code> sont déclarées comme faisant partie de colonnes internationalisables alors qu’elles n’existent pas. Colonnes connues : <code>{knownColumns}</code>", + "invalidInternationalizedColumnsForDataType": "Dans la surcharge du référentiel <code>{reference}</code> de la description du type de donnée <code>{dataType}</code>, les colonnes <code>{unknownUsedAsInternationalizedColumns}</code> sont déclarées comme faisant partie de colonnes internationalisables alors qu’elles n’existent pas. Colonnes connues : <code>{knownColumns}</code>", + "invalidKeyColumns": "Dans la description du référentiel <code>{reference}</code>, les colonnes <code>{unknownUsedAsKeyElementColumns}</code> sont déclarées comme faisant partie de la clé alors qu’elles n’existent pas. Colonnes connues : <code>{knownColumns}</code>", "invalidReference": "Pour le composant identifié : <code>{target}</code> la valeur <code>{value}</code> n'existe pas dans la référence <code>{refType}</code>. Valeurs attendues <code>{referenceValues}</code>.", "invalidReferenceWithColumn": "Pour la colonne : <code>{target}</code> la valeur <code>{value}</code> n'existe pas dans la référence <code>{refType}</code>. Valeurs attendues <code>{referenceValues}</code>.", - "checkerExpressionReturnedFalse": "La contrainte suivante n'est pas respectée : <code>{expression}</code>", - "requiredValue": "Pour le composant identifié : <code>{target}</code> la valeur ne peut pas être nulle.", - "requiredValueWithColumn": "Pour la colonne : <code>{target}</code> la valeur ne peut pas être nulle.", - "timerangeoutofinterval": "La date <code>{value}</code> est incompatible avec l'intervale de dates du dépôt. Elle doit être comprise entre <code>{from}</code> et <code>{to}</code>.", - "badauthorizationscopeforrepository": "L'autorisation <code>{authorization}</code>) doit être <code>{expectedValue}/code> et non <code>{givenValue}</code>", - "overlappingpublishedversion": "Il existe une version déposée dans les dates de dépôt ont une période chevauchante avec la version déposée. <code>{overlapingFiles]</code>", - "unDeclaredValueForChart":"Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, la valeur n'est pas déclarée.<br /> Valeurs attendues <code>{components}</code>", - "missingValueComponentForChart":"Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, la valeur <code> {valueComponent}</code> n'est pas un composant déclaré.<br /> Valeurs attendues <code>{components}</code>", - "missingAggregationVariableForChart":"Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, la variable d'aggrégation <code> {aggregationVariable}</code> n'est pas déclarée.<br /> Valeurs attendues <code>{variables}</code>", "missingAggregationComponentForChart":"Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, le componsant <code> {aggregationComponent}</code> de la variable d'aggrégation <code> {aggregationVariable}</code> n'est pas déclarée.<br /> Valeurs attendues <code>{components}</code>", + "missingAggregationVariableForChart":"Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, la variable d'aggrégation <code> {aggregationVariable}</code> n'est pas déclarée.<br /> Valeurs attendues <code>{variables}</code>", + "missingAuthorizationForDatatype": "La section authorization doit être présente dans la description du type de données <code>{datatype}</code>", + "missingAuthorizationScopeVariableComponentKey": "Il faut indiquer au moins un groupe de variables (et leur composants) dans le(s)quel(s) on recueille les informations spatiales à rattacher la donnée pour le gestion des droits jeu de données <code>{dataType}</code>", + "missingBoundToForConstantDescription": "Dans la section format->constant du dataType {dataType} vous devez remplir la section boundTo.", + "missingColumnNumberOrHeaderNameForConstantDescription": "!!TODO", + "missingColumnReferenceForCheckerInDataType": "Dans la description du type de données {dataType} et la validation <code>{validationRuleDescriptionEntryKey}</code> le vérificateur de valeur <code>{checkerName}</code> déclare des variables/composants inconnus <code>{missingVariableComponents}</code> : valeurs possible<code>{knownVariableComponents}</code>", + "missingColumnReferenceForCheckerInReference": "Dans la description de la référence {reference} et la validation <code>{validationRuleDescriptionEntryKey}</code> le vérificateur de valeur <code>{checkerName}</code> déclare des colonnes inconnues <code>{missingColumns}</code> : valeurs possible<code>{knownColumns}</code>", + "missingExportHeaderNameForConstantDescription": "Dans la section format->constant du dataType {dataType} vous devez spécifier un exportHeaderName.", + "missingKeyColumnsForReference": "Dans la description du référentiel <code>{reference}</code>, vous devez déclarer les colonnes (au moins une) qui composent la clé naturelle", + "missingParamColumnReferenceForCheckerInDataType": "Dans la description du type de données <code>{dataType}</code>, la règle de validation <code>{validationRuleDescriptionEntryKey}</code> ne précise pas sur quelles variables/composants la règle doit s'exécuter en déclarant un paramètre <code>variableComponents</code>", + "missingParamColumnReferenceForCheckerInReference": "Dans la description de la <code>{reference}</code>, la règle de validation <code>{validationRuleDescriptionEntryKey}</code> ne précise pas sur quelles colonnes la règle doit s'exécuter en déclarant un paramètre <code>columns</code>", + "missingParentColumnForReferenceInCompositeReference": "Dans la référence composite <code>{compositeReference}</code> la <i>parentKeyColumn</i> <code>{parentKeyColumn}</code> n'existe pas dans la référence <code>{reference}</code>.", + "missingParentLineInRecursiveReference": "Dans le fichier du référentiel {references} la valeur d'identifiant {missingReferencesKey} pour le parent n'existe pas. Valeurs acceptées {knownReferences}", + "missingParentRecursiveKeyColumnForReferenceInCompositeReference": "Dans la référence composite <code>{compositeReference}</code> la <i>parentRecursiveKey</i> <code>{parentRecursiveKey}</code> n'existe pas dans la référence <code>{reference}</code>.", + "missingReferenceForChecker": "Pour le type de données <code>{dataType}</code>, la donnée <code>{datum}</code>, le composant <code>{component}</code>, il faut préciser le référentiel parmi <code>{references}</code>", + "missingReferenceForCheckerInDataType": "Pour le type de données <code>{dataType}</code>, la validation <code>{validationKey}</code>, il faut préciser le référentiel parmi <code>{references}</code>", + "missingReferenceForCheckerInReference": "Pour la reference <code>{reference}</code>, la validation <code>{validationKey}</code>, il faut préciser le référentiel parmi <code>{references}</code>", + "missingReferenceForCheckerInReferenceColumn": "Pour la reference <code>{referenceToValidate}</code>, il faut indiquer le référentiel à utiliser pour le contrôle de la valeur de <code>{column}</code> parmi <code>{knownReferences}</code>", + "missingReferenceInCompositereference": "Tous les composants de la reference composite <code>{compositeReference}</code> doivent déclarer une référence", + "missingRequiredExpressionForValidationRuleInDataType": "Pour la règle de validation <code>{lineValidationRuleKey}</code> du type de données <code>{dataType}</code>, vous devez renseigner l’expression à évaluer pour contrôler que la règle est respectée par les données", + "missingRequiredExpressionForValidationRuleInReference": "Pour la règle de validation <code>{lineValidationRuleKey}</code> de la référence {reference}, vous devez renseigner l’expression à évaluer pour contrôler que la règle est respectée par les données", + "missingRowLineForConstantDescription": "Dans la section format->constant du dataType {dataType} vous devez indiquer un numéro de ligne.", "missingStandardDeviationComponentForChart":"Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, l'écart type <code> {standardDeviation}</code> n'est pas un composant déclaré.<br /> Valeurs attendues <code>{components}</code>", + "missingTimeScopeVariableComponentKey": "Il faut indiquer la variable (et son composant) dans laquelle on recueille la période de temps à laquelle rattacher la donnée pour le gestion des droits jeu de données <code>{dataType}</code>", "missingUnitComponentForChart":"Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, l'unité <code> {unit}</code> n'est pas un composant déclaré.<br /> Valeurs attendues <code>{components}</code>", - "duplicatedLineInReference": "Dans le fichier du référentiel {file}, la ligne {lineNumber} a le même identifiant {duplicateKey} que les lignes {otherLines}", - "duplicatedLineInDatatype": "Dans le fichier de données {file}, la ligne {lineNumber} a le même identifiant {duplicateKey} que les lignes {otherLines}", - "missingParentLineInRecursiveReference": "Dans le fichier du référentiel {references} la valeur d'identifiant {missingReferencesKey} pour le parent n'existe pas. Valeurs acceptées {knownReferences}", - "unknownUsedAsVariableComponentUniqueness": "Dans la description du type de données {dataType} dans la section <I>uniqueness</i> les descriptions de variable composants {unknownUsedAsVariableComponentUniqueness} n'existent pas. Valeurs acceptées {availableVariableComponents}", + "missingValueComponentForChart":"Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, la valeur <code> {valueComponent}</code> n'est pas un composant déclaré.<br /> Valeurs attendues <code>{components}</code>", + "overlappingpublishedversion": "Il existe une version déposée dans les dates de dépôt ont une période chevauchante avec la version déposée. <code>{overlapingFiles]</code>", + "patternNotMatched": "Pour le composant identifié : <code>{target}</code> la valeur <code>{value}</code> ne respecte pas le format attendu : <code>{pattern}</code>.", + "patternNotMatchedWithColumn": "Pour la colonne : <code>{target}</code> la valeur <code>{value}</code> ne respecte pas le format attendu : <code>{pattern}</code>.", + "recordCsvMissingColumnNumberOrHeaderNameForConstantDescription": "Dans la section format->constant du dataType {dataType} vous devez indiquer un numéro de ligne ou un nom d'en-tête.", + "requiredParentKeyColumnInCompositeReferenceForReference": "Dans la référence composite <code>{compositeReference}</code> la référence <code>{reference}</code> fait référence à <code>{referenceTo}</code> mais ne déclare pas de <i>parentKeyColumn</i> .", + "requiredReferenceInCompositeReferenceForParentKeyColumn": "Aucune référence n'a été déclarée pour la <i>parentKeyColumn</i> <code>{parentKeyColumn}</code> dans la référence composite <code>{compositeReference}</code> .", + "requiredValue": "Pour le composant identifié : <code>{target}</code> la valeur ne peut pas être nulle.", + "requiredValueWithColumn": "Pour la colonne : <code>{target}</code> la valeur ne peut pas être nulle.", + "sameHeaderLineAndFirstRowLineForConstantDescription": "Dans la section format->constant du dataType {dataType} la ligne d'en-tête ne doit pas être egale à la ligne de données.", + "timeScopeVariableComponentKeyMissingVariable": "Il faut indiquer la variable dans laquelle on recueille la période de temps à laquelle rattacher la donnée pour le gestion des droits jeu de données <code>{dataType}</code>. Valeurs possibles <code>{variables}</code>", + "timeScopeVariableComponentKeyUnknownVariable": "<code>{variable}</code> ne fait pas partie des colonnes connues <code>{knownVariables}</code>", + "timeScopeVariableComponentPatternUnknown": "Le composant <code>{component}</code> de la variable <code>{variable}</code> ne peut pas être utilisé comme portant l’information temporelle car le format de date '<code>{pattern}</code>' n’est pas géré. Formats acceptés : <code>{knownPatterns}</code>", + "timeScopeVariableComponentWrongChecker": "Le composant <code>{component}</code> de la variable <code>{variable}</code> ne peut pas être utilisé comme portant l’information temporelle car ce n’est pas une donnée déclarée comme <code>{expectedChecker}</code>", + "timeVariableComponentKeyMissingComponent": "Il faut indiquer le composant de la variable <code>{variable}</code> dans laquelle on recueille la période de temps à laquelle rattacher la donnée pour le gestion des droits jeu de données <code>{dataType}</code>. Valeurs possibles <code>{knownComponents}</code>", + "timeVariableComponentKeyUnknownComponent": "<code>{component}</code> ne fait pas partie des composants connus pour la variable <code>{variable}</code>. Composants connus : <code>{knownComponents}</code>", + "timerangeoutofinterval": "La date <code>{value}</code> est incompatible avec l'intervale de dates du dépôt. Elle doit être comprise entre <code>{from}</code> et <code>{to}</code>.", "tooBigRowLineForConstantDescription": "Dans la section format->constant du dataType {dataType} le numéro de ligne doit être inférieur à celui de la ligne de données.", "tooLittleRowLineForConstantDescription": "Dans la section format->constant du dataType {dataType} le numéro de ligne doit être positif.", - "missingRowLineForConstantDescription": "Dans la section format->constant du dataType {dataType} vous devez indiquer un numéro de ligne.", - "recordCsvMissingColumnNumberOrHeaderNameForConstantDescription": "Dans la section format->constant du dataType {dataType} vous devez indiquer un numéro de ligne ou un nom d'en-tête.", - "missingBoundToForConstantDescription": "Dans la section format->constant du dataType {dataType} vous devez remplir la section boundTo.", - "missingExportHeaderNameForConstantDescription": "Dans la section format->constant du dataType {dataType} vous devez spécifier un exportHeaderName.", - "sameHeaderLineAndFirstRowLineForConstantDescription": "Dans la section format->constant du dataType {dataType} la ligne d'en-tête ne doit pas être egale à la ligne de données." + "unDeclaredValueForChart":"Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, la valeur n'est pas déclarée.<br /> Valeurs attendues <code>{components}</code>", + "undeclaredDataGroupForVariable": "La variable <code>{variable}</code> n’est déclarée appartenir à aucun groupe de données, elle doit être présente dans un groupe", + "unexpectedHeaderColumn": "En-tête de colonne inattendu. En-tête attendu : <code>{expectedHeaderColumn}</code> <br />En-tête actuel : <code>{actualHeaderColumn}</code>", + "unexpectedTokenCount": "Le nombre de token est inattendu. Nombre attendu : <code>{expectedTokenCount}</code><br/>L'en-tête actuel : <code>{actualHeader}</code> comprend <code>{actualTokenCount}</code> tokens", + "unknownCheckerNameForValidationRuleInDataType": "Pour la règle de validation <code>{lineValidationRuleKey}</code> du type de données <code>{dataType}</code>, '<code>{checkerName}</code>' est déclaré mais ce n’est pas un contrôle connu. Contrôles connus : {allCheckerNames}", + "unknownCheckerNameForValidationRuleInReference": "Pour la règle de validation <code>{lineValidationRuleKey}</code> de la référence <code>{reference}</code>, '<code>{checkerName}</code>' est déclaré mais ce n’est pas un contrôle connu. Contrôles connus : {allCheckerNames}", + "unknownCheckerNameForVariableComponent": "Dans la description du type de données {datatype} le composant <code>{component}</code> de la variable <code>{variable}</code> le vérificateur de valeur <code>{checkerName}</code> est déclaré mais ce n’est pas un contrôle connu<br /> Vérificateurs connues : <code>{knownCheckerNames}</code>", + "unknownCheckerNameForVariableComponentCheckerInDataType": "Dans la validation du type de données <code>{dataType}</code> et la règle de validation <code>{validationRuleDescriptionEntryKey}</code>, '<code>{name}</code>' est déclaré mais ce n’est pas un contrôle connu: valeurs possibles <code>{checkerOnTargetNames}</code>.", + "unknownCheckerNameForVariableComponentCheckerInReference": "Dans la validation de la référence <code>{reference}</code> et la règle de validation <code>{validationRuleDescriptionEntryKey}</code>, '<code>{name}</code>' est déclaré mais ce n’est pas un contrôle connu: valeurs possibles <code>{checkerOnTargetNames}</code>.", + "unknownCheckerNameInReferenceColumn": "Pour le référentiel <code>{referenceToValidate}</code>, le contrôle défini pour la colonne <code>{column}</code> est <code>{checkerName}</code>. Or, ce n'est pas un contrôle connu. Les contrôles connus sont <code>{knownCheckerNames}</code>", + "unknownIllegalException": "Erreur inattendue : <code>{cause}</code>", + "unknownReferenceForChecker": "Pour le type de données <code>{dataType}</code>, la donnée <code>{datum}</code>, le composant <code>{component}</code>, la référence <code>{refType}</code> n’est pas dans les références acceptées qui sont : <code>{references}</code>", + "unknownReferenceForCheckerInDataType": "Pour le type de données <code>{dataType}</code>, la validation <code>{validationKey}</code>, la référence <code>{refType}</code> n’est pas dans les références acceptées qui sont : <code>{references}</code>", + "unknownReferenceForCheckerInReference": "Pour la référence <code>{reference}</code>, la validation <code>{validationKey}</code>, la référence <code>{refType}</code> n’est pas dans les références acceptées qui sont : <code>{references}</code>", + "unknownReferenceForCheckerInReferenceColumn": "Pour le référentiel <code>{referenceToValidate}</code> et la colonne <code>{column}</code>, le référentiel à utiliser pour le contrôle de valeur est <code>{refType}</code> qui n'est pas connu parmi <code>{knownReferences}</code>", + "unknownReferenceInCompositereference": "La reference composite <code>{compositeReference}</code> contient des références qui ne sont pas déclarées <code>{unknownReferences}</code>. Références connues <code>{references}</code>", + "unknownReferenceInDatatypeReferenceDisplay": "Dans la surcharge de l'affichage des référentiels de la description du type de donnée <code>{dataType}</code>, le référentiel <code>{reference}</code> est inconnu . Référentiels connus connues : <code>{references}</code>", + "unknownUsedAsVariableComponentUniqueness": "Dans la description du type de données {dataType} dans la section <I>uniqueness</i> les descriptions de variable composants {unknownUsedAsVariableComponentUniqueness} n'existent pas. Valeurs acceptées {availableVariableComponents}", + "unknownVariablesInDataGroup": "le groupe de données <code>{dataGroup}</code> contient des données qui ne sont pas déclarées <code>{unknownVariables}</code>. Données connues <code>{variables}</code>", + "unrecognizedProperty": "Erreur à la ligne <code>{lineNumber}</code> (colonne <code>{columnNumber}</code>) : <code>{unknownPropertyName}</code>, c’est pas une propriété reconnue. Les propriétés reconnues sont <code>{knownProperties}</code>", + "unsupportedVersion": "Les fichiers YAML de version <code>{actualVersion}</code> ne sont pas gérés, version attendue <code>{expectedVersion}</code>", + "variableInMultipleDataGroup": "La variable <code>{variable}</code> est déclarée dans plusieurs groupes de données, elle ne doit être présente que dans un groupe" }, "referencesManagement": { "actions": "Actions", diff --git a/ui/src/services/ErrorsService.js b/ui/src/services/ErrorsService.js index 0c12e7da7..507b435a3 100644 --- a/ui/src/services/ErrorsService.js +++ b/ui/src/services/ErrorsService.js @@ -2,93 +2,105 @@ import { i18n } from "@/main"; //prettier-ignore const ERRORS = { - emptyFile: () => i18n.t("errors.emptyFile"), - missingReferenceForChecker: (params) => i18n.t("errors.missingReferenceForChecker", params), - unknownReferenceForChecker: (params) => i18n.t("errors.unknownReferenceForChecker", params), - unsupportedVersion: (params) => i18n.t("errors.unsupportedVersion", params), - undeclaredDataGroupForVariable: (params) => i18n.t("errors.undeclaredDataGroupForVariable", params), - variableInMultipleDataGroup: (params) => i18n.t("errors.variableInMultipleDataGroup", params), - unknownVariablesInDataGroup: (params) => i18n.t("errors.unknownVariablesInDataGroup", params), - missingTimeScopeVariableComponentKey: (params) => i18n.t("errors.missingTimeScopeVariableComponentKey", params), - timeScopeVariableComponentKeyMissingVariable: (params) => i18n.t("errors.timeScopeVariableComponentKeyMissingVariable", params), - timeScopeVariableComponentKeyUnknownVariable: (params) => i18n.t("errors.timeScopeVariableComponentKeyUnknownVariable", params), - timeVariableComponentKeyMissingComponent: (params) => i18n.t("errors.timeVariableComponentKeyMissingComponent", params), - timeVariableComponentKeyUnknownComponent: (params) => i18n.t("errors.timeVariableComponentKeyUnknownComponent", params), - timeScopeVariableComponentWrongChecker: (params) => i18n.t("errors.timeScopeVariableComponentWrongChecker", params), - timeScopeVariableComponentPatternUnknown: (params) => i18n.t("errors.timeScopeVariableComponentPatternUnknown", params), - unrecognizedProperty: (params) => i18n.t("errors.unrecognizedProperty", params), - invalidFormat: (params) => i18n.t("errors.invalidFormat", params), - missingRequiredExpression: (params) => i18n.t("errors.missingRequiredExpression", params), - illegalGroovyExpression: (params) => i18n.t("errors.illegalGroovyExpression", params), - unknownCheckerName: (params) => i18n.t("errors.unknownCheckerName", params), + authorizationScopeVariableComponentKeyMissingVariable: (params) => i18n.t("errors.authorizationScopeVariableComponentKeyMissingVariable", params), + authorizationScopeVariableComponentKeyUnknownVariable: (params) => i18n.t("errors.authorizationScopeVariableComponentKeyUnknownVariable", params), + authorizationScopeVariableComponentReftypeNull: (params) => i18n.t("errors.authorizationScopeVariableComponentReftypeNull", params), + authorizationScopeVariableComponentReftypeUnknown: (params) => i18n.t("errors.authorizationScopeVariableComponentReftypeUnknown", params), + authorizationScopeVariableComponentWrongChecker: (params) => i18n.t("errors.authorizationScopeVariableComponentWrongChecker", params), + authorizationVariableComponentKeyMissingComponent: (params) => i18n.t("errors.authorizationVariableComponentKeyMissingComponent", params), + authorizationVariableComponentKeyUnknownComponent: (params) => i18n.t("errors.authorizationVariableComponentKeyUnknownComponent", params), + badauthorizationscopeforrepository: (params) => i18n.t("errors.badauthorizationscopeforrepository", params), + checkerExpressionReturnedFalse: (params) => i18n.t("errors.checkerExpressionReturnedFalse", params), csvBoundToUnknownVariable: (params) => i18n.t("errors.csvBoundToUnknownVariable", params), csvBoundToUnknownVariableComponent: (params) => i18n.t("errors.csvBoundToUnknownVariableComponent", params), - invalidKeyColumns: (params) => i18n.t("errors.invalidKeyColumns", params), + duplicatedHeaders: (params) => i18n.t("errors.duplicatedHeaders", params), + duplicatedLineInDatatype: (params) => i18n.t("errors.duplicatedLineInDatatype", params), + duplicatedLineInReference: (params) => i18n.t("errors.duplicatedLineInReference", params), + emptyFile: (params) => i18n.t("errors.emptyFile", params), + emptyHeader: (params) => i18n.t("errors.emptyHeader", params), + headerColumnPatternNotMatching: (params) => i18n.t("errors.headerColumnPatternNotMatching", params), + illegalGroovyExpressionForValidationRuleInDataType: (params) => i18n.t("errors.illegalGroovyExpressionForValidationRuleInDataType", params), + illegalGroovyExpressionForValidationRuleInReference: (params) => i18n.t("errors.illegalGroovyExpressionForValidationRuleInReference", params), + invalidDate: (params) => i18n.t("errors.invalidDate", params), + invalidDateWithColumn: (params) => i18n.t("errors.invalidDateWithColumn", params), + invalidFloat: (params) => i18n.t("errors.invalidFloat", params), + invalidFloatWithColumn: (params) => i18n.t("errors.invalidFloatWithColumn", params), + invalidFormat: (params) => i18n.t("errors.invalidFormat", params), + invalidHeaders: (params) => i18n.t("errors.invalidHeaders", params), + invalidInteger: (params) => i18n.t("errors.invalidInteger", params), + invalidIntegerWithColumn: (params) => i18n.t("errors.invalidIntegerWithColumn", params), invalidInternationalizedColumns: (params) => i18n.t("errors.invalidInternationalizedColumns", params), - unexpectedHeaderColumn : (params) => i18n.t("errors.unexpectedHeaderColumn", params), - headerColumnPatternNotMatching :(params) => i18n.t("errors.headerColumnPatternNotMatching", params), - unexpectedTokenCount : (params) => i18n.t("errors.unexpectedTokenCount", params), - invalidHeaders : (params) => i18n.t("errors.invalidHeaders", params), - emptyHeader : (params) => i18n.t("errors.emptyHeader", params), - duplicatedHeaders : (params) => i18n.t("errors.duplicatedHeaders", params), - patternNotMatched : (params) => i18n.t("errors.patternNotMatched", params), - invalidDate : (params) => i18n.t("errors.invalidDate", params), - invalidInteger : (params) => i18n.t("errors.invalidInteger", params), - invalidFloat : (params) => i18n.t("errors.invalidFloat", params), - checkerExpressionReturnedFalse : (params) => i18n.t("errors.checkerExpressionReturnedFalse", params), - missingReferenceForCheckerInReference: (params) => i18n.t("errors.missingReferenceForCheckerInReference", params), - unknownReferenceForCheckerInReference: (params) => i18n.t("errors.unknownReferenceForCheckerInReference", params), - unknownReferenceInCompositereference: (params) => i18n.t("errors.unknownReferenceInCompositereference", params), - missingReferenceInCompositereference: (params) => i18n.t("errors.missingReferenceInCompositereference", params), - requiredReferenceInCompositeReferenceForParentKeyColumn: (params) => i18n.t("errors.requiredReferenceInCompositeReferenceForParentKeyColumn", params), - requiredParentKeyColumnInCompositeReferenceForReference: (params) => i18n.t("errors.requiredParentKeyColumnInCompositeReferenceForReference", params), - missingParentColumnForReferenceInCompositeReference: (params) => i18n.t("errors.missingParentColumnForReferenceInCompositeReference", params), - missingParentRecursiveKeyColumnForReferenceInCompositeReference: (params) => i18n.t("errors.missingParentRecursiveKeyColumnForReferenceInCompositeReference", params), - missingAuthorizationScopeVariableComponentKey: (params) => i18n.t("errors.missingAuthorizationScopeVariableComponentKey", params), + invalidInternationalizedColumnsForDataType: (params) => i18n.t("errors.invalidInternationalizedColumnsForDataType", params), + invalidKeyColumns: (params) => i18n.t("errors.invalidKeyColumns", params), + invalidReference: (params) => i18n.t("errors.invalidReference", params), + invalidReferenceWithColumn: (params) => i18n.t("errors.invalidReferenceWithColumn", params), + missingAggregationComponentForChart: (params) => i18n.t("errors.missingAggregationComponentForChart", params), + missingAggregationVariableForChart: (params) => i18n.t("errors.missingAggregationVariableForChart", params), missingAuthorizationForDatatype: (params) => i18n.t("errors.missingAuthorizationForDatatype", params), - authorizationScopeVariableComponentKeyMissingVariable: (params) => i18n.t("errors.authorizationScopeVariableComponentKeyMissingVariable", params), - authorizationScopeVariableComponentKeyUnknownVariable: (params) => i18n.t("errors.authorizationScopeVariableComponentKeyUnknownVariable", params), - authorizationVariableComponentKeyMissingComponent: (params) => i18n.t("errors.authorizationVariableComponentKeyMissingComponent", params), - authorizationVariableComponentKeyUnknownComponent: (params) => i18n.t("errors.authorizationVariableComponentKeyUnknownComponent", params), - authorizationScopeVariableComponentWrongChecker: (params) => i18n.t("errors.authorizationScopeVariableComponentWrongChecker", params), - authorizationScopeVariableComponentReftypeUnknown: (params) => i18n.t("errors.authorizationScopeVariableComponentReftypeUnknown", params), - authorizationScopeVariableComponentReftypeNull: (params) => i18n.t("errors.authorizationScopeVariableComponentReftypeNull", params), - authorizationVariableComponentMustReferToCompositereference: (params) => i18n.t("errors.authorizationVariableComponentMustReferToCompositereference", params), - unknownCheckerNameForVariableComponentCheckerInReference: (params) => i18n.t("errors.unknownCheckerNameForVariableComponentCheckerInReference", params), - unknownCheckerNameForVariableComponent: (params) => i18n.t("errors.unknownCheckerNameForVariableComponent", params), + missingAuthorizationScopeVariableComponentKey: (params) => i18n.t("errors.missingAuthorizationScopeVariableComponentKey", params), + missingBoundToForConstantDescription: (params) => i18n.t("errors.missingBoundToForConstantDescription", params), + missingColumnNumberOrHeaderNameForConstantDescription: (params) => i18n.t("errors.missingColumnNumberOrHeaderNameForConstantDescription", params), + missingColumnReferenceForCheckerInDataType: (params) => i18n.t("errors.missingColumnReferenceForCheckerInDataType", params), missingColumnReferenceForCheckerInReference: (params) => i18n.t("errors.missingColumnReferenceForCheckerInReference", params), - missingParamColumnReferenceForCheckerInReference: (params) => i18n.t("errors.missingParamColumnReferenceForCheckerInReference", params), + missingExportHeaderNameForConstantDescription: (params) => i18n.t("errors.missingExportHeaderNameForConstantDescription", params), missingKeyColumnsForReference: (params) => i18n.t("errors.missingKeyColumnsForReference", params), - invalidInternationalizedColumnsForDataType: (params) => i18n.t("errors.invalidInternationalizedColumnsForDataType", params), - unknownReferenceInDatatypeReferenceDisplay: (params) => i18n.t("errors.unknownReferenceInDatatypeReferenceDisplay", params), + missingParamColumnReferenceForCheckerInDataType: (params) => i18n.t("errors.missingParamColumnReferenceForCheckerInDataType", params), + missingParamColumnReferenceForCheckerInReference: (params) => i18n.t("errors.missingParamColumnReferenceForCheckerInReference", params), + missingParentColumnForReferenceInCompositeReference: (params) => i18n.t("errors.missingParentColumnForReferenceInCompositeReference", params), + missingParentLineInRecursiveReference: (params) => i18n.t("errors.missingParentLineInRecursiveReference", params), + missingParentRecursiveKeyColumnForReferenceInCompositeReference: (params) => i18n.t("errors.missingParentRecursiveKeyColumnForReferenceInCompositeReference", params), + missingReferenceForChecker: (params) => i18n.t("errors.missingReferenceForChecker", params), + missingReferenceForCheckerInDataType: (params) => i18n.t("errors.missingReferenceForCheckerInDataType", params), + missingReferenceForCheckerInReference: (params) => i18n.t("errors.missingReferenceForCheckerInReference", params), + missingReferenceForCheckerInReferenceColumn: (params) => i18n.t("errors.missingReferenceForCheckerInReferenceColumn", params), + missingReferenceInCompositereference: (params) => i18n.t("errors.missingReferenceInCompositereference", params), + missingRequiredExpressionForValidationRuleInDataType: (params) => i18n.t("errors.missingRequiredExpressionForValidationRuleInDataType", params), + missingRequiredExpressionForValidationRuleInReference: (params) => i18n.t("errors.missingRequiredExpressionForValidationRuleInReference", params), + missingRowLineForConstantDescription: (params) => i18n.t("errors.missingRowLineForConstantDescription", params), + missingStandardDeviationComponentForChart: (params) => i18n.t("errors.missingStandardDeviationComponentForChart", params), + missingTimeScopeVariableComponentKey: (params) => i18n.t("errors.missingTimeScopeVariableComponentKey", params), + missingUnitComponentForChart: (params) => i18n.t("errors.missingUnitComponentForChart", params), + missingValueComponentForChart: (params) => i18n.t("errors.missingValueComponentForChart", params), + overlappingpublishedversion: (params) => i18n.t("errors.overlappingpublishedversion", params), + patternNotMatched: (params) => i18n.t("errors.patternNotMatched", params), patternNotMatchedWithColumn: (params) => i18n.t("errors.patternNotMatchedWithColumn", params), - invalidDateWithColumn: (params) => i18n.t("errors.invalidDateWithColumn", params), - invalidIntegerWithColumn: (params) => i18n.t("errors.invalidIntegerWithColumn", params), - invalidFloatWithColumn: (params) => i18n.t("errors.invalidFloatWithColumn", params), - invalidReference: (params) => i18n.t("errors.invalidReference", params), - invalidReferenceWithColumn: (params) => i18n.t("errors.invalidReferenceWithColumn", params), + recordCsvMissingColumnNumberOrHeaderNameForConstantDescription: (params) => i18n.t("errors.recordCsvMissingColumnNumberOrHeaderNameForConstantDescription", params), + requiredParentKeyColumnInCompositeReferenceForReference: (params) => i18n.t("errors.requiredParentKeyColumnInCompositeReferenceForReference", params), + requiredReferenceInCompositeReferenceForParentKeyColumn: (params) => i18n.t("errors.requiredReferenceInCompositeReferenceForParentKeyColumn", params), requiredValue: (params) => i18n.t("errors.requiredValue", params), requiredValueWithColumn: (params) => i18n.t("errors.requiredValueWithColumn", params), + sameHeaderLineAndFirstRowLineForConstantDescription: (params) => i18n.t("errors.sameHeaderLineAndFirstRowLineForConstantDescription", params), + timeScopeVariableComponentKeyMissingVariable: (params) => i18n.t("errors.timeScopeVariableComponentKeyMissingVariable", params), + timeScopeVariableComponentKeyUnknownVariable: (params) => i18n.t("errors.timeScopeVariableComponentKeyUnknownVariable", params), + timeScopeVariableComponentPatternUnknown: (params) => i18n.t("errors.timeScopeVariableComponentPatternUnknown", params), + timeScopeVariableComponentWrongChecker: (params) => i18n.t("errors.timeScopeVariableComponentWrongChecker", params), + timeVariableComponentKeyMissingComponent: (params) => i18n.t("errors.timeVariableComponentKeyMissingComponent", params), + timeVariableComponentKeyUnknownComponent: (params) => i18n.t("errors.timeVariableComponentKeyUnknownComponent", params), timerangeoutofinterval: (params) => i18n.t("errors.timerangeoutofinterval", params), - badauthorizationscopeforrepository: (params) => i18n.t("errors.badauthorizationscopeforrepository", params), - overlappingpublishedversion: (params) => i18n.t("errors.overlappingpublishedversion", params), - unDeclaredValueForChart: (params) => i18n.t("errors.unDeclaredValueForChart", params), - missingValueComponentForChart: (params) => i18n.t("errors.missingValueComponentForChart", params), - missingAggregationVariableForChart: (params) => i18n.t("errors.missingAggregationVariableForChart", params), - missingAggregationComponentForChart: (params) => i18n.t("errors.missingAggregationComponentForChart", params), - missingStandardDeviationComponentForChart: (params) => i18n.t("errors.missingStandardDeviationComponentForChart", params), - missingUnitComponentForChart: (params) => i18n.t("errors.missingUnitComponentForChart", params), - duplicatedLineInReference: (params) => i18n.t("errors.duplicatedLineInReference", params), - duplicatedLineInDatatype: (params) => i18n.t("errors.duplicatedLineInDatatype", params), - missingParentLineInRecursiveReference: (params) => i18n.t("errors.missingParentLineInRecursiveReference", params), - unknownUsedAsVariableComponentUniqueness: (params) => i18n.t("errors.unknownUsedAsVariableComponentUniqueness", params), tooBigRowLineForConstantDescription: (params) => i18n.t("errors.tooBigRowLineForConstantDescription", params), tooLittleRowLineForConstantDescription: (params) => i18n.t("errors.tooLittleRowLineForConstantDescription", params), - missingRowLineForConstantDescription: (params) => i18n.t("errors.missingRowLineForConstantDescription", params), - recordCsvMissingColumnNumberOrHeaderNameForConstantDescription: (params) => i18n.t("errors.recordCsvMissingColumnNumberOrHeaderNameForConstantDescription", params), - missingBoundToForConstantDescription: (params) => i18n.t("errors.missingBoundToForConstantDescription", params), - missingExportHeaderNameForConstantDescription: (params) => i18n.t("errors.missingExportHeaderNameForConstantDescription", params), - sameHeaderLineAndFirstRowLineForConstantDescription: (params) => i18n.t("errors.sameHeaderLineAndFirstRowLineForConstantDescription", params) + unDeclaredValueForChart: (params) => i18n.t("errors.unDeclaredValueForChart", params), + undeclaredDataGroupForVariable: (params) => i18n.t("errors.undeclaredDataGroupForVariable", params), + unexpectedHeaderColumn: (params) => i18n.t("errors.unexpectedHeaderColumn", params), + unexpectedTokenCount: (params) => i18n.t("errors.unexpectedTokenCount", params), + unknownCheckerNameForValidationRuleInDataType: (params) => i18n.t("errors.unknownCheckerNameForValidationRuleInDataType", params), + unknownCheckerNameForValidationRuleInReference: (params) => i18n.t("errors.unknownCheckerNameForValidationRuleInReference", params), + unknownCheckerNameForVariableComponent: (params) => i18n.t("errors.unknownCheckerNameForVariableComponent", params), + unknownCheckerNameForVariableComponentCheckerInDataType: (params) => i18n.t("errors.unknownCheckerNameForVariableComponentCheckerInDataType", params), + unknownCheckerNameForVariableComponentCheckerInReference: (params) => i18n.t("errors.unknownCheckerNameForVariableComponentCheckerInReference", params), + unknownCheckerNameInReferenceColumn: (params) => i18n.t("errors.unknownCheckerNameInReferenceColumn", params), + unknownIllegalException: (params) => i18n.t("errors.unknownIllegalException", params), + unknownReferenceForChecker: (params) => i18n.t("errors.unknownReferenceForChecker", params), + unknownReferenceForCheckerInDataType: (params) => i18n.t("errors.unknownReferenceForCheckerInDataType", params), + unknownReferenceForCheckerInReference: (params) => i18n.t("errors.unknownReferenceForCheckerInReference", params), + unknownReferenceForCheckerInReferenceColumn: (params) => i18n.t("errors.unknownReferenceForCheckerInReferenceColumn", params), + unknownReferenceInCompositereference: (params) => i18n.t("errors.unknownReferenceInCompositereference", params), + unknownReferenceInDatatypeReferenceDisplay: (params) => i18n.t("errors.unknownReferenceInDatatypeReferenceDisplay", params), + unknownUsedAsVariableComponentUniqueness: (params) => i18n.t("errors.unknownUsedAsVariableComponentUniqueness", params), + unknownVariablesInDataGroup: (params) => i18n.t("errors.unknownVariablesInDataGroup", params), + unrecognizedProperty: (params) => i18n.t("errors.unrecognizedProperty", params), + unsupportedVersion: (params) => i18n.t("errors.unsupportedVersion", params), + variableInMultipleDataGroup: (params) => i18n.t("errors.variableInMultipleDataGroup", params), }; export class ErrorsService { -- GitLab From 123415697f6957960d4f3aa1adcb69244cb4043b Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Tue, 5 Apr 2022 17:39:30 +0200 Subject: [PATCH 34/41] =?UTF-8?q?Ajoute=20des=20r=C3=A8gles=20de=20validat?= =?UTF-8?q?ion=20pour=20les=20checkers=20de=20type=20Date=20et=20expressio?= =?UTF-8?q?n=20r=C3=A9guli=C3=A8res?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inra/oresing/checker/DateLineChecker.java | 19 ++- .../checker/RegularExpressionChecker.java | 22 +++- .../java/fr/inra/oresing/model/Duration.java | 5 + .../rest/ApplicationConfigurationService.java | 114 +++++++++++++++++- .../rest/ConfigurationParsingResult.java | 99 +++++++++++++++ ui/src/locales/en.json | 12 ++ ui/src/locales/fr.json | 12 ++ ui/src/services/ErrorsService.js | 12 ++ 8 files changed, 289 insertions(+), 6 deletions(-) diff --git a/src/main/java/fr/inra/oresing/checker/DateLineChecker.java b/src/main/java/fr/inra/oresing/checker/DateLineChecker.java index 6dc47d1da..18bb0cf3a 100644 --- a/src/main/java/fr/inra/oresing/checker/DateLineChecker.java +++ b/src/main/java/fr/inra/oresing/checker/DateLineChecker.java @@ -6,6 +6,7 @@ import fr.inra.oresing.persistence.SqlPrimitiveType; import fr.inra.oresing.rest.ValidationCheckResult; import fr.inra.oresing.rest.validationcheckresults.DateValidationCheckResult; import fr.inra.oresing.transformer.LineTransformer; +import org.apache.commons.lang3.StringUtils; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; @@ -19,6 +20,22 @@ public class DateLineChecker implements CheckerOnOneVariableComponentLineChecker @JsonIgnore private final LineTransformer transformer; + public static boolean isValidPattern(String pattern) { + if (StringUtils.isBlank(pattern)) { + return false; + } + try { + newDateTimeFormatter(pattern); + return true; + } catch (IllegalArgumentException e) { + return false; + } + } + + private static DateTimeFormatter newDateTimeFormatter(String pattern) { + return DateTimeFormatter.ofPattern(pattern); + } + public CheckerTarget getTarget(){ return this.target; } @@ -33,7 +50,7 @@ public class DateLineChecker implements CheckerOnOneVariableComponentLineChecker public DateLineChecker(CheckerTarget target, String pattern, DateLineCheckerConfiguration configuration, LineTransformer transformer) { this.configuration = configuration; this.target = target; - this.dateTimeFormatter = DateTimeFormatter.ofPattern(pattern); + this.dateTimeFormatter = newDateTimeFormatter(pattern); this.pattern = pattern; this.transformer = transformer; } diff --git a/src/main/java/fr/inra/oresing/checker/RegularExpressionChecker.java b/src/main/java/fr/inra/oresing/checker/RegularExpressionChecker.java index 3564cf75d..b230a87d5 100644 --- a/src/main/java/fr/inra/oresing/checker/RegularExpressionChecker.java +++ b/src/main/java/fr/inra/oresing/checker/RegularExpressionChecker.java @@ -2,13 +2,15 @@ package fr.inra.oresing.checker; import com.fasterxml.jackson.annotation.JsonIgnore; import com.google.common.collect.ImmutableMap; -import fr.inra.oresing.rest.validationcheckresults.DefaultValidationCheckResult; import fr.inra.oresing.persistence.SqlPrimitiveType; import fr.inra.oresing.rest.ValidationCheckResult; +import fr.inra.oresing.rest.validationcheckresults.DefaultValidationCheckResult; import fr.inra.oresing.transformer.LineTransformer; +import org.apache.commons.lang3.StringUtils; import java.util.function.Predicate; import java.util.regex.Pattern; +import java.util.regex.PatternSyntaxException; public class RegularExpressionChecker implements CheckerOnOneVariableComponentLineChecker<RegularExpressionCheckerConfiguration> { @@ -20,6 +22,18 @@ public class RegularExpressionChecker implements CheckerOnOneVariableComponentLi private final CheckerTarget target; private final RegularExpressionCheckerConfiguration configuration; + public static boolean isValid(String pattern) { + if (StringUtils.isBlank(pattern)) { + return false; + } + try { + compile(pattern); + return true; + } catch (PatternSyntaxException e) { + return false; + } + } + public CheckerTarget getTarget(){ return this.target; } @@ -28,10 +42,14 @@ public class RegularExpressionChecker implements CheckerOnOneVariableComponentLi this.configuration = configuration; this.target = target; this.patternString = patternString; - predicate = Pattern.compile(patternString).asMatchPredicate(); + this.predicate = compile(patternString).asMatchPredicate(); this.transformer = transformer; } + private static Pattern compile(String patternString) { + return Pattern.compile(patternString); + } + @Override public ValidationCheckResult check(String value) { ValidationCheckResult validationCheckResult; diff --git a/src/main/java/fr/inra/oresing/model/Duration.java b/src/main/java/fr/inra/oresing/model/Duration.java index d83e0971c..18c50694a 100644 --- a/src/main/java/fr/inra/oresing/model/Duration.java +++ b/src/main/java/fr/inra/oresing/model/Duration.java @@ -19,6 +19,11 @@ public class Duration { this.temporalUnit = ChronoUnit.valueOf(matcher.group(2).toUpperCase()); } } + + public static boolean isValid(String duration) { + return PATTERN.matcher(duration).matches(); + } + LocalDateTimeRange getLocalDateTimeRange(LocalDateTime date){ return LocalDateTimeRange.between(LocalDateTime.from(date), date.plus(amount, temporalUnit)); } diff --git a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java index b52b2dd94..4614f0fbf 100644 --- a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java +++ b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java @@ -12,10 +12,13 @@ import com.google.common.collect.Sets; import com.google.common.collect.TreeMultiset; import fr.inra.oresing.OreSiTechnicalException; import fr.inra.oresing.checker.CheckerTarget; +import fr.inra.oresing.checker.DateLineChecker; import fr.inra.oresing.checker.GroovyConfiguration; import fr.inra.oresing.checker.GroovyLineChecker; +import fr.inra.oresing.checker.RegularExpressionChecker; import fr.inra.oresing.groovy.GroovyExpression; import fr.inra.oresing.model.Configuration; +import fr.inra.oresing.model.Duration; import fr.inra.oresing.model.LocalDateTimeRange; import fr.inra.oresing.model.ReferenceColumn; import fr.inra.oresing.model.VariableComponentKey; @@ -483,6 +486,21 @@ public class ApplicationConfigurationService { public void recordUnknownCheckerNameForValidationRule(String validationRuleDescriptionEntryKey, String checkerName, ImmutableSet<String> allCheckerNames) { builder.recordUnknownCheckerNameForValidationRuleInDataType(validationRuleDescriptionEntryKey, dataType, checkerName, allCheckerNames); } + + @Override + public void invalidPatternForDateChecker(String validationRuleDescriptionEntryKey, String pattern) { + builder.invalidPatternForDateCheckerForValidationRuleInDataType(validationRuleDescriptionEntryKey, dataType, pattern); + } + + @Override + public void invalidDurationForDateChecker(String validationRuleDescriptionEntryKey, String duration) { + builder.invalidDurationForDateCheckerForValidationRuleInDataType(validationRuleDescriptionEntryKey, dataType, duration); + } + + @Override + public void invalidPatternForRegularExpressionChecker(String validationRuleDescriptionEntryKey, String pattern) { + builder.invalidPatternForRegularExpressionCheckerForValidationRuleInDataType(validationRuleDescriptionEntryKey, dataType, pattern); + } }; for (Map.Entry<String, Configuration.LineValidationRuleWithVariableComponentsDescription> validationRuleDescriptionEntry : dataTypeDescription.getValidations().entrySet()) { String validationRuleDescriptionEntryKey = validationRuleDescriptionEntry.getKey(); @@ -524,6 +542,21 @@ public class ApplicationConfigurationService { // OK builder.recordUnknownCheckerNameForVariableComponentChecker(dataType, datum, component, checkerName, knownCheckerNames); } + + @Override + public void invalidPatternForDateChecker(String pattern) { + builder.invalidPatternForVariableComponentDateChecker(dataType, datum, component, pattern); + } + + @Override + public void invalidDurationForDateChecker(String duration) { + builder.invalidDurationForVariableComponentDateChecker(dataType, datum, component, duration); + } + + @Override + public void invalidPatternForRegularExpressionChecker(String pattern) { + builder.invalidPatternForVariableComponentRegularExpressionChecker(dataType, datum, component, pattern); + } }, checkerDescription); } } @@ -563,6 +596,21 @@ public class ApplicationConfigurationService { // OK builder.unknownCheckerNameInReferenceColumn(referenceToValidate, column, checkerName, knownCheckerNames); } + + @Override + public void invalidPatternForDateChecker(String pattern) { + builder.invalidPatternForForReferenceColumnDateChecker(referenceToValidate, column, pattern); + } + + @Override + public void invalidDurationForDateChecker(String duration) { + builder.invalidDurationForReferenceColumnDateChecker(referenceToValidate, column, duration); + } + + @Override + public void invalidPatternForRegularExpressionChecker(String pattern) { + builder.invalidPatternForReferenceColumnRegularExpressionChecker(referenceToValidate, column, pattern); + } }, checkerDescription); } } @@ -578,11 +626,18 @@ public class ApplicationConfigurationService { void missingReferenceForChecker(Set<String> references); void unknownCheckerOnOneTargetName(String checkerName, ImmutableSet<String> validCheckerNames); + + void invalidPatternForDateChecker(String pattern); + + void invalidDurationForDateChecker(String duration); + + void invalidPatternForRegularExpressionChecker(String pattern); } private void verifyCheckerOnOneTarget(CheckerOnOneTargetValidationContext builder, Configuration.CheckerDescription checkerDescription) { - if (CHECKER_ON_TARGET_NAMES.contains(checkerDescription.getName())) { - if ("Reference".equals(checkerDescription.getName())) { + String checkerName = checkerDescription.getName(); + if (CHECKER_ON_TARGET_NAMES.contains(checkerName)) { + if ("Reference".equals(checkerName)) { if (checkerDescription.getParams() != null && checkerDescription.getParams().getRefType() != null) { String refType = checkerDescription.getParams().getRefType(); if (!builder.getReferences().contains(refType)) { @@ -591,9 +646,26 @@ public class ApplicationConfigurationService { } else { builder.missingReferenceForChecker(builder.getReferences()); } + } else if ("Date".equals(checkerName)) { + String datePattern = checkerDescription.getParams().getPattern(); + if (DateLineChecker.isValidPattern(datePattern)) { + String duration = checkerDescription.getParams().getDuration(); + if (StringUtils.isBlank(duration)) { + // OK, champs facultatif + } else if (!Duration.isValid(duration)) { + builder.invalidDurationForDateChecker(duration); + } + } else { + builder.invalidPatternForDateChecker(datePattern); + } + } else if ("RegularExpression".equals(checkerName)) { + String regularExpressionPattern = checkerDescription.getParams().getPattern(); + if (!RegularExpressionChecker.isValid(regularExpressionPattern)) { + builder.invalidPatternForRegularExpressionChecker(regularExpressionPattern); + } } } else { - builder.unknownCheckerOnOneTargetName(checkerDescription.getName(), CHECKER_ON_TARGET_NAMES); + builder.unknownCheckerOnOneTargetName(checkerName, CHECKER_ON_TARGET_NAMES); } } @@ -807,6 +879,21 @@ public class ApplicationConfigurationService { // OK builder.recordUnknownCheckerNameForValidationRuleInReference(validationRuleDescriptionEntryKey, reference, checkerName, allCheckerNames); } + + @Override + public void invalidPatternForDateChecker(String validationRuleDescriptionEntryKey, String pattern) { + builder.invalidPatternForDateCheckerForValidationRuleInReference(validationRuleDescriptionEntryKey, reference, pattern); + } + + @Override + public void invalidDurationForDateChecker(String validationRuleDescriptionEntryKey, String duration) { + builder.invalidDurationForDateCheckerForValidationRuleInReference(validationRuleDescriptionEntryKey, reference, duration); + } + + @Override + public void invalidPatternForRegularExpressionChecker(String validationRuleDescriptionEntryKey, String pattern) { + builder.invalidPatternForRegularExpressionCheckerForValidationRuleInReference(validationRuleDescriptionEntryKey, reference, pattern); + } }; for (Map.Entry<String, Configuration.LineValidationRuleWithColumnsDescription> validationRuleDescriptionEntry : referenceDescription.getValidations().entrySet()) { String validationRuleDescriptionEntryKey = validationRuleDescriptionEntry.getKey(); @@ -836,6 +923,12 @@ public class ApplicationConfigurationService { void missingReferenceForChecker(String validationRuleDescriptionEntryKey, Set<String> references); void recordUnknownCheckerNameForValidationRule(String validationRuleDescriptionEntryKey, String checkerName, ImmutableSet<String> allCheckerNames); + + void invalidPatternForDateChecker(String validationRuleDescriptionEntryKey, String pattern); + + void invalidDurationForDateChecker(String validationRuleDescriptionEntryKey, String duration); + + void invalidPatternForRegularExpressionChecker(String validationRuleDescriptionEntryKey, String pattern); } private void verifyLineValidationRuleDescription(LineValidationRuleDescriptionValidationContext builder, String validationRuleDescriptionEntryKey, Configuration.LineValidationRuleDescription lineValidationRuleDescription) { @@ -883,6 +976,21 @@ public class ApplicationConfigurationService { public void unknownCheckerOnOneTargetName(String checkerName, ImmutableSet<String> validCheckerNames) { builder.recordUnknownCheckerNameForVariableComponentChecker(validationRuleDescriptionEntryKey, checkerName, validCheckerNames); } + + @Override + public void invalidPatternForDateChecker(String pattern) { + builder.invalidPatternForDateChecker(validationRuleDescriptionEntryKey, pattern); + } + + @Override + public void invalidDurationForDateChecker(String duration) { + builder.invalidDurationForDateChecker(validationRuleDescriptionEntryKey, duration); + } + + @Override + public void invalidPatternForRegularExpressionChecker(String pattern) { + builder.invalidPatternForRegularExpressionChecker(validationRuleDescriptionEntryKey, pattern); + } }, checker); } else { builder.recordUnknownCheckerNameForValidationRule(validationRuleDescriptionEntryKey, checker.getName(), ALL_CHECKER_NAMES); diff --git a/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java b/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java index 5d8545b0f..997adbdaa 100644 --- a/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java +++ b/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java @@ -574,5 +574,104 @@ public class ConfigurationParsingResult { "knownCheckerNames", knownCheckerNames )); } + + public Builder invalidPatternForVariableComponentDateChecker(String dataType, String variable, String component, String pattern) { + return recordError("invalidPatternForVariableComponentDateChecker", ImmutableMap.of( + "dataType", dataType, + "variable", variable, + "component", component, + "pattern", pattern + )); + } + + public Builder invalidPatternForForReferenceColumnDateChecker(String referenceToValidate, String column, String pattern) { + return recordError("invalidPatternForForVariableComponentDateChecker", ImmutableMap.of( + "referenceToValidate", referenceToValidate, + "column", column, + "pattern", pattern + )); + } + + public Builder invalidPatternForDateCheckerForValidationRuleInDataType(String validationRuleDescriptionEntryKey, String dataType, String pattern) { + return recordError("invalidPatternForDateCheckerForValidationRuleInDataType", ImmutableMap.of( + "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, + "dataType", dataType, + "pattern", pattern + )); + } + + public Builder invalidPatternForDateCheckerForValidationRuleInReference(String validationRuleDescriptionEntryKey, String reference, String pattern) { + return recordError("invalidPatternForDateCheckerForValidationRuleInReference", ImmutableMap.of( + "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, + "reference", reference, + "pattern", pattern + )); + } + + public Builder invalidDurationForVariableComponentDateChecker(String dataType, String variable, String component, String duration) { + return recordError("invalidDurationForVariableComponentDateChecker", ImmutableMap.of( + "dataType", dataType, + "variable", variable, + "component", component, + "duration", duration + )); + } + + public Builder invalidDurationForReferenceColumnDateChecker(String referenceToValidate, String column, String duration) { + return recordError("invalidDurationForReferenceColumnDateChecker", ImmutableMap.of( + "referenceToValidate", referenceToValidate, + "column", column, + "duration", duration + )); + } + + public Builder invalidDurationForDateCheckerForValidationRuleInDataType(String validationRuleDescriptionEntryKey, String dataType, String duration) { + return recordError("invalidDurationForDateCheckerForValidationRuleInDataType", ImmutableMap.of( + "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, + "dataType", dataType, + "duration", duration + )); + } + + public Builder invalidDurationForDateCheckerForValidationRuleInReference(String validationRuleDescriptionEntryKey, String reference, String duration) { + return recordError("invalidDurationForDateCheckerForValidationRuleInReference", ImmutableMap.of( + "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, + "reference", reference, + "duration", duration + )); + } + + public Builder invalidPatternForVariableComponentRegularExpressionChecker(String dataType, String variable, String component, String pattern) { + return recordError("invalidPatternForVariableComponentRegularExpressionChecker", ImmutableMap.of( + "dataType", dataType, + "variable", variable, + "component", component, + "pattern", pattern + )); + } + + public Builder invalidPatternForReferenceColumnRegularExpressionChecker(String referenceToValidate, String column, String pattern) { + return recordError("invalidPatternForReferenceColumnRegularExpressionChecker", ImmutableMap.of( + "referenceToValidate", referenceToValidate, + "column", column, + "pattern", pattern + )); + } + + public Builder invalidPatternForRegularExpressionCheckerForValidationRuleInDataType(String validationRuleDescriptionEntryKey, String dataType, String pattern) { + return recordError("invalidPatternForRegularExpressionCheckerForValidationRuleInDataType", ImmutableMap.of( + "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, + "dataType", dataType, + "pattern", pattern + )); + } + + public Builder invalidPatternForRegularExpressionCheckerForValidationRuleInReference(String validationRuleDescriptionEntryKey, String reference, String pattern) { + return recordError("invalidPatternForRegularExpressionCheckerForValidationRuleInReference", ImmutableMap.of( + "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, + "reference", reference, + "pattern", pattern + )); + } } } diff --git a/ui/src/locales/en.json b/ui/src/locales/en.json index 2f97ffcda..c1d5a0767 100644 --- a/ui/src/locales/en.json +++ b/ui/src/locales/en.json @@ -114,6 +114,10 @@ "illegalGroovyExpressionForValidationRuleInReference":"For the validation rule <code>{lineValidationRuleKey}</code> in reference <code>{reference}</code>, the expression : <code>{expression}</code> is not correct. Expression compilation error at line : <code>{compilationError.lineNumber}</code> (column : <code>{compilationError.columnNumber}</code>) message '<code>{compilationError.message}</code>'", "invalidDate": "For the identified component: <code> {target} </code> the date <code> {value} </code> does not respect the expected format: <code> {pattern} </code>. ", "invalidDateWithColumn": "For column: <code> {column} </code> the date <code> {value} </code> does not respect the expected format: <code> {pattern} </code>." , + "invalidDurationForDateCheckerForValidationRuleInDataType": "The 'duration' <code>{duration}</code> defined for validation rule <code>{validationRuleDescriptionEntryKey}</code> of data type <code>{dataType}</code> is incorrect", + "invalidDurationForDateCheckerForValidationRuleInReference": "The 'duration' <code>{duration}</code> defined for validation rule <code>{validationRuleDescriptionEntryKey}</code> of reference <code>{reference}</code> is incorrect", + "invalidDurationForForVariableComponentDateChecker": "The 'duration' <code>{duration}</code> defined for column <code>{column}</code> of reference <code>{referenceToValidate}</code> is incorrect", + "invalidDurationForVariableComponentDateChecker": "The 'duration' <code>{duration}</code> defined for component <code>{component}</code> of variable <code>{variable}</code> of data type <code>{dataType}</code> is incorrect", "invalidFloat": "For the identified component: <code> {target} </code> the value <code> {value} </code> must be a decimal number.", "invalidFloatWithColumn": "For column: <code> {target} </code> the value <code> {value} </code> must be a decimal number.", "invalidFormat":"Error in line : <code>{lineNumber}</code> (column : <code>{columnNumber}</code>) : <code>{value}</code> doesn't have the right format. <br>Expected format : <code>{targetTypeName}</code>", @@ -123,6 +127,14 @@ "invalidInternationalizedColumns":"In the repository description <code> {reference} </code>, the columns <code> {unknownUsedAsInternationalizedColumns} </code> are declared as part of internationalizable columns when they do not exist. Known columns: <code> {knownColumns} </code> ", "invalidInternationalizedColumnsForDataType": "In the <code> {reference} </code> repository overload of the <code> {dataType} </code> data type description, the <code> {unknownUsedAsInternationalizedColumns} </code> columns are declared as part of internationalizable columns when they do not exist. Known columns: <code> {knownColumns} </code> ", "invalidKeyColumns":"In the description of reference <code>{reference}</code>, colomns <code>{unknownUsedAsKeyElementColumns}</code> are declared as components of the key but there are no such columns. Known columns are <code>{knownColumns}</code>", + "invalidPatternForDateCheckerForValidationRuleInDataType": "The regular expression <code>{pattern}</code> defined for validation rule <code>{validationRuleDescriptionEntryKey}</code> of data type <code>{dataType}</code> is incorrect", + "invalidPatternForDateCheckerForValidationRuleInReference": "The regular expression <code>{pattern}</code> defined for validation rule <code>{validationRuleDescriptionEntryKey}</code> of reference <code>{reference}</code> is incorrect", + "invalidPatternForForVariableComponentDateChecker": "The regular expression <code>{pattern}</code> defined for column <code>{column}</code> of reference <code>{referenceToValidate}</code> is incorrect", + "invalidPatternForForVariableComponentRegularExpressionChecker": "The regular expression pattern <code>{pattern}</code> defined for column <code>{column}</code> of reference <code>{referenceToValidate}</code> is incorrect", + "invalidPatternForRegularExpressionCheckerForValidationRuleInDataType": "The regular expression pattern <code>{pattern}</code> defined for the validation rule <code>{validationRuleDescriptionEntryKey}</code> of data type <code>{dataType}</code> is incorrect", + "invalidPatternForRegularExpressionCheckerForValidationRuleInReference": "The regular expression pattern <code>{pattern}</code> defined for the validation rule <code>{validationRuleDescriptionEntryKey}</code> of reference <code>{reference}</code> is incorrect", + "invalidPatternForVariableComponentDateChecker": "The regular expression <code>{pattern}</code> defined for component <code>{component}</code> of variable <code>{variable}</code> of data type <code>{dataType}</code> is incorrect", + "invalidPatternForVariableComponentRegularExpressionChecker": "The regular expression pattern <code>{pattern}</code> defined for the component <code>{component}</code> of variable <code>{variable}</code> of data type <code>{dataType}</code> is incorrect", "invalidReference": "For the identified component: <code> {target} </code> the value <code> {value} </code> does not exist in the reference <code> {refType} </code>. Expected values ​​<code> {referenceValues} </code>. ", "invalidReferenceWithColumn": "For column: <code> {target} </code> the value <code> {value} </code> does not exist in the reference <code> {refType} </code>. Values expected <code> {referenceValues} </code>. ", "missingAggregationComponentForChart":"In the graph description of variable <code>{variable}</code> of data type <code>{dataType}</code>, component <code>{aggregationComponent}</code> of the aggregation variable <code>{aggregationVariable}</code> is not declared.<br /> Expected Values ​​<code>{components}</code>", diff --git a/ui/src/locales/fr.json b/ui/src/locales/fr.json index 79c86ff5b..ff37a124f 100644 --- a/ui/src/locales/fr.json +++ b/ui/src/locales/fr.json @@ -114,6 +114,10 @@ "illegalGroovyExpressionForValidationRuleInReference": "Pour la règle de validation <code>{lineValidationRuleKey}</code> de la référence {reference}, l’expression renseignée <code>{expression}</code> n’est pas correcte. Erreur de compilation de l’expression à la ligne <code>{compilationError.lineNumber}</code> (colonne <code>{compilationError.columnNumber}</code>) message '<code>{compilationError.message}</code>'", "invalidDate": "Pour le composant identifié : <code>{target}</code> la date <code>{value}</code> ne respecte pas le format attendu : <code>{pattern}</code>. ", "invalidDateWithColumn": "Pour la colonne : <code>{column}</code> la date <code>{value}</code> ne respecte pas le format attendu : <code>{pattern}</code>. ", + "invalidDurationForDateCheckerForValidationRuleInDataType": "La 'duration' <code>{duration}</code> définie pour la règle de validation <code>{validationRuleDescriptionEntryKey}</code> du type de données <code>{dataType}</code> est incorrecte", + "invalidDurationForDateCheckerForValidationRuleInReference": "La 'duration' <code>{duration}</code> définie pour la règle de validation <code>{validationRuleDescriptionEntryKey}</code> du référentiel <code>{reference}</code> est incorrecte", + "invalidDurationForForVariableComponentDateChecker": "La 'duration' <code>{duration}</code> définie pour la colonne <code>{column}</code> du référentiel <code>{referenceToValidate}</code> est incorrecte", + "invalidDurationForVariableComponentDateChecker": "La 'duration' <code>{duration}</code> définie pour le composant <code>{component}</code> de la variable <code>{variable}</code> du type de données <code>{dataType}</code> est incorrecte", "invalidFloat": "Pour le composant identifié : <code>{target}</code> la valeur <code>{value}</code> doit être un nombre décimal.", "invalidFloatWithColumn": "Pour la colonne : <code>{target}</code> la valeur <code>{value}</code> doit être un nombre décimal.", "invalidFormat": "Erreur à la ligne <code>{lineNumber}</code> (colonne <code>{columnNumber}</code>) : '<code>{value}</code>' n’a pas le bon format. Le type attendu est <code>{targetTypeName}</code>", @@ -123,6 +127,14 @@ "invalidInternationalizedColumns": "Dans la description du référentiel <code>{reference}</code>, les colonnes <code>{unknownUsedAsInternationalizedColumns}</code> sont déclarées comme faisant partie de colonnes internationalisables alors qu’elles n’existent pas. Colonnes connues : <code>{knownColumns}</code>", "invalidInternationalizedColumnsForDataType": "Dans la surcharge du référentiel <code>{reference}</code> de la description du type de donnée <code>{dataType}</code>, les colonnes <code>{unknownUsedAsInternationalizedColumns}</code> sont déclarées comme faisant partie de colonnes internationalisables alors qu’elles n’existent pas. Colonnes connues : <code>{knownColumns}</code>", "invalidKeyColumns": "Dans la description du référentiel <code>{reference}</code>, les colonnes <code>{unknownUsedAsKeyElementColumns}</code> sont déclarées comme faisant partie de la clé alors qu’elles n’existent pas. Colonnes connues : <code>{knownColumns}</code>", + "invalidPatternForDateCheckerForValidationRuleInDataType": "L'expression régulière <code>{pattern}</code> définie pour la règle de validation <code>{validationRuleDescriptionEntryKey}</code> du type de données <code>{dataType}</code> est incorrecte", + "invalidPatternForDateCheckerForValidationRuleInReference": "L'expression régulière <code>{pattern}</code> définie pour la règle de validation <code>{validationRuleDescriptionEntryKey}</code> du référentiel <code>{reference}</code> est incorrecte", + "invalidPatternForForVariableComponentDateChecker": "L'expression régulière <code>{pattern}</code> définie pour la colonne <code>{column}</code> du référentiel <code>{referenceToValidate}</code> est incorrecte", + "invalidPatternForForVariableComponentRegularExpressionChecker": "Le format de regularExpression <code>{pattern}</code> défini pour la colonne <code>{column}</code> du référentiel <code>{referenceToValidate}</code> est incorrect", + "invalidPatternForRegularExpressionCheckerForValidationRuleInDataType": "Le format de regularExpression <code>{pattern}</code> défini pour la règle de validation <code>{validationRuleDescriptionEntryKey}</code> du type de données <code>{dataType}</code> est incorrect", + "invalidPatternForRegularExpressionCheckerForValidationRuleInReference": "Le format de regularExpression <code>{pattern}</code> défini pour la règle de validation <code>{validationRuleDescriptionEntryKey}</code> du référentiel <code>{reference}</code> est incorrect", + "invalidPatternForVariableComponentDateChecker": "L'expression régulière <code>{pattern}</code> définie pour le composant <code>{component}</code> de la variable <code>{variable}</code> du type de données <code>{dataType}</code> est incorrecte", + "invalidPatternForVariableComponentRegularExpressionChecker": "Le format de regularExpression <code>{pattern}</code> défini pour le composant <code>{component}</code> de la variable <code>{variable}</code> du type de données <code>{dataType}</code> est incorrect", "invalidReference": "Pour le composant identifié : <code>{target}</code> la valeur <code>{value}</code> n'existe pas dans la référence <code>{refType}</code>. Valeurs attendues <code>{referenceValues}</code>.", "invalidReferenceWithColumn": "Pour la colonne : <code>{target}</code> la valeur <code>{value}</code> n'existe pas dans la référence <code>{refType}</code>. Valeurs attendues <code>{referenceValues}</code>.", "missingAggregationComponentForChart":"Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, le componsant <code> {aggregationComponent}</code> de la variable d'aggrégation <code> {aggregationVariable}</code> n'est pas déclarée.<br /> Valeurs attendues <code>{components}</code>", diff --git a/ui/src/services/ErrorsService.js b/ui/src/services/ErrorsService.js index 507b435a3..89ecd3ad9 100644 --- a/ui/src/services/ErrorsService.js +++ b/ui/src/services/ErrorsService.js @@ -23,6 +23,10 @@ const ERRORS = { illegalGroovyExpressionForValidationRuleInReference: (params) => i18n.t("errors.illegalGroovyExpressionForValidationRuleInReference", params), invalidDate: (params) => i18n.t("errors.invalidDate", params), invalidDateWithColumn: (params) => i18n.t("errors.invalidDateWithColumn", params), + invalidDurationForDateCheckerForValidationRuleInDataType: (params) => i18n.t("errors.invalidDurationForDateCheckerForValidationRuleInDataType", params), + invalidDurationForDateCheckerForValidationRuleInReference: (params) => i18n.t("errors.invalidDurationForDateCheckerForValidationRuleInReference", params), + invalidDurationForForVariableComponentDateChecker: (params) => i18n.t("errors.invalidDurationForForVariableComponentDateChecker", params), + invalidDurationForVariableComponentDateChecker: (params) => i18n.t("errors.invalidDurationForVariableComponentDateChecker", params), invalidFloat: (params) => i18n.t("errors.invalidFloat", params), invalidFloatWithColumn: (params) => i18n.t("errors.invalidFloatWithColumn", params), invalidFormat: (params) => i18n.t("errors.invalidFormat", params), @@ -32,6 +36,14 @@ const ERRORS = { invalidInternationalizedColumns: (params) => i18n.t("errors.invalidInternationalizedColumns", params), invalidInternationalizedColumnsForDataType: (params) => i18n.t("errors.invalidInternationalizedColumnsForDataType", params), invalidKeyColumns: (params) => i18n.t("errors.invalidKeyColumns", params), + invalidPatternForDateCheckerForValidationRuleInDataType: (params) => i18n.t("errors.invalidPatternForDateCheckerForValidationRuleInDataType", params), + invalidPatternForDateCheckerForValidationRuleInReference: (params) => i18n.t("errors.invalidPatternForDateCheckerForValidationRuleInReference", params), + invalidPatternForForVariableComponentDateChecker: (params) => i18n.t("errors.invalidPatternForForVariableComponentDateChecker", params), + invalidPatternForForVariableComponentRegularExpressionChecker: (params) => i18n.t("errors.invalidPatternForForVariableComponentRegularExpressionChecker", params), + invalidPatternForRegularExpressionCheckerForValidationRuleInDataType: (params) => i18n.t("errors.invalidPatternForRegularExpressionCheckerForValidationRuleInDataType", params), + invalidPatternForRegularExpressionCheckerForValidationRuleInReference: (params) => i18n.t("errors.invalidPatternForRegularExpressionCheckerForValidationRuleInReference", params), + invalidPatternForVariableComponentDateChecker: (params) => i18n.t("errors.invalidPatternForVariableComponentDateChecker", params), + invalidPatternForVariableComponentRegularExpressionChecker: (params) => i18n.t("errors.invalidPatternForVariableComponentRegularExpressionChecker", params), invalidReference: (params) => i18n.t("errors.invalidReference", params), invalidReferenceWithColumn: (params) => i18n.t("errors.invalidReferenceWithColumn", params), missingAggregationComponentForChart: (params) => i18n.t("errors.missingAggregationComponentForChart", params), -- GitLab From ffdc868a2f0a60902ee1322679ebf2a8cac07ca7 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Tue, 5 Apr 2022 17:41:00 +0200 Subject: [PATCH 35/41] Indentation et tri des erreurs dans les bundle i18n --- ui/src/locales/en.json | 126 ++++++++++++++++++++--------------------- ui/src/locales/fr.json | 12 ++-- 2 files changed, 69 insertions(+), 69 deletions(-) diff --git a/ui/src/locales/en.json b/ui/src/locales/en.json index c1d5a0767..07a523f7a 100644 --- a/ui/src/locales/en.json +++ b/ui/src/locales/en.json @@ -92,41 +92,41 @@ "change": "Edit app", "version" : "The current version of the application <b class=\"has-text-primary\">{applicationName}</b> is <b class=\"has-text-primary\">{version}.</b>" }, - "errors":{ - "authorizationScopeVariableComponentKeyMissingVariable":"You must indicate the variable in which to collect the spatial information to which to attach the data for the management of the rights dataset <code> {dataType} </code> for the authorization <code> {authorizationName} </code>. Possible values ​​<code> {variables} </code> ", - "authorizationScopeVariableComponentKeyUnknownVariable":"<code> {variable} </code> is not one of the known columns <code> {knownVariables} </code>", - "authorizationScopeVariableComponentReftypeNull":"No reference has been defined for the <code> {component} </code> component of the variable <code> {variable} </code>. Accepted references: <code> {knownPatterns} </ code> ", - "authorizationScopeVariableComponentReftypeUnknown":"The <code> {refType} </code> reference of the <code> {component} </code> component of the <code> {variable} </code> variable has not been declared. accepted: <code> {knownPatterns} </code> ", - "authorizationScopeVariableComponentWrongChecker":"The <code> {component} </code> component of the <code> {variable} </code> variable cannot be used as carrying time information because it is not declared data like <code> {expectedChecker} </code> ", - "authorizationVariableComponentKeyMissingComponent":"You must indicate the component of the variable <code> {variable} </code> in which we collect the spatial information to which to attach the data for the management of rights dataset <code> {dataType} < / code> for authorization <code> {authorizationName} </code>. Possible values ​​<code> {knownComponents} </code> ", - "authorizationVariableComponentKeyUnknownComponent":"<code> {component} </code> is not one of the known components for the variable <code> {variable} </code>. Known components: <code> {knownComponents} </code>", - "badauthorizationscopeforrepository":"Authorization <code> {authorization} </code>) must be <code> {expectedValue} / code> and not <code> {givenValue} </code>", + "errors": { + "authorizationScopeVariableComponentKeyMissingVariable": "You must indicate the variable in which to collect the spatial information to which to attach the data for the management of the rights dataset <code> {dataType} </code> for the authorization <code> {authorizationName} </code>. Possible values ​​<code> {variables} </code> ", + "authorizationScopeVariableComponentKeyUnknownVariable": "<code> {variable} </code> is not one of the known columns <code> {knownVariables} </code>", + "authorizationScopeVariableComponentReftypeNull": "No reference has been defined for the <code> {component} </code> component of the variable <code> {variable} </code>. Accepted references: <code> {knownPatterns} </ code> ", + "authorizationScopeVariableComponentReftypeUnknown": "The <code> {refType} </code> reference of the <code> {component} </code> component of the <code> {variable} </code> variable has not been declared. accepted: <code> {knownPatterns} </code> ", + "authorizationScopeVariableComponentWrongChecker": "The <code> {component} </code> component of the <code> {variable} </code> variable cannot be used as carrying time information because it is not declared data like <code> {expectedChecker} </code> ", + "authorizationVariableComponentKeyMissingComponent": "You must indicate the component of the variable <code> {variable} </code> in which we collect the spatial information to which to attach the data for the management of rights dataset <code> {dataType} < / code> for authorization <code> {authorizationName} </code>. Possible values ​​<code> {knownComponents} </code> ", + "authorizationVariableComponentKeyUnknownComponent": "<code> {component} </code> is not one of the known components for the variable <code> {variable} </code>. Known components: <code> {knownComponents} </code>", + "badauthorizationscopeforrepository": "Authorization <code> {authorization} </code>) must be <code> {expectedValue} / code> and not <code> {givenValue} </code>", "checkerExpressionReturnedFalse": "The following constraint is not respected: <code> {expression} </code>", - "csvBoundToUnknownVariable":"In the CSV format, header <code>{header}</code> is bound to unknown variable <code>{variable}</code>. Known variables: <code>{variables}</code>", - "csvBoundToUnknownVariableComponent":"In the CSV format, header <code>{header}</code> is bound to <code>{variable}</code> but it has no <code>{component}</code> component. Known components: <code>{components}</code>", + "csvBoundToUnknownVariable": "In the CSV format, header <code>{header}</code> is bound to unknown variable <code>{variable}</code>. Known variables: <code>{variables}</code>", + "csvBoundToUnknownVariableComponent": "In the CSV format, header <code>{header}</code> is bound to <code>{variable}</code> but it has no <code>{component}</code> component. Known components: <code>{components}</code>", "duplicateLineInDatatype": "In data file {file}, line {lineNumber} has the same identifier {duplicateKey} as lines {otherLines}", "duplicateLineInReference": "In the repository file {file}, line {lineNumber} has the same id {duplicateKey} as lines {otherLines}", - "duplicatedHeaders":"These headers are duplicated : <code>{duplicatedHeaders}</code>", - "emptyFile":"File is empty", + "duplicatedHeaders": "These headers are duplicated : <code>{duplicatedHeaders}</code>", + "emptyFile": "File is empty", "emptyHeader": "The file contains a column with an empty header", - "headerColumnPatternNotMatching":"Column header pattern not matching. Pattern to match : <code>{expectedHeaderColumnPattern}</code><br/>Actual header : <code>{actualHeaderColumn}</code>", - "illegalGroovyExpressionForValidationRuleInDataType":"For the validation rule <code>{lineValidationRuleKey}</code> in data type <code>{dataType}</code>, the expression : <code>{expression}</code> is not correct. Expression compilation error at line : <code>{compilationError.lineNumber}</code> (column : <code>{compilationError.columnNumber}</code>) message '<code>{compilationError.message}</code>'", - "illegalGroovyExpressionForValidationRuleInReference":"For the validation rule <code>{lineValidationRuleKey}</code> in reference <code>{reference}</code>, the expression : <code>{expression}</code> is not correct. Expression compilation error at line : <code>{compilationError.lineNumber}</code> (column : <code>{compilationError.columnNumber}</code>) message '<code>{compilationError.message}</code>'", + "headerColumnPatternNotMatching": "Column header pattern not matching. Pattern to match : <code>{expectedHeaderColumnPattern}</code><br/>Actual header : <code>{actualHeaderColumn}</code>", + "illegalGroovyExpressionForValidationRuleInDataType": "For the validation rule <code>{lineValidationRuleKey}</code> in data type <code>{dataType}</code>, the expression : <code>{expression}</code> is not correct. Expression compilation error at line : <code>{compilationError.lineNumber}</code> (column : <code>{compilationError.columnNumber}</code>) message '<code>{compilationError.message}</code>'", + "illegalGroovyExpressionForValidationRuleInReference": "For the validation rule <code>{lineValidationRuleKey}</code> in reference <code>{reference}</code>, the expression : <code>{expression}</code> is not correct. Expression compilation error at line : <code>{compilationError.lineNumber}</code> (column : <code>{compilationError.columnNumber}</code>) message '<code>{compilationError.message}</code>'", "invalidDate": "For the identified component: <code> {target} </code> the date <code> {value} </code> does not respect the expected format: <code> {pattern} </code>. ", - "invalidDateWithColumn": "For column: <code> {column} </code> the date <code> {value} </code> does not respect the expected format: <code> {pattern} </code>." , + "invalidDateWithColumn": "For column: <code> {column} </code> the date <code> {value} </code> does not respect the expected format: <code> {pattern} </code>.", "invalidDurationForDateCheckerForValidationRuleInDataType": "The 'duration' <code>{duration}</code> defined for validation rule <code>{validationRuleDescriptionEntryKey}</code> of data type <code>{dataType}</code> is incorrect", "invalidDurationForDateCheckerForValidationRuleInReference": "The 'duration' <code>{duration}</code> defined for validation rule <code>{validationRuleDescriptionEntryKey}</code> of reference <code>{reference}</code> is incorrect", "invalidDurationForForVariableComponentDateChecker": "The 'duration' <code>{duration}</code> defined for column <code>{column}</code> of reference <code>{referenceToValidate}</code> is incorrect", "invalidDurationForVariableComponentDateChecker": "The 'duration' <code>{duration}</code> defined for component <code>{component}</code> of variable <code>{variable}</code> of data type <code>{dataType}</code> is incorrect", "invalidFloat": "For the identified component: <code> {target} </code> the value <code> {value} </code> must be a decimal number.", "invalidFloatWithColumn": "For column: <code> {target} </code> the value <code> {value} </code> must be a decimal number.", - "invalidFormat":"Error in line : <code>{lineNumber}</code> (column : <code>{columnNumber}</code>) : <code>{value}</code> doesn't have the right format. <br>Expected format : <code>{targetTypeName}</code>", - "invalidHeaders":"Invalid headers. Expected columns : <code>{expectedColumns}</code><br/>Actual columns : <code>{actualColumns}</code><br/>Missing columns : <code>{missingColumns}</code><br/>Unknown columns : <code>{unknownColumns}</code>", + "invalidFormat": "Error in line : <code>{lineNumber}</code> (column : <code>{columnNumber}</code>) : <code>{value}</code> doesn't have the right format. <br>Expected format : <code>{targetTypeName}</code>", + "invalidHeaders": "Invalid headers. Expected columns : <code>{expectedColumns}</code><br/>Actual columns : <code>{actualColumns}</code><br/>Missing columns : <code>{missingColumns}</code><br/>Unknown columns : <code>{unknownColumns}</code>", "invalidInteger": "For the identified component: <code> {target} </code> the value <code> {value} </code> must be an integer.", "invalidIntegerWithColumn": "For column: <code> {target} </code> the value <code> {value} </code> must be an integer.", - "invalidInternationalizedColumns":"In the repository description <code> {reference} </code>, the columns <code> {unknownUsedAsInternationalizedColumns} </code> are declared as part of internationalizable columns when they do not exist. Known columns: <code> {knownColumns} </code> ", + "invalidInternationalizedColumns": "In the repository description <code> {reference} </code>, the columns <code> {unknownUsedAsInternationalizedColumns} </code> are declared as part of internationalizable columns when they do not exist. Known columns: <code> {knownColumns} </code> ", "invalidInternationalizedColumnsForDataType": "In the <code> {reference} </code> repository overload of the <code> {dataType} </code> data type description, the <code> {unknownUsedAsInternationalizedColumns} </code> columns are declared as part of internationalizable columns when they do not exist. Known columns: <code> {knownColumns} </code> ", - "invalidKeyColumns":"In the description of reference <code>{reference}</code>, colomns <code>{unknownUsedAsKeyElementColumns}</code> are declared as components of the key but there are no such columns. Known columns are <code>{knownColumns}</code>", + "invalidKeyColumns": "In the description of reference <code>{reference}</code>, colomns <code>{unknownUsedAsKeyElementColumns}</code> are declared as components of the key but there are no such columns. Known columns are <code>{knownColumns}</code>", "invalidPatternForDateCheckerForValidationRuleInDataType": "The regular expression <code>{pattern}</code> defined for validation rule <code>{validationRuleDescriptionEntryKey}</code> of data type <code>{dataType}</code> is incorrect", "invalidPatternForDateCheckerForValidationRuleInReference": "The regular expression <code>{pattern}</code> defined for validation rule <code>{validationRuleDescriptionEntryKey}</code> of reference <code>{reference}</code> is incorrect", "invalidPatternForForVariableComponentDateChecker": "The regular expression <code>{pattern}</code> defined for column <code>{column}</code> of reference <code>{referenceToValidate}</code> is incorrect", @@ -137,74 +137,74 @@ "invalidPatternForVariableComponentRegularExpressionChecker": "The regular expression pattern <code>{pattern}</code> defined for the component <code>{component}</code> of variable <code>{variable}</code> of data type <code>{dataType}</code> is incorrect", "invalidReference": "For the identified component: <code> {target} </code> the value <code> {value} </code> does not exist in the reference <code> {refType} </code>. Expected values ​​<code> {referenceValues} </code>. ", "invalidReferenceWithColumn": "For column: <code> {target} </code> the value <code> {value} </code> does not exist in the reference <code> {refType} </code>. Values expected <code> {referenceValues} </code>. ", - "missingAggregationComponentForChart":"In the graph description of variable <code>{variable}</code> of data type <code>{dataType}</code>, component <code>{aggregationComponent}</code> of the aggregation variable <code>{aggregationVariable}</code> is not declared.<br /> Expected Values ​​<code>{components}</code>", - "missingAggregationVariableForChart":"In the chart description of variable <code>{variable}</code> of data type <code>{dataType}</code>, aggregation variable <code>{aggregationVariable}< /code> is not declared.<br /> Expected Values ​​<code>{variables}</code>", - "missingAuthorizationForDatatype":"The authorization section must be present in the description of the <code> {datatype} </code> data type", - "missingAuthorizationScopeVariableComponentKey":"You must indicate at least one group of variables (and their components) in which (s) we collect the spatial information to be attached to the data for the rights management dataset <code> {dataType } </code> ", + "missingAggregationComponentForChart": "In the graph description of variable <code>{variable}</code> of data type <code>{dataType}</code>, component <code>{aggregationComponent}</code> of the aggregation variable <code>{aggregationVariable}</code> is not declared.<br /> Expected Values ​​<code>{components}</code>", + "missingAggregationVariableForChart": "In the chart description of variable <code>{variable}</code> of data type <code>{dataType}</code>, aggregation variable <code>{aggregationVariable}< /code> is not declared.<br /> Expected Values ​​<code>{variables}</code>", + "missingAuthorizationForDatatype": "The authorization section must be present in the description of the <code> {datatype} </code> data type", + "missingAuthorizationScopeVariableComponentKey": "You must indicate at least one group of variables (and their components) in which (s) we collect the spatial information to be attached to the data for the rights management dataset <code> {dataType } </code> ", "missingBoundToForConstantDescription": "In the format->constant section of the dataType {dataType} you must fill in the boundTo section.", "missingColumnNumberOrHeaderNameForConstantDescription": "!!TODO", - "missingColumnReferenceForCheckerInDataType":"For the validation rule : <code>{lineValidationRuleKey}</code> in data type <code>{dataType}</code>, '<code>{checkerName}</code>' is declared but is not a known checker. Known checkers are <code>{checkerOnTargetNames}</code>", - "missingColumnReferenceForCheckerInReference":"In the reference description {reference} and the validation <code> {validationRuleDescriptionEntryKey} </code> the value checker <code> {checkerName} </code> declares unknown columns <code> {missingColumns } </code>: possible values ​​<code> {knownColumns} </code> ", + "missingColumnReferenceForCheckerInDataType": "For the validation rule : <code>{lineValidationRuleKey}</code> in data type <code>{dataType}</code>, '<code>{checkerName}</code>' is declared but is not a known checker. Known checkers are <code>{checkerOnTargetNames}</code>", + "missingColumnReferenceForCheckerInReference": "In the reference description {reference} and the validation <code> {validationRuleDescriptionEntryKey} </code> the value checker <code> {checkerName} </code> declares unknown columns <code> {missingColumns } </code>: possible values ​​<code> {knownColumns} </code> ", "missingExportHeaderNameForConstantDescription": "In the format->constant section of dataType {dataType} you must specify an exportHeaderName.", "missingKeyColumnsForReference": "In the description of reference <code>{reference}</code>, you must declare the components (at least one) of the key", - "missingParamColumnReferenceForCheckerInDataType":"In the description of the <code> {dataType} </code>, the validation rule <code> {validationRuleDescriptionEntryKey} </code> does not specify on which variable/components the rule should be executed by declaring a <code> variableComponents </code> parameter ", - "missingParamColumnReferenceForCheckerInReference":"In the description of the <code> {reference} </code>, the validation rule <code> {validationRuleDescriptionEntryKey} </code> does not specify on which columns the rule should be executed by declaring a <code> columns </code> parameter ", + "missingParamColumnReferenceForCheckerInDataType": "In the description of the <code> {dataType} </code>, the validation rule <code> {validationRuleDescriptionEntryKey} </code> does not specify on which variable/components the rule should be executed by declaring a <code> variableComponents </code> parameter ", + "missingParamColumnReferenceForCheckerInReference": "In the description of the <code> {reference} </code>, the validation rule <code> {validationRuleDescriptionEntryKey} </code> does not specify on which columns the rule should be executed by declaring a <code> columns </code> parameter ", "missingParentColumnForReferenceInCompositeReference": "In the composite reference <code> {compositeReference} </code> the <i> parentKeyColumn </i> <code> {parentKeyColumn} </code> does not exist in the reference <code> {reference } </code>. ", "missingParentLineInRecursiveReference": "In repository file {references} the id value {missingReferencesKey} for parent does not exist. Accepted values ${knownReferences}", "missingParentRecursiveKeyColumnForReferenceInCompositeReference": "In the composite reference <code> {compositeReference} </code> the <i> parentRecursiveKey </i> <code> {parentRecursiveKey} </code> does not exist in the reference <code> {reference } </code>. ", - "missingReferenceForChecker":"For data type <code>{dataType}</code>, datum <code>{datum}</code>, component <code>{component}</code>, you need to one of those references : <code>{references}</code>", - "missingReferenceForCheckerInDataType":"For data type <code>{dataType}</code> and validation <code>{validationKey}</code>, you need to one of those references : <code>{references}</code>", - "missingReferenceForCheckerInReference":"For reference <code>{reference}</code> and validation <code>{validationKey}</code>, you need to one of those references : <code>{references}</code>", + "missingReferenceForChecker": "For data type <code>{dataType}</code>, datum <code>{datum}</code>, component <code>{component}</code>, you need to one of those references : <code>{references}</code>", + "missingReferenceForCheckerInDataType": "For data type <code>{dataType}</code> and validation <code>{validationKey}</code>, you need to one of those references : <code>{references}</code>", + "missingReferenceForCheckerInReference": "For reference <code>{reference}</code> and validation <code>{validationKey}</code>, you need to one of those references : <code>{references}</code>", "missingReferenceForCheckerInReferenceColumn": "For reference <code>{referenceToValidate}≤/code>, you must provide the reference to use to check <code>{column}</code> among <code>{knownReferences}</code>", "missingReferenceInCompositereference": "All components of the composite reference <code> {compositeReference} </code> must declare a reference.", - "missingRequiredExpressionForValidationRuleInDataType":"For the validation rule <code>{lineValidationRuleKey}</code> of data type <code>{dataType}</code>, you have to write the expression to evaluate in order to verify that the data are following the rules.", - "missingRequiredExpressionForValidationRuleInReference":"For the validation rule <code>{lineValidationRuleKey}</code> of reference <code>{reference}</code>, you have to write the expression to evaluate in order to verify that the data are following the rules.", + "missingRequiredExpressionForValidationRuleInDataType": "For the validation rule <code>{lineValidationRuleKey}</code> of data type <code>{dataType}</code>, you have to write the expression to evaluate in order to verify that the data are following the rules.", + "missingRequiredExpressionForValidationRuleInReference": "For the validation rule <code>{lineValidationRuleKey}</code> of reference <code>{reference}</code>, you have to write the expression to evaluate in order to verify that the data are following the rules.", "missingRowLineForConstantDescription": "In the format->constant section of dataType {dataType} you must specify a line number.", - "missingStandardDeviationComponentForChart":"In the chart description of variable <code> {variable} </code> of data type <code> {dataType} </code>, the standard deviation <code> {standardDeviation}</ code> is not a declared component.<br /> Expected Values ​​<code>{components}</code>", - "missingTimeScopeVariableComponentKey":"Mandatory indication of the variable (and its component) used for the time period for which we need to attach the data for rights management of data type : <code>{dataType}</code>", - "missingUnitComponentForChart":"In the chart description of variable <code> {variable} </code> of data type <code> {dataType} </code>, unit <code> {unit}</code > is not a declared component.<br /> Expected Values ​​<code>{components}</code>", - "missingValueComponentForChart":"In the chart description of variable <code>{variable}</code> of data type <code>{dataType}</code>, value <code>{valueComponent}</code> is not a declared component.<br /> Expected Values ​​<code>{components}</code>", - "overlappingpublishedversion":"There is a deposited version in the deposit dates have an overlapping period with the deposited version. <code> {overlapingFiles] </code>", + "missingStandardDeviationComponentForChart": "In the chart description of variable <code> {variable} </code> of data type <code> {dataType} </code>, the standard deviation <code> {standardDeviation}</ code> is not a declared component.<br /> Expected Values ​​<code>{components}</code>", + "missingTimeScopeVariableComponentKey": "Mandatory indication of the variable (and its component) used for the time period for which we need to attach the data for rights management of data type : <code>{dataType}</code>", + "missingUnitComponentForChart": "In the chart description of variable <code> {variable} </code> of data type <code> {dataType} </code>, unit <code> {unit}</code > is not a declared component.<br /> Expected Values ​​<code>{components}</code>", + "missingValueComponentForChart": "In the chart description of variable <code>{variable}</code> of data type <code>{dataType}</code>, value <code>{valueComponent}</code> is not a declared component.<br /> Expected Values ​​<code>{components}</code>", + "overlappingpublishedversion": "There is a deposited version in the deposit dates have an overlapping period with the deposited version. <code> {overlapingFiles] </code>", "patternNotMatched": "For the identified component: <code> {target} </code> the value <code> {value} </code> does not respect the expected format: <code> {pattern} </code>. ", - "patternNotMatchedWithColumn": "For column: <code> {target} </code> the value <code> {value} </code> does not respect the expected format: <code> {pattern} </code>." , + "patternNotMatchedWithColumn": "For column: <code> {target} </code> the value <code> {value} </code> does not respect the expected format: <code> {pattern} </code>.", "recordCsvMissingColumnNumberOrHeaderNameForConstantDescription": "In the format->constant section of dataType {dataType} you must specify a row number or header name.", "requiredParentKeyColumnInCompositeReferenceForReference": "In the composite reference <code> {compositeReference} </code> the reference <code> {reference} </code> refers to <code> {referenceTo} </code> but does not declare a < i> parentKeyColumn </i>. ", "requiredReferenceInCompositeReferenceForParentKeyColumn": "No reference has been declared for the <i>parentKeyColumn</i> <code> {parentKeyColumn} </code> in the composite reference <code> {compositeReference} </code>.", "requiredValue": "For the identified component: <code> {target} </code> the value cannot be zero.", "requiredValueWithColumn": "For column: <code> {target} </code> the value cannot be zero.", "sameHeaderLineAndFirstRowLineForConstantDescription": "In the format->constant section of dataType {dataType} the header row must not be equal to the data row.", - "timeScopeVariableComponentKeyMissingVariable":"Mandatory indication of the variable in which we collect the time period for which we need to attach the data for rights management of data type : <code>{dataType}</code>. <br>Accepted values : <code>{variables}</code>", - "timeScopeVariableComponentKeyUnknownVariable":"<code>{variable}</code> doesn't be along to any of known variables : <code>{knownVariables}</code>", - "timeScopeVariableComponentPatternUnknown":"The component <code>{component}</code> of variable <code>{variable}</code> can't be used for carrying time information because the date format : <code>{pattern}</code> isn't managed. <br>Accepted formats : <code>{knownPatterns}</code>", - "timeScopeVariableComponentWrongChecker":"The component <code>{component}</code> of variable <code>{variable}</code> can't be used for carrying time information because it's not declared as : <code>{expectedChecker}</code>", - "timeVariableComponentKeyMissingComponent":"Mandatory indication of the component of : <code>{variable}</code> in which we collect the time period for which we need to attach the data for rights management of data type : <code>{dataType}</code>. <br>Accepted values : <code>{knownComponents}</code>", - "timeVariableComponentKeyUnknownComponent":"<code>{component}</code> doesn't belong to any of known variables : <code>{variable}</code>. <br>Known components : <code>{knownComponents}</code>", - "timerangeoutofinterval":"The date <code> {value} </code> is incompatible with the date range of the deposit. It must be between <code> {from} </code> and <code> {to} </code>. ", + "timeScopeVariableComponentKeyMissingVariable": "Mandatory indication of the variable in which we collect the time period for which we need to attach the data for rights management of data type : <code>{dataType}</code>. <br>Accepted values : <code>{variables}</code>", + "timeScopeVariableComponentKeyUnknownVariable": "<code>{variable}</code> doesn't be along to any of known variables : <code>{knownVariables}</code>", + "timeScopeVariableComponentPatternUnknown": "The component <code>{component}</code> of variable <code>{variable}</code> can't be used for carrying time information because the date format : <code>{pattern}</code> isn't managed. <br>Accepted formats : <code>{knownPatterns}</code>", + "timeScopeVariableComponentWrongChecker": "The component <code>{component}</code> of variable <code>{variable}</code> can't be used for carrying time information because it's not declared as : <code>{expectedChecker}</code>", + "timeVariableComponentKeyMissingComponent": "Mandatory indication of the component of : <code>{variable}</code> in which we collect the time period for which we need to attach the data for rights management of data type : <code>{dataType}</code>. <br>Accepted values : <code>{knownComponents}</code>", + "timeVariableComponentKeyUnknownComponent": "<code>{component}</code> doesn't belong to any of known variables : <code>{variable}</code>. <br>Known components : <code>{knownComponents}</code>", + "timerangeoutofinterval": "The date <code> {value} </code> is incompatible with the date range of the deposit. It must be between <code> {from} </code> and <code> {to} </code>. ", "tooBigRowLineForConstantDescription": "In the format->constant section of dataType {dataType} the row number must be less than the data row.", "tooLittleRowLineForConstantDescription": "In the format->constant section of dataType {dataType} the row number must be positive.", - "unDeclaredValueForChart":"In the chart description of variable <code> {variable} </code> of data type <code> {dataType} </code>, the value is not declared.<br /> Expected values ​​<code>{components}</code>", - "undeclaredDataGroupForVariable":"Variable <code>{variable}</code> doesn't belong to any data group, it needs to be in one", - "unexpectedHeaderColumn":"Unexpected column header. Expected : <code>{expectedHeaderColumn}</code> <br />Actual : <code>{actualHeaderColumn}</code>", - "unexpectedTokenCount":"Unexpected token count. Expected : <code>{expectedTokenCount}</code><br/>Actual header : <code>{actualHeader}</code> has <code>{actualTokenCount}</code> tokens", - "unknownCheckerNameForValidationRuleInDataType":"For the validation rule : <code>{lineValidationRuleKey}</code> in data type <code>{dataType}</code>, '<code>{checkerName}</code>' is declared but is not a known checker. Known checkers are <code>{checkerOnTargetNames}</code>", - "unknownCheckerNameForValidationRuleInReference":"For the validation rule : <code>{lineValidationRuleKey}</code> in reference <code>{reference}</code>, '<code>{checkerName}</code>' is declared but is not a known checker. Known checkers are <code>{checkerOnTargetNames}</code>", - "unknownCheckerNameForVariableComponent":"In the description of the data type {datatype} the component <code> {component} </code> of the variable <code> {variable} </code> the value checker <code> {checkerName} </code> is declared but it is not a known control <br /> Known checkers are <code>{knownCheckerNames}</code>", + "unDeclaredValueForChart": "In the chart description of variable <code> {variable} </code> of data type <code> {dataType} </code>, the value is not declared.<br /> Expected values ​​<code>{components}</code>", + "undeclaredDataGroupForVariable": "Variable <code>{variable}</code> doesn't belong to any data group, it needs to be in one", + "unexpectedHeaderColumn": "Unexpected column header. Expected : <code>{expectedHeaderColumn}</code> <br />Actual : <code>{actualHeaderColumn}</code>", + "unexpectedTokenCount": "Unexpected token count. Expected : <code>{expectedTokenCount}</code><br/>Actual header : <code>{actualHeader}</code> has <code>{actualTokenCount}</code> tokens", + "unknownCheckerNameForValidationRuleInDataType": "For the validation rule : <code>{lineValidationRuleKey}</code> in data type <code>{dataType}</code>, '<code>{checkerName}</code>' is declared but is not a known checker. Known checkers are <code>{checkerOnTargetNames}</code>", + "unknownCheckerNameForValidationRuleInReference": "For the validation rule : <code>{lineValidationRuleKey}</code> in reference <code>{reference}</code>, '<code>{checkerName}</code>' is declared but is not a known checker. Known checkers are <code>{checkerOnTargetNames}</code>", + "unknownCheckerNameForVariableComponent": "In the description of the data type {datatype} the component <code> {component} </code> of the variable <code> {variable} </code> the value checker <code> {checkerName} </code> is declared but it is not a known control <br /> Known checkers are <code>{knownCheckerNames}</code>", "unknownCheckerNameForVariableComponentCheckerInDataType": "For the data type <code>{dataType}</code> and validation rule <code>{validationRuleDescriptionEntryKey}</code>, '<code>{name}</code>' is declared but it's not a known checker name: possible values are <code>{checkerOnTargetNames}</code>.", "unknownCheckerNameForVariableComponentCheckerInReference": "In the reference validation <code> {reference} </code> and the validation rule <code> {validationRuleDescriptionEntryKey} </code>, '<code> {name} </code>' is declared but not a known check: possible values ​​<code> {variableComponentCheckers} </code>. ", "unknownCheckerNameInReferenceColumn": "For reference <code>{referenceToValidate}</code>, the checker defined for column <code>{column}</code> is <code>{checkerName}</code>. It's not a known checker. Known checkers are <code>{knownCheckerNames}</code>", "unknownIllegalException": "Unexpected error : <code>{cause}</code>", - "unknownReferenceForChecker":"For data type <code>{dataType}</code>, datum <code>{datum}</code>, component <code>{component}</code>, the reference <code>{refType}</code> is not in the accepted references which are: <code>{references}</code>", - "unknownReferenceForCheckerInDataType":"For data type <code>{dataType}</code> and validation <code>{validationKey}</code>, the reference <code>{refType}</code> is not in the accepted references which are: <code>{references}</code>", - "unknownReferenceForCheckerInReference":"For reference <code>{reference}</code> and validation <code>{validationKey}</code>, the reference <code>{refType}</code> is not in the accepted references which are: <code>{references}</code>", + "unknownReferenceForChecker": "For data type <code>{dataType}</code>, datum <code>{datum}</code>, component <code>{component}</code>, the reference <code>{refType}</code> is not in the accepted references which are: <code>{references}</code>", + "unknownReferenceForCheckerInDataType": "For data type <code>{dataType}</code> and validation <code>{validationKey}</code>, the reference <code>{refType}</code> is not in the accepted references which are: <code>{references}</code>", + "unknownReferenceForCheckerInReference": "For reference <code>{reference}</code> and validation <code>{validationKey}</code>, the reference <code>{refType}</code> is not in the accepted references which are: <code>{references}</code>", "unknownReferenceForCheckerInReferenceColumn": "For reference <code>{referenceToValidate}</code> and column <code>{column}</code>, the reference to use to check the value is <code>{refType}</code> but it's not among known references <code>{knownReferences}</code>", - "unknownReferenceInCompositereference": "The composite reference <code> {compositeReference} </code> contains references that are not declared <code> {unknownReferences} </code>. Known references <code> {references} </code>" , + "unknownReferenceInCompositereference": "The composite reference <code> {compositeReference} </code> contains references that are not declared <code> {unknownReferences} </code>. Known references <code> {references} </code>", "unknownReferenceInDatatypeReferenceDisplay": "In the repository display overload of the <code> {dataType} </code> datatype description, the <code> {reference} </code> repository is unknown. Known repositories known : <code> {references} </code> ", "unknownUsedAsVariableComponentUniqueness": "In the description of data type {dataType} in the <I>uniqueness</i> section component variable descriptions {unknownUsedAsVariableComponentUniqueness} do not exist. Accepted values {availableVariableComponents}", - "unknownVariablesInDataGroup":"Data group <code>{dataGroup}</code> has undeclared data : <code>{unknownVariables}</code>. <br>Known data : <code>{variables}</code>", - "unrecognizedProperty":"Error in line <code>{lineNumber}</code> (column : <code>{columnNumber}</code>) : <code>{unknownPropertyName}</code>, is not a known property. <br>Known properties : <code>{knownProperties}</code>", - "unsupportedVersion":"YAML files with version <code>{actualVersion}</code> aren't currently managed, expected version : <code>{expectedVersion}</code>", - "variableInMultipleDataGroup":"Variable <code>{variable}</code> is declared in several data groups, it needs to be only in one" - }, + "unknownVariablesInDataGroup": "Data group <code>{dataGroup}</code> has undeclared data : <code>{unknownVariables}</code>. <br>Known data : <code>{variables}</code>", + "unrecognizedProperty": "Error in line <code>{lineNumber}</code> (column : <code>{columnNumber}</code>) : <code>{unknownPropertyName}</code>, is not a known property. <br>Known properties : <code>{knownProperties}</code>", + "unsupportedVersion": "YAML files with version <code>{actualVersion}</code> aren't currently managed, expected version : <code>{expectedVersion}</code>", + "variableInMultipleDataGroup": "Variable <code>{variable}</code> is declared in several data groups, it needs to be only in one" + }, "referencesManagement":{ "actions":"Actions", "consult":"Consult", diff --git a/ui/src/locales/fr.json b/ui/src/locales/fr.json index ff37a124f..500f3405e 100644 --- a/ui/src/locales/fr.json +++ b/ui/src/locales/fr.json @@ -137,8 +137,8 @@ "invalidPatternForVariableComponentRegularExpressionChecker": "Le format de regularExpression <code>{pattern}</code> défini pour le composant <code>{component}</code> de la variable <code>{variable}</code> du type de données <code>{dataType}</code> est incorrect", "invalidReference": "Pour le composant identifié : <code>{target}</code> la valeur <code>{value}</code> n'existe pas dans la référence <code>{refType}</code>. Valeurs attendues <code>{referenceValues}</code>.", "invalidReferenceWithColumn": "Pour la colonne : <code>{target}</code> la valeur <code>{value}</code> n'existe pas dans la référence <code>{refType}</code>. Valeurs attendues <code>{referenceValues}</code>.", - "missingAggregationComponentForChart":"Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, le componsant <code> {aggregationComponent}</code> de la variable d'aggrégation <code> {aggregationVariable}</code> n'est pas déclarée.<br /> Valeurs attendues <code>{components}</code>", - "missingAggregationVariableForChart":"Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, la variable d'aggrégation <code> {aggregationVariable}</code> n'est pas déclarée.<br /> Valeurs attendues <code>{variables}</code>", + "missingAggregationComponentForChart": "Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, le componsant <code> {aggregationComponent}</code> de la variable d'aggrégation <code> {aggregationVariable}</code> n'est pas déclarée.<br /> Valeurs attendues <code>{components}</code>", + "missingAggregationVariableForChart": "Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, la variable d'aggrégation <code> {aggregationVariable}</code> n'est pas déclarée.<br /> Valeurs attendues <code>{variables}</code>", "missingAuthorizationForDatatype": "La section authorization doit être présente dans la description du type de données <code>{datatype}</code>", "missingAuthorizationScopeVariableComponentKey": "Il faut indiquer au moins un groupe de variables (et leur composants) dans le(s)quel(s) on recueille les informations spatiales à rattacher la donnée pour le gestion des droits jeu de données <code>{dataType}</code>", "missingBoundToForConstantDescription": "Dans la section format->constant du dataType {dataType} vous devez remplir la section boundTo.", @@ -160,10 +160,10 @@ "missingRequiredExpressionForValidationRuleInDataType": "Pour la règle de validation <code>{lineValidationRuleKey}</code> du type de données <code>{dataType}</code>, vous devez renseigner l’expression à évaluer pour contrôler que la règle est respectée par les données", "missingRequiredExpressionForValidationRuleInReference": "Pour la règle de validation <code>{lineValidationRuleKey}</code> de la référence {reference}, vous devez renseigner l’expression à évaluer pour contrôler que la règle est respectée par les données", "missingRowLineForConstantDescription": "Dans la section format->constant du dataType {dataType} vous devez indiquer un numéro de ligne.", - "missingStandardDeviationComponentForChart":"Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, l'écart type <code> {standardDeviation}</code> n'est pas un composant déclaré.<br /> Valeurs attendues <code>{components}</code>", + "missingStandardDeviationComponentForChart": "Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, l'écart type <code> {standardDeviation}</code> n'est pas un composant déclaré.<br /> Valeurs attendues <code>{components}</code>", "missingTimeScopeVariableComponentKey": "Il faut indiquer la variable (et son composant) dans laquelle on recueille la période de temps à laquelle rattacher la donnée pour le gestion des droits jeu de données <code>{dataType}</code>", - "missingUnitComponentForChart":"Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, l'unité <code> {unit}</code> n'est pas un composant déclaré.<br /> Valeurs attendues <code>{components}</code>", - "missingValueComponentForChart":"Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, la valeur <code> {valueComponent}</code> n'est pas un composant déclaré.<br /> Valeurs attendues <code>{components}</code>", + "missingUnitComponentForChart": "Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, l'unité <code> {unit}</code> n'est pas un composant déclaré.<br /> Valeurs attendues <code>{components}</code>", + "missingValueComponentForChart": "Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, la valeur <code> {valueComponent}</code> n'est pas un composant déclaré.<br /> Valeurs attendues <code>{components}</code>", "overlappingpublishedversion": "Il existe une version déposée dans les dates de dépôt ont une période chevauchante avec la version déposée. <code>{overlapingFiles]</code>", "patternNotMatched": "Pour le composant identifié : <code>{target}</code> la valeur <code>{value}</code> ne respecte pas le format attendu : <code>{pattern}</code>.", "patternNotMatchedWithColumn": "Pour la colonne : <code>{target}</code> la valeur <code>{value}</code> ne respecte pas le format attendu : <code>{pattern}</code>.", @@ -182,7 +182,7 @@ "timerangeoutofinterval": "La date <code>{value}</code> est incompatible avec l'intervale de dates du dépôt. Elle doit être comprise entre <code>{from}</code> et <code>{to}</code>.", "tooBigRowLineForConstantDescription": "Dans la section format->constant du dataType {dataType} le numéro de ligne doit être inférieur à celui de la ligne de données.", "tooLittleRowLineForConstantDescription": "Dans la section format->constant du dataType {dataType} le numéro de ligne doit être positif.", - "unDeclaredValueForChart":"Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, la valeur n'est pas déclarée.<br /> Valeurs attendues <code>{components}</code>", + "unDeclaredValueForChart": "Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, la valeur n'est pas déclarée.<br /> Valeurs attendues <code>{components}</code>", "undeclaredDataGroupForVariable": "La variable <code>{variable}</code> n’est déclarée appartenir à aucun groupe de données, elle doit être présente dans un groupe", "unexpectedHeaderColumn": "En-tête de colonne inattendu. En-tête attendu : <code>{expectedHeaderColumn}</code> <br />En-tête actuel : <code>{actualHeaderColumn}</code>", "unexpectedTokenCount": "Le nombre de token est inattendu. Nombre attendu : <code>{expectedTokenCount}</code><br/>L'en-tête actuel : <code>{actualHeader}</code> comprend <code>{actualTokenCount}</code> tokens", -- GitLab From 62cd214b86d1f982e0246d6b693d83861bde8690 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Tue, 5 Apr 2022 17:49:11 +0200 Subject: [PATCH 36/41] Corrige une erreur dans le nommage des codes erreurs --- ui/src/locales/en.json | 3 +-- ui/src/locales/fr.json | 3 +-- ui/src/services/ErrorsService.js | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/ui/src/locales/en.json b/ui/src/locales/en.json index 07a523f7a..922a82f6f 100644 --- a/ui/src/locales/en.json +++ b/ui/src/locales/en.json @@ -142,7 +142,7 @@ "missingAuthorizationForDatatype": "The authorization section must be present in the description of the <code> {datatype} </code> data type", "missingAuthorizationScopeVariableComponentKey": "You must indicate at least one group of variables (and their components) in which (s) we collect the spatial information to be attached to the data for the rights management dataset <code> {dataType } </code> ", "missingBoundToForConstantDescription": "In the format->constant section of the dataType {dataType} you must fill in the boundTo section.", - "missingColumnNumberOrHeaderNameForConstantDescription": "!!TODO", + "missingColumnNumberOrHeaderNameForConstantDescription": "In the format->constant section of dataType {dataType} you must specify a row number or header name.", "missingColumnReferenceForCheckerInDataType": "For the validation rule : <code>{lineValidationRuleKey}</code> in data type <code>{dataType}</code>, '<code>{checkerName}</code>' is declared but is not a known checker. Known checkers are <code>{checkerOnTargetNames}</code>", "missingColumnReferenceForCheckerInReference": "In the reference description {reference} and the validation <code> {validationRuleDescriptionEntryKey} </code> the value checker <code> {checkerName} </code> declares unknown columns <code> {missingColumns } </code>: possible values ​​<code> {knownColumns} </code> ", "missingExportHeaderNameForConstantDescription": "In the format->constant section of dataType {dataType} you must specify an exportHeaderName.", @@ -167,7 +167,6 @@ "overlappingpublishedversion": "There is a deposited version in the deposit dates have an overlapping period with the deposited version. <code> {overlapingFiles] </code>", "patternNotMatched": "For the identified component: <code> {target} </code> the value <code> {value} </code> does not respect the expected format: <code> {pattern} </code>. ", "patternNotMatchedWithColumn": "For column: <code> {target} </code> the value <code> {value} </code> does not respect the expected format: <code> {pattern} </code>.", - "recordCsvMissingColumnNumberOrHeaderNameForConstantDescription": "In the format->constant section of dataType {dataType} you must specify a row number or header name.", "requiredParentKeyColumnInCompositeReferenceForReference": "In the composite reference <code> {compositeReference} </code> the reference <code> {reference} </code> refers to <code> {referenceTo} </code> but does not declare a < i> parentKeyColumn </i>. ", "requiredReferenceInCompositeReferenceForParentKeyColumn": "No reference has been declared for the <i>parentKeyColumn</i> <code> {parentKeyColumn} </code> in the composite reference <code> {compositeReference} </code>.", "requiredValue": "For the identified component: <code> {target} </code> the value cannot be zero.", diff --git a/ui/src/locales/fr.json b/ui/src/locales/fr.json index 500f3405e..5fd7475a0 100644 --- a/ui/src/locales/fr.json +++ b/ui/src/locales/fr.json @@ -142,7 +142,7 @@ "missingAuthorizationForDatatype": "La section authorization doit être présente dans la description du type de données <code>{datatype}</code>", "missingAuthorizationScopeVariableComponentKey": "Il faut indiquer au moins un groupe de variables (et leur composants) dans le(s)quel(s) on recueille les informations spatiales à rattacher la donnée pour le gestion des droits jeu de données <code>{dataType}</code>", "missingBoundToForConstantDescription": "Dans la section format->constant du dataType {dataType} vous devez remplir la section boundTo.", - "missingColumnNumberOrHeaderNameForConstantDescription": "!!TODO", + "missingColumnNumberOrHeaderNameForConstantDescription": "Dans la section format->constant du dataType {dataType} vous devez indiquer un numéro de ligne ou un nom d'en-tête.", "missingColumnReferenceForCheckerInDataType": "Dans la description du type de données {dataType} et la validation <code>{validationRuleDescriptionEntryKey}</code> le vérificateur de valeur <code>{checkerName}</code> déclare des variables/composants inconnus <code>{missingVariableComponents}</code> : valeurs possible<code>{knownVariableComponents}</code>", "missingColumnReferenceForCheckerInReference": "Dans la description de la référence {reference} et la validation <code>{validationRuleDescriptionEntryKey}</code> le vérificateur de valeur <code>{checkerName}</code> déclare des colonnes inconnues <code>{missingColumns}</code> : valeurs possible<code>{knownColumns}</code>", "missingExportHeaderNameForConstantDescription": "Dans la section format->constant du dataType {dataType} vous devez spécifier un exportHeaderName.", @@ -167,7 +167,6 @@ "overlappingpublishedversion": "Il existe une version déposée dans les dates de dépôt ont une période chevauchante avec la version déposée. <code>{overlapingFiles]</code>", "patternNotMatched": "Pour le composant identifié : <code>{target}</code> la valeur <code>{value}</code> ne respecte pas le format attendu : <code>{pattern}</code>.", "patternNotMatchedWithColumn": "Pour la colonne : <code>{target}</code> la valeur <code>{value}</code> ne respecte pas le format attendu : <code>{pattern}</code>.", - "recordCsvMissingColumnNumberOrHeaderNameForConstantDescription": "Dans la section format->constant du dataType {dataType} vous devez indiquer un numéro de ligne ou un nom d'en-tête.", "requiredParentKeyColumnInCompositeReferenceForReference": "Dans la référence composite <code>{compositeReference}</code> la référence <code>{reference}</code> fait référence à <code>{referenceTo}</code> mais ne déclare pas de <i>parentKeyColumn</i> .", "requiredReferenceInCompositeReferenceForParentKeyColumn": "Aucune référence n'a été déclarée pour la <i>parentKeyColumn</i> <code>{parentKeyColumn}</code> dans la référence composite <code>{compositeReference}</code> .", "requiredValue": "Pour le composant identifié : <code>{target}</code> la valeur ne peut pas être nulle.", diff --git a/ui/src/services/ErrorsService.js b/ui/src/services/ErrorsService.js index 89ecd3ad9..42fbc91bd 100644 --- a/ui/src/services/ErrorsService.js +++ b/ui/src/services/ErrorsService.js @@ -76,7 +76,6 @@ const ERRORS = { overlappingpublishedversion: (params) => i18n.t("errors.overlappingpublishedversion", params), patternNotMatched: (params) => i18n.t("errors.patternNotMatched", params), patternNotMatchedWithColumn: (params) => i18n.t("errors.patternNotMatchedWithColumn", params), - recordCsvMissingColumnNumberOrHeaderNameForConstantDescription: (params) => i18n.t("errors.recordCsvMissingColumnNumberOrHeaderNameForConstantDescription", params), requiredParentKeyColumnInCompositeReferenceForReference: (params) => i18n.t("errors.requiredParentKeyColumnInCompositeReferenceForReference", params), requiredReferenceInCompositeReferenceForParentKeyColumn: (params) => i18n.t("errors.requiredReferenceInCompositeReferenceForParentKeyColumn", params), requiredValue: (params) => i18n.t("errors.requiredValue", params), -- GitLab From af9d33bfd01021e068ca328d8c7a9a21ebcafb46 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Tue, 5 Apr 2022 18:22:41 +0200 Subject: [PATCH 37/41] =?UTF-8?q?Homog=C3=A9inise=20nom=20de=20l'erreur,?= =?UTF-8?q?=20nom=20de=20la=20m=C3=A9thode=20d'erreur=20et=20corrige=20des?= =?UTF-8?q?=20casses?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rest/ApplicationConfigurationService.java | 150 +++++++++--------- .../rest/ConfigurationParsingResult.java | 118 +++++++------- .../ApplicationConfigurationServiceTest.java | 4 +- ui/src/locales/en.json | 14 +- ui/src/locales/fr.json | 20 +-- 5 files changed, 153 insertions(+), 153 deletions(-) diff --git a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java index 4614f0fbf..7f0dbe1f7 100644 --- a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java +++ b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java @@ -67,7 +67,7 @@ public class ApplicationConfigurationService { ConfigurationParsingResult parseConfigurationBytes(byte[] bytes) { if (bytes.length == 0) { return ConfigurationParsingResult.builder() - .recordEmptyFile() + .emptyFile() .build(); } Map<String, Map> internationalizedSections = new HashMap<>(); @@ -79,7 +79,7 @@ public class ApplicationConfigurationService { int expectedVersion = 0; if (actualVersion != expectedVersion) { return ConfigurationParsingResult.builder() - .recordUnsupportedVersion(actualVersion, expectedVersion) + .unsupportedVersion(actualVersion, expectedVersion) .build(); } } catch (UnrecognizedPropertyException e) { @@ -172,27 +172,27 @@ public class ApplicationConfigurationService { final String valueComponent = chartDescription.getValue(); final Map<String, Configuration.VariableComponentDescription> components = entry.getValue().doGetAllComponentDescriptions(); if (Strings.isNullOrEmpty(valueComponent)) { - builder.recordUndeclaredValueForChart(datatype, variable, components.keySet()); + builder.unDeclaredValueForChart(datatype, variable, components.keySet()); } else { if (!components.containsKey(valueComponent)) { - builder.recordMissingValueComponentForChart(datatype, variable, valueComponent, components.keySet()); + builder.missingValueComponentForChart(datatype, variable, valueComponent, components.keySet()); } final VariableComponentKey aggregation = chartDescription.getAggregation(); if (aggregation != null) { if (!dataTypeDescription.getData().containsKey(aggregation.getVariable())) { - builder.recordMissingAggregationVariableForChart(datatype, variable, aggregation, dataTypeDescription.getData().keySet()); + builder.missingAggregationVariableForChart(datatype, variable, aggregation, dataTypeDescription.getData().keySet()); } else if (!dataTypeDescription.getData().get(aggregation.getVariable()).hasComponent(aggregation.getComponent())) { - builder.recordMissingAggregationComponentForChart(datatype, variable, aggregation, components.keySet()); + builder.missingAggregationComponentForChart(datatype, variable, aggregation, components.keySet()); } } final String standardDeviation = chartDescription.getStandardDeviation(); if (standardDeviation != null && !components.containsKey(standardDeviation)) { - builder.recordMissingStandardDeviationComponentForChart(datatype, variable, standardDeviation, components.keySet()); + builder.missingStandardDeviationComponentForChart(datatype, variable, standardDeviation, components.keySet()); } final String unit = chartDescription.getUnit(); if (standardDeviation != null && !components.containsKey(unit)) { - builder.recordMissingUnitComponentForChart(datatype, variable, unit, components.keySet()); + builder.missingUnitComponentForChart(datatype, variable, unit, components.keySet()); } } } @@ -207,7 +207,7 @@ public class ApplicationConfigurationService { .map(Configuration.CompositeReferenceComponentDescription::getReference) .filter(ref -> { if (ref == null) { - builder.recordMissingReferenceInCompositereference(compositeReferenceName); + builder.missingReferenceInCompositereference(compositeReferenceName); } return ref != null; }) @@ -215,7 +215,7 @@ public class ApplicationConfigurationService { Set<String> existingReferences = configuration.getReferences().keySet(); ImmutableSet<String> unknownReferences = Sets.difference(expectingReferences, existingReferences).immutableCopy(); if (!unknownReferences.isEmpty()) { - builder.recordUnknownReferenceInCompositeReference(compositeReferenceName, unknownReferences, existingReferences); + builder.unknownReferenceInCompositeReference(compositeReferenceName, unknownReferences, existingReferences); } } @@ -229,13 +229,13 @@ public class ApplicationConfigurationService { } String parentKeyColumn = component.getParentKeyColumn(); if (previousReference == null && parentKeyColumn != null) { - builder.recordRequiredReferenceInCompositeReferenceForParentKeyColumn(compositeReferenceName, parentKeyColumn); + builder.requiredReferenceInCompositeReferenceForParentKeyColumn(compositeReferenceName, parentKeyColumn); } else if (previousReference != null) { String reference = component.getReference(); if (parentKeyColumn == null) { - builder.recordRequiredParentKeyColumnInCompositeReferenceForReference(compositeReferenceName, reference, previousReference); + builder.requiredParentKeyColumnInCompositeReferenceForReference(compositeReferenceName, reference, previousReference); } else if (!configuration.getReferences().get(reference).hasStaticColumn(parentKeyColumn)) { - builder.recordMissingParentColumnForReferenceInCompositeReferenceFor(compositeReferenceName, reference, parentKeyColumn); + builder.missingParentColumnForReferenceInCompositeReference(compositeReferenceName, reference, parentKeyColumn); } } previousReference = component.getReference(); @@ -252,7 +252,7 @@ public class ApplicationConfigurationService { } String parentRecursiveKey = component.getParentRecursiveKey(); if (parentRecursiveKey != null && !configuration.getReferences().get(reference).hasStaticColumn(parentRecursiveKey)) { - builder.recordMissingParentRecursiveKeyColumnForReferenceInCompositeReference(compositeReferenceName, reference, parentRecursiveKey); + builder.missingParentRecursiveKeyColumnForReferenceInCompositeReference(compositeReferenceName, reference, parentRecursiveKey); } } } @@ -270,10 +270,10 @@ public class ApplicationConfigurationService { if (components.contains(component)) { // OK } else { - builder.recordCsvBoundToUnknownVariableComponent(columnBindingDescription.getHeader(), variable, component, components); + builder.csvBoundToUnknownVariableComponent(columnBindingDescription.getHeader(), variable, component, components); } } else { - builder.recordCsvBoundToUnknownVariable(columnBindingDescription.getHeader(), variable, variables); + builder.csvBoundToUnknownVariable(columnBindingDescription.getHeader(), variable, variables); } } } @@ -286,25 +286,25 @@ public class ApplicationConfigurationService { final int rowNumber = headerConstantDescription.getRowNumber(); final int headerLine = format.getHeaderLine(); if (rowNumber == headerLine) { - builder.recordCsvSameHeaderLineAndFirstRowLineForConstantDescription(dataType); + builder.sameHeaderLineAndFirstRowLineForConstantDescription(dataType); } final int firstRowLine = format.getFirstRowLine(); if (rowNumber >= firstRowLine) { - builder.recordCsvTooBigRowLineForConstantDescription(dataType); + builder.tooBigRowLineForConstantDescription(dataType); } if (rowNumber < 1) { - builder.recordCsvTooLittleRowLineForConstantDescription(dataType); + builder.tooLittleRowLineForConstantDescription(dataType); } if (rowNumber < headerLine && rowNumber < 1) { - builder.recordCsvMissingRowLineForConstantDescription(dataType); + builder.missingRowLineForConstantDescription(dataType); } else if (rowNumber > headerLine && columnNumber < 1 && headerName == null) { - builder.recordCsvMissingColumnNumberOrHeaderNameForConstantDescription(dataType); + builder.missingColumnNumberOrHeaderNameForConstantDescription(dataType); } else { final VariableComponentKey boundTo = headerConstantDescription.getBoundTo(); if (boundTo == null) { - builder.recordCsvMissingBoundToForConstantDescription(dataType); + builder.missingBoundToForConstantDescription(dataType); } else if (headerConstantDescription.getExportHeader() == null) { - builder.recordCsvMissingExportHeaderNameForConstantDescription(dataType); + builder.missingExportHeaderNameForConstantDescription(dataType); } } }); @@ -314,9 +314,9 @@ public class ApplicationConfigurationService { variables.forEach(variable -> { int count = variableOccurrencesInDataGroups.count(variable); if (count == 0) { - builder.recordUndeclaredDataGroupForVariable(variable); + builder.undeclaredDataGroupForVariable(variable); } else if (count > 1) { - builder.recordVariableInMultipleDataGroup(variable); + builder.variableInMultipleDataGroup(variable); } }); } @@ -329,14 +329,14 @@ public class ApplicationConfigurationService { variableOccurrencesInDataGroups.addAll(dataGroupVariables); ImmutableSet<String> unknownVariables = Sets.difference(dataGroupVariables, variables).immutableCopy(); if (!unknownVariables.isEmpty()) { - builder.recordUnknownVariablesInDataGroup(dataGroup, unknownVariables, variables); + builder.unknownVariablesInDataGroup(dataGroup, unknownVariables, variables); } } } private void verifyDatatypeAuthorizationScopeExistsAndIsValid(ConfigurationParsingResult.Builder builder, String dataType, Configuration configuration, Set<String> variables, LinkedHashMap<String, Configuration.AuthorizationScopeDescription> authorizationScopesVariableComponentKey) { if (authorizationScopesVariableComponentKey == null || authorizationScopesVariableComponentKey.isEmpty()) { - builder.recordMissingAuthorizationScopeVariableComponentKey(dataType); + builder.missingAuthorizationScopeVariableComponentKey(dataType); } else { Configuration.DataTypeDescription dataTypeDescription = configuration.getDataTypes().get(dataType); authorizationScopesVariableComponentKey.entrySet().stream().forEach(authorizationScopeVariableComponentKeyEntry -> { @@ -344,24 +344,24 @@ public class ApplicationConfigurationService { Configuration.AuthorizationScopeDescription authorizationScopeDescription = authorizationScopeVariableComponentKeyEntry.getValue(); VariableComponentKey authorizationScopeVariableComponentKey = authorizationScopeDescription.getVariableComponentKey(); if (authorizationScopeVariableComponentKey.getVariable() == null) { - builder.recordAuthorizationScopeVariableComponentKeyMissingVariable(dataType, authorizationScopeName, variables); + builder.authorizationScopeVariableComponentKeyMissingVariable(dataType, authorizationScopeName, variables); } else { String variable = authorizationScopeVariableComponentKey.getVariable(); Configuration.VariableDescription variableInDescription = dataTypeDescription.getData().get(variable); if (!dataTypeDescription.getData().containsKey(variable)) { - builder.recordAuthorizationScopeVariableComponentKeyUnknownVariable(authorizationScopeVariableComponentKey, variables); + builder.authorizationScopeVariableComponentKeyUnknownVariable(authorizationScopeVariableComponentKey, variables); } else { String component = authorizationScopeVariableComponentKey.getComponent(); Map<String, Configuration.VariableComponentDescription> componentsInDescription = variableInDescription.doGetAllComponentDescriptions(); if (component == null) { - builder.recordAuthorizationVariableComponentKeyMissingComponent(dataType, authorizationScopeName, variable, componentsInDescription.keySet()); + builder.authorizationVariableComponentKeyMissingComponent(dataType, authorizationScopeName, variable, componentsInDescription.keySet()); } else { if (!componentsInDescription.containsKey(component)) { - builder.recordAuthorizationVariableComponentKeyUnknownComponent(authorizationScopeVariableComponentKey, componentsInDescription.keySet()); + builder.authorizationVariableComponentKeyUnknownComponent(authorizationScopeVariableComponentKey, componentsInDescription.keySet()); } else { Configuration.CheckerDescription authorizationScopeVariableComponentChecker = dataTypeDescription.getData().get(variable).doGetAllComponentDescriptions().get(authorizationScopeVariableComponentKey.getComponent()).getChecker(); if (authorizationScopeVariableComponentChecker == null || !"Reference".equals(authorizationScopeVariableComponentChecker.getName())) { - builder.recordAuthorizationScopeVariableComponentWrongChecker(authorizationScopeVariableComponentKey, "Date"); + builder.authorizationScopeVariableComponentWrongChecker(authorizationScopeVariableComponentKey, "Date"); } String refType; Configuration.CheckerConfigurationDescription checkerConfigurationDescription = null; @@ -369,11 +369,11 @@ public class ApplicationConfigurationService { checkerConfigurationDescription = authorizationScopeVariableComponentChecker.getParams(); } if (checkerConfigurationDescription == null) { - builder.recordAuthorizationScopeVariableComponentReftypeNull(authorizationScopeVariableComponentKey, configuration.getReferences().keySet()); + builder.authorizationScopeVariableComponentReftypeNull(authorizationScopeVariableComponentKey, configuration.getReferences().keySet()); } else { refType = checkerConfigurationDescription.getRefType(); if (refType == null || !configuration.getReferences().containsKey(refType)) { - builder.recordAuthorizationScopeVariableComponentReftypeUnknown(authorizationScopeVariableComponentKey, refType, configuration.getReferences().keySet()); + builder.authorizationScopeVariableComponentReftypeUnknown(authorizationScopeVariableComponentKey, refType, configuration.getReferences().keySet()); } else { Set<String> compositesReferences = configuration.getCompositeReferences().values().stream() .map(Configuration.CompositeReferenceDescription::getComponents) @@ -381,7 +381,7 @@ public class ApplicationConfigurationService { .map(Configuration.CompositeReferenceComponentDescription::getReference) .collect(Collectors.toSet()); if (!compositesReferences.contains(refType)) { - builder.recordAuthorizationVariableComponentMustReferToCompositereference(dataType, authorizationScopeName, refType, compositesReferences); + builder.authorizationScopeVariableComponentReftypeUnknown(dataType, authorizationScopeName, refType, compositesReferences); } } } @@ -396,30 +396,30 @@ public class ApplicationConfigurationService { private void verifyDatatypeTimeScopeExistsAndIsValid(ConfigurationParsingResult.Builder builder, String dataType, Configuration.DataTypeDescription dataTypeDescription, Set<String> variables, VariableComponentKey timeScopeVariableComponentKey) { if (timeScopeVariableComponentKey == null) { - builder.recordMissingTimeScopeVariableComponentKey(dataType); + builder.missingTimeScopeVariableComponentKey(dataType); } else { if (timeScopeVariableComponentKey.getVariable() == null) { - builder.recordTimeScopeVariableComponentKeyMissingVariable(dataType, variables); + builder.timeScopeVariableComponentKeyMissingVariable(dataType, variables); } else { if (!dataTypeDescription.getData().containsKey(timeScopeVariableComponentKey.getVariable())) { - builder.recordTimeScopeVariableComponentKeyUnknownVariable(timeScopeVariableComponentKey, variables); + builder.timeScopeVariableComponentKeyUnknownVariable(timeScopeVariableComponentKey, variables); } else { if (timeScopeVariableComponentKey.getComponent() == null) { - builder.recordTimeVariableComponentKeyMissingComponent(dataType, timeScopeVariableComponentKey.getVariable(), dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).doGetAllComponents()); + builder.timeVariableComponentKeyMissingComponent(dataType, timeScopeVariableComponentKey.getVariable(), dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).doGetAllComponents()); } else { if (!dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).hasComponent(timeScopeVariableComponentKey.getComponent())) { - builder.recordTimeVariableComponentKeyUnknownComponent(timeScopeVariableComponentKey, dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).doGetAllComponents()); + builder.timeVariableComponentKeyUnknownComponent(timeScopeVariableComponentKey, dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).doGetAllComponents()); } else { Configuration.CheckerDescription timeScopeVariableComponentChecker = dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).doGetAllComponentDescriptions().get(timeScopeVariableComponentKey.getComponent()).getChecker(); if (timeScopeVariableComponentChecker == null || !"Date".equals(timeScopeVariableComponentChecker.getName())) { - builder.recordTimeScopeVariableComponentWrongChecker(timeScopeVariableComponentKey, "Date"); + builder.timeScopeVariableComponentWrongChecker(timeScopeVariableComponentKey, "Date"); } Optional.ofNullable(timeScopeVariableComponentChecker) .map(Configuration.CheckerDescription::getParams) .map(Configuration.CheckerConfigurationDescription::getPattern) .ifPresent(pattern -> { if (!LocalDateTimeRange.getKnownPatterns().contains(pattern)) { - builder.recordTimeScopeVariableComponentPatternUnknown(timeScopeVariableComponentKey, pattern, LocalDateTimeRange.getKnownPatterns()); + builder.timeScopeVariableComponentPatternUnknown(timeScopeVariableComponentKey, pattern, LocalDateTimeRange.getKnownPatterns()); } }); } @@ -443,8 +443,8 @@ public class ApplicationConfigurationService { } @Override - public void recordUnknownCheckerNameForVariableComponentChecker(String validationRuleDescriptionEntryKey, String checkerName, ImmutableSet<String> checkerOnTargetNames) { - builder.recordUnknownCheckerNameForVariableComponentCheckerInDataType(validationRuleDescriptionEntryKey, dataType, checkerName, checkerOnTargetNames); + public void unknownCheckerNameForVariableComponentChecker(String validationRuleDescriptionEntryKey, String checkerName, ImmutableSet<String> checkerOnTargetNames) { + builder.unknownCheckerNameForVariableComponentCheckerInDataType(validationRuleDescriptionEntryKey, dataType, checkerName, checkerOnTargetNames); } @Override @@ -458,12 +458,12 @@ public class ApplicationConfigurationService { } @Override - public void recordMissingRequiredExpression(String validationRuleDescriptionEntryKey) { + public void missingRequiredExpression(String validationRuleDescriptionEntryKey) { builder.missingRequiredExpressionForValidationRuleInDataType(validationRuleDescriptionEntryKey, dataType); } @Override - public void recordIllegalGroovyExpression(String validationRuleDescriptionEntryKey, String expression, GroovyExpression.CompilationError compilationError) { + public void illegalGroovyExpression(String validationRuleDescriptionEntryKey, String expression, GroovyExpression.CompilationError compilationError) { builder.illegalGroovyExpressionForValidationRuleInDataType(validationRuleDescriptionEntryKey, dataType, expression, compilationError); } @@ -483,8 +483,8 @@ public class ApplicationConfigurationService { } @Override - public void recordUnknownCheckerNameForValidationRule(String validationRuleDescriptionEntryKey, String checkerName, ImmutableSet<String> allCheckerNames) { - builder.recordUnknownCheckerNameForValidationRuleInDataType(validationRuleDescriptionEntryKey, dataType, checkerName, allCheckerNames); + public void unknownCheckerNameForValidationRule(String validationRuleDescriptionEntryKey, String checkerName, ImmutableSet<String> allCheckerNames) { + builder.unknownCheckerNameForValidationRuleInDataType(validationRuleDescriptionEntryKey, dataType, checkerName, allCheckerNames); } @Override @@ -540,7 +540,7 @@ public class ApplicationConfigurationService { @Override public void unknownCheckerOnOneTargetName(String checkerName, ImmutableSet<String> knownCheckerNames) { // OK - builder.recordUnknownCheckerNameForVariableComponentChecker(dataType, datum, component, checkerName, knownCheckerNames); + builder.unknownCheckerNameForVariableComponent(dataType, datum, component, checkerName, knownCheckerNames); } @Override @@ -599,7 +599,7 @@ public class ApplicationConfigurationService { @Override public void invalidPatternForDateChecker(String pattern) { - builder.invalidPatternForForReferenceColumnDateChecker(referenceToValidate, column, pattern); + builder.invalidPatternForReferenceColumnDateChecker(referenceToValidate, column, pattern); } @Override @@ -674,13 +674,13 @@ public class ApplicationConfigurationService { Configuration.ReferenceDescription referenceDescription = referenceEntry.getValue(); List<String> keyColumns = referenceDescription.getKeyColumns(); if (keyColumns.isEmpty()) { - builder.recordMissingKeyColumnsForReference(reference); + builder.missingKeyColumnsForReference(reference); } else { Set<String> columns = referenceDescription.doGetStaticColumns(); ImmutableSet<String> keyColumnsSet = ImmutableSet.copyOf(keyColumns); ImmutableSet<String> unknownUsedAsKeyElementColumns = Sets.difference(keyColumnsSet, columns).immutableCopy(); if (!unknownUsedAsKeyElementColumns.isEmpty()) { - builder.recordInvalidKeyColumns(reference, unknownUsedAsKeyElementColumns, columns); + builder.invalidKeyColumns(reference, unknownUsedAsKeyElementColumns, columns); } } } @@ -719,7 +719,7 @@ public class ApplicationConfigurationService { ImmutableSet<String> unknownUsedAsInternationalizedColumnsSetColumns = Sets.difference(internationalizedColumnsForDisplay, columns).immutableCopy(); if (!unknownUsedAsInternationalizedColumnsSetColumns.isEmpty()) { - builder.recordInvalidInternationalizedColumns(reference, unknownUsedAsInternationalizedColumnsSetColumns, columns); + builder.invalidInternationalizedColumns(reference, unknownUsedAsInternationalizedColumnsSetColumns, columns); } } @@ -757,7 +757,7 @@ public class ApplicationConfigurationService { Map<String, Configuration.ReferenceDescription> references = Optional.ofNullable(configuration.getReferences()) .orElse(new LinkedHashMap<>()); if (!references.containsKey(reference)) { - builder.recordUnknownReferenceInDatatypeReferenceDisplay(dataType, reference, references.keySet()); + builder.unknownReferenceInDatatypeReferenceDisplay(dataType, reference, references.keySet()); return; } @@ -773,7 +773,7 @@ public class ApplicationConfigurationService { ImmutableSet<String> unknownUsedAsInternationalizedColumnsSetColumns = Sets.difference(internationalizedColumnsForDisplay, columns).immutableCopy(); if (!unknownUsedAsInternationalizedColumnsSetColumns.isEmpty()) { - builder.recordInvalidInternationalizedColumnsForDataType(dataType, reference, unknownUsedAsInternationalizedColumnsSetColumns, columns); + builder.invalidInternationalizedColumnsForDataType(dataType, reference, unknownUsedAsInternationalizedColumnsSetColumns, columns); } } } @@ -791,7 +791,7 @@ public class ApplicationConfigurationService { } ImmutableSet<String> unknownUsedAsVariableComponentUniqueness = Sets.difference(variableComponentsKeyInUniqueness, availableVariableComponents).immutableCopy(); if (!unknownUsedAsVariableComponentUniqueness.isEmpty()) { - builder.recordUnknownUsedAsVariableComponentUniqueness(dataType, unknownUsedAsVariableComponentUniqueness, availableVariableComponents); + builder.unknownUsedAsVariableComponentUniqueness(dataType, unknownUsedAsVariableComponentUniqueness, availableVariableComponents); } } @@ -807,7 +807,7 @@ public class ApplicationConfigurationService { ImmutableSet<String> internationalizedColumnsSet = ImmutableSet.copyOf(internationalizedColumns); ImmutableSet<String> unknownUsedAsInternationalizedColumnsSetColumns = Sets.difference(internationalizedColumnsSet, columns).immutableCopy(); if (!unknownUsedAsInternationalizedColumnsSetColumns.isEmpty()) { - builder.recordInvalidInternationalizedColumns(reference, unknownUsedAsInternationalizedColumnsSetColumns, columns); + builder.invalidInternationalizedColumns(reference, unknownUsedAsInternationalizedColumnsSetColumns, columns); } } @@ -829,9 +829,9 @@ public class ApplicationConfigurationService { } @Override - public void recordUnknownCheckerNameForVariableComponentChecker(String validationRuleDescriptionEntryKey, String checkerName, ImmutableSet<String> checkerOnTargetNames) { + public void unknownCheckerNameForVariableComponentChecker(String validationRuleDescriptionEntryKey, String checkerName, ImmutableSet<String> checkerOnTargetNames) { // OK - builder.recordUnknownCheckerNameForVariableComponentCheckerInReference(validationRuleDescriptionEntryKey, reference, checkerName, checkerOnTargetNames); + builder.unknownCheckerNameForVariableComponentCheckerInReference(validationRuleDescriptionEntryKey, reference, checkerName, checkerOnTargetNames); } @Override @@ -847,13 +847,13 @@ public class ApplicationConfigurationService { } @Override - public void recordMissingRequiredExpression(String validationRuleDescriptionEntryKey) { + public void missingRequiredExpression(String validationRuleDescriptionEntryKey) { // OK builder.missingRequiredExpressionForValidationRuleInReference(validationRuleDescriptionEntryKey, reference); } @Override - public void recordIllegalGroovyExpression(String validationRuleDescriptionEntryKey, String expression, GroovyExpression.CompilationError compilationError) { + public void illegalGroovyExpression(String validationRuleDescriptionEntryKey, String expression, GroovyExpression.CompilationError compilationError) { // OK builder.illegalGroovyExpressionForValidationRuleInReference(validationRuleDescriptionEntryKey, reference, expression, compilationError); } @@ -875,9 +875,9 @@ public class ApplicationConfigurationService { } @Override - public void recordUnknownCheckerNameForValidationRule(String validationRuleDescriptionEntryKey, String checkerName, ImmutableSet<String> allCheckerNames) { + public void unknownCheckerNameForValidationRule(String validationRuleDescriptionEntryKey, String checkerName, ImmutableSet<String> allCheckerNames) { // OK - builder.recordUnknownCheckerNameForValidationRuleInReference(validationRuleDescriptionEntryKey, reference, checkerName, allCheckerNames); + builder.unknownCheckerNameForValidationRuleInReference(validationRuleDescriptionEntryKey, reference, checkerName, allCheckerNames); } @Override @@ -908,21 +908,21 @@ public class ApplicationConfigurationService { Set<CheckerTarget> getAcceptableCheckerTargets(); - void recordMissingRequiredExpression(String validationRuleDescriptionEntryKey); + void missingRequiredExpression(String validationRuleDescriptionEntryKey); - void recordIllegalGroovyExpression(String validationRuleDescriptionEntryKey, String expression, GroovyExpression.CompilationError compilationError); + void illegalGroovyExpression(String validationRuleDescriptionEntryKey, String expression, GroovyExpression.CompilationError compilationError); void missingParamColumnReferenceForChecker(String validationRuleDescriptionEntryKey); void missingColumnReferenceForChecker(String validationRuleDescriptionEntryKey, String checkerName, Set<CheckerTarget> knownColumns, ImmutableSet<CheckerTarget> missingColumns); - void recordUnknownCheckerNameForVariableComponentChecker(String validationRuleDescriptionEntryKey, String name, ImmutableSet<String> checkerOnTargetNames); + void unknownCheckerNameForVariableComponentChecker(String validationRuleDescriptionEntryKey, String name, ImmutableSet<String> checkerOnTargetNames); void unknownReferenceForChecker(String validationRuleDescriptionEntryKey, String refType, Set<String> references); void missingReferenceForChecker(String validationRuleDescriptionEntryKey, Set<String> references); - void recordUnknownCheckerNameForValidationRule(String validationRuleDescriptionEntryKey, String checkerName, ImmutableSet<String> allCheckerNames); + void unknownCheckerNameForValidationRule(String validationRuleDescriptionEntryKey, String checkerName, ImmutableSet<String> allCheckerNames); void invalidPatternForDateChecker(String validationRuleDescriptionEntryKey, String pattern); @@ -940,10 +940,10 @@ public class ApplicationConfigurationService { .map(GroovyConfiguration::getExpression) .orElse(null); if (StringUtils.isBlank(expression)) { - builder.recordMissingRequiredExpression(validationRuleDescriptionEntryKey); + builder.missingRequiredExpression(validationRuleDescriptionEntryKey); } else { Optional<GroovyExpression.CompilationError> compileResult = GroovyLineChecker.validateExpression(expression); - compileResult.ifPresent(compilationError -> builder.recordIllegalGroovyExpression(validationRuleDescriptionEntryKey, expression, compilationError)); + compileResult.ifPresent(compilationError -> builder.illegalGroovyExpression(validationRuleDescriptionEntryKey, expression, compilationError)); } } else if (CHECKER_ON_TARGET_NAMES.contains(checker.getName())) { if (lineValidationRuleDescription.doGetCheckerTargets().isEmpty()) { @@ -974,7 +974,7 @@ public class ApplicationConfigurationService { @Override public void unknownCheckerOnOneTargetName(String checkerName, ImmutableSet<String> validCheckerNames) { - builder.recordUnknownCheckerNameForVariableComponentChecker(validationRuleDescriptionEntryKey, checkerName, validCheckerNames); + builder.unknownCheckerNameForVariableComponentChecker(validationRuleDescriptionEntryKey, checkerName, validCheckerNames); } @Override @@ -993,7 +993,7 @@ public class ApplicationConfigurationService { } }, checker); } else { - builder.recordUnknownCheckerNameForValidationRule(validationRuleDescriptionEntryKey, checker.getName(), ALL_CHECKER_NAMES); + builder.unknownCheckerNameForValidationRule(validationRuleDescriptionEntryKey, checker.getName(), ALL_CHECKER_NAMES); } } @@ -1016,14 +1016,14 @@ public class ApplicationConfigurationService { int columnNumber = e.getLocation().getColumnNr(); String unknownPropertyName = e.getPropertyName(); Collection<String> knownProperties = (Collection) e.getKnownPropertyIds(); - builder.recordUnrecognizedProperty(lineNumber, columnNumber, unknownPropertyName, knownProperties); + builder.unrecognizedProperty(lineNumber, columnNumber, unknownPropertyName, knownProperties); } else if (exception.getCause() instanceof InvalidFormatException) { InvalidFormatException e = (InvalidFormatException) exception.getCause(); int lineNumber = e.getLocation().getLineNr(); int columnNumber = e.getLocation().getColumnNr(); String value = e.getValue().toString(); String targetTypeName = e.getTargetType().getName(); - builder.recordInvalidFormat(lineNumber, columnNumber, value, targetTypeName); + builder.invalidFormat(lineNumber, columnNumber, value, targetTypeName); } else { builder.unknownIllegalException(exception.getCause().getLocalizedMessage()); } @@ -1037,7 +1037,7 @@ public class ApplicationConfigurationService { String unknownPropertyName = e.getPropertyName(); Collection<String> knownProperties = (Collection) e.getKnownPropertyIds(); return ConfigurationParsingResult.builder() - .recordUnrecognizedProperty(lineNumber, columnNumber, unknownPropertyName, knownProperties) + .unrecognizedProperty(lineNumber, columnNumber, unknownPropertyName, knownProperties) .build(); } @@ -1047,7 +1047,7 @@ public class ApplicationConfigurationService { String value = e.getValue().toString(); String targetTypeName = e.getTargetType().getName(); return ConfigurationParsingResult.builder() - .recordInvalidFormat(lineNumber, columnNumber, value, targetTypeName) + .invalidFormat(lineNumber, columnNumber, value, targetTypeName) .build(); } diff --git a/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java b/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java index 997adbdaa..17d5a31c4 100644 --- a/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java +++ b/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java @@ -56,7 +56,7 @@ public class ConfigurationParsingResult { return new ConfigurationParsingResult(validationCheckResults, null); } - public Builder recordEmptyFile() { + public Builder emptyFile() { return recordError("emptyFile"); } @@ -64,7 +64,7 @@ public class ConfigurationParsingResult { return recordError(message); } - public Builder recordUnsupportedVersion(int actualVersion, int expectedVersion) { + public Builder unsupportedVersion(int actualVersion, int expectedVersion) { return recordError("unsupportedVersion", ImmutableMap.of("actualVersion", actualVersion, "expectedVersion", expectedVersion)); } @@ -118,15 +118,15 @@ public class ConfigurationParsingResult { "references", references)); } - public Builder recordUndeclaredDataGroupForVariable(String variable) { + public Builder undeclaredDataGroupForVariable(String variable) { return recordError("undeclaredDataGroupForVariable", ImmutableMap.of("variable", variable)); } - public Builder recordVariableInMultipleDataGroup(String variable) { + public Builder variableInMultipleDataGroup(String variable) { return recordError("variableInMultipleDataGroup", ImmutableMap.of("variable", variable)); } - public Builder recordUnknownVariablesInDataGroup(String dataGroup, Set<String> unknownVariables, Set<String> variables) { + public Builder unknownVariablesInDataGroup(String dataGroup, Set<String> unknownVariables, Set<String> variables) { return recordError("unknownVariablesInDataGroup", ImmutableMap.of( "dataGroup", dataGroup, "unknownVariables", unknownVariables, @@ -134,31 +134,31 @@ public class ConfigurationParsingResult { ); } - public Builder recordMissingTimeScopeVariableComponentKey(String dataType) { + public Builder missingTimeScopeVariableComponentKey(String dataType) { return recordError("missingTimeScopeVariableComponentKey", ImmutableMap.of("dataType", dataType)); } - public Builder recordMissingAuthorizationScopeVariableComponentKey(String dataType) { + public Builder missingAuthorizationScopeVariableComponentKey(String dataType) { return recordError("missingAuthorizationScopeVariableComponentKey", ImmutableMap.of("dataType", dataType)); } - public Builder recordTimeScopeVariableComponentKeyMissingVariable(String dataType, Set<String> variables) { + public Builder timeScopeVariableComponentKeyMissingVariable(String dataType, Set<String> variables) { return recordError("timeScopeVariableComponentKeyMissingVariable", ImmutableMap.of("dataType", dataType, "variables", variables)); } - public Builder recordAuthorizationScopeVariableComponentKeyMissingVariable(String dataType, String authorizationScopeName, Set<String> variables) { + public Builder authorizationScopeVariableComponentKeyMissingVariable(String dataType, String authorizationScopeName, Set<String> variables) { return recordError("authorizationScopeVariableComponentKeyMissingVariable", ImmutableMap.of("dataType", dataType, "authorizationScopeName", authorizationScopeName, "variables", variables)); } - public Builder recordTimeScopeVariableComponentKeyUnknownVariable(VariableComponentKey timeScopeVariableComponentKey, Set<String> knownVariables) { + public Builder timeScopeVariableComponentKeyUnknownVariable(VariableComponentKey timeScopeVariableComponentKey, Set<String> knownVariables) { return recordError("timeScopeVariableComponentKeyUnknownVariable", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "knownVariables", knownVariables)); } - public Builder recordAuthorizationScopeVariableComponentKeyUnknownVariable(VariableComponentKey timeScopeVariableComponentKey, Set<String> knownVariables) { + public Builder authorizationScopeVariableComponentKeyUnknownVariable(VariableComponentKey timeScopeVariableComponentKey, Set<String> knownVariables) { return recordError("authorizationScopeVariableComponentKeyUnknownVariable", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "knownVariables", knownVariables)); } - public Builder recordTimeVariableComponentKeyMissingComponent(String dataType, String variable, Set<String> knownComponents) { + public Builder timeVariableComponentKeyMissingComponent(String dataType, String variable, Set<String> knownComponents) { return recordError("timeVariableComponentKeyMissingComponent", ImmutableMap.of( "dataType", dataType, "variable", variable, @@ -166,7 +166,7 @@ public class ConfigurationParsingResult { )); } - public Builder recordAuthorizationVariableComponentKeyMissingComponent(String dataType, String authorizationName, String variable, Set<String> knownComponents) { + public Builder authorizationVariableComponentKeyMissingComponent(String dataType, String authorizationName, String variable, Set<String> knownComponents) { return recordError("authorizationVariableComponentKeyMissingComponent", ImmutableMap.of( "dataType", dataType, "authorizationName", authorizationName, @@ -175,39 +175,39 @@ public class ConfigurationParsingResult { )); } - public Builder recordTimeVariableComponentKeyUnknownComponent(VariableComponentKey timeScopeVariableComponentKey, Set<String> knownComponents) { + public Builder timeVariableComponentKeyUnknownComponent(VariableComponentKey timeScopeVariableComponentKey, Set<String> knownComponents) { return recordError("timeVariableComponentKeyUnknownComponent", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "component", timeScopeVariableComponentKey.getComponent(), "knownComponents", knownComponents)); } - public Builder recordAuthorizationVariableComponentKeyUnknownComponent(VariableComponentKey timeScopeVariableComponentKey, Set<String> knownComponents) { + public Builder authorizationVariableComponentKeyUnknownComponent(VariableComponentKey timeScopeVariableComponentKey, Set<String> knownComponents) { return recordError("authorizationVariableComponentKeyUnknownComponent", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "component", timeScopeVariableComponentKey.getComponent(), "knownComponents", knownComponents)); } - public Builder recordTimeScopeVariableComponentWrongChecker(VariableComponentKey timeScopeVariableComponentKey, String expectedChecker) { + public Builder timeScopeVariableComponentWrongChecker(VariableComponentKey timeScopeVariableComponentKey, String expectedChecker) { return recordError("timeScopeVariableComponentWrongChecker", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "component", timeScopeVariableComponentKey.getComponent(), "expectedChecker", expectedChecker)); } - public Builder recordAuthorizationScopeVariableComponentWrongChecker(VariableComponentKey timeScopeVariableComponentKey, String expectedChecker) { + public Builder authorizationScopeVariableComponentWrongChecker(VariableComponentKey timeScopeVariableComponentKey, String expectedChecker) { return recordError("authorizationScopeVariableComponentWrongChecker", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "component", timeScopeVariableComponentKey.getComponent(), "expectedChecker", expectedChecker)); } - public Builder recordTimeScopeVariableComponentPatternUnknown(VariableComponentKey timeScopeVariableComponentKey, String pattern, Set<String> knownPatterns) { + public Builder timeScopeVariableComponentPatternUnknown(VariableComponentKey timeScopeVariableComponentKey, String pattern, Set<String> knownPatterns) { return recordError("timeScopeVariableComponentPatternUnknown", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "component", timeScopeVariableComponentKey.getComponent(), "pattern", pattern, "knownPatterns", knownPatterns)); } - public Builder recordAuthorizationScopeVariableComponentReftypeUnknown(VariableComponentKey timeScopeVariableComponentKey, String refType, Set<String> knownPatterns) { + public Builder authorizationScopeVariableComponentReftypeUnknown(VariableComponentKey timeScopeVariableComponentKey, String refType, Set<String> knownPatterns) { return recordError("authorizationScopeVariableComponentReftypeUnknown", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "component", timeScopeVariableComponentKey.getComponent(), "refType", refType, "knownPatterns", knownPatterns)); } - public Builder recordAuthorizationScopeVariableComponentReftypeNull(VariableComponentKey timeScopeVariableComponentKey, Set<String> knownPatterns) { + public Builder authorizationScopeVariableComponentReftypeNull(VariableComponentKey timeScopeVariableComponentKey, Set<String> knownPatterns) { return recordError("authorizationScopeVariableComponentReftypeNull", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "component", timeScopeVariableComponentKey.getComponent(), "knownPatterns", knownPatterns)); } - public Builder recordAuthorizationVariableComponentMustReferToCompositereference(String dataType, String authorizationName, String refType, Set<String> knownCompositesReferences) { + public Builder authorizationScopeVariableComponentReftypeUnknown(String dataType, String authorizationName, String refType, Set<String> knownCompositesReferences) { return recordError("authorizationScopeVariableComponentReftypeUnknown", ImmutableMap.of("dataType", dataType, "authorizationName", authorizationName, "refType", refType, "knownCompositesReferences", knownCompositesReferences)); } - public Builder recordUnrecognizedProperty(int lineNumber, int columnNumber, String unknownPropertyName, Collection<String> knownProperties) { + public Builder unrecognizedProperty(int lineNumber, int columnNumber, String unknownPropertyName, Collection<String> knownProperties) { return recordError("unrecognizedProperty", ImmutableMap.of( "lineNumber", lineNumber, "columnNumber", columnNumber, @@ -216,7 +216,7 @@ public class ConfigurationParsingResult { )); } - public Builder recordInvalidFormat(int lineNumber, int columnNumber, String value, String targetTypeName) { + public Builder invalidFormat(int lineNumber, int columnNumber, String value, String targetTypeName) { return recordError("invalidFormat", ImmutableMap.of( "lineNumber", lineNumber, "columnNumber", columnNumber, @@ -257,7 +257,7 @@ public class ConfigurationParsingResult { )); } - public Builder recordUnknownCheckerNameForValidationRuleInReference(String lineValidationRuleKey, String reference, String checkerName, ImmutableSet<String> allCheckerNames) { + public Builder unknownCheckerNameForValidationRuleInReference(String lineValidationRuleKey, String reference, String checkerName, ImmutableSet<String> allCheckerNames) { return recordError("unknownCheckerNameForValidationRuleInReference", ImmutableMap.of( "lineValidationRuleKey", lineValidationRuleKey, "reference", reference, @@ -266,7 +266,7 @@ public class ConfigurationParsingResult { )); } - public Builder recordUnknownCheckerNameForValidationRuleInDataType(String lineValidationRuleKey, String dataType, String checkerName, ImmutableSet<String> allCheckerNames) { + public Builder unknownCheckerNameForValidationRuleInDataType(String lineValidationRuleKey, String dataType, String checkerName, ImmutableSet<String> allCheckerNames) { return recordError("unknownCheckerNameForValidationRuleInDataType", ImmutableMap.of( "lineValidationRuleKey", lineValidationRuleKey, "dataType", dataType, @@ -275,7 +275,7 @@ public class ConfigurationParsingResult { )); } - public Builder recordUnknownCheckerNameForVariableComponentChecker(String dataType, String variable, String component, String checkerName, ImmutableSet<String> knownCheckerNames) { + public Builder unknownCheckerNameForVariableComponent(String dataType, String variable, String component, String checkerName, ImmutableSet<String> knownCheckerNames) { return recordError("unknownCheckerNameForVariableComponent", ImmutableMap.of( "datatype", dataType, "variable", variable, @@ -285,7 +285,7 @@ public class ConfigurationParsingResult { )); } - public Builder recordCsvBoundToUnknownVariable(String header, String variable, Set<String> variables) { + public Builder csvBoundToUnknownVariable(String header, String variable, Set<String> variables) { return recordError("csvBoundToUnknownVariable", ImmutableMap.of( "header", header, "variable", variable, @@ -293,7 +293,7 @@ public class ConfigurationParsingResult { )); } - public Builder recordCsvBoundToUnknownVariableComponent(String header, String variable, String component, Set<String> components) { + public Builder csvBoundToUnknownVariableComponent(String header, String variable, String component, Set<String> components) { return recordError("csvBoundToUnknownVariableComponent", ImmutableMap.of( "header", header, "variable", variable, @@ -302,7 +302,7 @@ public class ConfigurationParsingResult { )); } - public Builder recordInvalidKeyColumns(String reference, Set<String> unknownUsedAsKeyElementColumns, Set<String> knownColumns) { + public Builder invalidKeyColumns(String reference, Set<String> unknownUsedAsKeyElementColumns, Set<String> knownColumns) { return recordError("invalidKeyColumns", ImmutableMap.of( "reference", reference, "unknownUsedAsKeyElementColumns", unknownUsedAsKeyElementColumns, @@ -310,7 +310,7 @@ public class ConfigurationParsingResult { )); } - public Builder recordInvalidInternationalizedColumns(String reference, Set<String> unknownUsedAsKeyInternationalizedColumns, Set<String> knownColumns) { + public Builder invalidInternationalizedColumns(String reference, Set<String> unknownUsedAsKeyInternationalizedColumns, Set<String> knownColumns) { return recordError("invalidInternationalizedColumns", ImmutableMap.of( "reference", reference, "unknownUsedAsInternationalizedColumns", unknownUsedAsKeyInternationalizedColumns, @@ -318,7 +318,7 @@ public class ConfigurationParsingResult { )); } - public Builder recordUnknownUsedAsVariableComponentUniqueness(String dataType, Set<String> unknownUsedAsVariableComponentUniqueness,Set<String> availableVariableComponents) { + public Builder unknownUsedAsVariableComponentUniqueness(String dataType, Set<String> unknownUsedAsVariableComponentUniqueness,Set<String> availableVariableComponents) { return recordError("unknownUsedAsVariableComponentUniqueness", ImmutableMap.of( "dataType", dataType, "unknownUsedAsVariableComponentUniqueness", unknownUsedAsVariableComponentUniqueness, @@ -326,7 +326,7 @@ public class ConfigurationParsingResult { )); } - public Builder recordInvalidInternationalizedColumnsForDataType(String dataType, String reference, Set<String> unknownUsedAsKeyInternationalizedColumns, Set<String> knownColumns) { + public Builder invalidInternationalizedColumnsForDataType(String dataType, String reference, Set<String> unknownUsedAsKeyInternationalizedColumns, Set<String> knownColumns) { return recordError("invalidInternationalizedColumnsForDataType", ImmutableMap.of( "dataType", dataType, "reference", reference, @@ -355,7 +355,7 @@ public class ConfigurationParsingResult { )); } - public Builder recordUnknownCheckerNameForVariableComponentCheckerInReference(String validationRuleDescriptionEntryKey, String reference, String name, ImmutableSet<String> checkerOnTargetNames) { + public Builder unknownCheckerNameForVariableComponentCheckerInReference(String validationRuleDescriptionEntryKey, String reference, String name, ImmutableSet<String> checkerOnTargetNames) { return recordError("unknownCheckerNameForVariableComponentCheckerInReference", ImmutableMap.of( "reference", reference, "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, @@ -364,7 +364,7 @@ public class ConfigurationParsingResult { )); } - public Builder recordUnknownCheckerNameForVariableComponentCheckerInDataType(String validationRuleDescriptionEntryKey, String dataType, String name, ImmutableSet<String> checkerOnTargetNames) { + public Builder unknownCheckerNameForVariableComponentCheckerInDataType(String validationRuleDescriptionEntryKey, String dataType, String name, ImmutableSet<String> checkerOnTargetNames) { return recordError("unknownCheckerNameForVariableComponentCheckerInDataType", ImmutableMap.of( "dataType", dataType, "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, @@ -387,34 +387,34 @@ public class ConfigurationParsingResult { )); } - public Builder missingAuthorizationsForDatatype(String dataType) { + public Builder missingAuthorizationForDatatype(String dataType) { return recordError("missingAuthorizationForDatatype", ImmutableMap.of( "datatype", dataType )); } - public Builder recordUnknownReferenceInCompositeReference(String compositeReferenceName, ImmutableSet<String> unknownReferences, Set<String> existingReferences) { - return recordError("unknownReferenceInCompositereference", ImmutableMap.of( + public Builder unknownReferenceInCompositeReference(String compositeReferenceName, ImmutableSet<String> unknownReferences, Set<String> existingReferences) { + return recordError("unknownReferenceInCompositeReference", ImmutableMap.of( "compositeReference", compositeReferenceName, "unknownReferences", unknownReferences, "references", existingReferences) ); } - public Builder recordMissingReferenceInCompositereference(String compositeReferenceName) { + public Builder missingReferenceInCompositereference(String compositeReferenceName) { return recordError("missingReferenceInCompositereference", ImmutableMap.of( "compositeReference", compositeReferenceName) ); } - public Builder recordRequiredReferenceInCompositeReferenceForParentKeyColumn(String compositeReferenceName, String parentKeyColumn) { + public Builder requiredReferenceInCompositeReferenceForParentKeyColumn(String compositeReferenceName, String parentKeyColumn) { return recordError("requiredReferenceInCompositeReferenceForParentKeyColumn", ImmutableMap.of( "compositeReference", compositeReferenceName, "parentKeyColumn", parentKeyColumn) ); } - public Builder recordRequiredParentKeyColumnInCompositeReferenceForReference(String compositeReferenceName, String reference, String referenceTo) { + public Builder requiredParentKeyColumnInCompositeReferenceForReference(String compositeReferenceName, String reference, String referenceTo) { return recordError("requiredParentKeyColumnInCompositeReferenceForReference", ImmutableMap.of( "compositeReference", compositeReferenceName, "reference", reference, @@ -422,7 +422,7 @@ public class ConfigurationParsingResult { ); } - public Builder recordMissingParentColumnForReferenceInCompositeReferenceFor(String compositeReferenceName, String reference, String parentKeyColumn) { + public Builder missingParentColumnForReferenceInCompositeReference(String compositeReferenceName, String reference, String parentKeyColumn) { return recordError("missingParentColumnForReferenceInCompositeReference", ImmutableMap.of( "compositeReference", compositeReferenceName, "reference", reference, @@ -430,7 +430,7 @@ public class ConfigurationParsingResult { ); } - public Builder recordMissingParentRecursiveKeyColumnForReferenceInCompositeReference(String compositeReferenceName, String reference, String parentRecursiveKey) { + public Builder missingParentRecursiveKeyColumnForReferenceInCompositeReference(String compositeReferenceName, String reference, String parentRecursiveKey) { return recordError("missingParentRecursiveKeyColumnForReferenceInCompositeReference", ImmutableMap.of( "compositeReference", compositeReferenceName, "reference", reference, @@ -438,7 +438,7 @@ public class ConfigurationParsingResult { ); } - public Builder recordUnknownReferenceInDatatypeReferenceDisplay(String dataType, String reference, Set<String> references) { + public Builder unknownReferenceInDatatypeReferenceDisplay(String dataType, String reference, Set<String> references) { return recordError("unknownReferenceInDatatypeReferenceDisplay", ImmutableMap.of( "dataType", dataType, "reference", reference, @@ -446,7 +446,7 @@ public class ConfigurationParsingResult { ); } - public Builder recordUndeclaredValueForChart(String datatype, String variable, Set<String> components) { + public Builder unDeclaredValueForChart(String datatype, String variable, Set<String> components) { return recordError("unDeclaredValueForChart", ImmutableMap.of( "variable", variable, "dataType", datatype, @@ -454,7 +454,7 @@ public class ConfigurationParsingResult { )); } - public Builder recordMissingValueComponentForChart(String datatype, String variable, String valueComponent, Set<String> components) { + public Builder missingValueComponentForChart(String datatype, String variable, String valueComponent, Set<String> components) { return recordError("missingValueComponentForChart", ImmutableMap.of( "variable", variable, "valueComponent", valueComponent, @@ -463,7 +463,7 @@ public class ConfigurationParsingResult { )); } - public Builder recordMissingAggregationVariableForChart(String datatype, String variable, VariableComponentKey aggregation, Set<String> variables) { + public Builder missingAggregationVariableForChart(String datatype, String variable, VariableComponentKey aggregation, Set<String> variables) { return recordError("missingAggregationVariableForChart", ImmutableMap.of( "variable", variable, "aggregationVariable", aggregation.getVariable(), @@ -473,7 +473,7 @@ public class ConfigurationParsingResult { )); } - public Builder recordMissingAggregationComponentForChart(String datatype, String variable, VariableComponentKey aggregation, Set<String> components) { + public Builder missingAggregationComponentForChart(String datatype, String variable, VariableComponentKey aggregation, Set<String> components) { return recordError("missingAggregationComponentForChart", ImmutableMap.of( "variable", variable, "aggregationVariable", aggregation.getVariable(), @@ -483,7 +483,7 @@ public class ConfigurationParsingResult { )); } - public Builder recordMissingStandardDeviationComponentForChart(String datatype, String variable, String standardDeviation, Set<String> components) { + public Builder missingStandardDeviationComponentForChart(String datatype, String variable, String standardDeviation, Set<String> components) { return recordError("missingStandardDeviationComponentForChart", ImmutableMap.of( "variable", variable, "standardDeviation",standardDeviation, @@ -492,7 +492,7 @@ public class ConfigurationParsingResult { )); } - public Builder recordMissingUnitComponentForChart(String datatype, String variable, String unit, Set<String> components) { + public Builder missingUnitComponentForChart(String datatype, String variable, String unit, Set<String> components) { return recordError("missingUnitComponentForChart", ImmutableMap.of( "variable", variable, "unit",unit, @@ -501,49 +501,49 @@ public class ConfigurationParsingResult { )); } - public Builder recordMissingKeyColumnsForReference(String reference) { + public Builder missingKeyColumnsForReference(String reference) { return recordError("missingKeyColumnsForReference", ImmutableMap.of( "reference", reference) ); } - public Builder recordCsvSameHeaderLineAndFirstRowLineForConstantDescription(String dataType) { + public Builder sameHeaderLineAndFirstRowLineForConstantDescription(String dataType) { return recordError("sameHeaderLineAndFirstRowLineForConstantDescription", ImmutableMap.of( "dataType", dataType )); } - public Builder recordCsvTooBigRowLineForConstantDescription(String dataType) { + public Builder tooBigRowLineForConstantDescription(String dataType) { return recordError("tooBigRowLineForConstantDescription", ImmutableMap.of( "dataType", dataType )); } - public Builder recordCsvTooLittleRowLineForConstantDescription(String dataType) { + public Builder tooLittleRowLineForConstantDescription(String dataType) { return recordError("tooLittleRowLineForConstantDescription", ImmutableMap.of( "dataType", dataType )); } - public Builder recordCsvMissingRowLineForConstantDescription(String dataType) { + public Builder missingRowLineForConstantDescription(String dataType) { return recordError("missingRowLineForConstantDescription", ImmutableMap.of( "dataType", dataType )); } - public Builder recordCsvMissingColumnNumberOrHeaderNameForConstantDescription(String dataType) { + public Builder missingColumnNumberOrHeaderNameForConstantDescription(String dataType) { return recordError("missingColumnNumberOrHeaderNameForConstantDescription", ImmutableMap.of( "dataType", dataType )); } - public Builder recordCsvMissingBoundToForConstantDescription(String dataType) { + public Builder missingBoundToForConstantDescription(String dataType) { return recordError("missingBoundToForConstantDescription", ImmutableMap.of( "dataType", dataType )); } - public Builder recordCsvMissingExportHeaderNameForConstantDescription(String dataType) { + public Builder missingExportHeaderNameForConstantDescription(String dataType) { return recordError("missingExportHeaderNameForConstantDescription", ImmutableMap.of( "dataType", dataType )); @@ -584,8 +584,8 @@ public class ConfigurationParsingResult { )); } - public Builder invalidPatternForForReferenceColumnDateChecker(String referenceToValidate, String column, String pattern) { - return recordError("invalidPatternForForVariableComponentDateChecker", ImmutableMap.of( + public Builder invalidPatternForReferenceColumnDateChecker(String referenceToValidate, String column, String pattern) { + return recordError("invalidPatternForReferenceColumnDateChecker", ImmutableMap.of( "referenceToValidate", referenceToValidate, "column", column, "pattern", pattern diff --git a/src/test/java/fr/inra/oresing/rest/ApplicationConfigurationServiceTest.java b/src/test/java/fr/inra/oresing/rest/ApplicationConfigurationServiceTest.java index af7a9b828..657cae577 100644 --- a/src/test/java/fr/inra/oresing/rest/ApplicationConfigurationServiceTest.java +++ b/src/test/java/fr/inra/oresing/rest/ApplicationConfigurationServiceTest.java @@ -157,12 +157,12 @@ public class ApplicationConfigurationServiceTest { } @Test - public void testUnknownReferenceInCompositereference() { + public void testUnknownReferenceInCompositeReference() { ConfigurationParsingResult configurationParsingResult = parseYaml("- reference: typeSites", "- reference: typeDeSites"); Assert.assertFalse(configurationParsingResult.isValid()); ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); log.debug(onlyError.getMessage()); - Assert.assertEquals("unknownReferenceInCompositereference", onlyError.getMessage()); + Assert.assertEquals("unknownReferenceInCompositeReference", onlyError.getMessage()); } @Test diff --git a/ui/src/locales/en.json b/ui/src/locales/en.json index 922a82f6f..01abc35e3 100644 --- a/ui/src/locales/en.json +++ b/ui/src/locales/en.json @@ -116,7 +116,7 @@ "invalidDateWithColumn": "For column: <code> {column} </code> the date <code> {value} </code> does not respect the expected format: <code> {pattern} </code>.", "invalidDurationForDateCheckerForValidationRuleInDataType": "The 'duration' <code>{duration}</code> defined for validation rule <code>{validationRuleDescriptionEntryKey}</code> of data type <code>{dataType}</code> is incorrect", "invalidDurationForDateCheckerForValidationRuleInReference": "The 'duration' <code>{duration}</code> defined for validation rule <code>{validationRuleDescriptionEntryKey}</code> of reference <code>{reference}</code> is incorrect", - "invalidDurationForForVariableComponentDateChecker": "The 'duration' <code>{duration}</code> defined for column <code>{column}</code> of reference <code>{referenceToValidate}</code> is incorrect", + "invalidDurationForReferenceColumnDateChecker": "The 'duration' <code>{duration}</code> defined for column <code>{column}</code> of reference <code>{referenceToValidate}</code> is incorrect", "invalidDurationForVariableComponentDateChecker": "The 'duration' <code>{duration}</code> defined for component <code>{component}</code> of variable <code>{variable}</code> of data type <code>{dataType}</code> is incorrect", "invalidFloat": "For the identified component: <code> {target} </code> the value <code> {value} </code> must be a decimal number.", "invalidFloatWithColumn": "For column: <code> {target} </code> the value <code> {value} </code> must be a decimal number.", @@ -127,13 +127,13 @@ "invalidInternationalizedColumns": "In the repository description <code> {reference} </code>, the columns <code> {unknownUsedAsInternationalizedColumns} </code> are declared as part of internationalizable columns when they do not exist. Known columns: <code> {knownColumns} </code> ", "invalidInternationalizedColumnsForDataType": "In the <code> {reference} </code> repository overload of the <code> {dataType} </code> data type description, the <code> {unknownUsedAsInternationalizedColumns} </code> columns are declared as part of internationalizable columns when they do not exist. Known columns: <code> {knownColumns} </code> ", "invalidKeyColumns": "In the description of reference <code>{reference}</code>, colomns <code>{unknownUsedAsKeyElementColumns}</code> are declared as components of the key but there are no such columns. Known columns are <code>{knownColumns}</code>", - "invalidPatternForDateCheckerForValidationRuleInDataType": "The regular expression <code>{pattern}</code> defined for validation rule <code>{validationRuleDescriptionEntryKey}</code> of data type <code>{dataType}</code> is incorrect", - "invalidPatternForDateCheckerForValidationRuleInReference": "The regular expression <code>{pattern}</code> defined for validation rule <code>{validationRuleDescriptionEntryKey}</code> of reference <code>{reference}</code> is incorrect", - "invalidPatternForForVariableComponentDateChecker": "The regular expression <code>{pattern}</code> defined for column <code>{column}</code> of reference <code>{referenceToValidate}</code> is incorrect", - "invalidPatternForForVariableComponentRegularExpressionChecker": "The regular expression pattern <code>{pattern}</code> defined for column <code>{column}</code> of reference <code>{referenceToValidate}</code> is incorrect", + "invalidPatternForDateCheckerForValidationRuleInDataType": "The date pattern <code>{pattern}</code> defined for validation rule <code>{validationRuleDescriptionEntryKey}</code> of data type <code>{dataType}</code> is incorrect", + "invalidPatternForDateCheckerForValidationRuleInReference": "The date pattern <code>{pattern}</code> defined for validation rule <code>{validationRuleDescriptionEntryKey}</code> of reference <code>{reference}</code> is incorrect", + "invalidPatternForReferenceColumnDateChecker": "The date pattern <code>{pattern}</code> defined for column <code>{column}</code> of reference <code>{referenceToValidate}</code> is incorrect", + "invalidPatternForReferenceColumnRegularExpressionChecker": "The regular expression pattern <code>{pattern}</code> defined for column <code>{column}</code> of reference <code>{referenceToValidate}</code> is incorrect", "invalidPatternForRegularExpressionCheckerForValidationRuleInDataType": "The regular expression pattern <code>{pattern}</code> defined for the validation rule <code>{validationRuleDescriptionEntryKey}</code> of data type <code>{dataType}</code> is incorrect", "invalidPatternForRegularExpressionCheckerForValidationRuleInReference": "The regular expression pattern <code>{pattern}</code> defined for the validation rule <code>{validationRuleDescriptionEntryKey}</code> of reference <code>{reference}</code> is incorrect", - "invalidPatternForVariableComponentDateChecker": "The regular expression <code>{pattern}</code> defined for component <code>{component}</code> of variable <code>{variable}</code> of data type <code>{dataType}</code> is incorrect", + "invalidPatternForVariableComponentDateChecker": "The date pattern <code>{pattern}</code> defined for component <code>{component}</code> of variable <code>{variable}</code> of data type <code>{dataType}</code> is incorrect", "invalidPatternForVariableComponentRegularExpressionChecker": "The regular expression pattern <code>{pattern}</code> defined for the component <code>{component}</code> of variable <code>{variable}</code> of data type <code>{dataType}</code> is incorrect", "invalidReference": "For the identified component: <code> {target} </code> the value <code> {value} </code> does not exist in the reference <code> {refType} </code>. Expected values ​​<code> {referenceValues} </code>. ", "invalidReferenceWithColumn": "For column: <code> {target} </code> the value <code> {value} </code> does not exist in the reference <code> {refType} </code>. Values expected <code> {referenceValues} </code>. ", @@ -196,7 +196,7 @@ "unknownReferenceForCheckerInDataType": "For data type <code>{dataType}</code> and validation <code>{validationKey}</code>, the reference <code>{refType}</code> is not in the accepted references which are: <code>{references}</code>", "unknownReferenceForCheckerInReference": "For reference <code>{reference}</code> and validation <code>{validationKey}</code>, the reference <code>{refType}</code> is not in the accepted references which are: <code>{references}</code>", "unknownReferenceForCheckerInReferenceColumn": "For reference <code>{referenceToValidate}</code> and column <code>{column}</code>, the reference to use to check the value is <code>{refType}</code> but it's not among known references <code>{knownReferences}</code>", - "unknownReferenceInCompositereference": "The composite reference <code> {compositeReference} </code> contains references that are not declared <code> {unknownReferences} </code>. Known references <code> {references} </code>", + "unknownReferenceInCompositeReference": "The composite reference <code> {compositeReference} </code> contains references that are not declared <code> {unknownReferences} </code>. Known references <code> {references} </code>", "unknownReferenceInDatatypeReferenceDisplay": "In the repository display overload of the <code> {dataType} </code> datatype description, the <code> {reference} </code> repository is unknown. Known repositories known : <code> {references} </code> ", "unknownUsedAsVariableComponentUniqueness": "In the description of data type {dataType} in the <I>uniqueness</i> section component variable descriptions {unknownUsedAsVariableComponentUniqueness} do not exist. Accepted values {availableVariableComponents}", "unknownVariablesInDataGroup": "Data group <code>{dataGroup}</code> has undeclared data : <code>{unknownVariables}</code>. <br>Known data : <code>{variables}</code>", diff --git a/ui/src/locales/fr.json b/ui/src/locales/fr.json index 5fd7475a0..3605e2772 100644 --- a/ui/src/locales/fr.json +++ b/ui/src/locales/fr.json @@ -116,7 +116,7 @@ "invalidDateWithColumn": "Pour la colonne : <code>{column}</code> la date <code>{value}</code> ne respecte pas le format attendu : <code>{pattern}</code>. ", "invalidDurationForDateCheckerForValidationRuleInDataType": "La 'duration' <code>{duration}</code> définie pour la règle de validation <code>{validationRuleDescriptionEntryKey}</code> du type de données <code>{dataType}</code> est incorrecte", "invalidDurationForDateCheckerForValidationRuleInReference": "La 'duration' <code>{duration}</code> définie pour la règle de validation <code>{validationRuleDescriptionEntryKey}</code> du référentiel <code>{reference}</code> est incorrecte", - "invalidDurationForForVariableComponentDateChecker": "La 'duration' <code>{duration}</code> définie pour la colonne <code>{column}</code> du référentiel <code>{referenceToValidate}</code> est incorrecte", + "invalidDurationForReferenceColumnDateChecker": "La 'duration' <code>{duration}</code> définie pour la colonne <code>{column}</code> du référentiel <code>{referenceToValidate}</code> est incorrecte", "invalidDurationForVariableComponentDateChecker": "La 'duration' <code>{duration}</code> définie pour le composant <code>{component}</code> de la variable <code>{variable}</code> du type de données <code>{dataType}</code> est incorrecte", "invalidFloat": "Pour le composant identifié : <code>{target}</code> la valeur <code>{value}</code> doit être un nombre décimal.", "invalidFloatWithColumn": "Pour la colonne : <code>{target}</code> la valeur <code>{value}</code> doit être un nombre décimal.", @@ -127,14 +127,14 @@ "invalidInternationalizedColumns": "Dans la description du référentiel <code>{reference}</code>, les colonnes <code>{unknownUsedAsInternationalizedColumns}</code> sont déclarées comme faisant partie de colonnes internationalisables alors qu’elles n’existent pas. Colonnes connues : <code>{knownColumns}</code>", "invalidInternationalizedColumnsForDataType": "Dans la surcharge du référentiel <code>{reference}</code> de la description du type de donnée <code>{dataType}</code>, les colonnes <code>{unknownUsedAsInternationalizedColumns}</code> sont déclarées comme faisant partie de colonnes internationalisables alors qu’elles n’existent pas. Colonnes connues : <code>{knownColumns}</code>", "invalidKeyColumns": "Dans la description du référentiel <code>{reference}</code>, les colonnes <code>{unknownUsedAsKeyElementColumns}</code> sont déclarées comme faisant partie de la clé alors qu’elles n’existent pas. Colonnes connues : <code>{knownColumns}</code>", - "invalidPatternForDateCheckerForValidationRuleInDataType": "L'expression régulière <code>{pattern}</code> définie pour la règle de validation <code>{validationRuleDescriptionEntryKey}</code> du type de données <code>{dataType}</code> est incorrecte", - "invalidPatternForDateCheckerForValidationRuleInReference": "L'expression régulière <code>{pattern}</code> définie pour la règle de validation <code>{validationRuleDescriptionEntryKey}</code> du référentiel <code>{reference}</code> est incorrecte", - "invalidPatternForForVariableComponentDateChecker": "L'expression régulière <code>{pattern}</code> définie pour la colonne <code>{column}</code> du référentiel <code>{referenceToValidate}</code> est incorrecte", - "invalidPatternForForVariableComponentRegularExpressionChecker": "Le format de regularExpression <code>{pattern}</code> défini pour la colonne <code>{column}</code> du référentiel <code>{referenceToValidate}</code> est incorrect", - "invalidPatternForRegularExpressionCheckerForValidationRuleInDataType": "Le format de regularExpression <code>{pattern}</code> défini pour la règle de validation <code>{validationRuleDescriptionEntryKey}</code> du type de données <code>{dataType}</code> est incorrect", - "invalidPatternForRegularExpressionCheckerForValidationRuleInReference": "Le format de regularExpression <code>{pattern}</code> défini pour la règle de validation <code>{validationRuleDescriptionEntryKey}</code> du référentiel <code>{reference}</code> est incorrect", - "invalidPatternForVariableComponentDateChecker": "L'expression régulière <code>{pattern}</code> définie pour le composant <code>{component}</code> de la variable <code>{variable}</code> du type de données <code>{dataType}</code> est incorrecte", - "invalidPatternForVariableComponentRegularExpressionChecker": "Le format de regularExpression <code>{pattern}</code> défini pour le composant <code>{component}</code> de la variable <code>{variable}</code> du type de données <code>{dataType}</code> est incorrect", + "invalidPatternForDateCheckerForValidationRuleInDataType": "Le format de date <code>{pattern}</code> défini pour la règle de validation <code>{validationRuleDescriptionEntryKey}</code> du type de données <code>{dataType}</code> est incorrect", + "invalidPatternForDateCheckerForValidationRuleInReference": "Le format de date <code>{pattern}</code> défini pour la règle de validation <code>{validationRuleDescriptionEntryKey}</code> du référentiel <code>{reference}</code> est incorrect", + "invalidPatternForReferenceColumnDateChecker": "Le format de date <code>{pattern}</code> défini pour la colonne <code>{column}</code> du référentiel <code>{referenceToValidate}</code> est incorrect", + "invalidPatternForReferenceColumnRegularExpressionChecker": "L'expression régulière <code>{pattern}</code> défini pour la colonne <code>{column}</code> du référentiel <code>{referenceToValidate}</code> est incorrect", + "invalidPatternForRegularExpressionCheckerForValidationRuleInDataType": "L'expression régulière <code>{pattern}</code> défini pour la règle de validation <code>{validationRuleDescriptionEntryKey}</code> du type de données <code>{dataType}</code> est incorrect", + "invalidPatternForRegularExpressionCheckerForValidationRuleInReference": "L'expression régulière <code>{pattern}</code> défini pour la règle de validation <code>{validationRuleDescriptionEntryKey}</code> du référentiel <code>{reference}</code> est incorrect", + "invalidPatternForVariableComponentDateChecker": "Le format de date <code>{pattern}</code> défini pour le composant <code>{component}</code> de la variable <code>{variable}</code> du type de données <code>{dataType}</code> est incorrect", + "invalidPatternForVariableComponentRegularExpressionChecker": "L'expression régulière <code>{pattern}</code> défini pour le composant <code>{component}</code> de la variable <code>{variable}</code> du type de données <code>{dataType}</code> est incorrect", "invalidReference": "Pour le composant identifié : <code>{target}</code> la valeur <code>{value}</code> n'existe pas dans la référence <code>{refType}</code>. Valeurs attendues <code>{referenceValues}</code>.", "invalidReferenceWithColumn": "Pour la colonne : <code>{target}</code> la valeur <code>{value}</code> n'existe pas dans la référence <code>{refType}</code>. Valeurs attendues <code>{referenceValues}</code>.", "missingAggregationComponentForChart": "Dans la description du graphe de la variable <code> {variable} </code> du type de données <code> {dataType} </code>, le componsant <code> {aggregationComponent}</code> de la variable d'aggrégation <code> {aggregationVariable}</code> n'est pas déclarée.<br /> Valeurs attendues <code>{components}</code>", @@ -196,7 +196,7 @@ "unknownReferenceForCheckerInDataType": "Pour le type de données <code>{dataType}</code>, la validation <code>{validationKey}</code>, la référence <code>{refType}</code> n’est pas dans les références acceptées qui sont : <code>{references}</code>", "unknownReferenceForCheckerInReference": "Pour la référence <code>{reference}</code>, la validation <code>{validationKey}</code>, la référence <code>{refType}</code> n’est pas dans les références acceptées qui sont : <code>{references}</code>", "unknownReferenceForCheckerInReferenceColumn": "Pour le référentiel <code>{referenceToValidate}</code> et la colonne <code>{column}</code>, le référentiel à utiliser pour le contrôle de valeur est <code>{refType}</code> qui n'est pas connu parmi <code>{knownReferences}</code>", - "unknownReferenceInCompositereference": "La reference composite <code>{compositeReference}</code> contient des références qui ne sont pas déclarées <code>{unknownReferences}</code>. Références connues <code>{references}</code>", + "unknownReferenceInCompositeReference": "La reference composite <code>{compositeReference}</code> contient des références qui ne sont pas déclarées <code>{unknownReferences}</code>. Références connues <code>{references}</code>", "unknownReferenceInDatatypeReferenceDisplay": "Dans la surcharge de l'affichage des référentiels de la description du type de donnée <code>{dataType}</code>, le référentiel <code>{reference}</code> est inconnu . Référentiels connus connues : <code>{references}</code>", "unknownUsedAsVariableComponentUniqueness": "Dans la description du type de données {dataType} dans la section <I>uniqueness</i> les descriptions de variable composants {unknownUsedAsVariableComponentUniqueness} n'existent pas. Valeurs acceptées {availableVariableComponents}", "unknownVariablesInDataGroup": "le groupe de données <code>{dataGroup}</code> contient des données qui ne sont pas déclarées <code>{unknownVariables}</code>. Données connues <code>{variables}</code>", -- GitLab From 0bd0ad770c4708fe08420cc019373f5527efe6d4 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Tue, 5 Apr 2022 18:27:19 +0200 Subject: [PATCH 38/41] =?UTF-8?q?=C3=89vite=20de=20retourner=20le=20Builde?= =?UTF-8?q?r=20car,=20en=20pratique,=20on=20ne=20cha=C3=AEne=20presque=20j?= =?UTF-8?q?amais?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rest/ConfigurationParsingResult.java | 328 +++++++++--------- 1 file changed, 164 insertions(+), 164 deletions(-) diff --git a/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java b/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java index 17d5a31c4..69365259d 100644 --- a/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java +++ b/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java @@ -68,106 +68,106 @@ public class ConfigurationParsingResult { return recordError("unsupportedVersion", ImmutableMap.of("actualVersion", actualVersion, "expectedVersion", expectedVersion)); } - public Builder unknownIllegalException(String cause) { - return recordError("unknownIllegalException", ImmutableMap.of( + public void unknownIllegalException(String cause) { + recordError("unknownIllegalException", ImmutableMap.of( "cause", cause)); } - public Builder missingReferenceForCheckerInReference(String validationKey, String reference, Set<String> references) { - return recordError("missingReferenceForCheckerInReference", ImmutableMap.of( + public void missingReferenceForCheckerInReference(String validationKey, String reference, Set<String> references) { + recordError("missingReferenceForCheckerInReference", ImmutableMap.of( "validationKey", validationKey, "reference", reference, "references", references)); } - public Builder missingReferenceForCheckerInDataType(String validationKey, String dataType, Set<String> references) { - return recordError("missingReferenceForCheckerInDataType", ImmutableMap.of( + public void missingReferenceForCheckerInDataType(String validationKey, String dataType, Set<String> references) { + recordError("missingReferenceForCheckerInDataType", ImmutableMap.of( "validationKey", validationKey, "dataType", dataType, "references", references)); } - public Builder missingReferenceForChecker(String dataType, String datum, String component, Set<String> references) { - return recordError("missingReferenceForChecker", ImmutableMap.of("dataType", dataType, + public void missingReferenceForChecker(String dataType, String datum, String component, Set<String> references) { + recordError("missingReferenceForChecker", ImmutableMap.of("dataType", dataType, "datum", datum, "component", component, "references", references)); } - public Builder unknownReferenceForCheckerInReference(String validationKey, String reference, String refType, Set<String> references) { - return recordError("unknownReferenceForCheckerInReference", ImmutableMap.of( + public void unknownReferenceForCheckerInReference(String validationKey, String reference, String refType, Set<String> references) { + recordError("unknownReferenceForCheckerInReference", ImmutableMap.of( "validationKey", validationKey, "refType", refType, "reference", reference, "references", references)); } - public Builder unknownReferenceForCheckerInDataType(String validationKey, String dataType, String refType, Set<String> references) { - return recordError("unknownReferenceForCheckerInDataType", ImmutableMap.of( + public void unknownReferenceForCheckerInDataType(String validationKey, String dataType, String refType, Set<String> references) { + recordError("unknownReferenceForCheckerInDataType", ImmutableMap.of( "validationKey", validationKey, "refType", refType, "dataType", dataType, "references", references)); } - public Builder unknownReferenceForChecker(String dataType, String datum, String component, String refType, Set<String> references) { - return recordError("unknownReferenceForChecker", ImmutableMap.of("dataType", dataType, + public void unknownReferenceForChecker(String dataType, String datum, String component, String refType, Set<String> references) { + recordError("unknownReferenceForChecker", ImmutableMap.of("dataType", dataType, "datum", datum, "refType", refType, "component", component, "references", references)); } - public Builder undeclaredDataGroupForVariable(String variable) { - return recordError("undeclaredDataGroupForVariable", ImmutableMap.of("variable", variable)); + public void undeclaredDataGroupForVariable(String variable) { + recordError("undeclaredDataGroupForVariable", ImmutableMap.of("variable", variable)); } - public Builder variableInMultipleDataGroup(String variable) { - return recordError("variableInMultipleDataGroup", ImmutableMap.of("variable", variable)); + public void variableInMultipleDataGroup(String variable) { + recordError("variableInMultipleDataGroup", ImmutableMap.of("variable", variable)); } - public Builder unknownVariablesInDataGroup(String dataGroup, Set<String> unknownVariables, Set<String> variables) { - return recordError("unknownVariablesInDataGroup", ImmutableMap.of( + public void unknownVariablesInDataGroup(String dataGroup, Set<String> unknownVariables, Set<String> variables) { + recordError("unknownVariablesInDataGroup", ImmutableMap.of( "dataGroup", dataGroup, "unknownVariables", unknownVariables, "variables", variables) ); } - public Builder missingTimeScopeVariableComponentKey(String dataType) { - return recordError("missingTimeScopeVariableComponentKey", ImmutableMap.of("dataType", dataType)); + public void missingTimeScopeVariableComponentKey(String dataType) { + recordError("missingTimeScopeVariableComponentKey", ImmutableMap.of("dataType", dataType)); } - public Builder missingAuthorizationScopeVariableComponentKey(String dataType) { - return recordError("missingAuthorizationScopeVariableComponentKey", ImmutableMap.of("dataType", dataType)); + public void missingAuthorizationScopeVariableComponentKey(String dataType) { + recordError("missingAuthorizationScopeVariableComponentKey", ImmutableMap.of("dataType", dataType)); } - public Builder timeScopeVariableComponentKeyMissingVariable(String dataType, Set<String> variables) { - return recordError("timeScopeVariableComponentKeyMissingVariable", ImmutableMap.of("dataType", dataType, "variables", variables)); + public void timeScopeVariableComponentKeyMissingVariable(String dataType, Set<String> variables) { + recordError("timeScopeVariableComponentKeyMissingVariable", ImmutableMap.of("dataType", dataType, "variables", variables)); } - public Builder authorizationScopeVariableComponentKeyMissingVariable(String dataType, String authorizationScopeName, Set<String> variables) { - return recordError("authorizationScopeVariableComponentKeyMissingVariable", ImmutableMap.of("dataType", dataType, "authorizationScopeName", authorizationScopeName, "variables", variables)); + public void authorizationScopeVariableComponentKeyMissingVariable(String dataType, String authorizationScopeName, Set<String> variables) { + recordError("authorizationScopeVariableComponentKeyMissingVariable", ImmutableMap.of("dataType", dataType, "authorizationScopeName", authorizationScopeName, "variables", variables)); } - public Builder timeScopeVariableComponentKeyUnknownVariable(VariableComponentKey timeScopeVariableComponentKey, Set<String> knownVariables) { - return recordError("timeScopeVariableComponentKeyUnknownVariable", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "knownVariables", knownVariables)); + public void timeScopeVariableComponentKeyUnknownVariable(VariableComponentKey timeScopeVariableComponentKey, Set<String> knownVariables) { + recordError("timeScopeVariableComponentKeyUnknownVariable", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "knownVariables", knownVariables)); } - public Builder authorizationScopeVariableComponentKeyUnknownVariable(VariableComponentKey timeScopeVariableComponentKey, Set<String> knownVariables) { - return recordError("authorizationScopeVariableComponentKeyUnknownVariable", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "knownVariables", knownVariables)); + public void authorizationScopeVariableComponentKeyUnknownVariable(VariableComponentKey timeScopeVariableComponentKey, Set<String> knownVariables) { + recordError("authorizationScopeVariableComponentKeyUnknownVariable", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "knownVariables", knownVariables)); } - public Builder timeVariableComponentKeyMissingComponent(String dataType, String variable, Set<String> knownComponents) { - return recordError("timeVariableComponentKeyMissingComponent", ImmutableMap.of( + public void timeVariableComponentKeyMissingComponent(String dataType, String variable, Set<String> knownComponents) { + recordError("timeVariableComponentKeyMissingComponent", ImmutableMap.of( "dataType", dataType, "variable", variable, "knownComponents", knownComponents )); } - public Builder authorizationVariableComponentKeyMissingComponent(String dataType, String authorizationName, String variable, Set<String> knownComponents) { - return recordError("authorizationVariableComponentKeyMissingComponent", ImmutableMap.of( + public void authorizationVariableComponentKeyMissingComponent(String dataType, String authorizationName, String variable, Set<String> knownComponents) { + recordError("authorizationVariableComponentKeyMissingComponent", ImmutableMap.of( "dataType", dataType, "authorizationName", authorizationName, "variable", variable, @@ -175,36 +175,36 @@ public class ConfigurationParsingResult { )); } - public Builder timeVariableComponentKeyUnknownComponent(VariableComponentKey timeScopeVariableComponentKey, Set<String> knownComponents) { - return recordError("timeVariableComponentKeyUnknownComponent", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "component", timeScopeVariableComponentKey.getComponent(), "knownComponents", knownComponents)); + public void timeVariableComponentKeyUnknownComponent(VariableComponentKey timeScopeVariableComponentKey, Set<String> knownComponents) { + recordError("timeVariableComponentKeyUnknownComponent", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "component", timeScopeVariableComponentKey.getComponent(), "knownComponents", knownComponents)); } - public Builder authorizationVariableComponentKeyUnknownComponent(VariableComponentKey timeScopeVariableComponentKey, Set<String> knownComponents) { - return recordError("authorizationVariableComponentKeyUnknownComponent", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "component", timeScopeVariableComponentKey.getComponent(), "knownComponents", knownComponents)); + public void authorizationVariableComponentKeyUnknownComponent(VariableComponentKey timeScopeVariableComponentKey, Set<String> knownComponents) { + recordError("authorizationVariableComponentKeyUnknownComponent", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "component", timeScopeVariableComponentKey.getComponent(), "knownComponents", knownComponents)); } - public Builder timeScopeVariableComponentWrongChecker(VariableComponentKey timeScopeVariableComponentKey, String expectedChecker) { - return recordError("timeScopeVariableComponentWrongChecker", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "component", timeScopeVariableComponentKey.getComponent(), "expectedChecker", expectedChecker)); + public void timeScopeVariableComponentWrongChecker(VariableComponentKey timeScopeVariableComponentKey, String expectedChecker) { + recordError("timeScopeVariableComponentWrongChecker", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "component", timeScopeVariableComponentKey.getComponent(), "expectedChecker", expectedChecker)); } - public Builder authorizationScopeVariableComponentWrongChecker(VariableComponentKey timeScopeVariableComponentKey, String expectedChecker) { - return recordError("authorizationScopeVariableComponentWrongChecker", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "component", timeScopeVariableComponentKey.getComponent(), "expectedChecker", expectedChecker)); + public void authorizationScopeVariableComponentWrongChecker(VariableComponentKey timeScopeVariableComponentKey, String expectedChecker) { + recordError("authorizationScopeVariableComponentWrongChecker", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "component", timeScopeVariableComponentKey.getComponent(), "expectedChecker", expectedChecker)); } - public Builder timeScopeVariableComponentPatternUnknown(VariableComponentKey timeScopeVariableComponentKey, String pattern, Set<String> knownPatterns) { - return recordError("timeScopeVariableComponentPatternUnknown", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "component", timeScopeVariableComponentKey.getComponent(), "pattern", pattern, "knownPatterns", knownPatterns)); + public void timeScopeVariableComponentPatternUnknown(VariableComponentKey timeScopeVariableComponentKey, String pattern, Set<String> knownPatterns) { + recordError("timeScopeVariableComponentPatternUnknown", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "component", timeScopeVariableComponentKey.getComponent(), "pattern", pattern, "knownPatterns", knownPatterns)); } - public Builder authorizationScopeVariableComponentReftypeUnknown(VariableComponentKey timeScopeVariableComponentKey, String refType, Set<String> knownPatterns) { - return recordError("authorizationScopeVariableComponentReftypeUnknown", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "component", timeScopeVariableComponentKey.getComponent(), "refType", refType, "knownPatterns", knownPatterns)); + public void authorizationScopeVariableComponentReftypeUnknown(VariableComponentKey timeScopeVariableComponentKey, String refType, Set<String> knownPatterns) { + recordError("authorizationScopeVariableComponentReftypeUnknown", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "component", timeScopeVariableComponentKey.getComponent(), "refType", refType, "knownPatterns", knownPatterns)); } - public Builder authorizationScopeVariableComponentReftypeNull(VariableComponentKey timeScopeVariableComponentKey, Set<String> knownPatterns) { - return recordError("authorizationScopeVariableComponentReftypeNull", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "component", timeScopeVariableComponentKey.getComponent(), "knownPatterns", knownPatterns)); + public void authorizationScopeVariableComponentReftypeNull(VariableComponentKey timeScopeVariableComponentKey, Set<String> knownPatterns) { + recordError("authorizationScopeVariableComponentReftypeNull", ImmutableMap.of("variable", timeScopeVariableComponentKey.getVariable(), "component", timeScopeVariableComponentKey.getComponent(), "knownPatterns", knownPatterns)); } - public Builder authorizationScopeVariableComponentReftypeUnknown(String dataType, String authorizationName, String refType, Set<String> knownCompositesReferences) { - return recordError("authorizationScopeVariableComponentReftypeUnknown", ImmutableMap.of("dataType", dataType, "authorizationName", authorizationName, "refType", refType, "knownCompositesReferences", knownCompositesReferences)); + public void authorizationScopeVariableComponentReftypeUnknown(String dataType, String authorizationName, String refType, Set<String> knownCompositesReferences) { + recordError("authorizationScopeVariableComponentReftypeUnknown", ImmutableMap.of("dataType", dataType, "authorizationName", authorizationName, "refType", refType, "knownCompositesReferences", knownCompositesReferences)); } public Builder unrecognizedProperty(int lineNumber, int columnNumber, String unknownPropertyName, Collection<String> knownProperties) { @@ -225,22 +225,22 @@ public class ConfigurationParsingResult { )); } - public Builder missingRequiredExpressionForValidationRuleInDataType(String lineValidationRuleKey, String dataType) { - return recordError("missingRequiredExpressionForValidationRuleInDataType", ImmutableMap.of( + public void missingRequiredExpressionForValidationRuleInDataType(String lineValidationRuleKey, String dataType) { + recordError("missingRequiredExpressionForValidationRuleInDataType", ImmutableMap.of( "lineValidationRuleKey", lineValidationRuleKey, "dataType", dataType )); } - public Builder missingRequiredExpressionForValidationRuleInReference(String lineValidationRuleKey, String reference) { - return recordError("missingRequiredExpressionForValidationRuleInReference", ImmutableMap.of( + public void missingRequiredExpressionForValidationRuleInReference(String lineValidationRuleKey, String reference) { + recordError("missingRequiredExpressionForValidationRuleInReference", ImmutableMap.of( "lineValidationRuleKey", lineValidationRuleKey, "reference", reference )); } - public Builder illegalGroovyExpressionForValidationRuleInDataType(String lineValidationRuleKey, String dataType, String expression, GroovyExpression.CompilationError compilationError) { - return recordError("illegalGroovyExpressionForValidationRuleInDataType", ImmutableMap.of( + public void illegalGroovyExpressionForValidationRuleInDataType(String lineValidationRuleKey, String dataType, String expression, GroovyExpression.CompilationError compilationError) { + recordError("illegalGroovyExpressionForValidationRuleInDataType", ImmutableMap.of( "lineValidationRuleKey", lineValidationRuleKey, "dataType", dataType, "expression", expression, @@ -248,8 +248,8 @@ public class ConfigurationParsingResult { )); } - public Builder illegalGroovyExpressionForValidationRuleInReference(String lineValidationRuleKey, String reference, String expression, GroovyExpression.CompilationError compilationError) { - return recordError("illegalGroovyExpressionForValidationRuleInReference", ImmutableMap.of( + public void illegalGroovyExpressionForValidationRuleInReference(String lineValidationRuleKey, String reference, String expression, GroovyExpression.CompilationError compilationError) { + recordError("illegalGroovyExpressionForValidationRuleInReference", ImmutableMap.of( "lineValidationRuleKey", lineValidationRuleKey, "reference", reference, "expression", expression, @@ -257,8 +257,8 @@ public class ConfigurationParsingResult { )); } - public Builder unknownCheckerNameForValidationRuleInReference(String lineValidationRuleKey, String reference, String checkerName, ImmutableSet<String> allCheckerNames) { - return recordError("unknownCheckerNameForValidationRuleInReference", ImmutableMap.of( + public void unknownCheckerNameForValidationRuleInReference(String lineValidationRuleKey, String reference, String checkerName, ImmutableSet<String> allCheckerNames) { + recordError("unknownCheckerNameForValidationRuleInReference", ImmutableMap.of( "lineValidationRuleKey", lineValidationRuleKey, "reference", reference, "allCheckerNames", allCheckerNames, @@ -266,8 +266,8 @@ public class ConfigurationParsingResult { )); } - public Builder unknownCheckerNameForValidationRuleInDataType(String lineValidationRuleKey, String dataType, String checkerName, ImmutableSet<String> allCheckerNames) { - return recordError("unknownCheckerNameForValidationRuleInDataType", ImmutableMap.of( + public void unknownCheckerNameForValidationRuleInDataType(String lineValidationRuleKey, String dataType, String checkerName, ImmutableSet<String> allCheckerNames) { + recordError("unknownCheckerNameForValidationRuleInDataType", ImmutableMap.of( "lineValidationRuleKey", lineValidationRuleKey, "dataType", dataType, "allCheckerNames", allCheckerNames, @@ -275,8 +275,8 @@ public class ConfigurationParsingResult { )); } - public Builder unknownCheckerNameForVariableComponent(String dataType, String variable, String component, String checkerName, ImmutableSet<String> knownCheckerNames) { - return recordError("unknownCheckerNameForVariableComponent", ImmutableMap.of( + public void unknownCheckerNameForVariableComponent(String dataType, String variable, String component, String checkerName, ImmutableSet<String> knownCheckerNames) { + recordError("unknownCheckerNameForVariableComponent", ImmutableMap.of( "datatype", dataType, "variable", variable, "component", component, @@ -285,16 +285,16 @@ public class ConfigurationParsingResult { )); } - public Builder csvBoundToUnknownVariable(String header, String variable, Set<String> variables) { - return recordError("csvBoundToUnknownVariable", ImmutableMap.of( + public void csvBoundToUnknownVariable(String header, String variable, Set<String> variables) { + recordError("csvBoundToUnknownVariable", ImmutableMap.of( "header", header, "variable", variable, "variables", variables )); } - public Builder csvBoundToUnknownVariableComponent(String header, String variable, String component, Set<String> components) { - return recordError("csvBoundToUnknownVariableComponent", ImmutableMap.of( + public void csvBoundToUnknownVariableComponent(String header, String variable, String component, Set<String> components) { + recordError("csvBoundToUnknownVariableComponent", ImmutableMap.of( "header", header, "variable", variable, "component", component, @@ -302,32 +302,32 @@ public class ConfigurationParsingResult { )); } - public Builder invalidKeyColumns(String reference, Set<String> unknownUsedAsKeyElementColumns, Set<String> knownColumns) { - return recordError("invalidKeyColumns", ImmutableMap.of( + public void invalidKeyColumns(String reference, Set<String> unknownUsedAsKeyElementColumns, Set<String> knownColumns) { + recordError("invalidKeyColumns", ImmutableMap.of( "reference", reference, "unknownUsedAsKeyElementColumns", unknownUsedAsKeyElementColumns, "knownColumns", knownColumns )); } - public Builder invalidInternationalizedColumns(String reference, Set<String> unknownUsedAsKeyInternationalizedColumns, Set<String> knownColumns) { - return recordError("invalidInternationalizedColumns", ImmutableMap.of( + public void invalidInternationalizedColumns(String reference, Set<String> unknownUsedAsKeyInternationalizedColumns, Set<String> knownColumns) { + recordError("invalidInternationalizedColumns", ImmutableMap.of( "reference", reference, "unknownUsedAsInternationalizedColumns", unknownUsedAsKeyInternationalizedColumns, "knownColumns", knownColumns )); } - public Builder unknownUsedAsVariableComponentUniqueness(String dataType, Set<String> unknownUsedAsVariableComponentUniqueness,Set<String> availableVariableComponents) { - return recordError("unknownUsedAsVariableComponentUniqueness", ImmutableMap.of( + public void unknownUsedAsVariableComponentUniqueness(String dataType, Set<String> unknownUsedAsVariableComponentUniqueness,Set<String> availableVariableComponents) { + recordError("unknownUsedAsVariableComponentUniqueness", ImmutableMap.of( "dataType", dataType, "unknownUsedAsVariableComponentUniqueness", unknownUsedAsVariableComponentUniqueness, "availableVariableComponents", availableVariableComponents )); } - public Builder invalidInternationalizedColumnsForDataType(String dataType, String reference, Set<String> unknownUsedAsKeyInternationalizedColumns, Set<String> knownColumns) { - return recordError("invalidInternationalizedColumnsForDataType", ImmutableMap.of( + public void invalidInternationalizedColumnsForDataType(String dataType, String reference, Set<String> unknownUsedAsKeyInternationalizedColumns, Set<String> knownColumns) { + recordError("invalidInternationalizedColumnsForDataType", ImmutableMap.of( "dataType", dataType, "reference", reference, "unknownUsedAsInternationalizedColumns", unknownUsedAsKeyInternationalizedColumns, @@ -335,8 +335,8 @@ public class ConfigurationParsingResult { )); } - public Builder missingColumnReferenceForCheckerInReference(String validationRuleDescriptionEntryKey, Set<String> knownColumns, String name, ImmutableSet<String> missingColumns, String reference) { - return recordError("missingColumnReferenceForCheckerInReference", ImmutableMap.of( + public void missingColumnReferenceForCheckerInReference(String validationRuleDescriptionEntryKey, Set<String> knownColumns, String name, ImmutableSet<String> missingColumns, String reference) { + recordError("missingColumnReferenceForCheckerInReference", ImmutableMap.of( "reference", reference, "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, "knownColumns", knownColumns, @@ -345,8 +345,8 @@ public class ConfigurationParsingResult { )); } - public Builder missingColumnReferenceForCheckerInDataType(String validationRuleDescriptionEntryKey, Set<String> knownVariableComponents, String name, ImmutableSet<String> missingVariableComponents, String dataType) { - return recordError("missingColumnReferenceForCheckerInDataType", ImmutableMap.of( + public void missingColumnReferenceForCheckerInDataType(String validationRuleDescriptionEntryKey, Set<String> knownVariableComponents, String name, ImmutableSet<String> missingVariableComponents, String dataType) { + recordError("missingColumnReferenceForCheckerInDataType", ImmutableMap.of( "dataType", dataType, "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, "knownVariableComponents", knownVariableComponents, @@ -355,8 +355,8 @@ public class ConfigurationParsingResult { )); } - public Builder unknownCheckerNameForVariableComponentCheckerInReference(String validationRuleDescriptionEntryKey, String reference, String name, ImmutableSet<String> checkerOnTargetNames) { - return recordError("unknownCheckerNameForVariableComponentCheckerInReference", ImmutableMap.of( + public void unknownCheckerNameForVariableComponentCheckerInReference(String validationRuleDescriptionEntryKey, String reference, String name, ImmutableSet<String> checkerOnTargetNames) { + recordError("unknownCheckerNameForVariableComponentCheckerInReference", ImmutableMap.of( "reference", reference, "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, "name", name, @@ -364,8 +364,8 @@ public class ConfigurationParsingResult { )); } - public Builder unknownCheckerNameForVariableComponentCheckerInDataType(String validationRuleDescriptionEntryKey, String dataType, String name, ImmutableSet<String> checkerOnTargetNames) { - return recordError("unknownCheckerNameForVariableComponentCheckerInDataType", ImmutableMap.of( + public void unknownCheckerNameForVariableComponentCheckerInDataType(String validationRuleDescriptionEntryKey, String dataType, String name, ImmutableSet<String> checkerOnTargetNames) { + recordError("unknownCheckerNameForVariableComponentCheckerInDataType", ImmutableMap.of( "dataType", dataType, "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, "name", name, @@ -373,89 +373,89 @@ public class ConfigurationParsingResult { )); } - public Builder missingParamColumnReferenceForCheckerInReference(String validationRuleDescriptionEntryKey, String reference) { - return recordError("missingParamColumnReferenceForCheckerInReference", ImmutableMap.of( + public void missingParamColumnReferenceForCheckerInReference(String validationRuleDescriptionEntryKey, String reference) { + recordError("missingParamColumnReferenceForCheckerInReference", ImmutableMap.of( "reference", reference, "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey )); } - public Builder missingParamColumnReferenceForCheckerInDataType(String validationRuleDescriptionEntryKey, String dataType) { - return recordError("missingParamColumnReferenceForCheckerInDataType", ImmutableMap.of( + public void missingParamColumnReferenceForCheckerInDataType(String validationRuleDescriptionEntryKey, String dataType) { + recordError("missingParamColumnReferenceForCheckerInDataType", ImmutableMap.of( "dataType", dataType, "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey )); } - public Builder missingAuthorizationForDatatype(String dataType) { - return recordError("missingAuthorizationForDatatype", ImmutableMap.of( + public void missingAuthorizationForDatatype(String dataType) { + recordError("missingAuthorizationForDatatype", ImmutableMap.of( "datatype", dataType )); } - public Builder unknownReferenceInCompositeReference(String compositeReferenceName, ImmutableSet<String> unknownReferences, Set<String> existingReferences) { - return recordError("unknownReferenceInCompositeReference", ImmutableMap.of( + public void unknownReferenceInCompositeReference(String compositeReferenceName, ImmutableSet<String> unknownReferences, Set<String> existingReferences) { + recordError("unknownReferenceInCompositeReference", ImmutableMap.of( "compositeReference", compositeReferenceName, "unknownReferences", unknownReferences, "references", existingReferences) ); } - public Builder missingReferenceInCompositereference(String compositeReferenceName) { - return recordError("missingReferenceInCompositereference", ImmutableMap.of( + public void missingReferenceInCompositereference(String compositeReferenceName) { + recordError("missingReferenceInCompositereference", ImmutableMap.of( "compositeReference", compositeReferenceName) ); } - public Builder requiredReferenceInCompositeReferenceForParentKeyColumn(String compositeReferenceName, String parentKeyColumn) { - return recordError("requiredReferenceInCompositeReferenceForParentKeyColumn", ImmutableMap.of( + public void requiredReferenceInCompositeReferenceForParentKeyColumn(String compositeReferenceName, String parentKeyColumn) { + recordError("requiredReferenceInCompositeReferenceForParentKeyColumn", ImmutableMap.of( "compositeReference", compositeReferenceName, "parentKeyColumn", parentKeyColumn) ); } - public Builder requiredParentKeyColumnInCompositeReferenceForReference(String compositeReferenceName, String reference, String referenceTo) { - return recordError("requiredParentKeyColumnInCompositeReferenceForReference", ImmutableMap.of( + public void requiredParentKeyColumnInCompositeReferenceForReference(String compositeReferenceName, String reference, String referenceTo) { + recordError("requiredParentKeyColumnInCompositeReferenceForReference", ImmutableMap.of( "compositeReference", compositeReferenceName, "reference", reference, "referenceTo", referenceTo) ); } - public Builder missingParentColumnForReferenceInCompositeReference(String compositeReferenceName, String reference, String parentKeyColumn) { - return recordError("missingParentColumnForReferenceInCompositeReference", ImmutableMap.of( + public void missingParentColumnForReferenceInCompositeReference(String compositeReferenceName, String reference, String parentKeyColumn) { + recordError("missingParentColumnForReferenceInCompositeReference", ImmutableMap.of( "compositeReference", compositeReferenceName, "reference", reference, "parentKeyColumn", parentKeyColumn) ); } - public Builder missingParentRecursiveKeyColumnForReferenceInCompositeReference(String compositeReferenceName, String reference, String parentRecursiveKey) { - return recordError("missingParentRecursiveKeyColumnForReferenceInCompositeReference", ImmutableMap.of( + public void missingParentRecursiveKeyColumnForReferenceInCompositeReference(String compositeReferenceName, String reference, String parentRecursiveKey) { + recordError("missingParentRecursiveKeyColumnForReferenceInCompositeReference", ImmutableMap.of( "compositeReference", compositeReferenceName, "reference", reference, "parentRecursiveKey", parentRecursiveKey) ); } - public Builder unknownReferenceInDatatypeReferenceDisplay(String dataType, String reference, Set<String> references) { - return recordError("unknownReferenceInDatatypeReferenceDisplay", ImmutableMap.of( + public void unknownReferenceInDatatypeReferenceDisplay(String dataType, String reference, Set<String> references) { + recordError("unknownReferenceInDatatypeReferenceDisplay", ImmutableMap.of( "dataType", dataType, "reference", reference, "references", references) ); } - public Builder unDeclaredValueForChart(String datatype, String variable, Set<String> components) { - return recordError("unDeclaredValueForChart", ImmutableMap.of( + public void unDeclaredValueForChart(String datatype, String variable, Set<String> components) { + recordError("unDeclaredValueForChart", ImmutableMap.of( "variable", variable, "dataType", datatype, "components", components )); } - public Builder missingValueComponentForChart(String datatype, String variable, String valueComponent, Set<String> components) { - return recordError("missingValueComponentForChart", ImmutableMap.of( + public void missingValueComponentForChart(String datatype, String variable, String valueComponent, Set<String> components) { + recordError("missingValueComponentForChart", ImmutableMap.of( "variable", variable, "valueComponent", valueComponent, "dataType", datatype, @@ -463,8 +463,8 @@ public class ConfigurationParsingResult { )); } - public Builder missingAggregationVariableForChart(String datatype, String variable, VariableComponentKey aggregation, Set<String> variables) { - return recordError("missingAggregationVariableForChart", ImmutableMap.of( + public void missingAggregationVariableForChart(String datatype, String variable, VariableComponentKey aggregation, Set<String> variables) { + recordError("missingAggregationVariableForChart", ImmutableMap.of( "variable", variable, "aggregationVariable", aggregation.getVariable(), "aggregationComponent", aggregation.getComponent(), @@ -473,8 +473,8 @@ public class ConfigurationParsingResult { )); } - public Builder missingAggregationComponentForChart(String datatype, String variable, VariableComponentKey aggregation, Set<String> components) { - return recordError("missingAggregationComponentForChart", ImmutableMap.of( + public void missingAggregationComponentForChart(String datatype, String variable, VariableComponentKey aggregation, Set<String> components) { + recordError("missingAggregationComponentForChart", ImmutableMap.of( "variable", variable, "aggregationVariable", aggregation.getVariable(), "aggregationComponent", aggregation.getComponent(), @@ -483,8 +483,8 @@ public class ConfigurationParsingResult { )); } - public Builder missingStandardDeviationComponentForChart(String datatype, String variable, String standardDeviation, Set<String> components) { - return recordError("missingStandardDeviationComponentForChart", ImmutableMap.of( + public void missingStandardDeviationComponentForChart(String datatype, String variable, String standardDeviation, Set<String> components) { + recordError("missingStandardDeviationComponentForChart", ImmutableMap.of( "variable", variable, "standardDeviation",standardDeviation, "dataType", datatype, @@ -492,8 +492,8 @@ public class ConfigurationParsingResult { )); } - public Builder missingUnitComponentForChart(String datatype, String variable, String unit, Set<String> components) { - return recordError("missingUnitComponentForChart", ImmutableMap.of( + public void missingUnitComponentForChart(String datatype, String variable, String unit, Set<String> components) { + recordError("missingUnitComponentForChart", ImmutableMap.of( "variable", variable, "unit",unit, "dataType", datatype, @@ -501,56 +501,56 @@ public class ConfigurationParsingResult { )); } - public Builder missingKeyColumnsForReference(String reference) { - return recordError("missingKeyColumnsForReference", ImmutableMap.of( + public void missingKeyColumnsForReference(String reference) { + recordError("missingKeyColumnsForReference", ImmutableMap.of( "reference", reference) ); } - public Builder sameHeaderLineAndFirstRowLineForConstantDescription(String dataType) { - return recordError("sameHeaderLineAndFirstRowLineForConstantDescription", ImmutableMap.of( + public void sameHeaderLineAndFirstRowLineForConstantDescription(String dataType) { + recordError("sameHeaderLineAndFirstRowLineForConstantDescription", ImmutableMap.of( "dataType", dataType )); } - public Builder tooBigRowLineForConstantDescription(String dataType) { - return recordError("tooBigRowLineForConstantDescription", ImmutableMap.of( + public void tooBigRowLineForConstantDescription(String dataType) { + recordError("tooBigRowLineForConstantDescription", ImmutableMap.of( "dataType", dataType )); } - public Builder tooLittleRowLineForConstantDescription(String dataType) { - return recordError("tooLittleRowLineForConstantDescription", ImmutableMap.of( + public void tooLittleRowLineForConstantDescription(String dataType) { + recordError("tooLittleRowLineForConstantDescription", ImmutableMap.of( "dataType", dataType )); } - public Builder missingRowLineForConstantDescription(String dataType) { - return recordError("missingRowLineForConstantDescription", ImmutableMap.of( + public void missingRowLineForConstantDescription(String dataType) { + recordError("missingRowLineForConstantDescription", ImmutableMap.of( "dataType", dataType )); } - public Builder missingColumnNumberOrHeaderNameForConstantDescription(String dataType) { - return recordError("missingColumnNumberOrHeaderNameForConstantDescription", ImmutableMap.of( + public void missingColumnNumberOrHeaderNameForConstantDescription(String dataType) { + recordError("missingColumnNumberOrHeaderNameForConstantDescription", ImmutableMap.of( "dataType", dataType )); } - public Builder missingBoundToForConstantDescription(String dataType) { - return recordError("missingBoundToForConstantDescription", ImmutableMap.of( + public void missingBoundToForConstantDescription(String dataType) { + recordError("missingBoundToForConstantDescription", ImmutableMap.of( "dataType", dataType )); } - public Builder missingExportHeaderNameForConstantDescription(String dataType) { - return recordError("missingExportHeaderNameForConstantDescription", ImmutableMap.of( + public void missingExportHeaderNameForConstantDescription(String dataType) { + recordError("missingExportHeaderNameForConstantDescription", ImmutableMap.of( "dataType", dataType )); } - public Builder unknownReferenceForCheckerInReferenceColumn(String referenceToValidate, String column, String refType, Set<String> knownReferences) { - return recordError("unknownReferenceForCheckerInReferenceColumn", ImmutableMap.of( + public void unknownReferenceForCheckerInReferenceColumn(String referenceToValidate, String column, String refType, Set<String> knownReferences) { + recordError("unknownReferenceForCheckerInReferenceColumn", ImmutableMap.of( "referenceToValidate", referenceToValidate, "column", column, "refType", refType, @@ -558,16 +558,16 @@ public class ConfigurationParsingResult { )); } - public Builder missingReferenceForCheckerInReferenceColumn(String referenceToValidate, String column, Set<String> knownReferences) { - return recordError("missingReferenceForCheckerInReferenceColumn", ImmutableMap.of( + public void missingReferenceForCheckerInReferenceColumn(String referenceToValidate, String column, Set<String> knownReferences) { + recordError("missingReferenceForCheckerInReferenceColumn", ImmutableMap.of( "referenceToValidate", referenceToValidate, "column", column, "knownReferences", knownReferences )); } - public Builder unknownCheckerNameInReferenceColumn(String referenceToValidate, String column, String checkerName, ImmutableSet<String> knownCheckerNames) { - return recordError("unknownCheckerNameInReferenceColumn", ImmutableMap.of( + public void unknownCheckerNameInReferenceColumn(String referenceToValidate, String column, String checkerName, ImmutableSet<String> knownCheckerNames) { + recordError("unknownCheckerNameInReferenceColumn", ImmutableMap.of( "referenceToValidate", referenceToValidate, "column", column, "checkerName", checkerName, @@ -575,8 +575,8 @@ public class ConfigurationParsingResult { )); } - public Builder invalidPatternForVariableComponentDateChecker(String dataType, String variable, String component, String pattern) { - return recordError("invalidPatternForVariableComponentDateChecker", ImmutableMap.of( + public void invalidPatternForVariableComponentDateChecker(String dataType, String variable, String component, String pattern) { + recordError("invalidPatternForVariableComponentDateChecker", ImmutableMap.of( "dataType", dataType, "variable", variable, "component", component, @@ -584,32 +584,32 @@ public class ConfigurationParsingResult { )); } - public Builder invalidPatternForReferenceColumnDateChecker(String referenceToValidate, String column, String pattern) { - return recordError("invalidPatternForReferenceColumnDateChecker", ImmutableMap.of( + public void invalidPatternForReferenceColumnDateChecker(String referenceToValidate, String column, String pattern) { + recordError("invalidPatternForReferenceColumnDateChecker", ImmutableMap.of( "referenceToValidate", referenceToValidate, "column", column, "pattern", pattern )); } - public Builder invalidPatternForDateCheckerForValidationRuleInDataType(String validationRuleDescriptionEntryKey, String dataType, String pattern) { - return recordError("invalidPatternForDateCheckerForValidationRuleInDataType", ImmutableMap.of( + public void invalidPatternForDateCheckerForValidationRuleInDataType(String validationRuleDescriptionEntryKey, String dataType, String pattern) { + recordError("invalidPatternForDateCheckerForValidationRuleInDataType", ImmutableMap.of( "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, "dataType", dataType, "pattern", pattern )); } - public Builder invalidPatternForDateCheckerForValidationRuleInReference(String validationRuleDescriptionEntryKey, String reference, String pattern) { - return recordError("invalidPatternForDateCheckerForValidationRuleInReference", ImmutableMap.of( + public void invalidPatternForDateCheckerForValidationRuleInReference(String validationRuleDescriptionEntryKey, String reference, String pattern) { + recordError("invalidPatternForDateCheckerForValidationRuleInReference", ImmutableMap.of( "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, "reference", reference, "pattern", pattern )); } - public Builder invalidDurationForVariableComponentDateChecker(String dataType, String variable, String component, String duration) { - return recordError("invalidDurationForVariableComponentDateChecker", ImmutableMap.of( + public void invalidDurationForVariableComponentDateChecker(String dataType, String variable, String component, String duration) { + recordError("invalidDurationForVariableComponentDateChecker", ImmutableMap.of( "dataType", dataType, "variable", variable, "component", component, @@ -617,32 +617,32 @@ public class ConfigurationParsingResult { )); } - public Builder invalidDurationForReferenceColumnDateChecker(String referenceToValidate, String column, String duration) { - return recordError("invalidDurationForReferenceColumnDateChecker", ImmutableMap.of( + public void invalidDurationForReferenceColumnDateChecker(String referenceToValidate, String column, String duration) { + recordError("invalidDurationForReferenceColumnDateChecker", ImmutableMap.of( "referenceToValidate", referenceToValidate, "column", column, "duration", duration )); } - public Builder invalidDurationForDateCheckerForValidationRuleInDataType(String validationRuleDescriptionEntryKey, String dataType, String duration) { - return recordError("invalidDurationForDateCheckerForValidationRuleInDataType", ImmutableMap.of( + public void invalidDurationForDateCheckerForValidationRuleInDataType(String validationRuleDescriptionEntryKey, String dataType, String duration) { + recordError("invalidDurationForDateCheckerForValidationRuleInDataType", ImmutableMap.of( "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, "dataType", dataType, "duration", duration )); } - public Builder invalidDurationForDateCheckerForValidationRuleInReference(String validationRuleDescriptionEntryKey, String reference, String duration) { - return recordError("invalidDurationForDateCheckerForValidationRuleInReference", ImmutableMap.of( + public void invalidDurationForDateCheckerForValidationRuleInReference(String validationRuleDescriptionEntryKey, String reference, String duration) { + recordError("invalidDurationForDateCheckerForValidationRuleInReference", ImmutableMap.of( "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, "reference", reference, "duration", duration )); } - public Builder invalidPatternForVariableComponentRegularExpressionChecker(String dataType, String variable, String component, String pattern) { - return recordError("invalidPatternForVariableComponentRegularExpressionChecker", ImmutableMap.of( + public void invalidPatternForVariableComponentRegularExpressionChecker(String dataType, String variable, String component, String pattern) { + recordError("invalidPatternForVariableComponentRegularExpressionChecker", ImmutableMap.of( "dataType", dataType, "variable", variable, "component", component, @@ -650,24 +650,24 @@ public class ConfigurationParsingResult { )); } - public Builder invalidPatternForReferenceColumnRegularExpressionChecker(String referenceToValidate, String column, String pattern) { - return recordError("invalidPatternForReferenceColumnRegularExpressionChecker", ImmutableMap.of( + public void invalidPatternForReferenceColumnRegularExpressionChecker(String referenceToValidate, String column, String pattern) { + recordError("invalidPatternForReferenceColumnRegularExpressionChecker", ImmutableMap.of( "referenceToValidate", referenceToValidate, "column", column, "pattern", pattern )); } - public Builder invalidPatternForRegularExpressionCheckerForValidationRuleInDataType(String validationRuleDescriptionEntryKey, String dataType, String pattern) { - return recordError("invalidPatternForRegularExpressionCheckerForValidationRuleInDataType", ImmutableMap.of( + public void invalidPatternForRegularExpressionCheckerForValidationRuleInDataType(String validationRuleDescriptionEntryKey, String dataType, String pattern) { + recordError("invalidPatternForRegularExpressionCheckerForValidationRuleInDataType", ImmutableMap.of( "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, "dataType", dataType, "pattern", pattern )); } - public Builder invalidPatternForRegularExpressionCheckerForValidationRuleInReference(String validationRuleDescriptionEntryKey, String reference, String pattern) { - return recordError("invalidPatternForRegularExpressionCheckerForValidationRuleInReference", ImmutableMap.of( + public void invalidPatternForRegularExpressionCheckerForValidationRuleInReference(String validationRuleDescriptionEntryKey, String reference, String pattern) { + recordError("invalidPatternForRegularExpressionCheckerForValidationRuleInReference", ImmutableMap.of( "validationRuleDescriptionEntryKey", validationRuleDescriptionEntryKey, "reference", reference, "pattern", pattern -- GitLab From 182e5eecad113eb6f0756ad20c57d103d1b1ceca Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Tue, 5 Apr 2022 18:31:04 +0200 Subject: [PATCH 39/41] =?UTF-8?q?=C3=89vite=20que=20du=20code=20soit=20mor?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oresing/rest/ApplicationConfigurationService.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java index 7f0dbe1f7..1016b2927 100644 --- a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java +++ b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java @@ -137,11 +137,12 @@ public class ApplicationConfigurationService { Configuration.AuthorizationDescription authorization = dataTypeDescription.getAuthorization(); Set<String> variables = dataTypeDescription.getData().keySet(); - if (authorization == null) { - /** - * to decomment if authorization section is required - */ - //builder.missingAuthorizationsForDatatype(dataType); + + // FIXME + boolean authorizationSectionIsRequired = false; + + if (authorizationSectionIsRequired && authorization == null) { + builder.missingAuthorizationForDatatype(dataType); } else { VariableComponentKey timeScopeVariableComponentKey = authorization.getTimeScope(); verifyDatatypeTimeScopeExistsAndIsValid(builder, dataType, dataTypeDescription, variables, timeScopeVariableComponentKey); -- GitLab From 03051f42d98612be21bb51569a38f8f5248d1077 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Tue, 5 Apr 2022 18:33:24 +0200 Subject: [PATCH 40/41] Supprime le code mort du service de validation --- .../rest/ApplicationConfigurationService.java | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java index 1016b2927..bced293da 100644 --- a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java +++ b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java @@ -36,7 +36,6 @@ import org.springframework.web.multipart.MultipartFile; import java.io.IOException; import java.util.Collection; -import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -50,7 +49,6 @@ import java.util.stream.Collectors; @Component @Slf4j public class ApplicationConfigurationService { - public static final List INTERNATIONALIZED_FIELDS = List.of("internationalization", "internationalizationName", "internationalizedColumns", "internationalizationDisplay"); private static final ImmutableSet<String> CHECKER_ON_TARGET_NAMES = ImmutableSet.of("Date", "Float", "Integer", "RegularExpression", "Reference"); @@ -70,7 +68,6 @@ public class ApplicationConfigurationService { .emptyFile() .build(); } - Map<String, Map> internationalizedSections = new HashMap<>(); try { YAMLMapper mapper = new YAMLMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @@ -1007,31 +1004,6 @@ public class ApplicationConfigurationService { .build(); } - private ConfigurationParsingResult onMappingExceptions(List<IllegalArgumentException> exceptions) { - ConfigurationParsingResult.Builder builder = ConfigurationParsingResult.builder(); - exceptions - .forEach(exception -> { - if (exception.getCause() instanceof UnrecognizedPropertyException) { - UnrecognizedPropertyException e = (UnrecognizedPropertyException) exception.getCause(); - int lineNumber = e.getLocation().getLineNr(); - int columnNumber = e.getLocation().getColumnNr(); - String unknownPropertyName = e.getPropertyName(); - Collection<String> knownProperties = (Collection) e.getKnownPropertyIds(); - builder.unrecognizedProperty(lineNumber, columnNumber, unknownPropertyName, knownProperties); - } else if (exception.getCause() instanceof InvalidFormatException) { - InvalidFormatException e = (InvalidFormatException) exception.getCause(); - int lineNumber = e.getLocation().getLineNr(); - int columnNumber = e.getLocation().getColumnNr(); - String value = e.getValue().toString(); - String targetTypeName = e.getTargetType().getName(); - builder.invalidFormat(lineNumber, columnNumber, value, targetTypeName); - } else { - builder.unknownIllegalException(exception.getCause().getLocalizedMessage()); - } - }); - return builder.build(); - } - private ConfigurationParsingResult onUnrecognizedPropertyException(UnrecognizedPropertyException e) { int lineNumber = e.getLocation().getLineNr(); int columnNumber = e.getLocation().getColumnNr(); -- GitLab From d424a4c1ee971d0ce0754a44a00bebe8d4900375 Mon Sep 17 00:00:00 2001 From: Brendan Le Ny <bleny@codelutin.com> Date: Wed, 6 Apr 2022 10:12:47 +0200 Subject: [PATCH 41/41] Corrige ErrorService suite aux corrections des bundles pour les erreurs --- ui/src/services/ErrorsService.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/src/services/ErrorsService.js b/ui/src/services/ErrorsService.js index 42fbc91bd..95e2c347f 100644 --- a/ui/src/services/ErrorsService.js +++ b/ui/src/services/ErrorsService.js @@ -13,9 +13,9 @@ const ERRORS = { checkerExpressionReturnedFalse: (params) => i18n.t("errors.checkerExpressionReturnedFalse", params), csvBoundToUnknownVariable: (params) => i18n.t("errors.csvBoundToUnknownVariable", params), csvBoundToUnknownVariableComponent: (params) => i18n.t("errors.csvBoundToUnknownVariableComponent", params), + duplicateLineInDatatype: (params) => i18n.t("errors.duplicateLineInDatatype", params), + duplicateLineInReference: (params) => i18n.t("errors.duplicateLineInReference", params), duplicatedHeaders: (params) => i18n.t("errors.duplicatedHeaders", params), - duplicatedLineInDatatype: (params) => i18n.t("errors.duplicatedLineInDatatype", params), - duplicatedLineInReference: (params) => i18n.t("errors.duplicatedLineInReference", params), emptyFile: (params) => i18n.t("errors.emptyFile", params), emptyHeader: (params) => i18n.t("errors.emptyHeader", params), headerColumnPatternNotMatching: (params) => i18n.t("errors.headerColumnPatternNotMatching", params), @@ -25,7 +25,7 @@ const ERRORS = { invalidDateWithColumn: (params) => i18n.t("errors.invalidDateWithColumn", params), invalidDurationForDateCheckerForValidationRuleInDataType: (params) => i18n.t("errors.invalidDurationForDateCheckerForValidationRuleInDataType", params), invalidDurationForDateCheckerForValidationRuleInReference: (params) => i18n.t("errors.invalidDurationForDateCheckerForValidationRuleInReference", params), - invalidDurationForForVariableComponentDateChecker: (params) => i18n.t("errors.invalidDurationForForVariableComponentDateChecker", params), + invalidDurationForReferenceColumnDateChecker: (params) => i18n.t("errors.invalidDurationForReferenceColumnDateChecker", params), invalidDurationForVariableComponentDateChecker: (params) => i18n.t("errors.invalidDurationForVariableComponentDateChecker", params), invalidFloat: (params) => i18n.t("errors.invalidFloat", params), invalidFloatWithColumn: (params) => i18n.t("errors.invalidFloatWithColumn", params), @@ -38,8 +38,8 @@ const ERRORS = { invalidKeyColumns: (params) => i18n.t("errors.invalidKeyColumns", params), invalidPatternForDateCheckerForValidationRuleInDataType: (params) => i18n.t("errors.invalidPatternForDateCheckerForValidationRuleInDataType", params), invalidPatternForDateCheckerForValidationRuleInReference: (params) => i18n.t("errors.invalidPatternForDateCheckerForValidationRuleInReference", params), - invalidPatternForForVariableComponentDateChecker: (params) => i18n.t("errors.invalidPatternForForVariableComponentDateChecker", params), - invalidPatternForForVariableComponentRegularExpressionChecker: (params) => i18n.t("errors.invalidPatternForForVariableComponentRegularExpressionChecker", params), + invalidPatternForReferenceColumnDateChecker: (params) => i18n.t("errors.invalidPatternForReferenceColumnDateChecker", params), + invalidPatternForReferenceColumnRegularExpressionChecker: (params) => i18n.t("errors.invalidPatternForReferenceColumnRegularExpressionChecker", params), invalidPatternForRegularExpressionCheckerForValidationRuleInDataType: (params) => i18n.t("errors.invalidPatternForRegularExpressionCheckerForValidationRuleInDataType", params), invalidPatternForRegularExpressionCheckerForValidationRuleInReference: (params) => i18n.t("errors.invalidPatternForRegularExpressionCheckerForValidationRuleInReference", params), invalidPatternForVariableComponentDateChecker: (params) => i18n.t("errors.invalidPatternForVariableComponentDateChecker", params), @@ -105,7 +105,7 @@ const ERRORS = { unknownReferenceForCheckerInDataType: (params) => i18n.t("errors.unknownReferenceForCheckerInDataType", params), unknownReferenceForCheckerInReference: (params) => i18n.t("errors.unknownReferenceForCheckerInReference", params), unknownReferenceForCheckerInReferenceColumn: (params) => i18n.t("errors.unknownReferenceForCheckerInReferenceColumn", params), - unknownReferenceInCompositereference: (params) => i18n.t("errors.unknownReferenceInCompositereference", params), + unknownReferenceInCompositeReference: (params) => i18n.t("errors.unknownReferenceInCompositeReference", params), unknownReferenceInDatatypeReferenceDisplay: (params) => i18n.t("errors.unknownReferenceInDatatypeReferenceDisplay", params), unknownUsedAsVariableComponentUniqueness: (params) => i18n.t("errors.unknownUsedAsVariableComponentUniqueness", params), unknownVariablesInDataGroup: (params) => i18n.t("errors.unknownVariablesInDataGroup", params), -- GitLab