Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
defe4bce
by Tony Chemit at 2023-12-07T17:58:18+01:00
-
f7e26769
by Tony Chemit at 2023-12-07T17:58:23+01:00
-
2551e5e5
by Tony Chemit at 2023-12-08T11:43:43+01:00
-
04e62ee0
by Tony Chemit at 2023-12-08T11:43:47+01:00
-
d5392cdd
by Tony Chemit at 2023-12-08T11:43:52+01:00
7 changed files:
- core/persistence/avdth/src/main/java/fr/ird/observe/persistence/avdth/data/ImportDataContext.java
- core/persistence/report/pom.xml
- core/persistence/report/src/main/java/fr/ird/observe/persistence/report/ReportI18nKeys.java
- toolkit/api-report/src/main/java/fr/ird/observe/report/json/ReportI18nItemArrayDefinitionAdapter.java
- toolkit/api-report/src/main/java/fr/ird/observe/report/json/ReportI18nItemDefinitionAdapter.java
- toolkit/api-report/src/main/java/fr/ird/observe/report/renderers/HighlightIfEquals18nReferentialValue.java
- toolkit/plugin/src/main/java/fr/ird/observe/toolkit/maven/plugin/MojoRunnable.java
Changes:
| ... | ... | @@ -143,6 +143,6 @@ public class ImportDataContext extends ImportReferentialContext { |
| 143 | 143 | }
|
| 144 | 144 | |
| 145 | 145 | public void computeCanCreateActivity() {
|
| 146 | - canCreateActivity = !trip.isLocalmarketFilled() && activityPkToId.isEmpty();
|
|
| 146 | + canCreateActivity = activityPkToId.isEmpty();
|
|
| 147 | 147 | }
|
| 148 | 148 | } |
| ... | ... | @@ -49,6 +49,10 @@ |
| 49 | 49 | <artifactId>toolkit-persistence</artifactId>
|
| 50 | 50 | <version>${project.version}</version>
|
| 51 | 51 | </dependency>
|
| 52 | + <dependency>
|
|
| 53 | + <groupId>io.ultreia.java4all.i18n</groupId>
|
|
| 54 | + <artifactId>i18n-runtime</artifactId>
|
|
| 55 | + </dependency>
|
|
| 52 | 56 | <dependency>
|
| 53 | 57 | <groupId>io.ultreia.java4all</groupId>
|
| 54 | 58 | <artifactId>java-lang</artifactId>
|
| ... | ... | @@ -81,7 +85,7 @@ |
| 81 | 85 | <dependency>
|
| 82 | 86 | <groupId>org.apache.logging.log4j</groupId>
|
| 83 | 87 | <artifactId>log4j-api</artifactId>
|
| 84 | - <scope>test</scope>
|
|
| 88 | + <scope>provided</scope>
|
|
| 85 | 89 | </dependency>
|
| 86 | 90 | <dependency>
|
| 87 | 91 | <groupId>org.apache.logging.log4j</groupId>
|
| ... | ... | @@ -42,21 +42,68 @@ public class ReportI18nKeys implements ReportI18nKeysProducer { |
| 42 | 42 | |
| 43 | 43 | public ReportI18nKeys() {
|
| 44 | 44 | Map<String, String> mapping = new TreeMap<>();
|
| 45 | - mapping.put("yes", I18n.n("boolean.true"));
|
|
| 46 | - mapping.put("no", I18n.n("boolean.false"));
|
|
| 47 | - mapping.put("Null", I18n.n("boolean.null"));
|
|
| 48 | - mapping.put("unknown", I18n.n("observe.Common.unknown"));
|
|
| 49 | - mapping.put("notFilled", I18n.n("observe.Common.notFilled"));
|
|
| 50 | - mapping.put("undefined", I18n.n("observe.Common.undefined"));
|
|
| 51 | - mapping.put("all", I18n.n("observe.Common.all"));
|
|
| 52 | - mapping.put("noCode", I18n.n("observe.Common.no.code"));
|
|
| 53 | - mapping.put("count", I18n.n("observe.Common.count"));
|
|
| 54 | - mapping.put("totalWeight", I18n.n("observe.Common.totalWeightInTons"));
|
|
| 55 | - mapping.put("species", I18n.n("observe.Common.species"));
|
|
| 56 | - mapping.put("freeSchoolTypeTotal", I18n.n("observe.Common.freeSchoolTypeTotal"));
|
|
| 57 | - mapping.put("objectSchoolTypeTotal", I18n.n("observe.Common.objectSchoolTypeTotal"));
|
|
| 58 | - mapping.put("lengthClass", I18n.n("observe.Common.lengthClass"));
|
|
| 45 | + mapping.put("@yes@", I18n.n("boolean.true"));
|
|
| 46 | + mapping.put("@no@", I18n.n("boolean.false"));
|
|
| 47 | + mapping.put("@Null@", I18n.n("boolean.null"));
|
|
| 48 | + mapping.put("@unknown@", I18n.n("observe.Common.unknown"));
|
|
| 49 | + mapping.put("@notFilled@", I18n.n("observe.Common.notFilled"));
|
|
| 50 | + mapping.put("@undefined@", I18n.n("observe.Common.undefined"));
|
|
| 51 | + mapping.put("@all@", I18n.n("observe.Common.all"));
|
|
| 52 | + mapping.put("@noCode@", I18n.n("observe.Common.no.code"));
|
|
| 53 | + mapping.put("@count@", I18n.n("observe.Common.count"));
|
|
| 54 | + mapping.put("@totalWeight@", I18n.n("observe.Common.totalWeightInTons"));
|
|
| 55 | + mapping.put("@species@", I18n.n("observe.Common.species"));
|
|
| 56 | + mapping.put("@freeSchoolTypeTotal@", I18n.n("observe.Common.freeSchoolTypeTotal"));
|
|
| 57 | + mapping.put("@objectSchoolTypeTotal@", I18n.n("observe.Common.objectSchoolTypeTotal"));
|
|
| 58 | + mapping.put("@lengthClass@", I18n.n("observe.Common.lengthClass"));
|
|
| 59 | 59 | this.mapping = Collections.unmodifiableMap(mapping);
|
| 60 | + /* FIXME Use this in each report requires it
|
|
| 61 | +i18n.noCode=Aucun code
|
|
| 62 | +i18n.noCode.en=No code
|
|
| 63 | +i18n.noCode.es=No code ?
|
|
| 64 | +i18n.yes=Oui
|
|
| 65 | +i18n.yes.en=Yes
|
|
| 66 | +i18n.yes.es=Si
|
|
| 67 | +i18n.no=Non
|
|
| 68 | +i18n.no.en=No
|
|
| 69 | +i18n.no.es=No
|
|
| 70 | +i18n.Null=Indéterminé
|
|
| 71 | +i18n.Null.en=Undefined
|
|
| 72 | +i18n.Null.es=Indeterminado
|
|
| 73 | +i18n.unknown=Inconnu
|
|
| 74 | +i18n.unknown.en=Unknown
|
|
| 75 | +i18n.unknown.es=desconocido
|
|
| 76 | +i18n.notFilled=Non renseigné
|
|
| 77 | +i18n.notFilled.en=Not filled
|
|
| 78 | +i18n.notFilled.es=
|
|
| 79 | +i18n.undefined=Non défini
|
|
| 80 | +i18n.undefined.en=Undefined
|
|
| 81 | +i18n.undefined.es=indeterminado
|
|
| 82 | +i18n.all=Tous
|
|
| 83 | +i18n.all.en=All
|
|
| 84 | +i18n.all.es=
|
|
| 85 | +i18n.noCode=Aucun code
|
|
| 86 | +i18n.noCode.en=No code
|
|
| 87 | +i18n.noCode.es=
|
|
| 88 | +i18n.count=Effectif
|
|
| 89 | +i18n.count.en=Count
|
|
| 90 | +i18n.count.es=
|
|
| 91 | +i18n.totalWeight=Poids total (t)
|
|
| 92 | +i18n.totalWeight.en=Total weight (t)
|
|
| 93 | +i18n.totalWeight.es=
|
|
| 94 | +i18n.species=Espèce
|
|
| 95 | +i18n.species.en=Species
|
|
| 96 | +i18n.species.es=Especie
|
|
| 97 | +i18n.freeSchoolTypeTotal=Total BL
|
|
| 98 | +i18n.freeSchoolTypeTotal.en=Free school type total
|
|
| 99 | +i18n.freeSchoolTypeTotal.es=
|
|
| 100 | +i18n.objectSchoolTypeTotal=Total BO
|
|
| 101 | +i18n.objectSchoolTypeTotal.en=Object school type total
|
|
| 102 | +i18n.objectSchoolTypeTotal.es=
|
|
| 103 | +i18n.lengthClass=Classe de taille (cm)
|
|
| 104 | +i18n.lengthClass.en=Length class (cm)
|
|
| 105 | +i18n.lengthClass.es=
|
|
| 106 | + */
|
|
| 60 | 107 | }
|
| 61 | 108 | |
| 62 | 109 | public Map<String, String> mapping() {
|
| ... | ... | @@ -24,6 +24,7 @@ package fr.ird.observe.report.json; |
| 24 | 24 | |
| 25 | 25 | import com.google.auto.service.AutoService;
|
| 26 | 26 | import com.google.gson.JsonDeserializationContext;
|
| 27 | +import com.google.gson.JsonElement;
|
|
| 27 | 28 | import com.google.gson.JsonObject;
|
| 28 | 29 | import fr.ird.observe.report.definition.ReportI18nItemArrayDefinition;
|
| 29 | 30 | import fr.ird.observe.report.definition.ReportI18nItemDefinition;
|
| ... | ... | @@ -44,7 +45,8 @@ public class ReportI18nItemArrayDefinitionAdapter extends ReportI18nDefinitionSu |
| 44 | 45 | |
| 45 | 46 | @Override
|
| 46 | 47 | protected String[] deserialize(JsonDeserializationContext context, JsonObject jsonObject, String labelType) {
|
| 47 | - return context.deserialize(jsonObject.get(labelType), String[].class);
|
|
| 48 | + JsonElement jsonElement = jsonObject.get(labelType);
|
|
| 49 | + return jsonElement == null ? null : context.deserialize(jsonElement, String[].class);
|
|
| 48 | 50 | }
|
| 49 | 51 | |
| 50 | 52 | @Override
|
| ... | ... | @@ -24,6 +24,7 @@ package fr.ird.observe.report.json; |
| 24 | 24 | |
| 25 | 25 | import com.google.auto.service.AutoService;
|
| 26 | 26 | import com.google.gson.JsonDeserializationContext;
|
| 27 | +import com.google.gson.JsonElement;
|
|
| 27 | 28 | import com.google.gson.JsonObject;
|
| 28 | 29 | import fr.ird.observe.report.definition.ReportI18nItemDefinition;
|
| 29 | 30 | import io.ultreia.java4all.util.json.JsonAdapter;
|
| ... | ... | @@ -43,7 +44,8 @@ public class ReportI18nItemDefinitionAdapter extends ReportI18nDefinitionSupport |
| 43 | 44 | |
| 44 | 45 | @Override
|
| 45 | 46 | protected String deserialize(JsonDeserializationContext context, JsonObject jsonObject, String labelType) {
|
| 46 | - return jsonObject.get(labelType).getAsString();
|
|
| 47 | + JsonElement jsonElement = jsonObject.get(labelType);
|
|
| 48 | + return jsonElement == null ? null : jsonElement.getAsString();
|
|
| 47 | 49 | }
|
| 48 | 50 | |
| 49 | 51 | @Override
|
| ... | ... | @@ -43,6 +43,7 @@ import static fr.ird.observe.report.renderers.HighlightIfEquals18nReferentialVal |
| 43 | 43 | * @author Tony Chemit - dev@tchemit.fr
|
| 44 | 44 | * @since 9.3.0
|
| 45 | 45 | */
|
| 46 | +@SuppressWarnings("rawtypes")
|
|
| 46 | 47 | @AutoService(ColumnRendererConsumer.class)
|
| 47 | 48 | public class HighlightIfEquals18nReferentialValue implements ColumnRendererConsumer<Parameters> {
|
| 48 | 49 | private final static SingletonSupplier<String> HTML_FUNCTION = ColumnRendererConsumer.htmlFunctions(HighlightIfEquals18nReferentialValue.class);
|
| ... | ... | @@ -45,6 +45,15 @@ public abstract class MojoRunnable implements Runnable { |
| 45 | 45 | private boolean verbose;
|
| 46 | 46 | private Path temporaryPath;
|
| 47 | 47 | |
| 48 | + public static MojoRunnable of(Runnable runner) {
|
|
| 49 | + return new MojoRunnable() {
|
|
| 50 | + @Override
|
|
| 51 | + public void run() {
|
|
| 52 | + Objects.requireNonNull(runner).run();
|
|
| 53 | + }
|
|
| 54 | + };
|
|
| 55 | + }
|
|
| 56 | + |
|
| 48 | 57 | public I18nKeySet getGetterFile() {
|
| 49 | 58 | return getterFile;
|
| 50 | 59 | }
|
| ... | ... | @@ -81,14 +90,14 @@ public abstract class MojoRunnable implements Runnable { |
| 81 | 90 | Objects.requireNonNull(temporaryPath);
|
| 82 | 91 | }
|
| 83 | 92 | |
| 84 | - public void setTemporaryPath(Path temporaryPath) {
|
|
| 85 | - this.temporaryPath = temporaryPath;
|
|
| 86 | - }
|
|
| 87 | - |
|
| 88 | 93 | public Path getTemporaryPath() {
|
| 89 | 94 | return temporaryPath;
|
| 90 | 95 | }
|
| 91 | 96 | |
| 97 | + public void setTemporaryPath(Path temporaryPath) {
|
|
| 98 | + this.temporaryPath = temporaryPath;
|
|
| 99 | + }
|
|
| 100 | + |
|
| 92 | 101 | public void prepare(MojoRunnable parentRunner) {
|
| 93 | 102 | setLog(parentRunner.log);
|
| 94 | 103 | setGetterFile(parentRunner.getterFile);
|