Commit 614fcfdb authored by Piotr Gawron's avatar Piotr Gawron
Browse files

hibernate upgraded

parent 2f156a29
<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
......@@ -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;
}
}
......@@ -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;
/**
......
......@@ -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)