Skip to content

Commit

Permalink
Additional fixes to no longer hard code class API address
Browse files Browse the repository at this point in the history
  • Loading branch information
computate committed Dec 19, 2023
1 parent 159976c commit 8930677
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions src/main/java/org/computate/frFR/java/EcrireApiClasse.java
Original file line number Diff line number Diff line change
Expand Up @@ -1779,7 +1779,7 @@ public void ecrireGenApiServiceImpl2(String classeLangueNom) throws Exception {
if(StringUtils.containsAny(classeApiMethode, "POST", "PUT", "PATCH"))
tl(2, "LOG.debug(String.format(\"", classeApiOperationIdMethode, " ", classeLangueConfig.getString(ConfigCles.str_a_démarré), ". \"));");

tl(2, classeLangueConfig.getString(ConfigCles.var_utilisateur), "(", classeLangueConfig.getString(ConfigCles.var_requeteService), ", ", classePartsRequeteSite.nomSimple(classeLangueNom), ".class, ", classePartsUtilisateurSite.nomSimple(classeLangueNom), ".class, ", classePartsUtilisateurSite.nomSimple(classeLangueNom), ".", classeLangueConfig.getString(ConfigCles.var_CLASSE_API_ADDRESSE), ", \"post", classePartsUtilisateurSite.nomSimple(classeLangueNom), "Future\", \"patch", classePartsUtilisateurSite.nomSimple(classeLangueNom), "Future\").onSuccess(", classeLangueConfig.getString(ConfigCles.var_requeteSite), " -> {");
tl(2, classeLangueConfig.getString(ConfigCles.var_utilisateur), "(", classeLangueConfig.getString(ConfigCles.var_requeteService), ", ", classePartsRequeteSite.nomSimple(classeLangueNom), ".class, ", classePartsUtilisateurSite.nomSimple(classeLangueNom), ".class, ", classePartsUtilisateurSite.nomSimple(classeLangueNom), ".get", classeLangueConfig.getString(ConfigCles.var_ClasseApiAddresse), "(), \"post", classePartsUtilisateurSite.nomSimple(classeLangueNom), "Future\", \"patch", classePartsUtilisateurSite.nomSimple(classeLangueNom), "Future\").onSuccess(", classeLangueConfig.getString(ConfigCles.var_requeteSite), " -> {");
if(
StringUtils.containsAny(classeApiMethode, "POST", "PUT", "PATCH")
&& !(classeRoleSession || classeRoleUtilisateur || classeRoleChacun)
Expand Down Expand Up @@ -2283,7 +2283,7 @@ else if(classeApiMethode.equals(classeLangueConfig.getString(ConfigCles.var_PUTF
l();
tl(1, "@Override");
tl(1, "public void ", classeApiOperationIdMethode, "Future(" , StringUtils.equals(classeApiTypeMediaRequeteMethode, "application/json") ? "JsonObject" : "String", " body, ServiceRequest ", classeLangueConfig.getString(ConfigCles.var_requeteService), ", Handler<AsyncResult<ServiceResponse>> ", classeLangueConfig.getString(ConfigCles.var_gestionnaireEvenements), ") {");
tl(2, classeLangueConfig.getString(ConfigCles.var_utilisateur), "(", classeLangueConfig.getString(ConfigCles.var_requeteService), ", ", classePartsRequeteSite.nomSimple(classeLangueNom), ".class, ", classePartsUtilisateurSite.nomSimple(classeLangueNom), ".class, ", classePartsUtilisateurSite.nomSimple(classeLangueNom), ".", classeLangueConfig.getString(ConfigCles.var_CLASSE_API_ADDRESSE), ", \"post", classePartsUtilisateurSite.nomSimple(classeLangueNom), "Future\", \"patch", classePartsUtilisateurSite.nomSimple(classeLangueNom), "Future\").onSuccess(", classeLangueConfig.getString(ConfigCles.var_requeteSite), " -> {");
tl(2, classeLangueConfig.getString(ConfigCles.var_utilisateur), "(", classeLangueConfig.getString(ConfigCles.var_requeteService), ", ", classePartsRequeteSite.nomSimple(classeLangueNom), ".class, ", classePartsUtilisateurSite.nomSimple(classeLangueNom), ".class, ", classePartsUtilisateurSite.nomSimple(classeLangueNom), ".get", classeLangueConfig.getString(ConfigCles.var_ClasseApiAddresse), "(), \"post", classePartsUtilisateurSite.nomSimple(classeLangueNom), "Future\", \"patch", classePartsUtilisateurSite.nomSimple(classeLangueNom), "Future\").onSuccess(", classeLangueConfig.getString(ConfigCles.var_requeteSite), " -> {");
tl(3, classePartsRequeteApi.nomSimple(classeLangueNom), " ", classeLangueConfig.getString(ConfigCles.var_requeteApi), " = new ", classePartsRequeteApi.nomSimple(classeLangueNom), "();");
tl(3, classeLangueConfig.getString(ConfigCles.var_requeteApi), ".setRows(1L);");
tl(3, classeLangueConfig.getString(ConfigCles.var_requeteApi), ".setNumFound(1L);");
Expand Down Expand Up @@ -2333,7 +2333,7 @@ else if(StringUtils.contains(classeApiMethode, "PATCH")) {
l();
tl(1, "@Override");
tl(1, "public void ", classeApiOperationIdMethode, "Future(" , StringUtils.equals(classeApiTypeMediaRequeteMethode, "application/json") ? "JsonObject" : "String", " body, ServiceRequest ", classeLangueConfig.getString(ConfigCles.var_requeteService), ", Handler<AsyncResult<ServiceResponse>> ", classeLangueConfig.getString(ConfigCles.var_gestionnaireEvenements), ") {");
tl(2, classeLangueConfig.getString(ConfigCles.var_utilisateur), "(", classeLangueConfig.getString(ConfigCles.var_requeteService), ", ", classePartsRequeteSite.nomSimple(classeLangueNom), ".class, ", classePartsUtilisateurSite.nomSimple(classeLangueNom), ".class, ", classePartsUtilisateurSite.nomSimple(classeLangueNom), ".", classeLangueConfig.getString(ConfigCles.var_CLASSE_API_ADDRESSE), ", \"post", classePartsUtilisateurSite.nomSimple(classeLangueNom), "Future\", \"patch", classePartsUtilisateurSite.nomSimple(classeLangueNom), "Future\").onSuccess(", classeLangueConfig.getString(ConfigCles.var_requeteSite), " -> {");
tl(2, classeLangueConfig.getString(ConfigCles.var_utilisateur), "(", classeLangueConfig.getString(ConfigCles.var_requeteService), ", ", classePartsRequeteSite.nomSimple(classeLangueNom), ".class, ", classePartsUtilisateurSite.nomSimple(classeLangueNom), ".class, ", classePartsUtilisateurSite.nomSimple(classeLangueNom), ".get", classeLangueConfig.getString(ConfigCles.var_ClasseApiAddresse), "(), \"post", classePartsUtilisateurSite.nomSimple(classeLangueNom), "Future\", \"patch", classePartsUtilisateurSite.nomSimple(classeLangueNom), "Future\").onSuccess(", classeLangueConfig.getString(ConfigCles.var_requeteSite), " -> {");
tl(3, "try {");
tl(4, classeLangueConfig.getString(ConfigCles.var_requeteSite), ".setJsonObject(body);");
tl(4, classeLangueConfig.getString(ConfigCles.var_requeteService), ".getParams().getJsonObject(\"query\").put(\"rows\", 1);");
Expand Down Expand Up @@ -2385,7 +2385,7 @@ else if(StringUtils.containsAny(classeApiMethode, classeLangueConfig.getString(C
l();
tl(1, "@Override");
tl(1, "public void ", classeApiOperationIdMethode, "Future(" , StringUtils.equals(classeApiTypeMediaRequeteMethode, "application/json") ? "JsonObject" : "String", " body, ServiceRequest ", classeLangueConfig.getString(ConfigCles.var_requeteService), ", Handler<AsyncResult<ServiceResponse>> ", classeLangueConfig.getString(ConfigCles.var_gestionnaireEvenements), ") {");
tl(2, classeLangueConfig.getString(ConfigCles.var_utilisateur), "(", classeLangueConfig.getString(ConfigCles.var_requeteService), ", ", classePartsRequeteSite.nomSimple(classeLangueNom), ".class, ", classePartsUtilisateurSite.nomSimple(classeLangueNom), ".class, ", classePartsUtilisateurSite.nomSimple(classeLangueNom), ".", classeLangueConfig.getString(ConfigCles.var_CLASSE_API_ADDRESSE), ", \"post", classePartsUtilisateurSite.nomSimple(classeLangueNom), "Future\", \"patch", classePartsUtilisateurSite.nomSimple(classeLangueNom), "Future\").onSuccess(", classeLangueConfig.getString(ConfigCles.var_requeteSite), " -> {");
tl(2, classeLangueConfig.getString(ConfigCles.var_utilisateur), "(", classeLangueConfig.getString(ConfigCles.var_requeteService), ", ", classePartsRequeteSite.nomSimple(classeLangueNom), ".class, ", classePartsUtilisateurSite.nomSimple(classeLangueNom), ".class, ", classePartsUtilisateurSite.nomSimple(classeLangueNom), ".get", classeLangueConfig.getString(ConfigCles.var_ClasseApiAddresse), "(), \"post", classePartsUtilisateurSite.nomSimple(classeLangueNom), "Future\", \"patch", classePartsUtilisateurSite.nomSimple(classeLangueNom), "Future\").onSuccess(", classeLangueConfig.getString(ConfigCles.var_requeteSite), " -> {");
tl(3, "try {");
if(StringUtils.equals(classeApiTypeMediaRequeteMethode, "application/json")) {
tl(4, classePartsRequeteApi.nomSimple(classeLangueNom), " ", classeLangueConfig.getString(ConfigCles.var_requeteApi), " = new ", classePartsRequeteApi.nomSimple(classeLangueNom), "();");
Expand Down Expand Up @@ -3871,6 +3871,11 @@ public void ecrireGenApiServiceImpl3(String classeLangueNom) throws Exception {
tl(1, "public String ", classeLangueConfig.getString(ConfigCles.var_recherche), "Var(String var", classeLangueConfig.getString(ConfigCles.var_Indexe), ") {");
tl(2, "return ", classeNomSimple, ".", classeLangueConfig.getString(ConfigCles.var_recherche), "Var", classeNomSimple, "(var", classeLangueConfig.getString(ConfigCles.var_Indexe), ");");
tl(1, "}");
l();
tl(1, "@Override");
tl(1, "public String get", classeLangueConfig.getString(ConfigCles.var_ClasseApiAddresse), "() {");
tl(2, "return ", classeNomSimple, ".", classeLangueConfig.getString(ConfigCles.var_CLASSE_API_ADDRESSE), "_", classeNomSimple, ";");
tl(1, "}");
}
///////////////
// recharger //
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/computate/frFR/java/EcrireGenClasse.java
Original file line number Diff line number Diff line change
Expand Up @@ -6028,7 +6028,7 @@ public void genCodeClasseFin(String langueNom, YAMLConfiguration langueConfig) t
l();
tl(1, "public static final String ", langueConfig.getString(ConfigCles.var_CLASSE_NOM_SIMPLE), " = \"", classeNomSimple, "\";");
if(classeApi) {
tl(0, "public static final String ", classeLangueConfig.getString(ConfigCles.var_CLASSE_API_ADDRESSE), "_", classeNomSimple, " = \"", siteNom, "-", classeLangueNom, "-", classeNomSimple, "\";");
tl(1, "public static final String ", classeLangueConfig.getString(ConfigCles.var_CLASSE_API_ADDRESSE), "_", classeNomSimple, " = \"", siteNom, "-", classeLangueNom, "-", classeNomSimple, "\";");
tl(1, "public static String get", classeLangueConfig.getString(ConfigCles.var_ClasseApiAddresse), "() {");
tl(2, "return ", classeLangueConfig.getString(ConfigCles.var_CLASSE_API_ADDRESSE), "_", classeNomSimple, ";");
tl(1, "}");
Expand Down

0 comments on commit 8930677

Please sign in to comment.