diff --git a/model/pom.xml b/model/pom.xml index 34cd348b503b647aa6bda239a10b1463b59669e7..c98001ebd1262adf26bc6571359c5934762ff88e 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -1,22 +1,25 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>lcsb.mapviewer</groupId> - <artifactId>parent</artifactId> - <version>1.0</version> - </parent> - <artifactId>model</artifactId> - <name>model MapViewer</name> - <description>Data model</description> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>lcsb.mapviewer</groupId> + <artifactId>parent</artifactId> + <version>1.0</version> + </parent> + <artifactId>model</artifactId> + <name>model MapViewer</name> + <description>Data model</description> <dependencies> <dependency> - <groupId>lcsb.mapviewer</groupId> - <artifactId>commons</artifactId> - <version>1.0</version> - </dependency> + <groupId>lcsb.mapviewer</groupId> + <artifactId>commons</artifactId> + <version>1.0</version> + </dependency> - <dependency> + <!-- Hibernate --> + <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>${hibernate.version}</version> @@ -25,42 +28,64 @@ <artifactId>xml-apis</artifactId> <groupId>xml-apis</groupId> </exclusion> + <exclusion> + <groupId>org.jboss.logging</groupId> + <artifactId>jboss-logging</artifactId> + </exclusion> + <exclusion> + <groupId>net.bytebuddy</groupId> + <artifactId>byte-buddy</artifactId> + </exclusion> </exclusions> - </dependency> - - <!-- Library excluded from above; it was in conflict with Xerces --> - <dependency> + </dependency> + + <!-- https://mvnrepository.com/artifact/net.bytebuddy/byte-buddy --> + <dependency> + <groupId>net.bytebuddy</groupId> + <artifactId>byte-buddy</artifactId> + <version>${byte-buddy.version}</version> + </dependency> + + <!-- https://mvnrepository.com/artifact/org.jboss.logging/jboss-logging --> + <dependency> + <groupId>org.jboss.logging</groupId> + <artifactId>jboss-logging</artifactId> + <version>${jboss-logging.version}</version> + </dependency> + + <!-- Library excluded from above; it was in conflict with Xerces --> + <dependency> <groupId>xml-apis</groupId> <artifactId>xml-apis</artifactId> <version>${xml-apis.version}</version> </dependency> - - <!-- Log4j - logging --> + + <!-- Log4j - logging --> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>${log4j.version}</version> </dependency> - + <dependency> - <groupId>org.reflections</groupId> - <artifactId>reflections</artifactId> + <groupId>org.reflections</groupId> + <artifactId>reflections</artifactId> <version>${reflections.version}</version> <exclusions> <exclusion> - <groupId>org.javassist</groupId> - <artifactId>javassist</artifactId> + <groupId>org.javassist</groupId> + <artifactId>javassist</artifactId> </exclusion> </exclusions> </dependency> -<!-- mockito used for testing --> + <!-- mockito used for testing --> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <version>${mockito.version}</version> <scope>test</scope> </dependency> - + </dependencies> </project> \ No newline at end of file diff --git a/model/src/main/java/lcsb/mapviewer/model/map/OverviewImage.java b/model/src/main/java/lcsb/mapviewer/model/map/OverviewImage.java index ae22a55c8d042e0707bb5946c24a4ad4afac1cbe..8d7ac37fff4cceacd026a517b78ef7dfc252999c 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/OverviewImage.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/OverviewImage.java @@ -35,197 +35,197 @@ import lcsb.mapviewer.model.map.model.ModelData; @Table(name = "overview_image_table") public class OverviewImage implements Serializable { - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * Unique database identifier. - */ - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "idDb", unique = true, nullable = false) - private int id; - - /** - * The image belongs to this {@link Project}. Links can point to any - * (sub)model in this project. - */ - @ManyToOne(fetch = FetchType.LAZY, optional = false) - private Project project; - - /** - * Name of the file in file system that reresent this overview image. - */ - private String filename; - - /** - * Width of the image. - */ - private Integer width; - - /** - * Height of the image. - */ - private Integer height; - - /** - * List of links that should redirect from this image. They can refer to - * another {@link OverviewImage} or {@link ModelData Model}. - */ - @Cascade({ CascadeType.ALL }) - @OneToMany(fetch = FetchType.EAGER, mappedBy = "overviewImage", orphanRemoval = true) - @OrderBy("id") - private List<OverviewLink> links = new ArrayList<>(); - - /** - * Default constructor. - */ - public OverviewImage() { - - } - - /** - * Default constructor with original {@link OverviewImage} as a source of - * data. - * - * @param overviewImage - * original {@link OverviewImage} - */ - public OverviewImage(OverviewImage overviewImage) { - this.setId(overviewImage.getId()); - this.setProject(overviewImage.getProject()); - this.setFilename(overviewImage.getFilename()); - this.setWidth(overviewImage.getWidth()); - this.setHeight(overviewImage.getHeight()); - for (OverviewLink ol : overviewImage.getLinks()) { - this.addLink(ol.copy()); - } - } - - /** - * @return the filename - * @see #filename - */ - public String getFilename() { - return filename; - } - - /** - * @param filename - * the filename to set - * @see #filename - */ - public void setFilename(String filename) { - this.filename = filename; - } - - /** - * @return the width - * @see #width - */ - public Integer getWidth() { - return width; - } - - /** - * @param width - * the width to set - * @see #width - */ - public void setWidth(Integer width) { - this.width = width; - } - - /** - * @return the height - * @see #height - */ - public Integer getHeight() { - return height; - } - - /** - * @param height - * the height to set - * @see #height - */ - public void setHeight(Integer height) { - this.height = height; - } - - /** - * @return the links - * @see #links - */ - public List<OverviewLink> getLinks() { - return links; - } - - /** - * @param links - * the links to set - * @see #links - */ - public void setLinks(List<OverviewLink> links) { - this.links = links; - } - - /** - * @return the id - * @see #id - */ - public int getId() { - return id; - } - - /** - * @param id - * the id to set - * @see #id - */ - public void setId(int id) { - this.id = id; - } - - /** - * Adds {@link OverviewLink link } to {@link #links}. - * - * @param oml - * object to add - */ - public void addLink(OverviewLink oml) { - links.add(oml); - oml.setOverviewImage(this); - } - - /** - * Creates a copy of the object. - * - * @return copy of the object - */ - public OverviewImage copy() { - if (this.getClass() == OverviewImage.class) { - return new OverviewImage(this); - } else { - throw new NotImplementedException("Method copy() should be overriden in class " + this.getClass()); - } - } - - /** - * @return the project - * @see #project - */ - public Project getProject() { - return project; - } - - /** - * @param project the project to set - * @see #project - */ - public void setProject(Project project) { - this.project = project; - } + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Unique database identifier. + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "idDb", unique = true, nullable = false) + private int id; + + /** + * The image belongs to this {@link Project}. Links can point to any (sub)model + * in this project. + */ + @ManyToOne(fetch = FetchType.LAZY, optional = false) + private Project project; + + /** + * Name of the file in file system that represent this overview image. + */ + private String filename; + + /** + * Width of the image. + */ + private Integer width; + + /** + * Height of the image. + */ + private Integer height; + + /** + * List of links that should redirect from this image. They can refer to another + * {@link OverviewImage} or {@link ModelData Model}. + */ + @Cascade({ CascadeType.ALL }) + @OneToMany(fetch = FetchType.EAGER, mappedBy = "overviewImage") + @OrderBy("id") + private List<OverviewLink> links = new ArrayList<>(); + + /** + * Default constructor. + */ + public OverviewImage() { + + } + + /** + * Default constructor with original {@link OverviewImage} as a source of data. + * + * @param overviewImage + * original {@link OverviewImage} + */ + public OverviewImage(OverviewImage overviewImage) { + this.setId(overviewImage.getId()); + this.setProject(overviewImage.getProject()); + this.setFilename(overviewImage.getFilename()); + this.setWidth(overviewImage.getWidth()); + this.setHeight(overviewImage.getHeight()); + for (OverviewLink ol : overviewImage.getLinks()) { + this.addLink(ol.copy()); + } + } + + /** + * @return the filename + * @see #filename + */ + public String getFilename() { + return filename; + } + + /** + * @param filename + * the filename to set + * @see #filename + */ + public void setFilename(String filename) { + this.filename = filename; + } + + /** + * @return the width + * @see #width + */ + public Integer getWidth() { + return width; + } + + /** + * @param width + * the width to set + * @see #width + */ + public void setWidth(Integer width) { + this.width = width; + } + + /** + * @return the height + * @see #height + */ + public Integer getHeight() { + return height; + } + + /** + * @param height + * the height to set + * @see #height + */ + public void setHeight(Integer height) { + this.height = height; + } + + /** + * @return the links + * @see #links + */ + public List<OverviewLink> getLinks() { + return links; + } + + /** + * @param links + * the links to set + * @see #links + */ + public void setLinks(List<OverviewLink> links) { + this.links = links; + } + + /** + * @return the id + * @see #id + */ + public int getId() { + return id; + } + + /** + * @param id + * the id to set + * @see #id + */ + public void setId(int id) { + this.id = id; + } + + /** + * Adds {@link OverviewLink link } to {@link #links}. + * + * @param oml + * object to add + */ + public void addLink(OverviewLink oml) { + links.add(oml); + oml.setOverviewImage(this); + } + + /** + * Creates a copy of the object. + * + * @return copy of the object + */ + public OverviewImage copy() { + if (this.getClass() == OverviewImage.class) { + return new OverviewImage(this); + } else { + throw new NotImplementedException("Method copy() should be overriden in class " + this.getClass()); + } + } + + /** + * @return the project + * @see #project + */ + public Project getProject() { + return project; + } + + /** + * @param project + * the project to set + * @see #project + */ + public void setProject(Project project) { + this.project = project; + } } diff --git a/model/src/main/java/lcsb/mapviewer/model/map/OverviewModelLink.java b/model/src/main/java/lcsb/mapviewer/model/map/OverviewModelLink.java index 074874ae3e5131959763c2f3dce76b55a2416c0b..81c45341ec21b38d3d6549bc6ce374fb99bf999d 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/OverviewModelLink.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/OverviewModelLink.java @@ -28,7 +28,7 @@ public class OverviewModelLink extends OverviewLink { /** * Model to which this links is going. */ - @ManyToOne(fetch = FetchType.LAZY, optional = false) + @ManyToOne(fetch = FetchType.LAZY, optional = false) private ModelData linkedModel; /** diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/graphics/Layer.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/graphics/Layer.java index 1a9237adffdf9989696bc55af399e1230162bcda..958615af329981051f42e24cb9d07f41d2810c5e 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/graphics/Layer.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/graphics/Layer.java @@ -11,6 +11,8 @@ import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; @@ -35,367 +37,375 @@ import lcsb.mapviewer.model.map.model.ModelData; @Table(name = "layer_table") public class Layer implements Serializable { - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * Default class logger. - */ - @SuppressWarnings("unused") - private static Logger logger = Logger.getLogger(Layer.class); - - /** - * Unique database identifier. - */ - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "idDb", unique = true, nullable = false) - private int id; - - /** - * Layer identifier (unique in single model). - */ - private String layerId; - - /** - * Layer name. - */ - private String name; - - /** - * Is the layer visible. - */ - private boolean visible; - - /** - * Is the layer locekd (can be edited). - */ - private boolean locked; - - /** - * List of text objects on the layer. - */ - @Cascade({ CascadeType.ALL }) - @OneToMany(fetch = FetchType.EAGER) - @IndexColumn(name = "idx") - private List<LayerText> texts = new ArrayList<LayerText>(); - - /** - * List of line objects on the layer. - */ - @Cascade({ CascadeType.ALL }) - @OneToMany(fetch = FetchType.EAGER) - @IndexColumn(name = "idx") - private List<PolylineData> lines = new ArrayList<PolylineData>(); - - /** - * List of rectangle objects on the layer. - */ - @Cascade({ CascadeType.ALL }) - @OneToMany(fetch = FetchType.EAGER) - @IndexColumn(name = "idx") - private List<LayerRect> rectangles = new ArrayList<LayerRect>(); - - /** - * List of oval objects on the layer. - */ - @Cascade({ CascadeType.ALL }) - @OneToMany(fetch = FetchType.EAGER) - @IndexColumn(name = "idx") - private List<LayerOval> ovals = new ArrayList<LayerOval>(); - - /** - * ModelData to which layer belongs to. - */ - @ManyToOne(fetch = FetchType.LAZY) - private ModelData model; - - /** - * Default constructor. - */ - public Layer() { - } - - /** - * Constructor that copies data from the parameter. - * - * @param layer - * from this paramter layer data will be copied - */ - public Layer(Layer layer) { - layerId = layer.getLayerId(); - name = layer.getName(); - visible = layer.isVisible(); - locked = layer.isLocked(); - - for (LayerText lt : layer.getTexts()) { - addLayerText(lt.copy()); - } - - for (PolylineData lt : layer.getLines()) { - addLayerLine(lt.copy()); - } - - for (LayerRect lt : layer.getRectangles()) { - addLayerRect(lt.copy()); - } - - for (LayerOval lt : layer.getOvals()) { - addLayerOval(lt.copy()); - } - - model = layer.getModel(); - } - - /** - * Makes copy of the layer. - * - * @return copy of the layer - */ - public Layer copy() { - if (this.getClass() == Layer.class) { - return new Layer(this); - } else { - throw new NotImplementedException("Method copy() should be overriden in class " + this.getClass()); - } - } - - /** - * @return the model - * @see #model - */ - public ModelData getModel() { - return model; - } - - /** - * @param model - * the model to set - * @see #model - */ - public void setModel(ModelData model) { - this.model = model; - } - - /** - * @return the ovals - * @see #ovals - */ - public List<LayerOval> getOvals() { - return ovals; - } - - /** - * @param ovals - * the ovals to set - * @see #ovals - */ - public void setOvals(List<LayerOval> ovals) { - this.ovals = ovals; - } - - /** - * @return the rectangles - * @see #rectangles - */ - public List<LayerRect> getRectangles() { - return rectangles; - } - - /** - * @param rectangles - * the rectangles to set - * @see #rectangles - */ - public void setRectangles(List<LayerRect> rectangles) { - this.rectangles = rectangles; - } - - /** - * @return the lines - * @see #lines - */ - public List<PolylineData> getLines() { - return lines; - } - - /** - * @param lines - * the lines to set - * @see #lines - */ - public void setLines(List<PolylineData> lines) { - this.lines = lines; - } - - /** - * @return the texts - * @see #texts - */ - public List<LayerText> getTexts() { - return texts; - } - - /** - * @param texts - * the texts to set - * @see #texts - */ - public void setTexts(List<LayerText> texts) { - this.texts = texts; - } - - /** - * @return the locked - * @see #locked - */ - public boolean isLocked() { - return locked; - } - - /** - * @param locked - * the locked to set - * @see #locked - */ - public void setLocked(boolean locked) { - this.locked = locked; - } - - /** - * @return the visible - * @see #visible - */ - public boolean isVisible() { - return visible; - } - - /** - * @param visible - * the visible to set - * @see #visible - */ - public void setVisible(boolean visible) { - this.visible = visible; - } - - /** - * @return the name - * @see #name - */ - public String getName() { - return name; - } - - /** - * @param name - * the name to set - * @see #name - */ - public void setName(String name) { - this.name = name; - } - - /** - * Sets locked param from the text input. - * - * @param param - * text representing true/false - * @see #locked - */ - public void setLocked(String param) { - locked = param.equalsIgnoreCase("TRUE"); - } - - /** - * Sets visible param from the text input. - * - * @param param - * text representing true/false - * @see #visible - */ - public void setVisible(String param) { - visible = param.equalsIgnoreCase("TRUE"); - } - - /** - * Adds text to the layer. - * - * @param layerText - * text to add - */ - public void addLayerText(LayerText layerText) { - texts.add(layerText); - } - - /** - * Adds rectangle to the layer. - * - * @param layerRect - * rectangle to add - */ - public void addLayerRect(LayerRect layerRect) { - rectangles.add(layerRect); - } - - /** - * Adds oval to the layer. - * - * @param layerOval - * oval to add - */ - public void addLayerOval(LayerOval layerOval) { - ovals.add(layerOval); - } - - /** - * Adds line to the layer. - * - * @param layerLine - * line to add - */ - public void addLayerLine(PolylineData layerLine) { - lines.add(layerLine); - } - - /** - * @return the layerId - * @see #layerId - */ - public String getLayerId() { - return layerId; - } - - /** - * @param layerId - * the layerId to set - * @see #layerId - */ - public void setLayerId(String layerId) { - this.layerId = layerId; - } - - /** - * Adds lines to the layer. - * - * @param lines - * lines to add - */ - public void addLayerLines(Collection<PolylineData> lines) { - for (PolylineData layerLine : lines) { - addLayerLine(layerLine); - } - } - - /** - * Removes {@link LayerText} from {@link Layer}. - * - * @param toRemove - * object to remove - */ - public void removeLayerText(LayerText toRemove) { - texts.remove(toRemove); - } + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Default class logger. + */ + @SuppressWarnings("unused") + private static Logger logger = Logger.getLogger(Layer.class); + + /** + * Unique database identifier. + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "idDb", unique = true, nullable = false) + private int id; + + /** + * Layer identifier (unique in single model). + */ + private String layerId; + + /** + * Layer name. + */ + private String name; + + /** + * Is the layer visible. + */ + private boolean visible; + + /** + * Is the layer locked (can be edited). + */ + private boolean locked; + + /** + * List of text objects on the layer. + */ + @Cascade({ CascadeType.ALL }) + @OneToMany(fetch = FetchType.EAGER) + @IndexColumn(name = "idx") + @JoinTable( joinColumns = { + @JoinColumn(name = "layer_table_iddb", referencedColumnName = "idDb", nullable = false, updatable = false) }) + private List<LayerText> texts = new ArrayList<>(); + + /** + * List of line objects on the layer. + */ + @Cascade({ CascadeType.ALL }) + @OneToMany(fetch = FetchType.EAGER) + @IndexColumn(name = "idx") + @JoinTable( joinColumns = { + @JoinColumn(name = "layer_table_iddb", referencedColumnName = "idDb", nullable = false, updatable = false) }) + private List<PolylineData> lines = new ArrayList<>(); + + /** + * List of rectangle objects on the layer. + */ + @Cascade({ CascadeType.ALL }) + @OneToMany(fetch = FetchType.EAGER) + @IndexColumn(name = "idx") + @JoinTable( joinColumns = { + @JoinColumn(name = "layer_table_iddb", referencedColumnName = "idDb", nullable = false, updatable = false) }) + private List<LayerRect> rectangles = new ArrayList<>(); + + /** + * List of oval objects on the layer. + */ + @Cascade({ CascadeType.ALL }) + @OneToMany(fetch = FetchType.EAGER) + @IndexColumn(name = "idx") + @JoinTable( joinColumns = { + @JoinColumn(name = "layer_table_iddb", referencedColumnName = "idDb", nullable = false, updatable = false) }) + private List<LayerOval> ovals = new ArrayList<>(); + + /** + * ModelData to which layer belongs to. + */ + @ManyToOne(fetch = FetchType.LAZY) + private ModelData model; + + /** + * Default constructor. + */ + public Layer() { + } + + /** + * Constructor that copies data from the parameter. + * + * @param layer + * from this parameter layer data will be copied + */ + public Layer(Layer layer) { + layerId = layer.getLayerId(); + name = layer.getName(); + visible = layer.isVisible(); + locked = layer.isLocked(); + + for (LayerText lt : layer.getTexts()) { + addLayerText(lt.copy()); + } + + for (PolylineData lt : layer.getLines()) { + addLayerLine(lt.copy()); + } + + for (LayerRect lt : layer.getRectangles()) { + addLayerRect(lt.copy()); + } + + for (LayerOval lt : layer.getOvals()) { + addLayerOval(lt.copy()); + } + + model = layer.getModel(); + } + + /** + * Makes copy of the layer. + * + * @return copy of the layer + */ + public Layer copy() { + if (this.getClass() == Layer.class) { + return new Layer(this); + } else { + throw new NotImplementedException("Method copy() should be overriden in class " + this.getClass()); + } + } + + /** + * @return the model + * @see #model + */ + public ModelData getModel() { + return model; + } + + /** + * @param model + * the model to set + * @see #model + */ + public void setModel(ModelData model) { + this.model = model; + } + + /** + * @return the ovals + * @see #ovals + */ + public List<LayerOval> getOvals() { + return ovals; + } + + /** + * @param ovals + * the ovals to set + * @see #ovals + */ + public void setOvals(List<LayerOval> ovals) { + this.ovals = ovals; + } + + /** + * @return the rectangles + * @see #rectangles + */ + public List<LayerRect> getRectangles() { + return rectangles; + } + + /** + * @param rectangles + * the rectangles to set + * @see #rectangles + */ + public void setRectangles(List<LayerRect> rectangles) { + this.rectangles = rectangles; + } + + /** + * @return the lines + * @see #lines + */ + public List<PolylineData> getLines() { + return lines; + } + + /** + * @param lines + * the lines to set + * @see #lines + */ + public void setLines(List<PolylineData> lines) { + this.lines = lines; + } + + /** + * @return the texts + * @see #texts + */ + public List<LayerText> getTexts() { + return texts; + } + + /** + * @param texts + * the texts to set + * @see #texts + */ + public void setTexts(List<LayerText> texts) { + this.texts = texts; + } + + /** + * @return the locked + * @see #locked + */ + public boolean isLocked() { + return locked; + } + + /** + * @param locked + * the locked to set + * @see #locked + */ + public void setLocked(boolean locked) { + this.locked = locked; + } + + /** + * @return the visible + * @see #visible + */ + public boolean isVisible() { + return visible; + } + + /** + * @param visible + * the visible to set + * @see #visible + */ + public void setVisible(boolean visible) { + this.visible = visible; + } + + /** + * @return the name + * @see #name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + * @see #name + */ + public void setName(String name) { + this.name = name; + } + + /** + * Sets locked param from the text input. + * + * @param param + * text representing true/false + * @see #locked + */ + public void setLocked(String param) { + locked = param.equalsIgnoreCase("TRUE"); + } + + /** + * Sets visible param from the text input. + * + * @param param + * text representing true/false + * @see #visible + */ + public void setVisible(String param) { + visible = param.equalsIgnoreCase("TRUE"); + } + + /** + * Adds text to the layer. + * + * @param layerText + * text to add + */ + public void addLayerText(LayerText layerText) { + texts.add(layerText); + } + + /** + * Adds rectangle to the layer. + * + * @param layerRect + * rectangle to add + */ + public void addLayerRect(LayerRect layerRect) { + rectangles.add(layerRect); + } + + /** + * Adds oval to the layer. + * + * @param layerOval + * oval to add + */ + public void addLayerOval(LayerOval layerOval) { + ovals.add(layerOval); + } + + /** + * Adds line to the layer. + * + * @param layerLine + * line to add + */ + public void addLayerLine(PolylineData layerLine) { + lines.add(layerLine); + } + + /** + * @return the layerId + * @see #layerId + */ + public String getLayerId() { + return layerId; + } + + /** + * @param layerId + * the layerId to set + * @see #layerId + */ + public void setLayerId(String layerId) { + this.layerId = layerId; + } + + /** + * Adds lines to the layer. + * + * @param lines + * lines to add + */ + public void addLayerLines(Collection<PolylineData> lines) { + for (PolylineData layerLine : lines) { + addLayerLine(layerLine); + } + } + + /** + * Removes {@link LayerText} from {@link Layer}. + * + * @param toRemove + * object to remove + */ + public void removeLayerText(LayerText toRemove) { + texts.remove(toRemove); + } } diff --git a/model/src/main/java/lcsb/mapviewer/model/map/layout/graphics/LayerRect.java b/model/src/main/java/lcsb/mapviewer/model/map/layout/graphics/LayerRect.java index 5950e688014471725097e021db59f9c71673365d..6ad9b5ce749c59aa25bdaea7213aa48ea8eb8ff2 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/layout/graphics/LayerRect.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/layout/graphics/LayerRect.java @@ -5,9 +5,11 @@ import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; +import javax.persistence.ManyToOne; import org.apache.log4j.Logger; @@ -23,223 +25,222 @@ import lcsb.mapviewer.common.exception.NotImplementedException; @Entity public class LayerRect implements Serializable { - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * Default class logger. - */ - @SuppressWarnings("unused") - private static Logger logger = Logger.getLogger(LayerRect.class); - - /** - * Unique database identifier. - */ - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "idDb", unique = true, nullable = false) - private int id; - - /** - * Color of the rectangle. - */ - private Color color; - - /** - * X coordinate of top left corner. - */ - private Double x = 0.0; - - /** - * Y coordinate of top left corner. - */ - private Double y = 0.0; - - /** - * Width of the rectangle. - */ - private Double width = 0.0; - - /** - * Height of the rectangle. - */ - private Double height = 0.0; - - /** - * Default constructor. - */ - public LayerRect() { - - } - - /** - * Constructor that copies data from the parameter. - * - * @param layerRect - * from this paramter line data will be copied - */ - public LayerRect(LayerRect layerRect) { - color = layerRect.getColor(); - x = layerRect.getX(); - y = layerRect.getY(); - width = layerRect.getWidth(); - height = layerRect.getHeight(); - } - - /** - * Set x from string containing double value. - * - * @param param - * x of the line in text format - */ - public void setX(String param) { - try { - x = Double.parseDouble(param); - } catch (NumberFormatException e) { - throw new InvalidArgumentException("Invalid x value: " + param, e); - } - } - - /** - * Set y from string containing double value. - * - * @param param - * y of the line in text format - */ - public void setY(String param) { - try { - y = Double.parseDouble(param); - } catch (NumberFormatException e) { - throw new InvalidArgumentException("Invalid y value: " + param, e); - } - } - - /** - * Set width from string containing double value. - * - * @param param - * width of the line in text format - */ - public void setWidth(String param) { - try { - width = Double.parseDouble(param); - } catch (NumberFormatException e) { - throw new InvalidArgumentException("Invalid width value: " + param, e); - } - } - - /** - * Set height from string containing double value. - * - * @param param - * height of the line in text format - */ - public void setHeight(String param) { - try { - height = Double.parseDouble(param); - } catch (NumberFormatException e) { - throw new InvalidArgumentException("Invalid height value: " + param, e); - } - } - - /** - * Prepares a copy of the object. - * - * @return copy of LayerRect - */ - public LayerRect copy() { - if (this.getClass() == LayerRect.class) { - return new LayerRect(this); - } else { - throw new NotImplementedException("Method copy() should be overriden in class " + this.getClass()); - } - } - - /** - * @return the color - * @see #color - */ - public Color getColor() { - return color; - } - - /** - * @param color - * the color to set - * @see #color - */ - public void setColor(Color color) { - this.color = color; - } - - /** - * @return the x - * @see #x - */ - public Double getX() { - return x; - } - - /** - * @param x - * the x to set - * @see #x - */ - public void setX(Double x) { - this.x = x; - } - - /** - * @return the y - * @see #y - */ - public Double getY() { - return y; - } - - /** - * @param y - * the y to set - * @see #y - */ - public void setY(Double y) { - this.y = y; - } - - /** - * @return the width - * @see #width - */ - public Double getWidth() { - return width; - } - - /** - * @param width - * the width to set - * @see #width - */ - public void setWidth(Double width) { - this.width = width; - } - - /** - * @return the height - * @see #height - */ - public Double getHeight() { - return height; - } - - /** - * @param height - * the height to set - * @see #height - */ - public void setHeight(Double height) { - this.height = height; - } - + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Default class logger. + */ + @SuppressWarnings("unused") + private static Logger logger = Logger.getLogger(LayerRect.class); + + /** + * Unique database identifier. + */ + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "idDb", unique = true, nullable = false) + private int id; + + /** + * Color of the rectangle. + */ + private Color color; + + /** + * X coordinate of top left corner. + */ + private Double x = 0.0; + + /** + * Y coordinate of top left corner. + */ + private Double y = 0.0; + + /** + * Width of the rectangle. + */ + private Double width = 0.0; + + /** + * Height of the rectangle. + */ + private Double height = 0.0; + + /** + * Default constructor. + */ + public LayerRect() { + + } + + /** + * Constructor that copies data from the parameter. + * + * @param layerRect + * from this parameter line data will be copied + */ + public LayerRect(LayerRect layerRect) { + color = layerRect.getColor(); + x = layerRect.getX(); + y = layerRect.getY(); + width = layerRect.getWidth(); + height = layerRect.getHeight(); + } + + /** + * Set x from string containing double value. + * + * @param param + * x of the line in text format + */ + public void setX(String param) { + try { + x = Double.parseDouble(param); + } catch (NumberFormatException e) { + throw new InvalidArgumentException("Invalid x value: " + param, e); + } + } + + /** + * Set y from string containing double value. + * + * @param param + * y of the line in text format + */ + public void setY(String param) { + try { + y = Double.parseDouble(param); + } catch (NumberFormatException e) { + throw new InvalidArgumentException("Invalid y value: " + param, e); + } + } + + /** + * Set width from string containing double value. + * + * @param param + * width of the line in text format + */ + public void setWidth(String param) { + try { + width = Double.parseDouble(param); + } catch (NumberFormatException e) { + throw new InvalidArgumentException("Invalid width value: " + param, e); + } + } + + /** + * Set height from string containing double value. + * + * @param param + * height of the line in text format + */ + public void setHeight(String param) { + try { + height = Double.parseDouble(param); + } catch (NumberFormatException e) { + throw new InvalidArgumentException("Invalid height value: " + param, e); + } + } + + /** + * Prepares a copy of the object. + * + * @return copy of LayerRect + */ + public LayerRect copy() { + if (this.getClass() == LayerRect.class) { + return new LayerRect(this); + } else { + throw new NotImplementedException("Method copy() should be overriden in class " + this.getClass()); + } + } + + /** + * @return the color + * @see #color + */ + public Color getColor() { + return color; + } + + /** + * @param color + * the color to set + * @see #color + */ + public void setColor(Color color) { + this.color = color; + } + + /** + * @return the x + * @see #x + */ + public Double getX() { + return x; + } + + /** + * @param x + * the x to set + * @see #x + */ + public void setX(Double x) { + this.x = x; + } + + /** + * @return the y + * @see #y + */ + public Double getY() { + return y; + } + + /** + * @param y + * the y to set + * @see #y + */ + public void setY(Double y) { + this.y = y; + } + + /** + * @return the width + * @see #width + */ + public Double getWidth() { + return width; + } + + /** + * @param width + * the width to set + * @see #width + */ + public void setWidth(Double width) { + this.width = width; + } + + /** + * @return the height + * @see #height + */ + public Double getHeight() { + return height; + } + + /** + * @param height + * the height to set + * @see #height + */ + public void setHeight(Double height) { + this.height = height; + } } diff --git a/model/src/main/java/lcsb/mapviewer/model/map/model/ModelData.java b/model/src/main/java/lcsb/mapviewer/model/map/model/ModelData.java index b913f2a50d8d95ae6da6beed8d0741462f1a6b35..f54259d9e0b09a6222c6a3c83add0025bd305796 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/model/ModelData.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/model/ModelData.java @@ -30,6 +30,7 @@ import org.hibernate.annotations.CascadeType; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.model.Project; +import lcsb.mapviewer.model.map.OverviewModelLink; import lcsb.mapviewer.model.map.kinetics.SbmlFunction; import lcsb.mapviewer.model.map.kinetics.SbmlParameter; import lcsb.mapviewer.model.map.kinetics.SbmlUnit; @@ -194,7 +195,7 @@ public class ModelData implements Serializable { /** * Project to which this model belong to. */ - @ManyToOne(fetch = FetchType.LAZY, optional = false) + @ManyToOne(fetch = FetchType.LAZY) private Project project; // This field should be transient in hibernate and during the transformation @@ -221,6 +222,11 @@ public class ModelData implements Serializable { @OneToMany(fetch = FetchType.LAZY, mappedBy = "submodel") private Set<SubmodelConnection> parentModels = new HashSet<>(); + + @Cascade({ CascadeType.ALL }) + @OneToMany(fetch = FetchType.LAZY, mappedBy = "linkedModel") + private Set<OverviewModelLink> imageLinks = new HashSet<>(); + /** * Default constructor. */ diff --git a/persist/pom.xml b/persist/pom.xml index 5a6cd0fff26561bddb438d4f1912aa9373c10c1c..b23f71d657f86c735fc2c6269487050510c87e9d 100644 --- a/persist/pom.xml +++ b/persist/pom.xml @@ -47,9 +47,31 @@ <artifactId>xml-apis</artifactId> <groupId>xml-apis</groupId> </exclusion> + <exclusion> + <groupId>org.jboss.logging</groupId> + <artifactId>jboss-logging</artifactId> + </exclusion> + <exclusion> + <groupId>net.bytebuddy</groupId> + <artifactId>byte-buddy</artifactId> + </exclusion> </exclusions> </dependency> + <!-- https://mvnrepository.com/artifact/net.bytebuddy/byte-buddy --> + <dependency> + <groupId>net.bytebuddy</groupId> + <artifactId>byte-buddy</artifactId> + <version>${byte-buddy.version}</version> + </dependency> + + <!-- https://mvnrepository.com/artifact/org.jboss.logging/jboss-logging --> + <dependency> + <groupId>org.jboss.logging</groupId> + <artifactId>jboss-logging</artifactId> + <version>${jboss-logging.version}</version> + </dependency> + <!-- Library excluded from above; it was in conflict with Xerces --> <dependency> <groupId>xml-apis</groupId> diff --git a/persist/src/main/java/lcsb/mapviewer/persist/DbUtils.java b/persist/src/main/java/lcsb/mapviewer/persist/DbUtils.java index 6729733e77bad2214d9e3159e1b1aaf52298e3f1..8d1e6636fb411730411bf3a345d559f2f54d8248 100644 --- a/persist/src/main/java/lcsb/mapviewer/persist/DbUtils.java +++ b/persist/src/main/java/lcsb/mapviewer/persist/DbUtils.java @@ -5,21 +5,12 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Observable; -import javax.management.MBeanServer; -import javax.management.ObjectName; - import org.apache.log4j.Logger; -import org.flywaydb.core.Flyway; import org.hibernate.SQLQuery; import org.hibernate.Session; import org.hibernate.SessionFactory; -import org.hibernate.internal.SessionFactoryImpl; -import org.hibernate.jmx.StatisticsService; -import org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl; import org.springframework.beans.factory.annotation.Autowired; -import com.mchange.v2.c3p0.ComboPooledDataSource; - import lcsb.mapviewer.common.exception.InvalidStateException; /** @@ -28,7 +19,7 @@ import lcsb.mapviewer.common.exception.InvalidStateException; * <ul> * <li>default - created and managed by sessionFactory</li> * <li>custom - created and managed by this class, used only when new thread is - * created manualy.</li> + * created manually.</li> * </ul> * Class extends {@link Observable}. Whenever session is created or closed * observers are notified. @@ -50,23 +41,6 @@ public class DbUtils extends Observable { @Autowired private SessionFactory sessionFactory; - /** - * Service used for connection statistics. - */ - private StatisticsService statisticsService; - - /** - * This flag indicates if the object was initialized or not. - * - * @see #init() - */ - private boolean initialized = false; - - /** - * Bean used for statistics. - */ - private MBeanServer mbeanServer; - /** * Static map containing opened custom sessions. This object is also used for * synchronization between threads when accessing informations about sessions. @@ -85,33 +59,6 @@ public class DbUtils extends Observable { */ private static Map<Long, Boolean> autoFlushForThread = new HashMap<>(); - /** - * This method initialize services responsible for statistics. - */ - private void init() { - if (!initialized) { - if (SpringApplicationContext.getApplicationContext().containsBean("mbeanServer")) { - logger.info("Hibernate statistics turned on"); - mbeanServer = SpringApplicationContext.getApplicationContext().getBean(MBeanServer.class); - statisticsService = new StatisticsService(); - statisticsService.setSessionFactory(sessionFactory); - statisticsService.setStatisticsEnabled(true); - ObjectName objectName; - try { - objectName = new ObjectName("org.hibernate:name=HibernateStatistics"); - - mbeanServer.registerMBean(statisticsService, objectName); - } catch (Exception e) { - logger.error(e, e); - } - } else { - logger.info("Hibernate statistics turned off"); - } - } - initialized = true; - - } - /** * Executes sql query given in the parameter. * @@ -195,9 +142,6 @@ public class DbUtils extends Observable { Session session = null; synchronized (sessionForThread) { session = sessionForThread.get(id); - if (!initialized) { - init(); - } } // we cannot create two threads for one session @@ -209,10 +153,6 @@ public class DbUtils extends Observable { logger.debug("Session opened: " + id); session.beginTransaction(); logger.debug("Session started: " + id); - if (statisticsService != null) { - logger.debug("Opened sessions: " + statisticsService.getSessionOpenCount() + ". Closed sessions: " - + statisticsService.getSessionCloseCount()); - } Integer counter = -1; synchronized (sessionForThread) { sessionForThread.put(id, session); diff --git a/persist/src/main/java/lcsb/mapviewer/persist/dao/BaseDao.java b/persist/src/main/java/lcsb/mapviewer/persist/dao/BaseDao.java index 244554d641b0d613dfa88c7f67eacf7e8327d3f5..e14f32579f9aeac632c9dd62dc1819e4fc7707af 100644 --- a/persist/src/main/java/lcsb/mapviewer/persist/dao/BaseDao.java +++ b/persist/src/main/java/lcsb/mapviewer/persist/dao/BaseDao.java @@ -251,8 +251,8 @@ public abstract class BaseDao<T> { @SuppressWarnings("unchecked") public T getById(int id) { List<?> list = getSession() - .createQuery(" from " + this.clazz.getSimpleName() + " where id=? " + removableAndStatemant()) - .setParameter(0, id).list(); + .createQuery(" from " + this.clazz.getSimpleName() + " where id=:id " + removableAndStatemant()) + .setParameter("id", id).list(); if (list.size() == 0) { return null; } else { diff --git a/persist/src/main/java/lcsb/mapviewer/persist/dao/ProjectDao.java b/persist/src/main/java/lcsb/mapviewer/persist/dao/ProjectDao.java index d03df9369724c9a389a8281203f5f064acb2b7eb..66af35c7124cbefab08bc93490ce1ac6d6bccb37 100644 --- a/persist/src/main/java/lcsb/mapviewer/persist/dao/ProjectDao.java +++ b/persist/src/main/java/lcsb/mapviewer/persist/dao/ProjectDao.java @@ -8,8 +8,6 @@ import java.util.List; import org.hibernate.dialect.Dialect; import org.hibernate.jdbc.ReturningWork; -import org.hibernate.service.jdbc.dialect.internal.StandardDialectResolver; -import org.hibernate.service.jdbc.dialect.spi.DialectResolver; import lcsb.mapviewer.model.Project; import lcsb.mapviewer.model.map.model.ModelData; @@ -78,8 +76,7 @@ public class ProjectDao extends BaseDao<Project> { ReturningWork<Long> maxReturningWork = new ReturningWork<Long>() { @Override public Long execute(Connection connection) throws SQLException { - DialectResolver dialectResolver = new StandardDialectResolver(); - Dialect dialect = dialectResolver.resolveDialect(connection.getMetaData()); + Dialect dialect = Dialect.getDialect(connection.getClientInfo()); PreparedStatement preparedStatement = null; ResultSet resultSet = null; try { diff --git a/persist/src/main/java/lcsb/mapviewer/persist/mapper/Point2DMapper.java b/persist/src/main/java/lcsb/mapviewer/persist/mapper/Point2DMapper.java index afab6a1aabb4c5bb958b22369bf63e233abe4f3a..9c1b53670508e1976e914c8efc81395b4712c5df 100644 --- a/persist/src/main/java/lcsb/mapviewer/persist/mapper/Point2DMapper.java +++ b/persist/src/main/java/lcsb/mapviewer/persist/mapper/Point2DMapper.java @@ -6,7 +6,8 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.HibernateException; +import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.type.StringType; import org.hibernate.type.Type; import org.hibernate.usertype.CompositeUserType; @@ -19,108 +20,112 @@ import org.hibernate.usertype.CompositeUserType; */ public class Point2DMapper implements CompositeUserType { - @Override - public String[] getPropertyNames() { - return new String[] { "val" }; - } - - @Override - public Type[] getPropertyTypes() { - return new Type[] { StringType.INSTANCE }; - } - - @Override - public Object getPropertyValue(Object component, int property) { - Object returnValue = null; - final Point2D point = (Point2D) component; - if (0 == property) { - returnValue = point.getX() + "," + point.getY(); - } - return returnValue; - } - - @Override - public void setPropertyValue(Object component, int property, Object value) { - final Point2D point = (Point2D) component; - if (0 == property) { - final String[] values = ((String) value).split(","); - point.setLocation(Double.parseDouble(values[0]), Double.parseDouble(values[1])); - } - } - - @Override - public Class<?> returnedClass() { - return Point2D.class; - } - - @Override - public boolean equals(Object o1, Object o2) { - boolean isEqual = false; - if (o1 == o2) { - isEqual = false; - } - if (null == o1 || null == o2) { - isEqual = false; - } else { - isEqual = o1.equals(o2); - } - return isEqual; - } - - @Override - public int hashCode(Object x) { - return x.hashCode(); - } - - @Override - public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws SQLException { - Point2D point = null; - final String val = rs.getString(names[0]); - if (!rs.wasNull()) { - final String[] values = val.split(","); - point = new Point2D.Double(Double.parseDouble(values[0]), Double.parseDouble(values[1])); - } - return point; - } - - @Override - public void nullSafeSet(PreparedStatement st, Object value, int property, SessionImplementor session) throws SQLException { - if (value == null) { - st.setNull(property, StringType.INSTANCE.sqlType()); - } else { - final Point2D point = (Point2D) value; - st.setString(property, point.getX() + "," + point.getY()); - } - } - - @Override - public Object deepCopy(Object value) { - if (value == null) { - return null; - } - final Point2D recievedParam = (Point2D) value; - final Point2D point = new Point2D.Double(recievedParam.getX(), recievedParam.getY()); - return point; - } - - @Override - public boolean isMutable() { - return true; - } - - @Override - public Serializable disassemble(Object value, SessionImplementor session) { - return (Serializable) value; - } - - @Override - public Object assemble(Serializable cached, SessionImplementor session, Object owner) { - return cached; - } - - @Override - public Object replace(Object original, Object target, SessionImplementor session, Object owner) { - return this.deepCopy(original); - } + @Override + public String[] getPropertyNames() { + return new String[] { "val" }; + } + + @Override + public Type[] getPropertyTypes() { + return new Type[] { StringType.INSTANCE }; + } + + @Override + public Object getPropertyValue(Object component, int property) { + Object returnValue = null; + final Point2D point = (Point2D) component; + if (0 == property) { + returnValue = point.getX() + "," + point.getY(); + } + return returnValue; + } + + @Override + public void setPropertyValue(Object component, int property, Object value) { + final Point2D point = (Point2D) component; + if (0 == property) { + final String[] values = ((String) value).split(","); + point.setLocation(Double.parseDouble(values[0]), Double.parseDouble(values[1])); + } + } + + @Override + public Class<?> returnedClass() { + return Point2D.class; + } + + @Override + public boolean equals(Object o1, Object o2) { + boolean isEqual = false; + if (o1 == o2) { + isEqual = false; + } + if (null == o1 || null == o2) { + isEqual = false; + } else { + isEqual = o1.equals(o2); + } + return isEqual; + } + + @Override + public int hashCode(Object x) { + return x.hashCode(); + } + + @Override + public Object deepCopy(Object value) { + if (value == null) { + return null; + } + final Point2D recievedParam = (Point2D) value; + final Point2D point = new Point2D.Double(recievedParam.getX(), recievedParam.getY()); + return point; + } + + @Override + public boolean isMutable() { + return true; + } + + @Override + public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) + throws HibernateException, SQLException { + Point2D point = null; + final String val = rs.getString(names[0]); + if (!rs.wasNull()) { + final String[] values = val.split(","); + point = new Point2D.Double(Double.parseDouble(values[0]), Double.parseDouble(values[1])); + } + return point; + } + + @Override + public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) + throws HibernateException, SQLException { + if (value == null) { + st.setNull(index, StringType.INSTANCE.sqlType()); + } else { + final Point2D point = (Point2D) value; + st.setString(index, point.getX() + "," + point.getY()); + } + } + + @Override + public Serializable disassemble(Object value, SharedSessionContractImplementor session) throws HibernateException { + return (Serializable) value; + } + + @Override + public Object assemble(Serializable cached, SharedSessionContractImplementor session, Object owner) + throws HibernateException { + return cached; + } + + @Override + public Object replace(Object original, Object target, SharedSessionContractImplementor session, Object owner) + throws HibernateException { + return this.deepCopy(original); + } } diff --git a/persist/src/main/resources/applicationContext-persist.xml b/persist/src/main/resources/applicationContext-persist.xml index 34d97465abee91ce63a5d2ac5e9ed8f589f992f5..7cc5c31f49fe74d999f38c6751ed9582fabaad8b 100644 --- a/persist/src/main/resources/applicationContext-persist.xml +++ b/persist/src/main/resources/applicationContext-persist.xml @@ -46,7 +46,7 @@ <bean id="ProjectDao" class="lcsb.mapviewer.persist.dao.ProjectDao" parent="BaseDao"/> - <bean id="SessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> + <bean id="SessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"> <property name="dataSource" ref="DataSource" /> <property name="annotatedClasses"> <list> @@ -213,11 +213,11 @@ <tx:annotation-driven/> - <bean id="txManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> + <bean id="txManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager"> <property name="sessionFactory" ref="SessionFactory"/> </bean> - <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> + <bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager"> <property name="sessionFactory" ref="SessionFactory"/> </bean> diff --git a/persist/src/test/java/lcsb/mapviewer/persist/dao/AllDaoTests.java b/persist/src/test/java/lcsb/mapviewer/persist/dao/AllDaoTests.java index 40344ac58cfbf7e767ee562266c4a5e34d7c5ede..f18bf7b318be15c7cb2b7181b69023c14eac1715 100644 --- a/persist/src/test/java/lcsb/mapviewer/persist/dao/AllDaoTests.java +++ b/persist/src/test/java/lcsb/mapviewer/persist/dao/AllDaoTests.java @@ -17,7 +17,6 @@ import lcsb.mapviewer.persist.dao.user.AllUserTests; AllMapDaoTests.class, // AllPluginTests.class, // AllUserTests.class, // - BaseDaoTest.class, // ConfigurationDaoTest.class, // ProjectDaoTest.class, // diff --git a/persist/src/test/java/lcsb/mapviewer/persist/dao/BaseDaoTest.java b/persist/src/test/java/lcsb/mapviewer/persist/dao/BaseDaoTest.java deleted file mode 100644 index 7b77f30315bee9503a54f29ed279ed7159b20d5c..0000000000000000000000000000000000000000 --- a/persist/src/test/java/lcsb/mapviewer/persist/dao/BaseDaoTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package lcsb.mapviewer.persist.dao; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import org.hibernate.Transaction; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.springframework.test.annotation.Rollback; - -import lcsb.mapviewer.persist.PersistTestFunctions; - -@Rollback(false) -public class BaseDaoTest extends PersistTestFunctions{ - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testCommit() { - try { - - dbUtils.createSessionForCurrentThread(); - Transaction tr = userDao.getSession().getTransaction(); - userDao.commit(); - assertTrue(tr.equals(tr)); - Transaction tr2 = userDao.getSession().getTransaction(); - - assertFalse(tr.equals(tr2)); - - dbUtils.closeSessionForCurrentThread(); - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - -} diff --git a/persist/src/test/java/lcsb/mapviewer/persist/dao/ProjectDaoTest.java b/persist/src/test/java/lcsb/mapviewer/persist/dao/ProjectDaoTest.java index a534023046206072776f6023b318f3a5c50aabda..efccbc29eb8df5ec9837e5e6fc12d674f1440148 100644 --- a/persist/src/test/java/lcsb/mapviewer/persist/dao/ProjectDaoTest.java +++ b/persist/src/test/java/lcsb/mapviewer/persist/dao/ProjectDaoTest.java @@ -24,288 +24,279 @@ import lcsb.mapviewer.model.map.species.Species; import lcsb.mapviewer.persist.PersistTestFunctions; public class ProjectDaoTest extends PersistTestFunctions { - Logger logger = Logger.getLogger(ProjectDaoTest.class); - int identifierCounter = 0; - String projectId = "Some_id"; - - @Before - public void setUp() throws Exception { - Project project = projectDao.getProjectByProjectId(projectId); - if (project != null) { - projectDao.delete(project); - } - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void testGetProjectByName() throws Exception { - try { - Project project = new Project(); - project.setProjectId(projectId); - projectDao.add(project); - projectDao.evict(project); - - Project project2 = projectDao.getProjectByProjectId(projectId); - assertNotNull(project2); - assertFalse(project2.equals(project)); - assertEquals(project.getId(), project2.getId()); - - projectDao.delete(project2); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testGetProjectForModelId() throws Exception { - try { - String projectId = "Some name"; - Project project = new Project(); - project.setProjectId(projectId); - projectDao.add(project); - Model model = new ModelFullIndexed(null); - project.addModel(model); - modelDao.add(model); - modelDao.evict(model); - projectDao.evict(project); - - Project project2 = projectDao.getProjectForModelId(model.getId()); - assertNotNull(project2); - assertFalse(project2.equals(project)); - assertEquals(project.getId(), project2.getId()); - - modelDao.delete(modelDao.getById(model.getId())); - projectDao.delete(project2); - - assertNull(projectDao.getProjectForModelId(model.getId())); - - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testProjectExists() throws Exception { - try { - String projectId = "Some_id"; - Project project = new Project(); - project.setProjectId(projectId); - - assertFalse(projectDao.isProjectExistsByName(projectId)); - - projectDao.add(project); - projectDao.evict(project); - - assertTrue(projectDao.isProjectExistsByName(projectId)); - - Project project2 = projectDao.getProjectByProjectId(projectId); - - projectDao.delete(project2); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testCheckEqualityAfterReload() throws Exception { - try { - - String projectId = "Some_id"; - Project project = new Project(); - project.setProjectId(projectId); - projectDao.add(project); - projectDao.flush(); - - Model model = createModel(); - project.addModel(model); - - projectDao.update(project); - projectDao.evict(project); - - ModelComparator comparator = new ModelComparator(); - - Model model2 = new ModelFullIndexed(modelDao.getLastModelForProjectIdentifier(projectId, false)); - - assertEquals(0, comparator.compare(model, model2)); - - projectDao.delete(projectDao.getById(project.getId())); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testCheckEqualityAfterReload2() throws Exception { - try { - String project_id = "Some_id"; - Project project = new Project(); - project.setProjectId(project_id); - Model model = createModel(); - project.addModel(model); - - projectDao.add(project); - projectDao.evict(project); - - Project project2 = projectDao.getProjectByProjectId(project_id); - - ModelComparator comparator = new ModelComparator(); - - Model fullModel1 = new ModelFullIndexed(project.getModels().iterator().next()); - Model fullModel2 = new ModelFullIndexed(project2.getModels().iterator().next()); - assertEquals(0, comparator.compare(fullModel1, fullModel2)); - - projectDao.delete(project2); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - private Model createModel() { - Model model = new ModelFullIndexed(null); - - model.addElement(createSpeciesAlias(264.8333333333335, 517.75, 86.0, 46.0, "sa2")); - model.addElement(createSpeciesAlias(267.6666666666665, 438.75, 80.0, 40.0, "sa1117")); - model.addElement(createSpeciesAlias(261.6666666666665, 600.75, 92.0, 52.0, "sa1119")); - model.addElement(createSpeciesAlias(203.666666666667, 687.75, 98.0, 58.0, "sa1121")); - - Species alias = createSpeciesAlias(817.714285714286, 287.642857142859, 80.0, 40.0, "sa1422"); - Species alias2 = createSpeciesAlias(224.964285714286, 241.392857142859, 80.0, 40.0, "sa1419"); - Complex alias3 = createComplexAlias(804.714285714286, 182.642857142859, 112.0, 172.0, "csa152"); - alias3.addSpecies(alias); - alias3.addSpecies(alias2); - alias.setComplex(alias3); - alias2.setComplex(alias3); - - model.addElement(alias); - model.addElement(alias2); - model.addElement(alias3); - - model.addElement(createCompartmentAlias(380.0, 416.0, 1893.0, 1866.0, "ca1")); - model.setWidth(2000); - model.setHeight(2000); - return model; - } - - private Compartment createCompartmentAlias(double x, double y, double width, double height, String aliasId) { - Compartment alias = new Compartment(aliasId); - alias.setX(x); - alias.setY(y); - alias.setWidth(width); - alias.setHeight(height); - return alias; - } - - private Species createSpeciesAlias(double x, double y, double width, double height, String aliasId) { - Species alias = new SimpleMolecule(aliasId); - alias.setX(x); - alias.setY(y); - alias.setWidth(width); - alias.setHeight(height); - return alias; - } - - private Complex createComplexAlias(double x, double y, double width, double height, String aliasId) { - Complex alias = new Complex(aliasId); - alias.setX(x); - alias.setY(y); - alias.setWidth(width); - alias.setHeight(height); - return alias; - } - - @Test - public void testAddGetProjectWithOverviewImage() throws Exception { - try { - String projectId = "Some_id"; - Project project = new Project(); - project.setProjectId(projectId); - Model model = new ModelFullIndexed(null); - OverviewImage oi = new OverviewImage(); - oi.setFilename("test"); - OverviewModelLink oml = new OverviewModelLink(); - oml.setPolygon("10,10 20,20 20,100"); - oml.setxCoord(1); - oml.setyCoord(2); - oml.setZoomLevel(3); - oi.addLink(oml); - project.addOverviewImage(oi); - project.addModel(model); - - projectDao.add(project); - projectDao.evict(project); - - Project project2 = projectDao.getProjectByProjectId(projectId); - assertNotNull(project2); - - OverviewImage oi2 = project2.getOverviewImages().get(0); - OverviewModelLink oml2 = (OverviewModelLink) oi2.getLinks().get(0); - - assertEquals(oi.getFilename(), oi2.getFilename()); - assertEquals(oml.getPolygon(), oml2.getPolygon()); - assertEquals(oml.getxCoord(), oml2.getxCoord()); - assertEquals(oml.getyCoord(), oml2.getyCoord()); - assertEquals(oml.getZoomLevel(), oml2.getZoomLevel()); - assertNotNull(oml2.getPolygonCoordinates()); - - projectDao.delete(project2); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - /** - * After adding model to db with creation warnings... - * - * @throws Exception - */ - @Test - public void testCreationWarnings() throws Exception { - try { - Project project = new Project(); - project.addWarning("warning A"); - project.addWarning("warning B"); - assertEquals(2, project.getWarnings().size()); - - projectDao.add(project); - - projectDao.evict(project); - Project project2 = projectDao.getById(project.getId()); - - assertEquals(2, project2.getWarnings().size()); - - projectDao.delete(project2); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } - - @Test - public void testGetAll() throws Exception { - try { - - long startTime = System.currentTimeMillis(); - double max = 10; - - logger.debug("---"); - for (int i = 0; i < max; i++) { - projectDao.getAll(); - } - long estimatedTime = System.currentTimeMillis() - startTime; - logger.debug(estimatedTime/max); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } + Logger logger = Logger.getLogger(ProjectDaoTest.class); + int identifierCounter = 0; + String projectId = "Some_id"; + + @Before + public void setUp() throws Exception { + Project project = projectDao.getProjectByProjectId(projectId); + if (project != null) { + projectDao.delete(project); + } + } + + @After + public void tearDown() throws Exception { + } + + @Test + public void testGetProjectByName() throws Exception { + try { + Project project = new Project(); + project.setProjectId(projectId); + projectDao.add(project); + projectDao.evict(project); + + Project project2 = projectDao.getProjectByProjectId(projectId); + assertNotNull(project2); + assertFalse(project2.equals(project)); + assertEquals(project.getId(), project2.getId()); + + projectDao.delete(project2); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testGetProjectForModelId() throws Exception { + try { + Project project = new Project(); + project.setProjectId(projectId); + projectDao.add(project); + Model model = new ModelFullIndexed(null); + project.addModel(model); + modelDao.add(model); + modelDao.evict(model); + projectDao.evict(project); + + Project project2 = projectDao.getProjectForModelId(model.getId()); + assertNotNull(project2); + assertFalse(project2.equals(project)); + assertEquals(project.getId(), project2.getId()); + + modelDao.delete(modelDao.getById(model.getId())); + projectDao.delete(project2); + + assertNull(projectDao.getProjectForModelId(model.getId())); + + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testProjectExists() throws Exception { + try { + Project project = new Project(projectId); + + assertFalse(projectDao.isProjectExistsByName(projectId)); + + projectDao.add(project); + projectDao.evict(project); + + assertTrue(projectDao.isProjectExistsByName(projectId)); + + Project project2 = projectDao.getProjectByProjectId(projectId); + + projectDao.delete(project2); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testCheckEqualityAfterReload() throws Exception { + try { + Project project = new Project(projectId); + projectDao.add(project); + projectDao.flush(); + + Model model = createModel(); + project.addModel(model); + + projectDao.update(project); + projectDao.evict(project); + + ModelComparator comparator = new ModelComparator(); + + Model model2 = new ModelFullIndexed(modelDao.getLastModelForProjectIdentifier(projectId, false)); + + assertEquals(0, comparator.compare(model, model2)); + + projectDao.delete(projectDao.getById(project.getId())); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testCheckEqualityAfterReload2() throws Exception { + try { + Project project = new Project(projectId); + Model model = createModel(); + project.addModel(model); + + projectDao.add(project); + projectDao.evict(project); + + Project project2 = projectDao.getProjectByProjectId(projectId); + + ModelComparator comparator = new ModelComparator(); + + Model fullModel1 = new ModelFullIndexed(project.getModels().iterator().next()); + Model fullModel2 = new ModelFullIndexed(project2.getModels().iterator().next()); + assertEquals(0, comparator.compare(fullModel1, fullModel2)); + + projectDao.delete(project2); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + private Model createModel() { + Model model = new ModelFullIndexed(null); + + model.addElement(createSpeciesAlias(264.8333333333335, 517.75, 86.0, 46.0, "sa2")); + model.addElement(createSpeciesAlias(267.6666666666665, 438.75, 80.0, 40.0, "sa1117")); + model.addElement(createSpeciesAlias(261.6666666666665, 600.75, 92.0, 52.0, "sa1119")); + model.addElement(createSpeciesAlias(203.666666666667, 687.75, 98.0, 58.0, "sa1121")); + + Species alias = createSpeciesAlias(817.714285714286, 287.642857142859, 80.0, 40.0, "sa1422"); + Species alias2 = createSpeciesAlias(224.964285714286, 241.392857142859, 80.0, 40.0, "sa1419"); + Complex alias3 = createComplexAlias(804.714285714286, 182.642857142859, 112.0, 172.0, "csa152"); + alias3.addSpecies(alias); + alias3.addSpecies(alias2); + alias.setComplex(alias3); + alias2.setComplex(alias3); + + model.addElement(alias); + model.addElement(alias2); + model.addElement(alias3); + + model.addElement(createCompartmentAlias(380.0, 416.0, 1893.0, 1866.0, "ca1")); + model.setWidth(2000); + model.setHeight(2000); + return model; + } + + private Compartment createCompartmentAlias(double x, double y, double width, double height, String aliasId) { + Compartment alias = new Compartment(aliasId); + alias.setX(x); + alias.setY(y); + alias.setWidth(width); + alias.setHeight(height); + return alias; + } + + private Species createSpeciesAlias(double x, double y, double width, double height, String aliasId) { + Species alias = new SimpleMolecule(aliasId); + alias.setX(x); + alias.setY(y); + alias.setWidth(width); + alias.setHeight(height); + return alias; + } + + private Complex createComplexAlias(double x, double y, double width, double height, String aliasId) { + Complex alias = new Complex(aliasId); + alias.setX(x); + alias.setY(y); + alias.setWidth(width); + alias.setHeight(height); + return alias; + } + + @Test + public void testAddGetProjectWithOverviewImage() throws Exception { + try { + Project project = new Project(projectId); + Model model = new ModelFullIndexed(null); + OverviewImage oi = new OverviewImage(); + oi.setFilename("test"); + OverviewModelLink oml = new OverviewModelLink(); + oml.setPolygon("10,10 20,20 20,100"); + oml.setxCoord(1); + oml.setyCoord(2); + oml.setZoomLevel(3); + oml.setLinkedModel(model); + oi.addLink(oml); + project.addOverviewImage(oi); + project.addModel(model); + + projectDao.add(project); + projectDao.evict(project); + + Project project2 = projectDao.getProjectByProjectId(projectId); + assertNotNull(project2); + + OverviewImage oi2 = project2.getOverviewImages().get(0); + OverviewModelLink oml2 = (OverviewModelLink) oi2.getLinks().get(0); + + assertEquals(oi.getFilename(), oi2.getFilename()); + assertEquals(oml.getPolygon(), oml2.getPolygon()); + assertEquals(oml.getxCoord(), oml2.getxCoord()); + assertEquals(oml.getyCoord(), oml2.getyCoord()); + assertEquals(oml.getZoomLevel(), oml2.getZoomLevel()); + assertNotNull(oml2.getPolygonCoordinates()); + + projectDao.delete(project2); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + /** + * After adding model to db with creation warnings... + * + * @throws Exception + */ + @Test + public void testCreationWarnings() throws Exception { + try { + Project project = new Project("test_project_id"); + project.addWarning("warning A"); + project.addWarning("warning B"); + assertEquals(2, project.getWarnings().size()); + + projectDao.add(project); + + projectDao.evict(project); + Project project2 = projectDao.getById(project.getId()); + + assertEquals(2, project2.getWarnings().size()); + + projectDao.delete(project2); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @Test + public void testGetAll() throws Exception { + try { + + long startTime = System.currentTimeMillis(); + double max = 10; + + logger.debug("---"); + for (int i = 0; i < max; i++) { + projectDao.getAll(); + } + long estimatedTime = System.currentTimeMillis() - startTime; + logger.debug(estimatedTime / max); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } } diff --git a/persist/src/test/java/lcsb/mapviewer/persist/dao/graphics/PolylineDataTest.java b/persist/src/test/java/lcsb/mapviewer/persist/dao/graphics/PolylineDataTest.java index d30fcf91f5df8a82c92455b5d66f461be18b5736..4edfbf258554328e2d339d7f9f517099372735e0 100644 --- a/persist/src/test/java/lcsb/mapviewer/persist/dao/graphics/PolylineDataTest.java +++ b/persist/src/test/java/lcsb/mapviewer/persist/dao/graphics/PolylineDataTest.java @@ -8,62 +8,61 @@ import static org.junit.Assert.fail; import java.awt.Color; import java.awt.geom.Point2D; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + import lcsb.mapviewer.model.graphics.ArrowType; import lcsb.mapviewer.model.graphics.LineType; import lcsb.mapviewer.model.graphics.PolylineData; import lcsb.mapviewer.persist.PersistTestFunctions; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - public class PolylineDataTest extends PersistTestFunctions { - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } + @Before + public void setUp() throws Exception { + } - @Test - public void test() { - try { - PolylineData pd = new PolylineData(); - pd.getBeginAtd().setArrowType(ArrowType.BLANK_CROSSBAR); - pd.getBeginAtd().setArrowLineType(LineType.DASHED); - pd.getBeginAtd().setLen(102); - pd.setColor(Color.CYAN); - pd.setType(LineType.SOLID_BOLD); - pd.setWidth(2); - pd.getPoints().add(new Point2D.Double(1, 1)); - pd.getPoints().add(new Point2D.Double(2, 3)); - pd.getPoints().add(new Point2D.Double(10, 11)); - polylineDao.add(pd); - assertNotNull(pd.getId()); - PolylineData pd2 = polylineDao.getById(pd.getId()); - assertNotNull(pd2); + @After + public void tearDown() throws Exception { + } - assertEquals(ArrowType.BLANK_CROSSBAR, pd2.getBeginAtd().getArrowType()); - assertEquals(LineType.DASHED, pd2.getBeginAtd().getArrowLineType()); - assertEquals(102, pd2.getBeginAtd().getLen(), EPSILON); - assertEquals(Color.CYAN, pd2.getColor()); - assertEquals(LineType.SOLID_BOLD, pd2.getType()); - assertEquals(2, pd2.getWidth(), EPSILON); - assertEquals(0, pd2.getPoints().get(0).distance(new Point2D.Double(1, 1)), EPSILON); - assertEquals(0, pd2.getPoints().get(1).distance(new Point2D.Double(2, 3)), EPSILON); - assertEquals(0, pd2.getPoints().get(2).distance(new Point2D.Double(10, 11)), EPSILON); + @Test + public void test() { + try { + PolylineData pd = new PolylineData(); + pd.getBeginAtd().setArrowType(ArrowType.BLANK_CROSSBAR); + pd.getBeginAtd().setArrowLineType(LineType.DASHED); + pd.getBeginAtd().setLen(102); + pd.setColor(Color.CYAN); + pd.setType(LineType.SOLID_BOLD); + pd.setWidth(2); + pd.getPoints().add(new Point2D.Double(1, 1)); + pd.getPoints().add(new Point2D.Double(2, 3)); + pd.getPoints().add(new Point2D.Double(10, 11)); + polylineDao.add(pd); + assertNotNull(pd.getId()); + PolylineData pd2 = polylineDao.getById(pd.getId()); + assertNotNull(pd2); - polylineDao.delete(pd); - pd2 = polylineDao.getById(pd.getId()); - assertNull(pd2); + assertEquals(ArrowType.BLANK_CROSSBAR, pd2.getBeginAtd().getArrowType()); + assertEquals(LineType.DASHED, pd2.getBeginAtd().getArrowLineType()); + assertEquals(102, pd2.getBeginAtd().getLen(), EPSILON); + assertEquals(Color.CYAN, pd2.getColor()); + assertEquals(LineType.SOLID_BOLD, pd2.getType()); + assertEquals(2, pd2.getWidth(), EPSILON); + assertEquals(0, pd2.getPoints().get(0).distance(new Point2D.Double(1, 1)), EPSILON); + assertEquals(0, pd2.getPoints().get(1).distance(new Point2D.Double(2, 3)), EPSILON); + assertEquals(0, pd2.getPoints().get(2).distance(new Point2D.Double(10, 11)), EPSILON); - } catch (Exception e) { - e.printStackTrace(); + polylineDao.delete(pd); + pd2 = polylineDao.getById(pd.getId()); + assertNull(pd2); - fail("Unknowne exception occured"); - } - } + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } } diff --git a/persist/src/test/java/lcsb/mapviewer/persist/dao/map/LayoutDaoTest.java b/persist/src/test/java/lcsb/mapviewer/persist/dao/map/LayoutDaoTest.java index 83572545fdaf861ba0299e25b96d7880550b44f6..f09a699ebe46e887fce816f421027c6a1ed75c68 100644 --- a/persist/src/test/java/lcsb/mapviewer/persist/dao/map/LayoutDaoTest.java +++ b/persist/src/test/java/lcsb/mapviewer/persist/dao/map/LayoutDaoTest.java @@ -62,7 +62,7 @@ public class LayoutDaoTest extends PersistTestFunctions { try { Model model = createModel(); - Project project = new Project(); + Project project = new Project("test_project_id"); project.addModel(model); projectDao.add(project); @@ -108,7 +108,7 @@ public class LayoutDaoTest extends PersistTestFunctions { createUser(); - Project project = new Project(); + Project project = new Project("test_project_id"); project.addModel(model); projectDao.add(project); diff --git a/persist/src/test/java/lcsb/mapviewer/persist/dao/map/ModelDaoTest.java b/persist/src/test/java/lcsb/mapviewer/persist/dao/map/ModelDaoTest.java index 0d59dd755f32f2543aed9771a4356a3333d5caa2..162f85c7ab4db9e15986c8274efc5d79a245e5b0 100644 --- a/persist/src/test/java/lcsb/mapviewer/persist/dao/map/ModelDaoTest.java +++ b/persist/src/test/java/lcsb/mapviewer/persist/dao/map/ModelDaoTest.java @@ -323,7 +323,7 @@ public class ModelDaoTest extends PersistTestFunctions { public void testModificationsInProteins() throws Exception { try { Model model = createModel(); - Project project = new Project(); + Project project = new Project("test_project_id"); project.addModel(model); projectDao.add(project); @@ -354,7 +354,7 @@ public class ModelDaoTest extends PersistTestFunctions { public void testMiriamInSpecies() throws Exception { try { Model model = createModel(); - Project project = new Project(); + Project project = new Project("test_project_id"); project.addModel(model); projectDao.add(project); @@ -390,7 +390,7 @@ public class ModelDaoTest extends PersistTestFunctions { layout.setDirectory("tmp"); layout.setTitle("temporary name"); model.addLayout(layout); - Project project = new Project(); + Project project = new Project("test_porject_id"); project.addModel(model); projectDao.add(project); diff --git a/pom.xml b/pom.xml index 6e966eda82182f744efdf68247fb5a8c7c9dfc8d..84ca0baa89a41e9cd8f72c5e2cc6c3e120722b9b 100644 --- a/pom.xml +++ b/pom.xml @@ -47,6 +47,11 @@ <itext.version>5.5.13</itext.version> + <libsbgn.version>0.2</libsbgn.version> + + <hibernate.version>5.3.6.Final</hibernate.version> + <jboss-logging.version>3.3.2.Final</jboss-logging.version> + <byte-buddy.version>1.9.0</byte-buddy.version> @@ -90,9 +95,6 @@ <celldesigner.version>4.4</celldesigner.version> - <libsbgn.version>0.2</libsbgn.version> - - <hibernate.version>4.1.0.Final</hibernate.version> <c3p0.version>0.9.1.2</c3p0.version>