Skip to content

Commit 08e714d

Browse files
committed
Fixing APIs that don't require a VarId field
1 parent 8b661a2 commit 08e714d

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2154,7 +2154,8 @@ public void ecrireGenApiServiceImpl2(String classeLangueNom) throws Exception {
21542154
&& BooleanUtils.isNotTrue(classePublicLire) || !StringUtils.equals(classeApiMethodeMethode, "GET")
21552155
) {
21562156
if(authPolitiqueGranulee) {
2157-
tl(3, "String ", classeVarId, " = ", i18nGlobale.getString(I18n.var_requeteSite), ".get", i18nGlobale.getString(I18n.var_RequeteService), "().getParams().getJsonObject(\"path\").getString(\"", classeVarId, "\");");
2157+
if(classeVarId != null)
2158+
tl(3, "String ", classeVarId, " = ", i18nGlobale.getString(I18n.var_requeteSite), ".get", i18nGlobale.getString(I18n.var_RequeteService), "().getParams().getJsonObject(\"path\").getString(\"", classeVarId, "\");");
21582159
tl(3, "MultiMap form = MultiMap.caseInsensitiveMultiMap();");
21592160
tl(3, "form.add(\"grant_type\", \"urn:ietf:params:oauth:grant-type:uma-ticket\");");
21602161
tl(3, "form.add(\"audience\", config.getString(ComputateConfigKeys.AUTH_CLIENT));");
@@ -2166,8 +2167,10 @@ public void ecrireGenApiServiceImpl2(String classeLangueNom) throws Exception {
21662167
tl(3, "form.add(\"permission\", String.format(\"%s#%s\", ", classeNomSimple, ".", i18nGlobale.getString(I18n.var_CLASSE_NOM_SIMPLE), ", \"DELETE\"));");
21672168
tl(3, "form.add(\"permission\", String.format(\"%s#%s\", ", classeNomSimple, ".", i18nGlobale.getString(I18n.var_CLASSE_NOM_SIMPLE), ", \"PATCH\"));");
21682169
tl(3, "form.add(\"permission\", String.format(\"%s#%s\", ", classeNomSimple, ".", i18nGlobale.getString(I18n.var_CLASSE_NOM_SIMPLE), ", \"PUT\"));");
2169-
tl(3, "if(", classeVarId, " != null)");
2170-
tl(4, "form.add(\"permission\", String.format(\"%s-%s#%s\", ", classeNomSimple, ".", i18nGlobale.getString(I18n.var_CLASSE_NOM_SIMPLE), ", ", classeVarId, ", \"", classeApiMethodeMethode, "\"));");
2170+
if(classeVarId != null) {
2171+
tl(3, "if(", classeVarId, " != null)");
2172+
tl(4, "form.add(\"permission\", String.format(\"%s-%s#%s\", ", classeNomSimple, ".", i18nGlobale.getString(I18n.var_CLASSE_NOM_SIMPLE), ", ", classeVarId, ", \"", classeApiMethodeMethode, "\"));");
2173+
}
21712174
if(classeRoleUtilisateur) {
21722175
tl(3, i18nGlobale.getString(I18n.var_requeteSite), ".set", i18nGlobale.getString(I18n.var_PublicLire), "(", i18nGlobale.getString(I18n.var_classe), i18nGlobale.getString(I18n.var_PublicLire), ");");
21732176
}
@@ -4099,8 +4102,12 @@ else if(classeApiMethode.contains(i18nGlobale.getString(I18n.var_Telechargement)
40994102
tl(3, "}");
41004103
} else {
41014104
tl(3, "if(json == null) {");
4102-
tl(4, "String ", classeVarId, " = ", i18nGlobale.getString(I18n.var_requeteSite), ".get", i18nGlobale.getString(I18n.var_RequeteService), "().getParams().getJsonObject(\"path\").getString(\"", classeVarId, "\");");
4103-
tl(6, "String m = String.format(\"", i18nGlobale.getString(I18n.str_s_s_non_trouve), "\", \"", classeNomAdjectifSingulier, "\", ", classeVarId, ");");
4105+
if(classeVarId == null) {
4106+
tl(4, "String m = String.format(\"", i18nGlobale.getString(I18n.str_s_s_non_trouve), "\", \"", classeNomAdjectifSingulier, "\", null);");
4107+
} else {
4108+
tl(4, "String ", classeVarId, " = ", i18nGlobale.getString(I18n.var_requeteSite), ".get", i18nGlobale.getString(I18n.var_RequeteService), "().getParams().getJsonObject(\"path\").getString(\"", classeVarId, "\");");
4109+
tl(4, "String m = String.format(\"", i18nGlobale.getString(I18n.str_s_s_non_trouve), "\", \"", classeNomAdjectifSingulier, "\", ", classeVarId, ");");
4110+
}
41044111
tl(4, "promise.complete(new ServiceResponse(404");
41054112
tl(6, ", m");
41064113
tl(6, ", Buffer.buffer(new JsonObject().put(\"", i18nGlobale.getString(I18n.var_message), "\", m).encodePrettily()), null));");

0 commit comments

Comments
 (0)