use of org.broadinstitute.consent.http.models.DataAccessRequestData in project consent by DataBiosphere.
the class SummaryServiceTest method createDAR.
private DataAccessRequest createDAR(String referenceId, Integer userId) {
DataAccessRequestData data = new DataAccessRequestData();
data.setDatasetIds(List.of(1));
data.setReferenceId(referenceId);
data.setDarCode("DAR-" + RandomUtils.nextInt(100, 200));
data.setProjectTitle("Project-TEST");
DataAccessRequest dar = new DataAccessRequest();
dar.setReferenceId(referenceId);
dar.setUserId(userId);
dar.setData(data);
dar.setSortDate(new Timestamp(new Date().getTime()));
return dar;
}
use of org.broadinstitute.consent.http.models.DataAccessRequestData in project consent by DataBiosphere.
the class MatchServiceTest method getSampleDataAccessRequest.
private DataAccessRequest getSampleDataAccessRequest(String referenceId) {
DataAccessRequest dar = new DataAccessRequest();
dar.setReferenceId(referenceId);
DataAccessRequestData data = new DataAccessRequestData();
data.setReferenceId(referenceId);
data.setHmb(true);
data.setDatasetIds(Collections.singletonList(1));
dar.setData(data);
return dar;
}
use of org.broadinstitute.consent.http.models.DataAccessRequestData in project consent by DataBiosphere.
the class DarCollectionResourceTest method testResubmitDarCollection_CollectionNotCanceled.
@Test
public void testResubmitDarCollection_CollectionNotCanceled() {
int userId = 1;
User user = mock(User.class);
when(userService.findUserByEmail(anyString())).thenReturn(user);
when(user.getDacUserId()).thenReturn(userId);
DarCollection collection = mock(DarCollection.class);
when(collection.getCreateUserId()).thenReturn(userId);
DataAccessRequest dar = mock(DataAccessRequest.class);
DataAccessRequestData data = mock(DataAccessRequestData.class);
String referenceId = UUID.randomUUID().toString();
when(data.getStatus()).thenReturn("Not Canceled");
when(dar.getData()).thenReturn(data);
when(dar.getReferenceId()).thenReturn(referenceId);
Map<String, DataAccessRequest> darMap = Map.of(dar.getReferenceId(), dar);
when(collection.getDars()).thenReturn(darMap);
when(darCollectionService.getByCollectionId(any())).thenReturn(collection);
initResource();
Response response = resource.resubmitDarCollection(authUser, 1);
assertEquals(HttpStatusCodes.STATUS_CODE_BAD_REQUEST, response.getStatus());
}
use of org.broadinstitute.consent.http.models.DataAccessRequestData in project consent by DataBiosphere.
the class DarCollectionResourceTest method mockDataAccessRequestWithDatasetIds.
private DataAccessRequest mockDataAccessRequestWithDatasetIds() {
DataAccessRequest dar = new DataAccessRequest();
DataAccessRequestData data = new DataAccessRequestData();
data.setDatasetIds(List.of(RandomUtils.nextInt(1, 100)));
dar.setData(data);
return dar;
}
use of org.broadinstitute.consent.http.models.DataAccessRequestData in project consent by DataBiosphere.
the class DataAccessRequestResourceVersion2 method updatePartialDataAccessRequest.
@PUT
@Consumes("application/json")
@Produces("application/json")
@Path("/draft/{referenceId}")
@RolesAllowed(RESEARCHER)
public Response updatePartialDataAccessRequest(@Auth AuthUser authUser, @PathParam("referenceId") String referenceId, String dar) {
try {
User user = findUserByEmail(authUser.getEmail());
DataAccessRequest originalDar = dataAccessRequestService.findByReferenceId(referenceId);
checkAuthorizedUpdateUser(user, originalDar);
DataAccessRequestData data = DataAccessRequestData.fromString(dar);
// Keep dar data reference id in sync with the dar until we fully deprecate
// it in dar data.
data.setReferenceId(originalDar.getReferenceId());
originalDar.setData(data);
DataAccessRequest updatedDar = dataAccessRequestService.updateByReferenceIdVersion2(user, originalDar);
return Response.ok().entity(updatedDar.convertToSimplifiedDar()).build();
} catch (Exception e) {
return createExceptionResponse(e);
}
}
Aggregations