no message
This commit is contained in:
parent
067e0528dc
commit
9da5a8a17b
|
@ -1,202 +1,207 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<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">
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>dmp-backend</groupId>
|
<groupId>dmp-backend</groupId>
|
||||||
<artifactId>dmp-backend</artifactId>
|
<artifactId>dmp-backend</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>1.5.9.RELEASE</version>
|
<version>1.5.9.RELEASE</version>
|
||||||
</parent>
|
</parent>
|
||||||
<properties>
|
<properties>
|
||||||
<project.http.version>1.19.0</project.http.version>
|
<project.http.version>1.19.0</project.http.version>
|
||||||
<project.oauth.version>1.19.0</project.oauth.version>
|
<project.oauth.version>1.19.0</project.oauth.version>
|
||||||
|
|
||||||
<dmp-backend-commons.version>0.0.1-SNAPSHOT</dmp-backend-commons.version>
|
<dmp-backend-commons.version>0.0.1-SNAPSHOT</dmp-backend-commons.version>
|
||||||
<org.springframework.version>4.3.8.RELEASE</org.springframework.version>
|
<org.springframework.version>4.3.8.RELEASE</org.springframework.version>
|
||||||
<!-- <org.springframework.eu.eudat.security.version>3.2.10.RELEASE</org.springframework.eu.eudat.security.version> -->
|
<!-- <org.springframework.eu.eudat.security.version>3.2.10.RELEASE</org.springframework.eu.eudat.security.version> -->
|
||||||
<org.springframework.security.version>4.2.3.RELEASE</org.springframework.security.version>
|
<org.springframework.security.version>4.2.3.RELEASE</org.springframework.security.version>
|
||||||
<com.sun.jersey.version>1.19.1</com.sun.jersey.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>
|
<org.apache.tomcat.tomcat-jdbc.version>7.0.35</org.apache.tomcat.tomcat-jdbc.version>
|
||||||
<com.fasterxml.jackson>2.8.4</com.fasterxml.jackson>
|
<com.fasterxml.jackson>2.8.4</com.fasterxml.jackson>
|
||||||
|
|
||||||
<hibernate.version>5.2.11.Final</hibernate.version>
|
<hibernate.version>5.2.11.Final</hibernate.version>
|
||||||
|
|
||||||
<commons-codec.version>1.9</commons-codec.version>
|
<commons-codec.version>1.9</commons-codec.version>
|
||||||
<org.junit.version>4.11</org.junit.version>
|
<org.junit.version>4.11</org.junit.version>
|
||||||
<log4j.version>1.2.17</log4j.version>
|
<log4j.version>1.2.17</log4j.version>
|
||||||
<slf4j.version>1.7.12</slf4j.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/ -->
|
<jetty.version>9.0.7.v20131107
|
||||||
<logback.version>1.1.1</logback.version>
|
</jetty.version> <!-- Adapt this to a version found on http://repo.maven.apache.org/maven2/org/eclipse/jetty/jetty-maven-plugin/ -->
|
||||||
<javax.inject.version>1</javax.inject.version>
|
<logback.version>1.1.1</logback.version>
|
||||||
<javax.servlet.servlet-api.version>3.0.1</javax.servlet.servlet-api.version>
|
<javax.inject.version>1</javax.inject.version>
|
||||||
<!-- <jcloverslf4j.version>1.7.6</jcloverslf4j.version> -->
|
<javax.servlet.servlet-api.version>3.0.1</javax.servlet.servlet-api.version>
|
||||||
</properties>
|
<!-- <jcloverslf4j.version>1.7.6</jcloverslf4j.version> -->
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- <dependency> -->
|
<!-- <dependency> -->
|
||||||
<!-- <groupId>dmp-backend</groupId> -->
|
<!-- <groupId>dmp-backend</groupId> -->
|
||||||
<!-- <artifactId>dmp-backend-commons</artifactId> -->
|
<!-- <artifactId>dmp-backend-commons</artifactId> -->
|
||||||
<!-- <version>${dmp-backend-commons.version}</version> -->
|
<!-- <version>${dmp-backend-commons.version}</version> -->
|
||||||
<!-- </dependency> -->
|
<!-- </dependency> -->
|
||||||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
|
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
|
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
|
||||||
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
|
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.json</groupId>
|
<groupId>org.json</groupId>
|
||||||
<artifactId>json</artifactId>
|
<artifactId>json</artifactId>
|
||||||
<version>20160810</version>
|
<version>20160810</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-devtools</artifactId>
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hibernate</groupId>
|
<groupId>org.hibernate</groupId>
|
||||||
<artifactId>hibernate-core</artifactId>
|
<artifactId>hibernate-core</artifactId>
|
||||||
<version>${hibernate.version}</version>
|
<version>${hibernate.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.hibernate</groupId>
|
|
||||||
<artifactId>hibernate-c3p0</artifactId>
|
|
||||||
<version>${hibernate.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.google.api-client/google-api-client -->
|
<dependency>
|
||||||
<dependency>
|
<groupId>org.hibernate</groupId>
|
||||||
<groupId>com.google.api-client</groupId>
|
<artifactId>hibernate-c3p0</artifactId>
|
||||||
<artifactId>google-api-client</artifactId>
|
<version>${hibernate.version}</version>
|
||||||
<version>1.23.0</version>
|
</dependency>
|
||||||
</dependency>
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.jayway.jsonpath/json-path -->
|
<!-- https://mvnrepository.com/artifact/com.google.api-client/google-api-client -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.jayway.jsonpath</groupId>
|
<groupId>com.google.api-client</groupId>
|
||||||
<artifactId>json-path</artifactId>
|
<artifactId>google-api-client</artifactId>
|
||||||
<version>2.4.0</version>
|
<version>1.23.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/com.jayway.jsonpath/json-path -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jayway.jsonpath</groupId>
|
||||||
|
<artifactId>json-path</artifactId>
|
||||||
|
<version>2.4.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-xml -->
|
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-xml -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||||
<artifactId>jackson-dataformat-xml</artifactId>
|
<artifactId>jackson-dataformat-xml</artifactId>
|
||||||
<version>2.9.3</version>
|
<version>2.9.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.security</groupId>
|
<groupId>org.springframework.security</groupId>
|
||||||
<artifactId>spring-security-web</artifactId>
|
<artifactId>spring-security-web</artifactId>
|
||||||
<version>4.2.3.RELEASE</version>
|
<version>4.2.3.RELEASE</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- g/a spring -->
|
<!-- g/a spring -->
|
||||||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
|
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
|
<dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
|
<groupId>org.springframework.boot</groupId>
|
||||||
<dependency>
|
<artifactId>spring-boot-starter-mail</artifactId>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
</dependency>
|
||||||
<artifactId>jackson-databind</artifactId>
|
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
|
||||||
<exclusions>
|
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
|
||||||
<exclusion>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-annotations</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
</exclusion>
|
<exclusions>
|
||||||
</exclusions>
|
<exclusion>
|
||||||
</dependency>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-annotations</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-annotations</artifactId>
|
<artifactId>jackson-annotations</artifactId>
|
||||||
<version>2.9.0</version>
|
<version>2.9.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
|
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-context</artifactId>
|
<artifactId>spring-context</artifactId>
|
||||||
<version>4.3.10.RELEASE</version>
|
<version>4.3.10.RELEASE</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- guava eu.eudat.cache -->
|
<!-- guava eu.eudat.cache -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>23.0</version>
|
<version>23.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context-support -->
|
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context-support -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-context-support</artifactId>
|
<artifactId>spring-context-support</artifactId>
|
||||||
<version>4.0.0.RELEASE</version>
|
<version>4.0.0.RELEASE</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/junit/junit -->
|
<!-- https://mvnrepository.com/artifact/junit/junit -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>4.12</version>
|
<version>4.12</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>postgresql</groupId>
|
<groupId>postgresql</groupId>
|
||||||
<artifactId>postgresql</artifactId>
|
<artifactId>postgresql</artifactId>
|
||||||
<version>9.1-901.jdbc4</version>
|
<version>9.1-901.jdbc4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.springfox</groupId>
|
|
||||||
<artifactId>springfox-swagger-ui</artifactId>
|
|
||||||
<version>2.7.0</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Various libs -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-lang3</artifactId>
|
|
||||||
<version>3.5</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
<dependency>
|
||||||
<plugins>
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger-ui</artifactId>
|
||||||
|
<version>2.7.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<source>1.8</source>
|
|
||||||
<target>1.8</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
</plugins>
|
<!-- Various libs -->
|
||||||
|
<dependency>
|
||||||
<finalName>${project.artifactId}</finalName>
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
</build>
|
<version>3.5</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
</plugins>
|
||||||
|
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
|
@ -3,10 +3,13 @@ package eu.eudat.controllers;
|
||||||
import eu.eudat.managers.InvitationsManager;
|
import eu.eudat.managers.InvitationsManager;
|
||||||
import eu.eudat.models.helpers.responses.ResponseItem;
|
import eu.eudat.models.helpers.responses.ResponseItem;
|
||||||
import eu.eudat.models.invitation.Invitation;
|
import eu.eudat.models.invitation.Invitation;
|
||||||
|
import eu.eudat.models.security.Principal;
|
||||||
import eu.eudat.models.userinfo.UserInfoInvitationModel;
|
import eu.eudat.models.userinfo.UserInfoInvitationModel;
|
||||||
import eu.eudat.models.userinfo.UserInfoRequestItem;
|
import eu.eudat.models.userinfo.UserInfoRequestItem;
|
||||||
import eu.eudat.services.ApiContext;
|
import eu.eudat.services.ApiContext;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -24,12 +27,14 @@ public class UserInvitationController extends BaseController{
|
||||||
super(apiContext);
|
super(apiContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
@RequestMapping(method = RequestMethod.POST, value = { "/users" }, consumes = "application/json", produces="application/json")
|
@RequestMapping(method = RequestMethod.POST, value = { "/users" }, consumes = "application/json", produces="application/json")
|
||||||
public @ResponseBody ResponseItem<Invitation> users(@RequestBody Invitation invitation) {
|
public @ResponseBody ResponseItem<Invitation> users(@RequestBody Invitation invitation, Principal principal) {
|
||||||
try {
|
try {
|
||||||
InvitationsManager.inviteUsers(this.getApiContext(),invitation);
|
InvitationsManager.inviteUsers(this.getApiContext(),invitation,principal);
|
||||||
return new ResponseItem<Invitation>().message("Users have beeen invited");
|
return new ResponseItem<Invitation>().status(HttpStatus.OK).message("Users have beeen invited");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
return new ResponseItem<Invitation>().message(e.getMessage());
|
return new ResponseItem<Invitation>().message(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,9 +43,10 @@ public class UserInvitationController extends BaseController{
|
||||||
public @ResponseBody ResponseItem<List<UserInfoInvitationModel>> getUsers(@RequestBody UserInfoRequestItem userInfoRequestItem) {
|
public @ResponseBody ResponseItem<List<UserInfoInvitationModel>> getUsers(@RequestBody UserInfoRequestItem userInfoRequestItem) {
|
||||||
try {
|
try {
|
||||||
List<UserInfoInvitationModel> users = InvitationsManager.getUsers(this.getApiContext(),userInfoRequestItem);
|
List<UserInfoInvitationModel> users = InvitationsManager.getUsers(this.getApiContext(),userInfoRequestItem);
|
||||||
return new ResponseItem<List<UserInfoInvitationModel>>().payload(users);
|
return new ResponseItem<List<UserInfoInvitationModel>>().status(HttpStatus.OK).payload(users);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return new ResponseItem<List<UserInfoInvitationModel>>().message(e.getMessage());
|
e.printStackTrace();
|
||||||
|
return new ResponseItem<List<UserInfoInvitationModel>>().status(HttpStatus.BAD_REQUEST).message(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package eu.eudat.entities;
|
package eu.eudat.entities;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
|
@ -14,6 +15,8 @@ import java.util.UUID;
|
||||||
public class Invitation implements DataEntity<Invitation>{
|
public class Invitation implements DataEntity<Invitation>{
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||||
@Column(name = "\"Id\"", updatable = false, nullable = false)
|
@Column(name = "\"Id\"", updatable = false, nullable = false)
|
||||||
private UUID id;
|
private UUID id;
|
||||||
|
|
||||||
|
@ -31,6 +34,9 @@ public class Invitation implements DataEntity<Invitation>{
|
||||||
@Column(name = "\"Token\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
@Column(name = "\"Token\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||||
private UUID token;
|
private UUID token;
|
||||||
|
|
||||||
|
@Column(name = "\"AcceptedInvitation\"", nullable = false)
|
||||||
|
private boolean acceptedInvitation;
|
||||||
|
|
||||||
@Type(type="eu.eudat.typedefinition.XMLType")
|
@Type(type="eu.eudat.typedefinition.XMLType")
|
||||||
@Column(name = "\"Properties\"", columnDefinition = "xml", nullable = true)
|
@Column(name = "\"Properties\"", columnDefinition = "xml", nullable = true)
|
||||||
private String properties;
|
private String properties;
|
||||||
|
@ -83,6 +89,14 @@ public class Invitation implements DataEntity<Invitation>{
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getAcceptedInvitation() {
|
||||||
|
return acceptedInvitation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAcceptedInvitation(boolean acceptedInvitation) {
|
||||||
|
this.acceptedInvitation = acceptedInvitation;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Invitation entity) {
|
public void update(Invitation entity) {
|
||||||
|
|
||||||
|
|
|
@ -165,6 +165,6 @@ public class UserInfo implements Serializable,DataEntity<UserInfo>{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] getKeys() {
|
public Object[] getKeys() {
|
||||||
return new Object[0];
|
return new UUID[]{this.id == null ? null : this.id};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ public class FieldSet implements DatabaseViewStyleDefinition,XmlSerializable<Fie
|
||||||
private String description;
|
private String description;
|
||||||
private String extendedDescription;
|
private String extendedDescription;
|
||||||
private Multiplicity multiplicity;
|
private Multiplicity multiplicity;
|
||||||
|
private boolean hasCommentField;
|
||||||
public List<Field> getFields() {
|
public List<Field> getFields() {
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
@ -76,12 +77,20 @@ public class FieldSet implements DatabaseViewStyleDefinition,XmlSerializable<Fie
|
||||||
this.multiplicity = multiplicity;
|
this.multiplicity = multiplicity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getHasCommentField() {
|
||||||
|
return hasCommentField;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasCommentField(boolean hasCommentField) {
|
||||||
|
this.hasCommentField = hasCommentField;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Element toXml(Document doc) {
|
public Element toXml(Document doc) {
|
||||||
Element fieldSet = doc.createElement("fieldSet");
|
Element fieldSet = doc.createElement("fieldSet");
|
||||||
fieldSet.setAttribute("id", this.id);
|
fieldSet.setAttribute("id", this.id);
|
||||||
fieldSet.setAttribute("ordinal", ""+this.ordinal);
|
fieldSet.setAttribute("ordinal", ""+this.ordinal);
|
||||||
|
fieldSet.setAttribute("hasCommentField",""+this.hasCommentField);
|
||||||
Element title = doc.createElement("title");
|
Element title = doc.createElement("title");
|
||||||
title.setTextContent(this.title);
|
title.setTextContent(this.title);
|
||||||
|
|
||||||
|
@ -114,6 +123,7 @@ public class FieldSet implements DatabaseViewStyleDefinition,XmlSerializable<Fie
|
||||||
this.id = element.getAttribute("id");
|
this.id = element.getAttribute("id");
|
||||||
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
this.ordinal = Integer.parseInt(element.getAttribute("ordinal"));
|
||||||
this.fields = new LinkedList();
|
this.fields = new LinkedList();
|
||||||
|
this.hasCommentField = Boolean.parseBoolean(element.getAttribute("hasCommentField"));
|
||||||
Element title = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "title");
|
Element title = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "title");
|
||||||
this.title = title.getTextContent();
|
this.title = title.getTextContent();
|
||||||
Element description = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "description");
|
Element description = (Element)XmlBuilder.getNodeFromListByTagName(element.getChildNodes(), "description");
|
||||||
|
|
|
@ -3,6 +3,7 @@ package eu.eudat.managers;
|
||||||
import eu.eudat.entities.DMP;
|
import eu.eudat.entities.DMP;
|
||||||
import eu.eudat.entities.UserInfo;
|
import eu.eudat.entities.UserInfo;
|
||||||
import eu.eudat.models.invitation.Invitation;
|
import eu.eudat.models.invitation.Invitation;
|
||||||
|
import eu.eudat.models.security.Principal;
|
||||||
import eu.eudat.models.userinfo.UserInfoInvitationModel;
|
import eu.eudat.models.userinfo.UserInfoInvitationModel;
|
||||||
import eu.eudat.models.userinfo.UserInfoRequestItem;
|
import eu.eudat.models.userinfo.UserInfoRequestItem;
|
||||||
import eu.eudat.queryable.QueryableList;
|
import eu.eudat.queryable.QueryableList;
|
||||||
|
@ -17,11 +18,13 @@ import java.util.stream.Collectors;
|
||||||
*/
|
*/
|
||||||
public class InvitationsManager {
|
public class InvitationsManager {
|
||||||
|
|
||||||
public static void inviteUsers(ApiContext apiContext, Invitation invitation) {
|
public static void inviteUsers(ApiContext apiContext, Invitation invitation, Principal principal) {
|
||||||
|
UserInfo principalUser = new UserInfo();
|
||||||
|
principalUser.setId(principal.getId());
|
||||||
List<UserInfoInvitationModel> alreadySignedInUsers = invitation.getUsers().stream().filter(item -> item.getId() != null).collect(Collectors.toList());
|
List<UserInfoInvitationModel> alreadySignedInUsers = invitation.getUsers().stream().filter(item -> item.getId() != null).collect(Collectors.toList());
|
||||||
List<UserInfo> alreadySignedInUsersEntities = new DomainModelConverter<UserInfo, UserInfoInvitationModel>().toDataModel(alreadySignedInUsers);
|
List<UserInfo> alreadySignedInUsersEntities = new DomainModelConverter<UserInfo, UserInfoInvitationModel>().toDataModel(alreadySignedInUsers);
|
||||||
DMP dataManagementPlan = apiContext.getDatabaseRepository().getDmpDao().find(invitation.getDataManagementPlan());
|
DMP dataManagementPlan = apiContext.getDatabaseRepository().getDmpDao().find(invitation.getDataManagementPlan());
|
||||||
apiContext.getInvitationService().createInvitations(apiContext.getDatabaseRepository().getInvitationDao(),new DomainModelConverter<UserInfo, UserInfoInvitationModel>().toDataModel(invitation.getUsers()),dataManagementPlan);
|
apiContext.getInvitationService().createInvitations(apiContext.getDatabaseRepository().getInvitationDao(),new DomainModelConverter<UserInfo, UserInfoInvitationModel>().toDataModel(invitation.getUsers()),dataManagementPlan,principalUser);
|
||||||
apiContext.getInvitationService().assignToDmp(apiContext.getDatabaseRepository().getDmpDao(), alreadySignedInUsersEntities, dataManagementPlan);
|
apiContext.getInvitationService().assignToDmp(apiContext.getDatabaseRepository().getDmpDao(), alreadySignedInUsersEntities, dataManagementPlan);
|
||||||
apiContext.getInvitationService().sendInvitations(invitation.getUsers());
|
apiContext.getInvitationService().sendInvitations(invitation.getUsers());
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.entiti
|
||||||
private String title;
|
private String title;
|
||||||
private String description;
|
private String description;
|
||||||
private String extendedDescription;
|
private String extendedDescription;
|
||||||
|
private boolean hasCommentField;
|
||||||
private List<Field> fields;
|
private List<Field> fields;
|
||||||
|
|
||||||
public List<Field> getFields() {
|
public List<Field> getFields() {
|
||||||
|
@ -79,6 +79,14 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.entiti
|
||||||
this.extendedDescription = extendedDescription;
|
this.extendedDescription = extendedDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getHasCommentField() {
|
||||||
|
return hasCommentField;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasCommentField(boolean hasCommentField) {
|
||||||
|
this.hasCommentField = hasCommentField;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet toDatabaseDefinition(eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet item) {
|
public eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet toDatabaseDefinition(eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet item) {
|
||||||
if(this.id == null||this.id.isEmpty())this.id = "fieldSet_"+RandomStringUtils.random(5, true, true);
|
if(this.id == null||this.id.isEmpty())this.id = "fieldSet_"+RandomStringUtils.random(5, true, true);
|
||||||
|
@ -91,6 +99,7 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.entiti
|
||||||
item.setExtendedDescription(this.extendedDescription);
|
item.setExtendedDescription(this.extendedDescription);
|
||||||
item.setOrdinal(this.ordinal);
|
item.setOrdinal(this.ordinal);
|
||||||
item.setMultiplicity(this.multiplicity);
|
item.setMultiplicity(this.multiplicity);
|
||||||
|
item.setHasCommentField(this.hasCommentField);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,6 +112,7 @@ public class FieldSet implements Comparable, ViewStyleDefinition<eu.eudat.entiti
|
||||||
this.extendedDescription = item.getExtendedDescription();
|
this.extendedDescription = item.getExtendedDescription();
|
||||||
this.title = item.getTitle();
|
this.title = item.getTitle();
|
||||||
this.multiplicity = item.getMultiplicity();
|
this.multiplicity = item.getMultiplicity();
|
||||||
|
this.hasCommentField = item.getHasCommentField();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
package eu.eudat.models.mail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by ikalyvas on 1/5/2018.
|
||||||
|
*/
|
||||||
|
public class SimpleMail {
|
||||||
|
private String from;
|
||||||
|
private String to;
|
||||||
|
private String subject;
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
public SimpleMail() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public SimpleMail(String from, String to, String subject, String content) {
|
||||||
|
this.from = from;
|
||||||
|
this.to = to;
|
||||||
|
this.subject = subject;
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFrom() {
|
||||||
|
return from;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFrom(String from) {
|
||||||
|
this.from = from;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTo() {
|
||||||
|
return to;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTo(String to) {
|
||||||
|
this.to = to;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSubject() {
|
||||||
|
return subject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubject(String subject) {
|
||||||
|
this.subject = subject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(String content) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,6 +21,7 @@ public class FieldSet implements Comparable,PropertiesModelBuilder, ViewStyleDef
|
||||||
private Multiplicity multiplicity;
|
private Multiplicity multiplicity;
|
||||||
private List<Field> fields;
|
private List<Field> fields;
|
||||||
private List<FieldSet> multiplicityItems;
|
private List<FieldSet> multiplicityItems;
|
||||||
|
private boolean hasCommentField;
|
||||||
public List<Field> getFields() {
|
public List<Field> getFields() {
|
||||||
Collections.sort(this.fields);
|
Collections.sort(this.fields);
|
||||||
return fields;
|
return fields;
|
||||||
|
@ -92,6 +93,13 @@ public class FieldSet implements Comparable,PropertiesModelBuilder, ViewStyleDef
|
||||||
this.ordinal = ordinal;
|
this.ordinal = ordinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getHasCommentField() {
|
||||||
|
return hasCommentField;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasCommentField(boolean hasCommentField) {
|
||||||
|
this.hasCommentField = hasCommentField;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet toDatabaseDefinition(eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet item) {
|
public eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet toDatabaseDefinition(eu.eudat.entities.xmlmodels.datasetprofiledefinition.FieldSet item) {
|
||||||
|
@ -99,6 +107,8 @@ public class FieldSet implements Comparable,PropertiesModelBuilder, ViewStyleDef
|
||||||
item.setFields(viewStylefields);
|
item.setFields(viewStylefields);
|
||||||
item.setId(this.id);
|
item.setId(this.id);
|
||||||
item.setOrdinal(this.ordinal);
|
item.setOrdinal(this.ordinal);
|
||||||
|
item.setHasCommentField(this.hasCommentField);
|
||||||
|
item.setMultiplicity(this.multiplicity);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,6 +120,8 @@ public class FieldSet implements Comparable,PropertiesModelBuilder, ViewStyleDef
|
||||||
this.title = item.getTitle();
|
this.title = item.getTitle();
|
||||||
this.description = item.getDescription();
|
this.description = item.getDescription();
|
||||||
this.extendedDescription = item.getExtendedDescription();
|
this.extendedDescription = item.getExtendedDescription();
|
||||||
|
this.hasCommentField = item.getHasCommentField();
|
||||||
|
this.multiplicity = item.getMultiplicity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,4 +11,5 @@ public interface ApiContext {
|
||||||
ApplicationContext getApplicationContext();
|
ApplicationContext getApplicationContext();
|
||||||
InvitationService getInvitationService();
|
InvitationService getInvitationService();
|
||||||
RemoteFetcher getRemoteFetcher();
|
RemoteFetcher getRemoteFetcher();
|
||||||
|
MailService getMailService();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ public class ApiContextImpl implements ApiContext{
|
||||||
private ApplicationContext applicationContext;
|
private ApplicationContext applicationContext;
|
||||||
private RemoteFetcher remoteFetcher;
|
private RemoteFetcher remoteFetcher;
|
||||||
private InvitationService invitationService;
|
private InvitationService invitationService;
|
||||||
|
private MailService mailService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public void setDatabaseRepository(DatabaseRepository databaseRepository) {
|
public void setDatabaseRepository(DatabaseRepository databaseRepository) {
|
||||||
|
@ -55,4 +56,14 @@ public class ApiContextImpl implements ApiContext{
|
||||||
public void setInvitationService(InvitationService invitationService) {
|
public void setInvitationService(InvitationService invitationService) {
|
||||||
this.invitationService = invitationService;
|
this.invitationService = invitationService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MailService getMailService() {
|
||||||
|
return mailService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public void setMailService(MailService mailService) {
|
||||||
|
this.mailService = mailService;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ public interface InvitationService {
|
||||||
|
|
||||||
void assignToDmp(DMPDao dmpDao, eu.eudat.entities.UserInfo user, DMP dmp);
|
void assignToDmp(DMPDao dmpDao, eu.eudat.entities.UserInfo user, DMP dmp);
|
||||||
|
|
||||||
void createInvitations(InvitationDao invitationDao, List<eu.eudat.entities.UserInfo> users, DMP dmp);
|
void createInvitations(InvitationDao invitationDao, List<eu.eudat.entities.UserInfo> users, DMP dmp, eu.eudat.entities.UserInfo creator);
|
||||||
|
|
||||||
void sendInvitations(List<UserInfoInvitationModel> users);
|
void sendInvitations(List<UserInfoInvitationModel> users);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,13 +31,14 @@ public class InvitationServiceImpl implements InvitationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createInvitations(InvitationDao invitationDao, List<eu.eudat.entities.UserInfo> users, DMP dmp) {
|
public void createInvitations(InvitationDao invitationDao, List<eu.eudat.entities.UserInfo> users, DMP dmp, eu.eudat.entities.UserInfo creator) {
|
||||||
for(eu.eudat.entities.UserInfo userInfo : users){
|
for(eu.eudat.entities.UserInfo userInfo : users){
|
||||||
Invitation invitation = new Invitation();
|
Invitation invitation = new Invitation();
|
||||||
invitation.setDmp(dmp);
|
invitation.setDmp(dmp);
|
||||||
invitation.setInvitationEmail(userInfo.getEmail());
|
invitation.setInvitationEmail(userInfo.getEmail());
|
||||||
invitation.setUser(userInfo);
|
invitation.setUser(creator);
|
||||||
invitation.setToken(UUID.randomUUID());
|
invitation.setToken(UUID.randomUUID());
|
||||||
|
invitation.setAcceptedInvitation(userInfo.getId()!=null);
|
||||||
invitationDao.createOrUpdate(invitation);
|
invitationDao.createOrUpdate(invitation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package eu.eudat.services;
|
||||||
|
|
||||||
|
import eu.eudat.models.mail.SimpleMail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by ikalyvas on 1/5/2018.
|
||||||
|
*/
|
||||||
|
public interface MailService {
|
||||||
|
void sendSimpleMail(SimpleMail mail);
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package eu.eudat.services;
|
||||||
|
|
||||||
|
import eu.eudat.models.mail.SimpleMail;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.mail.SimpleMailMessage;
|
||||||
|
import org.springframework.mail.javamail.JavaMailSender;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by ikalyvas on 1/5/2018.
|
||||||
|
*/
|
||||||
|
@Service("mailService")
|
||||||
|
public class MailServiceImpl implements MailService{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JavaMailSender emailSender;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendSimpleMail(SimpleMail mail) {
|
||||||
|
SimpleMailMessage message = new SimpleMailMessage();
|
||||||
|
message.setSubject(mail.getSubject());
|
||||||
|
message.setText(mail.getContent());
|
||||||
|
message.setTo(mail.getTo());
|
||||||
|
message.setFrom(mail.getFrom());
|
||||||
|
this.emailSender.send(message);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { InvitationComponent } from './invitation/invitation.component';
|
||||||
import { UnauthorizedComponent } from './unauthorized/unauthorized.component';
|
import { UnauthorizedComponent } from './unauthorized/unauthorized.component';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
@ -29,7 +30,7 @@ const appRoutes: Routes = [
|
||||||
{ path: 'dataset/new', component: DatasetWizardComponent, canActivate: [AuthGuard] },
|
{ path: 'dataset/new', component: DatasetWizardComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'dataset/:id', component: DatasetWizardComponent, canActivate: [AuthGuard] },
|
{ path: 'dataset/:id', component: DatasetWizardComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'datasets/new', component: DatasetWizardComponent, canActivate: [AuthGuard] },
|
{ path: 'datasets/new', component: DatasetWizardComponent, canActivate: [AuthGuard] },
|
||||||
|
{ path: 'invite/:id', component: InvitationComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'login', component: LoginComponent },
|
{ path: 'login', component: LoginComponent },
|
||||||
{ path: "unauthorized", loadChildren: './unauthorized/unauthorized.module#UnauthorizedModule' },
|
{ path: "unauthorized", loadChildren: './unauthorized/unauthorized.module#UnauthorizedModule' },
|
||||||
{ path: 'welcome', component: HomepageComponent, canActivate: [AuthGuard] },
|
{ path: 'welcome', component: HomepageComponent, canActivate: [AuthGuard] },
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { InvitationComponent } from './invitation/invitation.component';
|
||||||
import { UnauthorizedComponent } from './unauthorized/unauthorized.component';
|
import { UnauthorizedComponent } from './unauthorized/unauthorized.component';
|
||||||
import { PaginationService } from './form/pagination/pagination-service';
|
import { PaginationService } from './form/pagination/pagination-service';
|
||||||
import { TableOfContentsFieldComponent } from './form/tableOfContents/table-of-content-field/table-of-content-field.component';
|
import { TableOfContentsFieldComponent } from './form/tableOfContents/table-of-content-field/table-of-content-field.component';
|
||||||
|
@ -81,6 +82,7 @@ import { AutocompleteComponent } from './shared/components/autocomplete/autocomp
|
||||||
DynamicFieldCheckBoxComponent,
|
DynamicFieldCheckBoxComponent,
|
||||||
ProjectEditorComponent,
|
ProjectEditorComponent,
|
||||||
DataManagementPlanEditorComponent,
|
DataManagementPlanEditorComponent,
|
||||||
|
InvitationComponent,
|
||||||
DatasetWizardComponent,
|
DatasetWizardComponent,
|
||||||
FigurecardComponent,
|
FigurecardComponent,
|
||||||
DatasetEditorComponent,
|
DatasetEditorComponent,
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
<mat-table [dataSource]="dataSource" matSort>
|
<mat-table [dataSource]="dataSource" matSort>
|
||||||
|
|
||||||
|
|
||||||
<!-- Column Definition: Name -->
|
<!-- Column Definition: Name -->
|
||||||
<ng-container cdkColumnDef="name">
|
<ng-container cdkColumnDef="name">
|
||||||
<mat-header-cell *matHeaderCellDef>{{'DMP-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
|
<mat-header-cell *matHeaderCellDef>{{'DMP-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
|
||||||
|
@ -43,8 +44,21 @@
|
||||||
<mat-cell *matCellDef="let row"> {{row.version}}</mat-cell>
|
<mat-cell *matCellDef="let row"> {{row.version}}</mat-cell>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container cdkColumnDef="actions">
|
||||||
|
<mat-header-cell *matHeaderCellDef>{{'DMP-LISTING.COLUMNS.ACTIONS' | translate}}</mat-header-cell>
|
||||||
|
<mat-cell *matCellDef="let row">
|
||||||
|
<mat-menu #actionsMenu="matMenu">
|
||||||
|
<button mat-menu-item (click)="rowClick(row.id)"><mat-icon>mode_edit</mat-icon>{{'DMP-LISTING.ACTIONS.EDIT' | translate}}</button>
|
||||||
|
<button mat-menu-item (click)="openShareDialog(row.id)"><mat-icon>insert_invitation</mat-icon>{{'DMP-LISTING.ACTIONS.INVITE' | translate}}</button>
|
||||||
|
</mat-menu>
|
||||||
|
<button mat-icon-button [matMenuTriggerFor]="actionsMenu">
|
||||||
|
<mat-icon>more_vert</mat-icon>
|
||||||
|
</button>
|
||||||
|
</mat-cell>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||||
<mat-row *matRowDef="let row; columns: displayedColumns" (click)="rowClick(row.id)"></mat-row>
|
<mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
|
||||||
|
|
||||||
</mat-table>
|
</mat-table>
|
||||||
<mat-paginator #paginator [length]="dataSource?.totalCount" [pageSizeOptions]="[10, 25, 100]">
|
<mat-paginator #paginator [length]="dataSource?.totalCount" [pageSizeOptions]="[10, 25, 100]">
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
|
import { InvitationComponent } from '../invitation/invitation.component';
|
||||||
import { Component, ViewChild, OnInit, AfterViewInit } from "@angular/core";
|
import { Component, ViewChild, OnInit, AfterViewInit } from "@angular/core";
|
||||||
import { MatPaginator, MatSort, MatSnackBar } from "@angular/material";
|
import { MatPaginator, MatSort, MatSnackBar, MatDialog } from "@angular/material";
|
||||||
import { Router } from "@angular/router";
|
import { Router } from "@angular/router";
|
||||||
import { TranslateService } from "@ngx-translate/core";
|
import { TranslateService } from "@ngx-translate/core";
|
||||||
import { DataSource } from "@angular/cdk/table";
|
import { DataSource } from "@angular/cdk/table";
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from "rxjs/Observable";
|
||||||
import { DataTableRequest } from "@app/models/data-table/DataTableRequest";
|
|
||||||
import { SnackBarNotificationComponent } from "../shared/components/notificaiton/snack-bar-notification.component";
|
import { SnackBarNotificationComponent } from "../shared/components/notificaiton/snack-bar-notification.component";
|
||||||
import { DataManagementPlanService } from "../services/data-management-plan/data-management-plan.service";
|
import { DataManagementPlanService } from "../services/data-management-plan/data-management-plan.service";
|
||||||
import { DataManagementPlanCriteriaComponent } from "../shared/components/criteria/data-management-plan/dmp-criteria.component";
|
import { DataManagementPlanCriteriaComponent } from "../shared/components/criteria/data-management-plan/dmp-criteria.component";
|
||||||
import { DataManagementPlanCriteria } from "../models/criteria/data-management-plan/DataManagementPlanCriteria";
|
import { DataManagementPlanCriteria } from "../models/criteria/data-management-plan/DataManagementPlanCriteria";
|
||||||
import { DataManagementPlanListingModel } from "../models/data-managemnt-plans/DataManagementPlanListingModel";
|
import { DataManagementPlanListingModel } from "../models/data-managemnt-plans/DataManagementPlanListingModel";
|
||||||
|
import { DataTableRequest } from '../models/data-table/DataTableRequest';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,13 +27,14 @@ export class DataManagementPlanListingComponent implements OnInit {
|
||||||
@ViewChild(DataManagementPlanCriteriaComponent) criteria: DataManagementPlanCriteriaComponent;
|
@ViewChild(DataManagementPlanCriteriaComponent) criteria: DataManagementPlanCriteriaComponent;
|
||||||
|
|
||||||
dataSource: DataManagementPlanDataSource | null;
|
dataSource: DataManagementPlanDataSource | null;
|
||||||
displayedColumns: String[] = ['name', 'project', 'profile', 'researchers', 'organisations', 'version'];
|
displayedColumns: String[] = ['name', 'project', 'profile', 'researchers', 'organisations', 'version','actions'];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private dataManagementPlanService: DataManagementPlanService,
|
private dataManagementPlanService: DataManagementPlanService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private languageService: TranslateService,
|
private languageService: TranslateService,
|
||||||
public snackBar: MatSnackBar,
|
public snackBar: MatSnackBar,
|
||||||
|
public dialog: MatDialog
|
||||||
) {
|
) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -55,6 +57,16 @@ export class DataManagementPlanListingComponent implements OnInit {
|
||||||
const defaultCriteria = new DataManagementPlanCriteria();
|
const defaultCriteria = new DataManagementPlanCriteria();
|
||||||
return defaultCriteria;
|
return defaultCriteria;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openShareDialog(rowId: any) {
|
||||||
|
let dialogRef = this.dialog.open(InvitationComponent, {
|
||||||
|
height: '200px',
|
||||||
|
width: '700px',
|
||||||
|
data: {
|
||||||
|
dmpId: rowId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DataManagementPlanDataSource extends DataSource<DataManagementPlanListingModel> {
|
export class DataManagementPlanDataSource extends DataSource<DataManagementPlanListingModel> {
|
||||||
|
@ -71,23 +83,13 @@ export class DataManagementPlanDataSource extends DataSource<DataManagementPlanL
|
||||||
private _criteria: DataManagementPlanCriteriaComponent
|
private _criteria: DataManagementPlanCriteriaComponent
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
//this._paginator.page.subscribe((pageEvent: PageEvent) => {
|
|
||||||
// this.store.dispatch(new LoadPhotosRequestAction(pageEvent.pageIndex, pageEvent.pageSize))
|
|
||||||
//})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(): Observable<DataManagementPlanListingModel[]> {
|
connect(): Observable<DataManagementPlanListingModel[]> {
|
||||||
const displayDataChanges = [
|
const displayDataChanges = [
|
||||||
this._paginator.page
|
this._paginator.page
|
||||||
//this._sort.matSortChange
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// If the user changes the sort order, reset back to the first page.
|
|
||||||
//this._sort.matSortChange.subscribe(() => {
|
|
||||||
// this._paginator.pageIndex = 0;
|
|
||||||
//})
|
|
||||||
|
|
||||||
return Observable.merge(...displayDataChanges)
|
return Observable.merge(...displayDataChanges)
|
||||||
.startWith(null)
|
.startWith(null)
|
||||||
.switchMap(() => {
|
.switchMap(() => {
|
||||||
|
@ -105,7 +107,6 @@ export class DataManagementPlanDataSource extends DataSource<DataManagementPlanL
|
||||||
duration: 3000,
|
duration: 3000,
|
||||||
extraClasses: ['snackbar-warning']
|
extraClasses: ['snackbar-warning']
|
||||||
});
|
});
|
||||||
//this._criteria.onCallbackError(error);
|
|
||||||
return Observable.of(null);
|
return Observable.of(null);
|
||||||
})
|
})
|
||||||
.map(result => {
|
.map(result => {
|
||||||
|
@ -122,6 +123,5 @@ export class DataManagementPlanDataSource extends DataSource<DataManagementPlanL
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnect() {
|
disconnect() {
|
||||||
// No-op
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,7 @@
|
||||||
|
|
||||||
<div layout="row" class="full-width text-right" align="end">
|
<div layout="row" class="full-width text-right" align="end">
|
||||||
<button mat-raised-button color="primary" (click)="cancel()" type="button">{{'DMP-EDITOR.ACTIONS.CANCEL' | translate}}</button>
|
<button mat-raised-button color="primary" (click)="cancel()" type="button">{{'DMP-EDITOR.ACTIONS.CANCEL' | translate}}</button>
|
||||||
|
<button mat-raised-button color="primary" (click)="invite()" type="button">{{'DMP-EDITOR.ACTIONS.INVITE' | translate}}</button>
|
||||||
<button mat-raised-button color="primary" type="submit">{{'DMP-EDITOR.ACTIONS.SAVE' | translate}}</button>
|
<button mat-raised-button color="primary" type="submit">{{'DMP-EDITOR.ACTIONS.SAVE' | translate}}</button>
|
||||||
<button *ngIf="!isNew" mat-raised-button color="primary" type="submit" (click)="delete()">{{'DMP-EDITOR.ACTIONS.DELETE' | translate}}</button>
|
<button *ngIf="!isNew" mat-raised-button color="primary" type="submit" (click)="delete()">{{'DMP-EDITOR.ACTIONS.DELETE' | translate}}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -123,6 +123,10 @@ export class DataManagementPlanEditorComponent implements AfterViewInit {
|
||||||
this.router.navigate(['/dmps']);
|
this.router.navigate(['/dmps']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public invite(): void {
|
||||||
|
this.router.navigate(['/invite/'+this.dataManagementPlan.id]);
|
||||||
|
}
|
||||||
|
|
||||||
filterOrganisations(value: string): void {
|
filterOrganisations(value: string): void {
|
||||||
|
|
||||||
this.filteredOrganisations = undefined;
|
this.filteredOrganisations = undefined;
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
<div>
|
||||||
|
<form *ngIf="formGroup" (ngSubmit)="formSubmit()" [formGroup]="formGroup">
|
||||||
|
<td-chips color="accent" [items]="filteredUsers" formControlName="users" placeholder="{{'INVITATION-EDITOR.TITLE' | translate}}"
|
||||||
|
(inputChange)="filterUsers($event)" [requireMatch]="false">
|
||||||
|
<ng-template td-chip let-chip="chip">
|
||||||
|
<div class="tc-grey-100 bgc-teal-700" td-chip-avatar>{{chip.name.substring(0, 1).toUpperCase()}}</div>
|
||||||
|
{{chip.name}}
|
||||||
|
</ng-template>
|
||||||
|
<ng-template td-autocomplete-option let-option="option">
|
||||||
|
<div layout="row" layout-align="start center">
|
||||||
|
{{option.name}}
|
||||||
|
</div>
|
||||||
|
</ng-template>
|
||||||
|
<mat-progress-bar [style.height.px]="2" *ngIf="filteredUsersAsync" mode="indeterminate"></mat-progress-bar>
|
||||||
|
</td-chips>
|
||||||
|
<button mat-raised-button color="primary" (click)="send()" type="button">{{'INVITATION-EDITOR.ACTIONS.SEND-INVITATION' | translate}}</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
|
@ -1,8 +1,62 @@
|
||||||
import { Component } from "@angular/core";
|
import { JsonSerializer } from '../utilities/JsonSerializer';
|
||||||
|
import { UserInvitationCriteria } from '../models/criteria/invitation/UserInvitationCriteria';
|
||||||
|
import { RequestItem } from '../models/criteria/RequestItem';
|
||||||
|
import { Invitation } from '../models/invitation/Invitation';
|
||||||
|
import { InvitationService } from '../services/invitation/invitation.service';
|
||||||
|
import { User } from '../models/invitation/User';
|
||||||
|
import { Component, OnInit, Inject } from "@angular/core";
|
||||||
|
import { FormGroup } from '@angular/forms';
|
||||||
|
import { Params, ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { MAT_DIALOG_DATA } from '@angular/material';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-invitation-component',
|
selector: 'app-invitation-component',
|
||||||
templateUrl: 'invitation.component.html',
|
templateUrl: 'invitation.component.html',
|
||||||
})
|
providers: [InvitationService]
|
||||||
export class InvitationComponent {
|
|
||||||
}
|
})
|
||||||
|
export class InvitationComponent implements OnInit {
|
||||||
|
|
||||||
|
private formGroup: FormGroup;
|
||||||
|
|
||||||
|
private filteredUsersAsync: boolean = false;
|
||||||
|
|
||||||
|
private filteredUsers: User[];
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private invitationService: InvitationService,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
public router: Router,
|
||||||
|
@Inject(MAT_DIALOG_DATA) public data: any
|
||||||
|
) { }
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
let invitation = new Invitation();
|
||||||
|
invitation.dataManagementPlan = this.data.dmpId;
|
||||||
|
this.formGroup = invitation.buildForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
send(value: any) {
|
||||||
|
this.invitationService.inviteUsers(this.formGroup.value).subscribe();
|
||||||
|
}
|
||||||
|
|
||||||
|
filterUsers(value: string): void {
|
||||||
|
this.filteredUsers = undefined;
|
||||||
|
if (value) {
|
||||||
|
this.filteredUsersAsync = true;
|
||||||
|
let request = new RequestItem<UserInvitationCriteria>();
|
||||||
|
request.criteria = { like: value }
|
||||||
|
this.invitationService.getUsers(request).subscribe(items => {
|
||||||
|
this.filteredUsers = JsonSerializer.fromJSONArray(items, User);
|
||||||
|
if (!this.filteredUsers || this.filteredUsers.length == 0) {
|
||||||
|
let user = new User();
|
||||||
|
user.email = value;
|
||||||
|
user.name = value;
|
||||||
|
this.filteredUsers.push(user)
|
||||||
|
}
|
||||||
|
this.filteredUsersAsync = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
import { BaseCriteria } from '../BaseCriteria';
|
||||||
|
export class UserInvitationCriteria extends BaseCriteria{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { FormGenerator } from '../interfaces/FormGenerator';
|
||||||
|
import { User } from './User';
|
||||||
|
import { FormGroup, FormBuilder } from '@angular/forms';
|
||||||
|
export class Invitation implements FormGenerator<FormGroup>{
|
||||||
|
|
||||||
|
public dataManagementPlan: string;
|
||||||
|
public users = new Array<User>();
|
||||||
|
|
||||||
|
buildForm(): FormGroup {
|
||||||
|
let formGroup = new FormBuilder().group({
|
||||||
|
dataManagementPlan:[this.dataManagementPlan],
|
||||||
|
users:[this.users]
|
||||||
|
})
|
||||||
|
|
||||||
|
return formGroup;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
import { FormGenerator } from '../interfaces/FormGenerator';
|
||||||
|
import { Serializable } from '../interfaces/Serializable';
|
||||||
|
import { FormGroup, FormBuilder } from '@angular/forms';
|
||||||
|
export class User implements Serializable<User>, FormGenerator<FormGroup>{
|
||||||
|
|
||||||
|
public id: string;
|
||||||
|
public email:string;
|
||||||
|
public name:string;
|
||||||
|
|
||||||
|
fromJSONObject(item: any): User {
|
||||||
|
this.id = item.id;
|
||||||
|
this.email = item.email;
|
||||||
|
this.name = item.name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
buildForm(): FormGroup {
|
||||||
|
return new FormBuilder().group({
|
||||||
|
id:[this.id],
|
||||||
|
email:[this.email],
|
||||||
|
name:[this.name]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { Invitation } from '../../models/invitation/Invitation';
|
||||||
|
import { UserInvitationCriteria } from '../../models/criteria/invitation/UserInvitationCriteria';
|
||||||
|
import { User } from '../../models/invitation/User';
|
||||||
|
import { HostConfiguration } from '../../app.constants';
|
||||||
|
import { BaseHttpService } from '../../utilities/cite-http-service-module/base-http.service';
|
||||||
|
import { Injectable } from "@angular/core";
|
||||||
|
import { HttpHeaders } from '@angular/common/http';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
import { RequestItem } from '../../models/criteria/RequestItem';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class InvitationService {
|
||||||
|
|
||||||
|
private actionUrl: string;
|
||||||
|
private headers: HttpHeaders;
|
||||||
|
|
||||||
|
constructor(private http: BaseHttpService) {
|
||||||
|
|
||||||
|
this.actionUrl = HostConfiguration.Server + 'invite/';
|
||||||
|
|
||||||
|
this.headers = new HttpHeaders();
|
||||||
|
this.headers = this.headers.set('Content-Type', 'application/json');
|
||||||
|
this.headers = this.headers.set('Accept', 'application/json');
|
||||||
|
}
|
||||||
|
|
||||||
|
public inviteUsers(invitation: Invitation): Observable<User[]> {
|
||||||
|
return this.http.post<User[]>(this.actionUrl + "users", invitation, { headers: this.headers });
|
||||||
|
}
|
||||||
|
|
||||||
|
public getUsers(usersInvitationRequestItem: RequestItem<UserInvitationCriteria>): Observable<User[]> {
|
||||||
|
return this.http.post<User[]>(this.actionUrl + "getUsers", usersInvitationRequestItem, { headers: this.headers });
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,7 +25,8 @@ import {
|
||||||
MatCheckboxModule,
|
MatCheckboxModule,
|
||||||
MatTabsModule,
|
MatTabsModule,
|
||||||
MatStepperModule,
|
MatStepperModule,
|
||||||
MatRadioModule
|
MatRadioModule,
|
||||||
|
MatMenuModule
|
||||||
} from '@angular/material';
|
} from '@angular/material';
|
||||||
import { CdkTableModule } from '@angular/cdk/table';
|
import { CdkTableModule } from '@angular/cdk/table';
|
||||||
import { SnackBarNotificationComponent } from '../components/notificaiton/snack-bar-notification.component';
|
import { SnackBarNotificationComponent } from '../components/notificaiton/snack-bar-notification.component';
|
||||||
|
@ -64,7 +65,8 @@ import { CovalentLayoutModule, CovalentChipsModule, CovalentDialogsModule } from
|
||||||
CovalentChipsModule,
|
CovalentChipsModule,
|
||||||
CovalentDialogsModule,
|
CovalentDialogsModule,
|
||||||
MatStepperModule,
|
MatStepperModule,
|
||||||
MatRadioModule
|
MatRadioModule,
|
||||||
|
MatMenuModule
|
||||||
],
|
],
|
||||||
|
|
||||||
providers: [
|
providers: [
|
||||||
|
|
|
@ -41,7 +41,12 @@
|
||||||
"PROFILE": "Profile",
|
"PROFILE": "Profile",
|
||||||
"RESEARCHERS": "Researchers",
|
"RESEARCHERS": "Researchers",
|
||||||
"ORGANISATIONS": "Organisations",
|
"ORGANISATIONS": "Organisations",
|
||||||
"VERSION": "Version"
|
"VERSION": "Version",
|
||||||
|
"ACTIONS":"Actions"
|
||||||
|
},
|
||||||
|
"ACTIONS":{
|
||||||
|
"EDIT":"Edit",
|
||||||
|
"INVITE":"Invite"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"DATASET-WIZARD": {
|
"DATASET-WIZARD": {
|
||||||
|
@ -152,5 +157,12 @@
|
||||||
"CANCEL": "Cancel",
|
"CANCEL": "Cancel",
|
||||||
"DELETE": "Delete"
|
"DELETE": "Delete"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"INVITATION-EDITOR": {
|
||||||
|
"TITLE": "User/Email",
|
||||||
|
"ACTIONS": {
|
||||||
|
"SEND-INVITATION": "Send Invitations",
|
||||||
|
"CANCEL": "Cancel"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue