use of org.sagebionetworks.bridge.models.schedules2.adherence.AdherenceRecord in project BridgeServer2 by Sage-Bionetworks.
the class TestUtils method getAdherenceRecord.
public static AdherenceRecord getAdherenceRecord(String instanceGuid) {
AdherenceRecord record = new AdherenceRecord();
record.setStudyId(TEST_STUDY_ID);
record.setUserId(TEST_USER_ID);
record.setEventTimestamp(CREATED_ON);
record.setClientTimeZone("America/Los_Angeles");
record.setStartedOn(MODIFIED_ON);
record.setInstanceGuid(instanceGuid);
return record;
}
use of org.sagebionetworks.bridge.models.schedules2.adherence.AdherenceRecord in project BridgeServer2 by Sage-Bionetworks.
the class TestUtils method mockAdherenceRecord.
public static AdherenceRecord mockAdherenceRecord(String instanceGuid) {
AdherenceRecord record = new AdherenceRecord();
record.setStudyId(TEST_STUDY_ID);
record.setUserId(TEST_USER_ID);
record.setEventTimestamp(CREATED_ON);
record.setClientTimeZone("America/Los_Angeles");
record.setStartedOn(MODIFIED_ON);
record.setInstanceGuid(instanceGuid);
record.setClientTimeZone("America/Los_Angeles");
return record;
}
use of org.sagebionetworks.bridge.models.schedules2.adherence.AdherenceRecord in project BridgeServer2 by Sage-Bionetworks.
the class AdherenceController method updateAdherenceRecordsForSelf.
@PostMapping("/v5/studies/{studyId}/participants/self/adherence")
public StatusMessage updateAdherenceRecordsForSelf(@PathVariable String studyId) {
UserSession session = getAuthenticatedAndConsentedSession();
AdherenceRecordList recordsList = parseJson(AdherenceRecordList.class);
for (AdherenceRecord oneRecord : recordsList.getRecords()) {
oneRecord.setAppId(session.getAppId());
oneRecord.setUserId(session.getId());
oneRecord.setStudyId(studyId);
}
service.updateAdherenceRecords(session.getAppId(), recordsList);
return SAVED_MSG;
}
use of org.sagebionetworks.bridge.models.schedules2.adherence.AdherenceRecord in project BridgeServer2 by Sage-Bionetworks.
the class AdherenceController method deleteAdherenceRecord.
@DeleteMapping("/v5/studies/{studyId}/participants/{userIdToken}/adherence/{instanceGuid}/{eventTimestamp}/{startedOn}")
public StatusMessage deleteAdherenceRecord(@PathVariable String studyId, @PathVariable String userIdToken, @PathVariable String instanceGuid, @PathVariable String eventTimestamp, @PathVariable String startedOn) {
UserSession session = getAuthenticatedSession(DEVELOPER, RESEARCHER, STUDY_DESIGNER, STUDY_COORDINATOR);
String userId = accountService.getAccountId(session.getAppId(), userIdToken).orElseThrow(() -> new EntityNotFoundException(Account.class));
AdherenceRecord record = new AdherenceRecord();
record.setAppId(session.getAppId());
record.setUserId(userId);
record.setStudyId(studyId);
record.setInstanceGuid(instanceGuid);
record.setEventTimestamp(BridgeUtils.getDateTimeOrDefault(eventTimestamp, null));
record.setStartedOn(BridgeUtils.getDateTimeOrDefault(startedOn, null));
service.deleteAdherenceRecord(record);
return DELETED_MSG;
}
use of org.sagebionetworks.bridge.models.schedules2.adherence.AdherenceRecord in project BridgeServer2 by Sage-Bionetworks.
the class AdherenceRecordListValidatorTest method studyIdBlank.
@Test
public void studyIdBlank() {
AdherenceRecord record = new AdherenceRecord();
record.setStudyId(" ");
assertValidatorMessage(INSTANCE, asList(record), asField(STUDY_ID_FIELD), CANNOT_BE_BLANK);
}
Aggregations