use of org.breedinginsight.api.model.v1.response.DataResponse in project bi-api by Breeding-Insight.
the class MetadataFilterIntegrationTest method getDataResponseMock.
public Response<DataResponse<User>> getDataResponseMock() {
User mockedUser = User.builder().name("Test User").email("test@user.com").id(UUID.randomUUID()).orcid("testorcid").build();
List<User> users = new ArrayList<>();
users.add(mockedUser);
users.add(mockedUser);
DataResponse<User> dataResponse = new DataResponse<User>().setData(users);
Response mockedResponse = new Response().setResult(dataResponse);
return mockedResponse;
}
use of org.breedinginsight.api.model.v1.response.DataResponse in project bi-api by Breeding-Insight.
the class ProgramController method getProgramObservationLevels.
@Get("/programs/{programId}/observation-levels")
@Produces(MediaType.APPLICATION_JSON)
@ProgramSecured(roleGroups = { ProgramSecuredRoleGroup.ALL })
public HttpResponse<Response<DataResponse<ProgramObservationLevel>>> getProgramObservationLevels(@PathVariable UUID programId) throws DoesNotExistException {
List<ProgramObservationLevel> programObservationLevels = programObservationLevelService.getByProgramId(programId);
List<Status> metadataStatus = new ArrayList<>();
metadataStatus.add(new Status(StatusCode.INFO, "Successful Query"));
Pagination pagination = new Pagination(programObservationLevels.size(), 1, 1, 0);
Metadata metadata = new Metadata(pagination, metadataStatus);
Response<DataResponse<ProgramObservationLevel>> response = new Response(metadata, new DataResponse<>(programObservationLevels));
return HttpResponse.ok(response);
}
use of org.breedinginsight.api.model.v1.response.DataResponse in project bi-api by Breeding-Insight.
the class RoleController method getSystemRoles.
@Get("/roles")
@Produces(MediaType.APPLICATION_JSON)
@Secured(SecurityRule.IS_AUTHENTICATED)
public HttpResponse<Response<DataResponse<SystemRole>>> getSystemRoles() {
List<SystemRole> roles = systemRoleService.getAll();
List<Status> metadataStatus = new ArrayList<>();
metadataStatus.add(new Status(StatusCode.INFO, "Successful Query"));
// TODO: Put in the actual page size
Pagination pagination = new Pagination(roles.size(), 1, 1, 0);
Metadata metadata = new Metadata(pagination, metadataStatus);
Response<DataResponse<SystemRole>> response = new Response(metadata, new DataResponse<>(roles));
return HttpResponse.ok(response);
}
use of org.breedinginsight.api.model.v1.response.DataResponse in project bi-api by Breeding-Insight.
the class RoleController method getRoles.
@Get("programs/roles")
@Produces(MediaType.APPLICATION_JSON)
@Secured(SecurityRule.IS_AUTHENTICATED)
public HttpResponse<Response<DataResponse<Role>>> getRoles() {
List<Role> roles = roleService.getAll();
List<Status> metadataStatus = new ArrayList<>();
metadataStatus.add(new Status(StatusCode.INFO, "Successful Query"));
// TODO: Put in the actual page size
Pagination pagination = new Pagination(roles.size(), 1, 1, 0);
Metadata metadata = new Metadata(pagination, metadataStatus);
Response<DataResponse<Role>> response = new Response(metadata, new DataResponse<>(roles));
return HttpResponse.ok(response);
}
use of org.breedinginsight.api.model.v1.response.DataResponse in project bi-api by Breeding-Insight.
the class SpeciesController method getSpecies.
@Get("/species")
@Produces(MediaType.APPLICATION_JSON)
@Secured(SecurityRule.IS_AUTHENTICATED)
public HttpResponse<Response<DataResponse<Species>>> getSpecies() {
List<Species> species = speciesService.getAll();
List<Status> metadataStatus = new ArrayList<>();
metadataStatus.add(new Status(StatusCode.INFO, "Successful Query"));
// TODO: Put in the actual page size
Pagination pagination = new Pagination(species.size(), 1, 1, 0);
Metadata metadata = new Metadata(pagination, metadataStatus);
Response response = new Response(metadata, new DataResponse<>(species));
return HttpResponse.ok(response);
}
Aggregations