Commit b70a1fe3 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

old info about backgrounds removed from overlays API

parent 9b2dd147
...@@ -20,8 +20,6 @@ import lcsb.mapviewer.model.Project; ...@@ -20,8 +20,6 @@ import lcsb.mapviewer.model.Project;
import lcsb.mapviewer.model.cache.FileEntry; import lcsb.mapviewer.model.cache.FileEntry;
import lcsb.mapviewer.model.cache.UploadedFileEntry; import lcsb.mapviewer.model.cache.UploadedFileEntry;
import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.BioEntity;
import lcsb.mapviewer.model.map.layout.ProjectBackground;
import lcsb.mapviewer.model.map.layout.ProjectBackgroundImageLayer;
import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.reaction.Reaction;
import lcsb.mapviewer.model.map.species.Element; import lcsb.mapviewer.model.map.species.Element;
import lcsb.mapviewer.model.overlay.*; import lcsb.mapviewer.model.overlay.*;
...@@ -31,7 +29,6 @@ import lcsb.mapviewer.services.ObjectNotFoundException; ...@@ -31,7 +29,6 @@ import lcsb.mapviewer.services.ObjectNotFoundException;
import lcsb.mapviewer.services.QueryException; import lcsb.mapviewer.services.QueryException;
import lcsb.mapviewer.services.interfaces.IDataOverlayService; import lcsb.mapviewer.services.interfaces.IDataOverlayService;
import lcsb.mapviewer.services.interfaces.IDataOverlayService.CreateDataOverlayParams; import lcsb.mapviewer.services.interfaces.IDataOverlayService.CreateDataOverlayParams;
import lcsb.mapviewer.services.interfaces.IProjectBackgroundService;
@Transactional @Transactional
@Service @Service
...@@ -40,8 +37,6 @@ public class OverlayRestImpl extends BaseRestImpl { ...@@ -40,8 +37,6 @@ public class OverlayRestImpl extends BaseRestImpl {
@SuppressWarnings("unused") @SuppressWarnings("unused")
private Logger logger = LogManager.getLogger(); private Logger logger = LogManager.getLogger();
private IProjectBackgroundService projectBackgroundService;
private IDataOverlayService dataOverlayService; private IDataOverlayService dataOverlayService;
private UploadedFileEntryDao uploadedFileEntryDao; private UploadedFileEntryDao uploadedFileEntryDao;
...@@ -49,9 +44,8 @@ public class OverlayRestImpl extends BaseRestImpl { ...@@ -49,9 +44,8 @@ public class OverlayRestImpl extends BaseRestImpl {
private ColorParser colorParser = new ColorParser(); private ColorParser colorParser = new ColorParser();
@Autowired @Autowired
public OverlayRestImpl(IProjectBackgroundService projectBackgroundService, UploadedFileEntryDao uploadedFileEntryDao, public OverlayRestImpl(UploadedFileEntryDao uploadedFileEntryDao,
IDataOverlayService dataOverlayService) { IDataOverlayService dataOverlayService) {
this.projectBackgroundService = projectBackgroundService;
this.uploadedFileEntryDao = uploadedFileEntryDao; this.uploadedFileEntryDao = uploadedFileEntryDao;
this.dataOverlayService = dataOverlayService; this.dataOverlayService = dataOverlayService;
} }
...@@ -61,11 +55,9 @@ public class OverlayRestImpl extends BaseRestImpl { ...@@ -61,11 +55,9 @@ public class OverlayRestImpl extends BaseRestImpl {
if (project == null) { if (project == null) {
throw new ObjectNotFoundException("Project with given id doesn't exist"); throw new ObjectNotFoundException("Project with given id doesn't exist");
} }
List<ProjectBackground> backgrounds = projectBackgroundService.getProjectBackgroundsByProject(project);
List<DataOverlay> dataOverlays = dataOverlayService.getDataOverlaysByProject(project); List<DataOverlay> dataOverlays = dataOverlayService.getDataOverlaysByProject(project);
List<Map<String, Object>> result = new ArrayList<>(); List<Map<String, Object>> result = new ArrayList<>();
result.addAll(backgroundsToMap(backgrounds));
result.addAll(overlaysToMap(dataOverlays)); result.addAll(overlaysToMap(dataOverlays));
return result; return result;
...@@ -79,43 +71,6 @@ public class OverlayRestImpl extends BaseRestImpl { ...@@ -79,43 +71,6 @@ public class OverlayRestImpl extends BaseRestImpl {
return result; return result;
} }
private List<Map<String, Object>> backgroundsToMap(List<ProjectBackground> backgrounds) {
List<Map<String, Object>> result = new ArrayList<>();
for (ProjectBackground background : backgrounds) {
result.add(backgroundToMap(background));
}
return result;
}
public Map<String, Object> backgroundToMap(ProjectBackground background) {
Map<String, Object> result = new TreeMap<>();
result.put("idObject", background.getId());
result.put("name", background.getName());
result.put("order", background.getOrderIndex());
result.put("description", background.getDescription());
result.put("publicOverlay", true);
result.put("defaultOverlay", background.isDefaultOverlay());
result.put("googleLicenseConsent", true);
List<Map<String, Object>> images = new ArrayList<>();
List<ProjectBackgroundImageLayer> imageList = new ArrayList<>(background.getProjectBackgroundImageLayer());
imageList.sort(ProjectBackgroundImageLayer.ID_COMPARATOR);
for (ProjectBackgroundImageLayer child : imageList) {
Map<String, Object> image = new TreeMap<>();
image.put("path", child.getDirectory());
image.put("modelId", child.getModel().getId());
images.add(image);
}
result.put("images", images);
if (background.getCreator() != null) {
result.put("creator", background.getCreator().getLogin());
}
result.put("inputDataAvailable", false);
return result;
}
public Map<String, Object> overlayToMap(DataOverlay overlay) { public Map<String, Object> overlayToMap(DataOverlay overlay) {
Map<String, Object> result = new TreeMap<>(); Map<String, Object> result = new TreeMap<>();
......
...@@ -6,6 +6,7 @@ v{project-version} {build-time} ...@@ -6,6 +6,7 @@ v{project-version} {build-time}
=== <<project_data.adoc#,Project Data>> === <<project_data.adoc#,Project Data>>
=== <<project_backgrounds.adoc#,Project Backgrounds>>
=== <<project_chemicals.adoc#,Project Chemicals>> === <<project_chemicals.adoc#,Project Chemicals>>
=== <<project_comments.adoc#,Project Comments>> === <<project_comments.adoc#,Project Comments>>
=== <<project_drugs.adoc#,Project Drugs>> === <<project_drugs.adoc#,Project Drugs>>
......
= Rest API Documentation - Project backgrounds
minerva
v{project-version} {build-time}
:toc: left
:sectnums:
== List backgrounds
=== Path Parameters
include::{snippets}/projects/project_backgrounds/get_all/path-parameters.adoc[]
=== Response Fields
include::{snippets}/projects/project_backgrounds/get_all/response-fields.adoc[]
=== CURL sample
include::{snippets}/projects/project_backgrounds/get_all/curl-request.adoc[]
=== Sample Response
include::{snippets}/projects/project_backgrounds/get_all/response-body.adoc[]
== Get background by id
=== Path Parameters
include::{snippets}/projects/project_backgrounds/get_by_id/path-parameters.adoc[]
=== Response Fields
include::{snippets}/projects/project_backgrounds/get_by_id/response-fields.adoc[]
=== CURL sample
include::{snippets}/projects/project_backgrounds/get_by_id/curl-request.adoc[]
=== Sample Response
include::{snippets}/projects/project_backgrounds/get_by_id/response-body.adoc[]
== Update Background
=== Path Parameters
include::{snippets}/projects/project_backgrounds/update_background/path-parameters.adoc[]
=== Request Fields
include::{snippets}/projects/project_backgrounds/update_background/request-fields.adoc[]
=== Response Fields
include::{snippets}/projects/project_backgrounds/update_background/response-fields.adoc[]
=== CURL sample
include::{snippets}/projects/project_backgrounds/update_background/curl-request.adoc[]
=== Sample Response
include::{snippets}/projects/project_backgrounds/update_background/response-body.adoc[]
== Delete overlay
=== CURL sample
include::{snippets}/projects/project_backgrounds/delete_background/curl-request.adoc[]
=== Path Parameters
include::{snippets}/projects/project_backgrounds/delete_background/path-parameters.adoc[]
...@@ -29,9 +29,6 @@ import org.springframework.test.web.servlet.RequestBuilder; ...@@ -29,9 +29,6 @@ import org.springframework.test.web.servlet.RequestBuilder;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ser.FilterProvider;
import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import lcsb.mapviewer.api.projects.ProjectRestImpl; import lcsb.mapviewer.api.projects.ProjectRestImpl;
...@@ -960,7 +957,7 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest ...@@ -960,7 +957,7 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
.session(session); .session(session);
mockMvc.perform(request) mockMvc.perform(request)
.andExpect(status().is2xxSuccessful()) .andExpect(status().is2xxSuccessful())
.andDo(document("projects/project_data/get_backgrounds", .andDo(document("projects/project_backgrounds/get_all",
projectPathParameters(), projectPathParameters(),
responseFields().andWithPrefix("[].", getBackgroundFields()))); responseFields().andWithPrefix("[].", getBackgroundFields())));
} }
...@@ -1019,7 +1016,7 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest ...@@ -1019,7 +1016,7 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
.session(session); .session(session);
mockMvc.perform(request) mockMvc.perform(request)
.andExpect(status().is2xxSuccessful()) .andExpect(status().is2xxSuccessful())
.andDo(document("projects/project_data/get_background_by_id", .andDo(document("projects/project_backgrounds/get_by_id",
backgroundPathParameters(), backgroundPathParameters(),
responseFields(getBackgroundFields()))); responseFields(getBackgroundFields())));
} }
...@@ -1041,7 +1038,7 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest ...@@ -1041,7 +1038,7 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
String response = mockMvc.perform(request) String response = mockMvc.perform(request)
.andExpect(status().is2xxSuccessful()) .andExpect(status().is2xxSuccessful())
.andDo(document("projects/project_data/update_background", .andDo(document("projects/project_backgrounds/update_background",
backgroundPathParameters(), backgroundPathParameters(),
responseFields(getBackgroundFields()))) responseFields(getBackgroundFields())))
.andReturn().getResponse().getContentAsString(); .andReturn().getResponse().getContentAsString();
...@@ -1060,7 +1057,7 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest ...@@ -1060,7 +1057,7 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
.session(session); .session(session);
mockMvc.perform(request) mockMvc.perform(request)
.andExpect(status().is2xxSuccessful()) .andExpect(status().is2xxSuccessful())
.andDo(document("projects/project_data/delete_background", .andDo(document("projects/project_backgrounds/delete_background",
backgroundPathParameters(), backgroundPathParameters(),
responseFields())); responseFields()));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment