Skip to content
Snippets Groups Projects
Commit 5d2bbcf4 authored by Rhys Evans's avatar Rhys Evans
Browse files

commiting changes

parent 145bfaab
No related branches found
No related tags found
1 merge request!40Resolve "As a user I would like to see a map containing all landmarks for a trail and a suggested path between them, so that I can easily follow the trail"
......@@ -52,6 +52,32 @@ public class LocationRepositoryJDBC implements LocationRepository {
// this.locationMapper = locationMapper;
// }
public List<Location> getAllApprovedLocation(){
String sql= "SELECT * FROM locations";
List<Location> lis = jdbc.query(sql, locationMapper);
List<Location> lisFiltered = new ArrayList<>();
for (Location li : lis){
if (li.isLocationApproved()){
lisFiltered.add(li);
}
}
return lisFiltered;
}
public List<Location> getAllUnapprovedLocation(){
String sql= "SELECT * FROM locations";
List<Location> lis = jdbc.query(sql, locationMapper);
List<Location> lisFiltered = new ArrayList<>();
for (Location li : lis){
if (!li.isLocationApproved()){
lisFiltered.add(li);
}
}
return lisFiltered;
}
@Override // intended implementation at current: user data from templates/Landmarks/LandmarkFormTh.html is added to the Location table
public void addLocation(Location loc) {
String sql = "insert into locations( locationName , locationEmail,locationDescription,locationPlace, locationTrailID, locationApproved) values (?,?,?,?,?,?)";
......
......@@ -38,7 +38,6 @@ public class LandmarksController {
} else{
// converts valid response using Location constructor into a submittable format to the sql table
Location loc= new Location(landmarks.getLandmarkName(), landmarks.getLandmarkEmail(), landmarks.getLandmarkDescription(), landmarks.getLandmarkLocation(), landmarks.getTrailID(), false);
System.out.println(loc);
locationRepository.addLocation(loc); // adds valid landmark to locations table
ModelAndView modelAndView = new ModelAndView("redirect:/home");
return modelAndView;
......
......@@ -53,6 +53,9 @@ public class PlacesCoordinatesRepositoryJDBC implements PlacesCoordinatesReposit
String sql= "SELECT * FROM locationCoordinates";
return jdbc.query(sql, locationCoordMapper);
}
public List<TownWithTrails> getAllTownCoords(){
String sql= "SELECT * FROM townswithtrails";
return jdbc.query(sql, townCoordMapper);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment