Merge branch 'master' of gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot

This commit is contained in:
annampak 2017-10-25 16:17:28 +03:00
commit e03d5f7ed2
32 changed files with 260 additions and 236 deletions

View File

@ -4,7 +4,6 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/resources"/>
<property name="context-root" value="dmp-backend"/> <property name="context-root" value="dmp-backend"/>
<property name="java-output-path" value="/dmp-backend/target/classes"/> <property name="java-output-path" value="/dmp-backend/target/classes"/>
</wb-module> </wb-module>

View File

@ -143,10 +143,10 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.datatype</groupId> <groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-hibernate5</artifactId> <artifactId>jackson-datatype-hibernate5</artifactId>
<version>2.8.4</version> <version>2.8.4</version>
</dependency> </dependency>
@ -166,13 +166,22 @@
<version>${org.apache.tomcat.tomcat-jdbc.version}</version> <version>${org.apache.tomcat.tomcat-jdbc.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- FOR TESTING -->
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>${org.junit.version}</version> <version>${org.junit.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
<scope>test</scope>
</dependency>
<!-- PostGreSql base libs dependencies --> <!-- PostGreSql base libs dependencies -->
<dependency> <dependency>

View File

@ -0,0 +1,37 @@
package configs;
import java.util.List;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module;
import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module.Feature;
@Configuration
@EnableWebMvc
public class WebConfiguration extends WebMvcConfigurerAdapter {
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
Hibernate5Module module = new Hibernate5Module();
module.enable(Feature.SERIALIZE_IDENTIFIER_FOR_LAZY_NOT_LOADED_OBJECTS);
ObjectMapper objectMapper = new ObjectMapper()
// .setSerializationInclusion(Include.NON_NULL)
// .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.registerModule(new Hibernate5Module())
;
converters.add(new MappingJackson2HttpMessageConverter(objectMapper));
System.out.println("Using custom json serializer loaded with module Hibernate5Module");
}
}

View File

@ -35,9 +35,7 @@ import com.fasterxml.jackson.databind.SerializationFeature;
@Entity @Entity
@Table(name="\"DMP\"") @Table(name="\"DMP\"")
//@Proxy(lazy = false) @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
//@JsonInclude(Include.NON_NULL)
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
public class DMP implements Serializable { public class DMP implements Serializable {
@ -64,7 +62,7 @@ public class DMP implements Serializable {
private Set<Dataset> dataset; private Set<Dataset> dataset;
@ManyToOne() @ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "\"Project\"") @JoinColumn(name = "\"Project\"")
private Project project; private Project project;
@ -73,7 +71,7 @@ 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.LAZY) @ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "\"Profile\"") @JoinColumn(name = "\"Profile\"")
private DMPProfile profile; private DMPProfile profile;

View File

@ -22,9 +22,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
@Entity @Entity
@Table(name="\"DMPOrganisation\"") @Table(name="\"DMPOrganisation\"")
//@Proxy(lazy = false) @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
//@JsonInclude(Include.NON_NULL)
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
public class DMPOrganisation implements Serializable { public class DMPOrganisation implements Serializable {

View File

@ -2,14 +2,15 @@ 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.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.FetchType; import javax.persistence.FetchType;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne; import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
@ -25,9 +26,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
@Entity @Entity
@Table(name="\"DMPProfile\"") @Table(name="\"DMPProfile\"")
//@Proxy(lazy = false) @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
//@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;
@ -42,8 +41,8 @@ public class DMPProfile implements Serializable {
private UUID id; private UUID id;
@OneToOne(fetch = FetchType.LAZY, mappedBy = "profile") @OneToMany(fetch = FetchType.LAZY, mappedBy = "profile")
private DMP dmp; private Set<DMP> dmps;
@Column(name = "\"Label\"") @Column(name = "\"Label\"")
@ -77,15 +76,13 @@ public class DMPProfile implements Serializable {
this.definition = definition; this.definition = definition;
} }
public DMP getDmp() { public Set<DMP> getDmps() {
return dmp; return dmps;
} }
public void setDmp(DMP dmp) { public void setDmps(Set<DMP> dmps) {
this.dmp = dmp; this.dmps = dmps;
} }
} }

View File

@ -22,9 +22,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
@Entity @Entity
@Table(name="\"DMPResearcher\"") @Table(name="\"DMPResearcher\"")
//@Proxy(lazy = false) @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
//@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;

View File

@ -26,9 +26,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
@Entity @Entity
@Table(name="\"DataRepository\"") @Table(name="\"DataRepository\"")
//@Proxy(lazy = false) @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
//@JsonInclude(Include.NON_NULL)
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
public class DataRepository implements Serializable { public class DataRepository implements Serializable {

View File

@ -30,14 +30,12 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
@Entity(name = "Dataset") @Entity(name = "Dataset")
@Table(name="\"Dataset\"") @Table(name="\"Dataset\"")
//@Proxy(lazy = false) @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
//@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;
public Dataset () {} //public Dataset () {}
@Id @Id
@ -50,12 +48,12 @@ public class Dataset implements Serializable {
private String label; private String label;
@ManyToOne(fetch = FetchType.LAZY) @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;
@Column(name = "\"Uri\"") @Column(name = "\"Uri\"")
private String uri; private String uri;
@ -64,7 +62,7 @@ public class Dataset implements Serializable {
private String properties; private String properties;
@ManyToOne(fetch = FetchType.LAZY) @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;

View File

@ -22,9 +22,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
@Entity @Entity
@Table(name="\"DatasetDataRepository\"") @Table(name="\"DatasetDataRepository\"")
//@Proxy(lazy = false) @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
//@JsonInclude(Include.NON_NULL)
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
public class DatasetDataRepository implements Serializable { public class DatasetDataRepository implements Serializable {

View File

@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.ObjectIdGenerators;
@Entity @Entity
@Table(name="\"DatasetProfile\"") @Table(name="\"DatasetProfile\"")
//@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 {

View File

@ -27,9 +27,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
@Entity @Entity
@Table(name="\"DatasetProfileRuleset\"") @Table(name="\"DatasetProfileRuleset\"")
//@Proxy(lazy = false) @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
//@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;
@ -44,7 +42,7 @@ public class DatasetProfileRuleset implements Serializable {
private UUID id; private UUID id;
@OneToOne(fetch = FetchType.EAGER, mappedBy = "ruleset") @OneToOne(fetch = FetchType.LAZY, mappedBy = "ruleset")
private DatasetProfile datasetProfile; private DatasetProfile datasetProfile;

View File

@ -26,9 +26,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
@Entity @Entity
@Table(name="\"DatasetProfileViewstyle\"") @Table(name="\"DatasetProfileViewstyle\"")
//@Proxy(lazy = false) @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
//@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;
@ -43,7 +41,7 @@ public class DatasetProfileViewstyle implements Serializable {
private UUID id; private UUID id;
@OneToOne(fetch = FetchType.EAGER, mappedBy = "viewstyle") @OneToOne(fetch = FetchType.LAZY, mappedBy = "viewstyle")
private DatasetProfile datasetProfile; private DatasetProfile datasetProfile;
@Column(name = "\"Label\"") @Column(name = "\"Label\"")

View File

@ -22,9 +22,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
@Entity @Entity
@Table(name="\"DatasetRegistry\"") @Table(name="\"DatasetRegistry\"")
//@Proxy(lazy = false) @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
//@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;

View File

@ -22,9 +22,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
@Entity @Entity
@Table(name="\"DatasetService\"") @Table(name="\"DatasetService\"")
//@Proxy(lazy = false) @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
//@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;

View File

@ -28,9 +28,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
@Entity @Entity
@Table(name="\"Organisation\"") @Table(name="\"Organisation\"")
//@Proxy(lazy = false) @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
//@JsonInclude(Include.NON_NULL)
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
public class Organisation implements Serializable { public class Organisation implements Serializable {

View File

@ -32,8 +32,6 @@ 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 {

View File

@ -28,9 +28,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
@Entity @Entity
@Table(name="\"Registry\"") @Table(name="\"Registry\"")
//@Proxy(lazy = false) @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
//@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;

View File

@ -28,9 +28,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
@Entity @Entity
@Table(name="\"Researcher\"") @Table(name="\"Researcher\"")
//@Proxy(lazy = false) @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
//@JsonInclude(Include.NON_NULL)
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
public class Researcher implements Serializable { public class Researcher implements Serializable {

View File

@ -30,16 +30,12 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
@Entity @Entity
@Table(name="\"Service\"") @Table(name="\"Service\"")
//@Proxy(lazy = false) @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
//@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 = 163279108676904730L;
public Service () {}
@Id @Id
@GeneratedValue @GeneratedValue
@GenericGenerator(name = "uuid2", strategy = "uuid2") @GenericGenerator(name = "uuid2", strategy = "uuid2")
@ -65,7 +61,7 @@ public class Service implements Serializable {
private String definition; private String definition;
@OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL) @OneToMany(fetch = FetchType.LAZY)
@JoinTable(name="\"DatasetService\"", @JoinTable(name="\"DatasetService\"",
joinColumns={@JoinColumn(name="\"Service\"", referencedColumnName="\"ID\"")}, joinColumns={@JoinColumn(name="\"Service\"", referencedColumnName="\"ID\"")},
inverseJoinColumns={@JoinColumn(name="\"Dataset\"", referencedColumnName="\"ID\"")} inverseJoinColumns={@JoinColumn(name="\"Dataset\"", referencedColumnName="\"ID\"")}

View File

@ -32,9 +32,7 @@ import entities.security.UserAuth;
@Entity @Entity
@Table(name="\"UserInfo\"") @Table(name="\"UserInfo\"")
//@Proxy(lazy = false) @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
//@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;

View File

@ -20,9 +20,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
@Entity @Entity
@Table(name="\"UserProject\"") @Table(name="\"UserProject\"")
//@Proxy(lazy = false) @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
//@JsonInclude(Include.NON_NULL)
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
public class UserProject implements Serializable{ public class UserProject implements Serializable{
private static final long serialVersionUID = -4467370784003784660L; private static final long serialVersionUID = -4467370784003784660L;

View File

@ -18,9 +18,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
@Entity @Entity
@Table(name="\"UserAuth\"") @Table(name="\"UserAuth\"")
//@Proxy(lazy = false) @JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
//@JsonInclude(Include.NON_NULL)
@JsonIdentityInfo(generator=ObjectIdGenerators.UUIDGenerator.class, property="id")
public class UserAuth { public class UserAuth {
@Id @Id

View File

@ -2,18 +2,27 @@ package helpers;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module;
import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module.Feature;
public class SerializerProvider { public class SerializerProvider {
private static ObjectMapper objectMapper = new ObjectMapper() private static ObjectMapper objectMapper = null;
// .setSerializationInclusion(Include.NON_NULL)
// .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.registerModule(new Hibernate5Module())
;
static {
Hibernate5Module module = new Hibernate5Module();
module.enable(Feature.SERIALIZE_IDENTIFIER_FOR_LAZY_NOT_LOADED_OBJECTS);
objectMapper = new ObjectMapper()
// .setSerializationInclusion(Include.NON_NULL)
// .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.registerModule(new Hibernate5Module())
;
}
public static ObjectMapper getJsonSerializer() { public static ObjectMapper getJsonSerializer() {
return objectMapper; return objectMapper;
} }

View File

@ -134,6 +134,7 @@ public class DMPs {
} }
catch(Exception ex) { catch(Exception ex) {
ex.printStackTrace();
return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR); return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR);
} }
} }
@ -252,6 +253,20 @@ public class DMPs {
*/ */
@RequestMapping(method = RequestMethod.POST, value = { "/dmp/getdatasets" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseEntity<Object> getDatasetsOfDMP(@RequestBody DMP dmp) {
Set<Dataset> datasets = dMPDao.read(dmp.getId()).getDataset();
try {
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(datasets));
} catch (JsonProcessingException e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not get datasets of DMP!\"");
}
}
@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) {

View File

@ -72,9 +72,7 @@ public class DatasetProfiles {
@Autowired private ResearcherDao researcherDao; @Autowired private ResearcherDao researcherDao;
@Autowired private ServiceDao serviceDao; @Autowired private ServiceDao serviceDao;
private ObjectMapper objectMapper = private ObjectMapper objectMapper = SerializerProvider.getJsonSerializer();
new ObjectMapper();
//SerializerProvider.getJsonSerializer();
//FETCH BY DATASET PROFILE //FETCH BY DATASET PROFILE
@ -102,6 +100,31 @@ public class DatasetProfiles {
} }
} }
@RequestMapping(method = RequestMethod.GET, value = { "/datasetprofile/getAll" })
public @ResponseBody ResponseEntity<Object> getAllDatasetProfiles(){
try {
List<DatasetProfile> allDatasetProfiles = datasetProfileDao.getAll();
//sorry for that, spring-jersey serialisation has issues when performed on tables, so -> custom
List<String> datasetProfilesStrL = allDatasetProfiles.stream().map((datasetProfileObj) -> {
try {
return objectMapper.writeValueAsString(datasetProfileObj);
} catch (JsonProcessingException e) {
e.printStackTrace();
return "";
}
}).collect(Collectors.toList());
return new ResponseEntity<Object>("["+String.join(",", datasetProfilesStrL)+"]", HttpStatus.OK);
}
catch(Exception ex) {
ex.printStackTrace();
return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@Transactional @Transactional
@ -113,14 +136,14 @@ public class DatasetProfiles {
if(datasetprofileruleset != null) { if(datasetprofileruleset != null) {
if(datasetprofileruleset.getId()==null) if(datasetprofileruleset.getId()==null)
datasetprofileruleset = datasetProfileRulesetDao.create(datasetprofileruleset); datasetProfileRulesetDao.create(datasetprofileruleset);
else else
datasetProfileRulesetDao.update(datasetprofileruleset); datasetProfileRulesetDao.update(datasetprofileruleset);
datasetProfile.setRuleset(datasetprofileruleset); datasetProfile.setRuleset(datasetprofileruleset);
} }
if(datasetprofileviewstyle != null) { if(datasetprofileviewstyle != null) {
if(datasetprofileviewstyle.getId()==null) if(datasetprofileviewstyle.getId()==null)
datasetprofileviewstyle = datasetProfileViewstyleDao.create(datasetprofileviewstyle); datasetProfileViewstyleDao.create(datasetprofileviewstyle);
else else
datasetProfileViewstyleDao.update(datasetprofileviewstyle); datasetProfileViewstyleDao.update(datasetprofileviewstyle);
datasetProfile.setViewstyle(datasetprofileviewstyle); datasetProfile.setViewstyle(datasetprofileviewstyle);
@ -129,7 +152,7 @@ public class DatasetProfiles {
try { try {
if(datasetProfile.getId()==null) if(datasetProfile.getId()==null)
datasetProfile = datasetProfileDao.create(datasetProfile); datasetProfileDao.create(datasetProfile);
else else
datasetProfileDao.update(datasetProfile); datasetProfileDao.update(datasetProfile);
return ResponseEntity.status(HttpStatus.CREATED).body(objectMapper.writeValueAsString(datasetProfile)); return ResponseEntity.status(HttpStatus.CREATED).body(objectMapper.writeValueAsString(datasetProfile));
@ -177,80 +200,26 @@ public class DatasetProfiles {
} }
// //@Transactional @Transactional
// @RequestMapping(method = RequestMethod.POST, value = { "/datasetprofile/set" }, consumes = "application/json", produces="application/json") @RequestMapping(method = RequestMethod.POST, value = { "/datasetprofile/delete" }, consumes = "application/json", produces="application/json")
// public @ResponseBody ResponseEntity<Object> setDatasetProfile(@RequestBody DatasetProfile datasetProfile) { public @ResponseBody ResponseEntity<Object> deleteDatasetProfile(@RequestBody DatasetProfile datasetProfile) {
//
// System.out.println("inside setDatasetProfile"); DatasetProfileRuleset datasetprofileruleset = datasetProfile.getRuleset();
// try { DatasetProfileViewstyle datasetprofileviewstyle = datasetProfile.getViewstyle();
// System.out.println(objectMapper.writeValueAsString(datasetProfile));
// } catch (JsonProcessingException e) { try {
// e.printStackTrace(); if(datasetprofileruleset != null)
// } datasetProfileRulesetDao.delete(datasetprofileruleset);
// if(datasetprofileviewstyle != null)
// if(datasetProfile.getRuleset()!=null && datasetProfile.getRuleset().getId()!=null){ datasetProfileViewstyleDao.delete(datasetprofileviewstyle);
// DatasetProfileRuleset dpr = datasetProfile.getRuleset(); datasetProfileDao.delete(datasetProfile);
// datasetProfileRulesetDao.update(dpr); return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(datasetProfile));
// DatasetProfileRuleset n = new DatasetProfileRuleset(); }
// n.setId(dpr.getId()); catch(Exception ex) {
// datasetProfile.setRuleset(n); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not delete dataset profile!\"}");
// } }
//
// if(datasetProfile.getViewstyle()!=null && datasetProfile.getViewstyle().getId()!=null){ }
// DatasetProfileViewstyle dpv = datasetProfile.getViewstyle();
// datasetProfileViewstyleDao.update(dpv);
// DatasetProfileViewstyle n = new DatasetProfileViewstyle();
// n.setId(dpv.getId());
// datasetProfile.setViewstyle(n);
// }
//
// datasetProfile.setDataset(null);
//
// DatasetProfile createdDatasetProfile = datasetProfileDao.update(datasetProfile);
// try {
// return ResponseEntity.status(HttpStatus.CREATED).body(objectMapper.writeValueAsString(createdDatasetProfile));
// } catch (JsonProcessingException e) {
// e.printStackTrace();
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not set dataset profile!\"}");
// }
//
// }
// @RequestMapping(method = RequestMethod.POST, value = { "/createEmptyDatasetProfile" })
// public @ResponseBody ResponseEntity<Object> createEmptyDatasetProfile(@RequestParam("datasetID") String datasetID) {
//
// DatasetProfileRuleset dpr = new DatasetProfileRuleset();
// dpr.setLabel("");
// dpr.setDefinition("");
// dpr.setId(datasetProfileRulesetDao.create(dpr).getId());
//
// DatasetProfileViewstyle dpv = new DatasetProfileViewstyle();
// dpv.setLabel("");
// dpv.setDefinition("");
// dpv.setId(datasetProfileViewstyleDao.create(dpv).getId());
//
// DatasetProfile datasetProfile = new DatasetProfile();
// datasetProfile.setLabel("");
// datasetProfile.setDefinition("");
// datasetProfile.setRuleset(dpr);
// datasetProfile.setViewstyle(dpv);
//
// Dataset ds = new Dataset();
// ds.setId(UUID.fromString(datasetID));
// Set<Dataset> datasets = new HashSet<Dataset>();
// datasets.add(ds);
// datasetProfile.setDataset(datasets);
//
// try {
// datasetProfile = datasetProfileDao.create(datasetProfile);
// return ResponseEntity.status(HttpStatus.CREATED).body(objectMapper.writeValueAsString(datasetProfile));
// }
// catch(Exception e) {
// return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("FAILED: reason: "+e.getMessage());
// }
// }

View File

@ -74,7 +74,6 @@ public class Datasets {
private ObjectMapper objectMapper = SerializerProvider.getJsonSerializer(); private ObjectMapper objectMapper = SerializerProvider.getJsonSerializer();
// FETCH BY DATASET(S) // FETCH BY DATASET(S)
@ -111,11 +110,13 @@ public class Datasets {
try { try {
List<Dataset> allDatasets = datasetDao.getAll(); List<Dataset> allDatasets = datasetDao.getAll();
//sorry for that, spring-jersey serialisation has issues when performed on tables, so -> custom //sorry for that, spring-jersey serialisation has issues when performed on tables, so -> custom
List<String> datasetsStrL = allDatasets.parallelStream().map((datasetObj) -> { List<String> datasetsStrL = allDatasets.stream().map((datasetObj) -> {
try { try {
return objectMapper.writeValueAsString(datasetObj); return objectMapper.writeValueAsString(datasetObj);
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
e.printStackTrace();
return ""; return "";
} }
}).collect(Collectors.toList()); }).collect(Collectors.toList());
@ -123,6 +124,7 @@ public class Datasets {
return new ResponseEntity<Object>("["+String.join(",", datasetsStrL)+"]", HttpStatus.OK); return new ResponseEntity<Object>("["+String.join(",", datasetsStrL)+"]", HttpStatus.OK);
} }
catch(Exception ex) { catch(Exception ex) {
ex.printStackTrace();
return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR); return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR);
} }
@ -219,33 +221,5 @@ public class Datasets {
/*
@RequestMapping(method = RequestMethod.GET, value = { "/createEmptyDataset" })
public @ResponseBody ResponseEntity<Object> createEmptyDataset() {
Dataset dataset = new Dataset();
dataset.setLabel("");
try {
dataset = datasetDao.create(dataset);
}
catch(Exception e) {
e.printStackTrace();
try {
dataset = datasetDao.update(dataset);
}
catch(Exception ex) {
ex.printStackTrace();
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("FAILED: reason: "+e.getMessage());
}
}
return ResponseEntity.status(HttpStatus.CREATED).body("Created Dataset with id: " + dataset.getId());
}
*/
} }

View File

@ -84,25 +84,25 @@ public class Projects {
// MANAGE PROJECT(S) // MANAGE PROJECT(S)
@RequestMapping(method = RequestMethod.GET, value = { "/projects" }) @RequestMapping(method = RequestMethod.GET, value = { "/projects" }, produces="application/json")
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(objectMapper.writeValueAsString(allIDs)); return ResponseEntity.status(HttpStatus.OK).body(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());
} }
} }
@RequestMapping(method = RequestMethod.GET, value = { "/projects/{id}" }) @RequestMapping(method = RequestMethod.GET, value = { "/projects/{id}" }, produces="application/json")
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));
System.out.println(project.getId().toString()); System.out.println(project.getId().toString());
return ResponseEntity.status(HttpStatus.OK).body(objectMapper.writeValueAsString(project)); return ResponseEntity.status(HttpStatus.OK).body(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());
@ -110,11 +110,11 @@ public class Projects {
} }
@RequestMapping(method = RequestMethod.GET, value = { "/project/listAllLabelIDs" }) @RequestMapping(method = RequestMethod.GET, value = { "/project/listAllLabelIDs" }, produces="application/json")
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(objectMapper.writeValueAsString(allIDs)); return ResponseEntity.status(HttpStatus.OK).body(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());
@ -150,15 +150,11 @@ public class Projects {
@RequestMapping(method = RequestMethod.POST, value = { "/project/create" }, consumes = "application/json", produces="application/json") @RequestMapping(method = RequestMethod.POST, value = { "/project/create" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseEntity<Object> setProject(@RequestBody Project project) { public @ResponseBody ResponseEntity<Object> setProject(@RequestBody Project project) {
Project createdProject = projectDao.update(project); Project createdProject = projectDao.update(project);
try { return ResponseEntity.status(HttpStatus.CREATED).body(createdProject);
return ResponseEntity.status(HttpStatus.CREATED).body(objectMapper.writeValueAsString(createdProject));
} catch (JsonProcessingException e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not create Project!\"}");
}
} }
@RequestMapping(method = RequestMethod.POST, value = { "/project/delete" }, consumes = "application/json", produces="text/plain") @RequestMapping(method = RequestMethod.POST, value = { "/project/delete" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseEntity<Object> delete(@RequestBody Project project) { public @ResponseBody ResponseEntity<Object> delete(@RequestBody Project project) {
Project p = new Project(); Project p = new Project();

View File

@ -1,5 +1,6 @@
package rest.entities; package rest.entities;
import java.io.IOException;
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;
@ -70,7 +71,9 @@ public class Services {
@Autowired private ServiceDao serviceDao; @Autowired private ServiceDao serviceDao;
private ObjectMapper objectMapper = SerializerProvider.getJsonSerializer(); private ObjectMapper objectMapper =
SerializerProvider.getJsonSerializer();
// new ObjectMapper();
// MANAGE SERVICE(S) // MANAGE SERVICE(S)
@ -124,7 +127,16 @@ public class Services {
@Transactional @Transactional
@RequestMapping(method = RequestMethod.POST, value = { "/service/create" }, consumes = "application/json", produces="application/json") @RequestMapping(method = RequestMethod.POST, value = { "/service/create" }, consumes = "application/json", produces="application/json")
public @ResponseBody ResponseEntity<Object> setService(@RequestBody Service service) { public @ResponseBody ResponseEntity<Object> setService(@RequestBody String serviceSTR) {
System.out.println(serviceSTR);
Service service = null;
try {
service = objectMapper.readValue(serviceSTR, Service.class);
} catch (IOException e1) {
e1.printStackTrace();
}
Service createdService = serviceDao.update(service); Service createdService = serviceDao.update(service);
try { try {
return ResponseEntity.status(HttpStatus.CREATED).body(objectMapper.writeValueAsString(createdService)); return ResponseEntity.status(HttpStatus.CREATED).body(objectMapper.writeValueAsString(createdService));
@ -137,10 +149,10 @@ public class Services {
@RequestMapping(method = RequestMethod.POST, value = { "/service/delete" }, consumes = "application/json", produces="text/plain") @RequestMapping(method = RequestMethod.POST, value = { "/service/delete" }, consumes = "application/json", produces="text/plain")
public @ResponseBody ResponseEntity<Object> delete(@RequestBody Service service) { public @ResponseBody ResponseEntity<Object> delete(@RequestBody Service service) {
Service s = new Service(); System.out.println(service);
s.setId(service.getId());
try { try {
serviceDao.delete(s); serviceDao.delete(service);
return ResponseEntity.status(HttpStatus.CREATED).body("{\"msg\":\"Deleted Service entity!\"}"); return ResponseEntity.status(HttpStatus.CREATED).body("{\"msg\":\"Deleted Service entity!\"}");
} catch (Exception e) { } catch (Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not Delete Service entity!\"}"); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("{\"msg\":\"Could not Delete Service entity!\"}");

View File

@ -112,6 +112,7 @@
<context:component-scan base-package="dao" /> <context:component-scan base-package="dao" />
<context:component-scan base-package="core" /> <context:component-scan base-package="core" />
<context:component-scan base-package="rest" /> <context:component-scan base-package="rest" />
<context:component-scan base-package="configs" />
<!-- <context:component-scan base-package="controller" /> --> <!-- <context:component-scan base-package="controller" /> -->

View File

@ -1,18 +1,24 @@
import static org.junit.Assert.*; import static org.junit.Assert.*;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.UUID;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.mortbay.jetty.HttpStatus;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import dao.entities.DMPDao; import dao.entities.DMPDao;
import dao.entities.DMPProfileDao; import dao.entities.DMPProfileDao;
@ -30,11 +36,13 @@ import dao.entities.UserInfoDao;
import entities.DatasetProfile; import entities.DatasetProfile;
import entities.DatasetProfileRuleset; import entities.DatasetProfileRuleset;
import entities.DatasetProfileViewstyle; import entities.DatasetProfileViewstyle;
import entities.Service;
import helpers.SerializerProvider; import helpers.SerializerProvider;
import rest.entities.DMPs; import rest.entities.DMPs;
import rest.entities.DatasetProfiles; import rest.entities.DatasetProfiles;
import rest.entities.Datasets; import rest.entities.Datasets;
import rest.entities.Projects; import rest.entities.Projects;
import rest.entities.Services;
@ComponentScan(basePackages = "dao, entities, controller, login, proxy, rest") @ComponentScan(basePackages = "dao, entities, controller, login, proxy, rest")
public class TestRest { public class TestRest {
@ -53,7 +61,8 @@ public class TestRest {
@Autowired private ServiceDao serviceDao; @Autowired private ServiceDao serviceDao;
@Autowired private UserInfoDao userInfoDao; @Autowired private UserInfoDao userInfoDao;
private static ObjectMapper objectMapper = SerializerProvider.getJsonSerializer();
Gson gson = new Gson();
private static String userID = "0f51f686-a2ce-47c1-9433-00736787aa88"; private static String userID = "0f51f686-a2ce-47c1-9433-00736787aa88";
@ -63,6 +72,7 @@ public class TestRest {
private Datasets datasetsService; private Datasets datasetsService;
private DatasetProfiles datasetProfilesService; private DatasetProfiles datasetProfilesService;
private DMPs dmpsService; private DMPs dmpsService;
private Services servicesService;
@Before @Before
@ -76,11 +86,11 @@ public class TestRest {
datasetsService = context.getBean(Datasets.class); datasetsService = context.getBean(Datasets.class);
datasetProfilesService = context.getBean(DatasetProfiles.class); datasetProfilesService = context.getBean(DatasetProfiles.class);
dmpsService = context.getBean(DMPs.class); dmpsService = context.getBean(DMPs.class);
servicesService = context.getBean(Services.class);
} }
@Test // @Test
public void testDatasetProfile() { public void testDatasetProfile() {
// DatasetProfile datasetProfile = new DatasetProfile(); // DatasetProfile datasetProfile = new DatasetProfile();
// datasetProfile.setLabel("Sample-Dataset-Profile"); // datasetProfile.setLabel("Sample-Dataset-Profile");
@ -95,25 +105,58 @@ public class TestRest {
// dpv.setLabel("Sample-Dataset-Profile viewstyle"); // dpv.setLabel("Sample-Dataset-Profile viewstyle");
// dpv.setDefinition("dpv definition"); // dpv.setDefinition("dpv definition");
// datasetProfile.setViewstyle(dpv); // datasetProfile.setViewstyle(dpv);
//
// datasetProfilesService.createDatasetProfile(datasetProfile);
// String profJSON = (String)datasetProfilesService.createDatasetProfile(datasetProfile).getBody(); //
// DatasetProfile prof = null; // assertNotNull(datasetProfile.getId());
try {
// prof = objectMapper.readValue(profJSON, DatasetProfile.class);
// assertNotNull(prof.getId());
}
catch(Exception ex) {
}
// assertNotNull(prof);
} }
// @Test
public void testDatasetProfile2() {
// DatasetProfile datasetProfile = new DatasetProfile();
// datasetProfile.setLabel("Sample-Dataset-Profile-222");
// datasetProfile.setDefinition("Sample-Dataset-Profile-222 definition");
//
// DatasetProfileRuleset dpr = new DatasetProfileRuleset();
// dpr.setLabel("Sample-Dataset-Profile-222 ruleset");
// dpr.setDefinition("dpr definition");
// datasetProfile.setRuleset(dpr);
//
// DatasetProfileViewstyle dpv = new DatasetProfileViewstyle();
// dpv.setLabel("Sample-Dataset-Profile-222 viewstyle");
// dpv.setDefinition("dpv definition");
// datasetProfile.setViewstyle(dpv);
//
// ResponseEntity<Object> createResp = datasetProfilesService.createDatasetProfile(datasetProfile);
// assertEquals(201, createResp.getStatusCodeValue());
//
// datasetProfile.setLabel("SAMPLE-DATASET-PROFILE-222");
// dpr.setLabel("SAMPLE-DATASET-PROFILE-222");
// dpv.setLabel("SAMPLE-DATASET-PROFILE-222");
//
// ResponseEntity<Object> updResp = datasetProfilesService.updateDatasetProfile(datasetProfile);
// assertEquals(201, updResp.getStatusCodeValue());
//
// ResponseEntity<Object> delResp = datasetProfilesService.deleteDatasetProfile(datasetProfile);
// assertEquals(200, delResp.getStatusCodeValue());
}
// @Test
public void testServiceService() {
Service service = new Service();
service.setId(UUID.fromString("37acad15-39a1-46f3-a6f3-1bf0eaefaadc"));
ResponseEntity<Object> delResp = servicesService.delete(service);
assertEquals(201, delResp.getStatusCodeValue());
}
@Test // @Test
public void testProject() { public void testProject() {
System.out.println(projectsService.listProjects().getBody()); System.out.println(projectsService.listProjects().getBody());

View File

@ -129,6 +129,9 @@ CREATE TABLE "DatasetProfile" (
"Definition" xml NOT NULL "Definition" xml NOT NULL
); );
-- SHould also force the 1-1 relation between the datasetprofile <-> ruleset and datasetprofile <-> viewstyle
ALTER TABLE "DatasetProfile" ADD CONSTRAINT datasetprofile_unique_ruleset UNIQUE ("Ruleset");
ALTER TABLE "DatasetProfile" ADD CONSTRAINT datasetprofile_unique_viewstyle UNIQUE ("Viewstyle");
ALTER TABLE "DatasetProfile" OWNER TO dmptool; ALTER TABLE "DatasetProfile" OWNER TO dmptool;