Skip to content

Commit

Permalink
fix: regenerate viewModules when action on module
Browse files Browse the repository at this point in the history
  • Loading branch information
lmanelphe committed Oct 13, 2023
1 parent a243db9 commit d9b1fef
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private ArcPreparedStatementBuilder moduleQuery(int moduleIndex, GuiModules modu
/**
* Query to get load rules view
*
* @param viewNormage
* @param viewChargement
*/
public void initializeViewChargement(VObject viewChargement) {

Expand Down Expand Up @@ -232,14 +232,14 @@ public void initializeViewChargement(VObject viewChargement) {
*/
public void initializeNormage(VObject viewNormage) {

ViewEnum dataModelChargement = ViewEnum.IHM_NORMAGE_REGLE;
ViewEnum dataModelNormage = ViewEnum.IHM_NORMAGE_REGLE;

ArcPreparedStatementBuilder query = new ArcPreparedStatementBuilder();

query.append(SQL.SELECT);
query.append(query.sqlListeOfColumnsFromModel(dataModelChargement));
query.append(query.sqlListeOfColumnsFromModel(dataModelNormage));
query.append(SQL.FROM);
query.append(dataObjectService.getView(dataModelChargement));
query.append(dataObjectService.getView(dataModelNormage));
query.append(SQL.WHERE);
query.append(sqlEqualWithFirstSelectedRecord(ColumnEnum.ID_NORME));
query.append(SQL.AND);
Expand All @@ -255,7 +255,7 @@ public void initializeNormage(VObject viewNormage) {
Map<String, String> defaultInputFields = buildDefaultInputFieldsWithFirstSelectedRecord(ColumnEnum.ID_NORME,
ColumnEnum.PERIODICITE, ColumnEnum.VALIDITE_INF, ColumnEnum.VALIDITE_SUP, ColumnEnum.VERSION);

vObjectService.initialize(viewNormage, query, dataObjectService.getView(dataModelChargement),
vObjectService.initialize(viewNormage, query, dataObjectService.getView(dataModelNormage),
defaultInputFields);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ public void putAllVObjects(ModelNorme model) {
views.setViewExpression(vObjectService.preInitialize(model.getViewExpression()));
views.setViewJeuxDeReglesCopie(vObjectService.preInitialize(model.getViewJeuxDeReglesCopie()));

putVObject(views.getViewNorme(),
t -> initializeViewNorme(t));
putVObject(views.getViewNorme(), t -> initializeViewNorme(t));
//
putVObject(views.getViewCalendrier(), t -> initializeViewCalendar(t, views.getViewNorme()));
//
Expand All @@ -65,8 +64,7 @@ public void putAllVObjects(ModelNorme model) {
//
putVObject(views.getViewChargement(), t -> initializeChargement(t, views.getViewJeuxDeRegles(), views.getViewModules()));
//
putVObject(views.getViewNormage(), t -> initializeNormage(t, views.getViewJeuxDeRegles(), views.getViewModules(),
dataObjectService.getView(ViewEnum.IHM_NORMAGE_REGLE) ));
putVObject(views.getViewNormage(), t -> initializeNormage(t, views.getViewJeuxDeRegles(), views.getViewModules()));
//
putVObject(views.getViewControle(), t -> initializeControle(t, views.getViewJeuxDeRegles(), views.getViewModules(),
dataObjectService.getView(ViewEnum.IHM_CONTROLE_REGLE) ));
Expand All @@ -77,7 +75,7 @@ public void putAllVObjects(ModelNorme model) {
putVObject(views.getViewExpression(), t -> initializeExpression(t, views.getViewJeuxDeRegles(), views.getViewModules(),
dataObjectService.getView(ViewEnum.IHM_EXPRESSION) ));
//
putVObject(views.getViewJeuxDeReglesCopie(), t -> initializeJeuxDeReglesCopie(t, views.getViewJeuxDeRegles(), views.getViewModules(),
putVObject(views.getViewJeuxDeReglesCopie(), t -> initializeJeuxDeReglesCopie(t,
dataObjectService.getView(ViewEnum.IHM_JEUDEREGLE) , getScope()));
}

Expand Down Expand Up @@ -185,10 +183,10 @@ public void initializeChargement(VObject viewChargement, VObject viewRulesSet, V
}

/**
* Initialize the {@link VObject} of a load ruleset. Only
* Initialize the {@link VObject} of a structurize ruleset. Only
* get the load rule link to the selected rule set.
*/
public void initializeNormage(VObject viewNormage, VObject viewRulesSet, VObject viewModules, String theTableName) {
public void initializeNormage(VObject viewNormage, VObject viewRulesSet, VObject viewModules) {
Map<String, List<String>> selection = viewRulesSet.mapContentSelected();
List<List<String>> moduleSelection =viewModules.listContentSelected();

Expand Down Expand Up @@ -225,8 +223,8 @@ public void initializeControle(VObject moduleView, VObject viewRulesSet, VObject
}

/**
* Initialize the {@link VObject} of the mapping rule. Only get the load
* rule link to the selected rule set.
* Initialize the {@link VObject} of the mapping rule. Only
* get the load rule link to the selected rule set.
*/
public void initializeMapping(VObject viewMapping, VObject viewRulesSet, VObject viewModules, String theTableName) {
Map<String, List<String>> selection = viewRulesSet.mapContentSelected();
Expand Down Expand Up @@ -285,8 +283,7 @@ public void initializeExpression(VObject moduleView, VObject viewRulesSet, VObje
*
* @param viewJeuxDeReglesCopie
*/
public void initializeJeuxDeReglesCopie(VObject viewJeuxDeReglesCopie, VObject viewRulesSet, VObject viewModules,
String theTableName, String scope) {
public void initializeJeuxDeReglesCopie(VObject viewJeuxDeReglesCopie, String theTableName, String scope) {
LoggerHelper.info(LOGGER, "initializeJeuxDeReglesCopie");
if (scope != null) {
ArcPreparedStatementBuilder requete = new ArcPreparedStatementBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ public String updateChargement(Model model) {
* @return
*/
public String sortChargement(Model model) {

this.vObjectService.sort(views.getViewChargement());
return generateDisplay(model, RESULT_SUCCESS);
return sortVobject(model, RESULT_SUCCESS, this.views.getViewChargement());
}

/**
Expand All @@ -69,6 +67,7 @@ public String sortChargement(Model model) {
* @return
*/
public String importChargement(Model model, MultipartFile fileUploadLoad) {

dao.uploadFileRule(views.getViewChargement(), views.getViewJeuxDeRegles(), fileUploadLoad);
return generateDisplay(model, RESULT_SUCCESS);
}
Expand Down
109 changes: 66 additions & 43 deletions arc-web/src/main/webapp/WEB-INF/jsp/gererNorme.jsp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%@ page
<%@ page
language="java"
contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"
Expand Down Expand Up @@ -92,9 +92,9 @@
<c:param name="ligneFilter" value ="true" />
<c:param name="checkbox" value ="true" />
<c:param name="checkboxVisible" value ="true" />
<c:param name="extraScopeAdd" value ="-viewChargement;-viewNormage;-viewControle;-viewMapping;-viewExpression;-viewJeuxDeReglesCopie;" />
<c:param name="extraScopeAdd" value ="-viewJeuxDeReglesCopie;" />
<c:param name="extraScopeDelete" value ="-viewModules;-viewChargement;-viewNormage;-viewControle;-viewMapping;-viewExpression;-viewJeuxDeReglesCopie;" />
<c:param name="extraScopeUpdate" value ="-viewChargement;-viewNormage;-viewControle;-viewMapping;-viewExpression;-viewJeuxDeReglesCopie;" />
<c:param name="extraScopeUpdate" value ="viewModules;viewChargement;viewNormage;viewControle;viewMapping;viewExpression;-viewJeuxDeReglesCopie;" />
<c:param name="extraScopeSee" value ="viewModules;viewChargement;viewNormage;viewControle;viewMapping;viewExpression;-viewJeuxDeReglesCopie;" />
<c:param name="otherButton">
<button
Expand Down Expand Up @@ -136,49 +136,56 @@
<c:param name="checkbox" value ="true" />
<c:param name="checkboxVisible" value ="true" />
<c:param name="multiSelection" value ="true" />
<c:param name="extraScopeAdd" value ="viewModules;" />
<c:param name="extraScopeDelete" value ="viewModules;" />
<c:param name="extraScopeUpdate" value ="viewModules;" />
<c:param name="extraScopeSee" value ="viewModules;" />
<c:param name="otherButton">

<input
class="btn btn-primary btn-sm"
id="viewChargement.truncate"
type="submit"
doAction="viderChargement"
scope="viewChargement;"
value="<spring:message code="gui.button.deleteRuleset"/>"
/>
<input
class="btn btn-primary btn-sm"
id="viewChargement.copie"
type="submit"
doAction="selectJeuxDeReglesChargementCopie"
scope="viewChargement;viewJeuxDeReglesCopie;"
value="<spring:message code="gui.button.replaceRuleset"/>"
/>
<c:if
test='${viewJeuxDeRegles.mapContentSelected().get("etat").get(0).toLowerCase().contains(".bas")}'
>
<input
class="btn btn-primary btn-sm"
id="viewChargement.truncate"
type="submit"
doAction="viderChargement"
scope="viewChargement;"
value="<spring:message code="gui.button.deleteRuleset"/>"
/>
<input
class="btn btn-primary btn-sm"
id="viewChargement.copie"
type="submit"
doAction="selectJeuxDeReglesChargementCopie"
scope="viewChargement;viewJeuxDeReglesCopie;"
value="<spring:message code="gui.button.replaceRuleset"/>"
/>

<div class="input-group my-3">
<div class="custom-file">
<input
name="fileUploadLoad"
type="file"
class="custom-file-input"
id="inputGroupFileLoad"
/> <label
class="custom-file-label"
for="inputGroupFileLoad"
aria-describedby="Choose file to upload for load module"
><spring:message code="general.chooseFile"/></label>
</div>
<div class="input-group-append">
<button
class="btn btn-primary btn-sm"
id="viewChargement.import"
type="submit"
doAction="importChargement"
scope="viewChargement;"
multipart="true"
><span class="fa fa-upload">&nbsp;</span> <spring:message code="gui.button.importRuleset"/></button>
<div class="input-group my-3">
<div class="custom-file">
<input
name="fileUploadLoad"
type="file"
class="custom-file-input"
id="inputGroupFileLoad"
/> <label
class="custom-file-label"
for="inputGroupFileLoad"
aria-describedby="Choose file to upload for load module"
><spring:message code="general.chooseFile"/></label>
</div>
<div class="input-group-append">
<button
class="btn btn-primary btn-sm"
id="viewChargement.import"
type="submit"
doAction="importChargement"
scope="viewChargement;"
multipart="true"
><span class="fa fa-upload">&nbsp;</span> <spring:message code="gui.button.importRuleset"/></button>
</div>
</div>
</div>
</c:if>
</c:param>
</c:import>

Expand All @@ -196,6 +203,10 @@
<c:param name="checkbox" value ="true" />
<c:param name="checkboxVisible" value ="true" />
<c:param name="multiSelection" value ="true" />
<c:param name="extraScopeAdd" value ="viewModules;" />
<c:param name="extraScopeDelete" value ="viewModules;" />
<c:param name="extraScopeUpdate" value ="viewModules;" />
<c:param name="extraScopeSee" value ="viewModules;" />
<c:param name="otherButton">
<c:if
test='${viewJeuxDeRegles.mapContentSelected().get("etat").get(0).toLowerCase().contains(".bas")}'
Expand Down Expand Up @@ -258,6 +269,10 @@
<c:param name="checkbox" value ="true" />
<c:param name="checkboxVisible" value ="true" />
<c:param name="multiSelection" value ="true" />
<c:param name="extraScopeAdd" value ="viewModules;" />
<c:param name="extraScopeDelete" value ="viewModules;" />
<c:param name="extraScopeUpdate" value ="viewModules;" />
<c:param name="extraScopeSee" value ="viewModules;" />
<c:param name="allowResize" value ="true" />
<c:param name="otherButton">
<c:if
Expand Down Expand Up @@ -318,6 +333,10 @@
<c:param name="checkbox" value ="true" />
<c:param name="checkboxVisible" value ="true" />
<c:param name="multiSelection" value ="true" />
<c:param name="extraScopeAdd" value ="viewModules;" />
<c:param name="extraScopeDelete" value ="viewModules;" />
<c:param name="extraScopeUpdate" value ="viewModules;" />
<c:param name="extraScopeSee" value ="viewModules;" />
<c:param name="allowResize" value ="true" />
<c:param name="otherButton">
<c:if
Expand Down Expand Up @@ -391,6 +410,10 @@
<c:param name="ligneFilter" value ="true" />
<c:param name="checkbox" value ="true" />
<c:param name="checkboxVisible" value ="true" />
<c:param name="extraScopeAdd" value ="viewModules;" />
<c:param name="extraScopeDelete" value ="viewModules;" />
<c:param name="extraScopeUpdate" value ="viewModules;" />
<c:param name="extraScopeSee" value ="viewModules;" />
<c:param name="allowResize" value ="true" />
<c:param name="otherButton">
<c:if
Expand Down

0 comments on commit d9b1fef

Please sign in to comment.