Removed unused imports;
This commit is contained in:
parent
eb0c5abc7b
commit
c1e0241f05
@ -3,8 +3,6 @@ package uk.co.neviyn.Observations.core;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
@ -44,8 +42,8 @@ public class Observation {
|
||||
@JsonProperty
|
||||
private DateTime date;
|
||||
|
||||
public Observation(int siteId, String observed, int monitoring, int control, int conservatism,
|
||||
int teamwork, int knowledge, String rawData) {
|
||||
public Observation(int siteId, String observed, int monitoring, int control, int conservatism, int teamwork,
|
||||
int knowledge, String rawData) {
|
||||
this.siteId = siteId;
|
||||
this.observed = observed;
|
||||
this.monitoring = monitoring;
|
||||
@ -71,7 +69,7 @@ public class Observation {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public static class Mapper implements RowMapper<Observation>{
|
||||
public static class Mapper implements RowMapper<Observation> {
|
||||
|
||||
public Observation map(ResultSet rs, StatementContext ctx) throws SQLException {
|
||||
return new Observation(rs.getInt("id"), rs.getInt("siteId"), rs.getString("observed"), rs.getString("type"),
|
||||
|
@ -1,8 +1,6 @@
|
||||
package uk.co.neviyn.Observations.resources;
|
||||
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import uk.co.neviyn.Observations.api.SelectOption;
|
||||
import uk.co.neviyn.Observations.dao.SiteDao;
|
||||
|
||||
@ -16,14 +14,13 @@ import java.util.stream.Collectors;
|
||||
@RequiredArgsConstructor
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Path("/site")
|
||||
@Slf4j
|
||||
public class SiteResource {
|
||||
|
||||
private final SiteDao dao;
|
||||
|
||||
@Path("/all")
|
||||
@GET
|
||||
public List<SelectOption<Integer>> allSites(){
|
||||
public List<SelectOption<Integer>> allSites() {
|
||||
return dao.allSites().stream().map(x -> new SelectOption<>(x.getName(), x.getId())).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import uk.co.neviyn.Observations.api.SelectOption;
|
||||
import uk.co.neviyn.Observations.core.Tutor;
|
||||
import uk.co.neviyn.Observations.dao.TutorDao;
|
||||
@ -18,25 +17,24 @@ import uk.co.neviyn.Observations.dao.TutorDao;
|
||||
@RequiredArgsConstructor
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Path("/tutor")
|
||||
@Slf4j
|
||||
public class TutorResource {
|
||||
|
||||
private final TutorDao dao;
|
||||
|
||||
@Path("/all")
|
||||
@GET
|
||||
public List<Tutor> allTutors(){
|
||||
public List<Tutor> allTutors() {
|
||||
List<Tutor> tutors = dao.allTutors();
|
||||
if(tutors != null && !tutors.isEmpty())
|
||||
if (tutors != null && !tutors.isEmpty())
|
||||
return tutors;
|
||||
throw new WebApplicationException("No tutors found!", Response.Status.NOT_FOUND);
|
||||
}
|
||||
|
||||
@Path("/site/{id}")
|
||||
@GET
|
||||
public List<SelectOption<Integer>> tutorsForSite(@PathParam("id")int siteId){
|
||||
public List<SelectOption<Integer>> tutorsForSite(@PathParam("id") int siteId) {
|
||||
List<Tutor> tutors = dao.tutorsForSite(siteId);
|
||||
if(tutors != null && !tutors.isEmpty()){
|
||||
if (tutors != null && !tutors.isEmpty()) {
|
||||
return tutors.stream().map(x -> new SelectOption<>(x.getName(), x.getId())).collect(Collectors.toList());
|
||||
}
|
||||
throw new WebApplicationException("No tutors found!", Response.Status.NOT_FOUND);
|
||||
|
Loading…
Reference in New Issue
Block a user