From 3a28d95700cf50d723b5851241ea6619ba095184 Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Fri, 1 Sep 2023 15:16:15 -0600 Subject: [PATCH] Fixing the websocket updates with the right vars in a PATCH request --- .../computate/frFR/java/EcrireApiClasse.java | 30 +-- .../computate/frFR/java/EcrireGenClasse.java | 4 +- .../computate/frFR/java/EcrirePageClasse.java | 175 ++++++++++-------- .../computate/frFR/java/IndexerClasse.java | 2 + 4 files changed, 123 insertions(+), 88 deletions(-) diff --git a/src/main/java/org/computate/frFR/java/EcrireApiClasse.java b/src/main/java/org/computate/frFR/java/EcrireApiClasse.java index 2c1c40dc..e0d53def 100644 --- a/src/main/java/org/computate/frFR/java/EcrireApiClasse.java +++ b/src/main/java/org/computate/frFR/java/EcrireApiClasse.java @@ -3053,14 +3053,8 @@ else if(StringUtils.contains(classeApiMethode, "PATCH")) { tl(8, classeLangueConfig.getString(ConfigCles.var_requeteApi), ".setOriginal(o);"); if(classeModele) tl(7, classeLangueConfig.getString(ConfigCles.var_requeteApi), ".setPk(Optional.ofNullable(", classeLangueConfig.getString(ConfigCles.var_liste), classeNomSimple, ".first()).map(o2 -> o2.getPk()).orElse(null));"); - tl(7, "eventBus.publish(\"websocket", classeNomSimple, "\", JsonObject.mapFrom(", classeLangueConfig.getString(ConfigCles.var_requeteApi), ").toString());"); +// tl(7, "eventBus.publish(\"websocket", classeNomSimple, "\", JsonObject.mapFrom(", classeLangueConfig.getString(ConfigCles.var_requeteApi), ").toString());"); tl(7, classeApiOperationIdMethode, "Future(o, false).onSuccess(o2 -> {"); - tl(8, "if(", classeLangueConfig.getString(ConfigCles.var_requeteApi), " != null) {"); - tl(9, classeLangueConfig.getString(ConfigCles.var_requeteApi), ".setNumPATCH(", classeLangueConfig.getString(ConfigCles.var_requeteApi), ".getNumPATCH() + ", classeLangueConfig.getString(ConfigCles.var_liste), classeNomSimple, ".getResponse().getResponse().getDocs().size());"); - tl(9, "if(", classeLangueConfig.getString(ConfigCles.var_requeteApi), ".getNumFound() == 1L)"); - tl(10, "o", classeSauvegarde ? "2" : "", ".", classeLangueConfig.getString(ConfigCles.var_requeteApi), classeNomSimple, "();"); - tl(9, "eventBus.publish(\"websocket", classeNomSimple, "\", JsonObject.mapFrom(", classeLangueConfig.getString(ConfigCles.var_requeteApi), ").toString());"); - tl(8, "}"); tl(8, classeLangueConfig.getString(ConfigCles.var_gestionnaireEvenements), ".handle(Future.succeededFuture(ServiceResponse.completedWithJson(Buffer.buffer(new JsonObject().encodePrettily()))));"); tl(7, "}).onFailure(ex -> {"); tl(8, classeLangueConfig.getString(ConfigCles.var_gestionnaireEvenements), ".handle(Future.failedFuture(ex));"); @@ -3262,7 +3256,7 @@ else if(!StringUtils.containsAny(classeApiMethode, "POST", "PUT")) tl(6, "sql", classeApiMethode, classeNomSimple, "(", uncapitalizeClasseNomSimple, ", inheritPk).onSuccess(b -> {"); tl(7, classeLangueConfig.getString(ConfigCles.var_definir), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(c -> {"); tl(8, classeLangueConfig.getString(ConfigCles.var_attribuer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(d -> {"); - tl(9, classeLangueConfig.getString(ConfigCles.var_indexer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(e -> {"); + tl(9, classeLangueConfig.getString(ConfigCles.var_indexer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(o2 -> {"); tl(10, "promise1.complete(", uncapitalizeClasseNomSimple, ");"); tl(9, "}).onFailure(ex -> {"); tl(10, "promise1.fail(ex);"); @@ -3315,7 +3309,7 @@ else if(!StringUtils.containsAny(classeApiMethode, "POST", "PUT")) } else { tl(3, classeLangueConfig.getString(ConfigCles.var_creer), classeNomSimple, "(", classeLangueConfig.getString(ConfigCles.var_requeteSite), ").onSuccess(", uncapitalizeClasseNomSimple, " -> {"); tl(4, classeLangueConfig.getString(ConfigCles.var_definir), classeNomSimple, "(", uncapitalizeClasseNomSimple, ", false).onSuccess(c -> {"); - tl(5, classeLangueConfig.getString(ConfigCles.var_indexer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(e -> {"); + tl(5, classeLangueConfig.getString(ConfigCles.var_indexer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(o2 -> {"); tl(6, "promise.complete(", uncapitalizeClasseNomSimple, ");"); tl(5, "}).onFailure(ex -> {"); tl(6, "promise.fail(ex);"); @@ -3349,7 +3343,7 @@ else if(classeApiMethode.equals(classeLangueConfig.getString(ConfigCles.var_PUTC tl(5, "sql", classeApiMethode, classeNomSimple, "(", uncapitalizeClasseNomSimple, ", jsonObject).onSuccess(b -> {"); tl(6, classeLangueConfig.getString(ConfigCles.var_definir), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(c -> {"); tl(7, classeLangueConfig.getString(ConfigCles.var_attribuer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(d -> {"); - tl(8, classeLangueConfig.getString(ConfigCles.var_indexer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(e -> {"); + tl(8, classeLangueConfig.getString(ConfigCles.var_indexer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(o2 -> {"); tl(9, "promise1.complete(", uncapitalizeClasseNomSimple, ");"); tl(8, "}).onFailure(ex -> {"); tl(9, "promise1.fail(ex);"); @@ -3416,7 +3410,15 @@ else if(classeApiMethode.contains("PATCH")) { tl(5, "sql", classeApiMethode, classeNomSimple, "(o, inheritPk).onSuccess(", uncapitalizeClasseNomSimple, " -> {"); tl(6, classeLangueConfig.getString(ConfigCles.var_definir), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(c -> {"); tl(7, classeLangueConfig.getString(ConfigCles.var_attribuer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(d -> {"); - tl(8, classeLangueConfig.getString(ConfigCles.var_indexer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(e -> {"); + tl(8, classeLangueConfig.getString(ConfigCles.var_indexer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(o2 -> {"); + tl(9, "if(", classeLangueConfig.getString(ConfigCles.var_requeteApi), " != null) {"); + tl(10, classeLangueConfig.getString(ConfigCles.var_requeteApi), ".setNumPATCH(", classeLangueConfig.getString(ConfigCles.var_requeteApi), ".getNumPATCH() + 1);"); + tl(10, "if(", classeLangueConfig.getString(ConfigCles.var_requeteApi), ".getNumFound() == 1L && Optional.ofNullable(", classeLangueConfig.getString(ConfigCles.var_requeteSite), ".getJsonObject()).map(json -> json.size() > 0).orElse(false)) {"); + tl(11, "o", classeSauvegarde ? "2" : "", ".", classeLangueConfig.getString(ConfigCles.var_requeteApi), classeNomSimple, "();"); + tl(11, "if(", classeLangueConfig.getString(ConfigCles.var_requeteApi), ".getVars().size() > 0)"); + tl(12, "eventBus.publish(\"websocket", classeNomSimple, "\", JsonObject.mapFrom(", classeLangueConfig.getString(ConfigCles.var_requeteApi), ").toString());"); + tl(10, "}"); + tl(9, "}"); tl(9, "promise1.complete(", uncapitalizeClasseNomSimple, ");"); tl(8, "}).onFailure(ex -> {"); tl(9, "promise1.fail(ex);"); @@ -4907,8 +4909,8 @@ public void ecrireGenApiServiceImpl3(String classeLangueNom) throws Exception { ///////////// if(classeIndexe) { l(); - tl(1, "public Future ", classeLangueConfig.getString(ConfigCles.var_indexer), classeNomSimple, "(", classeNomSimple, " o) {"); - tl(2, "Promise promise = Promise.promise();"); + tl(1, "public Future<", classeNomSimple, "> ", classeLangueConfig.getString(ConfigCles.var_indexer), classeNomSimple, "(", classeNomSimple, " o) {"); + tl(2, "Promise<", classeNomSimple, "> promise = Promise.promise();"); tl(2, "try {"); tl(3, classePartsRequeteSite.nomSimple(classeLangueNom), " ", classeLangueConfig.getString(ConfigCles.var_requeteSite), " = o.get", classeLangueConfig.getString(ConfigCles.var_RequeteSite), "_();"); tl(3, classePartsRequeteApi.nomSimple(classeLangueNom), " ", classeLangueConfig.getString(ConfigCles.var_requeteApi), " = ", classeLangueConfig.getString(ConfigCles.var_requeteSite), ".get", classeLangueConfig.getString(ConfigCles.var_RequeteApi), "_();"); @@ -4931,7 +4933,7 @@ public void ecrireGenApiServiceImpl3(String classeLangueNom) throws Exception { tl(6, "softCommit = false;"); tl(4, "String solrRequestUri = String.format(\"/solr/%s/update%s%s%s\", solrCollection, \"?overwrite=true&wt=json\", softCommit ? \"&softCommit=true\" : \"\", commitWithin != null ? (\"&commitWithin=\" + commitWithin) : \"\");"); tl(4, classeLangueConfig.getString(ConfigCles.var_clientWeb), ".post(solrPort, solrHostName, solrRequestUri).ssl(solrSsl).putHeader(\"Content-Type\", \"application/json\").expect(ResponsePredicate.SC_OK).sendBuffer(json.toBuffer()).onSuccess(b -> {"); - tl(5, "promise.complete();"); + tl(5, "promise.complete(o);"); tl(4, "}).onFailure(ex -> {"); tl(5, "LOG.error(String.format(\"", classeLangueConfig.getString(ConfigCles.var_indexer), classeNomSimple, " ", classeLangueConfig.getString(ConfigCles.str_a_échoué), ". \"), new RuntimeException(ex));"); tl(5, "promise.fail(ex);"); diff --git a/src/main/java/org/computate/frFR/java/EcrireGenClasse.java b/src/main/java/org/computate/frFR/java/EcrireGenClasse.java index 640d216a..f36419b7 100644 --- a/src/main/java/org/computate/frFR/java/EcrireGenClasse.java +++ b/src/main/java/org/computate/frFR/java/EcrireGenClasse.java @@ -1197,7 +1197,9 @@ public class EcrireGenClasse extends EcrireClasse { ToutEcrivain wFormPATCH; ToutEcrivain wJsInit; ToutEcrivain wWebsocket; - ToutEcrivain wWebsocketInput; + ToutEcrivain wWebsocketInput1; + ToutEcrivain wWebsocketInput2; + ToutEcrivain wWebsocketInput3; ToutEcrivain wPks; /** diff --git a/src/main/java/org/computate/frFR/java/EcrirePageClasse.java b/src/main/java/org/computate/frFR/java/EcrirePageClasse.java index f5fe32b7..c1e71d65 100644 --- a/src/main/java/org/computate/frFR/java/EcrirePageClasse.java +++ b/src/main/java/org/computate/frFR/java/EcrirePageClasse.java @@ -183,7 +183,11 @@ public Boolean ecrireFormEntite(String langueNom, YAMLConfiguration langueConfig if(BooleanUtils.isTrue(entiteHtmLigneVerticaleActuel)) { entiteHtmLigneVerticaleActuelMap.put(classeApiMethodeMethode, true); wForm.tl(7, ""); - wForm.tl(7, "
"); + if(entiteHtmLigneTitre == null) { + wForm.tl(7, "
"); + } else { + wForm.t(7, "
"); + } wForm.tl(8, ""); if(entiteHtmLigneTitre != null) { wForm.tl(9, ""); @@ -1072,7 +1076,9 @@ public void pageCodeClasseJava(String langueNom, YAMLConfiguration langueConfig) wJsInit = ToutEcrivain.create(); wWebsocket = ToutEcrivain.create(); - wWebsocketInput = ToutEcrivain.create(); + wWebsocketInput1 = ToutEcrivain.create(); + wWebsocketInput2 = ToutEcrivain.create(); + wWebsocketInput3 = ToutEcrivain.create(); wPks = ToutEcrivain.create(); @@ -1202,70 +1208,86 @@ public void pageCodeClasseJava(String langueNom, YAMLConfiguration langueConfig) wJsInit.tl(2, "$('#signatureInput", classeNomSimple, "' + pk + '", entiteVar, "').jSignature({'height':200}).bind('change', function(e){ patch{{", langueConfig.getString(ConfigCles.var_classeNomSimple), "}}Val([{ name: 'fq', value: '", classeModele ? classeVarClePrimaire : classeVarCleUnique, ":' + ", classeModele ? classeVarClePrimaire : classeVarCleUnique, " }], 'set", entiteVarCapitalise, "', $('#signatureInput", classeNomSimple, "' + pk + '", entiteVar, "').jSignature('getData', 'default'));"); } if(entiteDefinir || entiteAttribuer || entiteIndexeOuStocke) { - if("LocalDate".equals(entiteNomSimple)) { - wWebsocketInput.tl(4, "var val = o['", entiteVar, "'];"); -// wWebsocketInput.tl(3, "if(val != null) {"); -// wWebsocketInput.tl(4, "var t = moment(val, 'YYYY-MM-DD');"); -// wWebsocketInput.tl(4, "if(t)"); -// wWebsocketInput.tl(5, "val = t.format('", classePageLangueConfig.getString(ConfigCles.var_DDDashMMDashYYYY), "');"); -// wWebsocketInput.tl(3, "}"); - } - else if("LocalDateTime".equals(entiteNomSimple)) { - wWebsocketInput.tl(4, "var val = o['", entiteVar, "'];"); -// wWebsocketInput.tl(3, "if(val != null) {"); -// wWebsocketInput.tl(4, "var t = moment(val, 'YYYY-MM-DD');"); -// wWebsocketInput.tl(4, "if(t)"); -// wWebsocketInput.tl(5, "val = t.format('", classePageLangueConfig.getString(ConfigCles.var_DDDashMMDashYYYY), "');"); -// wWebsocketInput.tl(3, "}"); - } - else if("LocalTime".equals(entiteNomSimple)) { - wWebsocketInput.tl(4, "var val = o['", entiteVar, "'];"); -// wWebsocketInput.tl(3, "if(val != null) {"); -// wWebsocketInput.tl(4, "var t = moment(val, 'HH:mm');"); -// wWebsocketInput.tl(4, "if(t)"); -// wWebsocketInput.tl(5, "val = t.format('", classePageLangueConfig.getString(ConfigCles.var_HAposhAposmm), "');"); -// wWebsocketInput.tl(3, "}"); - } - else { - wWebsocketInput.tl(4, "var val = o['", entiteVar, "'];"); - } - wWebsocketInput.tl(4, "if(vars.includes('", entiteVar, "')) {"); - if(entiteImageBase64Url != null) { - wWebsocketInput.tl(5, "if(val === undefined)"); - wWebsocketInput.tl(6, "val = null;"); - wWebsocketInput.tl(5, "$('.img", classeNomSimple, "' + pk + '", entiteVarCapitalise, "').each(function() {"); - wWebsocketInput.tl(6, "if(val !== $(this).attr('src'))"); - wWebsocketInput.tl(7, "$(this).attr('src', val);"); - wWebsocketInput.tl(5, "});"); + wWebsocketInput3.l(); + if(entiteHtmLigneTitre != null) { + wWebsocketInput3.t(4, "$('#").sx(genererId(entiteHtmLigneTitre)).l("').each(function(index, fragment) {"); + wWebsocketInput3.t(5, "$(fragment).replaceWith($response.find(\"#").sx(genererId(entiteHtmLigneTitre)).l("\"));"); + wWebsocketInput3.tl(4, "});"); + wWebsocketInput3.l(); } - if(entiteSignature) { - wWebsocketInput.tl(5, "if(val === undefined)"); - wWebsocketInput.tl(6, "val = null;"); - wWebsocketInput.tl(5, "$('.signatureInput", classeNomSimple, "' + pk + '", entiteVarCapitalise, "').each(function() {"); - wWebsocketInput.tl(6, "if(val !== $('.signatureImg", classeNomSimple, "' + pk + '", entiteVarCapitalise, "').attr('src'))"); - wWebsocketInput.tl(7, "$('.signatureImg", classeNomSimple, "' + pk + '", entiteVarCapitalise, "').attr('src', val == null ? 'data:image/png;base64,' : val);"); - wWebsocketInput.tl(6, langueConfig.getString(ConfigCles.var_ajouterLueur), "($('.signatureInput", classeNomSimple, "' + pk + '", entiteVarCapitalise, "'));"); - wWebsocketInput.tl(5, "});"); - } - wWebsocketInput.tl(5, "$('.input", classeNomSimple, "' + pk + '", entiteVarCapitalise, "').each(function() {"); - wWebsocketInput.tl(6, "if(val !== $(this).val())"); - if(entiteNomSimple.startsWith("Json")) { - wWebsocketInput.tl(7, "$(this).val(JSON.stringify(val));"); - } else { - wWebsocketInput.tl(7, "$(this).val(val);"); - } - wWebsocketInput.tl(7, langueConfig.getString(ConfigCles.var_ajouterLueur), "($(this));"); - wWebsocketInput.tl(5, "});"); - wWebsocketInput.tl(5, "$('.var", classeNomSimple, "' + pk + '", entiteVarCapitalise, "').each(function() {"); - wWebsocketInput.tl(6, "if(val !== $(this).text())"); - if(entiteNomSimple.startsWith("Json")) { - wWebsocketInput.tl(7, "$(this).val(JSON.stringify(val));"); - } else { - wWebsocketInput.tl(7, "$(this).text(val);"); - } - wWebsocketInput.tl(7, langueConfig.getString(ConfigCles.var_ajouterLueur), "($(this));"); - wWebsocketInput.tl(5, "});"); - wWebsocketInput.tl(4, "}"); + wWebsocketInput1.tl(4, "var input", entiteVarCapitalise, " = null;"); + wWebsocketInput2.tl(4, "if(vars.includes('", entiteVar, "'))"); +// wWebsocketInput.tl(6, "if(val !== $(this).val())"); + wWebsocketInput2.tl(4, "input", entiteVarCapitalise, " = $response.find('.input", classeNomSimple, "' + pk + '", entiteVarCapitalise, "');"); + wWebsocketInput3.tl(4, "if(vars.includes('", entiteVar, "')) {"); + wWebsocketInput3.tl(5, "$('.input", classeNomSimple, "' + pk + '", entiteVarCapitalise, "').each(function(index, fragment) {"); + wWebsocketInput3.tl(6, "$(fragment).replaceWith(input", entiteVarCapitalise, ");"); + wWebsocketInput3.tl(5, "});"); + wWebsocketInput3.tl(4, "}"); +// if("LocalDate".equals(entiteNomSimple)) { +// wWebsocketInput.tl(4, "var val = o['", entiteVar, "'];"); +//// wWebsocketInput.tl(3, "if(val != null) {"); +//// wWebsocketInput.tl(4, "var t = moment(val, 'YYYY-MM-DD');"); +//// wWebsocketInput.tl(4, "if(t)"); +//// wWebsocketInput.tl(5, "val = t.format('", classePageLangueConfig.getString(ConfigCles.var_DDDashMMDashYYYY), "');"); +//// wWebsocketInput.tl(3, "}"); +// } +// else if("LocalDateTime".equals(entiteNomSimple)) { +// wWebsocketInput.tl(4, "var val = o['", entiteVar, "'];"); +//// wWebsocketInput.tl(3, "if(val != null) {"); +//// wWebsocketInput.tl(4, "var t = moment(val, 'YYYY-MM-DD');"); +//// wWebsocketInput.tl(4, "if(t)"); +//// wWebsocketInput.tl(5, "val = t.format('", classePageLangueConfig.getString(ConfigCles.var_DDDashMMDashYYYY), "');"); +//// wWebsocketInput.tl(3, "}"); +// } +// else if("LocalTime".equals(entiteNomSimple)) { +// wWebsocketInput.tl(4, "var val = o['", entiteVar, "'];"); +//// wWebsocketInput.tl(3, "if(val != null) {"); +//// wWebsocketInput.tl(4, "var t = moment(val, 'HH:mm');"); +//// wWebsocketInput.tl(4, "if(t)"); +//// wWebsocketInput.tl(5, "val = t.format('", classePageLangueConfig.getString(ConfigCles.var_HAposhAposmm), "');"); +//// wWebsocketInput.tl(3, "}"); +// } +// else { +// wWebsocketInput.tl(4, "var val = o['", entiteVar, "'];"); +// } +// wWebsocketInput.tl(4, "if(vars.includes('", entiteVar, "')) {"); +// if(entiteImageBase64Url != null) { +// wWebsocketInput.tl(5, "if(val === undefined)"); +// wWebsocketInput.tl(6, "val = null;"); +// wWebsocketInput.tl(5, "$('.img", classeNomSimple, "' + pk + '", entiteVarCapitalise, "').each(function() {"); +// wWebsocketInput.tl(6, "if(val !== $(this).attr('src'))"); +// wWebsocketInput.tl(7, "$(this).attr('src', val);"); +// wWebsocketInput.tl(5, "});"); +// } +// if(entiteSignature) { +// wWebsocketInput.tl(5, "if(val === undefined)"); +// wWebsocketInput.tl(6, "val = null;"); +// wWebsocketInput.tl(5, "$('.signatureInput", classeNomSimple, "' + pk + '", entiteVarCapitalise, "').each(function() {"); +// wWebsocketInput.tl(6, "if(val !== $('.signatureImg", classeNomSimple, "' + pk + '", entiteVarCapitalise, "').attr('src'))"); +// wWebsocketInput.tl(7, "$('.signatureImg", classeNomSimple, "' + pk + '", entiteVarCapitalise, "').attr('src', val == null ? 'data:image/png;base64,' : val);"); +// wWebsocketInput.tl(6, langueConfig.getString(ConfigCles.var_ajouterLueur), "($('.signatureInput", classeNomSimple, "' + pk + '", entiteVarCapitalise, "'));"); +// wWebsocketInput.tl(5, "});"); +// } +// wWebsocketInput.tl(5, "$('.input", classeNomSimple, "' + pk + '", entiteVarCapitalise, "').each(function() {"); +// wWebsocketInput.tl(6, "if(val !== $(this).val())"); +// if(entiteNomSimple.startsWith("Json")) { +// wWebsocketInput.tl(7, "$(this).val(JSON.stringify(val));"); +// } else { +// wWebsocketInput.tl(7, "$(this).val(val);"); +// } +// wWebsocketInput.tl(7, langueConfig.getString(ConfigCles.var_ajouterLueur), "($(this));"); +// wWebsocketInput.tl(5, "});"); +// wWebsocketInput.tl(5, "$('.var", classeNomSimple, "' + pk + '", entiteVarCapitalise, "').each(function() {"); +// wWebsocketInput.tl(6, "if(val !== $(this).text())"); +// if(entiteNomSimple.startsWith("Json")) { +// wWebsocketInput.tl(7, "$(this).val(JSON.stringify(val));"); +// } else { +// wWebsocketInput.tl(7, "$(this).text(val);"); +// } +// wWebsocketInput.tl(7, langueConfig.getString(ConfigCles.var_ajouterLueur), "($(this));"); +// wWebsocketInput.tl(5, "});"); +// wWebsocketInput.tl(4, "}"); } } rechercheSolr.setStart(i.intValue() + rechercheLignes); @@ -1279,14 +1301,21 @@ else if("LocalTime".equals(entiteNomSimple)) { wWebsocket.tl(1, "var vars = ", langueConfig.getString(ConfigCles.var_requeteApi), "['vars'];"); wWebsocket.tl(1, "var empty = ", langueConfig.getString(ConfigCles.var_requeteApi), "['empty'];"); wWebsocket.l(); - wWebsocket.tl(1, "if(pk != null) {"); - wWebsocket.tl(2, langueConfig.getString(ConfigCles.var_rechercher), classeNomSimple, "Vals([ {name: 'fq', value: '", classeModele ? classeVarClePrimaire : classeVarCleUnique, ":' + pk} ], function( data, textStatus, jQxhr ) {"); - wWebsocket.tl(3, "var o = data['list'][0];"); - wWebsocket.tl(3, "if(o != null) {"); - wWebsocket.s(wWebsocketInput); - wWebsocket.tl(3, "} else {"); - wWebsocket.tl(4, "window.location.href = '", classePageUriMethode + "';"); - wWebsocket.tl(3, "}"); + wWebsocket.tl(1, "if(pk != null && vars.length > 0) {"); + wWebsocket.tl(2, "var queryParams = \"?\" + $(\".pageSearchVal\").get().filter(elem => elem.innerText.length > 0).map(elem => elem.innerText).join(\"&\");"); + wWebsocket.tl(2, "var uri = location.pathname + queryParams;"); + wWebsocket.tl(2, "$.get(uri, {}, function(data) {"); + wWebsocket.tl(3, "var $response = $(\"\").html(data);"); +// wWebsocket.tl(2, langueConfig.getString(ConfigCles.var_rechercher), classeNomSimple, "Vals([ {name: 'fq', value: '", classeModele ? classeVarClePrimaire : classeVarCleUnique, ":' + pk} ], function( data, textStatus, jQxhr ) {"); +// wWebsocket.tl(3, "var o = data['list'][0];"); +// wWebsocket.tl(3, "if(o != null) {"); + wWebsocket.s(wWebsocketInput1); + wWebsocket.l(); + wWebsocket.s(wWebsocketInput2); + wWebsocket.s(wWebsocketInput3); +// wWebsocket.tl(3, "} else {"); +// wWebsocket.tl(4, "window.location.href = '", classePageUriMethode + "';"); +// wWebsocket.tl(3, "}"); wWebsocket.tl(2, "});"); wWebsocket.tl(1, "}"); // wWebsocket.l(); diff --git a/src/main/java/org/computate/frFR/java/IndexerClasse.java b/src/main/java/org/computate/frFR/java/IndexerClasse.java index ab1082a8..bf90ae7e 100644 --- a/src/main/java/org/computate/frFR/java/IndexerClasse.java +++ b/src/main/java/org/computate/frFR/java/IndexerClasse.java @@ -3738,6 +3738,8 @@ else if(classeEstBase) { classePartsGenAjouter(ClasseParts.initClasseParts(this, List.class.getCanonicalName(), classeLangueNom), classeLangueNom); classePartsGenAjouter(ClasseParts.initClasseParts(this, "org.apache.commons.lang3.StringUtils", classeLangueNom), classeLangueNom); classePartsGenAjouter(ClasseParts.initClasseParts(this, "java.util.Objects", classeLangueNom), classeLangueNom); + classePartsGenAjouter(ClasseParts.initClasseParts(this, "java.util.regex.Matcher", classeLangueNom), classeLangueNom); + classePartsGenAjouter(ClasseParts.initClasseParts(this, "java.util.regex.Pattern", classeLangueNom), classeLangueNom); classePartsGenAjouter(ClasseParts.initClasseParts(this, "com.fasterxml.jackson.annotation.JsonProperty", classeLangueNom), classeLangueNom); classePartsGenAjouter(ClasseParts.initClasseParts(this, "com.fasterxml.jackson.annotation.JsonIgnore", classeLangueNom), classeLangueNom); classePartsGenAjouter(ClasseParts.initClasseParts(this, JsonFormat.class.getCanonicalName(), classeLangueNom), classeLangueNom);