Initial import of DMP project modules.
1) dmp-backend : spring-hibernate webservice which allows dmp data storing and fetching from a relational database. 2) dmp-javascript-engine: a simple wrapper for java's nashorn javascript engine. 3) dmp-frontend: an angular based frontend app to serve dynamic questionnaires to aid the formation of Digital Management Plans
This commit is contained in:
commit
9f8b4a3cce
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
|
@ -0,0 +1 @@
|
|||
/target/
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>dmp-backend</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/webapp"/>
|
||||
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="target/m2e-wtp/web-resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
|
||||
<attributes>
|
||||
<attribute name="hide" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
|
||||
<classpathentry kind="output" path=""/>
|
||||
</classpath>
|
|
@ -0,0 +1,3 @@
|
|||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding//src/test/java=UTF-8
|
|
@ -0,0 +1,8 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
|
@ -0,0 +1,3 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jpt.core.platform=generic2_1
|
||||
org.eclipse.jpt.jpa.core.discoverAnnotatedClasses=true
|
|
@ -0,0 +1,4 @@
|
|||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="dmp-backend">
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
<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/resources"/>
|
||||
<property name="java-output-path" value="/dmp-backend/target/classes"/>
|
||||
<property name="context-root" value="dmp-backend"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
|
@ -0,0 +1,7 @@
|
|||
<root>
|
||||
<facet id="jpt.jpa">
|
||||
<node name="libprov">
|
||||
<attribute name="provider-id" value="jpa-no-op-library-provider"/>
|
||||
</node>
|
||||
</facet>
|
||||
</root>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<fixed facet="wst.jsdt.web"/>
|
||||
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||
<installed facet="java" version="1.8"/>
|
||||
<installed facet="jst.web" version="3.0"/>
|
||||
<installed facet="jpt.jpa" version="2.1"/>
|
||||
</faceted-project>
|
|
@ -0,0 +1 @@
|
|||
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
|
|
@ -0,0 +1 @@
|
|||
Window
|
|
@ -0,0 +1,2 @@
|
|||
disabled=06target
|
||||
eclipse.preferences.version=1
|
|
@ -0,0 +1,5 @@
|
|||
Manifest-Version: 1.0
|
||||
Built-By: nikolas
|
||||
Build-Jdk: 1.8.0_91
|
||||
Created-By: Maven Integration for Eclipse
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#Generated by Maven Integration for Eclipse
|
||||
#Thu Sep 14 13:20:15 EEST 2017
|
||||
version=0.0.1-SNAPSHOT
|
||||
groupId=dmp-backend
|
||||
m2e.projectName=dmp-backend
|
||||
m2e.projectLocation=/home/nikolas/git/OpenAIRE-EUDAT-DMP-service-pilot/dmp-backend
|
||||
artifactId=dmp-backend
|
|
@ -0,0 +1,254 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>dmp-backend</groupId>
|
||||
<artifactId>dmp-backend</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
|
||||
|
||||
<properties>
|
||||
<dmp-backend-commons.version>0.0.1-SNAPSHOT</dmp-backend-commons.version>
|
||||
<org.springframework.version>4.3.8.RELEASE</org.springframework.version>
|
||||
<com.sun.jersey.version>1.19.1</com.sun.jersey.version>
|
||||
<org.apache.tomcat.tomcat-jdbc.version>7.0.35</org.apache.tomcat.tomcat-jdbc.version>
|
||||
<hibernate.version>5.2.9.Final</hibernate.version>
|
||||
<commons-codec.version>1.9</commons-codec.version>
|
||||
<org.junit.version>4.11</org.junit.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<slf4j.version>1.7.12</slf4j.version>
|
||||
<jetty.version>9.0.7.v20131107</jetty.version> <!-- Adapt this to a version found on http://repo.maven.apache.org/maven2/org/eclipse/jetty/jetty-maven-plugin/ -->
|
||||
<logback.version>1.1.1</logback.version>
|
||||
<javax.inject.version>1</javax.inject.version>
|
||||
<javax.servlet.servlet-api.version>3.0.1</javax.servlet.servlet-api.version>
|
||||
<!-- <jcloverslf4j.version>1.7.6</jcloverslf4j.version> -->
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
||||
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>dmp-backend</groupId> -->
|
||||
<!-- <artifactId>dmp-backend-commons</artifactId> -->
|
||||
<!-- <version>${dmp-backend-commons.version}</version> -->
|
||||
<!-- </dependency> -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
<version>${hibernate.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-c3p0</artifactId>
|
||||
<version>${hibernate.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- g/a spring -->
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>${javax.servlet.servlet-api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- MY SPRING -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-orm</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Security -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-core</artifactId>
|
||||
<version>4.2.3.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-web</artifactId>
|
||||
<version>4.2.3.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-config</artifactId>
|
||||
<version>4.2.3.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>jstl</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>1.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Jackson core and databind -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>2.8.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>2.8.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.8.4</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Json <-> XML transformations -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20160810</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- tomcat jdbc -->
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat</groupId>
|
||||
<artifactId>tomcat-jdbc</artifactId>
|
||||
<version>${org.apache.tomcat.tomcat-jdbc.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${org.junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- PostGreSql base libs dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>9.4.1212</version>
|
||||
</dependency>
|
||||
|
||||
<!-- LogBack dependencies -->
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>${commons-codec.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Various libs -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.5</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.10</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>analyze</id>
|
||||
<goals>
|
||||
<goal>analyze-only</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<failOnWarning>false</failOnWarning>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
|
||||
</build>
|
||||
</project>
|
1
dmp-backend/home/nikolas/workspace-dmp/dmp-backend/target/m2e-wtp/web-resources/.gitignore
vendored
Normal file
1
dmp-backend/home/nikolas/workspace-dmp/dmp-backend/target/m2e-wtp/web-resources/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/META-INF/
|
|
@ -0,0 +1,254 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>dmp-backend</groupId>
|
||||
<artifactId>dmp-backend</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
|
||||
|
||||
<properties>
|
||||
<dmp-backend-commons.version>0.0.1-SNAPSHOT</dmp-backend-commons.version>
|
||||
<org.springframework.version>4.3.8.RELEASE</org.springframework.version>
|
||||
<com.sun.jersey.version>1.19.1</com.sun.jersey.version>
|
||||
<org.apache.tomcat.tomcat-jdbc.version>7.0.35</org.apache.tomcat.tomcat-jdbc.version>
|
||||
<hibernate.version>5.2.9.Final</hibernate.version>
|
||||
<commons-codec.version>1.9</commons-codec.version>
|
||||
<org.junit.version>4.11</org.junit.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<slf4j.version>1.7.12</slf4j.version>
|
||||
<jetty.version>9.0.7.v20131107</jetty.version> <!-- Adapt this to a version found on http://repo.maven.apache.org/maven2/org/eclipse/jetty/jetty-maven-plugin/ -->
|
||||
<logback.version>1.1.1</logback.version>
|
||||
<javax.inject.version>1</javax.inject.version>
|
||||
<javax.servlet.servlet-api.version>3.0.1</javax.servlet.servlet-api.version>
|
||||
<!-- <jcloverslf4j.version>1.7.6</jcloverslf4j.version> -->
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
||||
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>dmp-backend</groupId> -->
|
||||
<!-- <artifactId>dmp-backend-commons</artifactId> -->
|
||||
<!-- <version>${dmp-backend-commons.version}</version> -->
|
||||
<!-- </dependency> -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
<version>${hibernate.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-c3p0</artifactId>
|
||||
<version>${hibernate.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- g/a spring -->
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>${javax.servlet.servlet-api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- MY SPRING -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-orm</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Security -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-core</artifactId>
|
||||
<version>4.2.3.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-web</artifactId>
|
||||
<version>4.2.3.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-config</artifactId>
|
||||
<version>4.2.3.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>jstl</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>1.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Jackson core and databind -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>2.8.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>2.8.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.8.4</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Json <-> XML transformations -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20160810</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- tomcat jdbc -->
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat</groupId>
|
||||
<artifactId>tomcat-jdbc</artifactId>
|
||||
<version>${org.apache.tomcat.tomcat-jdbc.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${org.junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- PostGreSql base libs dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>9.4.1212</version>
|
||||
</dependency>
|
||||
|
||||
<!-- LogBack dependencies -->
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>${commons-codec.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Various libs -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.5</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.10</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>analyze</id>
|
||||
<goals>
|
||||
<goal>analyze-only</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<failOnWarning>false</failOnWarning>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,35 @@
|
|||
package controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import dao.entities.DMPDao;
|
||||
import entities.DMP;
|
||||
|
||||
|
||||
@Controller
|
||||
public class UIController {
|
||||
|
||||
@Autowired private DMPDao dMPDao;
|
||||
|
||||
@RequestMapping(value = "/home", method = RequestMethod.GET)
|
||||
public String printWelcome(ModelMap model) {
|
||||
model.addAttribute("DMPs", dMPDao.getAll());
|
||||
return "home";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package dao;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public interface Dao<T, PK extends Serializable> {
|
||||
public T create(T t);
|
||||
public T read(PK id);
|
||||
public T update(T t);
|
||||
public void delete(T t);
|
||||
|
||||
public List<T> getAll();
|
||||
public long count();
|
||||
|
||||
public T loadDetails(T t);
|
||||
public boolean isLoaded(T t);
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package dao;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public interface DaoFactory
|
||||
{
|
||||
public Dao getDao(Class<?> type) throws Exception;
|
||||
public void overrideMappings(Map<String, String> mappings) throws Exception;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package dao;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface DaoI<T, Id extends Serializable> {
|
||||
public void persist(T entity);
|
||||
|
||||
public void update(T entity);
|
||||
|
||||
public T findById(Id id);
|
||||
|
||||
public void delete(T entity);
|
||||
|
||||
public List<T> findAll();
|
||||
|
||||
public void deleteAll();
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package dao;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.PersistenceUnitUtil;
|
||||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
public abstract class JpaDao<T, PK extends Serializable> implements Dao<T, PK> {
|
||||
protected Class<T> entityClass;
|
||||
|
||||
// protected static EntityManagerFactory entityManagerFactory = null;
|
||||
|
||||
@PersistenceContext
|
||||
protected EntityManager entityManager;
|
||||
|
||||
protected PersistenceUnitUtil persistenceUnitUtil;
|
||||
|
||||
// public static void setEntityManagerFactory(EntityManagerFactory factory)
|
||||
// {
|
||||
// entityManagerFactory = factory;
|
||||
// }
|
||||
|
||||
public JpaDao() {
|
||||
ParameterizedType genericSuperclass = (ParameterizedType) getClass().getGenericSuperclass();
|
||||
this.entityClass = (Class<T>) genericSuperclass.getActualTypeArguments()[0];
|
||||
// entityManager = entityManagerFactory.createEntityManager();
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void initPersistenceUnitUtil() {
|
||||
this.persistenceUnitUtil = entityManager.getEntityManagerFactory().getPersistenceUnitUtil();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public T create(T t) {
|
||||
entityManager.persist(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public T read(PK id) {
|
||||
return entityManager.find(entityClass, id);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public T update(T t) {
|
||||
return entityManager.merge(t);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void delete(T t) {
|
||||
t = entityManager.merge(t);
|
||||
entityManager.remove(t);
|
||||
}
|
||||
|
||||
public List<T> getAll() {
|
||||
List<T> result = entityManager.createQuery("from " + entityClass.getSimpleName(), entityClass).getResultList();
|
||||
return result == null ? new ArrayList<T>() : result;
|
||||
}
|
||||
|
||||
public long count() {
|
||||
return ((Number) entityManager.createQuery("select count(e) from " + entityClass.getSimpleName() + " e").getSingleResult()).longValue();
|
||||
}
|
||||
|
||||
public boolean isLoaded(T t) {
|
||||
return persistenceUnitUtil.isLoaded(t);
|
||||
}
|
||||
|
||||
protected boolean isFieldLoaded(T t, String fieldName) {
|
||||
return persistenceUnitUtil.isLoaded(t, fieldName);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
package dao;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import dao.entities.DMPDaoImpl;
|
||||
import dao.entities.DMPProfileDaoImpl;
|
||||
import dao.entities.DMPResearcherDaoImpl;
|
||||
import dao.entities.DataRepositoryDaoImpl;
|
||||
import dao.entities.DatasetDaoImpl;
|
||||
import dao.entities.DatasetProfileDaoImpl;
|
||||
import dao.entities.DatasetProfileRulesetDaoImpl;
|
||||
import dao.entities.DatasetProfileViewstyleDaoImpl;
|
||||
import dao.entities.DatasetRegistryDaoImpl;
|
||||
import dao.entities.DatasetServiceDaoImpl;
|
||||
import dao.entities.OrganisationDaoImpl;
|
||||
import dao.entities.ProjectDaoImpl;
|
||||
import dao.entities.RegistryDaoImpl;
|
||||
import dao.entities.ResearcherDaoImpl;
|
||||
import dao.entities.ServiceDaoImpl;
|
||||
import entities.DMP;
|
||||
import entities.DMPProfile;
|
||||
import entities.DMPResearcher;
|
||||
import entities.DataRepository;
|
||||
import entities.Dataset;
|
||||
import entities.DatasetProfile;
|
||||
import entities.DatasetProfileRuleset;
|
||||
import entities.DatasetProfileViewstyle;
|
||||
import entities.DatasetRegistry;
|
||||
import entities.DatasetService;
|
||||
import entities.Organisation;
|
||||
import entities.Project;
|
||||
import entities.Registry;
|
||||
import entities.Researcher;
|
||||
import entities.Service;
|
||||
|
||||
|
||||
/**
|
||||
* A DAO factory for non-managed environments
|
||||
*/
|
||||
public class JpaDaoFactory implements DaoFactory
|
||||
{
|
||||
private static String persistenceUnit = null;
|
||||
private static Map<String, String> daoImpls = null;
|
||||
|
||||
public static void setPersistenceContext(String persistenceUnit)
|
||||
{
|
||||
JpaDaoFactory.persistenceUnit = persistenceUnit;
|
||||
}
|
||||
|
||||
private static void populateMappings()
|
||||
{
|
||||
daoImpls = new HashMap<String, String>();
|
||||
daoImpls.put(Organisation.class.getName(), OrganisationDaoImpl.class.getName());
|
||||
daoImpls.put(DataRepository.class.getName(), (DataRepositoryDaoImpl.class.getName()));
|
||||
daoImpls.put(Dataset.class.getName(), (DatasetDaoImpl.class.getName()));
|
||||
daoImpls.put(DatasetProfile.class.getName(), (DatasetProfileDaoImpl.class.getName()));
|
||||
daoImpls.put(DatasetProfileRuleset.class.getName(), (DatasetProfileRulesetDaoImpl.class.getName()));
|
||||
daoImpls.put(DatasetProfileViewstyle.class.getName(), (DatasetProfileViewstyleDaoImpl.class.getName()));
|
||||
daoImpls.put(DatasetRegistry.class.getName(), (DatasetRegistryDaoImpl.class.getName()));
|
||||
daoImpls.put(DatasetService.class.getName(), (DatasetServiceDaoImpl.class.getName()));
|
||||
daoImpls.put(DMP.class.getName(), (DMPDaoImpl.class.getName()));
|
||||
daoImpls.put(DMPProfile.class.getName(), (DMPProfileDaoImpl.class.getName()));
|
||||
daoImpls.put(DMPResearcher.class.getName(), (DMPResearcherDaoImpl.class.getName()));
|
||||
daoImpls.put(Organisation.class.getName(), (OrganisationDaoImpl.class.getName()));
|
||||
daoImpls.put(Project.class.getName(), (ProjectDaoImpl.class.getName()));
|
||||
daoImpls.put(Registry.class.getName(), (RegistryDaoImpl.class.getName()));
|
||||
daoImpls.put(Researcher.class.getName(), (ResearcherDaoImpl.class.getName()));
|
||||
daoImpls.put(Service.class.getName(), (ServiceDaoImpl.class.getName()));
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Dao getDao(Class<?> type) throws Exception
|
||||
{
|
||||
if(daoImpls == null) populateMappings();
|
||||
return (Dao)Class.forName(daoImpls.get(type.getName())).newInstance();
|
||||
}
|
||||
|
||||
public void overrideMappings(Map<String, String> mappings)
|
||||
{
|
||||
populateMappings();
|
||||
daoImpls.putAll(mappings);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
package dao;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
|
||||
import dao.entities.DMPDaoImpl;
|
||||
import dao.entities.DMPProfileDaoImpl;
|
||||
import dao.entities.DMPResearcherDaoImpl;
|
||||
import dao.entities.DataRepositoryDaoImpl;
|
||||
import dao.entities.DatasetDaoImpl;
|
||||
import dao.entities.DatasetProfileDaoImpl;
|
||||
import dao.entities.DatasetProfileRulesetDaoImpl;
|
||||
import dao.entities.DatasetProfileViewstyleDaoImpl;
|
||||
import dao.entities.DatasetRegistryDaoImpl;
|
||||
import dao.entities.DatasetServiceDaoImpl;
|
||||
import dao.entities.OrganisationDaoImpl;
|
||||
import dao.entities.ProjectDaoImpl;
|
||||
import dao.entities.RegistryDaoImpl;
|
||||
import dao.entities.ResearcherDaoImpl;
|
||||
import dao.entities.ServiceDaoImpl;
|
||||
import entities.DMP;
|
||||
import entities.DMPProfile;
|
||||
import entities.DMPResearcher;
|
||||
import entities.DataRepository;
|
||||
import entities.Dataset;
|
||||
import entities.DatasetProfile;
|
||||
import entities.DatasetProfileRuleset;
|
||||
import entities.DatasetProfileViewstyle;
|
||||
import entities.DatasetRegistry;
|
||||
import entities.DatasetService;
|
||||
import entities.Organisation;
|
||||
import entities.Project;
|
||||
import entities.Registry;
|
||||
import entities.Researcher;
|
||||
import entities.Service;
|
||||
|
||||
|
||||
/**
|
||||
* A DAO factory for Spring managed environment
|
||||
*/
|
||||
public class SpringJpaDaoFactory implements DaoFactory
|
||||
{
|
||||
public static class SpringApplicationContext implements ApplicationContextAware {
|
||||
|
||||
private static ApplicationContext CONTEXT;
|
||||
|
||||
/**
|
||||
* This method is called from within the ApplicationContext once it is
|
||||
* done starting up, it will stick a reference to itself into this bean.
|
||||
* @param context a reference to the ApplicationContext.
|
||||
*/
|
||||
public void setApplicationContext(ApplicationContext context) throws BeansException {
|
||||
CONTEXT = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is about the same as context.getBean("beanName"), except it has its
|
||||
* own static handle to the Spring context, so calling this method statically
|
||||
* will give access to the beans by name in the Spring application context.
|
||||
* As in the context.getBean("beanName") call, the caller must cast to the
|
||||
* appropriate target class. If the bean does not exist, then a Runtime error
|
||||
* will be thrown.
|
||||
* @param beanName the name of the bean to get.
|
||||
* @return an Object reference to the named bean.
|
||||
*/
|
||||
public static Object getBean(String beanName) {
|
||||
return CONTEXT.getBean(beanName);
|
||||
}
|
||||
}
|
||||
|
||||
private static String persistenceUnit = null;
|
||||
private static Map<String, String> daoImpls = null;
|
||||
|
||||
public static void setPersistenceContext(String persistenceUnit)
|
||||
{
|
||||
SpringJpaDaoFactory.persistenceUnit = persistenceUnit;
|
||||
}
|
||||
|
||||
private static String getBeanName(String className)
|
||||
{
|
||||
return Character.toLowerCase(className.charAt(0)) +
|
||||
(className.length() > 1 ? className.substring(1) : "");
|
||||
}
|
||||
private static void populateMappings()
|
||||
{
|
||||
daoImpls = new HashMap<String, String>();
|
||||
daoImpls.put(DataRepository.class.getName(), getBeanName(DataRepositoryDaoImpl.class.getSimpleName()));
|
||||
daoImpls.put(Dataset.class.getName(), getBeanName(DatasetDaoImpl.class.getSimpleName()));
|
||||
daoImpls.put(DatasetProfile.class.getName(), getBeanName(DatasetProfileDaoImpl.class.getSimpleName()));
|
||||
daoImpls.put(DatasetProfileRuleset.class.getName(), getBeanName(DatasetProfileRulesetDaoImpl.class.getSimpleName()));
|
||||
daoImpls.put(DatasetProfileViewstyle.class.getName(), getBeanName(DatasetProfileViewstyleDaoImpl.class.getSimpleName()));
|
||||
daoImpls.put(DatasetRegistry.class.getName(), getBeanName(DatasetRegistryDaoImpl.class.getSimpleName()));
|
||||
daoImpls.put(DatasetService.class.getName(), getBeanName(DatasetServiceDaoImpl.class.getSimpleName()));
|
||||
daoImpls.put(DMP.class.getName(), getBeanName(DMPDaoImpl.class.getSimpleName()));
|
||||
daoImpls.put(DMPProfile.class.getName(), getBeanName(DMPProfileDaoImpl.class.getSimpleName()));
|
||||
daoImpls.put(DMPResearcher.class.getName(), getBeanName(DMPResearcherDaoImpl.class.getSimpleName()));
|
||||
daoImpls.put(Organisation.class.getName(), getBeanName(OrganisationDaoImpl.class.getSimpleName()));
|
||||
daoImpls.put(Project.class.getName(), getBeanName(ProjectDaoImpl.class.getSimpleName()));
|
||||
daoImpls.put(Registry.class.getName(), getBeanName(RegistryDaoImpl.class.getSimpleName()));
|
||||
daoImpls.put(Researcher.class.getName(), getBeanName(ResearcherDaoImpl.class.getSimpleName()));
|
||||
daoImpls.put(Service.class.getName(), getBeanName(ServiceDaoImpl.class.getSimpleName()));
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Dao getDao(Class<?> type) throws Exception
|
||||
{
|
||||
if(daoImpls == null) populateMappings();
|
||||
return (Dao)SpringApplicationContext.getBean(daoImpls.get(type.getName()));
|
||||
}
|
||||
|
||||
public void overrideMappings(Map<String, String> mappings)
|
||||
{
|
||||
populateMappings();
|
||||
daoImpls.putAll(mappings);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import dao.Dao;
|
||||
import entities.DMP;
|
||||
import entities.Organisation;
|
||||
|
||||
public interface DMPDao extends Dao<DMP, UUID> {
|
||||
|
||||
public List<UUID> listAllIDs();
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.TypedQuery;
|
||||
|
||||
import dao.JpaDao;
|
||||
import entities.DMP;
|
||||
|
||||
public class DMPDaoImpl extends JpaDao<DMP, UUID> implements DMPDao {
|
||||
|
||||
public DMP loadDetails(DMP t) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UUID> listAllIDs() {
|
||||
String queryString = "SELECT dmp.id FROM DMP dmp";
|
||||
TypedQuery<UUID> typedQuery = entityManager.createQuery(queryString, UUID.class);
|
||||
return typedQuery.getResultList();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import dao.Dao;
|
||||
import entities.DMPProfile;
|
||||
|
||||
public interface DMPProfileDao extends Dao<DMPProfile, UUID> {
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
import dao.JpaDao;
|
||||
import entities.DMPProfile;
|
||||
|
||||
public class DMPProfileDaoImpl extends JpaDao<DMPProfile, UUID> implements DMPProfileDao {
|
||||
|
||||
public DMPProfile loadDetails(DMPProfile t) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import dao.Dao;
|
||||
import entities.DMPResearcher;
|
||||
|
||||
public interface DMPResearcherDao extends Dao<DMPResearcher, UUID> {
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
import dao.JpaDao;
|
||||
import entities.DMPResearcher;
|
||||
|
||||
public class DMPResearcherDaoImpl extends JpaDao<DMPResearcher, UUID> implements DMPResearcherDao {
|
||||
|
||||
public DMPResearcher loadDetails(DMPResearcher t) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import dao.Dao;
|
||||
import entities.DataRepository;
|
||||
|
||||
public interface DataRepositoryDao extends Dao<DataRepository, UUID> {
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
import dao.JpaDao;
|
||||
import entities.DataRepository;
|
||||
|
||||
public class DataRepositoryDaoImpl extends JpaDao<DataRepository, UUID> implements DataRepositoryDao {
|
||||
|
||||
public DataRepository loadDetails(DataRepository t) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import dao.Dao;
|
||||
import entities.Dataset;
|
||||
|
||||
public interface DatasetDao extends Dao<Dataset, UUID> {
|
||||
|
||||
|
||||
public List<UUID> listAllIDs();
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.TypedQuery;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import dao.JpaDao;
|
||||
import entities.Dataset;
|
||||
|
||||
public class DatasetDaoImpl extends JpaDao<Dataset, UUID> implements DatasetDao {
|
||||
|
||||
public Dataset loadDetails(Dataset t) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UUID> listAllIDs() {
|
||||
String queryString = "SELECT dataset.id FROM Dataset dataset";
|
||||
TypedQuery<UUID> typedQuery = entityManager.createQuery(queryString, UUID.class);
|
||||
return typedQuery.getResultList();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import dao.Dao;
|
||||
import entities.DatasetProfile;
|
||||
|
||||
public interface DatasetProfileDao extends Dao<DatasetProfile, UUID> {
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
import dao.JpaDao;
|
||||
import entities.DatasetProfile;
|
||||
|
||||
public class DatasetProfileDaoImpl extends JpaDao<DatasetProfile, UUID> implements DatasetProfileDao {
|
||||
|
||||
|
||||
public DatasetProfile loadDetails(DatasetProfile t) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import dao.Dao;
|
||||
import entities.DatasetProfileRuleset;
|
||||
|
||||
public interface DatasetProfileRulesetDao extends Dao<DatasetProfileRuleset, UUID> {
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
import dao.JpaDao;
|
||||
import entities.DatasetProfileRuleset;
|
||||
|
||||
public class DatasetProfileRulesetDaoImpl extends JpaDao<DatasetProfileRuleset, UUID> implements DatasetProfileRulesetDao {
|
||||
|
||||
public DatasetProfileRuleset loadDetails(DatasetProfileRuleset t) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import dao.Dao;
|
||||
import entities.DatasetProfileViewstyle;
|
||||
|
||||
public interface DatasetProfileViewstyleDao extends Dao<DatasetProfileViewstyle, UUID> {
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
import dao.JpaDao;
|
||||
import entities.DatasetProfileViewstyle;
|
||||
|
||||
public class DatasetProfileViewstyleDaoImpl extends JpaDao<DatasetProfileViewstyle, UUID> implements DatasetProfileViewstyleDao {
|
||||
|
||||
public DatasetProfileViewstyle loadDetails(DatasetProfileViewstyle t) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import dao.Dao;
|
||||
import entities.DatasetRegistry;
|
||||
|
||||
public interface DatasetRegistryDao extends Dao<DatasetRegistry, UUID> {
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
import dao.JpaDao;
|
||||
import entities.DatasetRegistry;
|
||||
|
||||
public class DatasetRegistryDaoImpl extends JpaDao<DatasetRegistry, UUID> implements DatasetRegistryDao {
|
||||
|
||||
public DatasetRegistry loadDetails(DatasetRegistry t) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import dao.Dao;
|
||||
import entities.DatasetService;
|
||||
|
||||
public interface DatasetServiceDao extends Dao<DatasetService, UUID> {
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
import dao.JpaDao;
|
||||
import entities.DatasetService;
|
||||
|
||||
public class DatasetServiceDaoImpl extends JpaDao<DatasetService, UUID> implements DatasetServiceDao {
|
||||
|
||||
public DatasetService loadDetails(DatasetService t) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import dao.Dao;
|
||||
import entities.Organisation;
|
||||
|
||||
public interface OrganisationDao extends Dao<Organisation, UUID> {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.Query;
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
|
||||
import dao.JpaDao;
|
||||
import entities.Organisation;
|
||||
|
||||
public class OrganisationDaoImpl extends JpaDao<Organisation, UUID> implements OrganisationDao {
|
||||
|
||||
public Organisation loadDetails(Organisation t) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import dao.Dao;
|
||||
import entities.Project;
|
||||
|
||||
public interface ProjectDao extends Dao<Project, UUID> {
|
||||
|
||||
public List<UUID> listAllIDs();
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.TypedQuery;
|
||||
|
||||
import dao.JpaDao;
|
||||
import entities.Project;
|
||||
|
||||
public class ProjectDaoImpl extends JpaDao<Project, UUID> implements ProjectDao {
|
||||
|
||||
public Project loadDetails(Project t) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UUID> listAllIDs() {
|
||||
String queryString = "SELECT project.id FROM Project project";
|
||||
TypedQuery<UUID> typedQuery = entityManager.createQuery(queryString, UUID.class);
|
||||
return typedQuery.getResultList();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import dao.Dao;
|
||||
import entities.Registry;
|
||||
|
||||
public interface RegistryDao extends Dao<Registry, UUID> {
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
import dao.JpaDao;
|
||||
import entities.Registry;
|
||||
|
||||
public class RegistryDaoImpl extends JpaDao<Registry, UUID> implements RegistryDao {
|
||||
|
||||
public Registry loadDetails(Registry t) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import dao.Dao;
|
||||
import entities.Researcher;
|
||||
|
||||
public interface ResearcherDao extends Dao<Researcher, UUID> {
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
import dao.JpaDao;
|
||||
import entities.Researcher;
|
||||
|
||||
public class ResearcherDaoImpl extends JpaDao<Researcher, UUID> implements ResearcherDao {
|
||||
|
||||
public Researcher loadDetails(Researcher t) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import dao.Dao;
|
||||
import entities.Service;
|
||||
|
||||
public interface ServiceDao extends Dao<Service, UUID> {
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
import dao.JpaDao;
|
||||
import entities.Service;
|
||||
|
||||
public class ServiceDaoImpl extends JpaDao<Service, UUID> implements ServiceDao {
|
||||
|
||||
public Service loadDetails(Service t) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,182 @@
|
|||
package entities;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Cascade;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name="\"DMP\"")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||
public class DMP implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = -8263056535208547615L;
|
||||
|
||||
public DMP () {}
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@Type(type="org.hibernate.type.PostgresUUIDType")
|
||||
@Column(name = "\"Previous\"")
|
||||
private UUID previous;
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
@Column(name = "\"Version\"")
|
||||
private Integer version;
|
||||
|
||||
@OneToOne(mappedBy = "dmp", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
private Dataset dataset;
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
|
||||
// @Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
||||
@JoinColumn(name = "\"Project\"")
|
||||
private Project project;
|
||||
|
||||
|
||||
@Type(type="typedefinition.XMLType")
|
||||
@Column(name = "\"ProfileData\"", columnDefinition = "xml", nullable = true)
|
||||
private String profileData;
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
|
||||
// @Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
||||
@JoinColumn(name = "\"Profile\"")
|
||||
private DMPProfile profile;
|
||||
|
||||
|
||||
@OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
|
||||
@JoinTable(name="\"DMPOrganisation\"",
|
||||
joinColumns={@JoinColumn(name="\"DMP\"", referencedColumnName="\"ID\"")},
|
||||
inverseJoinColumns={@JoinColumn(name="\"Organisation\"", referencedColumnName="\"ID\"")}
|
||||
)
|
||||
private Set<Organisation> organisations;
|
||||
|
||||
|
||||
@OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
|
||||
@JoinTable(name="\"DMPResearcher\"",
|
||||
joinColumns={@JoinColumn(name="\"DMP\"", referencedColumnName="\"ID\"")},
|
||||
inverseJoinColumns={@JoinColumn(name="\"Researcher\"", referencedColumnName="\"ID\"")}
|
||||
)
|
||||
private Set<Researcher> researchers;
|
||||
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public UUID getPrevious() {
|
||||
return previous;
|
||||
}
|
||||
|
||||
public void setPrevious(UUID previous) {
|
||||
this.previous = previous;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public Integer getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(Integer version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public String getProfileData() {
|
||||
return profileData;
|
||||
}
|
||||
|
||||
public void setProfileData(String profileData) {
|
||||
this.profileData = profileData;
|
||||
}
|
||||
|
||||
public DMPProfile getProfile() {
|
||||
return profile;
|
||||
}
|
||||
|
||||
public void setProfile(DMPProfile profile) {
|
||||
this.profile = profile;
|
||||
}
|
||||
|
||||
public Dataset getDataset() {
|
||||
return dataset;
|
||||
}
|
||||
|
||||
public void setDataset(Dataset dataset) {
|
||||
this.dataset = dataset;
|
||||
}
|
||||
|
||||
public Set<Organisation> getOrganisations() {
|
||||
return organisations;
|
||||
}
|
||||
|
||||
public void setOrganisations(Set<Organisation> organisations) {
|
||||
this.organisations = organisations;
|
||||
}
|
||||
|
||||
public Set<Researcher> getResearchers() {
|
||||
return researchers;
|
||||
}
|
||||
|
||||
public void setResearchers(Set<Researcher> researchers) {
|
||||
this.researchers = researchers;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
try {
|
||||
return new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).writeValueAsString(this);
|
||||
} catch (JsonProcessingException e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package entities;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name="\"DMPOrganisation\"")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||
public class DMPOrganisation implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = -222030426979174777L;
|
||||
|
||||
public DMPOrganisation () {}
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@Column(name = "\"DMP\"")
|
||||
private UUID dmp;
|
||||
|
||||
@Column(name = "\"Organisation\"")
|
||||
private UUID organisation;
|
||||
|
||||
@Column(name = "\"Role\"")
|
||||
private Integer role;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public UUID getDmp() {
|
||||
return dmp;
|
||||
}
|
||||
|
||||
public void setDmp(UUID dmp) {
|
||||
this.dmp = dmp;
|
||||
}
|
||||
|
||||
public UUID getOrganisation() {
|
||||
return organisation;
|
||||
}
|
||||
|
||||
public void setOrganisation(UUID organisation) {
|
||||
this.organisation = organisation;
|
||||
}
|
||||
|
||||
public Integer getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(Integer role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
package entities;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name="\"DMPProfile\"")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||
public class DMPProfile implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 3213099144442689808L;
|
||||
|
||||
public DMPProfile () {}
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER, mappedBy = "profile", cascade = CascadeType.ALL)
|
||||
private DMP dmp;
|
||||
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
@Type(type="typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
||||
private String definition;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public DMP getDmp() {
|
||||
return dmp;
|
||||
}
|
||||
|
||||
public void setDmp(DMP dmp) {
|
||||
this.dmp = dmp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
package entities;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name="\"DMPResearcher\"")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||
public class DMPResearcher implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 135449857355252959L;
|
||||
|
||||
public DMPResearcher () {}
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@Type(type="org.hibernate.type.PostgresUUIDType")
|
||||
@Column(name = "\"DMP\"")
|
||||
private UUID dmp;
|
||||
|
||||
@Type(type="org.hibernate.type.PostgresUUIDType")
|
||||
@Column(name = "\"Researcher\"")
|
||||
private UUID researcher;
|
||||
|
||||
@Column(name = "\"Role\"")
|
||||
private Integer role;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public UUID getDmp() {
|
||||
return dmp;
|
||||
}
|
||||
|
||||
public void setDmp(UUID dmp) {
|
||||
this.dmp = dmp;
|
||||
}
|
||||
|
||||
public UUID getResearcher() {
|
||||
return researcher;
|
||||
}
|
||||
|
||||
public void setResearcher(UUID researcher) {
|
||||
this.researcher = researcher;
|
||||
}
|
||||
|
||||
public Integer getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(Integer role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,130 @@
|
|||
package entities;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
|
||||
@Entity(name="\"DataRepository\"")
|
||||
@Table(name="\"DataRepository\"")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||
public class DataRepository implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 4162323701450468639L;
|
||||
|
||||
public DataRepository () {}
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
@Column(name = "\"Abbreviation\"")
|
||||
private String abbreviation;
|
||||
|
||||
@Type(type="typedefinition.XMLType")
|
||||
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
|
||||
private String reference;
|
||||
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
|
||||
@Type(type="typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
||||
private String definition;
|
||||
|
||||
|
||||
|
||||
@OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
|
||||
@JoinTable(name="\"DatasetDataRepository\"",
|
||||
joinColumns={@JoinColumn(name="\"DataRepository\"", referencedColumnName="\"ID\"")},
|
||||
inverseJoinColumns={@JoinColumn(name="\"Dataset\"", referencedColumnName="\"ID\"")}
|
||||
)
|
||||
private Set<Dataset> datasets;
|
||||
|
||||
|
||||
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public Set<Dataset> getDatasets() {
|
||||
return datasets;
|
||||
}
|
||||
|
||||
public void setDatasets(Set<Dataset> datasets) {
|
||||
this.datasets = datasets;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,181 @@
|
|||
package entities;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Cascade;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
@Entity(name = "Dataset")
|
||||
@Table(name="\"Dataset\"")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||
public class Dataset implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 3575723814399553259L;
|
||||
|
||||
public Dataset () {}
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
|
||||
// @Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
||||
@JoinColumn(name = "\"DMP\"", nullable = false)
|
||||
private DMP dmp;
|
||||
|
||||
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
|
||||
@Type(type="typedefinition.XMLType")
|
||||
@Column(name = "\"Properties\"", columnDefinition = "xml", nullable = true)
|
||||
private String properties;
|
||||
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
|
||||
@Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
||||
@JoinColumn(name = "\"Profile\"", nullable = false)
|
||||
private DatasetProfile profile;
|
||||
|
||||
|
||||
@OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
|
||||
@JoinTable(name="\"DatasetDataRepository\"",
|
||||
joinColumns={@JoinColumn(name="\"Dataset\"", referencedColumnName="\"ID\"")},
|
||||
inverseJoinColumns={@JoinColumn(name="\"DataRepository\"", referencedColumnName="\"ID\"")}
|
||||
)
|
||||
private Set<DataRepository> dataRepositories;
|
||||
|
||||
|
||||
@OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
|
||||
@JoinTable(name="\"DatasetRegistry\"",
|
||||
joinColumns={@JoinColumn(name="\"Dataset\"", referencedColumnName="\"ID\"")},
|
||||
inverseJoinColumns={@JoinColumn(name="\"Registry\"", referencedColumnName="\"ID\"")}
|
||||
)
|
||||
private Set<Registry> registries;
|
||||
|
||||
|
||||
@OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
|
||||
@JoinTable(name="\"DatasetService\"",
|
||||
joinColumns={@JoinColumn(name="\"Dataset\"", referencedColumnName="\"ID\"")},
|
||||
inverseJoinColumns={@JoinColumn(name="\"Service\"", referencedColumnName="\"ID\"")}
|
||||
)
|
||||
private Set<Service> services;
|
||||
|
||||
|
||||
|
||||
public Set<Registry> getRegistries() {
|
||||
return registries;
|
||||
}
|
||||
|
||||
|
||||
public void setRegistries(Set<Registry> registries) {
|
||||
this.registries = registries;
|
||||
}
|
||||
|
||||
|
||||
public Set<Service> getServices() {
|
||||
return services;
|
||||
}
|
||||
|
||||
|
||||
public void setServices(Set<Service> services) {
|
||||
this.services = services;
|
||||
}
|
||||
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
|
||||
public DMP getDmp() {
|
||||
return dmp;
|
||||
}
|
||||
|
||||
|
||||
public void setDmp(DMP dmp) {
|
||||
this.dmp = dmp;
|
||||
}
|
||||
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
|
||||
public String getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
|
||||
public void setProperties(String properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
|
||||
public DatasetProfile getProfile() {
|
||||
return profile;
|
||||
}
|
||||
|
||||
|
||||
public void setProfile(DatasetProfile profile) {
|
||||
this.profile = profile;
|
||||
}
|
||||
|
||||
|
||||
public Set<DataRepository> getDataRepositories() {
|
||||
return dataRepositories;
|
||||
}
|
||||
|
||||
|
||||
public void setDataRepositories(Set<DataRepository> dataRepositories) {
|
||||
this.dataRepositories = dataRepositories;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package entities;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name="\"DatasetDataRepository\"")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||
public class DatasetDataRepository implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 576327201656132811L;
|
||||
|
||||
public DatasetDataRepository () {}
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@Type(type="org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
|
||||
@Column(name = "\"Dataset\"", nullable = false)
|
||||
private UUID dataset;
|
||||
|
||||
@Type(type="org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
|
||||
@Column(name = "\"DataRepository\"", nullable = false)
|
||||
private UUID dataRepository;
|
||||
|
||||
@Column(name = "\"Role\"")
|
||||
private Integer role;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public UUID getDataset() {
|
||||
return dataset;
|
||||
}
|
||||
|
||||
public void setDataset(UUID dataset) {
|
||||
this.dataset = dataset;
|
||||
}
|
||||
|
||||
public UUID getDataRepository() {
|
||||
return dataRepository;
|
||||
}
|
||||
|
||||
public void setDataRepository(UUID dataRepository) {
|
||||
this.dataRepository = dataRepository;
|
||||
}
|
||||
|
||||
public Integer getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(Integer role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,118 @@
|
|||
package entities;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Cascade;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Proxy;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name="\"DatasetProfile\"")
|
||||
//@Proxy(lazy = false)
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||
public class DatasetProfile implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 8203086344232867334L;
|
||||
|
||||
public DatasetProfile () {}
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER, mappedBy = "profile", cascade = CascadeType.ALL)
|
||||
private Dataset dataset;
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
|
||||
// @Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
||||
@JoinColumn(name = "\"Ruleset\"", nullable = false)
|
||||
private DatasetProfileRuleset ruleset;
|
||||
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
|
||||
// @Cascade(value=org.hibernate.annotations.CascadeType.ALL)
|
||||
@JoinColumn(name = "\"Viewstyle\"", nullable = false)
|
||||
private DatasetProfileViewstyle viewstyle;
|
||||
|
||||
|
||||
@Type(type="typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
|
||||
private String definition;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
|
||||
public DatasetProfileRuleset getRuleset() {
|
||||
return ruleset;
|
||||
}
|
||||
|
||||
public void setRuleset(DatasetProfileRuleset ruleset) {
|
||||
this.ruleset = ruleset;
|
||||
}
|
||||
|
||||
|
||||
public DatasetProfileViewstyle getViewstyle() {
|
||||
return viewstyle;
|
||||
}
|
||||
|
||||
public void setViewstyle(DatasetProfileViewstyle viewstyle) {
|
||||
this.viewstyle = viewstyle;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public Dataset getDataset() {
|
||||
return dataset;
|
||||
}
|
||||
|
||||
public void setDataset(Dataset dataset) {
|
||||
this.dataset = dataset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package entities;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
import org.json.JSONObject;
|
||||
import org.json.XML;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name="\"DatasetProfileRuleset\"")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||
public class DatasetProfileRuleset implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 4249565129050898613L;
|
||||
|
||||
public DatasetProfileRuleset () {}
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER, mappedBy = "ruleset", cascade = CascadeType.ALL)
|
||||
private DatasetProfile datasetProfile;
|
||||
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
@Type(type="typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
|
||||
private String definition;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
// return XML.toJSONObject(definition).toString(); //return definition as json
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
// this.definition = XML.toString(definition); //if definition is in json
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public DatasetProfile getDatasetProfile() {
|
||||
return datasetProfile;
|
||||
}
|
||||
|
||||
public void setDatasetProfile(DatasetProfile datasetProfile) {
|
||||
this.datasetProfile = datasetProfile;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
package entities;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
import org.json.XML;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name="\"DatasetProfileViewstyle\"")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||
public class DatasetProfileViewstyle implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -3251295258160291468L;
|
||||
|
||||
public DatasetProfileViewstyle () {}
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER, mappedBy = "viewstyle", cascade = CascadeType.ALL)
|
||||
private DatasetProfile datasetProfile;
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
@Type(type="typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = false)
|
||||
private String definition;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
// return XML.toJSONObject(definition).toString(); //return definition as json
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
// this.definition = XML.toString(definition); //if definition is in json
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public DatasetProfile getDatasetProfile() {
|
||||
return datasetProfile;
|
||||
}
|
||||
|
||||
public void setDatasetProfile(DatasetProfile datasetProfile) {
|
||||
this.datasetProfile = datasetProfile;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package entities;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name="\"DatasetRegistry\"")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||
public class DatasetRegistry implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -5594183793725819187L;
|
||||
|
||||
public DatasetRegistry () {}
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
|
||||
@Type(type="org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
|
||||
@Column(name = "\"Dataset\"", nullable = false)
|
||||
private UUID dataset;
|
||||
|
||||
@Type(type="org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
|
||||
@Column(name = "\"Registry\"", nullable = false)
|
||||
private UUID registry;
|
||||
|
||||
@Column(name = "\"Role\"")
|
||||
private Integer role;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public UUID getDataset() {
|
||||
return dataset;
|
||||
}
|
||||
|
||||
public void setDataset(UUID dataset) {
|
||||
this.dataset = dataset;
|
||||
}
|
||||
|
||||
public UUID getRegistry() {
|
||||
return registry;
|
||||
}
|
||||
|
||||
public void setRegistry(UUID registry) {
|
||||
this.registry = registry;
|
||||
}
|
||||
|
||||
public Integer getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(Integer role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package entities;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name="\"DatasetService\"")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||
public class DatasetService implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1469161193939096037L;
|
||||
|
||||
public DatasetService () {}
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
|
||||
@Type(type="org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
|
||||
@Column(name = "\"Dataset\"", nullable = false)
|
||||
private UUID dataset;
|
||||
|
||||
@Type(type="org.hibernate.type.PostgresUUIDType") //DEPWARN dependency to Hibernate and PostgreSQL
|
||||
@Column(name = "\"Service\"", nullable = false)
|
||||
private UUID service;
|
||||
|
||||
@Column(name = "\"Role\"")
|
||||
private Integer role;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public UUID getDataset() {
|
||||
return dataset;
|
||||
}
|
||||
|
||||
public void setDataset(UUID dataset) {
|
||||
this.dataset = dataset;
|
||||
}
|
||||
|
||||
public UUID getService() {
|
||||
return service;
|
||||
}
|
||||
|
||||
public void setService(UUID service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
public Integer getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(Integer role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
package entities;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name="\"Organisation\"")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||
public class Organisation implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 3614146195740867782L;
|
||||
|
||||
public Organisation () {}
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
@Column(name = "\"Abbreviation\"")
|
||||
private String abbreviation;
|
||||
|
||||
@Type(type="typedefinition.XMLType")
|
||||
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
|
||||
private String reference;
|
||||
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
|
||||
@Type(type="typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
||||
private String definition;
|
||||
|
||||
|
||||
@OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
|
||||
@JoinTable(name="\"DMPOrganisation\"",
|
||||
joinColumns={@JoinColumn(name="\"Organisation\"", referencedColumnName="\"ID\"")},
|
||||
inverseJoinColumns={@JoinColumn(name="\"DMP\"", referencedColumnName="\"ID\"")}
|
||||
)
|
||||
private Set<DMP> dMPs;
|
||||
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public Set<DMP> getdMPs() {
|
||||
return dMPs;
|
||||
}
|
||||
|
||||
public void setdMPs(Set<DMP> dMPs) {
|
||||
this.dMPs = dMPs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
package entities;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name="\"Project\"")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||
public class Project implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -767048645098311154L;
|
||||
|
||||
public Project () {}
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER, mappedBy = "project", cascade = CascadeType.ALL)
|
||||
private DMP dmp;
|
||||
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
@Column(name = "\"Abbreviation\"")
|
||||
private String abbreviation;
|
||||
|
||||
@Type(type="typedefinition.XMLType")
|
||||
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
|
||||
private String reference;
|
||||
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
|
||||
@Type(type="typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
||||
private String definition;
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
|
||||
public DMP getDMP() {
|
||||
return dmp;
|
||||
}
|
||||
|
||||
public void setDMP(DMP dmp) {
|
||||
this.dmp = dmp;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
try {
|
||||
return new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).writeValueAsString(this).replace("\"", """);
|
||||
} catch (JsonProcessingException e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
package entities;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name="\"Registry\"")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||
public class Registry implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -277572262583178090L;
|
||||
|
||||
public Registry () {}
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
@Column(name = "\"Abbreviation\"")
|
||||
private String abbreviation;
|
||||
|
||||
@Type(type="typedefinition.XMLType")
|
||||
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
|
||||
private String reference;
|
||||
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
|
||||
@Type(type="typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
||||
private String definition;
|
||||
|
||||
|
||||
@OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
|
||||
@JoinTable(name="\"DatasetRegistry\"",
|
||||
joinColumns={@JoinColumn(name="\"Registry\"", referencedColumnName="\"ID\"")},
|
||||
inverseJoinColumns={@JoinColumn(name="\"Dataset\"", referencedColumnName="\"ID\"")}
|
||||
)
|
||||
private Set<Dataset> datasets;
|
||||
|
||||
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public Set<Dataset> getDatasets() {
|
||||
return datasets;
|
||||
}
|
||||
|
||||
public void setDatasets(Set<Dataset> datasets) {
|
||||
this.datasets = datasets;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
package entities;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name="\"Researcher\"")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||
public class Researcher implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = -2513186824704729896L;
|
||||
|
||||
public Researcher () {}
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
|
||||
@Column(name = "\"PrimaryEmail\"")
|
||||
private String primaryEmail;
|
||||
|
||||
@Type(type="typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
||||
private String definition;
|
||||
|
||||
@Type(type="typedefinition.XMLType")
|
||||
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
|
||||
private String reference;
|
||||
|
||||
|
||||
@OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
|
||||
@JoinTable(name="\"DMPResearcher\"",
|
||||
joinColumns={@JoinColumn(name="\"Researcher\"", referencedColumnName="\"ID\"")},
|
||||
inverseJoinColumns={@JoinColumn(name="\"DMP\"", referencedColumnName="\"ID\"")}
|
||||
)
|
||||
private Set<DMP> dMPs;
|
||||
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getPrimaryEmail() {
|
||||
return primaryEmail;
|
||||
}
|
||||
|
||||
public void setPrimaryEmail(String primaryEmail) {
|
||||
this.primaryEmail = primaryEmail;
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public Set<DMP> getdMPs() {
|
||||
return dMPs;
|
||||
}
|
||||
|
||||
public void setdMPs(Set<DMP> dMPs) {
|
||||
this.dMPs = dMPs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,130 @@
|
|||
package entities;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
|
||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name="\"Service\"")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||
public class Service implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 7243446610500174060L;
|
||||
|
||||
public Service () {}
|
||||
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "\"ID\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
|
||||
@Column(name = "\"Label\"")
|
||||
private String label;
|
||||
|
||||
@Column(name = "\"Abbreviation\"")
|
||||
private String abbreviation;
|
||||
|
||||
@Type(type="typedefinition.XMLType")
|
||||
@Column(name = "\"Reference\"", columnDefinition = "xml", nullable = true)
|
||||
private String reference;
|
||||
|
||||
@Column(name = "\"Uri\"")
|
||||
private String uri;
|
||||
|
||||
@Type(type="typedefinition.XMLType")
|
||||
@Column(name = "\"Definition\"", columnDefinition = "xml", nullable = true)
|
||||
private String definition;
|
||||
|
||||
|
||||
@OneToMany(fetch = FetchType.EAGER, cascade=CascadeType.ALL)
|
||||
@JoinTable(name="\"DatasetService\"",
|
||||
joinColumns={@JoinColumn(name="\"Service\"", referencedColumnName="\"ID\"")},
|
||||
inverseJoinColumns={@JoinColumn(name="\"Dataset\"", referencedColumnName="\"ID\"")}
|
||||
)
|
||||
private Set<Dataset> datasets;
|
||||
|
||||
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getAbbreviation() {
|
||||
return abbreviation;
|
||||
}
|
||||
|
||||
public void setAbbreviation(String abbreviation) {
|
||||
this.abbreviation = abbreviation;
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
|
||||
public Set<Dataset> getDatasets() {
|
||||
return datasets;
|
||||
}
|
||||
|
||||
public void setDatasets(Set<Dataset> datasets) {
|
||||
this.datasets = datasets;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
package helpers;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import entities.DMP;
|
||||
import entities.DMPProfile;
|
||||
import entities.DataRepository;
|
||||
import entities.Dataset;
|
||||
import entities.DatasetProfile;
|
||||
import entities.DatasetProfileRuleset;
|
||||
import entities.DatasetProfileViewstyle;
|
||||
import entities.Project;
|
||||
import entities.Registry;
|
||||
import entities.Service;
|
||||
|
||||
public class Transformers {
|
||||
|
||||
|
||||
public static DMP createDMPfromMap(MultiValueMap<String,String> formData) {
|
||||
|
||||
DatasetProfileRuleset dpr = new DatasetProfileRuleset();
|
||||
dpr.setLabel(formData.getFirst("DatasetProfileRuleset.label"));
|
||||
dpr.setDefinition(formData.getFirst("DatasetProfileRuleset.definition"));
|
||||
|
||||
DatasetProfileViewstyle dpv = new DatasetProfileViewstyle();
|
||||
dpv.setLabel(formData.getFirst("DatasetProfileViewStyle.label"));
|
||||
dpv.setDefinition(formData.getFirst("DatasetProfileViewStyle.definition"));
|
||||
|
||||
DatasetProfile dp = new DatasetProfile();
|
||||
dp.setLabel(formData.getFirst("DatasetProfile.label"));
|
||||
dp.setDefinition(formData.getFirst("DatasetProfile.definition"));
|
||||
dp.setRuleset(dpr);
|
||||
dp.setViewstyle(dpv);
|
||||
|
||||
|
||||
Project project = new Project();
|
||||
project.setDefinition(formData.getFirst("Project.definition"));
|
||||
project.setLabel(formData.getFirst("Project.label"));
|
||||
project.setReference(formData.getFirst("Project.reference"));
|
||||
project.setUri(formData.getFirst("Project.uri"));
|
||||
|
||||
|
||||
DMPProfile profile = new DMPProfile();
|
||||
profile.setLabel(formData.getFirst("DMPProfile.label"));
|
||||
profile.setDefinition(formData.getFirst("DMPProfile.definition"));
|
||||
|
||||
|
||||
DataRepository dr = new DataRepository();
|
||||
dr.setLabel(formData.getFirst("DataRepository.label"));
|
||||
dr.setDefinition(formData.getFirst("DataRepository.definition"));
|
||||
dr.setReference(formData.getFirst("DataRepository.reference"));
|
||||
dr.setAbbreviation(formData.getFirst("DataRepository.abbr"));
|
||||
dr.setUri(formData.getFirst("DataRepository.uri"));
|
||||
|
||||
Registry reg = new Registry();
|
||||
reg.setLabel(formData.getFirst("Registry.label"));
|
||||
reg.setAbbreviation(formData.getFirst("Registry.abbr"));
|
||||
reg.setReference(formData.getFirst("Registry.reference"));
|
||||
reg.setUri(formData.getFirst("Registry.uri"));
|
||||
reg.setDefinition(formData.getFirst("Registry.definition"));
|
||||
|
||||
Service ser = new Service();
|
||||
ser.setLabel(formData.getFirst("Service.label"));
|
||||
ser.setAbbreviation(formData.getFirst("Service.abbr"));
|
||||
ser.setReference(formData.getFirst("Service.reference"));
|
||||
ser.setUri(formData.getFirst("Service.uri"));
|
||||
ser.setDefinition(formData.getFirst("Service.definition"));
|
||||
|
||||
|
||||
Dataset ds = new Dataset();
|
||||
ds.setLabel(formData.getFirst("Dataset.label"));
|
||||
ds.setProperties(formData.getFirst("Dataset.props"));
|
||||
ds.setUri(formData.getFirst("Dataset.uri"));
|
||||
ds.setProfile(dp);
|
||||
ds.setDataRepositories(new HashSet<DataRepository>(Arrays.asList(dr)));
|
||||
ds.setRegistries(new HashSet<Registry>(Arrays.asList(reg)));
|
||||
ds.setServices(new HashSet<Service>(Arrays.asList(ser)));
|
||||
|
||||
|
||||
DMP dmp = new DMP();
|
||||
dmp.setLabel(formData.getFirst("DMP.label"));
|
||||
try {
|
||||
dmp.setPrevious(UUID.fromString(formData.getFirst("DMP.previous")));
|
||||
}catch(Exception ex) {/*do nothing*/}
|
||||
dmp.setProfile(profile);
|
||||
dmp.setProfileData(formData.getFirst("DMP.profileData"));
|
||||
dmp.setProject(project);
|
||||
dmp.setVersion(Integer.parseInt(formData.getFirst("DMP.version")));
|
||||
dmp.setDataset(ds);
|
||||
|
||||
|
||||
System.out.println(dmp);
|
||||
|
||||
return dmp;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,327 @@
|
|||
package rest;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.Session;
|
||||
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.transaction.annotation.Transactional;
|
||||
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.DMPResearcherDao;
|
||||
import dao.entities.DataRepositoryDao;
|
||||
import dao.entities.DatasetDao;
|
||||
import dao.entities.DatasetProfileDao;
|
||||
import dao.entities.DatasetProfileRulesetDao;
|
||||
import dao.entities.DatasetProfileViewstyleDao;
|
||||
import dao.entities.DatasetRegistryDao;
|
||||
import dao.entities.DatasetServiceDao;
|
||||
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.DatasetProfileViewstyle;
|
||||
import entities.DatasetRegistry;
|
||||
import entities.DatasetService;
|
||||
import entities.Organisation;
|
||||
import entities.Project;
|
||||
import entities.Registry;
|
||||
import entities.Service;
|
||||
import helpers.Transformers;
|
||||
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
public class BackendInterface {
|
||||
|
||||
@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;
|
||||
|
||||
|
||||
|
||||
// FETCH BY DMP(S)
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = { "/DMP" }, produces="text/plain")
|
||||
public @ResponseBody ResponseEntity<Object> listDMPs(){
|
||||
try {
|
||||
List<UUID> allIDs = dMPDao.listAllIDs();
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(allIDs));
|
||||
}
|
||||
catch(Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = { "/DMP/{id}" }, produces="application/json")
|
||||
public @ResponseBody ResponseEntity<Object> getDMP(@PathVariable("id") String id){
|
||||
try {
|
||||
DMP dmp = dMPDao.read(UUID.fromString(id));
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(dmp));
|
||||
}
|
||||
catch(Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This should be called on extreme cases. It's computationally intensive
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = { "/getAllDMPs" }, produces="application/json")
|
||||
public @ResponseBody ResponseEntity<Object> getAllDMPs(){
|
||||
try {
|
||||
List<DMP> allDMPs = dMPDao.getAll();
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(allDMPs));
|
||||
}
|
||||
catch(Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = { "/setDMP" }, consumes = "application/json", produces="text/plain")
|
||||
public @ResponseBody ResponseEntity<Object> setDMP(@RequestBody DMP dmp) {
|
||||
|
||||
//This function is a little bit tricky to implement (due to the irregular ORM mappings of the hibernate).
|
||||
// Please make changes only if you are sure about what you're altering.
|
||||
|
||||
Dataset dataset = SerializationUtils.clone(dmp.getDataset());
|
||||
|
||||
dmp.setDataset(null);
|
||||
|
||||
int failsDMP = 0;
|
||||
String reasonDmp = "";
|
||||
DMP storedDMP = null;
|
||||
//try first to create DMP
|
||||
try {
|
||||
storedDMP = dMPDao.create(dmp);
|
||||
}
|
||||
catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
failsDMP++;
|
||||
reasonDmp += e.getMessage();
|
||||
//try updating DMP
|
||||
try {
|
||||
storedDMP = dMPDao.update(dmp);
|
||||
}
|
||||
catch(Exception ex) {
|
||||
reasonDmp += (System.lineSeparator()+e.getMessage());
|
||||
failsDMP++;
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if(failsDMP==2)
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Could not create or update DMP! Reason: " + reasonDmp);
|
||||
|
||||
dataset.setDmp(storedDMP); //very important!
|
||||
|
||||
int failsDataset = 0;
|
||||
String reasonDataset = "";
|
||||
Dataset storedDataset = null;
|
||||
if(dataset != null) {
|
||||
//try first to create DMP
|
||||
try {
|
||||
storedDataset = datasetDao.create(dataset);
|
||||
}
|
||||
catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
failsDataset++;
|
||||
reasonDataset += e.getMessage();
|
||||
//try updating DMP
|
||||
try {
|
||||
storedDataset = datasetDao.update(dataset);
|
||||
}
|
||||
catch(Exception ex) {
|
||||
reasonDataset += (System.lineSeparator()+e.getMessage());
|
||||
failsDataset++;
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(failsDataset != 2) {
|
||||
if(failsDMP==0)
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body("Created DMP with id: " + storedDMP.getId());
|
||||
else if(failsDMP==1)
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body("Updated DMP with id: " + storedDMP.getId());
|
||||
else
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Could not create DMP! Reason:"+ reasonDmp);
|
||||
}
|
||||
else {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Could not create DMP! Failed to create or update its Dataset. Reason: "+reasonDataset);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@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) {
|
||||
DMP dmp = Transformers.createDMPfromMap(formData);
|
||||
return setDMP(dmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// FETCH BY DATASET(S)
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = { "/dataset" })
|
||||
public @ResponseBody ResponseEntity<Object> listDatasets(){
|
||||
try {
|
||||
List<UUID> allIDs = datasetDao.listAllIDs();
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(allIDs));
|
||||
}
|
||||
catch(Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = { "/dataset/{id}" })
|
||||
public @ResponseBody ResponseEntity<Object> getDataset(@PathVariable("id") String id) {
|
||||
try {
|
||||
Dataset ds = datasetDao.read(UUID.fromString(id));
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(ds));
|
||||
}
|
||||
catch(Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This should be called on extreme cases. It's computationally intensive
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = { "/getAllDatasets" })
|
||||
public @ResponseBody ResponseEntity<Object> getAllDatasets(){
|
||||
try {
|
||||
List<Dataset> allDatasets = datasetDao.getAll();
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(allDatasets));
|
||||
}
|
||||
catch(Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = { "/setDataset" }, consumes = "application/json")
|
||||
public @ResponseBody ResponseEntity<Object> setDataset(@RequestBody Dataset dataset) {
|
||||
String reason = "";
|
||||
Dataset storedDataset = null;
|
||||
//try first to create
|
||||
try {
|
||||
storedDataset = datasetDao.create(dataset);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body("Created Dataset with id: " + storedDataset.getId());
|
||||
}
|
||||
catch(Exception e) {
|
||||
reason += e.getMessage();
|
||||
//try updating
|
||||
try {
|
||||
storedDataset = datasetDao.update(dataset);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body("Updated Dataset with id: " + storedDataset.getId());
|
||||
}
|
||||
catch(Exception ex) {
|
||||
reason += (System.lineSeparator()+e.getMessage());
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Could not create or update Dataset! Reason: " + reason);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// FETCH BY PROJECT(S)
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = { "/project" })
|
||||
public @ResponseBody ResponseEntity<Object> listProjects(){
|
||||
try {
|
||||
List<UUID> allIDs = projectDao.listAllIDs();
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(allIDs));
|
||||
}
|
||||
catch(Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = { "/project/{id}" })
|
||||
public @ResponseBody ResponseEntity<Object> getProject(@PathVariable("id") String id) {
|
||||
try {
|
||||
Project project = projectDao.read(UUID.fromString(id));
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ObjectMapper().writeValueAsString(project));
|
||||
}
|
||||
catch(Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Erroneous input: "+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = { "/setProject" }, consumes = "application/json")
|
||||
public @ResponseBody ResponseEntity<Object> setProject(@RequestBody Project project) {
|
||||
String reason = "";
|
||||
Project storedProject = null;
|
||||
//try first to create
|
||||
try {
|
||||
storedProject = projectDao.create(project);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body("Created project with id: " + storedProject.getId());
|
||||
}
|
||||
catch(Exception e) {
|
||||
reason += e.getMessage();
|
||||
//try updating
|
||||
try {
|
||||
storedProject = projectDao.update(project);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body("Updated project with id: " + storedProject.getId());
|
||||
}
|
||||
catch(Exception ex) {
|
||||
reason += (System.lineSeparator()+e.getMessage());
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("Could not create or update project! Reason: " + reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package typedefinition;
|
||||
|
||||
public enum DataType {
|
||||
TINY,
|
||||
SHORT,
|
||||
INTEGER,
|
||||
LONG,
|
||||
DOUBLE,
|
||||
FLOAT,
|
||||
DATE,
|
||||
STRING,
|
||||
TEXT
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package typedefinition;
|
||||
|
||||
public interface DatabaseColumnType {
|
||||
public String getType(DataType dt);
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package typedefinition;
|
||||
|
||||
public class PostgreSQLDatabaseColumnType implements DatabaseColumnType {
|
||||
|
||||
public String getType(DataType dt) {
|
||||
switch (dt) {
|
||||
case TINY:
|
||||
case SHORT:
|
||||
case INTEGER:
|
||||
return "integer";
|
||||
case LONG:
|
||||
return "bigint";
|
||||
case FLOAT:
|
||||
case DOUBLE:
|
||||
return "numeric";
|
||||
case DATE:
|
||||
return "timestamp";
|
||||
case STRING:
|
||||
return "character varying(250)";
|
||||
case TEXT:
|
||||
return "text";
|
||||
}
|
||||
return "character varying(250)";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
package typedefinition;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.spi.SessionImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.usertype.UserType;
|
||||
|
||||
/**
|
||||
* Currently not used
|
||||
*
|
||||
*/
|
||||
public class UUIDType implements UserType
|
||||
{
|
||||
private final int[] sqlTypesSupported = new int[] { Types.NUMERIC };
|
||||
private final String CAST_EXCEPTION_TEXT = " cannot be cast to a java.util.UUID";
|
||||
|
||||
public int[] sqlTypes()
|
||||
{
|
||||
return sqlTypesSupported;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Class returnedClass()
|
||||
{
|
||||
return UUID.class;
|
||||
}
|
||||
|
||||
public boolean equals(Object x, Object y) throws HibernateException
|
||||
{
|
||||
if (x == null) return y == null;
|
||||
else return x.equals(y);
|
||||
}
|
||||
|
||||
public int hashCode(Object x) throws HibernateException
|
||||
{
|
||||
return x == null ? null : x.hashCode();
|
||||
}
|
||||
|
||||
public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException
|
||||
{
|
||||
assert(names.length == 1);
|
||||
Object value = rs.getObject(names[0]);
|
||||
if (value == null) return null;
|
||||
|
||||
UUID uuid = UUID.fromString( rs.getString( names[0] ) );
|
||||
return rs.wasNull() ? null : uuid;
|
||||
}
|
||||
|
||||
public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
st.setNull(index, Types.NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UUID.class.isAssignableFrom(value.getClass()))
|
||||
throw new HibernateException(value.getClass().toString() + CAST_EXCEPTION_TEXT);
|
||||
|
||||
UUID uuid = (UUID) value;
|
||||
st.setObject(index, uuid, Types.OTHER);
|
||||
}
|
||||
|
||||
public Object deepCopy(Object value) throws HibernateException
|
||||
{
|
||||
if (value == null) return null;
|
||||
UUID uuid = (UUID) value;
|
||||
return new UUID( uuid.getMostSignificantBits(), uuid.getLeastSignificantBits() );
|
||||
}
|
||||
|
||||
public boolean isMutable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public Serializable disassemble(Object value) throws HibernateException
|
||||
{
|
||||
return (Serializable) value;
|
||||
}
|
||||
|
||||
public Object assemble(Serializable cached, Object owner) throws HibernateException
|
||||
{
|
||||
return cached;
|
||||
}
|
||||
|
||||
public Object replace(Object original, Object target, Object owner) throws HibernateException
|
||||
{
|
||||
return original;
|
||||
}
|
||||
|
||||
// public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner)
|
||||
// throws HibernateException, SQLException
|
||||
// {
|
||||
// return nullSafeGet(rs, names, owner);
|
||||
// }
|
||||
//
|
||||
// public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session)
|
||||
// throws HibernateException, SQLException
|
||||
// {
|
||||
// nullSafeSet(st, value, index);
|
||||
//
|
||||
// }
|
||||
|
||||
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)
|
||||
throws HibernateException, SQLException {
|
||||
return nullSafeGet(rs, names, owner);
|
||||
}
|
||||
|
||||
public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session)
|
||||
throws HibernateException, SQLException {
|
||||
nullSafeSet(st, value, index);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package typedefinition;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.spi.SessionImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.usertype.UserType;
|
||||
|
||||
/**
|
||||
* Store and retrieve a PostgreSQL "xml" column as a Java string.
|
||||
*/
|
||||
public class XMLType implements UserType {
|
||||
|
||||
private final int[] sqlTypesSupported = new int[] { Types.VARCHAR };
|
||||
|
||||
public int[] sqlTypes() {
|
||||
return sqlTypesSupported;
|
||||
}
|
||||
|
||||
public Class returnedClass() {
|
||||
return String.class;
|
||||
}
|
||||
|
||||
public boolean equals(Object x, Object y) throws HibernateException {
|
||||
if (x == null) {
|
||||
return y == null;
|
||||
} else {
|
||||
return x.equals(y);
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode(Object x) throws HibernateException {
|
||||
return x == null ? null : x.hashCode();
|
||||
}
|
||||
|
||||
public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException {
|
||||
assert(names.length == 1);
|
||||
String xmldoc = rs.getString( names[0] );
|
||||
return rs.wasNull() ? null : xmldoc;
|
||||
}
|
||||
|
||||
public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
|
||||
if (value == null) {
|
||||
st.setNull(index, Types.OTHER);
|
||||
} else {
|
||||
st.setObject(index, value, Types.OTHER);
|
||||
}
|
||||
}
|
||||
|
||||
public Object deepCopy(Object value) throws HibernateException {
|
||||
if (value == null)
|
||||
return null;
|
||||
return new String( (String)value );
|
||||
}
|
||||
|
||||
public boolean isMutable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Serializable disassemble(Object value) throws HibernateException {
|
||||
return (String) value;
|
||||
}
|
||||
|
||||
public Object assemble(Serializable cached, Object owner) throws HibernateException {
|
||||
return (String) cached;
|
||||
}
|
||||
|
||||
public Object replace(Object original, Object target, Object owner) throws HibernateException {
|
||||
return original;
|
||||
}
|
||||
|
||||
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)
|
||||
throws HibernateException, SQLException
|
||||
{
|
||||
return nullSafeGet(rs, names, owner);
|
||||
}
|
||||
|
||||
public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException
|
||||
{
|
||||
nullSafeSet(st, value, index);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
//package types;
|
||||
//
|
||||
//import java.io.Serializable;
|
||||
//import java.sql.PreparedStatement;
|
||||
//import java.sql.ResultSet;
|
||||
//import java.sql.SQLException;
|
||||
//import java.sql.Types;
|
||||
//import org.hibernate.HibernateException;
|
||||
//import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
//
|
||||
///**
|
||||
// * Store and retrieve a PostgreSQL "xml" column as a Java string.
|
||||
// */
|
||||
//public class SQLXMLType implements org.hibernate.usertype.UserType {
|
||||
//
|
||||
// private final int[] sqlTypesSupported = new int[] { Types.VARCHAR };
|
||||
//
|
||||
// public int[] sqlTypes() {
|
||||
// return sqlTypesSupported;
|
||||
// }
|
||||
//
|
||||
// public Class returnedClass() {
|
||||
// return String.class;
|
||||
// }
|
||||
//
|
||||
// public boolean equals(Object x, Object y) throws HibernateException {
|
||||
// if (x == null) {
|
||||
// return y == null;
|
||||
// } else {
|
||||
// return x.equals(y);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public int hashCode(Object x) throws HibernateException {
|
||||
// return x == null ? null : x.hashCode();
|
||||
// }
|
||||
//
|
||||
// public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException {
|
||||
// assert(names.length == 1);
|
||||
// String xmldoc = rs.getString( names[0] );
|
||||
// return rs.wasNull() ? null : xmldoc;
|
||||
// }
|
||||
//
|
||||
// public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
|
||||
// if (value == null) {
|
||||
// st.setNull(index, Types.OTHER);
|
||||
// } else {
|
||||
// st.setObject(index, value, Types.OTHER);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public Object deepCopy(Object value) throws HibernateException {
|
||||
// if (value == null)
|
||||
// return null;
|
||||
// return new String( (String)value );
|
||||
// }
|
||||
//
|
||||
// public boolean isMutable() {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// public Serializable disassemble(Object value) throws HibernateException {
|
||||
// return (String) value;
|
||||
// }
|
||||
//
|
||||
// public Object assemble(Serializable cached, Object owner) throws HibernateException {
|
||||
// return (String) cached;
|
||||
// }
|
||||
//
|
||||
// public Object replace(Object original, Object target, Object owner) throws HibernateException {
|
||||
// return original;
|
||||
// }
|
||||
//
|
||||
// public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)
|
||||
// throws HibernateException, SQLException {
|
||||
// // TODO Auto-generated method stub
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session)
|
||||
// throws HibernateException, SQLException {
|
||||
// // TODO Auto-generated method stub
|
||||
//
|
||||
// }
|
||||
//}
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
|
||||
http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/persistence_2_1.xsd">
|
||||
<persistence-unit name="DMPBackendPersistence">
|
||||
<description> Persistence unit for DPM Backend </description>
|
||||
<!-- <provider>org.hibernate.ejb.HibernatePersistence</provider> --> <!--this is for hibernate versions before 5.2.1 -->
|
||||
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> <!-- this is for hibernate versions after 5.2.1 -->
|
||||
|
||||
</persistence-unit>
|
||||
</persistence>
|
|
@ -0,0 +1,101 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/tx
|
||||
http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
|
||||
<context:property-placeholder location="classpath*:**/dmp.properties" />
|
||||
|
||||
|
||||
<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
|
||||
|
||||
|
||||
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
|
||||
|
||||
<bean id="jpaDialect" class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />
|
||||
|
||||
<!-- <bean id="remoteFileRepositoryHostname" class="java.lang.String" /> -->
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
|
||||
<property name="entityManagerFactory" ref="emf" />
|
||||
<property name="jpaDialect" ref="jpaDialect" />
|
||||
</bean>
|
||||
|
||||
<bean id="springApplicationContext" class="dao.SpringJpaDaoFactory" />
|
||||
|
||||
<bean id="databaseColumnType" class="typedefinition.PostgreSQLDatabaseColumnType" />
|
||||
|
||||
<bean id="emf" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
|
||||
<property name="persistenceUnitName" value="DMPBackendPersistence" />
|
||||
<property name="jpaProperties">
|
||||
<props>
|
||||
<prop key="javax.persistence.jdbc.driver">${persistence.jdbc.driver}</prop>
|
||||
<prop key="javax.persistence.jdbc.url">${persistence.jdbc.url}</prop>
|
||||
<prop key="hibernate.connection.username">${persistence.dbusername}</prop>
|
||||
<prop key="hibernate.connection.password">${persistence.dbpassword}</prop>
|
||||
<prop key="hibernate.show_sql">${persistence.hibernate.show_sql}</prop>
|
||||
<prop key="hibernate.hbm2ddl.auto">${persistence.hibernate.hbm2dll}</prop>
|
||||
<prop key="hibernate.dialect">${persistence.hibernate.dialect}</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_updates">${persistence.hibernate.order_updates}</prop>
|
||||
<prop key="hibernate.jdbc.batch_versioned_data">${persistence.hibernate.batch_versioned_data}</prop>
|
||||
<prop key="hibernate.connection.handling_mode">${persistence.hibernate.jdbc.batch_versioned_data}</prop>
|
||||
<prop key="hibernate.connection.release_mode">on_close</prop>
|
||||
|
||||
<prop key="hibernate.connection.provider_class">${persistence.hibernate.connectionpool.provider_class}</prop>
|
||||
<prop key="hibernate.c3p0.min_size">${persistence.hibernate.connectionpool.c3p0.min_size}</prop>
|
||||
<prop key="hibernate.c3p0.max_size">${persistence.hibernate.connectionpool.c3p0.max_size}</prop>
|
||||
|
||||
<prop key="hibernate.c3p0.timeout">0</prop>
|
||||
<!-- <prop key="hibernate.c3p0.timeout">${persistence.hibernate.connectionpool.c3p0.timeout}</prop> -->
|
||||
|
||||
<prop key="hibernate.c3p0.max_statements">${persistence.hibernate.connectionpool.c3p0.max_statements}</prop>
|
||||
<prop key="hibernate.c3p0.acquire_retry_attempts">${persistence.hibernate.connectionpool.c3p0.acquire_retry_attempts}</prop>
|
||||
<prop key="hibernate.c3p0.acquire_retry_delay">${persistence.hibernate.connectionpool.c3p0.acquire_retry_delay}</prop>
|
||||
<prop key="hibernate.c3p0.idle_test_period">${persistence.hibernate.connectionpool.c3p0.idle_test_period}</prop>
|
||||
<prop key="hibernate.c3p0.break_after_acquire_failure">${persistence.hibernate.connectionpool.c3p0.break_after_acquire_failure}</prop>
|
||||
<prop key="hibernate.c3p0.idle_connection_test_period">${persistence.hibernate.connectionpool.c3p0.idle_connection_test_period}</prop>
|
||||
<prop key="hibernate.c3p0.test_connection_on_checkin">${persistence.hibernate.connectionpool.c3p0.test_connection_on_checkin}</prop>
|
||||
<prop key="hibernate.c3p0.test_connection_on_checkout">${persistence.hibernate.connectionpool.c3p0.test_connection_on_checkout}</prop>
|
||||
<prop key="hibernate.c3p0.preferred_test_query">${persistence.hibernate.connectionpool.c3p0.preferred_test_query}</prop>
|
||||
|
||||
</props>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
|
||||
|
||||
<bean id="organisationDao" class="dao.entities.OrganisationDaoImpl" />
|
||||
<bean id="dataRepositoryDao" class="dao.entities.DataRepositoryDaoImpl" />
|
||||
<bean id="datasetDao" class="dao.entities.DatasetDaoImpl" />
|
||||
<bean id="datasetProfileDao" class="dao.entities.DatasetProfileDaoImpl" />
|
||||
<bean id="datasetProfileRulesetDao" class="dao.entities.DatasetProfileRulesetDaoImpl" />
|
||||
<bean id="datasetProfileViewstyleDao" class="dao.entities.DatasetProfileViewstyleDaoImpl" />
|
||||
<bean id="datasetRegistryDao" class="dao.entities.DatasetRegistryDaoImpl" />
|
||||
<bean id="datasetServiceDao" class="dao.entities.DatasetServiceDaoImpl" />
|
||||
<bean id="dMPDao" class="dao.entities.DMPDaoImpl" />
|
||||
<bean id="dMPProfileDao" class="dao.entities.DMPProfileDaoImpl" />
|
||||
<bean id="dMPResearcherDao" class="dao.entities.DMPResearcherDaoImpl" />
|
||||
<bean id="projectDao" class="dao.entities.ProjectDaoImpl" />
|
||||
<bean id="registryDao" class="dao.entities.RegistryDaoImpl" />
|
||||
<bean id="researcherDao" class="dao.entities.ResearcherDaoImpl" />
|
||||
<bean id="serviceDao" class="dao.entities.ServiceDaoImpl" />
|
||||
|
||||
|
||||
<context:annotation-config />
|
||||
|
||||
<context:component-scan base-package="entities" />
|
||||
<context:component-scan base-package="dao" />
|
||||
<context:component-scan base-package="core" />
|
||||
<context:component-scan base-package="rest" />
|
||||
<!-- <context:component-scan base-package="controller" /> -->
|
||||
|
||||
|
||||
</beans>
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/mvc
|
||||
http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-4.1.xsd
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd">
|
||||
|
||||
|
||||
<mvc:resources mapping="resources/**" location="/resources/" />
|
||||
<mvc:annotation-driven />
|
||||
<context:component-scan base-package="rest" />
|
||||
|
||||
<bean
|
||||
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||
<property name="prefix" value="/views/" />
|
||||
<property name="suffix" value=".jsp" />
|
||||
</bean>
|
||||
|
||||
<bean id="multipartResolver"
|
||||
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
|
||||
<property name="maxUploadSize" value="100000000" />
|
||||
</bean>
|
||||
|
||||
<bean id="jsonConverter"
|
||||
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
|
||||
<property name="prefixJson" value="false" />
|
||||
<property name="supportedMediaTypes" value="application/json" />
|
||||
</bean>
|
||||
|
||||
<bean
|
||||
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
|
||||
<property name="messageConverters">
|
||||
<list>
|
||||
<ref bean="jsonConverter" />
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
</beans>
|
|
@ -0,0 +1,46 @@
|
|||
##########################Security##########################################
|
||||
#security.portmapping.http = 7081
|
||||
#security.portmapping.https = 7444
|
||||
##########################/Security########################################
|
||||
|
||||
##########################Persistence##########################################
|
||||
persistence.jdbc.driver = org.postgresql.Driver
|
||||
persistence.jdbc.url = jdbc:postgresql://localhost:5432/db
|
||||
persistence.dbusername = db-user
|
||||
persistence.dbpassword = db-pass
|
||||
##########################/Persistence##########################################
|
||||
|
||||
|
||||
########################Persistence/Hibernate Generic#############################
|
||||
persistence.hibernate.show_sql = false
|
||||
persistence.hibernate.hbm2dll = validate
|
||||
persistence.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
|
||||
#persistence.hibernate.dialect = org.hibernate.spatial.dialect.postgis.PostgisDialect
|
||||
########################Persistence/Hibernate Generic#############################
|
||||
|
||||
|
||||
########################Persistence/Hibernate/Batch##############################
|
||||
persistence.hibernate.jdbc.batch_size = 30
|
||||
persistence.hibernate.order_inserts = true
|
||||
persistence.hibernate.order_updates = true
|
||||
persistence.hibernate.batch_versioned_data = true
|
||||
persistence.hibernate.jdbc.batch_versioned_data = DELAYED_ACQUISITION_AND_RELEASE_AFTER_TRANSACTION
|
||||
########################Persistence/Hibernate/Batch##############################
|
||||
|
||||
|
||||
########################Persistence/Hibernate/Connection pool####################
|
||||
persistence.hibernate.connectionpool.provider_class = org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider
|
||||
persistence.hibernate.connectionpool.c3p0.min_size = 5
|
||||
persistence.hibernate.connectionpool.c3p0.max_size = 100
|
||||
persistence.hibernate.connectionpool.c3p0.timeout = 0
|
||||
persistence.hibernate.connectionpool.c3p0.max_statements = 50
|
||||
persistence.hibernate.connectionpool.c3p0.acquire_retry_attempts = 30
|
||||
persistence.hibernate.connectionpool.c3p0.acquire_retry_delay = 1000
|
||||
persistence.hibernate.connectionpool.c3p0.idle_test_period = 3000
|
||||
persistence.hibernate.connectionpool.c3p0.break_after_acquire_failure = false
|
||||
persistence.hibernate.connectionpool.c3p0.idle_connection_test_period = 3600
|
||||
persistence.hibernate.connectionpool.c3p0.test_connection_on_checkin = true
|
||||
persistence.hibernate.connectionpool.c3p0.test_connection_on_checkout = false
|
||||
persistence.hibernate.connectionpool.c3p0.preferred_test_query = select 1
|
||||
########################Persistence/Hibernate/Connection pool####################
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/mvc
|
||||
http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context-4.1.xsd
|
||||
http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd">
|
||||
|
||||
<context:component-scan base-package="controller" />
|
||||
|
||||
<bean
|
||||
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
|
||||
<property name="prefix">
|
||||
<value>/WEB-INF/views/jsp/</value>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<value>.jsp</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<mvc:resources mapping="/resources/**" location="/resources/" />
|
||||
|
||||
<mvc:annotation-driven />
|
||||
|
||||
</beans>
|
|
@ -0,0 +1,368 @@
|
|||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@ taglib uri = "http://java.sun.com/jsp/jstl/functions" prefix = "fn" %>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Digital Management Plans - Backend administration</title>
|
||||
|
||||
<!-- JQUERY -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
|
||||
|
||||
<!-- BOOTSTRAP -->
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||
<!-- Optional theme -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
|
||||
<!-- Latest compiled and minified JavaScript -->
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
|
||||
|
||||
<!-- Json formatter lib -->
|
||||
<script src="resources/js/jquery.json-viewer.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="resources/css/jquery.json-viewer.css">
|
||||
|
||||
<!-- Nice BS notifications -->
|
||||
<script src="resources/js/bootstrap-notify.min.js"></script>
|
||||
|
||||
<!-- Project resources (js, css, etc)-->
|
||||
<script src="resources/js/home.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="resources/css/home.css">
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
<div class="col-sm-8">
|
||||
|
||||
<h3>Digital Management Plans - Backend administration</h3>
|
||||
|
||||
<!--begin tabs going in wide content -->
|
||||
<ul class="nav nav-tabs content-tabs" id="maincontent" role="tablist">
|
||||
<li class="active"><a href="#manage" role="tab" data-toggle="tab">Manage DMPs</a></li>
|
||||
<li class=""><a href="#view" role="tab" data-toggle="tab">DMPs Viewer</a></li>
|
||||
<li class=""><a href="#create" role="tab" data-toggle="tab">Create a DMP model</a></li>
|
||||
</ul>
|
||||
<!--/.nav-tabs.content-tabs -->
|
||||
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane fade active in" id="manage">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>id</th>
|
||||
<th>Label</th>
|
||||
<th>Version</th>
|
||||
<th>Project</th>
|
||||
<th>Previous</th>
|
||||
<th>Content</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<c:forEach items="${DMPs}" var="dmp">
|
||||
<tr>
|
||||
<td>${dmp.id}</td>
|
||||
<td>${dmp.label}</td>
|
||||
<td>${dmp.version}</td>
|
||||
<td>
|
||||
<a href="#" data-toggle="tooltip" data-placement="auto bottom" title="${dmp.project}">${dmp.project.id}</a>
|
||||
</td>
|
||||
<td>${dmp.previous}</td>
|
||||
<td style='float: left;'>
|
||||
|
||||
<button class="btn btn-default" data-toggle="modal" data-target="#jsonModal" onclick="clickedShow(${fn:escapeXml(dmp)})">
|
||||
<span class="glyphicon glyphicon-search"></span>
|
||||
</button>
|
||||
|
||||
<button class="btn btn-default" onclick="clickedEdit('${dmp.project.id}')">
|
||||
<span class="glyphicon glyphicon-pencil"></span>
|
||||
</button>
|
||||
|
||||
<button class="btn btn-default" onclick="clickedDelete('${dmp.project.id}')">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</button>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!--/.tab-pane -->
|
||||
|
||||
<div class="tab-pane fade" id="view">
|
||||
|
||||
<c:forEach items="${DMPs}" var="dmp">
|
||||
<div class="well" onclick="loadTile(${fn:escapeXml(dmp)})">
|
||||
<a href="#">DMP <span class="badge">${dmp.id}</span></a>
|
||||
<div id="tile-${dmp.id}"></div>
|
||||
</div>
|
||||
</c:forEach>
|
||||
|
||||
</div>
|
||||
<!--/.tab-pane -->
|
||||
|
||||
|
||||
<div class="tab-pane fade" id="create" style="margin-top: 30px; margin-bottom: 30px;">
|
||||
|
||||
<form class="form-inline" method="POST" action="../rest/setDMPByForm">
|
||||
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">DatasetProfileRuleset</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label for="label">Label:</label>
|
||||
<input type="text" class="form-control" id="dpr-label" name="DatasetProfileRuleset.label">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="definition">Definition:</label>
|
||||
<input type="text" class="form-control" id="dpr-definition" name="DatasetProfileRuleset.definition">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">DatasetProfileViewStyle</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label for="label">Label:</label>
|
||||
<input type="text" class="form-control" id="dpv-label" name="DatasetProfileViewStyle.label">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="definition">Definition:</label>
|
||||
<input type="text" class="form-control" id="dpv-definition" name="DatasetProfileViewStyle.definition">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">DatasetProfile</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label for="label">Label:</label>
|
||||
<input type="text" class="form-control" id="dp-label" name="DatasetProfile.label">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="definition">Definition:</label>
|
||||
<input type="text" class="form-control" id="dp-definition" name="DatasetProfile.definition">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Project</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label for="label">Label:</label>
|
||||
<input type="text" class="form-control" id="p-label" name="Project.label">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="definition">Definition:</label>
|
||||
<input type="text" class="form-control" id="p-definition" name="Project.definition">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="reference">Reference:</label>
|
||||
<input type="text" class="form-control" id="p-reference" name="Project.reference">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="uri">URI:</label>
|
||||
<input type="text" class="form-control" id="p-uri" name="Project.uri">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">DMPProfile</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label for="label">Label:</label>
|
||||
<input type="text" class="form-control" id="dmpp-label" name="DMPProfile.label">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="definition">Definition:</label>
|
||||
<input type="text" class="form-control" id="dmpp-definition" name="DMPProfile.definition">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">DMP</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label for="label">Label:</label>
|
||||
<input type="text" class="form-control" id="dmp-label" name="DMP.label">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="previous">Previous:</label>
|
||||
<input type="text" class="form-control" id="dmp-previous" name="DMP.previous">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="version">Version:</label>
|
||||
<input type="text" class="form-control" id="dmp-version" name="DMP.version">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="profileData">Profile Data:</label>
|
||||
<input type="text" class="form-control" id="dmp-profileData" name="DMP.profileData">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">DataRepository</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label for="label">Label:</label>
|
||||
<input type="text" class="form-control" id="drep-label" name="DataRepository.label">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="definition">Definition:</label>
|
||||
<input type="text" class="form-control" id="drep-definition" name="DataRepository.definition">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="reference">Reference:</label>
|
||||
<input type="text" class="form-control" id="drep-reference" name="DataRepository.reference">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="uri">URI:</label>
|
||||
<input type="text" class="form-control" id="drep-uri" name="DataRepository.uri">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="abbr">Abbreviation:</label>
|
||||
<input type="text" class="form-control" id="drep-abbr" name="DataRepository.abbr">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Registry</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label for="label">Label:</label>
|
||||
<input type="text" class="form-control" id="reg-label" name="Registry.label">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="definition">Definition:</label>
|
||||
<input type="text" class="form-control" id="reg-definition" name="Registry.definition">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="reference">Reference:</label>
|
||||
<input type="text" class="form-control" id="reg-reference" name="Registry.reference">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="uri">URI:</label>
|
||||
<input type="text" class="form-control" id="reg-uri" name="Registry.uri">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="abbr">Abbreviation:</label>
|
||||
<input type="text" class="form-control" id="reg-abbr" name="Registry.abbr">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Service</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label for="label">Label:</label>
|
||||
<input type="text" class="form-control" id="s-label" name="Service.label">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="definition">Definition:</label>
|
||||
<input type="text" class="form-control" id="s-definition" name="Service.definition">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="reference">Reference:</label>
|
||||
<input type="text" class="form-control" id="s-reference" name="Service.reference">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="uri">URI:</label>
|
||||
<input type="text" class="form-control" id="s-uri" name="Service.uri">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="abbr">Abbreviation:</label>
|
||||
<input type="text" class="form-control" id="s-abbr" name="Service.abbr">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Dataset</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label for="label">Label:</label>
|
||||
<input type="text" class="form-control" id="datas-label" name="Dataset.label">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="uri">URI:</label>
|
||||
<input type="text" class="form-control" id="datas-uri" name="Dataset.uri">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="props">Properties:</label>
|
||||
<input type="text" class="form-control" id="datas-props" name="Dataset.props">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-default">Create</button> <button type="button" class="btn">Cancel</button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<!--/.tab-pane -->
|
||||
|
||||
|
||||
</div>
|
||||
<!--/.tab-content -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div id="jsonModal" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">DMP view</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
|
||||
<display-name>dmp-backend</display-name>
|
||||
<servlet>
|
||||
<servlet-name>dmp-backend-rest</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>dmp-backend-rest</servlet-name>
|
||||
<url-pattern>/rest/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
|
||||
|
||||
<servlet>
|
||||
<servlet-name>spring-web</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>spring-web</servlet-name>
|
||||
<url-pattern>/ui/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
|
||||
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>
|
||||
/WEB-INF/applicationContext.xml
|
||||
</param-value>
|
||||
</context-param>
|
||||
<session-config>
|
||||
<session-timeout>30</session-timeout>
|
||||
</session-config>
|
||||
</web-app>
|
|
@ -0,0 +1,74 @@
|
|||
div.form-group{
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
table {
|
||||
font-family: "Helvetica", "Lucida Sans", "Lucida Sans Unicode", "Luxi Sans", Tahoma, sans-serif;
|
||||
box-shadow: 1px 1px 10px rgba(0,0,0,0.5);
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
table {
|
||||
margin: auto;
|
||||
}
|
||||
table, td, th {
|
||||
padding: 7px;
|
||||
text-align: center;
|
||||
border: 1px solid rgb(8,48,107);
|
||||
}
|
||||
th {
|
||||
background-color: rgb(8,81,156);
|
||||
color: white;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
.node {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.overlay{
|
||||
background-color:#EEE;
|
||||
}
|
||||
|
||||
.node circle {
|
||||
fill: #fff;
|
||||
stroke: steelblue;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
.node text {
|
||||
font-size:10px;
|
||||
font-family:sans-serif;
|
||||
}
|
||||
|
||||
.link {
|
||||
fill: none;
|
||||
stroke: #ccc;
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
|
||||
.templink {
|
||||
fill: none;
|
||||
stroke: red;
|
||||
stroke-width: 3px;
|
||||
}
|
||||
|
||||
.ghostCircle.show{
|
||||
display:block;
|
||||
}
|
||||
|
||||
.ghostCircle, .activeDrag .ghostCircle{
|
||||
display: none;
|
||||
}
|
||||
|
||||
*/
|
|
@ -0,0 +1,47 @@
|
|||
/* Syntax highlighting for JSON objects */
|
||||
ul.json-dict, ol.json-array {
|
||||
list-style-type: none;
|
||||
margin: 0 0 0 1px;
|
||||
border-left: 1px dotted #ccc;
|
||||
padding-left: 2em;
|
||||
}
|
||||
.json-string {
|
||||
color: #0B7500;
|
||||
}
|
||||
.json-literal {
|
||||
color: #1A01CC;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Toggle button */
|
||||
a.json-toggle {
|
||||
position: relative;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
a.json-toggle:focus {
|
||||
outline: none;
|
||||
}
|
||||
a.json-toggle:before {
|
||||
color: #aaa;
|
||||
content: "\25BC"; /* down arrow */
|
||||
position: absolute;
|
||||
display: inline-block;
|
||||
width: 1em;
|
||||
left: -1em;
|
||||
}
|
||||
a.json-toggle.collapsed:before {
|
||||
transform: rotate(-90deg); /* Use rotated down arrow, prevents right arrow appearing smaller than down arrow in some browsers */
|
||||
-ms-transform: rotate(-90deg);
|
||||
-webkit-transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
/* Collapsable placeholder links */
|
||||
a.json-placeholder {
|
||||
color: #aaa;
|
||||
padding: 0 1em;
|
||||
text-decoration: none;
|
||||
}
|
||||
a.json-placeholder:hover {
|
||||
text-decoration: underline;
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,42 @@
|
|||
|
||||
|
||||
$(document).ready(function(){
|
||||
$('[data-toggle="tooltip"]').tooltip({html:true});
|
||||
});
|
||||
|
||||
|
||||
function clickedShow(dmp){
|
||||
$("#jsonModal").find("div.modal-body > p").jsonViewer(dmp, {withQuotes: true, collapsed: true});
|
||||
}
|
||||
|
||||
function clickedDelete(id){
|
||||
console.log(id);
|
||||
$.notify(
|
||||
{
|
||||
title: "<strong><b>Deleting is disabled</b></strong><br>",
|
||||
message: "Deleting DMPs is currently not allowed."
|
||||
},
|
||||
{
|
||||
type: 'danger'
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
function clickedEdit(id){
|
||||
console.log(id);
|
||||
$.notify({
|
||||
title: "<strong><b>Editing is disabled</b></strong><br>",
|
||||
message: "Editing DMPs is currently not allowed."
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
function loadTile(data){
|
||||
|
||||
if($("#tile-"+data.id).html() == ''){
|
||||
$("#tile-"+data.id).jsonViewer(data, {withQuotes: true, collapsed: true});
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,148 @@
|
|||
/**
|
||||
* jQuery json-viewer
|
||||
* @author: Alexandre Bodelot <alexandre.bodelot@gmail.com>
|
||||
*/
|
||||
(function($){
|
||||
|
||||
/**
|
||||
* Check if arg is either an array with at least 1 element, or a dict with at least 1 key
|
||||
* @return boolean
|
||||
*/
|
||||
function isCollapsable(arg) {
|
||||
return arg instanceof Object && Object.keys(arg).length > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a string represents a valid url
|
||||
* @return boolean
|
||||
*/
|
||||
function isUrl(string) {
|
||||
var regexp = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
|
||||
return regexp.test(string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform a json object into html representation
|
||||
* @return string
|
||||
*/
|
||||
function json2html(json, options) {
|
||||
var html = '';
|
||||
if (typeof json === 'string') {
|
||||
/* Escape tags */
|
||||
json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
||||
if (isUrl(json))
|
||||
html += '<a href="' + json + '" class="json-string">' + json + '</a>';
|
||||
else
|
||||
html += '<span class="json-string">"' + json + '"</span>';
|
||||
}
|
||||
else if (typeof json === 'number') {
|
||||
html += '<span class="json-literal">' + json + '</span>';
|
||||
}
|
||||
else if (typeof json === 'boolean') {
|
||||
html += '<span class="json-literal">' + json + '</span>';
|
||||
}
|
||||
else if (json === null) {
|
||||
html += '<span class="json-literal">null</span>';
|
||||
}
|
||||
else if (json instanceof Array) {
|
||||
if (json.length > 0) {
|
||||
html += '[<ol class="json-array">';
|
||||
for (var i = 0; i < json.length; ++i) {
|
||||
html += '<li>';
|
||||
/* Add toggle button if item is collapsable */
|
||||
if (isCollapsable(json[i])) {
|
||||
html += '<a href class="json-toggle"></a>';
|
||||
}
|
||||
html += json2html(json[i], options);
|
||||
/* Add comma if item is not last */
|
||||
if (i < json.length - 1) {
|
||||
html += ',';
|
||||
}
|
||||
html += '</li>';
|
||||
}
|
||||
html += '</ol>]';
|
||||
}
|
||||
else {
|
||||
html += '[]';
|
||||
}
|
||||
}
|
||||
else if (typeof json === 'object') {
|
||||
var key_count = Object.keys(json).length;
|
||||
if (key_count > 0) {
|
||||
html += '{<ul class="json-dict">';
|
||||
for (var key in json) {
|
||||
if (json.hasOwnProperty(key)) {
|
||||
html += '<li>';
|
||||
var keyRepr = options.withQuotes ?
|
||||
'<span class="json-string">"' + key + '"</span>' : key;
|
||||
/* Add toggle button if item is collapsable */
|
||||
if (isCollapsable(json[key])) {
|
||||
html += '<a href class="json-toggle">' + keyRepr + '</a>';
|
||||
}
|
||||
else {
|
||||
html += keyRepr;
|
||||
}
|
||||
html += ': ' + json2html(json[key], options);
|
||||
/* Add comma if item is not last */
|
||||
if (--key_count > 0)
|
||||
html += ',';
|
||||
html += '</li>';
|
||||
}
|
||||
}
|
||||
html += '</ul>}';
|
||||
}
|
||||
else {
|
||||
html += '{}';
|
||||
}
|
||||
}
|
||||
return html;
|
||||
}
|
||||
|
||||
/**
|
||||
* jQuery plugin method
|
||||
* @param json: a javascript object
|
||||
* @param options: an optional options hash
|
||||
*/
|
||||
$.fn.jsonViewer = function(json, options) {
|
||||
options = options || {};
|
||||
|
||||
/* jQuery chaining */
|
||||
return this.each(function() {
|
||||
|
||||
/* Transform to HTML */
|
||||
var html = json2html(json, options);
|
||||
if (isCollapsable(json))
|
||||
html = '<a href class="json-toggle"></a>' + html;
|
||||
|
||||
/* Insert HTML in target DOM element */
|
||||
$(this).html(html);
|
||||
|
||||
/* Bind click on toggle buttons */
|
||||
$(this).off('click');
|
||||
$(this).on('click', 'a.json-toggle', function() {
|
||||
var target = $(this).toggleClass('collapsed').siblings('ul.json-dict, ol.json-array');
|
||||
target.toggle();
|
||||
if (target.is(':visible')) {
|
||||
target.siblings('.json-placeholder').remove();
|
||||
}
|
||||
else {
|
||||
var count = target.children('li').length;
|
||||
var placeholder = count + (count > 1 ? ' items' : ' item');
|
||||
target.after('<a href class="json-placeholder">' + placeholder + '</a>');
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
/* Simulate click on toggle button when placeholder is clicked */
|
||||
$(this).on('click', 'a.json-placeholder', function() {
|
||||
$(this).siblings('a.json-toggle').click();
|
||||
return false;
|
||||
});
|
||||
|
||||
if (options.collapsed == true) {
|
||||
/* Trigger click to collapse all nodes */
|
||||
$(this).find('a.json-toggle').click();
|
||||
}
|
||||
});
|
||||
};
|
||||
})(jQuery);
|
|
@ -0,0 +1,65 @@
|
|||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"project": {
|
||||
"name": "forms-cli"
|
||||
},
|
||||
"apps": [
|
||||
{
|
||||
"root": "src",
|
||||
"outDir": "dist",
|
||||
"assets": [
|
||||
"assets",
|
||||
"favicon.ico"
|
||||
],
|
||||
"index": "index.html",
|
||||
"main": "main.ts",
|
||||
"polyfills": "polyfills.ts",
|
||||
"test": "test.ts",
|
||||
"tsconfig": "tsconfig.app.json",
|
||||
"testTsconfig": "tsconfig.spec.json",
|
||||
"prefix": "app",
|
||||
"styles": [
|
||||
"./../node_modules/bootstrap/dist/css/bootstrap.min.css",
|
||||
"styles.css"
|
||||
],
|
||||
"scripts": [
|
||||
"./../node_modules/jquery/dist/jquery.min.js",
|
||||
"./../node_modules/bootstrap/dist/js/bootstrap.min.js",
|
||||
"./assets/xml2json.min.js"
|
||||
],
|
||||
"environmentSource": "environments/environment.ts",
|
||||
"environments": {
|
||||
"dev": "environments/environment.ts",
|
||||
"prod": "environments/environment.prod.ts"
|
||||
}
|
||||
}
|
||||
],
|
||||
"e2e": {
|
||||
"protractor": {
|
||||
"config": "./protractor.conf.js"
|
||||
}
|
||||
},
|
||||
"lint": [
|
||||
{
|
||||
"project": "src/tsconfig.app.json",
|
||||
"exclude": "**/node_modules/**"
|
||||
},
|
||||
{
|
||||
"project": "src/tsconfig.spec.json",
|
||||
"exclude": "**/node_modules/**"
|
||||
},
|
||||
{
|
||||
"project": "e2e/tsconfig.e2e.json",
|
||||
"exclude": "**/node_modules/**"
|
||||
}
|
||||
],
|
||||
"test": {
|
||||
"karma": {
|
||||
"config": "./karma.conf.js"
|
||||
}
|
||||
},
|
||||
"defaults": {
|
||||
"styleExt": "css",
|
||||
"component": {}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
# Editor configuration, see http://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
|
@ -0,0 +1,43 @@
|
|||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# compiled output
|
||||
/dist
|
||||
/tmp
|
||||
/out-tsc
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
|
||||
# IDEs and editors
|
||||
/.idea
|
||||
.project
|
||||
.classpath
|
||||
.c9/
|
||||
*.launch
|
||||
.settings/
|
||||
*.sublime-workspace
|
||||
|
||||
# IDE - VSCode
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
|
||||
# misc
|
||||
/.sass-cache
|
||||
/connect.lock
|
||||
/coverage
|
||||
/libpeerconnection.log
|
||||
npm-debug.log
|
||||
testem.log
|
||||
/typings
|
||||
yarn-error.log
|
||||
|
||||
# e2e
|
||||
/e2e/*.js
|
||||
/e2e/*.map
|
||||
|
||||
# System Files
|
||||
.DS_Store
|
||||
Thumbs.db
|
|
@ -0,0 +1,28 @@
|
|||
# FormsCli
|
||||
|
||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.3.1.
|
||||
|
||||
## Development server
|
||||
|
||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
|
||||
|
||||
## Build
|
||||
|
||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
||||
|
||||
## Running end-to-end tests
|
||||
|
||||
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
|
||||
Before running the tests make sure you are serving the app via `ng serve`.
|
||||
|
||||
## Further help
|
||||
|
||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
|
|
@ -0,0 +1,14 @@
|
|||
import { AppPage } from './app.po';
|
||||
|
||||
describe('forms-cli App', () => {
|
||||
let page: AppPage;
|
||||
|
||||
beforeEach(() => {
|
||||
page = new AppPage();
|
||||
});
|
||||
|
||||
it('should display welcome message', () => {
|
||||
page.navigateTo();
|
||||
expect(page.getParagraphText()).toEqual('Welcome to app!');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,11 @@
|
|||
import { browser, by, element } from 'protractor';
|
||||
|
||||
export class AppPage {
|
||||
navigateTo() {
|
||||
return browser.get('/');
|
||||
}
|
||||
|
||||
getParagraphText() {
|
||||
return element(by.css('app-root h1')).getText();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/e2e",
|
||||
"baseUrl": "./",
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"types": [
|
||||
"jasmine",
|
||||
"jasminewd2",
|
||||
"node"
|
||||
]
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue