add missing method to profiles controller
This commit is contained in:
1 parent
3bc69682bc
commit
93ecd9ef9d
2 files changed
+22
-6
No files matched your search
@@ -9,6 +9,7 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import pl.edu.agh.ztb.configs.model.Configuration;
|
||||
import pl.edu.agh.ztb.configs.model.LampConfig;
|
||||
import pl.edu.agh.ztb.configs.model.Profile;
|
||||
import pl.edu.agh.ztb.configs.model.Project;
|
||||
|
||||
import java.sql.SQLException;
|
||||
@@ -28,8 +29,8 @@ public class ProfileController {
|
||||
|
||||
@RequestMapping(value = APIServicePaths.PUT_PROJECT + "/{id}", method = RequestMethod.PUT)
|
||||
@ResponseBody
|
||||
Boolean putProject(@RequestBody Description description, @PathVariable("id") Long id) throws SQLException {
|
||||
profileDbApi.getProfileDbApi().addProject(String.valueOf(id), description.getDescription());
|
||||
Boolean putProject(@RequestBody Description description, @PathVariable("id") String id) throws SQLException {
|
||||
profileDbApi.getProfileDbApi().addProject(id, description.getDescription());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -38,9 +39,9 @@ public class ProfileController {
|
||||
method = RequestMethod.PUT)
|
||||
@ResponseBody
|
||||
Boolean putConfiguration(
|
||||
@PathVariable("projectId") Long projectId,
|
||||
@PathVariable("projectId") String projectId,
|
||||
@PathVariable("segmentId") Long segmentId,
|
||||
@PathVariable("profileId") Long profileId,
|
||||
@PathVariable("profileId") String profileId,
|
||||
@RequestBody List<ApiLampConfig> lampConfigurationList) throws Exception {
|
||||
List<LampConfig> lampConfigs = new ArrayList<>();
|
||||
for (ApiLampConfig apiLampConfig : lampConfigurationList) {
|
||||
@@ -48,9 +49,9 @@ public class ProfileController {
|
||||
}
|
||||
|
||||
profileDbApi.getProfileDbApi().addConfiguration(
|
||||
String.valueOf(projectId),
|
||||
projectId,
|
||||
segmentId,
|
||||
String.valueOf(profileId),
|
||||
profileId,
|
||||
lampConfigs);
|
||||
|
||||
return true;
|
||||
@@ -80,4 +81,17 @@ public class ProfileController {
|
||||
List<Project> getAllProjects() throws SQLException {
|
||||
return profileDbApi.getProfileDbApi().getAllProjects();
|
||||
}
|
||||
|
||||
@RequestMapping(value = APIServicePaths.GET_ALL_PROFILES)
|
||||
@ResponseBody
|
||||
List<Profile> getAllProfiles() throws SQLException {
|
||||
return profileDbApi.getProfileDbApi().getAllProfiles();
|
||||
}
|
||||
|
||||
@RequestMapping(value = APIServicePaths.DELETE_PROJECT + "/{projectId}", method = RequestMethod.DELETE)
|
||||
@ResponseBody
|
||||
boolean deleteProject(@PathVariable("projectId") String projectId) throws SQLException {
|
||||
profileDbApi.getProfileDbApi().deleteProject(projectId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,9 @@ public final class APIServicePaths {
|
||||
public static final String PUT_PROJECT = "/project";
|
||||
public static final String PUT_CONFIGURATION = "/configuration";
|
||||
public static final String GET_ALL_PROJECTS = "/projects";
|
||||
public static final String GET_ALL_PROFILES = "/profiles";
|
||||
public static final String DELETE_PROFILE = "/profile";
|
||||
public static final String GET_ALL_CONFIGURATION = "/configurations";
|
||||
public static final String DELETE_CONFIGURATION = "/configuration";
|
||||
public static final String DELETE_PROJECT = "/project";
|
||||
}
|
||||
Reference in new issue
Block a user