Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions src/main/java/org/computate/frFR/java/EcrireApiClasse.java
Original file line number Diff line number Diff line change
Expand Up @@ -2089,7 +2089,7 @@ public void ecrireGenApiServiceImpl2(String classeLangueNom) throws Exception {
if(classeRessourcesAutorisation.size() > 0) {
for(String classeRessourceAutorisation : classeRessourcesAutorisation) {
tl(4, "groups.stream().map(group -> {");
tl(7, "Matcher mPermission = Pattern.compile(\"^/(.*-?", StringUtils.substringBefore(classeRessourceAutorisation, "-"), "-([a-z0-9\\\\-]+))-(", classeApiPortee, ")$\").matcher(group);");
tl(7, "Matcher mPermission = Pattern.compile(\"^/(.*-?", StringUtils.substringBefore(classeRessourceAutorisation, "-"), "-([a-z0-9\\\\-]+))-(\\\\w+)$\").matcher(group);");
tl(7, "return mPermission.find() ? mPermission : null;");
tl(6, "}).filter(v -> v != null).forEach(mPermission -> {");
tl(7, "form.add(\"permission\", String.format(\"%s#%s\", mPermission.group(1), mPermission.group(3)));");
Expand Down Expand Up @@ -2124,6 +2124,10 @@ public void ecrireGenApiServiceImpl2(String classeLangueNom) throws Exception {
tl(12, "&& mPermission.find();");
tl(9, "}).forEach(permission -> {");
tl(10, "fqs.add(String.format(\"%s:%s\", \"", StringUtils.substringAfter(classeRessourceAutorisation, "-"), "\", permission.getString(\"rsname\")));");
tl(10, "permission.getJsonArray(\"scopes\").stream().map(s -> (String)s).forEach(scope -> {");
tl(11, "if(!scopes.contains(scope))");
tl(12, "scopes.add(scope);");
tl(10, "});");
tl(9, "});");
}
tl(7, "JsonObject authParams = ", i18nGlobale.getString(I18n.var_requeteSite), ".get", i18nGlobale.getString(I18n.var_RequeteService), "().getParams();");
Expand All @@ -2139,7 +2143,8 @@ public void ecrireGenApiServiceImpl2(String classeLangueNom) throws Exception {
tl(7, "}");
tl(7, "if(fqs.size() > 0) {");
tl(8, "fq.add(fqs.stream().collect(Collectors.joining(\" OR \")));");
tl(8, "scopes.add(\"", classeApiPortee, "\");");
tl(8, "if(!scopes.contains(\"", classeApiPortee, "\"))");
tl(9, "scopes.add(\"", classeApiPortee, "\");");
tl(8, i18nGlobale.getString(I18n.var_requeteSite), ".setFilteredScope(true);");
tl(7, "}");
tl(6, "}");
Expand Down Expand Up @@ -2383,7 +2388,7 @@ public void ecrireGenApiServiceImpl2(String classeLangueNom) throws Exception {
if(classeRessourcesAutorisation.size() > 0) {
for(String classeRessourceAutorisation : classeRessourcesAutorisation) {
tl(4, "groups.stream().map(group -> {");
tl(7, "Matcher mPermission = Pattern.compile(\"^/(.*-?", StringUtils.substringBefore(classeRessourceAutorisation, "-"), "-([a-z0-9\\\\-]+))-(", classeApiPortee, ")$\").matcher(group);");
tl(7, "Matcher mPermission = Pattern.compile(\"^/(.*-?", StringUtils.substringBefore(classeRessourceAutorisation, "-"), "-([a-z0-9\\\\-]+))-(\\\\w+)$\").matcher(group);");
tl(7, "return mPermission.find() ? mPermission : null;");
tl(6, "}).filter(v -> v != null).forEach(mPermission -> {");
tl(7, "form.add(\"permission\", String.format(\"%s#%s\", mPermission.group(1), mPermission.group(3)));");
Expand Down Expand Up @@ -2419,6 +2424,10 @@ public void ecrireGenApiServiceImpl2(String classeLangueNom) throws Exception {
tl(12, "&& mPermission.find();");
tl(9, "}).forEach(permission -> {");
tl(10, "fqs.add(String.format(\"%s:%s\", \"", StringUtils.substringAfter(classeRessourceAutorisation, "-"), "\", permission.getString(\"rsname\")));");
tl(10, "permission.getJsonArray(\"scopes\").stream().map(s -> (String)s).forEach(scope -> {");
tl(11, "if(!scopes.contains(scope))");
tl(12, "scopes.add(scope);");
tl(10, "});");
tl(9, "});");
}
tl(7, "JsonObject authParams = ", i18nGlobale.getString(I18n.var_requeteSite), ".get", i18nGlobale.getString(I18n.var_RequeteService), "().getParams();");
Expand All @@ -2434,7 +2443,8 @@ public void ecrireGenApiServiceImpl2(String classeLangueNom) throws Exception {
tl(7, "}");
tl(7, "if(fqs.size() > 0) {");
tl(8, "fq.add(fqs.stream().collect(Collectors.joining(\" OR \")));");
tl(8, "scopes.add(\"", classeApiPortee, "\");");
tl(8, "if(!scopes.contains(\"", classeApiPortee, "\"))");
tl(9, "scopes.add(\"", classeApiPortee, "\");");
tl(8, i18nGlobale.getString(I18n.var_requeteSite), ".setFilteredScope(true);");
tl(7, "}");
tl(6, "}");
Expand Down Expand Up @@ -3228,13 +3238,14 @@ else if(StringUtils.containsAny(classeApiMethode, i18nGlobale.getString(I18n.var
tl(10, "} else {");
tl(11, "o2.", i18nGlobale.getString(I18n.var_definir), i18nGlobale.getString(I18n.var_PourClasse), "(f, bodyVal);");
tl(11, "o2.", i18nGlobale.getString(I18n.var_attribuer), i18nGlobale.getString(I18n.var_PourClasse), "(f, bodyVal);");
tl(11, "if(!StringUtils.containsAny(f, \"", classeVarId, "\", \"", i18nGlobale.getString(I18n.var_cree), "\", \"set", i18nGlobale.getString(I18n.var_Cree), "\") && !Objects.equals(o.", i18nGlobale.getString(I18n.var_obtenir), i18nGlobale.getString(I18n.var_PourClasse), "(f), o2.", i18nGlobale.getString(I18n.var_obtenir), i18nGlobale.getString(I18n.var_PourClasse), "(f)))");
String strImporterNull = classeImporterNull.size() == 0 ? "" : classeImporterNull.stream().collect(Collectors.joining("\", \"", ", \"", "\""));
tl(11, "if(!StringUtils.containsAny(f, \"", classeVarId, "\"", strImporterNull, ", \"", i18nGlobale.getString(I18n.var_cree), "\", \"set", i18nGlobale.getString(I18n.var_Cree), "\") && !Objects.equals(o.", i18nGlobale.getString(I18n.var_obtenir), i18nGlobale.getString(I18n.var_PourClasse), "(f), o2.", i18nGlobale.getString(I18n.var_obtenir), i18nGlobale.getString(I18n.var_PourClasse), "(f)))");
tl(12, "body2.put(\"set\" + StringUtils.capitalize(f), bodyVal);");
tl(10, "}");
tl(9, "}");
tl(9, "for(String f : Optional.ofNullable(o.get", i18nGlobale.getString(I18n.var_Sauvegardes), "()).orElse(new ArrayList<>())) {");
tl(10, "if(!body.fieldNames().contains(f)) {");
tl(11, "if(!StringUtils.containsAny(f, \"", classeVarId, "\", \"", i18nGlobale.getString(I18n.var_cree), "\", \"set", i18nGlobale.getString(I18n.var_Cree), "\") && !Objects.equals(o.", i18nGlobale.getString(I18n.var_obtenir), i18nGlobale.getString(I18n.var_PourClasse), "(f), o2.", i18nGlobale.getString(I18n.var_obtenir), i18nGlobale.getString(I18n.var_PourClasse), "(f)))");
tl(11, "if(!StringUtils.containsAny(f, \"", classeVarId, "\"", strImporterNull, ", \"", i18nGlobale.getString(I18n.var_cree), "\", \"set", i18nGlobale.getString(I18n.var_Cree), "\") && !Objects.equals(o.", i18nGlobale.getString(I18n.var_obtenir), i18nGlobale.getString(I18n.var_PourClasse), "(f), o2.", i18nGlobale.getString(I18n.var_obtenir), i18nGlobale.getString(I18n.var_PourClasse), "(f)))");
tl(12, "body2.putNull(\"set\" + StringUtils.capitalize(f));");
tl(10, "}");
tl(9, "}");
Expand Down Expand Up @@ -3323,13 +3334,14 @@ else if(StringUtils.containsAny(classeApiMethode, i18nGlobale.getString(I18n.var
tl(8, "} else {");
tl(9, "o2.", i18nGlobale.getString(I18n.var_definir), i18nGlobale.getString(I18n.var_PourClasse), "(f, bodyVal);");
tl(9, "o2.", i18nGlobale.getString(I18n.var_attribuer), i18nGlobale.getString(I18n.var_PourClasse), "(f, bodyVal);");
tl(9, "if(!StringUtils.containsAny(f, \"", classeVarId, "\", \"", i18nGlobale.getString(I18n.var_cree), "\", \"set", i18nGlobale.getString(I18n.var_Cree), "\") && !Objects.equals(o.", i18nGlobale.getString(I18n.var_obtenir), i18nGlobale.getString(I18n.var_PourClasse), "(f), o2.", i18nGlobale.getString(I18n.var_obtenir), i18nGlobale.getString(I18n.var_PourClasse), "(f)))");
String strImporterNull = classeImporterNull.size() == 0 ? "" : classeImporterNull.stream().collect(Collectors.joining("\", \"", ", \"", "\""));
tl(9, "if(!StringUtils.containsAny(f, \"", classeVarId, "\"", strImporterNull, ", \"", i18nGlobale.getString(I18n.var_cree), "\", \"set", i18nGlobale.getString(I18n.var_Cree), "\") && !Objects.equals(o.", i18nGlobale.getString(I18n.var_obtenir), i18nGlobale.getString(I18n.var_PourClasse), "(f), o2.", i18nGlobale.getString(I18n.var_obtenir), i18nGlobale.getString(I18n.var_PourClasse), "(f)))");
tl(10, "body2.put(\"set\" + StringUtils.capitalize(f), bodyVal);");
tl(8, "}");
tl(7, "}");
tl(7, "for(String f : Optional.ofNullable(o.get", i18nGlobale.getString(I18n.var_Sauvegardes), "()).orElse(new ArrayList<>())) {");
tl(8, "if(!body.fieldNames().contains(f)) {");
tl(9, "if(!StringUtils.containsAny(f, \"", classeVarId, "\", \"", i18nGlobale.getString(I18n.var_cree), "\", \"set", i18nGlobale.getString(I18n.var_Cree), "\") && !Objects.equals(o.", i18nGlobale.getString(I18n.var_obtenir), i18nGlobale.getString(I18n.var_PourClasse), "(f), o2.", i18nGlobale.getString(I18n.var_obtenir), i18nGlobale.getString(I18n.var_PourClasse), "(f)))");
tl(9, "if(!StringUtils.containsAny(f, \"", classeVarId, "\"", strImporterNull, ", \"", i18nGlobale.getString(I18n.var_cree), "\", \"set", i18nGlobale.getString(I18n.var_Cree), "\") && !Objects.equals(o.", i18nGlobale.getString(I18n.var_obtenir), i18nGlobale.getString(I18n.var_PourClasse), "(f), o2.", i18nGlobale.getString(I18n.var_obtenir), i18nGlobale.getString(I18n.var_PourClasse), "(f)))");
tl(10, "body2.putNull(\"set\" + StringUtils.capitalize(f));");
tl(8, "}");
tl(7, "}");
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/computate/frFR/java/EcrireGenClasse.java
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ public class EcrireGenClasse extends EcrireClasse {
* Var.enUS: classEntityVars
*/
protected List<String> classeEntiteVars;
protected List<String> classeImporterNull;

/**
* Var.enUS: classMethodVars
Expand Down
29 changes: 7 additions & 22 deletions src/main/java/org/computate/frFR/java/EcrirePageClasse.java
Original file line number Diff line number Diff line change
Expand Up @@ -1842,65 +1842,47 @@ public void pageVarsStaticInit(String classeLangueNom, String langueNom, JsonObj
if(resultatFormPOST) {
wFormPOST.tl(7, "</div>");
wFormPOST.tl(6, "</", composantsWebPrefixe, "details>");
if(entitePorteeActuelMap.get(classeApiMethodeMethode) != null) {
if(entitePorteeActuelMap.get("POST") != null) {
wFormPOST.tl(6, "{%- endif -%}");
}
}
if(resultatFormPUTImport) {
wFormPUTImport.tl(7, "</div>");
wFormPUTImport.tl(6, "</", composantsWebPrefixe, "details>");
if(entitePorteeActuelMap.get(classeApiMethodeMethode) != null) {
wFormPUTImport.tl(6, "{%- endif -%}");
}
}
if(resultatFormPUTFusion) {
wFormPUTFusion.tl(7, "</div>");
wFormPUTFusion.tl(6, "</", composantsWebPrefixe, "details>");
if(entitePorteeActuelMap.get(classeApiMethodeMethode) != null) {
wFormPUTFusion.tl(6, "{%- endif -%}");
}
}
if(resultatFormPUTCopie) {
wFormPUTCopie.tl(7, "</div>");
wFormPUTCopie.tl(6, "</", composantsWebPrefixe, "details>");
if(entitePorteeActuelMap.get(classeApiMethodeMethode) != null) {
wFormPUTCopie.tl(6, "{%- endif -%}");
}
}
if(resultatFormPage) {
wFormPage.tl(7, "</div>");
wFormPage.tl(6, "</", composantsWebPrefixe, "details>");
if(entitePorteeActuelMap.get(classeApiMethodeMethode) != null) {
if(entitePorteeActuelMap.get("Page") != null) {
wFormPage.tl(6, "{%- endif -%}");
}
}
if(resultatFormPATCH) {
wFormPATCH.tl(7, "</div>");
wFormPATCH.tl(6, "</", composantsWebPrefixe, "details>");
if(entitePorteeActuelMap.get(classeApiMethodeMethode) != null) {
if(entitePorteeActuelMap.get("PATCH") != null) {
wFormPATCH.tl(6, "{%- endif -%}");
}
}
if(resultatFormDELETE) {
wFormDELETE.tl(7, "</div>");
wFormDELETE.tl(6, "</", composantsWebPrefixe, "details>");
if(entitePorteeActuelMap.get(classeApiMethodeMethode) != null) {
wFormDELETE.tl(6, "{%- endif -%}");
}
}
if(resultatFormDELETEFiltre) {
wFormDELETEFiltre.tl(7, "</div>");
wFormDELETEFiltre.tl(6, "</", composantsWebPrefixe, "details>");
if(entitePorteeActuelMap.get(classeApiMethodeMethode) != null) {
wFormDELETEFiltre.tl(6, "{%- endif -%}");
}
}
if(resultatFormRecherche) {
wFormRecherche.tl(7, "</div>");
wFormRecherche.tl(6, "</", composantsWebPrefixe, "details>");
if(entitePorteeActuelMap.get(classeApiMethodeMethode) != null) {
wFormRecherche.tl(6, "{%- endif -%}");
}
}
}
}
Expand Down Expand Up @@ -2812,6 +2794,8 @@ public void pageCodeClasseJinja(String classeLangueNom, String langueNom, JsonOb
}

if(entiteLien) {
wTh.tl(10, "{% if item.", entiteVar, " is defined -%}");
wTd.tl(10, "{% if item.", entiteVar, " is defined -%}");
wTd.tl(10, "<", composantsWebPrefixe, "button", "wa-".equals(composantsWebPrefixe) ? " variant=\"brand\"" : " variant=\"primary\" outline", "");
wTd.tl(11, "id=\"", classeNomSimple, "_{{", i18nClasse.getString(I18n.var_classeApiMethodeMethode), "}}_", entiteVar, "\"");

Expand All @@ -2838,6 +2822,8 @@ public void pageCodeClasseJinja(String classeLangueNom, String langueNom, JsonOb
wTd.t(12).sx(entiteNomAffichage).l();
}
wTd.tl(10, "</", composantsWebPrefixe, "button>");
wTh.tl(10, "{% endif -%}");
wTd.tl(10, "{% endif -%}");
} else {
if(wTd.getEmpty()) {
wTd.tl(10, "<a href=\"{{ item.", classeVarUrlPageAffichage, " }}\">");
Expand Down Expand Up @@ -5121,7 +5107,6 @@ else if(classeApiMethode.contains(i18nClasse.getString(I18n.var_PUTCopie)))
} else if(classeApiMethode.equals("PATCH")) {
tl(0, "{%- if 'DELETE' in ", i18nGlobale.getString(I18n.var_portees), " %}");
tl(2, "{{ htm", i18nClasse.getString(I18n.var_Formulaire), "_", classeApiOperationIdMethode, "() }}");
tl(1, "{%- endif %}");
tl(0, "{%- endif %}");
} else if(classeApiMethode.equals(i18nClasse.getString(I18n.var_PUTFusion)) || classeApiMethode.equals("PUTImport")) {
tl(0, "{%- if ", i18nClasse.getString(I18n.var_AUTH_PORTEE_SUPER_ADMIN), " in ", i18nGlobale.getString(I18n.var_portees), " %}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ public void ecrireGenClasse(JsonObject doc, String langueNom) throws Exception {
classeTrisSuffixeType = Optional.ofNullable(doc.getJsonArray("classeTrisSuffixeType_stored_strings")).orElse(new JsonArray()).stream().map(v -> (String)v).collect(Collectors.toList());
classeFiltresTrouves = BooleanUtils.isTrue((Boolean)doc.getBoolean("classeFiltresTrouves_stored_boolean"));
classeFiltres = Optional.ofNullable(doc.getJsonArray("classeFiltres_stored_strings")).orElse(new JsonArray()).stream().map(v -> (String)v).collect(Collectors.toList());
classeEntiteVars = Optional.ofNullable(doc.getJsonArray("classeEntiteVars_" + langueNom + "_stored_strings")).orElse(new JsonArray()).stream().map(v -> (String)v).collect(Collectors.toList());
classeImporterNull = Optional.ofNullable(doc.getJsonArray("classeImporterNull_stored_strings")).orElse(new JsonArray()).stream().map(v -> (String)v).collect(Collectors.toList());
if(classeEntiteVars == null)
classeEntiteVars = new ArrayList<>();
classeMethodeVars = Optional.ofNullable(doc.getJsonArray("classeMethodeVars_" + langueNom + "_stored_strings")).orElse(new JsonArray()).stream().map(v -> (String)v).collect(Collectors.toList());
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/org/computate/frFR/java/IndexerClasse.java
Original file line number Diff line number Diff line change
Expand Up @@ -3530,6 +3530,9 @@ else if("LocalTime".equals(entiteMapCleType) && NumberUtils.isCreatable(entiteMa
indexerStockerSolr(entiteDoc, "entiteAjouter", regexTrouve("^" + i18nGlobale.getString(I18n.var_Ajouter) + ": (true)$", methodeCommentaire));
indexerStockerSolr(entiteDoc, "entiteSupprimer", regexTrouve("^" + i18nGlobale.getString(I18n.var_Supprimer) + ": (true)$", methodeCommentaire));
Boolean entiteDefinir = indexerStockerSolr(entiteDoc, "entiteDefinir", regexTrouve("^" + i18nGlobale.getString(I18n.var_Definir) + ": (true)$", methodeCommentaire));
Boolean entiteImporterNull = indexerStockerSolr(entiteDoc, "entiteImporterNull", !regexTrouve("^" + i18nGlobale.getString(I18n.var_ImporterNull) + ": (false)$", methodeCommentaire));
if(!entiteImporterNull)
indexerStockerListeSolr(classeDoc, "classeImporterNull", entiteVar);
indexerStockerSolr(entiteDoc, "entiteModifier", !regexTrouve("^" + i18nGlobale.getString(I18n.var_Modifier) + ": (false)$", methodeCommentaire));
indexerStockerSolr(entiteDoc, "entiteRecharger", regexTrouve("^" + i18nGlobale.getString(I18n.var_Recharger) + ": (true)$", methodeCommentaire));
indexerStockerSolr(entiteDoc, "entiteMultiligne", regexTrouve("^" + i18nGlobale.getString(I18n.var_Multiligne) + ": (true)$", methodeCommentaire));
Expand Down Expand Up @@ -3596,7 +3599,12 @@ else if("LocalTime".equals(entiteMapCleType) && NumberUtils.isCreatable(entiteMa
}
}

indexerStockerSolr(entiteDoc, "entitePortee", regex("^" + i18nGlobale.getString(I18n.var_Portee) + ": (.*)", methodeCommentaire, 1));
String entitePortee = regex("^" + i18nGlobale.getString(I18n.var_Portee) + ": (.*)", methodeCommentaire, 1);
if(methodeCommentaireActuelle != null)
entitePortee = Optional.ofNullable(regex("^" + i18nGlobale.getString(I18n.var_Portee) + ": (.*)", methodeCommentaireActuelle, 1)).orElse(entitePortee);
if(entitePortee != null) {
indexerStockerSolr(entiteDoc, "entitePortee", entitePortee);
}

Boolean entiteHighlighting = indexerStockerSolr(entiteDoc, "entiteHighlighting", regexTrouve("^Highlighting: (true)$", methodeCommentaire));
Boolean entiteHtml = entiteDefinir || regexTrouve("^Html: (true)$", methodeCommentaire);
Expand Down
Loading