Skip to content

Commit

Permalink
bug fix in normage service
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolife999 committed Feb 9, 2023
1 parent 6082f4d commit 225864d
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public enum ViewEnum {

, VIEW_MODULE("view_module",false,ColumnEnum.MODULE_ORDER,ColumnEnum.MODULE_NAME)

, IHM_CHARGEMENT_REGLE("ihm_chargement_regle", false, ColumnEnum.ID_REGLE, ColumnEnum.ID_NORME, ColumnEnum.VALIDITE_INF, ColumnEnum.VALIDITE_SUP, ColumnEnum.VERSION, ColumnEnum.PERIODICITE, ColumnEnum.TYPE_FICHIER, ColumnEnum.DELIMITER, ColumnEnum.FORMAT, ColumnEnum.COMMENTAIRE)
, IHM_CHARGEMENT_REGLE("ihm_chargement_regle", false, ColumnEnum.ID_NORME, ColumnEnum.PERIODICITE, ColumnEnum.VALIDITE_INF, ColumnEnum.VALIDITE_SUP, ColumnEnum.VERSION, ColumnEnum.ID_REGLE, ColumnEnum.TYPE_FICHIER, ColumnEnum.DELIMITER, ColumnEnum.FORMAT, ColumnEnum.COMMENTAIRE)
, IHM_NORMAGE_REGLE("ihm_normage_regle", false, ColumnEnum.ID_NORME, ColumnEnum.PERIODICITE, ColumnEnum.VALIDITE_INF, ColumnEnum.VALIDITE_SUP, ColumnEnum.VERSION, ColumnEnum.ID_CLASSE, ColumnEnum.RUBRIQUE, ColumnEnum.RUBRIQUE_NMCL, ColumnEnum.ID_REGLE, ColumnEnum.TODO, ColumnEnum.COMMENTAIRE)
, IHM_CONTROLE_REGLE("ihm_controle_regle", false, ColumnEnum.ID_NORME, ColumnEnum.PERIODICITE, ColumnEnum.VALIDITE_INF, ColumnEnum.VALIDITE_SUP, ColumnEnum.VERSION, ColumnEnum.ID_CLASSE, ColumnEnum.RUBRIQUE_PERE, ColumnEnum.RUBRIQUE_FILS, ColumnEnum.BORNE_INF, ColumnEnum.BORNE_SUP, ColumnEnum.CONDITION, ColumnEnum.PRE_ACTION, ColumnEnum.ID_REGLE, ColumnEnum.TODO, ColumnEnum.COMMENTAIRE, ColumnEnum.XSD_ORDRE, ColumnEnum.XSD_LABEL_FILS, ColumnEnum.XSD_ROLE, ColumnEnum.BLOCKING_THRESHOLD, ColumnEnum.ERROR_ROW_PROCESSING)
, IHM_FILTRAGE_REGLE("ihm_filtrage_regle", false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,35 @@ private ArcPreparedStatementBuilder moduleQuery(int moduleIndex, GuiModules modu

return query;
}


public void initializeViewChargement(VObject viewChargement) {

ViewEnum dataModelChargement = ViewEnum.IHM_CHARGEMENT_REGLE;

ArcPreparedStatementBuilder query = new ArcPreparedStatementBuilder();

query.append(SQL.SELECT);
query.append(query.sqlListeOfColumnsFromModel(dataModelChargement));
query.append(SQL.FROM);
query.append(dataObjectService.getView(dataModelChargement));
query.append(SQL.WHERE);
query.append(sqlEqualWithFirstSelectedRecord(ColumnEnum.ID_NORME));
query.append(SQL.AND);
query.append(sqlEqualWithFirstSelectedRecord(ColumnEnum.PERIODICITE));
query.append(SQL.AND);
query.append(sqlEqualWithFirstSelectedRecord(ColumnEnum.VALIDITE_INF));
query.append(SQL.AND);
query.append(sqlEqualWithFirstSelectedRecord(ColumnEnum.VALIDITE_SUP));
query.append(SQL.AND);
query.append(sqlEqualWithFirstSelectedRecord(ColumnEnum.VERSION));

// build the default value when adding a record
HashMap<String, String> defaultInputFields = buildDefaultInputFieldsWithFirstSelectedRecord(ColumnEnum.ID_NORME,
ColumnEnum.PERIODICITE, ColumnEnum.VALIDITE_INF, ColumnEnum.VALIDITE_SUP, ColumnEnum.VERSION);

vObjectService.initialize(viewChargement, query, dataObjectService.getView(dataModelChargement), defaultInputFields);

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -187,25 +187,23 @@ public void initializeViewModules(VObject viewModules, VObject viewRulesSet) {
* Initialize the {@link VObject} of a load ruleset. Only
* get the load rule link to the selected rule set.
*/
public void initializeChargement(VObject moduleView, VObject viewRulesSet, VObject viewModules, String theTableName) {
Map<String, ArrayList<String>> selection = viewRulesSet.mapContentSelected();
public void initializeChargement(VObject viewChargement, VObject viewRulesSet, VObject viewModules, String theTableName) {


Map<String, ArrayList<String>> viewRulesSetSelectedRecords = viewRulesSet.mapContentSelected();
ArrayList<ArrayList<String>> moduleSelection =viewModules.listContentSelected();

if (!selection.isEmpty() && !moduleSelection.isEmpty()
if (!viewRulesSetSelectedRecords.isEmpty() && !moduleSelection.isEmpty()
&& moduleSelection.get(0).get(1).equals(moduleIdentifier(GuiModules.load)))
{
HashMap<String, String> type = viewRulesSet.mapHeadersType();
ArcPreparedStatementBuilder requete = new ArcPreparedStatementBuilder();
requete.append("select id_norme,periodicite,validite_inf,validite_sup,version,id_regle,type_fichier, delimiter, format, commentaire from arc.ihm_chargement_regle");
whereRuleSetEquals(requete, selection, type);

vObjectService.initialize(moduleView, requete, theTableName, defaultRuleInputFields(selection));
dao.setSelectedRecords(viewRulesSetSelectedRecords);
dao.initializeViewChargement(viewChargement);

} else {
vObjectService.destroy(moduleView);
vObjectService.destroy(viewChargement);
}
}


/**
* Initialize the {@link VObject} of a load ruleset. Only
* get the load rule link to the selected rule set.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public String selectNormage(Model model) {
* @return success
*/
public String addNormage(Model model) {
return addLineVobject(model, RESULT_SUCCESS, this.views.getViewMapping());
return addLineVobject(model, RESULT_SUCCESS, this.views.getViewNormage());
}

/**
Expand All @@ -48,7 +48,7 @@ public String addNormage(Model model) {
* @return
*/
public String deleteNormage(Model model) {
return deleteLineVobject(model, RESULT_SUCCESS, this.views.getViewMapping());
return deleteLineVobject(model, RESULT_SUCCESS, this.views.getViewNormage());
}

/**
Expand All @@ -58,7 +58,7 @@ public String deleteNormage(Model model) {
* @return
*/
public String updateNormage(Model model) {
return updateVobject(model, RESULT_SUCCESS, this.views.getViewMapping());
return updateVobject(model, RESULT_SUCCESS, this.views.getViewNormage());
}

/**
Expand All @@ -68,7 +68,7 @@ public String updateNormage(Model model) {
*/

public String sortNormage(Model model) {
return sortVobject(model, RESULT_SUCCESS, this.views.getViewMapping());
return sortVobject(model, RESULT_SUCCESS, this.views.getViewNormage());
}

/**
Expand Down

0 comments on commit 225864d

Please sign in to comment.