Skip to content
Snippets Groups Projects
Commit 8768699d authored by Piotr Gawron's avatar Piotr Gawron
Browse files

copy command copies authors

parent be104def
No related branches found
No related tags found
1 merge request!717Resolve "process vcard data that can appear in model annotations"
......@@ -18,6 +18,7 @@ import lcsb.mapviewer.model.map.kinetics.SbmlKinetics;
import lcsb.mapviewer.model.map.kinetics.SbmlParameter;
import lcsb.mapviewer.model.map.kinetics.SbmlUnit;
import lcsb.mapviewer.model.map.layout.graphics.Layer;
import lcsb.mapviewer.model.map.model.Author;
import lcsb.mapviewer.model.map.model.ElementSubmodelConnection;
import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.model.map.model.ModelFullIndexed;
......@@ -246,6 +247,11 @@ public class CopyCommand extends NewModelCommand {
for (ModelSubmodelConnection connection : model.getSubmodelConnections()) {
result.addSubmodelConnection(connection.copy());
}
for (Author author: model.getAuthors()) {
result.addAuthor(author.copy());
}
return result;
}
......
......@@ -24,6 +24,7 @@ import lcsb.mapviewer.model.map.compartment.SquareCompartment;
import lcsb.mapviewer.model.map.kinetics.SbmlFunction;
import lcsb.mapviewer.model.map.kinetics.SbmlParameter;
import lcsb.mapviewer.model.map.layout.graphics.Layer;
import lcsb.mapviewer.model.map.model.Author;
import lcsb.mapviewer.model.map.model.ElementSubmodelConnection;
import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.model.map.model.ModelComparator;
......@@ -393,4 +394,23 @@ public class CopyCommandTest extends CommandTestFunctions {
}
}
@Test
public void testCopyModelWithAuthor() throws Exception {
try {
Model model = getModel();
model.addAuthor(new Author("Piotr", "G"));
Model copy = new CopyCommand(model).execute();
ModelComparator comparator = new ModelComparator();
assertEquals(0, comparator.compare(copy, model));
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
}
......@@ -116,4 +116,8 @@ public class Author implements Serializable {
public void setOrganisation(String organisation) {
this.organisation = organisation;
}
public Author copy() {
return new Author(this);
}
}
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