diff --git a/src/main/java/hello/agh/edu/bazy/controllers/GisController.java b/src/main/java/hello/agh/edu/bazy/controllers/GisController.java index 13dc59c..2d3acaf 100644 --- a/src/main/java/hello/agh/edu/bazy/controllers/GisController.java +++ b/src/main/java/hello/agh/edu/bazy/controllers/GisController.java @@ -18,6 +18,7 @@ import java.util.List; @Controller @RequestMapping(APIServicePaths.GIS_CONTROLLER) public class GisController { + @Autowired GisDbApi gisDbApi; diff --git a/src/main/java/hello/agh/edu/bazy/controllers/ProfileController.java b/src/main/java/hello/agh/edu/bazy/controllers/ProfileController.java index 95f3e66..c2d29ff 100644 --- a/src/main/java/hello/agh/edu/bazy/controllers/ProfileController.java +++ b/src/main/java/hello/agh/edu/bazy/controllers/ProfileController.java @@ -4,7 +4,11 @@ import hello.agh.edu.bazy.dbApi.profile.ProfileDbApi; import hello.agh.edu.bazy.path.APIServicePaths; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.*; +import pl.edu.agh.ztb.configs.model.Configuration; + +import java.sql.SQLException; +import java.util.List; /** * Created by mar on 25.01.15. @@ -16,5 +20,23 @@ public class ProfileController { @Autowired ProfileDbApi profileDbApi; + @RequestMapping(value = APIServicePaths.DELETE_PROFILE + "/{name}", method = RequestMethod.DELETE) + boolean deleteProfile(@PathVariable("name") String name) throws SQLException { + profileDbApi.getProfileDbApi().deleteProfile(name); + return true; + } + + @RequestMapping(value = APIServicePaths.GET_ALL_CONFIGURATION) + @ResponseBody + List getAllConfiguration() throws SQLException { + return profileDbApi.getProfileDbApi().getAllConfigurations(); + } + + @RequestMapping(value = APIServicePaths.DELETE_CONFIGURATION + "/{projectId}/{segmentId}/{profileId}", method = RequestMethod.DELETE) + @ResponseBody + boolean deleteConfiguration(@PathVariable("projectId") String projectId, @PathVariable("segmentId") String segmentId, @PathVariable("profileId") String profileId) throws SQLException { + profileDbApi.getProfileDbApi().deleteConfiguration(projectId, Long.valueOf(segmentId), profileId); + return true; + } } diff --git a/src/main/java/hello/agh/edu/bazy/path/APIServicePaths.java b/src/main/java/hello/agh/edu/bazy/path/APIServicePaths.java index 8a6b5db..9c5e6d9 100644 --- a/src/main/java/hello/agh/edu/bazy/path/APIServicePaths.java +++ b/src/main/java/hello/agh/edu/bazy/path/APIServicePaths.java @@ -10,6 +10,8 @@ package hello.agh.edu.bazy.path; public final class APIServicePaths { + + private APIServicePaths() { } @@ -43,6 +45,7 @@ public final class APIServicePaths { //PROFILE public static final String PROFILE_CONTROLLER = "/profile"; - - + public static final String DELETE_PROFILE = "/profile"; + public static final String GET_ALL_CONFIGURATION = "/configurations"; + public static final String DELETE_CONFIGURATION = "/configuration"; }