diff --git a/src/main/java/org/computate/frFR/java/ConfigSite.java b/src/main/java/org/computate/frFR/java/ConfigSite.java index 596d774..4b012d9 100644 --- a/src/main/java/org/computate/frFR/java/ConfigSite.java +++ b/src/main/java/org/computate/frFR/java/ConfigSite.java @@ -694,6 +694,36 @@ protected void _clientSolrFiware() throws Exception { clientSolrFiware = new HttpSolrClient.Builder(solrUrlFiware).withHttpClient(httpClient).build(); } + public String ngsildTenantEnv; + + public String getNgsildTenantEnv() { + return ngsildTenantEnv; + } + + public void setNgsildTenantEnv(String ngsildTenantEnv) { + this.ngsildTenantEnv = ngsildTenantEnv; + } + + protected void _ngsildTenantEnv() throws Exception { + ngsildTenantEnv = StringUtils.defaultIfBlank(config + .getString(langueConfigGlobale.getString(I18n.var_NGSILD_TENANT_ENV)), null); + } + + public String ngsildCheminEnv; + + public String getNgsildCheminEnv() { + return ngsildCheminEnv; + } + + public void setNgsildCheminEnv(String ngsildCheminEnv) { + this.ngsildCheminEnv = ngsildCheminEnv; + } + + protected void _ngsildCheminEnv() throws Exception { + ngsildCheminEnv = StringUtils.defaultIfBlank(config + .getString(langueConfigGlobale.getString(I18n.var_NGSILD_CHEMIN_ENV)), null); + } + /** * Var.enUS: sourcePaths enUS: The absolute paths to source code directories in * the app to watch for changes. @@ -1000,6 +1030,8 @@ public void initConfigSite() throws Exception { _solrUrlFiware(); _clientSolrComputate(); _clientSolrFiware(); + _ngsildTenantEnv(); + _ngsildCheminEnv(); _cheminsSource(); _toutCheminsSource(); _nomsMethodeTest(); diff --git a/src/main/java/org/computate/frFR/java/EcrireApiClasse.java b/src/main/java/org/computate/frFR/java/EcrireApiClasse.java index 19ca065..bf0df3a 100644 --- a/src/main/java/org/computate/frFR/java/EcrireApiClasse.java +++ b/src/main/java/org/computate/frFR/java/EcrireApiClasse.java @@ -3203,31 +3203,94 @@ else if(classeApiMethode.contains("PATCH")) { tl(3, "pgPool.withTransaction(", i18nGlobale.getString(I18n.var_connexionSql), " -> {"); tl(4, i18nGlobale.getString(I18n.var_requeteSite), ".set", i18nGlobale.getString(I18n.var_ConnexionSql), "(", i18nGlobale.getString(I18n.var_connexionSql), ");"); tl(4, "vars", classeNomSimple, "(", i18nGlobale.getString(I18n.var_requeteSite), ").onSuccess(a -> {"); - tl(5, "sql", classeApiMethode, classeNomSimple, "(o, ", classeVarInheritClePrimaire, ").onSuccess(", uncapitalizeClasseNomSimple, " -> {"); - tl(6, i18nGlobale.getString(I18n.var_definir), classeNomSimple, "(", uncapitalizeClasseNomSimple, ", true).onSuccess(c -> {"); - tl(7, i18nGlobale.getString(I18n.var_attribuer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(d -> {"); - tl(8, i18nGlobale.getString(I18n.var_indexer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(o2 -> {"); - tl(9, "if(", i18nGlobale.getString(I18n.var_requeteApi), " != null) {"); - tl(10, i18nGlobale.getString(I18n.var_requeteApi), ".setNumPATCH(", i18nGlobale.getString(I18n.var_requeteApi), ".getNumPATCH() + 1);"); - tl(10, "if(", i18nGlobale.getString(I18n.var_requeteApi), ".getNumFound() == 1L && Optional.ofNullable(", i18nGlobale.getString(I18n.var_requeteSite), ".getJsonObject()).map(json -> json.size() > 0).orElse(false)) {"); - tl(11, "o", classeSauvegarde ? "2" : "", ".", i18nGlobale.getString(I18n.var_requeteApi), classeNomSimple, "();"); - tl(11, "if(", i18nGlobale.getString(I18n.var_requeteApi), ".getVars().size() > 0)"); - tl(12, "eventBus.publish(\"websocket", classeNomSimple, "\", JsonObject.mapFrom(", i18nGlobale.getString(I18n.var_requeteApi), ").toString());"); - tl(10, "}"); - tl(9, "}"); - tl(9, "promise1.complete(", uncapitalizeClasseNomSimple, ");"); - tl(8, "}).onFailure(ex -> {"); - tl(9, "promise1.fail(ex);"); - tl(8, "});"); - tl(7, "}).onFailure(ex -> {"); - tl(8, "promise1.fail(ex);"); - tl(7, "});"); - tl(6, "}).onFailure(ex -> {"); - tl(7, "promise1.fail(ex);"); - tl(6, "});"); - tl(5, "}).onFailure(ex -> {"); - tl(6, "promise1.fail(ex);"); - tl(5, "});"); + if(activerContextBroker && classeFiware) { + tl(5, "JsonObject jsonObject = o.getSiteRequest_().getJsonObject();"); + tl(5, "if(jsonObject.isEmpty()) {"); + tl(6, "ngsildGetEntity(o).onSuccess(ngsildData -> {"); + tl(7, "String setNgsildData = String.format(\"set%s\",StringUtils.capitalize(", classeNomSimple, ".VAR_ngsildData));"); + tl(7, "jsonObject.put(setNgsildData, ngsildData);"); + tl(7, "sql", classeApiMethode, classeNomSimple, "(o, ", classeVarInheritClePrimaire, ").onSuccess(", uncapitalizeClasseNomSimple, " -> {"); + tl(8, i18nGlobale.getString(I18n.var_definir), classeNomSimple, "(", uncapitalizeClasseNomSimple, ", true).onSuccess(c -> {"); + tl(9, i18nGlobale.getString(I18n.var_attribuer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(d -> {"); + tl(10, i18nGlobale.getString(I18n.var_indexer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(o2 -> {"); + tl(11, "if(", i18nGlobale.getString(I18n.var_requeteApi), " != null) {"); + tl(12, i18nGlobale.getString(I18n.var_requeteApi), ".setNumPATCH(", i18nGlobale.getString(I18n.var_requeteApi), ".getNumPATCH() + 1);"); + tl(12, "if(", i18nGlobale.getString(I18n.var_requeteApi), ".getNumFound() == 1L && Optional.ofNullable(", i18nGlobale.getString(I18n.var_requeteSite), ".getJsonObject()).map(json -> json.size() > 0).orElse(false)) {"); + tl(13, "o", classeSauvegarde ? "2" : "", ".", i18nGlobale.getString(I18n.var_requeteApi), classeNomSimple, "();"); + tl(13, "if(", i18nGlobale.getString(I18n.var_requeteApi), ".getVars().size() > 0)"); + tl(14, "eventBus.publish(\"websocket", classeNomSimple, "\", JsonObject.mapFrom(", i18nGlobale.getString(I18n.var_requeteApi), ").toString());"); + tl(12, "}"); + tl(11, "}"); + tl(11, "promise1.complete(", uncapitalizeClasseNomSimple, ");"); + tl(10, "}).onFailure(ex -> {"); + tl(11, "promise1.fail(ex);"); + tl(10, "});"); + tl(9, "}).onFailure(ex -> {"); + tl(10, "promise1.fail(ex);"); + tl(9, "});"); + tl(8, "}).onFailure(ex -> {"); + tl(9, "promise1.fail(ex);"); + tl(8, "});"); + tl(7, "}).onFailure(ex -> {"); + tl(8, "promise1.fail(ex);"); + tl(7, "});"); + tl(6, "}).onFailure(ex -> {"); + tl(7, "promise1.fail(ex);"); + tl(6, "});"); + tl(5, "} else {"); + tl(6, "sql", classeApiMethode, classeNomSimple, "(o, ", classeVarInheritClePrimaire, ").onSuccess(", uncapitalizeClasseNomSimple, " -> {"); + tl(7, i18nGlobale.getString(I18n.var_definir), classeNomSimple, "(", uncapitalizeClasseNomSimple, ", true).onSuccess(c -> {"); + tl(8, i18nGlobale.getString(I18n.var_attribuer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(d -> {"); + tl(9, i18nGlobale.getString(I18n.var_indexer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(o2 -> {"); + tl(10, "if(", i18nGlobale.getString(I18n.var_requeteApi), " != null) {"); + tl(11, i18nGlobale.getString(I18n.var_requeteApi), ".setNumPATCH(", i18nGlobale.getString(I18n.var_requeteApi), ".getNumPATCH() + 1);"); + tl(11, "if(", i18nGlobale.getString(I18n.var_requeteApi), ".getNumFound() == 1L && Optional.ofNullable(", i18nGlobale.getString(I18n.var_requeteSite), ".getJsonObject()).map(json -> json.size() > 0).orElse(false)) {"); + tl(12, "o", classeSauvegarde ? "2" : "", ".", i18nGlobale.getString(I18n.var_requeteApi), classeNomSimple, "();"); + tl(12, "if(", i18nGlobale.getString(I18n.var_requeteApi), ".getVars().size() > 0)"); + tl(13, "eventBus.publish(\"websocket", classeNomSimple, "\", JsonObject.mapFrom(", i18nGlobale.getString(I18n.var_requeteApi), ").toString());"); + tl(11, "}"); + tl(10, "}"); + tl(10, "promise1.complete(", uncapitalizeClasseNomSimple, ");"); + tl(9, "}).onFailure(ex -> {"); + tl(10, "promise1.fail(ex);"); + tl(9, "});"); + tl(8, "}).onFailure(ex -> {"); + tl(9, "promise1.fail(ex);"); + tl(8, "});"); + tl(7, "}).onFailure(ex -> {"); + tl(8, "promise1.fail(ex);"); + tl(7, "});"); + tl(6, "}).onFailure(ex -> {"); + tl(7, "promise1.fail(ex);"); + tl(6, "});"); + tl(5, "}"); + } else { + tl(5, "sql", classeApiMethode, classeNomSimple, "(o, ", classeVarInheritClePrimaire, ").onSuccess(", uncapitalizeClasseNomSimple, " -> {"); + tl(6, i18nGlobale.getString(I18n.var_definir), classeNomSimple, "(", uncapitalizeClasseNomSimple, ", true).onSuccess(c -> {"); + tl(7, i18nGlobale.getString(I18n.var_attribuer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(d -> {"); + tl(8, i18nGlobale.getString(I18n.var_indexer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(o2 -> {"); + tl(9, "if(", i18nGlobale.getString(I18n.var_requeteApi), " != null) {"); + tl(10, i18nGlobale.getString(I18n.var_requeteApi), ".setNumPATCH(", i18nGlobale.getString(I18n.var_requeteApi), ".getNumPATCH() + 1);"); + tl(10, "if(", i18nGlobale.getString(I18n.var_requeteApi), ".getNumFound() == 1L && Optional.ofNullable(", i18nGlobale.getString(I18n.var_requeteSite), ".getJsonObject()).map(json -> json.size() > 0).orElse(false)) {"); + tl(11, "o", classeSauvegarde ? "2" : "", ".", i18nGlobale.getString(I18n.var_requeteApi), classeNomSimple, "();"); + tl(11, "if(", i18nGlobale.getString(I18n.var_requeteApi), ".getVars().size() > 0)"); + tl(12, "eventBus.publish(\"websocket", classeNomSimple, "\", JsonObject.mapFrom(", i18nGlobale.getString(I18n.var_requeteApi), ").toString());"); + tl(10, "}"); + tl(9, "}"); + tl(9, "promise1.complete(", uncapitalizeClasseNomSimple, ");"); + tl(8, "}).onFailure(ex -> {"); + tl(9, "promise1.fail(ex);"); + tl(8, "});"); + tl(7, "}).onFailure(ex -> {"); + tl(8, "promise1.fail(ex);"); + tl(7, "});"); + tl(6, "}).onFailure(ex -> {"); + tl(7, "promise1.fail(ex);"); + tl(6, "});"); + tl(5, "}).onFailure(ex -> {"); + tl(6, "promise1.fail(ex);"); + tl(5, "});"); + } tl(4, "}).onFailure(ex -> {"); tl(5, "promise1.fail(ex);"); tl(4, "});"); @@ -3418,7 +3481,16 @@ else if(classeApiMethode.contains("PATCH")) { tl(3, "}));"); tl(3, "CompositeFuture.all(futures1).onSuccess(a -> {"); tl(4, "CompositeFuture.all(futures2).onSuccess(b -> {"); - tl(5, "promise.complete();"); + if(activerContextBroker && classeFiware) { + tl(5, "cbDeleteEntity(o).onSuccess(c -> {"); + tl(6, "promise.complete();"); + tl(5, "}).onFailure(ex -> {"); + tl(6, "LOG.error(String.format(\"sql", classeApiMethode, classeNomSimple, " ", i18nGlobale.getString(I18n.str_a_échoué), ". \"), ex);"); + tl(6, "promise.fail(ex);"); + tl(5, "});"); + } else { + tl(5, "promise.complete();"); + } tl(4, "}).onFailure(ex -> {"); tl(5, "LOG.error(String.format(\"sql", classeApiMethode, classeNomSimple, " ", i18nGlobale.getString(I18n.str_a_échoué), ". \"), ex);"); tl(5, "promise.fail(ex);"); @@ -4425,13 +4497,15 @@ public void ecrireGenApiServiceImpl3(String classeLangueNom) throws Exception { tl(3, "for (String var : vars) {"); tl(4, "String ngsiType = ", classeNomSimple, ".ngsiType(var);"); tl(4, "String displayName = Optional.ofNullable(", classeNomSimple, ".displayName", classeNomSimple, "(var)).orElse(var);"); - tl(4, "if (ngsiType != null && displayName != null && !var.equals(\"ngsildData\")) {"); + tl(4, "if (ngsiType != null && displayName != null && !var.equals(\"id\") && !var.equals(\"ngsildData\")) {"); tl(5, "Object value = o.obtainForClass(var);"); tl(5, "if(value != null) {"); + tl(6, "Object ngsildVal = ", classeNomSimple, ".ngsi", classeNomSimple, "(var, o);"); + tl(6, "String ngsildType = ", classeNomSimple, ".ngsiType(var);"); tl(6, "entityBody.put(displayName"); tl(8, ", new JsonObject()"); - tl(8, ".put(\"type\", \"Property\")"); - tl(8, ".put(\"value\", value)"); + tl(8, ".put(\"type\", ngsildType)"); + tl(8, ".put(\"value\", ngsildVal)"); tl(8, ".put(\"observedAt\", observedAtStr)"); tl(8, ");"); tl(5, "}"); @@ -4469,9 +4543,9 @@ public void ecrireGenApiServiceImpl3(String classeLangueNom) throws Exception { tl(2, "try {"); tl(3, "String entityName = o.getName();"); tl(3, "String entityType = ", classeNomSimple, ".CLASS_SIMPLE_NAME;"); - tl(3, "String entityId = o.getEntityId();"); + tl(3, "String entityId = o.getId();"); tl(3, "String ngsildUri = String.format(\"/ngsi-ld/v1/entities/%s\", urlEncode(entityId));"); - tl(3, "String ngsildContext = o.getNgsildContext();"); + tl(3, "String ngsildContext = config.getString(ComputateConfigKeys.CONTEXT_BROKER_CONTEXT);"); tl(3, "String link = String.format(\"<%s>; rel=\\\"http://www.w3.org/ns/json-ld#context\\\"; type=\\\"application/ld+json\\\"\", ngsildContext);"); l(); tl(3, "webClient.get("); @@ -4509,7 +4583,7 @@ public void ecrireGenApiServiceImpl3(String classeLangueNom) throws Exception { tl(3, "webClient.delete("); tl(5, "config.getInteger(ComputateConfigKeys.CONTEXT_BROKER_PORT)"); tl(5, ", config.getString(ComputateConfigKeys.CONTEXT_BROKER_HOST_NAME)"); - tl(5, ", String.format(\"/ngsi-ld/v1/entities/%s\", urlEncode(o.getEntityId()))"); + tl(5, ", String.format(\"/ngsi-ld/v1/entities/%s\", urlEncode(o.getId()))"); tl(5, ")"); tl(5, ".ssl(config.getBoolean(ComputateConfigKeys.CONTEXT_BROKER_SSL))"); tl(5, ".putHeader(\"Content-Type\", \"application/ld+json\")"); diff --git a/src/main/java/org/computate/frFR/java/EcrireGenClasse.java b/src/main/java/org/computate/frFR/java/EcrireGenClasse.java index 7f05142..dea7e72 100644 --- a/src/main/java/org/computate/frFR/java/EcrireGenClasse.java +++ b/src/main/java/org/computate/frFR/java/EcrireGenClasse.java @@ -513,6 +513,7 @@ public class EcrireGenClasse extends EcrireClasse { protected ToutEcrivain wClasseNomSimpleMethode; protected ToutEcrivain wDescriptionMethode; protected ToutEcrivain wNgsiTypeMethode; + protected ToutEcrivain wNgsiMethode; protected ToutEcrivain wHtmColonneMethode; protected ToutEcrivain wHtmLigneMethode; protected ToutEcrivain wHtmCelluleMethode; @@ -1350,6 +1351,7 @@ public void genCodeInit() throws Exception { wClasseNomSimpleMethode = ToutEcrivain.create(); wDescriptionMethode = ToutEcrivain.create(); wNgsiTypeMethode = ToutEcrivain.create(); + wNgsiMethode = ToutEcrivain.create(); wHtmColonneMethode = ToutEcrivain.create(); wHtmLigneMethode = ToutEcrivain.create(); wHtmCelluleMethode = ToutEcrivain.create(); @@ -3529,9 +3531,11 @@ else if("td".equals(element)) tl(1, "@JsonIgnore"); else if("JsonArray".equals(entiteNomSimple)) { tl(1, "@JsonProperty"); + tl(1, "@JsonDeserialize(using = ", classePartsJsonArrayDeserializer.nomSimple(langueNom), ".class)"); } else if("JsonObject".equals(entiteNomSimple)) { tl(1, "@JsonProperty"); + tl(1, "@JsonDeserialize(using = ", classePartsJsonObjectDeserializer.nomSimple(langueNom), ".class)"); } else if("Point".equals(entiteNomSimple)) { tl(1, "@JsonProperty"); @@ -5546,6 +5550,21 @@ else if(entiteIndexe if(entiteNgsiType != null) { wNgsiTypeMethode.tl(2, "case VAR_", entiteVar, ":"); wNgsiTypeMethode.tl(3, "return \"", StringEscapeUtils.escapeJava(entiteNgsiType), "\";"); + + wNgsiMethode.tl(2, "case VAR_", entiteVar, ":"); + if("Point".equals(entiteNomSimple)) { + wNgsiMethode.tl(3, "return new JsonObject().put(\"type\", \"Point\").put(\"coordinates\", new JsonArray().add(Double.valueOf(o.get", entiteVarCapitalise, "().getX())).add(Double.valueOf(o.get", entiteVarCapitalise, "().getY()))).toString();"); + } else if("Path".equals(entiteNomSimple)) { + wNgsiMethode.tl(3, "JsonArray pointsArray", entiteVarCapitalise, " = new JsonArray();"); + wNgsiMethode.tl(3, "o.get", entiteVarCapitalise, "().getPoints().stream().map(point -> new JsonArray().add(Double.valueOf(point.getX())).add(Double.valueOf(point.getY()))).collect(Collectors.toList()).forEach(pointArray -> pointsArray", entiteVarCapitalise, ".add(pointArray));"); + wNgsiMethode.tl(3, "return new JsonObject().put(\"type\", \"LineString\").put(\"coordinates\", pointsArray", entiteVarCapitalise, ").toString();"); + } else if("Polygon".equals(entiteNomSimple)) { + wNgsiMethode.tl(3, "JsonArray pointsArray", entiteVarCapitalise, " = new JsonArray();"); + wNgsiMethode.tl(3, "o.get", entiteVarCapitalise, "().getPoints().stream().map(point -> new JsonArray().add(Double.valueOf(point.getX())).add(Double.valueOf(point.getY()))).collect(Collectors.toList()).forEach(pointArray -> pointsArray", entiteVarCapitalise, ".add(pointArray));"); + wNgsiMethode.tl(3, "return new JsonObject().put(\"type\", \"LineString\").put(\"coordinates\", pointsArray", entiteVarCapitalise, ").toString();"); + } else { + wNgsiMethode.tl(3, "return o.get", entiteVarCapitalise, "();"); + } } if(entiteNomSimple != null) { wClasseNomSimpleMethode.tl(2, "case VAR_", entiteVar, ":"); @@ -5752,6 +5771,7 @@ public void genCodeClasseFin(String langueNom, JsonObject langueConfig) throws E wNomAffichageMethode.flushClose(); wDescriptionMethode.flushClose(); wNgsiTypeMethode.flushClose(); + wNgsiMethode.flushClose(); wClasseNomSimpleMethode.flushClose(); wHtmColonneMethode.flushClose(); wHtmLigneMethode.flushClose(); @@ -6427,6 +6447,14 @@ public void genCodeClasseFin(String langueNom, JsonObject langueConfig) throws E tl(4, "return null;"); tl(2, "}"); tl(1, "}"); + l(); + tl(1, "public static Object ngsi", classeNomSimple, "(String var, ", classeNomSimple, " o) {"); + tl(2, "switch(var) {"); + s(wNgsiMethode); + tl(3, "default:"); + tl(4, "return null;"); + tl(2, "}"); + tl(1, "}"); } ///////////////// diff --git a/src/main/java/org/computate/frFR/java/EcrirePageClasse.java b/src/main/java/org/computate/frFR/java/EcrirePageClasse.java index 4d64914..1798db7 100644 --- a/src/main/java/org/computate/frFR/java/EcrirePageClasse.java +++ b/src/main/java/org/computate/frFR/java/EcrirePageClasse.java @@ -1293,7 +1293,7 @@ public void pageCodeClasseJava(String langueNom, JsonObject langueConfig) throws wWebsocketInput3.tl(4, "if(input", entiteVarCapitalise, ") {"); wWebsocketInput3.tl(5, "document.querySelectorAll('.Page_", entiteVar, "').forEach((item, index) => {"); wWebsocketInput3.tl(6, "if(typeof item.value !== 'undefined')"); - wWebsocketInput3.tl(7, "item.setAttribute('value', input", entiteVarCapitalise, ".getAttribute('value'));"); + wWebsocketInput3.tl(7, "item.value = input", entiteVarCapitalise, ".getAttribute('value');"); wWebsocketInput3.tl(6, "else"); wWebsocketInput3.tl(7, "item.textContent = input", entiteVarCapitalise, ".textContent;"); wWebsocketInput3.tl(5, "});"); @@ -3551,7 +3551,6 @@ else if(entiteAttribuer) { // auteurPageJs.tl(3, langueConfig.getString(ConfigCles.var_rechercher), langueConfig.getString(ConfigCles.var_Page), "();"); auteurPageJs.tl(3, "var json = JSON.parse(message['body']);"); auteurPageJs.tl(3, "var ", classeVarId, " = json['id'];"); - auteurPageJs.tl(3, "var ", classeVarId, "Page = document.querySelector('#", i18nPage.getString(I18n.var_Page), "_", classeVarId, "')?.value;"); auteurPageJs.tl(3, "var ", classeVarClePrimairePluriel, " = json['", classeVarClePrimairePluriel, "'];"); auteurPageJs.tl(3, "var empty = json['empty'];"); // auteurPageJs.tl(3, "if(!empty) {"); @@ -3613,7 +3612,7 @@ else if(entiteAttribuer) { auteurPageJs.tl(3, "} else {"); auteurPageJs.tl(4, "document.querySelector('.box-' + ", classeVarId, ")?.remove();"); auteurPageJs.tl(3, "}"); - auteurPageJs.tl(3, "if(", classeVarId, " && ", classeVarId, "Page && ", classeVarId, " == ", classeVarId, "Page) {"); + auteurPageJs.tl(3, "if(", classeVarId, ") {"); auteurPageJs.tl(4, "if(success)"); auteurPageJs.tl(5, "success(json);"); auteurPageJs.tl(3, "}"); diff --git a/src/main/java/org/computate/frFR/java/IndexerClasse.java b/src/main/java/org/computate/frFR/java/IndexerClasse.java index 2e6875f..942fbf1 100644 --- a/src/main/java/org/computate/frFR/java/IndexerClasse.java +++ b/src/main/java/org/computate/frFR/java/IndexerClasse.java @@ -194,6 +194,12 @@ public class IndexerClasse extends RegarderClasseBase { */ public static final String VAL_nomCanoniqueVertxJsonObject = "io.vertx.core.json.JsonObject"; + ClasseParts classePartsJsonObjectSerializer; + ClasseParts classePartsJsonObjectDeserializer; + + ClasseParts classePartsJsonArraySerializer; + ClasseParts classePartsJsonArrayDeserializer; + ClasseParts classePartsPointSerializer; ClasseParts classePartsPointDeserializer; @@ -1765,6 +1771,20 @@ protected ClasseParts classePartsConfigCles(String nomEnsembleDomaine, String la return parts; } + protected ClasseParts classePartsJsonObjectDeserializer(String nomEnsembleDomaine, String langueNom) throws Exception { + ClasseParts parts = classePartsPourNomSimple(nomEnsembleDomaine, "JsonObjectDeserializer", langueNom); + if(parts == null) + parts = ClasseParts.initClasseParts(this, "org.computate.vertx.serialize.vertx.JsonObjectDeserializer", langueNom); + return parts; + } + + protected ClasseParts classePartsJsonArrayDeserializer(String nomEnsembleDomaine, String langueNom) throws Exception { + ClasseParts parts = classePartsPourNomSimple(nomEnsembleDomaine, "JsonArrayDeserializer", langueNom); + if(parts == null) + parts = ClasseParts.initClasseParts(this, "org.computate.vertx.serialize.vertx.JsonArrayDeserializer", langueNom); + return parts; + } + protected ClasseParts classePartsPointDeserializer(String nomEnsembleDomaine, String langueNom) throws Exception { ClasseParts parts = classePartsPourNomSimple(nomEnsembleDomaine, "PointDeserializer", langueNom); if(parts == null) @@ -2156,6 +2176,8 @@ else if(classeQdoxSuper != null) { classePartsRequeteSite = classePartsRequeteSite(nomEnsembleDomaine, classeLangueNom); classePartsMailVerticle = classePartsMailVerticle(nomEnsembleDomaine, classeLangueNom); classePartsConfigCles = classePartsConfigCles(nomEnsembleDomaine, classeLangueNom); + classePartsJsonObjectDeserializer = classePartsJsonObjectDeserializer(nomEnsembleDomaine, classeLangueNom); + classePartsJsonArrayDeserializer = classePartsJsonArrayDeserializer(nomEnsembleDomaine, classeLangueNom); classePartsPointDeserializer = classePartsPointDeserializer(nomEnsembleDomaine, classeLangueNom); classePartsPointSerializer = classePartsPointSerializer(nomEnsembleDomaine, classeLangueNom); classePartsPathDeserializer = classePartsPathDeserializer(nomEnsembleDomaine, classeLangueNom); @@ -2445,6 +2467,9 @@ else if(classeEstBase) { classePartsGenAjouter(ClasseParts.initClasseParts(this, JsonSerialize.class.getCanonicalName(), classeLangueNom), classeLangueNom); classePartsGenAjouter(ClasseParts.initClasseParts(this, JsonDeserialize.class.getCanonicalName(), classeLangueNom), classeLangueNom); + if(classePartsLocalDateSerializer != null) + classePartsGenAjouter(classePartsLocalDateSerializer, classeLangueNom); + if(classePartsLocalDateSerializer != null) classePartsGenAjouter(classePartsLocalDateSerializer, classeLangueNom); @@ -3045,6 +3070,13 @@ else if(entiteClasseParts != null && entiteClasseParts.getDocumentSolr() != null indexerStockerSolr(classeLangueNom, entiteDoc, "entiteNomSimpleComplet", entiteClasseParts.nomSimpleComplet(classeLangueNom)); indexerStockerSolr(classeLangueNom, entiteDoc, "entiteNomSimpleCompletGenerique", entiteClasseParts.nomSimpleGenerique(classeLangueNom)); + if("JsonObject".equals(entiteNomSimple)) { + classePartsGenAjouter(classePartsJsonObjectDeserializer, classeLangueNom); + } + if("JsonArray".equals(entiteNomSimple)) { + classePartsGenAjouter(classePartsJsonArrayDeserializer, classeLangueNom); + } + if("Point".equals(entiteNomSimple)) { classePartsGenAjouter(classePartsPointSerializer, classeLangueNom); classePartsGenAjouter(classePartsPointDeserializer, classeLangueNom); @@ -6329,6 +6361,7 @@ else if("location".equals(fieldName)) wSmartDataModel.l(" * Facet: true"); wSmartDataModel.l(" */"); wSmartDataModel.l(" protected void _ngsildTenant(Wrap w) {"); + wSmartDataModel.l(" ", Optional.ofNullable(ngsildTenantEnv).map(str -> String.format("w.o(System.getenv(\"%s\"));", str)).orElse("")); wSmartDataModel.l(" }"); cell++; wSmartDataModel.l(); @@ -6343,6 +6376,22 @@ else if("location".equals(fieldName)) wSmartDataModel.l(" * Facet: true"); wSmartDataModel.l(" */"); wSmartDataModel.l(" protected void _ngsildPath(Wrap w) {"); + wSmartDataModel.l(" ", Optional.ofNullable(ngsildCheminEnv).map(str -> String.format("w.o(System.getenv(\"%s\"));", str)).orElse("")); + wSmartDataModel.l(" }"); + cell++; + wSmartDataModel.l(); + wSmartDataModel.l(" /**"); + wSmartDataModel.l(" * {@inheritDoc}"); + wSmartDataModel.l(" * DocValues: true"); + wSmartDataModel.l(" * Persist: true"); + wSmartDataModel.l(" * DisplayName: NGSILD data"); + wSmartDataModel.l(" * Description: The NGSILD data with @context from the context broker"); + wSmartDataModel.l(" * HtmRow: ", row, ""); + wSmartDataModel.l(" * HtmCell: ", cell, ""); + wSmartDataModel.l(" * Facet: true"); + wSmartDataModel.l(" * Multiline: true"); + wSmartDataModel.l(" */"); + wSmartDataModel.l(" protected void _ngsildData(Wrap w) {"); wSmartDataModel.l(" }"); row++; cell = -1;