@@ -802,6 +802,23 @@ else if(VAL_nomCanoniqueInteger.equals(entiteNomCanoniqueGenerique)) {
802802//
803803// Integer tBase = 3;
804804
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+
805822 ////////////////////////
806823 // codeApiGenererPost //
807824 ////////////////////////
@@ -1845,7 +1862,10 @@ else if(BooleanUtils.isTrue(entiteDefinir)) {
18451862 tl (7 , "o2.set" , entiteVarCapitalise , "(jsonObject.get" , entiteNomSimpleVertxJson , "(" , i18nGlobale .getString (I18n .var_entite ), "Var));" );
18461863 tl (7 , "if(bParams.size() > 0)" );
18471864 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);" );
18491869 tl (7 , "num++;" );
18501870 tl (7 , "bParams.add(o2.sql" , entiteVarCapitalise , "());" );
18511871 tl (6 , "break;" );
@@ -4590,7 +4610,7 @@ public void ecrireGenApiServiceImpl4(String classeLangueNom) throws Exception {
45904610 tl (3 , classePartsRequeteSite .nomSimple (classeLangueNom ), " " , i18nGlobale .getString (I18n .var_requeteSite ), " = o.get" , i18nGlobale .getString (I18n .var_RequeteSite ), "_();" );
45914611 tl (3 , "SqlConnection " , i18nGlobale .getString (I18n .var_connexionSql ), " = " , i18nGlobale .getString (I18n .var_requeteSite ), ".get" , i18nGlobale .getString (I18n .var_ConnexionSql ), "();" );
45924612 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\" )" );
45944614 tl (5 , ".collecting(Collectors.toList())" );
45954615 tl (5 , ".execute(Tuple.of(" , classeVarClePrimaire , ")" );
45964616 tl (5 , ").onSuccess(" , i18nGlobale .getString (I18n .var_resultat ), " -> {" );
@@ -4722,17 +4742,19 @@ public void ecrireGenApiServiceImpl4(String classeLangueNom) throws Exception {
47224742 tl (5 , "if(value != null) {" );
47234743 tl (6 , "Object ngsildVal = " , classeNomSimple , ".ngsi" , classeNomSimple , "(var, o);" );
47244744 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 , "}" );
47314753 tl (5 , "}" );
47324754 tl (4 , "}" );
47334755 tl (3 , "}" );
47344756 tl (3 , "entityArray.add(entityBody);" );
4735- tl (3 , "LOG.info (entityArray.encodePrettily());" );
4757+ tl (3 , "LOG.debug (entityArray.encodePrettily());" );
47364758 tl (3 , "webClient.post(" );
47374759 tl (5 , "Integer.parseInt(config.getString(ComputateConfigKeys.CONTEXT_BROKER_PORT))" );
47384760 tl (5 , ", config.getString(ComputateConfigKeys.CONTEXT_BROKER_HOST_NAME)" );
0 commit comments