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

copy of element copies element id

parent a0e88924
Pipeline #43267 passed with stage
in 19 minutes and 31 seconds
......@@ -19,6 +19,8 @@ minerva (16.0.0~beta.1) stable; urgency=medium
from the database (#1508)
* Bug fix: adding user with already existing login and changing his
privileges occured with error (#1507)
* Bug fix: export model as model could cause an issue (#1500, #1502)
* Bug fix: problem with export as image with data overlays (#1503, #1498)
-- Piotr Gawron <piotr.gawron@uni.lu> Wed, 9 Jun 2021 15:00:00 +0200
......
......@@ -280,6 +280,7 @@ public abstract class Element implements BioEntity, Serializable, SbmlArgument {
* original object that will be used for creating copy
*/
protected Element(Element original) {
this.id = original.id;
this.nameHorizontalAlign = original.getNameHorizontalAlign();
this.nameVerticalAlign = original.getNameVerticalAlign();
this.nameX = original.getNameX();
......
......@@ -87,9 +87,11 @@ public class ElementTest extends ModelTestFunctions {
@Test
public void testConstructor() {
GenericProtein protein = new GenericProtein();
protein.setId(-17);
protein.setSubmodel(new ElementSubmodelConnection());
Element copy = new GenericProtein(protein);
assertNotNull(copy);
assertEquals(protein.getId(), copy.getId());
}
@Test
......
......@@ -16,7 +16,8 @@ import lcsb.mapviewer.api.BaseRestImpl;
import lcsb.mapviewer.commands.*;
import lcsb.mapviewer.common.Configuration;
import lcsb.mapviewer.common.Pair;
import lcsb.mapviewer.converter.*;
import lcsb.mapviewer.converter.Converter;
import lcsb.mapviewer.converter.ConverterException;
import lcsb.mapviewer.converter.graphics.AbstractImageGenerator.Params;
import lcsb.mapviewer.converter.graphics.DrawingException;
import lcsb.mapviewer.converter.graphics.ImageGenerators;
......@@ -59,8 +60,9 @@ public class ModelRestImpl extends BaseRestImpl {
private Logger logger = LogManager.getLogger();
@Autowired
public ModelRestImpl(IProjectBackgroundService projectBackgroundService) {
public ModelRestImpl(IProjectBackgroundService projectBackgroundService, IDataOverlayService dataOverlayService) {
this.projectBackgroundService = projectBackgroundService;
this.dataOverlayService = dataOverlayService;
}
public List<Map<String, Object>> getModels(String projectId) throws QueryException {
......@@ -212,10 +214,7 @@ public class ModelRestImpl extends BaseRestImpl {
int overlayId = parseInteger(overlayIdString, "overlayId");
DataOverlay overlay = dataOverlayService.getDataOverlayById(projectId, overlayId);
ColorSchemaReader reader = new ColorSchemaReader();
Collection<DataOverlayEntry> schemas = reader.readColorSchema(overlay.getInputData().getFileContent(),
overlay.getColorSchemaType());
Set<DataOverlayEntry> schemas = overlay.getEntries();
new ColorModelCommand(part, schemas, getUserService().getColorExtractorForUser(user)).execute();
}
......
......@@ -41,9 +41,9 @@ import lcsb.mapviewer.converter.graphics.PngImageGenerator;
import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser;
import lcsb.mapviewer.converter.model.sbgnml.SbgnmlXmlConverter;
import lcsb.mapviewer.model.Project;
import lcsb.mapviewer.model.map.layout.ProjectBackground;
import lcsb.mapviewer.model.map.model.ModelData;
import lcsb.mapviewer.model.map.species.Element;
import lcsb.mapviewer.model.overlay.DataOverlay;
import lcsb.mapviewer.model.security.PrivilegeType;
import lcsb.mapviewer.model.user.User;
import lcsb.mapviewer.modelutils.map.ElementUtils;
......@@ -651,6 +651,28 @@ public class MapControllerIntegrationTest extends ControllerIntegrationTest {
.andExpect(status().is2xxSuccessful());
}
@Test
public void testDownloadImageDataOverlay() throws Exception {
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
DataOverlay overlay = createOverlayInSeparateThread(TEST_PROJECT,
userService.getUserByLogin(BUILT_IN_TEST_ADMIN_LOGIN));
RequestBuilder request = get("/projects/{projectId}/models/{mapId}:downloadImage?" +
"handlerClass={handlerClass}&overlayIds={ids}",
TEST_PROJECT,
map.getId(),
PngImageGenerator.class.getCanonicalName(),
overlay.getId())
.session(session);
mockMvc.perform(request)
.andDo(document("projects/project_maps/download_image_data_overlay",
downloadImageRequestParameters(),
mapPathParameters()))
.andExpect(status().is2xxSuccessful());
}
@Test
public void testDownloadInfluenceMap() throws Exception {
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
......
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