+ * Called from Kit Classes, this method adds the kit event to the EVENT_QUEUE table and triggers the Dss for the event. + * If the event is skipped for this participant, the event will not be triggered, just added into the EVENT_QUEUE table. + *
+ * The event that is sent to DSS has the ddpKitRequestId as the eventInfo, however, the event that is added to the + * EVENT_QUEUE table will have the dsmKitRequestId as the eventInfo. + *
+ * @param kitDDPNotification - the kit event to be triggered + * */ + public static void sendKitEventToDss(@NonNull KitDDPNotification kitDDPNotification) { + boolean dssSuccessfullyTriggered = false; + if (isParticipantEventSkipped(kitDDPNotification)) { + logger.info("Participant event was skipped per data in participant_event table. DDP will not get triggered"); + } else { + dssSuccessfullyTriggered = triggerDssByKitEvent(kitDDPNotification); + } + addKitEvent(kitDDPNotification.getEventName(), kitDDPNotification.getDdpInstanceId(), + kitDDPNotification.getDsmKitRequestId(), dssSuccessfullyTriggered); + } + + /** + * Returns true if this event is skipped for this participant, false otherwise + * */ + private static boolean isParticipantEventSkipped(KitDDPNotification kitDDPNotification) { + return skippedParticipantEventDao.isParticipantEventSkipped(kitDDPNotification.getParticipantId(), + kitDDPNotification.getEventName(), kitDDPNotification.getDdpInstanceId()); + } + + /** + * Called in ClinicalKitDao and BasePatch classes, this method adds the participant event to the EVENT_QUEUE table + * and triggers the Dss for the event. + * The Only participant_event currently in DSM is "REQUIRED_SAMPLES_RECEIVED" for PE-CGS studies + * */ + public static void sendParticipantEventToDss(String eventName, DDPInstance ddpInstance, @NotNull String ddpParticipantId) { + int ddpInstanceId = ddpInstance.getDdpInstanceIdAsInt(); + if (!skippedParticipantEventDao.isParticipantEventSkipped(ddpParticipantId, eventName, ddpInstanceId)) { + boolean dssSuccessfullyTriggered = triggerDssWithEvent(eventName, ddpInstance, System.currentTimeMillis() / 1000, + ddpParticipantId, ddpParticipantId, KitReasonType.NORMAL); + addParticipantEvent(eventName, ddpInstanceId, ddpParticipantId, dssSuccessfullyTriggered); + } else { + logger.info("Participant event was skipped for event %s for participant %s ".formatted(eventName, ddpParticipantId) + .concat("based on participant_event table. Dss will not get triggered")); + //add this event to the EVENT_QUEUE table, but without triggering dss and flag EVENT_TRIGGERED = false + addParticipantEvent(eventName, ddpInstanceId, ddpParticipantId, false); + } + } + + /** + * Sends a POST request to DSS to trigger the event for a kit, using the information in the KitDDPNotification object. + * */ + @VisibleForTesting + protected static boolean triggerDssByKitEvent(KitDDPNotification kitDDPNotification) { + DDPInstance ddpInstance = DDPInstance.getDDPInstanceById(kitDDPNotification.getDdpInstanceId()); + return triggerDssWithEvent(kitDDPNotification.getEventName(), ddpInstance, + kitDDPNotification.getDate() / 1000, kitDDPNotification.getParticipantId(), + kitDDPNotification.getDdpKitRequestId(), kitDDPNotification.getUploadReason()); + } + + /** + * Tries to send a POST request to DSS to trigger the event for a kit or a participant, + * It will try MAX_TRIES times before giving up and adding the event to the EVENT_QUEUE table. + * @param eventType - the type of event to be triggered, e.g. "SALIVA_RECEIVED" + * @param eventInfo - the information to be sent in the event, for kit events it is the "ddp_kit_request_id", + * and for participant events it is the ddp_participant_id + * @return true if the request was successful, false otherwise + * */ + @VisibleForTesting + protected static boolean triggerDssWithEvent(@NonNull String eventType, DDPInstance ddpInstance, long eventDate, + @NotNull String ddpParticipantId, @NotNull String eventInfo, KitReasonType reason) { + final long initialInterval = 500; // base delay in milliseconds + final double multiplier = 2.0; // exponential backoff multiplier + + IntervalFunction intervalFn = IntervalFunction.ofExponentialBackoff(initialInterval, multiplier); + RetryConfig retryConfig = RetryConfig.custom() + .maxAttempts(MAX_TRIES) + .intervalFunction(intervalFn) + .build(); + Retry retry = Retry.of("triggerDssWithEvent", retryConfig); + retry.getEventPublisher() + .onRetry(event -> logger.warn("{}", event)); + Callable- * This class has methods to set up a Juniper study in DSM database. - * It creates the instance, group, instance_role, kit_type, carrier, - * kit_dimensions, kit_return and ddp_kit_request_settings for the - * newly created study. - * It also contains methods to delete what was set up after tests are complete - *
- *- * The usage is by first creating an instance of this class by declaring the desired instance name and study guid, - * display name and collaborator prefix. - * Then call setupJuniperInstanceAndSettings() for initiating all the config in database. - *When done, call deleteJuniperInstanceAndSettings() to delete everything - *
- */ -@Slf4j -public class JuniperTestSetupUtil { - private static final String SELECT_INSTANCE_ROLE = "SELECT instance_role_id FROM instance_role WHERE name = 'juniper_study';"; - private static final String INSERT_DDP_INSTANCE_ROLE = "INSERT INTO ddp_instance_role (ddp_instance_id, instance_role_id) " - + " VALUES (?, ?) ON DUPLICATE KEY UPDATE instance_role_id = ?;"; - private static final String SELECT_KIT_TYPE_ID = "SELECT kit_type_id FROM kit_type WHERE kit_type_name = ?"; - private static final String INSERT_KIT_DIMENSION = "INSERT INTO kit_dimension (kit_width, kit_height, kit_length, kit_weight) " - + " VALUES ('6.9', '1.3', '5.2', '3.2') ON DUPLICATE KEY UPDATE kit_width = '6.9';"; - private static final String INSERT_KIT_RETURN = "INSERT INTO kit_return_information (return_address_name, return_address_phone) " - + " VALUES ('Broad Institute', '1111112222') ON DUPLICATE KEY UPDATE return_address_name = 'Broad Institute';"; - private static final String INSERT_CARRIER = "INSERT INTO carrier_service (carrier, service) " - + " VALUES ('FedEx', 'FEDEX_2_DAY') ON DUPLICATE KEY UPDATE carrier = 'FedEx';"; - private static final String INSERT_DDP_KIT_REQUEST_SETTINGS = - "INSERT INTO ddp_kit_request_settings (ddp_instance_id, kit_type_id, kit_return_id, carrier_service_to_id, kit_dimension_id) " - + " VALUES (?, ?, ?, ?, ?) ;"; - private static final String SELECT_DSM_KIT_REQUEST_ID = "SELECT dsm_kit_request_id from ddp_kit_request where ddp_kit_request_id = ?"; - private static final UserAdminTestUtil adminUtil = new UserAdminTestUtil(); - public static String ddpGroupId; - public static String ddpInstanceId; - public static String ddpInstanceGroupId; - public static String instanceRoleId; - public static String ddpInstanceRoleId; - private static String kitTypeId; - private static String kitDimensionId; - private static String kitReturnId; - private static String carrierId; - private static String ddpKitRequestSettingsId; - private static String instanceName; - private static String groupName; - private static String studyGuid; - private static String displayName; - private static String collaboratorPrefix; - private static String userWithKitShippingAccess; - - private static NotificationUtil notificationUtil; - - public JuniperTestSetupUtil(String instanceName, String studyGuid, String displayName, String collaboratorPrefix, String groupName) { - this.instanceName = instanceName; - this.studyGuid = studyGuid; - this.displayName = displayName; - this.collaboratorPrefix = collaboratorPrefix; - this.groupName = groupName; - } - - public void setupJuniperInstanceAndSettings() { - //everything should get inserted in one transaction - SimpleResult results = inTransaction((conn) -> { - SimpleResult simpleResult = new SimpleResult(); - try { - adminUtil.createRealmAndStudyGroup(instanceName, studyGuid, collaboratorPrefix, groupName, null); - ddpInstanceId = String.valueOf(adminUtil.getDdpInstanceId()); - ddpGroupId = String.valueOf(adminUtil.getStudyGroupId()); - instanceRoleId = getInstanceRole(conn); - ddpInstanceRoleId = createDdpInstanceRole(conn); - kitTypeId = getKitTypeId(conn); - kitDimensionId = createKitDimension(conn); - kitReturnId = createKitReturnInformation(conn); - carrierId = createCarrierInformation(conn); - ddpKitRequestSettingsId = createKitRequestSettingsInformation(conn); - adminUtil.setStudyAdminAndRoles(generateUserEmail(), USER_ADMIN_ROLE, - Arrays.asList(KIT_SHIPPING)); - - userWithKitShippingAccess = Integer.toString(adminUtil.createTestUser(generateUserEmail(), - Collections.singletonList(KIT_SHIPPING))); - } catch (SQLException e) { - simpleResult.resultException = e; - } - return simpleResult; - }); - if (results.resultException != null) { - log.error("Error creating juniper data ", results.resultException); - deleteJuniperInstanceAndSettings(); - } - } - - public static void deleteJuniperInstanceAndSettings() { - SimpleResult results = inTransaction((conn) -> { - SimpleResult dbVals = new SimpleResult(); - try { - delete(conn, "kit_dimension", "kit_dimension_id", kitDimensionId); - delete(conn, "kit_return_information", "kit_return_id", kitReturnId); - delete(conn, "carrier_service", "carrier_service_id", carrierId); - delete(conn, "ddp_kit_request_settings", "ddp_kit_request_settings_id", ddpKitRequestSettingsId); - delete(conn, "ddp_instance_role", "ddp_instance_role_id", ddpInstanceRoleId); - delete(conn, "ddp_instance_group", "instance_group_id", ddpInstanceGroupId); - delete(conn, "ddp_instance", "ddp_instance_id", ddpInstanceId); - delete(conn, "ddp_group", "group_id", ddpGroupId); - adminUtil.deleteGeneratedData(); - } catch (Exception e) { - dbVals.resultException = e; - } - return dbVals; - }); - - } - - private static void delete(Connection conn, String tableName, String primaryColumn, String id) { - try (PreparedStatement stmt = conn.prepareStatement("DELETE from " + tableName + " WHERE " + primaryColumn + " = ? ;")) { - stmt.setString(1, id); - try { - stmt.executeUpdate(); - } catch (SQLException e) { - throw new RuntimeException("Error deleting from " + tableName, e); - } - } catch (SQLException ex) { - throw new RuntimeException("Error deleting ", ex); - } - } - - public static void deleteJuniperKit(String ddpKitRequestId) { - SimpleResult results = inTransaction((conn) -> { - String dsmKitRequestId; - try (PreparedStatement stmt = conn.prepareStatement(SELECT_DSM_KIT_REQUEST_ID)) { - stmt.setString(1, ddpKitRequestId); - try (ResultSet rs = stmt.executeQuery()) { - if (rs.next()) { - dsmKitRequestId = rs.getString("dsm_kit_request_id"); - } else { - log.warn("Kit Not Found " + ddpKitRequestId); - return null; - } - } catch (SQLException e) { - throw new RuntimeException("Error selecting dsm_kit_request_id", e); - } - } catch (SQLException ex) { - throw new RuntimeException("Error deleting ", ex); - } - try { - delete(conn, "ddp_kit", "dsm_kit_request_id", dsmKitRequestId); - delete(conn, "ddp_kit_request", "dsm_kit_request_id", dsmKitRequestId); - } catch (Exception ex) { - throw new RuntimeException("Error deleting kits", ex); - } - return null; - }); - } - - public static void deleteKitsArray(List- * This class has methods to set up a study that uses kits in DSM database. - * It creates the instance, group, instance_role, kit_type, carrier, - * kit_dimensions, kit_return and ddp_kit_request_settings for the - * newly created study. - * It also contains methods to delete what was set up after tests are complete - *
- * The usage is by first creating an instance of this class by declaring the desired instance name and study guid, - * display name and collaborator prefix. - * Then call setupStudyWithKitsInstanceAndSettings() for initiating all the config in database. - *
- * When done, call deleteJuniperInstanceAndSettings() to delete everything - */ - @Slf4j -public class TestKitUtil { +@Getter +public class KitTestUtil { - private static final String SELECT_INSTANCE_ROLE = "SELECT instance_role_id FROM instance_role WHERE name = 'juniper_study';"; - private static final String INSERT_DDP_INSTANCE_ROLE = "INSERT INTO ddp_instance_role (ddp_instance_id, instance_role_id) " + protected static final String SELECT_INSTANCE_ROLE = "SELECT instance_role_id FROM instance_role WHERE name = ?;"; + protected static final String INSERT_DDP_INSTANCE_ROLE = "INSERT INTO ddp_instance_role (ddp_instance_id, instance_role_id) " + " VALUES (?, ?) ON DUPLICATE KEY UPDATE instance_role_id = ?;"; - - private static final String INSERT_KIT_TYPE_ID = "INSERT into kit_type (kit_type_name , display_name) VALUES (?, ?)"; - private static final String SELECT_KIT_TYPE_ID = "SELECT kit_type_id FROM kit_type WHERE kit_type_name = ? "; - private static final String SELECT_BY_DISPLAY_NAME = " and display_name = ? "; - private static final String INSERT_KIT_DIMENSION = "INSERT INTO kit_dimension (kit_width, kit_height, kit_length, kit_weight) " + protected static final String SELECT_KIT_TYPE_ID = "SELECT kit_type_id FROM kit_type WHERE kit_type_name = ?"; + protected static final String INSERT_KIT_DIMENSION = "INSERT INTO kit_dimension (kit_width, kit_height, kit_length, kit_weight) " + " VALUES ('6.9', '1.3', '5.2', '3.2') ON DUPLICATE KEY UPDATE kit_width = '6.9';"; - private static final String INSERT_KIT_RETURN = "INSERT INTO kit_return_information (return_address_name, return_address_phone) " + protected static final String INSERT_KIT_RETURN = "INSERT INTO kit_return_information (return_address_name, return_address_phone) " + " VALUES ('Broad Institute', '1111112222') ON DUPLICATE KEY UPDATE return_address_name = 'Broad Institute';"; - private static final String INSERT_CARRIER = "INSERT INTO carrier_service (carrier, service) " + protected static final String INSERT_CARRIER = "INSERT INTO carrier_service (carrier, service) " + " VALUES ('FedEx', 'FEDEX_2_DAY') ON DUPLICATE KEY UPDATE carrier = 'FedEx';"; - private static final String INSERT_DDP_KIT_REQUEST_SETTINGS = + protected static final String INSERT_DDP_KIT_REQUEST_SETTINGS = "INSERT INTO ddp_kit_request_settings (ddp_instance_id, kit_type_id, kit_return_id, carrier_service_to_id, kit_dimension_id) " + " VALUES (?, ?, ?, ?, ?) ;"; + private static final String SELECT_DSM_KIT_REQUEST_ID = + "SELECT dsm_kit_request_id from ddp_kit_request where ddp_kit_request_id like ? "; + + private static final String INSERT_KIT_TYPE_ID = "INSERT into kit_type (kit_type_name , display_name) VALUES (?, ?)"; + private static final String SELECT_BY_DISPLAY_NAME = " and display_name = ? "; private static final String INSERT_SUB_KITS_SETTINGS = "INSERT INTO sub_kits_settings (ddp_kit_request_settings_id, kit_type_id, kit_count, hide_on_sample_pages, external_name) " + " VALUES (?, ?, 1, ?, '') ;"; - private static final String SELECT_DSM_KIT_REQUEST_ID = "SELECT dsm_kit_request_id from ddp_kit_request " - + " where ddp_kit_request_id like ? "; - public final UserAdminTestUtil adminUtil = new UserAdminTestUtil(); + + private static final String INSERT_EVENT_TYPE = + "INSERT INTO event_type (ddp_instance_id, event_name, event_description, kit_type_id, event_type) " + + " VALUES (?, ?, ?, ?, ?) ;"; + + protected UserAdminTestUtil adminUtil = new UserAdminTestUtil(); + protected Integer ddpInstanceId; + protected Integer ddpGroupId; + protected Integer ddpInstanceGroupId; + protected Integer kitTypeId; + protected Integer kitDimensionId; + protected Integer kitReturnId; + protected Integer carrierId; + protected Integer ddpKitRequestSettingsId; + protected String instanceName; + protected String groupName; + protected String studyGuid; + protected String userWithKitShippingAccess; + protected NotificationUtil notificationUtil; private String kitTypeDisplayName; - public Integer ddpGroupId; - public Integer ddpInstanceId; - public Integer instanceRoleId; - public Integer ddpInstanceRoleId; + public ListSee {@link java.time.format.DateTimeFormatter#ofPattern(String)} for more information * about supported format strings. - * @param format The date format string to use. + * @param format The date format string to use. * @param defaultValue The string to return if there is no valid date * @return the formatted date of first completion, or `defaultValue` if one does not exist */ @@ -271,10 +271,10 @@ public String activityInstanceNumberDisplay(int offsetToSubtract, int numberCuto /** * Returns a string value depending on whether a specified PICKLIST question's option * is selected or not. - * - *
If {@link useDefaultsForDdpMethods} is true, this method will always return + * + *
If {@link #useDefaultsForDdpMethods} is true, this method will always return * a value of the form "stringIfMatches/stringOtherwise". - * + * *
If an activity does not have a response, * or the question does not have an associated answer, a match will be assumed, * and the `stringIfMatches` value will be returned. diff --git a/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/db/dao/EventTriggerDao.java b/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/db/dao/EventTriggerDao.java index a49321625e..1b158627cc 100644 --- a/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/db/dao/EventTriggerDao.java +++ b/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/db/dao/EventTriggerDao.java @@ -6,8 +6,8 @@ import org.broadinstitute.ddp.db.DaoException; import org.broadinstitute.ddp.model.activity.types.EventTriggerType; import org.broadinstitute.ddp.model.activity.types.InstanceStatusType; -import org.broadinstitute.ddp.model.dsm.DsmNotificationEventType; import org.broadinstitute.ddp.model.user.EnrollmentStatusType; +import org.broadinstitute.ddp.notficationevent.DsmNotificationEventType; import org.jdbi.v3.sqlobject.CreateSqlObject; public interface EventTriggerDao { diff --git a/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/db/dao/EventTriggerSql.java b/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/db/dao/EventTriggerSql.java index 5a7b3b3f34..9df56f29f8 100644 --- a/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/db/dao/EventTriggerSql.java +++ b/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/db/dao/EventTriggerSql.java @@ -1,7 +1,7 @@ package org.broadinstitute.ddp.db.dao; import org.broadinstitute.ddp.model.activity.types.EventTriggerType; -import org.broadinstitute.ddp.model.dsm.DsmNotificationEventType; +import org.broadinstitute.ddp.notficationevent.DsmNotificationEventType; import org.broadinstitute.ddp.model.user.EnrollmentStatusType; import org.jdbi.v3.sqlobject.SqlObject; import org.jdbi.v3.sqlobject.customizer.Bind; diff --git a/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/db/dto/EventConfigurationDto.java b/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/db/dto/EventConfigurationDto.java index 80de272909..50a7b90c68 100644 --- a/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/db/dto/EventConfigurationDto.java +++ b/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/db/dto/EventConfigurationDto.java @@ -11,7 +11,7 @@ import org.broadinstitute.ddp.model.activity.types.EventActionType; import org.broadinstitute.ddp.model.activity.types.EventTriggerType; import org.broadinstitute.ddp.model.activity.types.InstanceStatusType; -import org.broadinstitute.ddp.model.dsm.DsmNotificationEventType; +import org.broadinstitute.ddp.notficationevent.DsmNotificationEventType; import org.broadinstitute.ddp.model.event.NotificationServiceType; import org.broadinstitute.ddp.model.event.NotificationType; import org.broadinstitute.ddp.model.event.PdfAttachment; diff --git a/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/event/pubsubtask/api/PubSubTaskConnectionService.java b/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/event/pubsubtask/api/PubSubTaskConnectionService.java index c106ea8e4b..351c59cd4b 100644 --- a/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/event/pubsubtask/api/PubSubTaskConnectionService.java +++ b/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/event/pubsubtask/api/PubSubTaskConnectionService.java @@ -9,7 +9,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; - import com.google.api.gax.core.ExecutorProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.cloud.pubsub.v1.Publisher; diff --git a/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/model/event/DsmNotificationSignal.java b/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/model/event/DsmNotificationSignal.java index 30d78ba188..1d6309c738 100644 --- a/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/model/event/DsmNotificationSignal.java +++ b/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/model/event/DsmNotificationSignal.java @@ -3,9 +3,9 @@ import javax.annotation.Nullable; import org.broadinstitute.ddp.model.activity.types.EventTriggerType; -import org.broadinstitute.ddp.model.dsm.DsmNotificationEventType; -import org.broadinstitute.ddp.model.dsm.KitReasonType; +import org.broadinstitute.ddp.notficationevent.DsmNotificationEventType; import org.broadinstitute.ddp.model.dsm.TestResult; +import org.broadinstitute.ddp.notficationevent.KitReasonType; public class DsmNotificationSignal extends EventSignal { diff --git a/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/model/event/DsmNotificationTrigger.java b/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/model/event/DsmNotificationTrigger.java index 8c29145529..7aa6551964 100644 --- a/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/model/event/DsmNotificationTrigger.java +++ b/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/model/event/DsmNotificationTrigger.java @@ -1,7 +1,7 @@ package org.broadinstitute.ddp.model.event; import org.broadinstitute.ddp.db.dto.EventConfigurationDto; -import org.broadinstitute.ddp.model.dsm.DsmNotificationEventType; +import org.broadinstitute.ddp.notficationevent.DsmNotificationEventType; import org.jdbi.v3.core.Handle; public class DsmNotificationTrigger extends EventTrigger { diff --git a/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/route/ReceiveDsmNotificationRoute.java b/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/route/ReceiveDsmNotificationRoute.java index 73ce3472c8..8ddf83ad1c 100644 --- a/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/route/ReceiveDsmNotificationRoute.java +++ b/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/route/ReceiveDsmNotificationRoute.java @@ -17,10 +17,10 @@ import org.broadinstitute.ddp.db.dto.StudyDto; import org.broadinstitute.ddp.db.dto.kit.KitConfigurationDto; import org.broadinstitute.ddp.exception.DDPException; -import org.broadinstitute.ddp.json.dsm.DsmNotificationPayload; +import org.broadinstitute.ddp.notficationevent.DsmNotificationPayload; import org.broadinstitute.ddp.json.errors.ApiError; -import org.broadinstitute.ddp.model.dsm.DsmNotificationEventType; -import org.broadinstitute.ddp.model.dsm.KitReasonType; +import org.broadinstitute.ddp.notficationevent.DsmNotificationEventType; +import org.broadinstitute.ddp.notficationevent.KitReasonType; import org.broadinstitute.ddp.model.dsm.KitType; import org.broadinstitute.ddp.model.dsm.TestResult; import org.broadinstitute.ddp.model.event.DsmNotificationSignal; diff --git a/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/service/ActivityInstanceCreationService.java b/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/service/ActivityInstanceCreationService.java index 50f3363b16..95645b2b78 100644 --- a/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/service/ActivityInstanceCreationService.java +++ b/pepper-apis/dss-core/src/main/java/org/broadinstitute/ddp/service/ActivityInstanceCreationService.java @@ -16,11 +16,11 @@ import org.broadinstitute.ddp.exception.DDPException; import org.broadinstitute.ddp.model.activity.types.EventTriggerType; import org.broadinstitute.ddp.model.activity.types.InstanceStatusType; -import org.broadinstitute.ddp.model.dsm.DsmNotificationEventType; import org.broadinstitute.ddp.model.dsm.TestResult; import org.broadinstitute.ddp.model.event.ActivityInstanceStatusChangeSignal; import org.broadinstitute.ddp.model.event.DsmNotificationSignal; import org.broadinstitute.ddp.model.event.EventSignal; +import org.broadinstitute.ddp.notficationevent.DsmNotificationEventType; import org.jdbi.v3.core.Handle; /** diff --git a/pepper-apis/dss-core/src/test/java/org/broadinstitute/ddp/export/DataExporterTest.java b/pepper-apis/dss-core/src/test/java/org/broadinstitute/ddp/export/DataExporterTest.java index 7142334b19..c823b9a309 100644 --- a/pepper-apis/dss-core/src/test/java/org/broadinstitute/ddp/export/DataExporterTest.java +++ b/pepper-apis/dss-core/src/test/java/org/broadinstitute/ddp/export/DataExporterTest.java @@ -92,7 +92,6 @@ import org.broadinstitute.ddp.model.activity.types.TemplateType; import org.broadinstitute.ddp.model.activity.types.TextInputType; import org.broadinstitute.ddp.model.address.MailAddress; -import org.broadinstitute.ddp.model.dsm.KitReasonType; import org.broadinstitute.ddp.model.files.FileScanResult; import org.broadinstitute.ddp.model.files.FileUpload; import org.broadinstitute.ddp.model.governance.AgeOfMajorityRule; @@ -102,6 +101,7 @@ import org.broadinstitute.ddp.model.user.EnrollmentStatusType; import org.broadinstitute.ddp.model.user.User; import org.broadinstitute.ddp.model.user.UserProfile; +import org.broadinstitute.ddp.notficationevent.KitReasonType; import org.broadinstitute.ddp.pex.PexInterpreter; import org.broadinstitute.ddp.service.AddressService; import org.broadinstitute.ddp.service.DsmAddressValidationStatus; diff --git a/pepper-apis/dss-core/src/test/java/org/broadinstitute/ddp/pex/TreeWalkInterpreterTest.java b/pepper-apis/dss-core/src/test/java/org/broadinstitute/ddp/pex/TreeWalkInterpreterTest.java index 7f8f6a347e..8eb89f1ec2 100644 --- a/pepper-apis/dss-core/src/test/java/org/broadinstitute/ddp/pex/TreeWalkInterpreterTest.java +++ b/pepper-apis/dss-core/src/test/java/org/broadinstitute/ddp/pex/TreeWalkInterpreterTest.java @@ -69,8 +69,8 @@ import org.broadinstitute.ddp.model.activity.types.MatrixSelectMode; import org.broadinstitute.ddp.model.activity.types.TemplateType; import org.broadinstitute.ddp.model.activity.types.TextInputType; -import org.broadinstitute.ddp.model.dsm.DsmNotificationEventType; -import org.broadinstitute.ddp.model.dsm.KitReasonType; +import org.broadinstitute.ddp.notficationevent.DsmNotificationEventType; +import org.broadinstitute.ddp.notficationevent.KitReasonType; import org.broadinstitute.ddp.model.dsm.TestResult; import org.broadinstitute.ddp.model.event.ActivityInstanceStatusChangeSignal; import org.broadinstitute.ddp.model.event.DsmNotificationSignal; diff --git a/pepper-apis/dss-core/src/test/java/org/broadinstitute/ddp/route/ReceiveDsmNotificationRouteTest.java b/pepper-apis/dss-core/src/test/java/org/broadinstitute/ddp/route/ReceiveDsmNotificationRouteTest.java index d846bf00b9..92762dc57f 100644 --- a/pepper-apis/dss-core/src/test/java/org/broadinstitute/ddp/route/ReceiveDsmNotificationRouteTest.java +++ b/pepper-apis/dss-core/src/test/java/org/broadinstitute/ddp/route/ReceiveDsmNotificationRouteTest.java @@ -1,10 +1,10 @@ package org.broadinstitute.ddp.route; import static io.restassured.RestAssured.given; -import static org.broadinstitute.ddp.model.dsm.DsmNotificationEventType.SALIVA_RECEIVED; -import static org.broadinstitute.ddp.model.dsm.DsmNotificationEventType.TESTBOSTON_RECEIVED; -import static org.broadinstitute.ddp.model.dsm.DsmNotificationEventType.TESTBOSTON_SENT; -import static org.broadinstitute.ddp.model.dsm.DsmNotificationEventType.TEST_RESULT; +import static org.broadinstitute.ddp.notficationevent.DsmNotificationEventType.SALIVA_RECEIVED; +import static org.broadinstitute.ddp.notficationevent.DsmNotificationEventType.TESTBOSTON_RECEIVED; +import static org.broadinstitute.ddp.notficationevent.DsmNotificationEventType.TESTBOSTON_SENT; +import static org.broadinstitute.ddp.notficationevent.DsmNotificationEventType.TEST_RESULT; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assert.assertEquals; @@ -47,13 +47,13 @@ import org.broadinstitute.ddp.db.dto.QueuedNotificationDto; import org.broadinstitute.ddp.db.dto.SendgridEmailEventActionDto; import org.broadinstitute.ddp.db.dto.StudyDto; -import org.broadinstitute.ddp.json.dsm.DsmNotificationPayload; +import org.broadinstitute.ddp.notficationevent.DsmNotificationPayload; import org.broadinstitute.ddp.model.activity.definition.FormActivityDef; import org.broadinstitute.ddp.model.activity.definition.i18n.Translation; import org.broadinstitute.ddp.model.activity.instance.ActivityResponse; import org.broadinstitute.ddp.model.activity.revision.RevisionMetadata; -import org.broadinstitute.ddp.model.dsm.DsmNotificationEventType; -import org.broadinstitute.ddp.model.dsm.KitReasonType; +import org.broadinstitute.ddp.notficationevent.DsmNotificationEventType; +import org.broadinstitute.ddp.notficationevent.KitReasonType; import org.broadinstitute.ddp.model.dsm.TestResult; import org.broadinstitute.ddp.model.pex.Expression; import org.broadinstitute.ddp.model.user.EnrollmentStatusType; diff --git a/pepper-apis/studybuilder-cli/src/main/java/org/broadinstitute/ddp/studybuilder/EventBuilder.java b/pepper-apis/studybuilder-cli/src/main/java/org/broadinstitute/ddp/studybuilder/EventBuilder.java index de418e8b0c..4a940ae169 100644 --- a/pepper-apis/studybuilder-cli/src/main/java/org/broadinstitute/ddp/studybuilder/EventBuilder.java +++ b/pepper-apis/studybuilder-cli/src/main/java/org/broadinstitute/ddp/studybuilder/EventBuilder.java @@ -42,7 +42,7 @@ import org.broadinstitute.ddp.model.copy.CopyLocationType; import org.broadinstitute.ddp.model.copy.CopyPreviousInstanceFilter; import org.broadinstitute.ddp.model.copy.UserType; -import org.broadinstitute.ddp.model.dsm.DsmNotificationEventType; +import org.broadinstitute.ddp.notficationevent.DsmNotificationEventType; import org.broadinstitute.ddp.model.event.ActivityStatusChangeTrigger; import org.broadinstitute.ddp.model.event.DsmNotificationTrigger; import org.broadinstitute.ddp.model.event.EventTrigger; diff --git a/pepper-apis/studybuilder-cli/src/main/java/org/broadinstitute/ddp/studybuilder/task/CircadiaUpdateDLMOInstructionsTrigger.java b/pepper-apis/studybuilder-cli/src/main/java/org/broadinstitute/ddp/studybuilder/task/CircadiaUpdateDLMOInstructionsTrigger.java index 0380857d3f..0718c97294 100644 --- a/pepper-apis/studybuilder-cli/src/main/java/org/broadinstitute/ddp/studybuilder/task/CircadiaUpdateDLMOInstructionsTrigger.java +++ b/pepper-apis/studybuilder-cli/src/main/java/org/broadinstitute/ddp/studybuilder/task/CircadiaUpdateDLMOInstructionsTrigger.java @@ -1,5 +1,11 @@ package org.broadinstitute.ddp.studybuilder.task; +import java.io.File; +import java.nio.file.Path; +import java.util.Comparator; +import java.util.List; +import java.util.stream.Collectors; + import com.google.gson.Gson; import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; @@ -21,10 +27,10 @@ import org.broadinstitute.ddp.model.activity.definition.FormSectionDef; import org.broadinstitute.ddp.model.activity.types.EventTriggerType; import org.broadinstitute.ddp.model.activity.types.InstanceStatusType; -import org.broadinstitute.ddp.model.dsm.DsmNotificationEventType; import org.broadinstitute.ddp.model.event.ActivityInstanceCreationEventAction; import org.broadinstitute.ddp.model.event.DsmNotificationTrigger; import org.broadinstitute.ddp.model.event.EventConfiguration; +import org.broadinstitute.ddp.notficationevent.DsmNotificationEventType; import org.broadinstitute.ddp.util.ConfigUtil; import org.broadinstitute.ddp.util.GsonUtil; import org.jdbi.v3.core.Handle; @@ -33,12 +39,6 @@ import org.jdbi.v3.sqlobject.statement.SqlQuery; import org.jdbi.v3.sqlobject.statement.SqlUpdate; -import java.io.File; -import java.nio.file.Path; -import java.util.Comparator; -import java.util.List; -import java.util.stream.Collectors; - /** * One-off task to update configurations and events to support kit uploads and adhoc survey in deployed environments. */ diff --git a/pepper-apis/studybuilder-cli/src/main/java/org/broadinstitute/ddp/studybuilder/task/LmsInsertDsmEvents.java b/pepper-apis/studybuilder-cli/src/main/java/org/broadinstitute/ddp/studybuilder/task/LmsInsertDsmEvents.java index c032a260ac..702bb509b8 100644 --- a/pepper-apis/studybuilder-cli/src/main/java/org/broadinstitute/ddp/studybuilder/task/LmsInsertDsmEvents.java +++ b/pepper-apis/studybuilder-cli/src/main/java/org/broadinstitute/ddp/studybuilder/task/LmsInsertDsmEvents.java @@ -7,9 +7,9 @@ import org.broadinstitute.ddp.db.dao.JdbiUmbrellaStudy; import org.broadinstitute.ddp.model.activity.types.EventActionType; import org.broadinstitute.ddp.model.activity.types.EventTriggerType; -import org.broadinstitute.ddp.model.dsm.DsmNotificationEventType; import org.broadinstitute.ddp.model.event.DsmNotificationTrigger; import org.broadinstitute.ddp.model.event.EventConfiguration; +import org.broadinstitute.ddp.notficationevent.DsmNotificationEventType; import org.jdbi.v3.core.Handle; @Slf4j diff --git a/pepper-apis/studybuilder-cli/src/main/java/org/broadinstitute/ddp/studybuilder/task/OsteoInsertDsmEvents.java b/pepper-apis/studybuilder-cli/src/main/java/org/broadinstitute/ddp/studybuilder/task/OsteoInsertDsmEvents.java index fff5c88d16..6885c32ada 100644 --- a/pepper-apis/studybuilder-cli/src/main/java/org/broadinstitute/ddp/studybuilder/task/OsteoInsertDsmEvents.java +++ b/pepper-apis/studybuilder-cli/src/main/java/org/broadinstitute/ddp/studybuilder/task/OsteoInsertDsmEvents.java @@ -7,7 +7,7 @@ import org.broadinstitute.ddp.db.dao.JdbiUmbrellaStudy; import org.broadinstitute.ddp.model.activity.types.EventActionType; import org.broadinstitute.ddp.model.activity.types.EventTriggerType; -import org.broadinstitute.ddp.model.dsm.DsmNotificationEventType; +import org.broadinstitute.ddp.notficationevent.DsmNotificationEventType; import org.broadinstitute.ddp.model.event.DsmNotificationTrigger; import org.broadinstitute.ddp.model.event.EventConfiguration; import org.jdbi.v3.core.Handle; diff --git a/pepper-apis/studybuilder-cli/src/main/java/org/broadinstitute/ddp/studybuilder/task/TestBostonEnableKitUploads.java b/pepper-apis/studybuilder-cli/src/main/java/org/broadinstitute/ddp/studybuilder/task/TestBostonEnableKitUploads.java index c50d7da098..29a951b2e2 100644 --- a/pepper-apis/studybuilder-cli/src/main/java/org/broadinstitute/ddp/studybuilder/task/TestBostonEnableKitUploads.java +++ b/pepper-apis/studybuilder-cli/src/main/java/org/broadinstitute/ddp/studybuilder/task/TestBostonEnableKitUploads.java @@ -21,7 +21,7 @@ import org.broadinstitute.ddp.model.activity.types.EventActionType; import org.broadinstitute.ddp.model.activity.types.EventTriggerType; import org.broadinstitute.ddp.model.activity.types.InstanceStatusType; -import org.broadinstitute.ddp.model.dsm.DsmNotificationEventType; +import org.broadinstitute.ddp.notficationevent.DsmNotificationEventType; import org.broadinstitute.ddp.model.event.ActivityStatusChangeTrigger; import org.broadinstitute.ddp.model.event.DsmNotificationTrigger; import org.broadinstitute.ddp.model.event.EventConfiguration;