Commit 92308cad authored by Piotr Gawron's avatar Piotr Gawron
Browse files

changes required due to library upgrades

parent 184b9094
Pipeline #6907 failed with stage
in 6 minutes and 59 seconds
......@@ -119,6 +119,10 @@
<groupId>org.glassfish.jaxb</groupId>
<artifactId>txw2</artifactId>
</exclusion>
<exclusion>
<groupId>org.jvnet.staxex</groupId>
<artifactId>stax-ex</artifactId>
</exclusion>
</exclusions>
</dependency>
......@@ -128,7 +132,7 @@
<artifactId>txw2</artifactId>
<version>${txw2.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.xml.ws/jaxws-api -->
<dependency>
<groupId>javax.xml.ws</groupId>
......
......@@ -104,10 +104,6 @@
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>stax2-api</artifactId>
</exclusion>
<!-- https://github.com/sbmlteam/jsbml/issues/156 -->
<exclusion>
<groupId>org.sbml.jsbml</groupId>
......@@ -147,19 +143,9 @@
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>stax2-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>stax2-api</artifactId>
<version>${stax2-api.version}</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-graphics</artifactId>
......
......@@ -18,60 +18,60 @@ import lcsb.mapviewer.common.exception.NotImplementedException;
@DiscriminatorValue("IMAGE_LINK")
public class OverviewImageLink extends OverviewLink {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Child {@link OverviewImage} that can be reached via this link.
*/
@ManyToOne(fetch = FetchType.LAZY, optional = false)
private OverviewImage linkedOverviewImage;
/**
* Child {@link OverviewImage} that can be reached via this link.
*/
@ManyToOne(fetch = FetchType.LAZY)
private OverviewImage linkedOverviewImage;
/**
* Default constructor that copies object from the parameter.
*
* @param original
* original object to be copied
*/
public OverviewImageLink(OverviewImageLink original) {
super(original);
this.linkedOverviewImage = original.linkedOverviewImage;
/**
* Default constructor that copies object from the parameter.
*
* @param original
* original object to be copied
*/
public OverviewImageLink(OverviewImageLink original) {
super(original);
this.linkedOverviewImage = original.linkedOverviewImage;
}
}
/**
* DEfault constructor.
*/
public OverviewImageLink() {
super();
}
/**
* DEfault constructor.
*/
public OverviewImageLink() {
super();
}
/**
* @return the linkedOverviewImage
* @see #linkedOverviewImage
*/
public OverviewImage getLinkedOverviewImage() {
return linkedOverviewImage;
}
/**
* @return the linkedOverviewImage
* @see #linkedOverviewImage
*/
public OverviewImage getLinkedOverviewImage() {
return linkedOverviewImage;
}
/**
* @param linkedOverviewImage
* the linkedOverviewImage to set
* @see #linkedOverviewImage
*/
public void setLinkedOverviewImage(OverviewImage linkedOverviewImage) {
this.linkedOverviewImage = linkedOverviewImage;
}
/**
* @param linkedOverviewImage
* the linkedOverviewImage to set
* @see #linkedOverviewImage
*/
public void setLinkedOverviewImage(OverviewImage linkedOverviewImage) {
this.linkedOverviewImage = linkedOverviewImage;
}
@Override
public OverviewImageLink copy() {
if (this.getClass() == OverviewImageLink.class) {
return new OverviewImageLink(this);
} else {
throw new NotImplementedException("Method copy() should be overriden in class " + this.getClass());
}
}
@Override
public OverviewImageLink copy() {
if (this.getClass() == OverviewImageLink.class) {
return new OverviewImageLink(this);
} else {
throw new NotImplementedException("Method copy() should be overriden in class " + this.getClass());
}
}
}
package lcsb.mapviewer.model.map;
import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import lcsb.mapviewer.common.exception.NotImplementedException;
import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.model.map.model.ModelData;
......@@ -20,162 +24,162 @@ import lcsb.mapviewer.model.map.model.ModelData;
@DiscriminatorValue("MODEL_LINK")
public class OverviewModelLink extends OverviewLink {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Model to which this links is going.
*/
@ManyToOne(fetch = FetchType.LAZY, optional = false)
private ModelData linkedModel;
/**
* Zoom level at which model should be opened.
*/
private Integer zoomLevel;
/**
* X coordinate on {@link #linkedModel} where this links point to.
*/
private Integer xCoord;
/**
* Y coordinate on {@link #linkedModel} where this links point to.
*/
private Integer yCoord;
/**
* Default constructor that creates copy of the parameter object.
*
* @param original
* origianl object that will be copied to this one
*/
public OverviewModelLink(OverviewModelLink original) {
super(original);
this.linkedModel = original.linkedModel;
this.xCoord = original.xCoord;
this.yCoord = original.yCoord;
this.zoomLevel = original.zoomLevel;
}
/**
* Default constructor.
*/
public OverviewModelLink() {
super();
}
/**
* @return the model
* @see #linkedModel
*/
public ModelData getLinkedModel() {
return linkedModel;
}
/**
* @param model
* the model to set
* @see #linkedModel
*/
public void setLinkedModel(Model model) {
if (model != null) {
this.linkedModel = model.getModelData();
} else {
this.linkedModel = null;
}
}
@Override
public OverviewModelLink copy() {
if (this.getClass() == OverviewModelLink.class) {
return new OverviewModelLink(this);
} else {
throw new NotImplementedException("Method copy() should be overriden in class " + this.getClass());
}
}
/**
* @return the zoomLevel
* @see #zoomLevel
*/
public Integer getZoomLevel() {
return zoomLevel;
}
/**
* @param zoomLevel
* the zoomLevel to set
* @see #zoomLevel
*/
public void setZoomLevel(Integer zoomLevel) {
this.zoomLevel = zoomLevel;
}
/**
* @return the xCoord
* @see #xCoord
*/
public Integer getxCoord() {
return xCoord;
}
/**
* @param xCoord
* the xCoord to set
* @see #xCoord
*/
public void setxCoord(Integer xCoord) {
this.xCoord = xCoord;
}
/**
* @return the yCoord
* @see #yCoord
*/
public Integer getyCoord() {
return yCoord;
}
/**
* @param yCoord
* the yCoord to set
* @see #yCoord
*/
public void setyCoord(Integer yCoord) {
this.yCoord = yCoord;
}
/**
* Sets {@link #xCoord} value. Value will be trimmed to {@link Integer}.
*
* @param value
* the xCoord to set
* @see #xCoord
*/
public void setxCoord(Double value) {
if (value == null) {
this.xCoord = null;
} else {
this.xCoord = value.intValue();
}
}
/**
* Sets {@link #yCoord} value. Value will be trimmed to {@link Integer}.
*
* @param value
* the yCoord to set
* @see #yCoord
*/
public void setyCoord(Double value) {
if (value == null) {
this.yCoord = null;
} else {
this.yCoord = value.intValue();
}
}
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Model to which this links is going.
*/
@ManyToOne(fetch = FetchType.LAZY)
private ModelData linkedModel;
/**
* Zoom level at which model should be opened.
*/
private Integer zoomLevel;
/**
* X coordinate on {@link #linkedModel} where this links point to.
*/
private Integer xCoord;
/**
* Y coordinate on {@link #linkedModel} where this links point to.
*/
private Integer yCoord;
/**
* Default constructor that creates copy of the parameter object.
*
* @param original
* origianl object that will be copied to this one
*/
public OverviewModelLink(OverviewModelLink original) {
super(original);
this.linkedModel = original.linkedModel;
this.xCoord = original.xCoord;
this.yCoord = original.yCoord;
this.zoomLevel = original.zoomLevel;
}
/**
* Default constructor.
*/
public OverviewModelLink() {
super();
}
/**
* @return the model
* @see #linkedModel
*/
public ModelData getLinkedModel() {
return linkedModel;
}
/**
* @param model
* the model to set
* @see #linkedModel
*/
public void setLinkedModel(Model model) {
if (model != null) {
this.linkedModel = model.getModelData();
} else {
this.linkedModel = null;
}
}
@Override
public OverviewModelLink copy() {
if (this.getClass() == OverviewModelLink.class) {
return new OverviewModelLink(this);
} else {
throw new NotImplementedException("Method copy() should be overriden in class " + this.getClass());
}
}
/**
* @return the zoomLevel
* @see #zoomLevel
*/
public Integer getZoomLevel() {
return zoomLevel;
}
/**
* @param zoomLevel
* the zoomLevel to set
* @see #zoomLevel
*/
public void setZoomLevel(Integer zoomLevel) {
this.zoomLevel = zoomLevel;
}
/**
* @return the xCoord
* @see #xCoord
*/
public Integer getxCoord() {
return xCoord;
}
/**
* @param xCoord
* the xCoord to set
* @see #xCoord
*/
public void setxCoord(Integer xCoord) {
this.xCoord = xCoord;
}
/**
* @return the yCoord
* @see #yCoord
*/
public Integer getyCoord() {
return yCoord;
}
/**
* @param yCoord
* the yCoord to set
* @see #yCoord
*/
public void setyCoord(Integer yCoord) {
this.yCoord = yCoord;
}
/**
* Sets {@link #xCoord} value. Value will be trimmed to {@link Integer}.
*
* @param value
* the xCoord to set
* @see #xCoord
*/
public void setxCoord(Double value) {
if (value == null) {
this.xCoord = null;
} else {
this.xCoord = value.intValue();
}
}
/**
* Sets {@link #yCoord} value. Value will be trimmed to {@link Integer}.
*
* @param value
* the yCoord to set
* @see #yCoord
*/
public void setyCoord(Double value) {
if (value == null) {
this.yCoord = null;
} else {
this.yCoord = value.intValue();
}
}
}
......@@ -223,10 +223,6 @@ public class ModelData implements Serializable {
private Set<SubmodelConnection> parentModels = new HashSet<>();
@Cascade({ CascadeType.ALL })
@OneToMany(fetch = FetchType.LAZY, mappedBy = "linkedModel")
private Set<OverviewModelLink> imageLinks = new HashSet<>();
/**
* Default constructor.
*/
......
......@@ -5,10 +5,14 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Observable;
import javax.transaction.TransactionManager;
import org.apache.log4j.Logger;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.dialect.Dialect;
import org.hibernate.internal.SessionFactoryImpl;
import org.springframework.beans.factory.annotation.Autowired;
import lcsb.mapviewer.common.exception.InvalidStateException;
......@@ -249,4 +253,8 @@ public class DbUtils extends Observable {
autoFlushForThread.put(id, autoFlush);
}
}
public Dialect getDialect() {
return ((SessionFactoryImpl)sessionFactory).getDialect();
}
}
......@@ -7,6 +7,7 @@ import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.hibernate.dialect.Dialect;
import org.springframework.beans.factory.annotation.Autowired;
import lcsb.mapviewer.common.Pair;
......@@ -327,4 +328,8 @@ public abstract class BaseDao<T> {
}
}
protected Dialect getDialect() {
return dbUtils.getDialect();
}
}
package lcsb.mapviewer.persist.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.math.BigInteger;
import java.util.List;
import org.apache.log4j.Logger;
import org.hibernate.SQLQuery;
import org.hibernate.dialect.Dialect;
import org.hibernate.jdbc.ReturningWork;
import lcsb.mapviewer.model.Project;
import lcsb.mapviewer.model.map.model.ModelData;
......@@ -19,6 +17,8 @@ import lcsb.mapviewer.model.map.model.ModelData;
*
*/
public class ProjectDao extends BaseDao<Project> {
Logger logger = Logger.getLogger(ProjectDao.class);
/**
* Default constructor.
*/
......@@ -73,31 +73,10 @@ public class ProjectDao extends BaseDao<Project> {
}
public long getNextId() {
ReturningWork<Long> maxReturningWork = new ReturningWork<Long>() {
@Override
public Long execute(Connection connection) throws SQLException {
Dialect dialect = Dialect.getDialect(connection.getClientInfo());
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
try {
preparedStatement = connection.prepareStatement(dialect.getSequenceNextValString("project_table_iddb_seq"));
resultSet = preparedStatement.executeQuery();
resultSet.next();
return resultSet.getLong(1);
} catch (SQLException e) {
throw e;
} finally {
if (preparedStatement != null) {