-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adjust lunatic parameters (#752)
* refactor: proper class for lunatic parameters * test(parameters): new specs * feat(parameters): parametrized file name * feat(parameters): adjustments with new specs * chore: bump version
- Loading branch information
Showing
8 changed files
with
135 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
eno-core/src/main/java/fr/insee/eno/core/parameter/LunaticParameters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package fr.insee.eno.core.parameter; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
public class LunaticParameters { | ||
|
||
private boolean controls; | ||
private boolean toolTip; // Not implemented yet in Lunatic | ||
private boolean missingVariables; | ||
private boolean filterResult; | ||
private boolean filterDescription; | ||
private EnoParameters.LunaticPaginationMode lunaticPaginationMode; | ||
|
||
private LunaticParameters() {} | ||
|
||
public static LunaticParameters emptyValues() { | ||
return new LunaticParameters(); | ||
} | ||
|
||
public static LunaticParameters of(EnoParameters.Context context, EnoParameters.ModeParameter modeParameter) { | ||
LunaticParameters parameters = new LunaticParameters(); | ||
parameters.lunaticValues(context, modeParameter); | ||
return parameters; | ||
} | ||
|
||
private void lunaticValues(EnoParameters.Context context, EnoParameters.ModeParameter modeParameter) { | ||
// | ||
if (EnoParameters.ModeParameter.PAPI.equals(modeParameter)) | ||
throw new IllegalArgumentException("Mode 'PAPI' is not compatible with Lunatic format."); | ||
// | ||
boolean isInterview = EnoParameters.ModeParameter.CAPI.equals(modeParameter) || EnoParameters.ModeParameter.CATI.equals(modeParameter); | ||
boolean isWeb = EnoParameters.ModeParameter.CAWI.equals(modeParameter); | ||
boolean isProcess = EnoParameters.ModeParameter.PROCESS.equals(modeParameter); | ||
this.setControls(isWeb || isProcess); | ||
this.setToolTip(isWeb || isProcess); | ||
this.setFilterDescription(isProcess); | ||
this.setFilterResult(isWeb); | ||
this.setMissingVariables(isInterview); | ||
this.setLunaticPaginationMode( | ||
EnoParameters.Context.BUSINESS.equals(context) ? | ||
EnoParameters.LunaticPaginationMode.SEQUENCE : | ||
EnoParameters.LunaticPaginationMode.NONE); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters