Skip to content

Commit 57f31b8

Browse files
committed
Fixed bug with DELETE requests
1 parent b0352c3 commit 57f31b8

File tree

5 files changed

+71
-60
lines changed

5 files changed

+71
-60
lines changed

src/main/java/org/computate/frFR/java/EcrireApiClasse.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2808,11 +2808,11 @@ else if(StringUtils.containsAny(classeApiMethode, i18nGlobale.getString(I18n.var
28082808
tl(4, i18nGlobale.getString(I18n.var_requeteApi), ".", i18nGlobale.getString(I18n.var_initLoin), classePartsRequeteApi.nomSimple(classeLangueNom), "(", i18nGlobale.getString(I18n.var_requeteSite), ");");
28092809
tl(4, i18nGlobale.getString(I18n.var_requeteSite), ".set", i18nGlobale.getString(I18n.var_RequeteApi), "_(", i18nGlobale.getString(I18n.var_requeteApi), ");");
28102810
tl(4, "String ", classeVarInheritClePrimaire, " = Optional.ofNullable(body.getString(", classeNomSimple, ".VAR_", classeVarId, ")).orElse(body.getString(", classeNomSimple, ".VAR_", classeVarCleUnique, "));");
2811-
if(classeApiMethode.equals(i18nGlobale.getString(I18n.var_PUTFusion)) || classeApiMethode.equals("PUTImport")) {
2812-
tl(4, "body.put(\"", classeVarInheritClePrimaire, "\", ", classeVarInheritClePrimaire, ");");
2813-
if(!classeModele)
2814-
tl(4, "body.put(\"", classeVarInheritClePrimaire, "\", body.getValue(\"", classeVarCleUnique, "\"));");
2815-
}
2811+
// if(classeApiMethode.equals(i18nGlobale.getString(I18n.var_PUTFusion)) || classeApiMethode.equals("PUTImport")) {
2812+
// tl(4, "body.put(\"", classeVarInheritClePrimaire, "\", ", classeVarInheritClePrimaire, ");");
2813+
// if(!classeModele)
2814+
// tl(4, "body.put(\"", classeVarInheritClePrimaire, "\", body.getValue(\"", classeVarCleUnique, "\"));");
2815+
// }
28162816
tl(4, "if(Optional.ofNullable(", i18nGlobale.getString(I18n.var_requeteService), ".getParams()).map(p -> p.getJsonObject(\"query\")).map( q -> q.getJsonArray(\"var\")).orElse(new JsonArray()).stream().filter(s -> \"", i18nGlobale.getString(I18n.var_recharger), ":false\".equals(s)).count() > 0L) {");
28172817
tl(5, i18nGlobale.getString(I18n.var_requeteSite), ".get", i18nGlobale.getString(I18n.var_Requete), "Vars().put( \"", i18nGlobale.getString(I18n.var_recharger), "\", \"false\" );");
28182818
tl(4, "}");
@@ -4200,7 +4200,7 @@ public void ecrireGenApiServiceImpl3(String classeLangueNom) throws Exception {
42004200
tl(3, "String statsField2 = statsField;");
42014201
tl(3, "String statsFieldIndexed2 = statsFieldIndexed;");
42024202
tl(3, i18nGlobale.getString(I18n.var_rechercher), classeNomSimple, "2(", i18nGlobale.getString(I18n.var_requeteSite), ", ", i18nGlobale.getString(I18n.var_peupler), ", ", i18nGlobale.getString(I18n.var_stocker), ", ", i18nGlobale.getString(I18n.var_modifier), ", ", i18nGlobale.getString(I18n.var_listeRecherche), ");");
4203-
tl(3, i18nGlobale.getString(I18n.var_listeRecherche), ".", i18nGlobale.getString(I18n.var_promesseLoin), i18nGlobale.getString(I18n.var_PourClasse), "(", i18nGlobale.getString(I18n.var_requeteSite), ").onSuccess(a -> {");
4203+
tl(3, i18nGlobale.getString(I18n.var_listeRecherche), ".", i18nGlobale.getString(I18n.var_promesseLoin), i18nGlobale.getString(I18n.var_PourClasse), "(", i18nGlobale.getString(I18n.var_requeteSite), ").onSuccess(", i18nGlobale.getString(I18n.var_listeRecherche), "2 -> {");
42044204
tl(4, "if(facetRange2 != null && statsField2 != null && facetRange2.equals(statsField2)) {");
42054205
tl(5, "StatsField stats = ", i18nGlobale.getString(I18n.var_listeRecherche), ".getResponse().getStats().getStatsFields().get(statsFieldIndexed2);");
42064206
tl(5, "Instant min = Optional.ofNullable(stats.getMin()).map(val -> Instant.parse(val.toString())).orElse(Instant.now());");
@@ -4448,7 +4448,7 @@ public void ecrireGenApiServiceImpl3(String classeLangueNom) throws Exception {
44484448
tl(4, "JsonObject json = new JsonObject();");
44494449
tl(4, "JsonObject delete = new JsonObject();");
44504450
tl(4, "json.put(\"delete\", delete);");
4451-
tl(4, "String query = String.format(\"filter(", classeVarIdSuffixeSolr, ":%s)\", o.", i18nGlobale.getString(I18n.var_obtenir), i18nGlobale.getString(I18n.var_PourClasse), "(\"", classeVarId, "\"));");
4451+
tl(4, "String query = String.format(\"filter(", classeVarId, classeVarIdSuffixeSolr, ":%s)\", o.", i18nGlobale.getString(I18n.var_obtenir), i18nGlobale.getString(I18n.var_PourClasse), "(\"", classeVarId, "\"));");
44524452
tl(4, "delete.put(\"query\", query);");
44534453
tl(4, "String solrUsername = ", i18nGlobale.getString(I18n.var_requeteSite), ".getConfig().getString(", classePartsConfigCles.nomSimple(classeLangueNom), ".SOLR_USERNAME);");
44544454
tl(4, "String solrPassword = ", i18nGlobale.getString(I18n.var_requeteSite), ".getConfig().getString(", classePartsConfigCles.nomSimple(classeLangueNom), ".SOLR_PASSWORD);");

src/main/java/org/computate/frFR/java/EcrireGenClasse.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ public class EcrireGenClasse extends EcrireClasse {
147147
* Var.enUS: classSuperSimpleName
148148
*/
149149
protected String classeNomSimpleSuper;
150+
protected String classeNomSimpleBaseGenLangue;
150151

151152
/**
152153
* Var.enUS: classSuperSimpleNameGeneric
@@ -1426,7 +1427,7 @@ public void genCodeInitLoin(String langueNom, JsonObject langueConfig) throws Ex
14261427

14271428
wInitLoin.l();
14281429
if(classePromesse) {
1429-
wInitLoin.tl(1, "public Future<Void> ", langueConfig.getString(I18n.var_promesseLoin), classeNomSimple, "(", classePartsRequeteSite.getEtendBase() ? classePartsRequeteSite.getNomSimpleSuperGenerique() : classePartsRequeteSite.nomSimple(langueNom), " ", langueConfig.getString(I18n.var_requeteSite), "_) {");
1430+
wInitLoin.tl(1, "public Future<", classeNomSimpleSuper, "<DEV>> ", langueConfig.getString(I18n.var_promesseLoin), classeNomSimple, "(", classePartsRequeteSite.getEtendBase() ? classePartsRequeteSite.getNomSimpleSuperGenerique() : classePartsRequeteSite.nomSimple(langueNom), " ", langueConfig.getString(I18n.var_requeteSite), "_) {");
14301431
if(classeContientRequeteSite)
14311432
wInitLoin.tl(2, "set", langueConfig.getString(I18n.var_RequeteSite), "_(", langueConfig.getString(I18n.var_requeteSite), "_);");
14321433
wInitLoin.tl(2, "return ", langueConfig.getString(I18n.var_promesseLoin), classeNomSimple, "();");
@@ -1455,34 +1456,34 @@ public void genCodeInitLoin(String langueNom, JsonObject langueConfig) throws Ex
14551456

14561457
if(classePromesse) {
14571458
wInitLoin.l();
1458-
wInitLoin.tl(1, "public Future<Void> ", langueConfig.getString(I18n.var_promesseLoin), classeNomSimple, "() {");
1459-
wInitLoin.tl(2, "Promise<Void> promise = Promise.promise();");
1459+
wInitLoin.tl(1, "public Future<", classeNomSimpleSuper, "<DEV>> ", langueConfig.getString(I18n.var_promesseLoin), classeNomSimple, "() {");
1460+
wInitLoin.tl(2, "Promise<", classeNomSimpleSuper, "<DEV>> promise = Promise.promise();");
14601461
if(classeInitLoinAvant) {
14611462
if(BooleanUtils.isTrue(classeEtendBase)) {
14621463
wInitLoin.tl(2, "super.", langueConfig.getString(I18n.var_promesseLoin), classeNomSimpleSuperGenerique, "(", langueConfig.getString(I18n.var_requeteSite), "_).onSuccess(a -> {");
14631464
wInitLoin.tl(3, "Promise<Void> promise2 = Promise.promise();");
14641465
wInitLoin.tl(3, langueConfig.getString(I18n.var_promesse), classeNomSimple, "(promise2);");
14651466
wInitLoin.tl(3, "promise2.future().onSuccess(b -> {");
1466-
wInitLoin.tl(4, "promise.complete();");
1467+
wInitLoin.tl(4, "promise.complete(this);");
14671468
wInitLoin.tl(3, "}).onFailure(ex -> {");
14681469
wInitLoin.tl(4, "promise.fail(ex);");
14691470
wInitLoin.tl(3, "});");
14701471
} else {
14711472
wInitLoin.tl(2, "promise2.future().onSuccess(a -> {");
1472-
wInitLoin.tl(3, "promise.complete();");
1473+
wInitLoin.tl(3, "promise.complete(this);");
14731474
}
14741475
} else {
14751476
wInitLoin.tl(2, "Promise<Void> promise2 = Promise.promise();");
14761477
wInitLoin.tl(2, langueConfig.getString(I18n.var_promesse), classeNomSimple, "(promise2);");
14771478
wInitLoin.tl(2, "promise2.future().onSuccess(a -> {");
14781479
if(BooleanUtils.isTrue(classeEtendBase)) {
14791480
wInitLoin.tl(3, "super.", langueConfig.getString(I18n.var_promesseLoin), classeNomSimpleSuperGenerique, "(", langueConfig.getString(I18n.var_requeteSite), "_).onSuccess(b -> {");
1480-
wInitLoin.tl(4, "promise.complete();");
1481+
wInitLoin.tl(4, "promise.complete(this);");
14811482
wInitLoin.tl(3, "}).onFailure(ex -> {");
14821483
wInitLoin.tl(4, "promise.fail(ex);");
14831484
wInitLoin.tl(3, "});");
14841485
} else {
1485-
wInitLoin.tl(3, "promise.complete();");
1486+
wInitLoin.tl(3, "promise.complete(this);");
14861487
}
14871488
}
14881489
wInitLoin.tl(2, "}).onFailure(ex -> {");
@@ -5643,7 +5644,7 @@ public void genCodeClasseFin(String langueNom, JsonObject langueConfig) throws E
56435644
if(classeEtendBase)
56445645
wInitLoin.s("@Override ");
56455646
if(classePromesse) {
5646-
wInitLoin.l("public Future<Void> ", langueConfig.getString(I18n.var_promesseLoin), langueConfig.getString(I18n.var_PourClasse), "(", classePartsRequeteSite.getEtendBase() ? classePartsRequeteSite.getNomSimpleSuperGenerique() : classePartsRequeteSite.nomSimple(langueNom), " ", langueConfig.getString(I18n.var_requeteSite), "_) {");
5647+
wInitLoin.l("public Future<? extends ", classeNomSimpleSuper, "<DEV>> ", langueConfig.getString(I18n.var_promesseLoin), langueConfig.getString(I18n.var_PourClasse), "(", classePartsRequeteSite.getEtendBase() ? classePartsRequeteSite.getNomSimpleSuperGenerique() : classePartsRequeteSite.nomSimple(langueNom), " ", langueConfig.getString(I18n.var_requeteSite), "_) {");
56475648
wInitLoin.tl(2, "return ", langueConfig.getString(I18n.var_promesseLoin), classeNomSimple, "(", langueConfig.getString(I18n.var_requeteSite), "_);");
56485649
wInitLoin.tl(1, "}");
56495650
} else {

0 commit comments

Comments
 (0)