Skip to content

Commit 916109b

Browse files
Merge pull request #679 from DwayneJengSage/dev3
DHP-1154 App flag to enable adherence report
2 parents f2238ce + f81fa85 commit 916109b

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

src/main/java/org/sagebionetworks/bridge/dynamodb/DynamoApp.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public TypeReference<Map<String,ActivityEventUpdateType>> getTypeReference() {
6868
private String shortName;
6969
private String sponsorName;
7070
private String identifier;
71+
private boolean adherenceReportEnabled;
7172
private Map<String, String> automaticCustomEvents;
7273
private boolean autoVerificationEmailSuppressed;
7374
private Exporter3Configuration exporter3Configuration;
@@ -185,6 +186,16 @@ public void setVersion(Long version) {
185186
this.version = version;
186187
}
187188

189+
@Override
190+
public boolean isAdherenceReportEnabled() {
191+
return adherenceReportEnabled;
192+
}
193+
194+
@Override
195+
public void setAdherenceReportEnabled(boolean adherenceReportEnabled) {
196+
this.adherenceReportEnabled = adherenceReportEnabled;
197+
}
198+
188199
/** {@inheritDoc} */
189200
@Override
190201
public Map<String, String> getAutomaticCustomEvents() {
@@ -671,7 +682,7 @@ public void setDefaultTemplates(Map<String,String> defaultTemplates) {
671682

672683
@Override
673684
public int hashCode() {
674-
return Objects.hash(name, shortName, sponsorName, identifier, automaticCustomEvents,
685+
return Objects.hash(name, shortName, sponsorName, identifier, adherenceReportEnabled, automaticCustomEvents,
675686
autoVerificationEmailSuppressed, exporter3Configuration, exporter3Enabled, participantIpLockingEnabled, appIdExcludedInExport,
676687
supportEmail, synapseDataAccessTeamId, synapseProjectId, technicalEmail, usesCustomExportSchedule,
677688
uploadMetadataFieldDefinitions, uploadValidationStrictness, consentNotificationEmail,
@@ -692,6 +703,7 @@ public boolean equals(Object obj) {
692703
DynamoApp other = (DynamoApp) obj;
693704

694705
return (Objects.equals(identifier, other.identifier)
706+
&& Objects.equals(adherenceReportEnabled, other.adherenceReportEnabled)
695707
&& Objects.equals(automaticCustomEvents, other.automaticCustomEvents)
696708
&& Objects.equals(autoVerificationEmailSuppressed, other.autoVerificationEmailSuppressed)
697709
&& Objects.equals(exporter3Configuration, other.exporter3Configuration)
@@ -743,7 +755,7 @@ public boolean equals(Object obj) {
743755
@Override
744756
public String toString() {
745757
return String.format(
746-
"DynamoApp [name=%s, shortName=%s, active=%s, sponsorName=%s, identifier=%s, automaticCustomEvents=%s"
758+
"DynamoApp [name=%s, shortName=%s, active=%s, sponsorName=%s, identifier=%s, adherenceReportEnabled=%b, automaticCustomEvents=%s"
747759
+ "autoVerificationEmailSuppressed=%b, minAgeOfConsent=%s, exporter3Configuration=%s, exporter3Enabled=%b, participantIpLockingEnabled=%b, "
748760
+ "appIdExcludedInExport=%b, supportEmail=%s, synapseDataAccessTeamId=%s, synapseProjectId=%s, "
749761
+ "technicalEmail=%s, uploadValidationStrictness=%s, consentNotificationEmail=%s, "
@@ -755,7 +767,7 @@ public String toString() {
755767
+ "phoneSignInEnabled=%s, accountLimit=%s, oauthProviders=%s, appleAppLinks=%s, androidAppLinks=%s, "
756768
+ "reauthenticationEnabled=%s, autoVerificationPhoneSuppressed=%s, verifyChannelOnSignInEnabled=%s, "
757769
+ "defaultTemplates=%s]",
758-
name, shortName, active, sponsorName, identifier, automaticCustomEvents,
770+
name, shortName, active, sponsorName, identifier, adherenceReportEnabled, automaticCustomEvents,
759771
autoVerificationEmailSuppressed, minAgeOfConsent, exporter3Configuration, exporter3Enabled, participantIpLockingEnabled, appIdExcludedInExport,
760772
supportEmail, synapseDataAccessTeamId, synapseProjectId, technicalEmail, uploadValidationStrictness,
761773
consentNotificationEmail, consentNotificationEmailVerified, version, profileAttributes, taskIdentifiers,

src/main/java/org/sagebionetworks/bridge/models/apps/App.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ static App create() {
6565
Long getVersion();
6666
void setVersion(Long version);
6767

68+
/** True if this app should run adherence reports. */
69+
boolean isAdherenceReportEnabled();
70+
void setAdherenceReportEnabled(boolean enabled);
71+
6872
/**
6973
* Custom events that should be generated for participant upon enrollment. The key in this map is the eventKey, and
7074
* the value is the offset after the enrollment event (eg, "P1D" for one day after enrollment, "P2W" for 2 weeks

src/test/java/org/sagebionetworks/bridge/dynamodb/DynamoAppTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ public void appFullySerializesForCaching() throws Exception {
129129
OAuthProviderTest.CALLBACK_URL, null);
130130
app.getOAuthProviders().put("myProvider", oauthProvider);
131131

132+
app.setAdherenceReportEnabled(true);
132133
app.setAutomaticCustomEvents(ImmutableMap.of("3-days-after-enrollment", "P3D"));
133134
app.setVersion(2L);
134135
app.setMinSupportedAppVersions(ImmutableMap.<String, Integer>builder().put(OperatingSystem.IOS, 2).build());
@@ -139,6 +140,7 @@ public void appFullySerializesForCaching() throws Exception {
139140

140141
final JsonNode node = BridgeObjectMapper.get().valueToTree(app);
141142

143+
assertTrue(node.get("adherenceReportEnabled").booleanValue());
142144
assertTrue(node.get("autoVerificationEmailSuppressed").booleanValue());
143145
assertEqualsAndNotNull(app.getConsentNotificationEmail(), node.get("consentNotificationEmail").asText());
144146
assertEqualsAndNotNull(app.getExporter3Configuration(), JsonUtils.asEntity(node,

0 commit comments

Comments
 (0)