Skip to content

Commit

Permalink
fix: doc and comment in GererNormeDao
Browse files Browse the repository at this point in the history
  • Loading branch information
lmanelphe committed Jan 3, 2024
1 parent 340e428 commit 27560aa
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ public class GererNormeDao extends VObjectHelperDao {
/**
* dao call to build norm vobject
*
* @param viewObject
* @param viewNorme
* @param theTableName
*/
public void initializeViewNorme(VObject viewNorme) {

Expand All @@ -66,10 +64,7 @@ public void initializeViewNorme(VObject viewNorme) {
/**
* dao call to build calendar vobject
*
* @param viewObject
* @param viewCalendar
* @param theTableName
* @param selection
*/
public void initializeViewCalendar(VObject viewCalendar) {

Expand Down Expand Up @@ -144,7 +139,8 @@ public void initializeViewRulesSet(VObject viewRulesSet) {
/**
* dao call to build module menu vobject
*
* @param viewRulesSet
* @param viewModules
* @param functionGetModuleName
*/
public void initializeViewModules(VObject viewModules, Function<GuiModules, String> functionGetModuleName) {

Expand Down Expand Up @@ -363,7 +359,7 @@ public void initializeExpression(VObject viewExpression) {
/**
* Query to get ruleset view for copy
*
* @param viewExpression
* @param viewJeuxDeReglesCopie
*/
public void initializeJeuxDeReglesCopie(VObject viewJeuxDeReglesCopie) {

Expand All @@ -386,8 +382,9 @@ public void initializeJeuxDeReglesCopie(VObject viewJeuxDeReglesCopie) {
* generate a blank rules set for mapping based on variables declared in data
* model
*
* @param viewMapping
* @param viewNorme
* @param viewJeuxDeRegles
* @param viewMapping
* @throws ArcException
*/
public void execQueryPreGenererRegleMapping(VObject viewNorme, VObject viewJeuxDeRegles, VObject viewMapping)
Expand Down Expand Up @@ -509,8 +506,8 @@ public void execQueryCopieJeuxDeRegles(VObject viewJeuxDeRegles, VObject viewJeu
/**
* Empty all the rules of a norm module
*
* @param viewRulesSet
* @param table
* @return
* @throws ArcException
*/
public void emptyRuleTable(VObject viewRulesSet, String table) throws ArcException {
Expand All @@ -534,9 +531,12 @@ public void emptyRuleTable(VObject viewRulesSet, String table) throws ArcExcepti
}

/**
* Upload module rules for a rule set of a norm family. Upload for mapping rules
* uses {@code uploadFileMapping} method.
*
* @param vObjectToUpdate the vObject to update with file
* @param tableName the
* @param viewRulesSet the ruleset vObject, used to get the selected ruleset
* @param theFileToUpload the file uploaded by the user
*/
public void uploadFileRule(VObject vObjectToUpdate, VObject viewRulesSet, MultipartFile theFileToUpload) {

Expand Down Expand Up @@ -624,12 +624,14 @@ public void uploadFileRule(VObject vObjectToUpdate, VObject viewRulesSet, Multip
}

/**
* Upload mapping rules for a rule set of a norm module. The upload method for
* Upload mapping rules for a rule set of a norm family. The upload method for
* mapping rules is different because it needs to ensure that mapping rules
* remain consistent with the norm family
*
* @param vObjectToUpdate the vObject to update with file
* @param tableName the
* @param viewMapping the mapping vObject to update with file
* @param viewRulesSet the ruleset vObject, used to get the selected ruleset
* @param viewNorme the norme vObject, used to pregenerate mapping rules
* @param theFileToUpload the file uploaded by the user
*/
public void uploadFileMapping(VObject viewMapping, VObject viewRulesSet, VObject viewNorme,
MultipartFile theFileToUpload) {
Expand Down Expand Up @@ -659,6 +661,18 @@ public void uploadFileMapping(VObject viewMapping, VObject viewRulesSet, VObject
}
}

/**
* Copies the mapping rules file given by the user into a temporary table.
* Exceptions that might be thrown because of the file given by the user
* are dealt here to avoid deleting and regenerating the rules in the
* database for nothing
*
* @param viewMapping the mapping vObject to update with file
* @param theFileToUpload the file uploaded by the user
* @return the name of the temporary table
* @throws IOException
* @throws ArcException
*/
private String copyFileIntoTemporaryTable(VObject viewMapping, MultipartFile theFileToUpload)
throws IOException, ArcException {
// A file -> can process it
Expand Down Expand Up @@ -728,6 +742,15 @@ private String copyFileIntoTemporaryTable(VObject viewMapping, MultipartFile the

}

/**
* Update the mapping rules with data from the temporary table, then drops
* the temporary table
*
* @param viewMapping the mapping vObject to update with file
* @param viewRulesSet the ruleset vObject, used to get the selected ruleset
* @param nomTableImage the name of the temporary table
* @throws ArcException
*/
private void copyTemporaryTableToRuleTable(VObject viewMapping, VObject viewRulesSet, String nomTableImage)
throws ArcException {
LoggerHelper.debug(LOGGER, "Insert file in the " + nomTableImage + " table");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void initializeViewNorme() {

assertEquals(0, viewColumns.size());

// in test data, must return two norms
// in test data, must return one norm
assertEquals(1, viewNorme.getContent().t.size());

}
Expand Down

0 comments on commit 27560aa

Please sign in to comment.