Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
computate committed Sep 12, 2024
2 parents 5637736 + 8bcc761 commit 146ab96
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 15 deletions.
14 changes: 7 additions & 7 deletions src/main/java/org/computate/frFR/java/EcrireApiClasse.java
Original file line number Diff line number Diff line change
Expand Up @@ -2996,7 +2996,7 @@ else if(!StringUtils.containsAny(classeApiMethode, "POST", "PUT"))
tl(4, "vars", classeNomSimple, "(", i18nGlobale.getString(I18n.var_requeteSite), ").onSuccess(a -> {");
tl(5, i18nGlobale.getString(I18n.var_creer), classeNomSimple, "(", i18nGlobale.getString(I18n.var_requeteSite), ").onSuccess(", uncapitalizeClasseNomSimple, " -> {");
tl(6, "sql", classeApiMethode, classeNomSimple, "(", uncapitalizeClasseNomSimple, ", inheritPk).onSuccess(b -> {");
tl(7, i18nGlobale.getString(I18n.var_definir), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(c -> {");
tl(7, i18nGlobale.getString(I18n.var_definir), classeNomSimple, "(", uncapitalizeClasseNomSimple, ", false).onSuccess(c -> {");
tl(8, i18nGlobale.getString(I18n.var_attribuer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(d -> {");
tl(9, i18nGlobale.getString(I18n.var_indexer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(o2 -> {");
tl(10, "promise1.complete(", uncapitalizeClasseNomSimple, ");");
Expand Down Expand Up @@ -3140,7 +3140,7 @@ else if(classeApiMethode.equals(i18nGlobale.getString(I18n.var_PUTCopie))) {

tl(4, i18nGlobale.getString(I18n.var_creer), classeNomSimple, "(", i18nGlobale.getString(I18n.var_requeteSite), ").onSuccess(", uncapitalizeClasseNomSimple, " -> {");
tl(5, "sql", classeApiMethode, classeNomSimple, "(", uncapitalizeClasseNomSimple, ", jsonObject).onSuccess(b -> {");
tl(6, i18nGlobale.getString(I18n.var_definir), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(c -> {");
tl(6, i18nGlobale.getString(I18n.var_definir), classeNomSimple, "(", uncapitalizeClasseNomSimple, ", false).onSuccess(c -> {");
tl(7, i18nGlobale.getString(I18n.var_attribuer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(d -> {");
tl(8, i18nGlobale.getString(I18n.var_indexer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(o2 -> {");
tl(9, "promise1.complete(", uncapitalizeClasseNomSimple, ");");
Expand Down Expand Up @@ -3207,7 +3207,7 @@ else if(classeApiMethode.contains("PATCH")) {
tl(4, i18nGlobale.getString(I18n.var_requeteSite), ".set", i18nGlobale.getString(I18n.var_ConnexionSql), "(", i18nGlobale.getString(I18n.var_connexionSql), ");");
tl(4, "vars", classeNomSimple, "(", i18nGlobale.getString(I18n.var_requeteSite), ").onSuccess(a -> {");
tl(5, "sql", classeApiMethode, classeNomSimple, "(o, inheritPk).onSuccess(", uncapitalizeClasseNomSimple, " -> {");
tl(6, i18nGlobale.getString(I18n.var_definir), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(c -> {");
tl(6, i18nGlobale.getString(I18n.var_definir), classeNomSimple, "(", uncapitalizeClasseNomSimple, ", true).onSuccess(c -> {");
tl(7, i18nGlobale.getString(I18n.var_attribuer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(d -> {");
tl(8, i18nGlobale.getString(I18n.var_indexer), classeNomSimple, "(", uncapitalizeClasseNomSimple, ").onSuccess(o2 -> {");
tl(9, "if(", i18nGlobale.getString(I18n.var_requeteApi), " != null) {");
Expand Down Expand Up @@ -3279,8 +3279,8 @@ else if(classeApiMethode.contains("PATCH")) {
if(classeModele) {
if(classeApiMethode.contains("POST")) {
l();
tl(1, "public Future<Void> sql", classeApiMethode, classeNomSimple, "(", classeNomSimple, " o, Boolean inheritPk) {");
tl(2, "Promise<Void> promise = Promise.promise();");
tl(1, "public Future<", classeNomSimple, "> sql", classeApiMethode, classeNomSimple, "(", classeNomSimple, " o, Boolean inheritPk) {");
tl(2, "Promise<", classeNomSimple, "> promise = Promise.promise();");
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), "_();");
Expand Down Expand Up @@ -3354,7 +3354,7 @@ else if(classeApiMethode.contains("PATCH")) {
tl(3, "}");
tl(3, "CompositeFuture.all(futures1).onSuccess(a -> {");
tl(4, "CompositeFuture.all(futures2).onSuccess(b -> {");
tl(5, "promise.complete();");
tl(5, "promise.complete(o2);");
tl(4, "}).onFailure(ex -> {");
tl(5, "LOG.error(String.format(\"sql", classeApiMethode, classeNomSimple, " ", i18nGlobale.getString(I18n.str_a_échoué), ". \"), ex);");
tl(5, "promise.fail(ex);");
Expand Down Expand Up @@ -4268,7 +4268,7 @@ public void ecrireGenApiServiceImpl3(String classeLangueNom) throws Exception {
/////////////
l();
if(classeModele) {
tl(1, "public Future<Void> ", i18nGlobale.getString(I18n.var_definir), classeNomSimple, "(", classeNomSimple, " o) {");
tl(1, "public Future<Void> ", i18nGlobale.getString(I18n.var_definir), classeNomSimple, "(", classeNomSimple, " o, Boolean patch) {");
tl(2, "Promise<Void> promise = Promise.promise();");
tl(2, "try {");
tl(3, classePartsRequeteSite.nomSimple(classeLangueNom), " ", i18nGlobale.getString(I18n.var_requeteSite), " = o.get", i18nGlobale.getString(I18n.var_RequeteSite), "_();");
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/org/computate/frFR/java/EcrireGenClasse.java
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ public class EcrireGenClasse extends EcrireClasse {
protected ToutEcrivain wNomAffichageMethode;
protected ToutEcrivain wClasseNomSimpleMethode;
protected ToutEcrivain wDescriptionMethode;
protected ToutEcrivain wNgsiTypeMethode;
protected ToutEcrivain wHtmColonneMethode;
protected ToutEcrivain wHtmLigneMethode;
protected ToutEcrivain wHtmCelluleMethode;
Expand Down Expand Up @@ -955,6 +956,7 @@ public class EcrireGenClasse extends EcrireClasse {
* Var.enUS: entityDescription
*/
String entiteDescription;
String entiteNgsiType;

Integer entiteHtmLigne;
Integer entiteHtmCellule;
Expand Down Expand Up @@ -1288,6 +1290,7 @@ public void genCodeInit() throws Exception {

wClasseNomSimpleMethode = ToutEcrivain.create();
wDescriptionMethode = ToutEcrivain.create();
wNgsiTypeMethode = ToutEcrivain.create();
wHtmColonneMethode = ToutEcrivain.create();
wHtmLigneMethode = ToutEcrivain.create();
wHtmCelluleMethode = ToutEcrivain.create();
Expand Down Expand Up @@ -3006,6 +3009,7 @@ public void genCodeEntite(String langueNom, JsonObject langueConfig) throws Exce
entiteVar = doc.getString("entiteVar_" + langueNom + "_stored_string");
entiteVarUrl = doc.getString("entiteVarUrl_" + langueNom + "_stored_string");
entiteDescription = doc.getString("entiteDescription_" + langueNom + "_stored_string");
entiteNgsiType = doc.getString("entiteNgsiType_stored_string");
entiteSuffixeType = doc.getString("entiteSuffixeType_stored_string");
entiteVarCapitalise = doc.getString("entiteVarCapitalise_" + langueNom + "_stored_string");
entiteAttribuerVarSuggere = doc.getString("entiteAttribuerVarSuggere_" + langueNom + "_stored_string");
Expand Down Expand Up @@ -5367,6 +5371,10 @@ else if(entiteIndexe
wDescriptionMethode.tl(2, "case VAR_", entiteVar, ":");
wDescriptionMethode.tl(3, "return \"", StringEscapeUtils.escapeJava(entiteDescription), "\";");
}
if(entiteNgsiType != null) {
wNgsiTypeMethode.tl(2, "case VAR_", entiteVar, ":");
wNgsiTypeMethode.tl(3, "return \"", StringEscapeUtils.escapeJava(entiteNgsiType), "\";");
}
if(entiteNomSimple != null) {
wClasseNomSimpleMethode.tl(2, "case VAR_", entiteVar, ":");
wClasseNomSimpleMethode.tl(3, "return \"", entiteNomSimple, "\";");
Expand Down Expand Up @@ -5571,6 +5579,7 @@ public void genCodeClasseFin(String langueNom, JsonObject langueConfig) throws E
wNomAffichageStatic.flushClose();
wNomAffichageMethode.flushClose();
wDescriptionMethode.flushClose();
wNgsiTypeMethode.flushClose();
wClasseNomSimpleMethode.flushClose();
wHtmColonneMethode.flushClose();
wHtmLigneMethode.flushClose();
Expand Down Expand Up @@ -6134,6 +6143,21 @@ public void genCodeClasseFin(String langueNom, JsonObject langueConfig) throws E
tl(2, "}");
tl(1, "}");

//////////////
// NgsiType //
//////////////
if(classeFiware) {

l();
tl(1, "public static String ngsiType(String var) {");
tl(2, "switch(var) {");
s(wNgsiTypeMethode);
tl(3, "default:");
tl(4, "return null;");
tl(2, "}");
tl(1, "}");
}

/////////////////
// HtmColonne //
/////////////////
Expand Down
23 changes: 15 additions & 8 deletions src/main/java/org/computate/frFR/java/EcrirePageClasse.java
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ else if("LocalDate".equals(entiteNomSimple)) {
// if(entiteDescription != null)
// tl(16, "title=\"", entiteDescription, " (", langueConfig.getString(ConfigCles.var_DDDashMMDashYYYY), ")\"");
// tl(5, "value=\", ", entiteVar, " == null ? \"\" : DateTimeFormatter.ofPattern(\"", langueConfig.getString(ConfigCles.var_ddDashMMDashyyyy), "\").format(", entiteVar, "));");
tl(11, "value=\"{{", uncapitalizeClasseNomSimple, "_.", entiteVar, "}}\"");
tl(11, "value=\"{{", uncapitalizeClasseNomSimple, "_.", entiteVar, " | e }}\"");
tl(1, "{%- if 'Page' == ", langueConfig.getString(I18n.var_classeApiMethodeMethode), " %}");
tl(1, "{%- endif %}");
tl(11, "data-", classeModele ? classeVarClePrimaire : classeVarCleUnique, "=\"{{ ", classeModele ? classeVarClePrimaire : classeVarCleUnique, " }}\"");
Expand Down Expand Up @@ -417,7 +417,7 @@ else if("LocalDateTime".equals(entiteNomSimple) || "ZonedDateTime".equals(entite
tl(11, "data-timeformat=\"", langueConfig.getString(I18n.str_ddDashMMDashyyyy_HHColonmm_VV), "\"");
tl(11, "id=\"{{", langueConfig.getString(I18n.var_classeApiMethodeMethode), "}}_", entiteVar, "\"");
// tl(4, ".a(\"value\", ", entiteVar, " == null ? \"\" : DateTimeFormatter.ofPattern(\"", langueConfig.getString(ConfigCles.var_EEE_d_MMM_yyyy_HAposhAposmmColonss_zz_VV), "\").format(", entiteVar, "));");
tl(11, "value=\"{%- if ", uncapitalizeClasseNomSimple, "_.", entiteVar, " is defined %}{{ formatZonedDateTime(", uncapitalizeClasseNomSimple, "_.", entiteVar, ", \"", langueConfig.getString(I18n.str_ddDashMMDashyyyy_HHColonmm_VV), "\", defaultLocaleId, defaultZoneId) }}{%- endif %}\"");
tl(11, "value=\"{%- if ", uncapitalizeClasseNomSimple, "_.", entiteVar, " is defined %}{{ formatZonedDateTime(", uncapitalizeClasseNomSimple, "_.", entiteVar, ", \"", langueConfig.getString(I18n.str_ddDashMMDashyyyy_HHColonmm_VV), "\", defaultLocaleId, defaultZoneId) | e }}{%- endif %}\"");
tl(1, "{%- if 'Page' == ", langueConfig.getString(I18n.var_classeApiMethodeMethode), " %}");
tl(1, "{%- endif %}");
tl(11, "data-", classeModele ? classeVarClePrimaire : classeVarCleUnique, "=\"{{ ", classeModele ? classeVarClePrimaire : classeVarCleUnique, " }}\"");
Expand Down Expand Up @@ -453,7 +453,7 @@ else if("LocalTime".equals(entiteNomSimple)) {
tl(11, "class=\"label-on-left timepicker set", entiteVarCapitalise, " class", classeNomSimple, " input", classeNomSimple, "{{", classeModele ? classeVarClePrimaire : classeVarCleUnique, "}}", entiteVarCapitalise, " \"");
tl(11, "placeholder=\"", langueConfig.getString(I18n.var_HHColonMM), "\"");
tl(11, "id=\"{{", langueConfig.getString(I18n.var_classeApiMethodeMethode), "}}_", entiteVar, "\"");
tl(11, "value=\"{{", uncapitalizeClasseNomSimple, "_.", entiteVar, "}}\"");
tl(11, "value=\"{{", uncapitalizeClasseNomSimple, "_.", entiteVar, " | e }}\"");
tl(11, "data-", classeModele ? classeVarClePrimaire : classeVarCleUnique, "=\"{{ ", classeModele ? classeVarClePrimaire : classeVarCleUnique, " }}\"");
tl(11, "></sl-input>");
}
Expand Down Expand Up @@ -546,7 +546,7 @@ else if(entiteImageBase64Url != null) {

tl(10, "<h5>", langueConfig.getString(I18n.str_Télécharger_image), "</h5>");
tl(10, "<form method=\"POST\" enctype=\"multipart/form-data\" action=\"", entiteImageBase64Url, "\" class=\"\">");
tl(11, "<input type=\"hidden\" name=\"", classeModele ? classeVarClePrimaire : classeVarCleUnique, "\" value=\"{{", classeModele ? classeVarClePrimaire : classeVarCleUnique, "}}\"/>");
tl(11, "<input type=\"hidden\" name=\"", classeModele ? classeVarClePrimaire : classeVarCleUnique, "\" value=\"{{", classeModele ? classeVarClePrimaire : classeVarCleUnique, " | e }}\"/>");
tl(11, "<input type=\"hidden\" name=\"", langueConfig.getString(I18n.var_classeNomSimple), "\" value=\"", classeNomSimple, "\"/>");
tl(11, "<sl-input name=\"", langueConfig.getString(I18n.var_fichier), "\" type=\"file\" onchange=\"fetch('", entiteImageBase64Url, "', { method: 'POST', body: new FormData(this.form)}); \"></sl-input>");
tl(10, "</form>");
Expand Down Expand Up @@ -594,7 +594,7 @@ else if(BooleanUtils.isTrue(entiteSignature)) {
}
else {
if(entiteMultiligne)
tl(9, "<sl-textarea");
tl(9, "<sl-textarea resize=\"auto\"");
else {
tl(9, "<sl-input");
}
Expand Down Expand Up @@ -632,14 +632,20 @@ else if(BooleanUtils.isTrue(entiteSignature)) {
tl(1, "{%- endif %}");

if(entiteMultiligne) {
tl(11, ">", "{{", uncapitalizeClasseNomSimple, "_.", entiteVar, "}}");
tl(0, "{%- if \"Page\" == ", langueConfig.getString(I18n.var_classeApiMethodeMethode), " %}");
if("JsonArray".equals(entiteNomSimpleVertxJson) || "JsonObject".equals(entiteNomSimpleVertxJson))
tl(11, "value=\"{{ to", entiteNomSimpleVertxJson, "String(", uncapitalizeClasseNomSimple, "_.", entiteVar, ") | e }}\"");
else
tl(11, "value=\"{{", uncapitalizeClasseNomSimple, "_.", entiteVar, " | e }}\"");
tl(0, "{%- endif %}");
tl(11, ">");
}
else {
tl(1, "{%- if \"Page\" == ", langueConfig.getString(I18n.var_classeApiMethodeMethode), " %}");
if("JsonArray".equals(entiteNomSimpleVertxJson) || "JsonObject".equals(entiteNomSimpleVertxJson))
tl(11, "value=\"{{ to", entiteNomSimpleVertxJson, "String(", uncapitalizeClasseNomSimple, "_.", entiteVar, ") }}\"");
tl(11, "value=\"{{ to", entiteNomSimpleVertxJson, "String(", uncapitalizeClasseNomSimple, "_.", entiteVar, ") | e }}\"");
else
tl(11, "value=\"{{", uncapitalizeClasseNomSimple, "_.", entiteVar, "}}\"");
tl(11, "value=\"{{", uncapitalizeClasseNomSimple, "_.", entiteVar, " | e }}\"");
tl(1, "{%- endif %}");
}

Expand Down Expand Up @@ -3349,6 +3355,7 @@ else if(i18nPage.getString(I18n.var_PUTCopie).equals(classeApiMethode))
tl(0, "{%- block websocket", classePageSuperNomSimple, " %}");
tl(0, "{%- block websocket", classePageNomSimple, " %}");
tl(4, "window.eventBus = new EventBus('/eventbus');");
tl(4, "window.eventBus.enableReconnect(true);");
tl(4, "websocket", classeApiClasseNomSimple, "(websocket", classeApiClasseNomSimple, "Inner);");
tl(0, "{%- endblock websocket", classePageNomSimple, " %}");
tl(0, "{%- endblock websocket", classePageSuperNomSimple, " %}");
Expand Down

0 comments on commit 146ab96

Please sign in to comment.