diff --git a/src/main/java/org/mdbenefits/app/config/DocUploadDisabledHandlerConfiguration.java b/src/main/java/org/mdbenefits/app/config/DocUploadDisabledHandlerConfiguration.java deleted file mode 100644 index 47626a19..00000000 --- a/src/main/java/org/mdbenefits/app/config/DocUploadDisabledHandlerConfiguration.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.mdbenefits.app.config; - -import formflow.library.data.SubmissionRepositoryService; -import org.mdbenefits.app.interceptors.DocUploadDisabledInterceptor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.MessageSource; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -import java.util.Locale; - -@Configuration -public class DocUploadDisabledHandlerConfiguration implements WebMvcConfigurer { - @Autowired - SubmissionRepositoryService submissionRepositoryService; - - @Autowired - MessageSource messageSource; - - Locale locale; - - @Override - public void addInterceptors(InterceptorRegistry registry) { - registry.addInterceptor(new DocUploadDisabledInterceptor(this.submissionRepositoryService, this.messageSource, locale)).addPathPatterns(DocUploadDisabledInterceptor.PATH_FORMAT); - } -} diff --git a/src/main/java/org/mdbenefits/app/interceptors/DocUploadDisabledInterceptor.java b/src/main/java/org/mdbenefits/app/interceptors/DocUploadDisabledInterceptor.java deleted file mode 100644 index 6c15a92c..00000000 --- a/src/main/java/org/mdbenefits/app/interceptors/DocUploadDisabledInterceptor.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.mdbenefits.app.interceptors; - -import formflow.library.FormFlowController; -import formflow.library.data.SubmissionRepositoryService; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import lombok.extern.slf4j.Slf4j; -import org.mdbenefits.app.utils.SubmissionUtilities; -import org.springframework.context.MessageSource; -import org.springframework.util.AntPathMatcher; -import org.springframework.web.servlet.FlashMap; -import org.springframework.web.servlet.HandlerInterceptor; -import org.springframework.web.servlet.support.RequestContextUtils; - -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.UUID; - -@Slf4j -public class DocUploadDisabledInterceptor implements HandlerInterceptor { - - public static final String PATH_FORMAT = "/flow/{flow}/{screen}"; - - private final SubmissionRepositoryService submissionRepositoryService; - - private final MessageSource messageSource; - - private final Locale locale; - - private final String redirectUrl = "/flow/mdBenefitsFlow/confirmation"; - public static List docUploadScreens = List.of( - "docUploadIntro", "docUploadSignpost", "docUploadInstructions", - "docUploadRecommendations", "docUpload", "docUploadType", "docUploadReview", - "docUploadSubmit" - ); - - - public DocUploadDisabledInterceptor(SubmissionRepositoryService submissionRepositoryService, MessageSource messageSource, Locale locale) { - this.submissionRepositoryService = submissionRepositoryService; - this.messageSource = messageSource; - this.locale = locale; - } - - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception{ - try { - var parsedUrl = new AntPathMatcher().extractUriTemplateVariables(PATH_FORMAT, request.getRequestURI()); - FlashMap outputFlashMap = RequestContextUtils.getOutputFlashMap(request); // use this to populate messages - if (!parsedUrl.get("flow").equals("mdBenefitsFlow")){ - return true; - } - if (docUploadScreens.contains(parsedUrl.get("screen"))){ - var session = request.getSession(false); - if (session == null) { - return false; - } - Map submissionMap = (Map)session.getAttribute(FormFlowController.SUBMISSION_MAP_NAME); - UUID submissionId = null; - - if (submissionMap != null && submissionMap.get(parsedUrl.get("flow")) != null) { - submissionId = submissionMap.get(parsedUrl.get("flow")); - if (submissionId != null) { - var submissionMaybe = this.submissionRepositoryService.findById(submissionId); - if (submissionMaybe.isPresent()) { - var submission = submissionMaybe.get(); - var inputData = submission.getInputData(); - // TODO: the output flash map could use the same key for all of them - would simplify the template and logic a bit. But would make it harder to isolate conditions in testing. - if (inputData.containsKey("addDocuments")){ - // user tried to go back via browser after indicating they didn't want to add documents - if (inputData.get("addDocuments").equals("false")){ - outputFlashMap.put("addDocumentsSkipped", messageSource.getMessage("general.locked-submission", null, locale)); - RequestContextUtils.saveOutputFlashMap(redirectUrl, request, response); - response.sendRedirect(redirectUrl); - } else { - // user indicated to add documents and the time has expired (2 hours post submission) - if(!SubmissionUtilities.isDocUploadActive(submission)){ - outputFlashMap.put("docUploadExpired", messageSource.getMessage("general.locked-submission", null, locale)); - RequestContextUtils.saveOutputFlashMap(redirectUrl, request, response); - response.sendRedirect(redirectUrl); - } - - // the user already added documents and submitted them (cannot go back) - else if (inputData.containsKey("docUploadFinalized")){ - outputFlashMap.put("docUploadFinalized", messageSource.getMessage("general.locked-submission", null, locale)); - RequestContextUtils.saveOutputFlashMap(redirectUrl, request, response); - response.sendRedirect(redirectUrl); - } - } - } - } else { - log.error("Submission %s not found in database".formatted(submissionId)); - return false; - } - } else { - log.error("No submission ID in session"); - return false; - } - } - } - return true; - } catch (IllegalStateException e){ - return true; - } - } -} diff --git a/src/main/java/org/mdbenefits/app/submission/actions/SetExperimentGroups.java b/src/main/java/org/mdbenefits/app/submission/actions/SetExperimentGroups.java deleted file mode 100644 index 6006ff07..00000000 --- a/src/main/java/org/mdbenefits/app/submission/actions/SetExperimentGroups.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.mdbenefits.app.submission.actions; - -import formflow.library.config.submission.Action; -import formflow.library.data.Submission; -import org.mdbenefits.app.utils.SubmissionUtilities; -import org.springframework.stereotype.Component; -import java.util.Random; - - -@Component -public class SetExperimentGroups implements Action { - - public enum ExperimentGroup { - CONTROL, - LINK, - APPLY - } - - @Override - public void run(Submission submission) { - if (SubmissionUtilities.isEligibleForExperiment(submission)) { - Random rand = new Random(); - int group = rand.nextInt(3); - switch (group) { - case 0 -> submission.getInputData().put("experimentGroup", ExperimentGroup.CONTROL); - case 1 -> submission.getInputData().put("experimentGroup", ExperimentGroup.LINK); - case 2 -> submission.getInputData().put("experimentGroup", ExperimentGroup.APPLY); - } - } - } - -} diff --git a/src/main/java/org/mdbenefits/app/submission/conditions/EligibleForNolaWicEceApply.java b/src/main/java/org/mdbenefits/app/submission/conditions/EligibleForNolaWicEceApply.java index b0fc557e..fbd646c8 100644 --- a/src/main/java/org/mdbenefits/app/submission/conditions/EligibleForNolaWicEceApply.java +++ b/src/main/java/org/mdbenefits/app/submission/conditions/EligibleForNolaWicEceApply.java @@ -4,8 +4,6 @@ import formflow.library.data.Submission; import org.springframework.stereotype.Component; -import static org.mdbenefits.app.submission.actions.SetExperimentGroups.ExperimentGroup.APPLY; -import static org.mdbenefits.app.utils.SubmissionUtilities.inExperimentGroup; import static org.mdbenefits.app.utils.SubmissionUtilities.isNolaParish; @Component @@ -13,6 +11,6 @@ public class EligibleForNolaWicEceApply implements Condition { @Override public Boolean run(Submission submission) { - return isNolaParish(submission) && inExperimentGroup(APPLY.name(), submission); + return isNolaParish(submission); } } diff --git a/src/main/java/org/mdbenefits/app/submission/conditions/EligibleForNolaWicEceLinks.java b/src/main/java/org/mdbenefits/app/submission/conditions/EligibleForNolaWicEceLinks.java index 9f2f188f..91b0ba48 100644 --- a/src/main/java/org/mdbenefits/app/submission/conditions/EligibleForNolaWicEceLinks.java +++ b/src/main/java/org/mdbenefits/app/submission/conditions/EligibleForNolaWicEceLinks.java @@ -4,8 +4,6 @@ import formflow.library.data.Submission; import org.springframework.stereotype.Component; -import static org.mdbenefits.app.submission.actions.SetExperimentGroups.ExperimentGroup.LINK; -import static org.mdbenefits.app.utils.SubmissionUtilities.inExperimentGroup; import static org.mdbenefits.app.utils.SubmissionUtilities.isNolaParish; @Component @@ -13,6 +11,6 @@ public class EligibleForNolaWicEceLinks implements Condition { @Override public Boolean run(Submission submission) { - return isNolaParish(submission) && inExperimentGroup(LINK.name(), submission); + return isNolaParish(submission); } } diff --git a/src/main/java/org/mdbenefits/app/submission/conditions/EligibleForOutsideNolaWicApply.java b/src/main/java/org/mdbenefits/app/submission/conditions/EligibleForOutsideNolaWicApply.java index 7f2dec22..f8f7e73e 100644 --- a/src/main/java/org/mdbenefits/app/submission/conditions/EligibleForOutsideNolaWicApply.java +++ b/src/main/java/org/mdbenefits/app/submission/conditions/EligibleForOutsideNolaWicApply.java @@ -4,8 +4,6 @@ import formflow.library.data.Submission; import org.springframework.stereotype.Component; -import static org.mdbenefits.app.submission.actions.SetExperimentGroups.ExperimentGroup.APPLY; -import static org.mdbenefits.app.utils.SubmissionUtilities.inExperimentGroup; import static org.mdbenefits.app.utils.SubmissionUtilities.isNolaParish; @Component @@ -13,6 +11,6 @@ public class EligibleForOutsideNolaWicApply implements Condition { @Override public Boolean run(Submission submission) { - return !isNolaParish(submission) && inExperimentGroup(APPLY.name(), submission); + return !isNolaParish(submission); } } diff --git a/src/main/java/org/mdbenefits/app/submission/conditions/EligibleForOutsideNolaWicLinks.java b/src/main/java/org/mdbenefits/app/submission/conditions/EligibleForOutsideNolaWicLinks.java index a04c92d0..e6588ee5 100644 --- a/src/main/java/org/mdbenefits/app/submission/conditions/EligibleForOutsideNolaWicLinks.java +++ b/src/main/java/org/mdbenefits/app/submission/conditions/EligibleForOutsideNolaWicLinks.java @@ -4,8 +4,6 @@ import formflow.library.data.Submission; import org.springframework.stereotype.Component; -import static org.mdbenefits.app.submission.actions.SetExperimentGroups.ExperimentGroup.LINK; -import static org.mdbenefits.app.utils.SubmissionUtilities.inExperimentGroup; import static org.mdbenefits.app.utils.SubmissionUtilities.isNolaParish; @Component @@ -13,6 +11,6 @@ public class EligibleForOutsideNolaWicLinks implements Condition { @Override public Boolean run(Submission submission) { - return !isNolaParish(submission) && inExperimentGroup(LINK.name(), submission); + return !isNolaParish(submission); } } diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index d27f188b..d2f03005 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -54,6 +54,12 @@ spring: demo: - demo - form-flow-library + staging: + - staging + - form-flow-library + prod: + - prod + - form-flow-library security: user: name: ${DEFAULT_USER} diff --git a/src/main/resources/db/migration/V1_1__submission_add_blank_rpa_status_column.sql b/src/main/resources/db/migration/V1_1__submission_add_blank_rpa_status_column.sql deleted file mode 100644 index acc2c6c7..00000000 --- a/src/main/resources/db/migration/V1_1__submission_add_blank_rpa_status_column.sql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE TYPE rpa_status_type AS ENUM('NotReady', 'Ready', 'InProgress', 'Failed', 'Complete'); -ALTER TABLE submissions ADD COLUMN rpa_status rpa_status_type; \ No newline at end of file diff --git a/src/main/resources/db/migration/V2023.12.15.14.23.41__update_doc_type_label_default.sql b/src/main/resources/db/migration/V2023.12.15.14.23.41__update_doc_type_label_default.sql deleted file mode 100644 index 0e3a4725..00000000 --- a/src/main/resources/db/migration/V2023.12.15.14.23.41__update_doc_type_label_default.sql +++ /dev/null @@ -1 +0,0 @@ -UPDATE user_files SET doc_type_label='${user_file_doc_type_default_label}'; \ No newline at end of file diff --git a/src/main/resources/db/migration/V2023.7.12__add_user_file_status.sql b/src/main/resources/db/migration/V2023.7.12__add_user_file_status.sql deleted file mode 100644 index 0f73d3e8..00000000 --- a/src/main/resources/db/migration/V2023.7.12__add_user_file_status.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE user_files ADD COLUMN rpa_status rpa_status_type; -ALTER TABLE user_files ADD COLUMN rpa_status_description VARCHAR(50); -ALTER TABLE user_files ADD COLUMN rpa_critical_failure BOOLEAN DEFAULT false; \ No newline at end of file diff --git a/src/main/resources/db/migration/V2023.7.13__modify_rpa_schema.sql b/src/main/resources/db/migration/V2023.7.13__modify_rpa_schema.sql deleted file mode 100644 index db1a4594..00000000 --- a/src/main/resources/db/migration/V2023.7.13__modify_rpa_schema.sql +++ /dev/null @@ -1,4 +0,0 @@ -ALTER TYPE rpa_status_type ADD VALUE 'CriticalFailure'; -ALTER TABLE user_files DROP COLUMN rpa_critical_failure; -ALTER TABLE user_files ADD COLUMN rpa_process_start_time DATE; -ALTER TABLE user_files ADD COLUMN rpa_process_end_time DATE; \ No newline at end of file diff --git a/src/main/resources/db/migration/V2023.7.31__change_dates_to_timestamp.sql b/src/main/resources/db/migration/V2023.7.31__change_dates_to_timestamp.sql deleted file mode 100644 index 360c8b23..00000000 --- a/src/main/resources/db/migration/V2023.7.31__change_dates_to_timestamp.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE user_files -ALTER COLUMN rpa_process_start_time TYPE TIMESTAMP WITHOUT TIME ZONE, -ALTER COLUMN rpa_process_end_time TYPE TIMESTAMP WITHOUT TIME ZONE; \ No newline at end of file diff --git a/src/main/resources/flows-config.yaml b/src/main/resources/flows-config.yaml index 04562d59..0072a5e2 100644 --- a/src/main/resources/flows-config.yaml +++ b/src/main/resources/flows-config.yaml @@ -131,7 +131,6 @@ flow: nextScreens: - name: householdPregnancy householdPregnancy: - beforeSaveAction: SetExperimentGroups nextScreens: - name: householdPregnancyWho condition: IsPregnant diff --git a/src/main/resources/templates/mdBenefitsFlow/wicLinks.html b/src/main/resources/templates/mdBenefitsFlow/wicLinks.html index 59199367..31d8cec5 100644 --- a/src/main/resources/templates/mdBenefitsFlow/wicLinks.html +++ b/src/main/resources/templates/mdBenefitsFlow/wicLinks.html @@ -16,8 +16,8 @@ - + th:replace="~{fragments/form :: form(action=(${formAction}), content=~{::content})}"> +