Changed {lazy/eager} annotations of hibernate fetching...
This commit is contained in:
parent
2364d10c0e
commit
38676904c8
|
@ -142,6 +142,13 @@
|
||||||
<version>2.8.4</version>
|
<version>2.8.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-hibernate5</artifactId>
|
||||||
|
<version>2.8.4</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Json <-> XML transformations -->
|
<!-- Json <-> XML transformations -->
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,9 @@ public interface DMPDao extends Dao<DMP, UUID> {
|
||||||
|
|
||||||
List<IDLabelPair> listAllIDsLabels();
|
List<IDLabelPair> listAllIDsLabels();
|
||||||
|
|
||||||
|
List<DMP> listUserDMPs(String username);
|
||||||
|
|
||||||
|
|
||||||
// public boolean createFromForm();
|
// public boolean createFromForm();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.hibernate.query.Query;
|
||||||
|
|
||||||
import dao.JpaDao;
|
import dao.JpaDao;
|
||||||
import entities.DMP;
|
import entities.DMP;
|
||||||
|
import entities.UserInfo;
|
||||||
import entities.responses.IDLabelPair;
|
import entities.responses.IDLabelPair;
|
||||||
|
|
||||||
public class DMPDaoImpl extends JpaDao<DMP, UUID> implements DMPDao {
|
public class DMPDaoImpl extends JpaDao<DMP, UUID> implements DMPDao {
|
||||||
|
@ -39,6 +40,23 @@ public class DMPDaoImpl extends JpaDao<DMP, UUID> implements DMPDao {
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DMP> listUserDMPs(String username) {
|
||||||
|
|
||||||
|
// String queryString = "select ui from UserInfo ui join UserAuth ui.authentication ua where ua.username=:username";
|
||||||
|
|
||||||
|
|
||||||
|
// TypedQuery<UserInfo> typedQuery = entityManager.createQuery(queryString, UserInfo.class);
|
||||||
|
// typedQuery.setParameter("username", username);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
// public boolean createFromForm(Map<String,String> keyVals) {
|
// public boolean createFromForm(Map<String,String> keyVals) {
|
||||||
// String query = "insert into DMP () values"
|
// String query = "insert into DMP () values"
|
||||||
|
|
|
@ -20,10 +20,14 @@ import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.Cascade;
|
import org.hibernate.annotations.Cascade;
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
|
@ -31,14 +35,15 @@ import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="\"DMP\"")
|
@Table(name="\"DMP\"")
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
//@Proxy(lazy = false)
|
||||||
|
//@JsonInclude(Include.NON_NULL)
|
||||||
|
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
|
||||||
public class DMP implements Serializable {
|
public class DMP implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
private static final long serialVersionUID = -8263056535208547615L;
|
private static final long serialVersionUID = -8263056535208547615L;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||||
|
@ -55,10 +60,11 @@ public class DMP implements Serializable {
|
||||||
@Column(name = "\"Version\"")
|
@Column(name = "\"Version\"")
|
||||||
private Integer version;
|
private Integer version;
|
||||||
|
|
||||||
@OneToOne(mappedBy = "dmp", fetch = FetchType.EAGER)
|
@OneToMany(mappedBy = "dmp", fetch = FetchType.LAZY)
|
||||||
private Dataset dataset;
|
private Set<Dataset> dataset;
|
||||||
|
|
||||||
@OneToOne(fetch = FetchType.EAGER)
|
|
||||||
|
@ManyToOne()
|
||||||
@JoinColumn(name = "\"Project\"")
|
@JoinColumn(name = "\"Project\"")
|
||||||
private Project project;
|
private Project project;
|
||||||
|
|
||||||
|
@ -67,12 +73,12 @@ public class DMP implements Serializable {
|
||||||
@Column(name = "\"ProfileData\"", columnDefinition = "xml", nullable = true)
|
@Column(name = "\"ProfileData\"", columnDefinition = "xml", nullable = true)
|
||||||
private String profileData;
|
private String profileData;
|
||||||
|
|
||||||
@OneToOne(fetch = FetchType.EAGER)
|
@OneToOne(fetch = FetchType.LAZY)
|
||||||
@JoinColumn(name = "\"Profile\"")
|
@JoinColumn(name = "\"Profile\"")
|
||||||
private DMPProfile profile;
|
private DMPProfile profile;
|
||||||
|
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.EAGER)
|
@OneToMany(fetch = FetchType.LAZY)
|
||||||
@JoinTable(name="\"DMPOrganisation\"",
|
@JoinTable(name="\"DMPOrganisation\"",
|
||||||
joinColumns={@JoinColumn(name="\"DMP\"", referencedColumnName="\"ID\"")},
|
joinColumns={@JoinColumn(name="\"DMP\"", referencedColumnName="\"ID\"")},
|
||||||
inverseJoinColumns={@JoinColumn(name="\"Organisation\"", referencedColumnName="\"ID\"")}
|
inverseJoinColumns={@JoinColumn(name="\"Organisation\"", referencedColumnName="\"ID\"")}
|
||||||
|
@ -80,7 +86,7 @@ public class DMP implements Serializable {
|
||||||
private Set<Organisation> organisations;
|
private Set<Organisation> organisations;
|
||||||
|
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.EAGER)
|
@OneToMany(fetch = FetchType.LAZY)
|
||||||
@JoinTable(name="\"DMPResearcher\"",
|
@JoinTable(name="\"DMPResearcher\"",
|
||||||
joinColumns={@JoinColumn(name="\"DMP\"", referencedColumnName="\"ID\"")},
|
joinColumns={@JoinColumn(name="\"DMP\"", referencedColumnName="\"ID\"")},
|
||||||
inverseJoinColumns={@JoinColumn(name="\"Researcher\"", referencedColumnName="\"ID\"")}
|
inverseJoinColumns={@JoinColumn(name="\"Researcher\"", referencedColumnName="\"ID\"")}
|
||||||
|
@ -88,7 +94,7 @@ public class DMP implements Serializable {
|
||||||
private Set<Researcher> researchers;
|
private Set<Researcher> researchers;
|
||||||
|
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.EAGER)
|
@OneToMany(fetch = FetchType.LAZY)
|
||||||
@JoinTable(name="\"UserDMP\"",
|
@JoinTable(name="\"UserDMP\"",
|
||||||
joinColumns={@JoinColumn(name="dmp", referencedColumnName="\"ID\"")},
|
joinColumns={@JoinColumn(name="dmp", referencedColumnName="\"ID\"")},
|
||||||
inverseJoinColumns={@JoinColumn(name="usr", referencedColumnName="id")}
|
inverseJoinColumns={@JoinColumn(name="usr", referencedColumnName="id")}
|
||||||
|
@ -161,11 +167,11 @@ public class DMP implements Serializable {
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dataset getDataset() {
|
public Set<Dataset> getDataset() {
|
||||||
return dataset;
|
return dataset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDataset(Dataset dataset) {
|
public void setDataset(Set<Dataset> dataset) {
|
||||||
this.dataset = dataset;
|
this.dataset = dataset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,15 +11,20 @@ import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="\"DMPOrganisation\"")
|
@Table(name="\"DMPOrganisation\"")
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
//@Proxy(lazy = false)
|
||||||
|
//@JsonInclude(Include.NON_NULL)
|
||||||
|
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
|
||||||
public class DMPOrganisation implements Serializable {
|
public class DMPOrganisation implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,15 +14,20 @@ import javax.persistence.OneToOne;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="\"DMPProfile\"")
|
@Table(name="\"DMPProfile\"")
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
//@Proxy(lazy = false)
|
||||||
|
//@JsonInclude(Include.NON_NULL)
|
||||||
|
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
|
||||||
public class DMPProfile implements Serializable {
|
public class DMPProfile implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 3213099144442689808L;
|
private static final long serialVersionUID = 3213099144442689808L;
|
||||||
|
@ -37,7 +42,7 @@ public class DMPProfile implements Serializable {
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
|
||||||
@OneToOne(fetch = FetchType.EAGER, mappedBy = "profile")
|
@OneToOne(fetch = FetchType.LAZY, mappedBy = "profile")
|
||||||
private DMP dmp;
|
private DMP dmp;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,15 +11,20 @@ import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="\"DMPResearcher\"")
|
@Table(name="\"DMPResearcher\"")
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
//@Proxy(lazy = false)
|
||||||
|
//@JsonInclude(Include.NON_NULL)
|
||||||
|
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
|
||||||
public class DMPResearcher implements Serializable {
|
public class DMPResearcher implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 135449857355252959L;
|
private static final long serialVersionUID = 135449857355252959L;
|
||||||
|
|
|
@ -18,14 +18,19 @@ import javax.persistence.OneToMany;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="\"DataRepository\"")
|
@Table(name="\"DataRepository\"")
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
//@Proxy(lazy = false)
|
||||||
|
//@JsonInclude(Include.NON_NULL)
|
||||||
|
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
|
||||||
public class DataRepository implements Serializable {
|
public class DataRepository implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,20 +13,26 @@ import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.JoinTable;
|
import javax.persistence.JoinTable;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.OneToOne;
|
import javax.persistence.OneToOne;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.Cascade;
|
import org.hibernate.annotations.Cascade;
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
|
||||||
@Entity(name = "Dataset")
|
@Entity(name = "Dataset")
|
||||||
@Table(name="\"Dataset\"")
|
@Table(name="\"Dataset\"")
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
//@Proxy(lazy = false)
|
||||||
|
//@JsonInclude(Include.NON_NULL)
|
||||||
|
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
|
||||||
public class Dataset implements Serializable {
|
public class Dataset implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 3575723814399553259L;
|
private static final long serialVersionUID = 3575723814399553259L;
|
||||||
|
@ -44,7 +50,7 @@ public class Dataset implements Serializable {
|
||||||
private String label;
|
private String label;
|
||||||
|
|
||||||
|
|
||||||
@OneToOne(fetch = FetchType.EAGER)
|
@ManyToOne(fetch = FetchType.EAGER)
|
||||||
// @Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
// @Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
||||||
@JoinColumn(name = "\"DMP\"", nullable = true)
|
@JoinColumn(name = "\"DMP\"", nullable = true)
|
||||||
private DMP dmp;
|
private DMP dmp;
|
||||||
|
@ -58,12 +64,13 @@ public class Dataset implements Serializable {
|
||||||
private String properties;
|
private String properties;
|
||||||
|
|
||||||
|
|
||||||
@OneToOne(fetch = FetchType.EAGER)
|
@ManyToOne(fetch = FetchType.EAGER)
|
||||||
//@Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
//@Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
||||||
@JoinColumn(name = "\"Profile\"", nullable = true)
|
@JoinColumn(name = "\"Profile\"", nullable = true)
|
||||||
private DatasetProfile profile;
|
private DatasetProfile profile;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.EAGER)
|
@OneToMany(fetch = FetchType.EAGER)
|
||||||
@JoinTable(name="\"DatasetDataRepository\"",
|
@JoinTable(name="\"DatasetDataRepository\"",
|
||||||
joinColumns={@JoinColumn(name="\"Dataset\"", referencedColumnName="\"ID\"")},
|
joinColumns={@JoinColumn(name="\"Dataset\"", referencedColumnName="\"ID\"")},
|
||||||
|
|
|
@ -11,15 +11,20 @@ import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="\"DatasetDataRepository\"")
|
@Table(name="\"DatasetDataRepository\"")
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
//@Proxy(lazy = false)
|
||||||
|
//@JsonInclude(Include.NON_NULL)
|
||||||
|
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
|
||||||
public class DatasetDataRepository implements Serializable {
|
public class DatasetDataRepository implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package entities;
|
||||||
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
|
@ -11,6 +12,7 @@ import javax.persistence.FetchType;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.OneToOne;
|
import javax.persistence.OneToOne;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
@ -20,13 +22,16 @@ import org.hibernate.annotations.Proxy;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="\"DatasetProfile\"")
|
@Table(name="\"DatasetProfile\"")
|
||||||
//@Proxy(lazy = false)
|
//@Proxy(lazy = false)
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
//@JsonInclude(Include.NON_NULL)
|
||||||
|
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
|
||||||
public class DatasetProfile implements Serializable {
|
public class DatasetProfile implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,8 +49,13 @@ public class DatasetProfile implements Serializable {
|
||||||
@Column(name = "\"Label\"")
|
@Column(name = "\"Label\"")
|
||||||
private String label;
|
private String label;
|
||||||
|
|
||||||
@OneToOne(fetch = FetchType.EAGER, mappedBy = "profile")
|
// @OneToOne(fetch = FetchType.EAGER, mappedBy = "profile")
|
||||||
private Dataset dataset;
|
// private Dataset dataset;
|
||||||
|
|
||||||
|
@OneToMany(fetch = FetchType.EAGER, mappedBy = "profile")
|
||||||
|
private Set<Dataset> dataset;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@OneToOne(fetch = FetchType.EAGER)
|
@OneToOne(fetch = FetchType.EAGER)
|
||||||
// @Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
// @Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
||||||
|
@ -105,11 +115,13 @@ public class DatasetProfile implements Serializable {
|
||||||
this.definition = definition;
|
this.definition = definition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dataset getDataset() {
|
|
||||||
|
|
||||||
|
public Set<Dataset> getDataset() {
|
||||||
return dataset;
|
return dataset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDataset(Dataset dataset) {
|
public void setDataset(Set<Dataset> dataset) {
|
||||||
this.dataset = dataset;
|
this.dataset = dataset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,17 +14,22 @@ import javax.persistence.OneToOne;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.json.XML;
|
import org.json.XML;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="\"DatasetProfileRuleset\"")
|
@Table(name="\"DatasetProfileRuleset\"")
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
//@Proxy(lazy = false)
|
||||||
|
//@JsonInclude(Include.NON_NULL)
|
||||||
|
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
|
||||||
public class DatasetProfileRuleset implements Serializable {
|
public class DatasetProfileRuleset implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 4249565129050898613L;
|
private static final long serialVersionUID = 4249565129050898613L;
|
||||||
|
|
|
@ -14,16 +14,21 @@ import javax.persistence.OneToOne;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
import org.json.XML;
|
import org.json.XML;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="\"DatasetProfileViewstyle\"")
|
@Table(name="\"DatasetProfileViewstyle\"")
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
//@Proxy(lazy = false)
|
||||||
|
//@JsonInclude(Include.NON_NULL)
|
||||||
|
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
|
||||||
public class DatasetProfileViewstyle implements Serializable {
|
public class DatasetProfileViewstyle implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -3251295258160291468L;
|
private static final long serialVersionUID = -3251295258160291468L;
|
||||||
|
|
|
@ -11,15 +11,20 @@ import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="\"DatasetRegistry\"")
|
@Table(name="\"DatasetRegistry\"")
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
//@Proxy(lazy = false)
|
||||||
|
//@JsonInclude(Include.NON_NULL)
|
||||||
|
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
|
||||||
public class DatasetRegistry implements Serializable {
|
public class DatasetRegistry implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -5594183793725819187L;
|
private static final long serialVersionUID = -5594183793725819187L;
|
||||||
|
|
|
@ -11,15 +11,20 @@ import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="\"DatasetService\"")
|
@Table(name="\"DatasetService\"")
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
//@Proxy(lazy = false)
|
||||||
|
//@JsonInclude(Include.NON_NULL)
|
||||||
|
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
|
||||||
public class DatasetService implements Serializable {
|
public class DatasetService implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1469161193939096037L;
|
private static final long serialVersionUID = 1469161193939096037L;
|
||||||
|
|
|
@ -17,15 +17,20 @@ import javax.persistence.OneToMany;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="\"Organisation\"")
|
@Table(name="\"Organisation\"")
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
//@Proxy(lazy = false)
|
||||||
|
//@JsonInclude(Include.NON_NULL)
|
||||||
|
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
|
||||||
public class Organisation implements Serializable {
|
public class Organisation implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,7 +63,7 @@ public class Organisation implements Serializable {
|
||||||
private String definition;
|
private String definition;
|
||||||
|
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
|
@OneToMany(fetch = FetchType.LAZY)
|
||||||
@JoinTable(name="\"DMPOrganisation\"",
|
@JoinTable(name="\"DMPOrganisation\"",
|
||||||
joinColumns={@JoinColumn(name="\"Organisation\"", referencedColumnName="\"ID\"")},
|
joinColumns={@JoinColumn(name="\"Organisation\"", referencedColumnName="\"ID\"")},
|
||||||
inverseJoinColumns={@JoinColumn(name="\"DMP\"", referencedColumnName="\"ID\"")}
|
inverseJoinColumns={@JoinColumn(name="\"DMP\"", referencedColumnName="\"ID\"")}
|
||||||
|
|
|
@ -16,10 +16,13 @@ import javax.persistence.OneToOne;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
|
@ -27,6 +30,8 @@ import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="\"Project\"")
|
@Table(name="\"Project\"")
|
||||||
|
//@Proxy(lazy = false)
|
||||||
|
//@JsonInclude(Include.NON_NULL)
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||||
public class Project implements Serializable {
|
public class Project implements Serializable {
|
||||||
|
|
||||||
|
@ -42,8 +47,8 @@ public class Project implements Serializable {
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
|
||||||
@OneToOne(fetch = FetchType.EAGER, mappedBy = "project")
|
@OneToMany(mappedBy = "project")
|
||||||
private DMP dmp;
|
private Set<DMP> dmps;
|
||||||
|
|
||||||
|
|
||||||
@Column(name = "\"Label\"")
|
@Column(name = "\"Label\"")
|
||||||
|
@ -112,13 +117,15 @@ public class Project implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public DMP getDMP() {
|
public Set<DMP> getDmps() {
|
||||||
return dmp;
|
return dmps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDmps(Set<DMP> dmps) {
|
||||||
|
this.dmps = dmps;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setDMP(DMP dmp) {
|
|
||||||
this.dmp = dmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
try {
|
try {
|
||||||
|
@ -129,4 +136,5 @@ public class Project implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,15 +17,20 @@ import javax.persistence.OneToMany;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="\"Registry\"")
|
@Table(name="\"Registry\"")
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
//@Proxy(lazy = false)
|
||||||
|
//@JsonInclude(Include.NON_NULL)
|
||||||
|
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
|
||||||
public class Registry implements Serializable {
|
public class Registry implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -277572262583178090L;
|
private static final long serialVersionUID = -277572262583178090L;
|
||||||
|
@ -57,7 +62,7 @@ public class Registry implements Serializable {
|
||||||
private String definition;
|
private String definition;
|
||||||
|
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
|
@OneToMany(fetch = FetchType.EAGER)
|
||||||
@JoinTable(name="\"DatasetRegistry\"",
|
@JoinTable(name="\"DatasetRegistry\"",
|
||||||
joinColumns={@JoinColumn(name="\"Registry\"", referencedColumnName="\"ID\"")},
|
joinColumns={@JoinColumn(name="\"Registry\"", referencedColumnName="\"ID\"")},
|
||||||
inverseJoinColumns={@JoinColumn(name="\"Dataset\"", referencedColumnName="\"ID\"")}
|
inverseJoinColumns={@JoinColumn(name="\"Dataset\"", referencedColumnName="\"ID\"")}
|
||||||
|
|
|
@ -17,15 +17,20 @@ import javax.persistence.OneToMany;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="\"Researcher\"")
|
@Table(name="\"Researcher\"")
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
//@Proxy(lazy = false)
|
||||||
|
//@JsonInclude(Include.NON_NULL)
|
||||||
|
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
|
||||||
public class Researcher implements Serializable {
|
public class Researcher implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,7 +63,7 @@ public class Researcher implements Serializable {
|
||||||
private String reference;
|
private String reference;
|
||||||
|
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
|
@OneToMany(fetch = FetchType.LAZY)
|
||||||
@JoinTable(name="\"DMPResearcher\"",
|
@JoinTable(name="\"DMPResearcher\"",
|
||||||
joinColumns={@JoinColumn(name="\"Researcher\"", referencedColumnName="\"ID\"")},
|
joinColumns={@JoinColumn(name="\"Researcher\"", referencedColumnName="\"ID\"")},
|
||||||
inverseJoinColumns={@JoinColumn(name="\"DMP\"", referencedColumnName="\"ID\"")}
|
inverseJoinColumns={@JoinColumn(name="\"DMP\"", referencedColumnName="\"ID\"")}
|
||||||
|
|
|
@ -19,15 +19,20 @@ import javax.persistence.OneToMany;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="\"Service\"")
|
@Table(name="\"Service\"")
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
//@Proxy(lazy = false)
|
||||||
|
//@JsonInclude(Include.NON_NULL)
|
||||||
|
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
|
||||||
public class Service implements Serializable {
|
public class Service implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 7243446610500174060L;
|
private static final long serialVersionUID = 7243446610500174060L;
|
||||||
|
|
|
@ -10,19 +10,23 @@ import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="\"UserDMP\"")
|
@Table(name="\"UserDMP\"")
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
//@Proxy(lazy = false)
|
||||||
|
//@JsonInclude(Include.NON_NULL)
|
||||||
|
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
|
||||||
public class UserDMP implements Serializable{
|
public class UserDMP implements Serializable{
|
||||||
|
|
||||||
private static final long serialVersionUID = -4467370784003784660L;
|
private static final long serialVersionUID = -4467370784003784660L;
|
||||||
|
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||||
|
|
|
@ -19,17 +19,22 @@ import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
|
||||||
import entities.security.UserAuth;
|
import entities.security.UserAuth;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="\"UserInfo\"")
|
@Table(name="\"UserInfo\"")
|
||||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
//@Proxy(lazy = false)
|
||||||
|
//@JsonInclude(Include.NON_NULL)
|
||||||
|
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
|
||||||
public class UserInfo implements Serializable{
|
public class UserInfo implements Serializable{
|
||||||
|
|
||||||
private static final long serialVersionUID = 1225151430484658395L;
|
private static final long serialVersionUID = 1225151430484658395L;
|
||||||
|
@ -73,7 +78,7 @@ public class UserInfo implements Serializable{
|
||||||
@Column(name = "additionalinfo", columnDefinition = "xml", nullable = true)
|
@Column(name = "additionalinfo", columnDefinition = "xml", nullable = true)
|
||||||
private String additionalinfo;
|
private String additionalinfo;
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.EAGER)
|
@OneToMany(fetch = FetchType.LAZY)
|
||||||
@JoinTable(name="\"UserDMP\"",
|
@JoinTable(name="\"UserDMP\"",
|
||||||
joinColumns={@JoinColumn(name="usr", referencedColumnName="id")},
|
joinColumns={@JoinColumn(name="usr", referencedColumnName="id")},
|
||||||
inverseJoinColumns={@JoinColumn(name="dmp", referencedColumnName="\"ID\"")}
|
inverseJoinColumns={@JoinColumn(name="dmp", referencedColumnName="\"ID\"")}
|
||||||
|
|
|
@ -9,9 +9,18 @@ import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
import org.hibernate.annotations.Proxy;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="\"UserAuth\"")
|
@Table(name="\"UserAuth\"")
|
||||||
|
//@Proxy(lazy = false)
|
||||||
|
//@JsonInclude(Include.NON_NULL)
|
||||||
|
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
|
||||||
public class UserAuth {
|
public class UserAuth {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package helpers;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module;
|
||||||
|
|
||||||
|
|
||||||
|
public class SerializerProvider {
|
||||||
|
|
||||||
|
|
||||||
|
private static ObjectMapper objectMapper = new ObjectMapper()
|
||||||
|
// .setSerializationInclusion(Include.NON_NULL)
|
||||||
|
// .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
|
||||||
|
.registerModule(new Hibernate5Module())
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
public static ObjectMapper getJsonSerializer() {
|
||||||
|
return objectMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package helpers;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.springframework.util.MultiValueMap;
|
import org.springframework.util.MultiValueMap;
|
||||||
|
@ -80,6 +81,9 @@ public class Transformers {
|
||||||
ds.setRegistries(new HashSet<Registry>(Arrays.asList(reg)));
|
ds.setRegistries(new HashSet<Registry>(Arrays.asList(reg)));
|
||||||
ds.setServices(new HashSet<Service>(Arrays.asList(ser)));
|
ds.setServices(new HashSet<Service>(Arrays.asList(ser)));
|
||||||
|
|
||||||
|
Set<Dataset> datasets = new HashSet<Dataset>();
|
||||||
|
datasets.add(ds);
|
||||||
|
|
||||||
|
|
||||||
DMP dmp = new DMP();
|
DMP dmp = new DMP();
|
||||||
dmp.setLabel(formData.getFirst("DMP.label"));
|
dmp.setLabel(formData.getFirst("DMP.label"));
|
||||||
|
@ -90,7 +94,7 @@ public class Transformers {
|
||||||
dmp.setProfileData(formData.getFirst("DMP.profileData"));
|
dmp.setProfileData(formData.getFirst("DMP.profileData"));
|
||||||
dmp.setProject(project);
|
dmp.setProject(project);
|
||||||
dmp.setVersion(Integer.parseInt(formData.getFirst("DMP.version")));
|
dmp.setVersion(Integer.parseInt(formData.getFirst("DMP.version")));
|
||||||
dmp.setDataset(ds);
|
dmp.setDataset(datasets);
|
||||||
|
|
||||||
|
|
||||||
System.out.println(dmp);
|
System.out.println(dmp);
|
||||||
|
|
|
@ -1,18 +1,15 @@
|
||||||
package rest.entities;
|
package rest.entities;
|
||||||
|
|
||||||
import java.io.Console;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
import org.apache.commons.lang3.SerializationUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.util.MultiValueMap;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
@ -22,7 +19,9 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.mchange.v2.sql.filter.SynchronizedFilterDataSource;
|
import com.mchange.v2.sql.filter.SynchronizedFilterDataSource;
|
||||||
|
|
||||||
|
@ -38,13 +37,16 @@ import dao.entities.ProjectDao;
|
||||||
import dao.entities.RegistryDao;
|
import dao.entities.RegistryDao;
|
||||||
import dao.entities.ResearcherDao;
|
import dao.entities.ResearcherDao;
|
||||||
import dao.entities.ServiceDao;
|
import dao.entities.ServiceDao;
|
||||||
|
import dao.entities.UserInfoDao;
|
||||||
import entities.DMP;
|
import entities.DMP;
|
||||||
import entities.DMPProfile;
|
import entities.DMPProfile;
|
||||||
import entities.Dataset;
|
import entities.Dataset;
|
||||||
import entities.DatasetProfile;
|
import entities.DatasetProfile;
|
||||||
import entities.DatasetProfileRuleset;
|
import entities.DatasetProfileRuleset;
|
||||||
import entities.Project;
|
import entities.Project;
|
||||||
|
import entities.UserInfo;
|
||||||
import entities.responses.IDLabelPair;
|
import entities.responses.IDLabelPair;
|
||||||
|
import helpers.SerializerProvider;
|
||||||
import helpers.Transformers;
|
import helpers.Transformers;
|
||||||
import responses.RestResponse;
|
import responses.RestResponse;
|
||||||
|
|
||||||
|
@ -65,9 +67,11 @@ public class DMPs {
|
||||||
@Autowired private RegistryDao registryDao;
|
@Autowired private RegistryDao registryDao;
|
||||||
@Autowired private ResearcherDao researcherDao;
|
@Autowired private ResearcherDao researcherDao;
|
||||||
@Autowired private ServiceDao serviceDao;
|
@Autowired private ServiceDao serviceDao;
|
||||||
|
@Autowired private UserInfoDao userInfoDao;
|
||||||
|
|
||||||
|
|
||||||
private ObjectMapper objectMapper = new ObjectMapper();
|
private ObjectMapper objectMapper = SerializerProvider.getJsonSerializer();
|
||||||
|
|
||||||
|
|
||||||
// FETCH BY DMP(S)
|
// FETCH BY DMP(S)
|
||||||
|
|
||||||
|
@ -75,20 +79,26 @@ public class DMPs {
|
||||||
public @ResponseBody ResponseEntity<Object> listDMPs(){
|
public @ResponseBody ResponseEntity<Object> listDMPs(){
|
||||||
try {
|
try {
|
||||||
List<UUID> allIDs = dMPDao.listAllIDs();
|
List<UUID> allIDs = dMPDao.listAllIDs();
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(allIDs));
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(allIDs));
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
@RequestMapping(method = RequestMethod.GET, value = { "/dmps/{id}" }, produces="application/json")
|
@RequestMapping(method = RequestMethod.GET, value = { "/dmps/{id}" }, produces="application/json")
|
||||||
public @ResponseBody ResponseEntity<Object> getDMP(@PathVariable("id") String id){
|
public @ResponseBody ResponseEntity<Object> getDMP(@PathVariable("id") String id){
|
||||||
try {
|
try {
|
||||||
|
System.out.println("Trying for id: "+ id);
|
||||||
DMP dmp = dMPDao.read(UUID.fromString(id));
|
DMP dmp = dMPDao.read(UUID.fromString(id));
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(dmp));
|
System.out.println("tried, got : "+ dmp.getId());
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(dmp));
|
||||||
|
// return ResponseEntity.status(HttpStatus.OK).body(dmp);
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,13 +107,36 @@ public class DMPs {
|
||||||
public @ResponseBody ResponseEntity<Object> listDmpLabelID(){
|
public @ResponseBody ResponseEntity<Object> listDmpLabelID(){
|
||||||
try {
|
try {
|
||||||
List<IDLabelPair> allIDLabels = dMPDao.listAllIDsLabels();
|
List<IDLabelPair> allIDLabels = dMPDao.listAllIDsLabels();
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(allIDLabels));
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(allIDLabels));
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.GET, value = { "/dmp/ofuser" }, produces="text/plain")
|
||||||
|
public @ResponseBody ResponseEntity<Object> getDmpsOfUser(){
|
||||||
|
|
||||||
|
String userID = null;
|
||||||
|
try {
|
||||||
|
userID = SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString();
|
||||||
|
} catch(NullPointerException ex) {
|
||||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("You have not logged in. You shouldn't be here");
|
||||||
|
}
|
||||||
|
|
||||||
|
UserInfo userInfo = userInfoDao.read(UUID.fromString(userID));
|
||||||
|
|
||||||
|
if(userInfo==null) //this should normally never happer
|
||||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("There's no such a user on the system. You shouldn't be here");
|
||||||
|
|
||||||
|
try {
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(userInfo.getDmps()));
|
||||||
|
}
|
||||||
|
catch(Exception ex) {
|
||||||
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -112,6 +145,7 @@ public class DMPs {
|
||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.GET, value = { "/dmp/getAll" }, produces="application/json")
|
@RequestMapping(method = RequestMethod.GET, value = { "/dmp/getAll" }, produces="application/json")
|
||||||
public @ResponseBody ResponseEntity<Object> getAllDMPs(){
|
public @ResponseBody ResponseEntity<Object> getAllDMPs(){
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<DMP> allDMPs = dMPDao.getAll();
|
List<DMP> allDMPs = dMPDao.getAll();
|
||||||
|
|
||||||
|
@ -136,7 +170,6 @@ public class DMPs {
|
||||||
@Transactional
|
@Transactional
|
||||||
@RequestMapping(method = RequestMethod.POST, value = { "/dmp/create" }, consumes = "application/json", produces="application/json")
|
@RequestMapping(method = RequestMethod.POST, value = { "/dmp/create" }, consumes = "application/json", produces="application/json")
|
||||||
public @ResponseBody ResponseEntity<Object> setDMP(@RequestBody DMP dmp) {
|
public @ResponseBody ResponseEntity<Object> setDMP(@RequestBody DMP dmp) {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
DMP createdDmp = dMPDao.update(dmp);
|
DMP createdDmp = dMPDao.update(dmp);
|
||||||
try {
|
try {
|
||||||
return ResponseEntity.status(HttpStatus.CREATED).body(objectMapper.writeValueAsString(createdDmp));
|
return ResponseEntity.status(HttpStatus.CREATED).body(objectMapper.writeValueAsString(createdDmp));
|
||||||
|
@ -146,7 +179,7 @@ public class DMPs {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
@RequestMapping(method = RequestMethod.POST, value = { "/dmp/set/full" }, consumes = "application/json", produces="application/json")
|
@RequestMapping(method = RequestMethod.POST, value = { "/dmp/set/full" }, consumes = "application/json", produces="application/json")
|
||||||
public @ResponseBody ResponseEntity<Object> setFullDMP(@RequestBody DMP dmp) {
|
public @ResponseBody ResponseEntity<Object> setFullDMP(@RequestBody DMP dmp) {
|
||||||
|
|
||||||
|
@ -231,6 +264,8 @@ public class DMPs {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = { "/dmp/delete" }, consumes = "application/json", produces="text/plain")
|
@RequestMapping(method = RequestMethod.POST, value = { "/dmp/delete" }, consumes = "application/json", produces="text/plain")
|
||||||
public @ResponseBody ResponseEntity<Object> delete(@RequestBody DMP dmp) {
|
public @ResponseBody ResponseEntity<Object> delete(@RequestBody DMP dmp) {
|
||||||
|
@ -249,7 +284,7 @@ public class DMPs {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
// OLD ONES, USED BY THE EMBEDDED (simple) UI OF THIS SERVICE
|
// OLD ONES, USED BY THE EMBEDDED (simple) UI OF THIS SERVICE
|
||||||
@RequestMapping(method = RequestMethod.POST, value = { "/setDMPByForm" }, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces="text/plain")
|
@RequestMapping(method = RequestMethod.POST, value = { "/setDMPByForm" }, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces="text/plain")
|
||||||
public @ResponseBody ResponseEntity<Object> setDMPByForm(@RequestBody MultiValueMap<String,String> formData) {
|
public @ResponseBody ResponseEntity<Object> setDMPByForm(@RequestBody MultiValueMap<String,String> formData) {
|
||||||
|
@ -267,6 +302,7 @@ public class DMPs {
|
||||||
dmp.getDataset().getProfile().getViewstyle().setDefinition(formData.getFirst("DatasetProfileViewStyle.definition"));
|
dmp.getDataset().getProfile().getViewstyle().setDefinition(formData.getFirst("DatasetProfileViewStyle.definition"));
|
||||||
return setDMP(dmp);
|
return setDMP(dmp);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ import entities.Project;
|
||||||
import entities.Registry;
|
import entities.Registry;
|
||||||
import entities.Researcher;
|
import entities.Researcher;
|
||||||
import entities.Service;
|
import entities.Service;
|
||||||
|
import helpers.SerializerProvider;
|
||||||
import helpers.Transformers;
|
import helpers.Transformers;
|
||||||
import responses.RestResponse;
|
import responses.RestResponse;
|
||||||
|
|
||||||
|
@ -69,7 +70,7 @@ public class DataRepositories {
|
||||||
@Autowired private ServiceDao serviceDao;
|
@Autowired private ServiceDao serviceDao;
|
||||||
|
|
||||||
|
|
||||||
private ObjectMapper objectMapper = new ObjectMapper();
|
private ObjectMapper objectMapper = SerializerProvider.getJsonSerializer();
|
||||||
|
|
||||||
// MANAGE DATAREPOSITORy(IES)
|
// MANAGE DATAREPOSITORy(IES)
|
||||||
|
|
||||||
|
@ -77,7 +78,7 @@ public class DataRepositories {
|
||||||
public @ResponseBody ResponseEntity<Object> listDataRepositories(){
|
public @ResponseBody ResponseEntity<Object> listDataRepositories(){
|
||||||
try {
|
try {
|
||||||
List<UUID> allIDs = dataRepositoryDao.listAllIDs();
|
List<UUID> allIDs = dataRepositoryDao.listAllIDs();
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(allIDs));
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(allIDs));
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||||
|
@ -89,7 +90,7 @@ public class DataRepositories {
|
||||||
public @ResponseBody ResponseEntity<Object> getDataRepository(@PathVariable("id") String id) {
|
public @ResponseBody ResponseEntity<Object> getDataRepository(@PathVariable("id") String id) {
|
||||||
try {
|
try {
|
||||||
DataRepository dataRepository = dataRepositoryDao.read(UUID.fromString(id));
|
DataRepository dataRepository = dataRepositoryDao.read(UUID.fromString(id));
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(dataRepository));
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(dataRepository));
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
||||||
|
|
|
@ -2,7 +2,9 @@ package rest.entities;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -48,6 +50,7 @@ import entities.DatasetProfileRuleset;
|
||||||
import entities.DatasetProfileViewstyle;
|
import entities.DatasetProfileViewstyle;
|
||||||
import entities.Organisation;
|
import entities.Organisation;
|
||||||
import entities.Project;
|
import entities.Project;
|
||||||
|
import helpers.SerializerProvider;
|
||||||
import helpers.Transformers;
|
import helpers.Transformers;
|
||||||
import responses.RestResponse;
|
import responses.RestResponse;
|
||||||
|
|
||||||
|
@ -69,7 +72,7 @@ public class Datasets {
|
||||||
@Autowired private ResearcherDao researcherDao;
|
@Autowired private ResearcherDao researcherDao;
|
||||||
@Autowired private ServiceDao serviceDao;
|
@Autowired private ServiceDao serviceDao;
|
||||||
|
|
||||||
private ObjectMapper objectMapper = new ObjectMapper();
|
private ObjectMapper objectMapper = SerializerProvider.getJsonSerializer();
|
||||||
|
|
||||||
|
|
||||||
// FETCH BY DATASET(S)
|
// FETCH BY DATASET(S)
|
||||||
|
@ -78,7 +81,7 @@ public class Datasets {
|
||||||
public @ResponseBody ResponseEntity<Object> listDatasets(){
|
public @ResponseBody ResponseEntity<Object> listDatasets(){
|
||||||
try {
|
try {
|
||||||
List<UUID> allIDs = datasetDao.listAllIDs();
|
List<UUID> allIDs = datasetDao.listAllIDs();
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(allIDs));
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(allIDs));
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||||
|
@ -90,7 +93,7 @@ public class Datasets {
|
||||||
public @ResponseBody ResponseEntity<Object> getDataset(@PathVariable("id") String id) {
|
public @ResponseBody ResponseEntity<Object> getDataset(@PathVariable("id") String id) {
|
||||||
try {
|
try {
|
||||||
Dataset ds = datasetDao.read(UUID.fromString(id));
|
Dataset ds = datasetDao.read(UUID.fromString(id));
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(ds));
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(ds));
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
||||||
|
@ -226,7 +229,7 @@ public class Datasets {
|
||||||
public @ResponseBody ResponseEntity<Object> getDatasetProfile(@PathVariable("id") String id) {
|
public @ResponseBody ResponseEntity<Object> getDatasetProfile(@PathVariable("id") String id) {
|
||||||
try {
|
try {
|
||||||
DatasetProfile profile = datasetProfileDao.read(UUID.fromString(id));
|
DatasetProfile profile = datasetProfileDao.read(UUID.fromString(id));
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(profile));
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(profile));
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
||||||
|
@ -300,11 +303,13 @@ public class Datasets {
|
||||||
|
|
||||||
Dataset ds = new Dataset();
|
Dataset ds = new Dataset();
|
||||||
ds.setId(UUID.fromString(datasetID));
|
ds.setId(UUID.fromString(datasetID));
|
||||||
datasetProfile.setDataset(ds);
|
Set<Dataset> datasets = new HashSet<Dataset>();
|
||||||
|
datasets.add(ds);
|
||||||
|
datasetProfile.setDataset(datasets);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
datasetProfile = datasetProfileDao.create(datasetProfile);
|
datasetProfile = datasetProfileDao.create(datasetProfile);
|
||||||
return ResponseEntity.status(HttpStatus.CREATED).body(new ObjectMapper().writeValueAsString(datasetProfile));
|
return ResponseEntity.status(HttpStatus.CREATED).body(objectMapper.writeValueAsString(datasetProfile));
|
||||||
}
|
}
|
||||||
catch(Exception e) {
|
catch(Exception e) {
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("FAILED: reason: "+e.getMessage());
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("FAILED: reason: "+e.getMessage());
|
||||||
|
|
|
@ -48,6 +48,7 @@ import entities.Registry;
|
||||||
import entities.Researcher;
|
import entities.Researcher;
|
||||||
import entities.Service;
|
import entities.Service;
|
||||||
import entities.responses.IDLabelPair;
|
import entities.responses.IDLabelPair;
|
||||||
|
import helpers.SerializerProvider;
|
||||||
import helpers.Transformers;
|
import helpers.Transformers;
|
||||||
import responses.RestResponse;
|
import responses.RestResponse;
|
||||||
|
|
||||||
|
@ -69,7 +70,7 @@ public class DmpProfiles {
|
||||||
@Autowired private ResearcherDao researcherDao;
|
@Autowired private ResearcherDao researcherDao;
|
||||||
@Autowired private ServiceDao serviceDao;
|
@Autowired private ServiceDao serviceDao;
|
||||||
|
|
||||||
private ObjectMapper objectMapper = new ObjectMapper();
|
private ObjectMapper objectMapper = SerializerProvider.getJsonSerializer();
|
||||||
|
|
||||||
// MANAGE DMPPROFILE(S)
|
// MANAGE DMPPROFILE(S)
|
||||||
|
|
||||||
|
@ -77,7 +78,7 @@ public class DmpProfiles {
|
||||||
public @ResponseBody ResponseEntity<Object> listDmpProfiles(){
|
public @ResponseBody ResponseEntity<Object> listDmpProfiles(){
|
||||||
try {
|
try {
|
||||||
List<UUID> allIDs = dMPProfileDao.listAllIDs();
|
List<UUID> allIDs = dMPProfileDao.listAllIDs();
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(allIDs));
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(allIDs));
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||||
|
@ -91,7 +92,7 @@ public class DmpProfiles {
|
||||||
public @ResponseBody ResponseEntity<Object> getDmpProfile(@PathVariable("id") String id) {
|
public @ResponseBody ResponseEntity<Object> getDmpProfile(@PathVariable("id") String id) {
|
||||||
try {
|
try {
|
||||||
DMPProfile dmpProfile = dMPProfileDao.read(UUID.fromString(id));
|
DMPProfile dmpProfile = dMPProfileDao.read(UUID.fromString(id));
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(dmpProfile));
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(dmpProfile));
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
||||||
|
@ -104,7 +105,7 @@ public class DmpProfiles {
|
||||||
public @ResponseBody ResponseEntity<Object> listLabelIds(){
|
public @ResponseBody ResponseEntity<Object> listLabelIds(){
|
||||||
try {
|
try {
|
||||||
List<IDLabelPair> allIDs = dMPProfileDao.listAllIDsLabels();
|
List<IDLabelPair> allIDs = dMPProfileDao.listAllIDsLabels();
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(allIDs));
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(allIDs));
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||||
|
|
|
@ -47,6 +47,7 @@ import entities.Project;
|
||||||
import entities.Registry;
|
import entities.Registry;
|
||||||
import entities.Researcher;
|
import entities.Researcher;
|
||||||
import entities.Service;
|
import entities.Service;
|
||||||
|
import helpers.SerializerProvider;
|
||||||
import helpers.Transformers;
|
import helpers.Transformers;
|
||||||
import responses.RestResponse;
|
import responses.RestResponse;
|
||||||
|
|
||||||
|
@ -69,7 +70,7 @@ public class Organisations {
|
||||||
@Autowired private ServiceDao serviceDao;
|
@Autowired private ServiceDao serviceDao;
|
||||||
|
|
||||||
|
|
||||||
private ObjectMapper objectMapper = new ObjectMapper();
|
private ObjectMapper objectMapper = SerializerProvider.getJsonSerializer();
|
||||||
|
|
||||||
// MANAGE ORGANISATIONS(S)
|
// MANAGE ORGANISATIONS(S)
|
||||||
|
|
||||||
|
@ -77,7 +78,7 @@ public class Organisations {
|
||||||
public @ResponseBody ResponseEntity<Object> listOrganisations(){
|
public @ResponseBody ResponseEntity<Object> listOrganisations(){
|
||||||
try {
|
try {
|
||||||
List<UUID> allIDs = organisationDao.listAllIDs();
|
List<UUID> allIDs = organisationDao.listAllIDs();
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(allIDs));
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(allIDs));
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||||
|
@ -89,7 +90,7 @@ public class Organisations {
|
||||||
public @ResponseBody ResponseEntity<Object> getOrganisations(@PathVariable("id") String id) {
|
public @ResponseBody ResponseEntity<Object> getOrganisations(@PathVariable("id") String id) {
|
||||||
try {
|
try {
|
||||||
Organisation organisation = organisationDao.read(UUID.fromString(id));
|
Organisation organisation = organisationDao.read(UUID.fromString(id));
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(organisation));
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(organisation));
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
||||||
|
|
|
@ -21,8 +21,11 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module;
|
||||||
|
|
||||||
import dao.entities.DMPDao;
|
import dao.entities.DMPDao;
|
||||||
import dao.entities.DMPProfileDao;
|
import dao.entities.DMPProfileDao;
|
||||||
|
@ -48,6 +51,7 @@ import entities.Registry;
|
||||||
import entities.Researcher;
|
import entities.Researcher;
|
||||||
import entities.Service;
|
import entities.Service;
|
||||||
import entities.responses.IDLabelPair;
|
import entities.responses.IDLabelPair;
|
||||||
|
import helpers.SerializerProvider;
|
||||||
import helpers.Transformers;
|
import helpers.Transformers;
|
||||||
import responses.RestResponse;
|
import responses.RestResponse;
|
||||||
|
|
||||||
|
@ -70,7 +74,7 @@ public class Projects {
|
||||||
@Autowired private ServiceDao serviceDao;
|
@Autowired private ServiceDao serviceDao;
|
||||||
|
|
||||||
|
|
||||||
private ObjectMapper objectMapper = new ObjectMapper();
|
private ObjectMapper objectMapper = SerializerProvider.getJsonSerializer();
|
||||||
|
|
||||||
// MANAGE PROJECT(S)
|
// MANAGE PROJECT(S)
|
||||||
|
|
||||||
|
@ -78,7 +82,7 @@ public class Projects {
|
||||||
public @ResponseBody ResponseEntity<Object> listProjects(){
|
public @ResponseBody ResponseEntity<Object> listProjects(){
|
||||||
try {
|
try {
|
||||||
List<UUID> allIDs = projectDao.listAllIDs();
|
List<UUID> allIDs = projectDao.listAllIDs();
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(allIDs));
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(allIDs));
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||||
|
@ -89,7 +93,10 @@ public class Projects {
|
||||||
public @ResponseBody ResponseEntity<Object> getProject(@PathVariable("id") String id) {
|
public @ResponseBody ResponseEntity<Object> getProject(@PathVariable("id") String id) {
|
||||||
try {
|
try {
|
||||||
Project project = projectDao.read(UUID.fromString(id));
|
Project project = projectDao.read(UUID.fromString(id));
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(project));
|
|
||||||
|
System.out.println(project.getId().toString());
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(project));
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
||||||
|
@ -101,7 +108,7 @@ public class Projects {
|
||||||
public @ResponseBody ResponseEntity<Object> listLabelIds(){
|
public @ResponseBody ResponseEntity<Object> listLabelIds(){
|
||||||
try {
|
try {
|
||||||
List<IDLabelPair> allIDs = projectDao.listAllIDsLabels();
|
List<IDLabelPair> allIDs = projectDao.listAllIDsLabels();
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(allIDs));
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(allIDs));
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||||
|
|
|
@ -47,6 +47,7 @@ import entities.Registry;
|
||||||
import entities.Researcher;
|
import entities.Researcher;
|
||||||
import entities.Service;
|
import entities.Service;
|
||||||
import entities.responses.IDLabelPair;
|
import entities.responses.IDLabelPair;
|
||||||
|
import helpers.SerializerProvider;
|
||||||
import helpers.Transformers;
|
import helpers.Transformers;
|
||||||
import responses.RestResponse;
|
import responses.RestResponse;
|
||||||
|
|
||||||
|
@ -69,7 +70,7 @@ public class Registries {
|
||||||
@Autowired private ServiceDao serviceDao;
|
@Autowired private ServiceDao serviceDao;
|
||||||
|
|
||||||
|
|
||||||
private ObjectMapper objectMapper = new ObjectMapper();
|
private ObjectMapper objectMapper = SerializerProvider.getJsonSerializer();
|
||||||
|
|
||||||
// MANAGE REGISTRY(IES)
|
// MANAGE REGISTRY(IES)
|
||||||
|
|
||||||
|
@ -77,7 +78,7 @@ public class Registries {
|
||||||
public @ResponseBody ResponseEntity<Object> listRegistries(){
|
public @ResponseBody ResponseEntity<Object> listRegistries(){
|
||||||
try {
|
try {
|
||||||
List<UUID> allIDs = registryDao.listAllIDs();
|
List<UUID> allIDs = registryDao.listAllIDs();
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(allIDs));
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(allIDs));
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||||
|
@ -89,7 +90,7 @@ public class Registries {
|
||||||
public @ResponseBody ResponseEntity<Object> getRegistries(@PathVariable("id") String id) {
|
public @ResponseBody ResponseEntity<Object> getRegistries(@PathVariable("id") String id) {
|
||||||
try {
|
try {
|
||||||
Registry registry = registryDao.read(UUID.fromString(id));
|
Registry registry = registryDao.read(UUID.fromString(id));
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(registry));
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(registry));
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
||||||
|
|
|
@ -47,6 +47,7 @@ import entities.Project;
|
||||||
import entities.Registry;
|
import entities.Registry;
|
||||||
import entities.Researcher;
|
import entities.Researcher;
|
||||||
import entities.Service;
|
import entities.Service;
|
||||||
|
import helpers.SerializerProvider;
|
||||||
import helpers.Transformers;
|
import helpers.Transformers;
|
||||||
import responses.RestResponse;
|
import responses.RestResponse;
|
||||||
|
|
||||||
|
@ -69,7 +70,7 @@ public class Researchers {
|
||||||
@Autowired private ServiceDao serviceDao;
|
@Autowired private ServiceDao serviceDao;
|
||||||
|
|
||||||
|
|
||||||
private ObjectMapper objectMapper = new ObjectMapper();
|
private ObjectMapper objectMapper = SerializerProvider.getJsonSerializer();
|
||||||
|
|
||||||
// MANAGE RESEARCHER(S)
|
// MANAGE RESEARCHER(S)
|
||||||
|
|
||||||
|
@ -77,7 +78,7 @@ public class Researchers {
|
||||||
public @ResponseBody ResponseEntity<Object> listResearchers(){
|
public @ResponseBody ResponseEntity<Object> listResearchers(){
|
||||||
try {
|
try {
|
||||||
List<UUID> allIDs = researcherDao.listAllIDs();
|
List<UUID> allIDs = researcherDao.listAllIDs();
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(allIDs));
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(allIDs));
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||||
|
@ -89,7 +90,7 @@ public class Researchers {
|
||||||
public @ResponseBody ResponseEntity<Object> getResearchers(@PathVariable("id") String id) {
|
public @ResponseBody ResponseEntity<Object> getResearchers(@PathVariable("id") String id) {
|
||||||
try {
|
try {
|
||||||
Researcher researcher = researcherDao.read(UUID.fromString(id));
|
Researcher researcher = researcherDao.read(UUID.fromString(id));
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(researcher));
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(researcher));
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
||||||
|
@ -100,7 +101,7 @@ public class Researchers {
|
||||||
public @ResponseBody ResponseEntity<Object> getResearcherByEmail(@RequestParam("email") String email){
|
public @ResponseBody ResponseEntity<Object> getResearcherByEmail(@RequestParam("email") String email){
|
||||||
try {
|
try {
|
||||||
Researcher researcher = researcherDao.getResearcherByEmail(email);
|
Researcher researcher = researcherDao.getResearcherByEmail(email);
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(researcher));
|
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(researcher));
|
||||||
}
|
}
|
||||||
catch(Exception ex) {
|
catch(Exception ex) {
|
||||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
||||||
|
|
|
@ -47,6 +47,7 @@ import entities.Project;
|
||||||
import entities.Registry;
|
import entities.Registry;
|
||||||
import entities.Researcher;
|
import entities.Researcher;
|
||||||
import entities.Service;
|
import entities.Service;
|
||||||
|
import helpers.SerializerProvider;
|
||||||
import helpers.Transformers;
|
import helpers.Transformers;
|
||||||
import responses.RestResponse;
|
import responses.RestResponse;
|
||||||
|
|
||||||
|
@ -69,7 +70,7 @@ public class Services {
|
||||||
@Autowired private ServiceDao serviceDao;
|
@Autowired private ServiceDao serviceDao;
|
||||||
|
|
||||||
|
|
||||||
private ObjectMapper objectMapper = new ObjectMapper();
|
private ObjectMapper objectMapper = SerializerProvider.getJsonSerializer();
|
||||||
|
|
||||||
// MANAGE SERVICE(S)
|
// MANAGE SERVICE(S)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
package rest.entities;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.SerializationUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.util.MultiValueMap;
|
||||||
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import dao.entities.DMPDao;
|
||||||
|
import dao.entities.DMPProfileDao;
|
||||||
|
import dao.entities.DataRepositoryDao;
|
||||||
|
import dao.entities.DatasetDao;
|
||||||
|
import dao.entities.DatasetProfileDao;
|
||||||
|
import dao.entities.DatasetProfileRulesetDao;
|
||||||
|
import dao.entities.DatasetProfileViewstyleDao;
|
||||||
|
import dao.entities.OrganisationDao;
|
||||||
|
import dao.entities.ProjectDao;
|
||||||
|
import dao.entities.RegistryDao;
|
||||||
|
import dao.entities.ResearcherDao;
|
||||||
|
import dao.entities.ServiceDao;
|
||||||
|
import entities.DMP;
|
||||||
|
import entities.DMPProfile;
|
||||||
|
import entities.DataRepository;
|
||||||
|
import entities.Dataset;
|
||||||
|
import entities.DatasetProfile;
|
||||||
|
import entities.DatasetProfileRuleset;
|
||||||
|
import entities.Organisation;
|
||||||
|
import entities.Project;
|
||||||
|
import entities.Registry;
|
||||||
|
import entities.Researcher;
|
||||||
|
import entities.Service;
|
||||||
|
import helpers.SerializerProvider;
|
||||||
|
import helpers.Transformers;
|
||||||
|
import responses.RestResponse;
|
||||||
|
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@CrossOrigin
|
||||||
|
public class Users {
|
||||||
|
|
||||||
|
@Autowired private DataRepositoryDao dataRepositoryDao;
|
||||||
|
@Autowired private DatasetDao datasetDao;
|
||||||
|
@Autowired private DatasetProfileDao datasetProfileDao;
|
||||||
|
@Autowired private DatasetProfileRulesetDao datasetProfileRulesetDao;
|
||||||
|
@Autowired private DatasetProfileViewstyleDao datasetProfileViewstyleDao;
|
||||||
|
@Autowired private DMPDao dMPDao;
|
||||||
|
@Autowired private DMPProfileDao dMPProfileDao;
|
||||||
|
@Autowired private OrganisationDao organisationDao;
|
||||||
|
@Autowired private ProjectDao projectDao;
|
||||||
|
@Autowired private RegistryDao registryDao;
|
||||||
|
@Autowired private ResearcherDao researcherDao;
|
||||||
|
@Autowired private ServiceDao serviceDao;
|
||||||
|
|
||||||
|
|
||||||
|
private ObjectMapper objectMapper = SerializerProvider.getJsonSerializer();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -52,9 +52,9 @@ public class CustomAuthenticationProvider implements AuthenticationProvider {
|
||||||
throw new AuthenticationServiceException("Token validation failed - Not a valid token");
|
throw new AuthenticationServiceException("Token validation failed - Not a valid token");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if reached this point, authentication is ok, so return just an instance where the principal is the UserInfo ID
|
||||||
// if reached this point, authentication is ok, so return just an instance with whatever.
|
//(to have it at the webservices calls - it's ESSENTIAL) while the password can be whatever...
|
||||||
return new UsernamePasswordAuthenticationToken(authentication.getPrincipal(), authentication.getCredentials(), new ArrayList<>());
|
return new UsernamePasswordAuthenticationToken(userInfo.getId(), authentication.getCredentials(), new ArrayList<>());
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -55,6 +55,8 @@
|
||||||
<prop key="hibernate.hbm2ddl.auto">${persistence.hibernate.hbm2dll}</prop>
|
<prop key="hibernate.hbm2ddl.auto">${persistence.hibernate.hbm2dll}</prop>
|
||||||
<prop key="hibernate.dialect">${persistence.hibernate.dialect}</prop>
|
<prop key="hibernate.dialect">${persistence.hibernate.dialect}</prop>
|
||||||
|
|
||||||
|
<prop key="hibernate.enable_lazy_load_no_trans">true</prop> <!-- USE WITH CAUTION -->
|
||||||
|
|
||||||
<prop key="hibernate.jdbc.batch_size">${persistence.hibernate.jdbc.batch_size}</prop>
|
<prop key="hibernate.jdbc.batch_size">${persistence.hibernate.jdbc.batch_size}</prop>
|
||||||
<prop key="hibernate.order_inserts">${persistence.hibernate.order_inserts}</prop>
|
<prop key="hibernate.order_inserts">${persistence.hibernate.order_inserts}</prop>
|
||||||
<prop key="hibernate.order_updates">${persistence.hibernate.order_updates}</prop>
|
<prop key="hibernate.order_updates">${persistence.hibernate.order_updates}</prop>
|
||||||
|
|
|
@ -67,22 +67,22 @@
|
||||||
|
|
||||||
<context-param>
|
<context-param>
|
||||||
<param-name>contextConfigLocation</param-name>
|
<param-name>contextConfigLocation</param-name>
|
||||||
<param-value>/WEB-INF/applicationContext.xml,/WEB-INF/spring-security.xml</param-value>
|
<!-- <param-value>/WEB-INF/applicationContext.xml,/WEB-INF/spring-security.xml</param-value> -->
|
||||||
<!-- <param-value>/WEB-INF/applicationContext.xml</param-value> -->
|
<param-value>/WEB-INF/applicationContext.xml</param-value>
|
||||||
</context-param>
|
</context-param>
|
||||||
<session-config>
|
<session-config>
|
||||||
<session-timeout>30</session-timeout>
|
<session-timeout>30</session-timeout>
|
||||||
</session-config>
|
</session-config>
|
||||||
|
|
||||||
<!-- THIS FILTER IS FOR SPRING SECURITY -->
|
<!-- THIS FILTER IS FOR SPRING SECURITY -->
|
||||||
<filter>
|
<!-- <filter> -->
|
||||||
<filter-name>springSecurityFilterChain</filter-name>
|
<!-- <filter-name>springSecurityFilterChain</filter-name> -->
|
||||||
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
|
<!-- <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> -->
|
||||||
</filter>
|
<!-- </filter> -->
|
||||||
<filter-mapping>
|
<!-- <filter-mapping> -->
|
||||||
<filter-name>springSecurityFilterChain</filter-name>
|
<!-- <filter-name>springSecurityFilterChain</filter-name> -->
|
||||||
<url-pattern>/rest/*</url-pattern>
|
<!-- <url-pattern>/rest/*</url-pattern> -->
|
||||||
</filter-mapping>
|
<!-- </filter-mapping> -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue