Skip to content

Commit

Permalink
Adding the call to promiseDeep for models from index to persist
Browse files Browse the repository at this point in the history
  • Loading branch information
computate committed Sep 24, 2024
1 parent 4fc190e commit 660ae53
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 37 deletions.
57 changes: 28 additions & 29 deletions src/main/java/org/computate/frFR/java/EcrireApiClasse.java
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,6 @@ else if(VAL_nomCanoniqueInteger.equals(entiteNomCanoniqueGenerique)) {
tl(10, "pks.add(pk2);");
tl(10, "classes.add(\"", entiteAttribuerNomSimple, "\");");
tl(9, "}");
//STUFF2
tl(9, "sql(", i18nGlobale.getString(I18n.var_requeteSite), ").deleteFrom(", classeNomSimple, ".class, ", classeNomSimple, ".VAR_", entiteVar, ", ", entiteAttribuerNomSimple, ".class, ", entiteAttribuerNomSimple, ".VAR_", entiteAttribuerVar, ").relateValues(pk, pk2).onSuccess(a -> {");
tl(10, "promise2.complete();");
tl(9, "}).onFailure(ex -> {");
Expand Down Expand Up @@ -4292,7 +4291,12 @@ public void ecrireGenApiServiceImpl3(String classeLangueNom) throws Exception {
tl(7, "}");
tl(6, "}");
tl(5, "}");
tl(5, "promise.complete();");
tl(5, "o.", i18nGlobale.getString(I18n.var_promesseLoin), i18nGlobale.getString(I18n.var_PourClasse), "(", i18nGlobale.getString(I18n.var_requeteSite), ").onSuccess(a -> {");
tl(6, "promise.complete();");
tl(5, "}).onFailure(ex -> {");
tl(6, "LOG.error(String.format(\"", i18nGlobale.getString(I18n.var_definir), classeNomSimple, " ", i18nGlobale.getString(I18n.str_a_échoué), ". \"), ex);");
tl(6, "promise.fail(ex);");
tl(5, "});");
tl(4, "} catch(Exception ex) {");
tl(5, "LOG.error(String.format(\"", i18nGlobale.getString(I18n.var_definir), classeNomSimple, " ", i18nGlobale.getString(I18n.str_a_échoué), ". \"), ex);");
tl(5, "promise.fail(ex);");
Expand Down Expand Up @@ -4402,34 +4406,29 @@ public void ecrireGenApiServiceImpl3(String classeLangueNom) throws Exception {
tl(2, "try {");
tl(3, classePartsRequeteSite.nomSimple(classeLangueNom), " ", i18nGlobale.getString(I18n.var_requeteSite), " = o.get", i18nGlobale.getString(I18n.var_RequeteSite), "_();");
tl(3, classePartsRequeteApi.nomSimple(classeLangueNom), " ", i18nGlobale.getString(I18n.var_requeteApi), " = ", i18nGlobale.getString(I18n.var_requeteSite), ".get", i18nGlobale.getString(I18n.var_RequeteApi), "_();");
tl(3, "o.", i18nGlobale.getString(I18n.var_promesseLoin), i18nGlobale.getString(I18n.var_PourClasse), "(", i18nGlobale.getString(I18n.var_requeteSite), ").onSuccess(a -> {");
tl(4, "JsonObject json = new JsonObject();");
tl(4, "JsonObject add = new JsonObject();");
tl(4, "json.put(\"add\", add);");
tl(4, "JsonObject doc = new JsonObject();");
tl(4, "add.put(\"doc\", doc);");
tl(4, "o.", i18nGlobale.getString(I18n.var_indexer), classeNomSimple, "(doc);");
tl(4, "String solrUsername = ", i18nGlobale.getString(I18n.var_requeteSite), ".getConfig().getString(", classePartsConfigCles.nomSimple(classeLangueNom), ".SOLR_USERNAME);");
tl(4, "String solrPassword = ", i18nGlobale.getString(I18n.var_requeteSite), ".getConfig().getString(", classePartsConfigCles.nomSimple(classeLangueNom), ".SOLR_PASSWORD);");
tl(4, "String solrHostName = ", i18nGlobale.getString(I18n.var_requeteSite), ".getConfig().getString(", classePartsConfigCles.nomSimple(classeLangueNom), ".SOLR_HOST_NAME);");
tl(4, "Integer solrPort = ", i18nGlobale.getString(I18n.var_requeteSite), ".getConfig().getInteger(", classePartsConfigCles.nomSimple(classeLangueNom), ".SOLR_PORT);");
tl(4, "String solrCollection = ", i18nGlobale.getString(I18n.var_requeteSite), ".getConfig().getString(", classePartsConfigCles.nomSimple(classeLangueNom), ".SOLR_COLLECTION);");
tl(4, "Boolean solrSsl = ", i18nGlobale.getString(I18n.var_requeteSite), ".getConfig().getBoolean(", classePartsConfigCles.nomSimple(classeLangueNom), ".SOLR_SSL);");
tl(4, "Boolean softCommit = Optional.ofNullable(", i18nGlobale.getString(I18n.var_requeteSite), ".get", i18nGlobale.getString(I18n.var_RequeteService), "().getParams()).map(p -> p.getJsonObject(\"query\")).map( q -> q.getBoolean(\"softCommit\")).orElse(null);");
tl(4, "Integer commitWithin = Optional.ofNullable(", i18nGlobale.getString(I18n.var_requeteSite), ".get", i18nGlobale.getString(I18n.var_RequeteService), "().getParams()).map(p -> p.getJsonObject(\"query\")).map( q -> q.getInteger(\"commitWithin\")).orElse(null);");
tl(5, "if(softCommit == null && commitWithin == null)");
tl(6, "softCommit = true;");
tl(5, "else if(softCommit == null)");
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, i18nGlobale.getString(I18n.var_clientWeb), ".post(solrPort, solrHostName, solrRequestUri).ssl(solrSsl).authentication(new UsernamePasswordCredentials(solrUsername, solrPassword)).putHeader(\"Content-Type\", \"application/json\").expect(ResponsePredicate.SC_OK).sendBuffer(json.toBuffer()).onSuccess(b -> {");
tl(5, "promise.complete(o);");
tl(4, "}).onFailure(ex -> {");
tl(5, "LOG.error(String.format(\"", i18nGlobale.getString(I18n.var_indexer), classeNomSimple, " ", i18nGlobale.getString(I18n.str_a_échoué), ". \"), new RuntimeException(ex));");
tl(5, "promise.fail(ex);");
tl(4, "});");
tl(3, "JsonObject json = new JsonObject();");
tl(3, "JsonObject add = new JsonObject();");
tl(3, "json.put(\"add\", add);");
tl(3, "JsonObject doc = new JsonObject();");
tl(3, "add.put(\"doc\", doc);");
tl(3, "o.", i18nGlobale.getString(I18n.var_indexer), classeNomSimple, "(doc);");
tl(3, "String solrUsername = ", i18nGlobale.getString(I18n.var_requeteSite), ".getConfig().getString(", classePartsConfigCles.nomSimple(classeLangueNom), ".SOLR_USERNAME);");
tl(3, "String solrPassword = ", i18nGlobale.getString(I18n.var_requeteSite), ".getConfig().getString(", classePartsConfigCles.nomSimple(classeLangueNom), ".SOLR_PASSWORD);");
tl(3, "String solrHostName = ", i18nGlobale.getString(I18n.var_requeteSite), ".getConfig().getString(", classePartsConfigCles.nomSimple(classeLangueNom), ".SOLR_HOST_NAME);");
tl(3, "Integer solrPort = ", i18nGlobale.getString(I18n.var_requeteSite), ".getConfig().getInteger(", classePartsConfigCles.nomSimple(classeLangueNom), ".SOLR_PORT);");
tl(3, "String solrCollection = ", i18nGlobale.getString(I18n.var_requeteSite), ".getConfig().getString(", classePartsConfigCles.nomSimple(classeLangueNom), ".SOLR_COLLECTION);");
tl(3, "Boolean solrSsl = ", i18nGlobale.getString(I18n.var_requeteSite), ".getConfig().getBoolean(", classePartsConfigCles.nomSimple(classeLangueNom), ".SOLR_SSL);");
tl(3, "Boolean softCommit = Optional.ofNullable(", i18nGlobale.getString(I18n.var_requeteSite), ".get", i18nGlobale.getString(I18n.var_RequeteService), "().getParams()).map(p -> p.getJsonObject(\"query\")).map( q -> q.getBoolean(\"softCommit\")).orElse(null);");
tl(3, "Integer commitWithin = Optional.ofNullable(", i18nGlobale.getString(I18n.var_requeteSite), ".get", i18nGlobale.getString(I18n.var_RequeteService), "().getParams()).map(p -> p.getJsonObject(\"query\")).map( q -> q.getInteger(\"commitWithin\")).orElse(null);");
tl(4, "if(softCommit == null && commitWithin == null)");
tl(5, "softCommit = true;");
tl(4, "else if(softCommit == null)");
tl(5, "softCommit = false;");
tl(3, "String solrRequestUri = String.format(\"/solr/%s/update%s%s%s\", solrCollection, \"?overwrite=true&wt=json\", softCommit ? \"&softCommit=true\" : \"\", commitWithin != null ? (\"&commitWithin=\" + commitWithin) : \"\");");
tl(3, i18nGlobale.getString(I18n.var_clientWeb), ".post(solrPort, solrHostName, solrRequestUri).ssl(solrSsl).authentication(new UsernamePasswordCredentials(solrUsername, solrPassword)).putHeader(\"Content-Type\", \"application/json\").expect(ResponsePredicate.SC_OK).sendBuffer(json.toBuffer()).onSuccess(b -> {");
tl(4, "promise.complete(o);");
tl(3, "}).onFailure(ex -> {");
tl(4, "LOG.error(String.format(\"", i18nGlobale.getString(I18n.var_indexer), classeNomSimple, " ", i18nGlobale.getString(I18n.str_a_échoué), ". \"), ex);");
tl(4, "LOG.error(String.format(\"", i18nGlobale.getString(I18n.var_indexer), classeNomSimple, " ", i18nGlobale.getString(I18n.str_a_échoué), ". \"), new RuntimeException(ex));");
tl(4, "promise.fail(ex);");
tl(3, "});");
tl(2, "} catch(Exception ex) {");
Expand Down
14 changes: 8 additions & 6 deletions src/main/java/org/computate/frFR/java/EcrirePageClasse.java
Original file line number Diff line number Diff line change
Expand Up @@ -4072,24 +4072,26 @@ else if(classeApiMethode.contains(i18nPage.getString(I18n.var_PUTCopie)))
s(" id=\"pageSearchVal-buttonFacet", classeNomSimple, "_{{ key }}\"");
l(">{% if value.facetField.var is defined %}facet.field={{ value.facetField.var }}{% endif %}</div>");

t(10, "<ol");
t(10, "<div");
s(" class=\"pageFacetField pageFacetField", classeNomSimple, "_{{ key }} \"");
s(" id=\"pageFacetField", classeNomSimple, "_{{ key }}\"");
l(">");
tl(0, "{% for facetFieldKey, facetFieldValue in value.facetField.counts.items() %}");
t(11, "<li");
t(11, "<sl-tooltip content=\"", String.format(i18nPage.getString(I18n.str_au_total_avec_), "{{ facetFieldValue | e }}", classeNomSingulier, "{{ value.facetField.var | e }}", "{{ facetFieldKey | e }}"), "\">");
t(12, "<div");
s(" class=\"cursor-pointer \"");
s(" data-class=\"", classeNomSimple, "\"");
s(" data-var=\"{{ value.facetField.var }}\"");
s(" data-val=\"{{ facetFieldKey }}\"");
s(" onclick=\"fqReplace('", classeNomSimple, "', facetFieldValue); \"");
s(">");
s("{{ facetFieldKey }}");
s(": ");
s("{{ facetFieldValue }}");
l("</li>");
s(": ");
s("{{ facetFieldKey }}");
l("</div>");
t(11, "</sl-tooltip>");
tl(0, "{% endfor %}");
tl(10, "</ol>");
tl(10, "</div>");

tl(9, "</div>");
tl(8, "{% endfor %}");
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/computate/frFR/java/I18n.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class I18n {
public static final String str_Afficher_les_resultats_sous_forme_de_cartes = "str_Afficher_les_resultats_sous_forme_de_cartes";
public static final String str_Afficher_les_resultats_sous_forme_de_details = "str_Afficher_les_resultats_sous_forme_de_details";
public static final String str_API = "str_API";
public static final String str_au_total_avec_ = "str_au_total_avec_";
public static final String str_chemin_absolu = "str_chemin_absolu";
public static final String str_chemin_absolu_url = "str_chemin_absolu_url";
public static final String str_confirmer_supprimer = "str_confirmer_supprimer";
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/org/computate/i18n/i18n_enUS.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ str_Afficher_les_resultats_sous_forme_de_liste: "Show the results as a list"
str_Afficher_les_resultats_sous_forme_de_cartes: "Show the results as cards"
str_Afficher_les_resultats_sous_forme_de_details: "Show the results as details"
str_API: "API"
str_au_total_avec_: '%s %s total with %s &quot;%s&quot;'
str_chemin_absolu: "%s touched"
str_chemin_absolu_url: "%s/java-class/%s"
str_créé_nouveau: "created new"
Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/org/computate/i18n/i18n_frFR.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
str_confirmer_supprimer: "Voulez-vous vraiment supprimer cela ?"
str_confirmer_archiver: "Voulez-vous vraiment archiver cela ?"
str_a_démarré: "a démarré"
str_a_échoué: "a échoué"
str_a_réussi: "a réussi"
Expand All @@ -12,8 +10,11 @@ str_Afficher_les_resultats_sous_forme_de_liste: "Afficher les résultats sous fo
str_Afficher_les_resultats_sous_forme_de_cartes: "Afficher les résultats sous forme de cartes"
str_Afficher_les_resultats_sous_forme_de_details: "Afficher les résultats sous forme de détails"
str_API: "API"
str_au_total_avec_: '%s %s total avec %s « %s »'
str_chemin_absolu: "%s touché"
str_chemin_absolu_url: "%s/classe-java/%s"
str_confirmer_supprimer: "Voulez-vous vraiment supprimer cela ?"
str_confirmer_archiver: "Voulez-vous vraiment archiver cela ?"
str_créé_nouveau: "créé nouveau"
str_Creer: "Créer"
str_Creer_: "Créer "
Expand Down

0 comments on commit 660ae53

Please sign in to comment.