@@ -802,6 +802,23 @@ else if(VAL_nomCanoniqueInteger.equals(entiteNomCanoniqueGenerique)) {
802
802
//
803
803
// Integer tBase = 3;
804
804
805
+ ///////////////////
806
+ // wApiSqlSelect //
807
+ ///////////////////
808
+ if (classeSauvegarde && BooleanUtils .isTrue (entiteAttribuer )) {
809
+ if (!wApiSqlSelect .getEmpty ())
810
+ wApiSqlSelect .s (", " );
811
+ wApiSqlSelect .s (entiteVar );
812
+ } else if (classeSauvegarde && BooleanUtils .isTrue (entiteDefinir )) {
813
+ if (!wApiSqlSelect .getEmpty ())
814
+ wApiSqlSelect .s (", " );
815
+ if (VAL_nomCanoniquePolygon .equals (entiteNomCanoniqueGenerique ))
816
+ wApiSqlSelect .s ("ST_AsGeoJSON(" , entiteVar , ") as " , entiteVar );
817
+ else
818
+ wApiSqlSelect .s (entiteVar );
819
+ }
820
+
821
+
805
822
////////////////////////
806
823
// codeApiGenererPost //
807
824
////////////////////////
@@ -1845,7 +1862,10 @@ else if(BooleanUtils.isTrue(entiteDefinir)) {
1845
1862
tl (7 , "o2.set" , entiteVarCapitalise , "(jsonObject.get" , entiteNomSimpleVertxJson , "(" , i18nGlobale .getString (I18n .var_entite ), "Var));" );
1846
1863
tl (7 , "if(bParams.size() > 0)" );
1847
1864
tl (8 , "bSql.append(\" , \" );" );
1848
- tl (7 , "bSql.append(" , classeNomSimple , ".VAR_" , entiteVar , " + \" =$\" + num);" );
1865
+ if (VAL_nomCanoniquePolygon .equals (entiteNomCanoniqueGenerique ))
1866
+ tl (7 , "bSql.append(String.format(\" %s=ST_GeomFromGeoJSON($%s)\" , " , classeNomSimple , ".VAR_" , entiteVar , ", num));" );
1867
+ else
1868
+ tl (7 , "bSql.append(" , classeNomSimple , ".VAR_" , entiteVar , " + \" =$\" + num);" );
1849
1869
tl (7 , "num++;" );
1850
1870
tl (7 , "bParams.add(o2.sql" , entiteVarCapitalise , "());" );
1851
1871
tl (6 , "break;" );
@@ -4590,7 +4610,7 @@ public void ecrireGenApiServiceImpl4(String classeLangueNom) throws Exception {
4590
4610
tl (3 , classePartsRequeteSite .nomSimple (classeLangueNom ), " " , i18nGlobale .getString (I18n .var_requeteSite ), " = o.get" , i18nGlobale .getString (I18n .var_RequeteSite ), "_();" );
4591
4611
tl (3 , "SqlConnection " , i18nGlobale .getString (I18n .var_connexionSql ), " = " , i18nGlobale .getString (I18n .var_requeteSite ), ".get" , i18nGlobale .getString (I18n .var_ConnexionSql ), "();" );
4592
4612
tl (3 , "Long " , classeVarClePrimaire , " = o.get" , StringUtils .capitalize (classeVarClePrimaire ), "();" );
4593
- tl (3 , i18nGlobale .getString (I18n .var_connexionSql ), ".preparedQuery(\" SELECT * FROM " , classeNomSimple , " WHERE " , classeVarClePrimaire , "=$1\" )" );
4613
+ tl (3 , i18nGlobale .getString (I18n .var_connexionSql ), ".preparedQuery(\" SELECT " , wApiSqlSelect , " FROM " , classeNomSimple , " WHERE " , classeVarClePrimaire , "=$1\" )" );
4594
4614
tl (5 , ".collecting(Collectors.toList())" );
4595
4615
tl (5 , ".execute(Tuple.of(" , classeVarClePrimaire , ")" );
4596
4616
tl (5 , ").onSuccess(" , i18nGlobale .getString (I18n .var_resultat ), " -> {" );
@@ -4722,17 +4742,19 @@ public void ecrireGenApiServiceImpl4(String classeLangueNom) throws Exception {
4722
4742
tl (5 , "if(value != null) {" );
4723
4743
tl (6 , "Object ngsildVal = " , classeNomSimple , ".ngsi" , classeNomSimple , "(var, o);" );
4724
4744
tl (6 , "String ngsildType = " , classeNomSimple , ".ngsiType(var);" );
4725
- tl (6 , "entityBody.put(displayName" );
4726
- tl (8 , ", new JsonObject()" );
4727
- tl (8 , ".put(\" type\" , ngsildType)" );
4728
- tl (8 , ".put(\" value\" , ngsildVal)" );
4729
- tl (8 , ".put(\" observedAt\" , observedAtStr)" );
4730
- tl (8 , ");" );
4745
+ tl (6 , "if(ngsildVal != null) {" );
4746
+ tl (7 , "entityBody.put(displayName" );
4747
+ tl (9 , ", new JsonObject()" );
4748
+ tl (9 , ".put(\" type\" , ngsildType)" );
4749
+ tl (9 , ".put(\" value\" , ngsildVal)" );
4750
+ tl (9 , ".put(\" observedAt\" , observedAtStr)" );
4751
+ tl (9 , ");" );
4752
+ tl (6 , "}" );
4731
4753
tl (5 , "}" );
4732
4754
tl (4 , "}" );
4733
4755
tl (3 , "}" );
4734
4756
tl (3 , "entityArray.add(entityBody);" );
4735
- tl (3 , "LOG.info (entityArray.encodePrettily());" );
4757
+ tl (3 , "LOG.debug (entityArray.encodePrettily());" );
4736
4758
tl (3 , "webClient.post(" );
4737
4759
tl (5 , "Integer.parseInt(config.getString(ComputateConfigKeys.CONTEXT_BROKER_PORT))" );
4738
4760
tl (5 , ", config.getString(ComputateConfigKeys.CONTEXT_BROKER_HOST_NAME)" );
0 commit comments