Merge branch 'master' of gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot
This commit is contained in:
commit
ba4b885787
|
@ -15,6 +15,6 @@ public interface DMPDao extends Dao<DMP, UUID> {
|
|||
|
||||
List<IDLabelPair> listAllIDsLabels();
|
||||
|
||||
|
||||
List<DMP> getDMPsOfUser(String userID);
|
||||
|
||||
}
|
|
@ -41,6 +41,24 @@ public class DMPDaoImpl extends JpaDao<DMP, UUID> implements DMPDao {
|
|||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DMP> getDMPsOfUser(String userID) {
|
||||
|
||||
String queryString = "select dmp from DMP dmp where dmp.creator.id=:userid and dmp.status >= 0";
|
||||
TypedQuery<DMP> typedQuery = entityManager.createQuery(queryString, DMP.class);
|
||||
typedQuery.setParameter("userid", UUID.fromString(userID));
|
||||
try {
|
||||
return typedQuery.getResultList();
|
||||
}
|
||||
catch(Exception ex) { //no need to distinguish between exceptions for the moment
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13,4 +13,6 @@ public interface ProjectDao extends Dao<Project, UUID> {
|
|||
|
||||
public List<IDLabelPair> listAllIDsLabels();
|
||||
|
||||
public List<Project> getProjectsOfUser(String userID);
|
||||
|
||||
}
|
|
@ -9,6 +9,7 @@ import javax.persistence.TypedQuery;
|
|||
import org.hibernate.query.Query;
|
||||
|
||||
import dao.JpaDao;
|
||||
import entities.DMP;
|
||||
import entities.Project;
|
||||
import entities.responses.IDLabelPair;
|
||||
|
||||
|
@ -39,4 +40,23 @@ public class ProjectDaoImpl extends JpaDao<Project, UUID> implements ProjectDao
|
|||
}
|
||||
|
||||
|
||||
public List<Project> getProjectsOfUser(String userID){
|
||||
|
||||
String queryString = "select p from Project p where p.creationUser.id=:userid and project.status >= 0";
|
||||
TypedQuery<Project> typedQuery = entityManager.createQuery(queryString, Project.class);
|
||||
typedQuery.setParameter("userid", UUID.fromString(userID));
|
||||
try {
|
||||
return typedQuery.getResultList();
|
||||
}
|
||||
catch(Exception ex) { //no need to distinguish between exceptions for the moment
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import dao.Dao;
|
||||
import entities.DMP;
|
||||
import entities.UserInfo;
|
||||
|
||||
public interface UserInfoDao extends Dao<UserInfo, UUID> {
|
||||
|
||||
public UserInfo getByIdAndMail(String identification, String email);
|
||||
public UserInfo getUserInfo(String userID);
|
||||
|
||||
public UserInfo getByIdAndMail(String id, String email);
|
||||
|
||||
public UserInfo getByMail(String email);
|
||||
|
||||
|
@ -15,4 +19,6 @@ public interface UserInfoDao extends Dao<UserInfo, UUID> {
|
|||
|
||||
public UserInfo getByUsername(String username);
|
||||
|
||||
public List<DMP> getDmpsOfUser(String userID);
|
||||
|
||||
}
|
|
@ -1,12 +1,14 @@
|
|||
package dao.entities;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.NoResultException;
|
||||
import javax.persistence.TypedQuery;
|
||||
|
||||
import dao.JpaDao;
|
||||
import entities.DMP;
|
||||
import entities.UserInfo;
|
||||
import entities.security.UserAuth;
|
||||
|
||||
|
@ -21,10 +23,25 @@ public class UserInfoDaoImpl extends JpaDao<UserInfo, UUID> implements UserInfoD
|
|||
|
||||
|
||||
@Override
|
||||
public UserInfo getByIdAndMail(String identification, String email) {
|
||||
String queryString = "FROM UserInfo userInfo where userInfo.identification = :userInfoID and userInfo.email = :userInfoEmail";
|
||||
public UserInfo getUserInfo(String userID) {
|
||||
String queryString = "FROM UserInfo userInfo where userInfo.id = :userInfoID";
|
||||
TypedQuery<UserInfo> typedQuery = entityManager.createQuery(queryString, UserInfo.class);
|
||||
typedQuery.setParameter("userInfoID", identification);
|
||||
typedQuery.setParameter("userInfoID", UUID.fromString(userID));
|
||||
try {
|
||||
return typedQuery.getSingleResult();
|
||||
}
|
||||
catch(NoResultException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public UserInfo getByIdAndMail(String id, String email) {
|
||||
String queryString = "FROM UserInfo userInfo where userInfo.id = :userInfoID and userInfo.email = :userInfoEmail";
|
||||
TypedQuery<UserInfo> typedQuery = entityManager.createQuery(queryString, UserInfo.class);
|
||||
typedQuery.setParameter("userInfoID", UUID.fromString(id));
|
||||
typedQuery.setParameter("userInfoEmail", email);
|
||||
try {
|
||||
return typedQuery.getSingleResult();
|
||||
|
@ -80,6 +97,23 @@ public class UserInfoDaoImpl extends JpaDao<UserInfo, UUID> implements UserInfoD
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DMP> getDmpsOfUser(String userID) {
|
||||
|
||||
String queryString = "select dmp from DMP dmp join dmp.users user where user.id=:userid and dmp.status >= 0";
|
||||
TypedQuery<DMP> typedQuery = entityManager.createQuery(queryString, DMP.class);
|
||||
typedQuery.setParameter("userid", UUID.fromString(userID));
|
||||
try {
|
||||
return typedQuery.getResultList();
|
||||
}
|
||||
catch(Exception ex) { //no need to distinguish between exceptions for the moment
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import com.fasterxml.jackson.databind.SerializationFeature;
|
|||
|
||||
@Entity
|
||||
@Table(name="\"DMP\"")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id")
|
||||
@JsonIdentityInfo(generator=ObjectIdGenerators.PropertyGenerator.class, property="id", scope = DMP.class)
|
||||
public class DMP implements Serializable {
|
||||
|
||||
|
||||
|
@ -77,6 +77,11 @@ public class DMP implements Serializable {
|
|||
private DMPProfile profile;
|
||||
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "\"Creator\"")
|
||||
private UserInfo creator;
|
||||
|
||||
|
||||
@OneToMany(fetch = FetchType.LAZY)
|
||||
@JoinTable(name="\"DMPOrganisation\"",
|
||||
joinColumns={@JoinColumn(name="\"DMP\"", referencedColumnName="\"ID\"")},
|
||||
|
@ -126,6 +131,15 @@ public class DMP implements Serializable {
|
|||
}
|
||||
|
||||
|
||||
public UserInfo getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
|
||||
public void setCreator(UserInfo creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
|
||||
public Short getStatus() {
|
||||
return status;
|
||||
|
|
|
@ -106,6 +106,10 @@ public class Dataset implements Serializable {
|
|||
@Column(name = "\"Modified\"")
|
||||
private Date modified = new Date();
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "\"Creator\"", nullable = true)
|
||||
private UserInfo creator;
|
||||
|
||||
@Column(name = "\"Description\"")
|
||||
private String description;
|
||||
|
||||
|
@ -114,12 +118,19 @@ public class Dataset implements Serializable {
|
|||
return description;
|
||||
}
|
||||
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
public UserInfo getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
public void setCreator(UserInfo creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
public Short getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ 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;
|
||||
|
@ -81,6 +82,11 @@ public class Project implements Serializable {
|
|||
private Short status;
|
||||
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "\"CreationUser\"", nullable = true)
|
||||
private UserInfo creationUser;
|
||||
|
||||
|
||||
@Column(name = "\"Created\"")
|
||||
private Date created = null;
|
||||
|
||||
|
@ -209,6 +215,15 @@ public class Project implements Serializable {
|
|||
}
|
||||
|
||||
|
||||
public UserInfo getCreationUser() {
|
||||
return creationUser;
|
||||
}
|
||||
|
||||
|
||||
public void setCreationUser(UserInfo creationUser) {
|
||||
this.creationUser = creationUser;
|
||||
}
|
||||
|
||||
|
||||
public String toString() {
|
||||
try {
|
||||
|
|
|
@ -85,10 +85,11 @@ public class UserInfo implements Serializable{
|
|||
private Set<DMP> dmps;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
public Set<DMP> getDmpsNonDeleted(){
|
||||
return getDmps().parallelStream().filter(dmp -> dmp.getStatus()>=0).collect(Collectors.toSet());
|
||||
}
|
||||
*/
|
||||
|
||||
public Set<DMP> getDmps() {
|
||||
return dmps;
|
||||
|
|
|
@ -13,6 +13,7 @@ public class SafeCleanAttribs {
|
|||
newdmp.setId(dmp.getId());
|
||||
dataset.setDmp(newdmp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -153,7 +153,6 @@ public class DMPs {
|
|||
addNullAndForeignElems(previousDmp, dmp);
|
||||
|
||||
|
||||
|
||||
try {
|
||||
DMP updatedDMP = dMPDao.update(dmp);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(SerializerProvider.toJson(updatedDMP));
|
||||
|
@ -232,13 +231,9 @@ public class DMPs {
|
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("You have not logged in. You shouldn't be here");
|
||||
}
|
||||
|
||||
UserInfo userInfo = userInfoDao.read(UUID.fromString(userID));
|
||||
|
||||
if(userInfo==null) //this should normally never happer
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("There's no such a user on the system. You shouldn't be here");
|
||||
|
||||
try {
|
||||
Set<DMP> nonDeleted = userInfo.getDmpsNonDeleted();
|
||||
//List<DMP> nonDeleted = userInfoDao.getDmpsOfUser(userID);
|
||||
List<DMP> nonDeleted = dMPDao.getDMPsOfUser(userID);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(SerializerProvider.toJson(nonDeleted));
|
||||
}
|
||||
catch(Exception ex) {
|
||||
|
@ -267,6 +262,8 @@ public class DMPs {
|
|||
|
||||
dmp.setId(null);
|
||||
|
||||
dmp.setCreator(userInfo);
|
||||
|
||||
Set<UserInfo> users = new HashSet<UserInfo>();
|
||||
users.add(userInfo);
|
||||
dmp.setUsers(users);
|
||||
|
|
|
@ -16,6 +16,7 @@ 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.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
@ -43,6 +44,7 @@ import dao.entities.ProjectDao;
|
|||
import dao.entities.RegistryDao;
|
||||
import dao.entities.ResearcherDao;
|
||||
import dao.entities.ServiceDao;
|
||||
import dao.entities.UserInfoDao;
|
||||
import entities.DMP;
|
||||
import entities.DMPProfile;
|
||||
import entities.Dataset;
|
||||
|
@ -51,6 +53,7 @@ import entities.DatasetProfileRuleset;
|
|||
import entities.DatasetProfileViewstyle;
|
||||
import entities.Organisation;
|
||||
import entities.Project;
|
||||
import entities.UserInfo;
|
||||
import helpers.SafeCleanAttribs;
|
||||
import helpers.SerializerProvider;
|
||||
import helpers.Transformers;
|
||||
|
@ -73,6 +76,7 @@ public class Datasets {
|
|||
@Autowired private RegistryDao registryDao;
|
||||
@Autowired private ResearcherDao researcherDao;
|
||||
@Autowired private ServiceDao serviceDao;
|
||||
@Autowired private UserInfoDao userInfoDao;
|
||||
|
||||
|
||||
// FETCH BY DATASET(S)
|
||||
|
@ -124,15 +128,36 @@ public class Datasets {
|
|||
@RequestMapping(method = RequestMethod.POST, value = { "/dataset/create" }, consumes = "application/json", produces="application/json")
|
||||
public @ResponseBody ResponseEntity<Object> createDataset(@RequestBody Dataset dataset) {
|
||||
|
||||
|
||||
|
||||
String userID = null;
|
||||
try {
|
||||
userID = SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString();
|
||||
} catch(NullPointerException ex) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("You have not logged in. You shouldn't be here");
|
||||
}
|
||||
|
||||
UserInfo userInfo = userInfoDao.read(UUID.fromString(userID));
|
||||
|
||||
if(userInfo==null) //this should normally never happer
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("There's no such a user on the system. You shouldn't be here");
|
||||
|
||||
|
||||
|
||||
dataset.setId(null);
|
||||
dataset.setCreated(new Date());
|
||||
dataset.setModified(new Date());
|
||||
dataset.setStatus(new Short("0"));
|
||||
dataset.setCreator(userInfo);
|
||||
if("".equals(dataset.getReference())) dataset.setReference(null);
|
||||
if("".equals(dataset.getProperties())) dataset.setProperties(null);
|
||||
|
||||
try {
|
||||
dataset = datasetDao.create(dataset);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(SerializerProvider.toJson(dataset));
|
||||
}
|
||||
catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Could not create or update Dataset! Reason: " + e.getMessage());
|
||||
}
|
||||
|
||||
|
@ -151,6 +176,9 @@ public class Datasets {
|
|||
|
||||
SafeCleanAttribs.clean(dataset);
|
||||
|
||||
if("".equals(dataset.getReference())) dataset.setReference(null);
|
||||
if("".equals(dataset.getProperties())) dataset.setProperties(null);
|
||||
|
||||
try {
|
||||
dataset = datasetDao.update(dataset);
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(SerializerProvider.toJson(dataset));
|
||||
|
|
|
@ -219,6 +219,17 @@ public class Projects {
|
|||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("There's no such a user on the system. You shouldn't be here");
|
||||
|
||||
|
||||
try {
|
||||
List<Project> userProjects = projectDao.getProjectsOfUser(userID);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(SerializerProvider.toJson(userProjects));
|
||||
}
|
||||
catch(Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* OLD ONE
|
||||
Map<UUID, Project> userProjects = new HashMap<UUID, Project>();
|
||||
|
||||
userInfo.getDmps().forEach( dmp -> {
|
||||
|
@ -232,6 +243,7 @@ public class Projects {
|
|||
catch(Exception ex) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage());
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
@ -257,24 +269,25 @@ public class Projects {
|
|||
|
||||
project.setId(null);
|
||||
project.setStatus(new Short("0"));
|
||||
project.setCreationUser(userInfo);
|
||||
project.setCreated(new Date());
|
||||
project.setModified(new Date());
|
||||
|
||||
Project newproj = projectDao.create(project);
|
||||
|
||||
DMP newdmp = new DMP();
|
||||
newdmp.setId(null);
|
||||
newdmp.setLabel("Auto-Generated");
|
||||
newdmp.setCreated(new Date());
|
||||
newdmp.setVersion(1);
|
||||
newdmp.setStatus(new Short("0"));
|
||||
newdmp.setProject(newproj);
|
||||
|
||||
Set<UserInfo> users = new HashSet<UserInfo>();
|
||||
users.add(userInfo);
|
||||
newdmp.setUsers(users);
|
||||
|
||||
newdmp = dMPDao.create(newdmp);
|
||||
// DMP newdmp = new DMP();
|
||||
// newdmp.setId(null);
|
||||
// newdmp.setLabel("Auto-Generated");
|
||||
// newdmp.setCreated(new Date());
|
||||
// newdmp.setVersion(1);
|
||||
// newdmp.setStatus(new Short("0"));
|
||||
// newdmp.setProject(newproj);
|
||||
//
|
||||
// Set<UserInfo> users = new HashSet<UserInfo>();
|
||||
// users.add(userInfo);
|
||||
// newdmp.setUsers(users);
|
||||
//
|
||||
// newdmp = dMPDao.create(newdmp);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(SerializerProvider.toJson(newproj));
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ 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.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
@ -36,6 +37,7 @@ import dao.entities.ProjectDao;
|
|||
import dao.entities.RegistryDao;
|
||||
import dao.entities.ResearcherDao;
|
||||
import dao.entities.ServiceDao;
|
||||
import dao.entities.UserInfoDao;
|
||||
import entities.DMP;
|
||||
import entities.DMPProfile;
|
||||
import entities.DataRepository;
|
||||
|
@ -47,6 +49,7 @@ import entities.Project;
|
|||
import entities.Registry;
|
||||
import entities.Researcher;
|
||||
import entities.Service;
|
||||
import entities.UserInfo;
|
||||
import helpers.SerializerProvider;
|
||||
import helpers.Transformers;
|
||||
import responses.RestResponse;
|
||||
|
@ -68,6 +71,38 @@ public class Users {
|
|||
@Autowired private RegistryDao registryDao;
|
||||
@Autowired private ResearcherDao researcherDao;
|
||||
@Autowired private ServiceDao serviceDao;
|
||||
@Autowired private UserInfoDao userInfoDao;
|
||||
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = { "/user/whoami" }, produces="application/json;charset=UTF-8")
|
||||
public @ResponseBody ResponseEntity<Object> whoami(){
|
||||
|
||||
|
||||
String userID = null;
|
||||
try {
|
||||
userID = SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString();
|
||||
} catch(NullPointerException ex) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("You have not logged in. You shouldn't be here");
|
||||
}
|
||||
|
||||
UserInfo userInfo = userInfoDao.getUserInfo(userID);
|
||||
|
||||
|
||||
if(userInfo==null) //this should normally never happer
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("There's no such a user on the system. You shouldn't be here");
|
||||
|
||||
|
||||
try {
|
||||
|
||||
return new ResponseEntity<Object>(SerializerProvider.toJson(userInfo), HttpStatus.OK);
|
||||
}
|
||||
catch(Exception ex) {
|
||||
ex.printStackTrace();
|
||||
return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
##########################Security##########################################
|
||||
#security.portmapping.http = 7081
|
||||
#security.portmapping.https = 7444
|
||||
##########################/Security########################################
|
||||
|
||||
##########################Persistence##########################################
|
||||
persistence.jdbc.driver = org.postgresql.Driver
|
||||
persistence.jdbc.url = jdbc:postgresql://HOST:PORT/DB
|
||||
persistence.dbusername = USER
|
||||
persistence.dbpassword = PASS
|
||||
##########################/Persistence##########################################
|
||||
|
||||
###################Allowed Proxy Service Host ############################
|
||||
proxy.allowed.host = https://eestore.paas2.uninett.no
|
||||
#######################################################
|
||||
|
||||
########################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####################
|
|
@ -65,16 +65,16 @@
|
|||
</listener>
|
||||
|
||||
|
||||
<!-- THIS FILTER IS FOR SPRING SECURITY -->
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>/WEB-INF/applicationContext.xml,/WEB-INF/spring-security.xml</param-value>
|
||||
<!-- <param-value>/WEB-INF/applicationContext.xml</param-value> -->
|
||||
<!-- <param-value>/WEB-INF/applicationContext.xml</param-value> -->
|
||||
</context-param>
|
||||
<session-config>
|
||||
<session-timeout>30</session-timeout>
|
||||
</session-config>
|
||||
|
||||
<!-- THIS FILTER IS FOR SPRING SECURITY -->
|
||||
<filter>
|
||||
<filter-name>springSecurityFilterChain</filter-name>
|
||||
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
|
||||
|
@ -85,6 +85,23 @@
|
|||
</filter-mapping>
|
||||
|
||||
|
||||
<!-- THIS FILTER IS FOR SUPPORTING UNICODE CHARACTERS -->
|
||||
<filter>
|
||||
<filter-name>encodingFilter</filter-name>
|
||||
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
|
||||
<init-param>
|
||||
<param-name>encoding</param-name>
|
||||
<param-value>UTF-8</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>forceEncoding</param-name>
|
||||
<param-value>true</param-value>
|
||||
</init-param>
|
||||
</filter>
|
||||
<filter-mapping>
|
||||
<filter-name>encodingFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
|
||||
</web-app>
|
|
@ -3,6 +3,7 @@ import static org.junit.Assert.*;
|
|||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.Before;
|
||||
|
@ -17,6 +18,7 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio
|
|||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.type.CollectionType;
|
||||
import com.fasterxml.jackson.databind.type.TypeFactory;
|
||||
|
@ -201,7 +203,7 @@ public class TestRest {
|
|||
}
|
||||
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
public void testDmpClone() {
|
||||
|
||||
System.out.println(dmpsService.getDmpsOfUser().getBody());
|
||||
|
@ -266,5 +268,40 @@ public class TestRest {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProject2() {
|
||||
|
||||
|
||||
// String a = null;
|
||||
// try {
|
||||
// //a = (String)dmpsService.getDmpsOfUser().getBody();
|
||||
//
|
||||
// Set<DMP> dmps = new ObjectMapper().readValue(dmpsService.getDmpsOfUser().getBody().toString(), new TypeReference<Set<DMP>>(){});
|
||||
// System.out.println(dmps);
|
||||
//
|
||||
//// Set<DMP> dmps = SerializerProvider.fromJson((String)dmpsService.getDmpsOfUser().getBody(), new TypeReference<Set<DMP>>(){});
|
||||
// } catch (Exception e) {
|
||||
//
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
|
||||
|
||||
CollectionType typeReference = TypeFactory.defaultInstance().constructCollectionType(List.class, DMP.class);
|
||||
List<DMP> dmps = null;
|
||||
try {
|
||||
dmps = SerializerProvider.fromJson(dmpsService.getDmpsOfUser().getBody().toString(), typeReference) ;
|
||||
System.out.println(dmps);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
fail("Should not have thrown any exception");
|
||||
}
|
||||
|
||||
|
||||
assertEquals("aaa", "aaa");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ CREATE TABLE "DMP" (
|
|||
"Version" integer NOT NULL,
|
||||
"Project" uuid NOT NULL,
|
||||
"ProfileData" xml,
|
||||
"Creator" uuid not null,
|
||||
"Status" smallint not null default 0,
|
||||
"Created" timestamp not null default NOW(),
|
||||
"Modified" timestamp not null default NOW(),
|
||||
|
@ -116,6 +117,7 @@ CREATE TABLE "Dataset" (
|
|||
"Uri" character varying(250),
|
||||
"Properties" xml,
|
||||
"Reference" xml,
|
||||
"Creator" uuid not null,
|
||||
"Status" smallint not null default 0,
|
||||
"Created" timestamp not null default NOW(),
|
||||
"Modified" timestamp not null default NOW(),
|
||||
|
@ -214,6 +216,7 @@ CREATE TABLE "Project" (
|
|||
"Abbreviation" character varying(50),
|
||||
"Reference" xml,
|
||||
"Uri" character varying(250),
|
||||
"CreationUser" uuid not null,
|
||||
"Status" smallint not null default 0,
|
||||
"Created" timestamp not null default NOW(),
|
||||
"Modified" timestamp not null default NOW(),
|
||||
|
@ -534,6 +537,12 @@ ALTER TABLE "UserDMP" ADD CONSTRAINT fkey_userdmp_user FOREIGN KEY (usr) REFEREN
|
|||
ALTER TABLE "UserDMP" ADD CONSTRAINT fkey_userdmp_dmp FOREIGN KEY (dmp) REFERENCES "DMP"("ID");
|
||||
|
||||
|
||||
ALTER TABLE "DMP" ADD CONSTRAINT fk_dmp_creator FOREIGN KEY ("Creator") REFERENCES "UserInfo"(id);
|
||||
ALTER TABLE "Dataset" ADD CONSTRAINT fk_dataset_creator FOREIGN KEY ("Creator") REFERENCES "UserInfo"(id);
|
||||
ALTER TABLE "Project" ADD CONSTRAINT fk_project_creator FOREIGN KEY ("CreationUser") REFERENCES "UserInfo"(id);
|
||||
|
||||
|
||||
|
||||
ALTER TABLE "UserInfo" OWNER TO dmptool;
|
||||
ALTER TABLE "UserAuth" OWNER TO dmptool;
|
||||
ALTER TABLE "UserDMP" OWNER TO dmptool;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { PageNotFoundComponent } from './not-found.component';
|
||||
import { EmptyComponent } from './empty.component';
|
||||
import { HomepageComponent } from './homepage/homepage.component';
|
||||
import { DynamicFormComponent } from './form/dynamic-form.component';
|
||||
import { AuthGuard } from './guards/auth.guard';
|
||||
import { ProjectsComponent } from './projects/projects.component';
|
||||
|
@ -10,6 +10,8 @@ import { DmpComponent } from './dmps/dmp.component';
|
|||
import { AppComponent } from './app.component';
|
||||
import { UserWorkspaceComponent } from './user-workspace/user-workspace.component';
|
||||
import { MainSignInComponent } from './login/main-sign-in/main-sign-in.component';
|
||||
import { DmpDetailedComponent } from './viewers/dmp-detailed/dmp-detailed.component';
|
||||
|
||||
|
||||
const appRoutes: Routes = [
|
||||
//{ path: 'dynamic-form/:id', component: DynamicFormComponent, canActivate: [AuthGuard] },
|
||||
|
@ -18,8 +20,9 @@ const appRoutes: Routes = [
|
|||
{ path: 'login', component: MainSignInComponent},
|
||||
{ path: 'projects', component: ProjectsComponent},
|
||||
{ path: 'dmps', component: DmpComponent},
|
||||
{ path: 'dmp', component: DmpDetailedComponent },
|
||||
{ path: 'workspace', component: UserWorkspaceComponent},
|
||||
{ path: 'welcome', component: EmptyComponent},
|
||||
{ path: 'welcome', component: HomepageComponent},
|
||||
{ path: '', redirectTo: '/login', pathMatch: 'full' },
|
||||
{ path: '**', component: PageNotFoundComponent },
|
||||
/*
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="cursor" (click)="goToDMPs()">My DMPs</a></li>
|
||||
<li><a class="cursor" (click)="goToProjects()">My Projects</a></li>
|
||||
<li><a class="cursor" (click)="goToProjects()">Projects</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import { DynamicFormGroupComponent } from './form/dynamic-form-group/dynamic-for
|
|||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { AuthGuard } from './guards/auth.guard';
|
||||
import { PageNotFoundComponent } from './not-found.component';
|
||||
import { EmptyComponent } from './empty.component';
|
||||
import { HomepageComponent } from './homepage/homepage.component';
|
||||
import { TocComponent } from './form/tableOfContents/toc.component';
|
||||
import { ConfirmationComponent } from './widgets/confirmation/confirmation.component';
|
||||
|
||||
|
@ -70,6 +70,7 @@ import { AutocompleteRemoteComponent } from './form/fields/autocomplete-remote/a
|
|||
|
||||
import { Ng4LoadingSpinnerModule } from 'ng4-loading-spinner';
|
||||
import { BreadcrumbComponent } from './widgets/breadcrumb/breadcrumb.component';
|
||||
import { DmpDetailedComponent } from './viewers/dmp-detailed/dmp-detailed.component';
|
||||
|
||||
|
||||
|
||||
|
@ -84,7 +85,7 @@ import { BreadcrumbComponent } from './widgets/breadcrumb/breadcrumb.component';
|
|||
GooggleSignInComponent,
|
||||
MainSignInComponent,
|
||||
PageNotFoundComponent,
|
||||
EmptyComponent,
|
||||
HomepageComponent,
|
||||
ModalComponent,
|
||||
ProjectDetailComponent,
|
||||
ProjectsComponent,
|
||||
|
@ -101,7 +102,7 @@ import { BreadcrumbComponent } from './widgets/breadcrumb/breadcrumb.component';
|
|||
DatasetTableFilterPipe,
|
||||
DatasetStatusFilterPipe,
|
||||
StatusToString,
|
||||
BreadcrumbComponent
|
||||
BreadcrumbComponent, DmpDetailedComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
|
|
@ -41,3 +41,7 @@ tr.hover:hover > * {
|
|||
.cursor-hand{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.hidden-keepspace{
|
||||
visibility: hidden;
|
||||
}
|
|
@ -60,6 +60,8 @@ export class DatasetsComponent implements OnInit {
|
|||
|
||||
dataSetValue: boolean = true;
|
||||
|
||||
uriRegex = "/^([a-z0-9+.-]+):(?://(?:((?:[a-z0-9-._~!$&'()*+,;=:]|%[0-9A-F]{2})*)@)?((?:[a-z0-9-._~!$&'()*+,;=]|%[0-9A-F]{2})*)(?::(\d*))?(/(?:[a-z0-9-._~!$&'()*+,;=:@/]|%[0-9A-F]{2})*)?|(/?(?:[a-z0-9-._~!$&'()*+,;=:@]|%[0-9A-F]{2})+(?:[a-z0-9-._~!$&'()*+,;=:@/]|%[0-9A-F]{2})*)?)(?:\?((?:[a-z0-9-._~!$&'()*+,;=:/?@]|%[0-9A-F]{2})*))?(?:#((?:[a-z0-9-._~!$&'()*+,;=:/?@]|%[0-9A-F]{2})*))?$/i";
|
||||
|
||||
|
||||
constructor(
|
||||
|
||||
|
@ -140,8 +142,11 @@ export class DatasetsComponent implements OnInit {
|
|||
|
||||
}
|
||||
else{
|
||||
this.dataset.dmp = { "id": this.dmpIdforDatasets }
|
||||
this.dataset.profile = { "id": this.dataset.profile }
|
||||
|
||||
this.dataset.dmp = { "id": this.dmpIdforDatasets };
|
||||
this.dataset.profile = { "id": this.dataset.profile };
|
||||
this.dataset.creator = {"id" : this.dataset.creator };
|
||||
|
||||
this.serverService.updateDatsetsProfile(this.dataset).subscribe(
|
||||
response => {
|
||||
simple_notifier("success",null,"Dataset edited");
|
||||
|
@ -203,6 +208,7 @@ export class DatasetsComponent implements OnInit {
|
|||
//this.dataset.dmp = item.dmp;
|
||||
this.dataset.profile = item.profile==null ? null : item.profile.id;
|
||||
this.dataset.id = item.id;
|
||||
this.dataset.creator = item.creator;
|
||||
$("#newDatasetModal").modal("show");
|
||||
}
|
||||
else if(event.toElement.id == "describeDataset"){
|
||||
|
@ -245,7 +251,13 @@ export class DatasetsComponent implements OnInit {
|
|||
this.getDatasets();
|
||||
},
|
||||
err => {
|
||||
|
||||
if(err.status>=200 && err.status<300)
|
||||
simple_notifier("success",null,"Deleted dataset");
|
||||
else
|
||||
simple_notifier("danger",null,"Could not delete the dataset");
|
||||
this.getDatasets();
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -55,14 +55,14 @@
|
|||
|
||||
<tr *ngFor="let dataset of mf.data" class="hover">
|
||||
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{dataset.id}}</td>
|
||||
<td>{{dataset?.label}}</td>
|
||||
<td>{{dataset?.uri}}</td>
|
||||
<td>{{dataset?.profile?.label}}</td>
|
||||
<td>{{dataset?.description}}</td>
|
||||
<td>{{(dataset?.label?.length > 80) ? (dataset?.label | slice:0:80)+'...':(dataset?.label) }}</td>
|
||||
<td>{{(dataset?.uri?.length > 40) ? (dataset?.uri | slice:0:40)+'...':(dataset?.uri) }}</td>
|
||||
<td>{{(dataset?.profile?.label?.length > 40) ? (dataset?.profile?.label | slice:0:40)+'...':(dataset?.profile?.label) }}</td>
|
||||
<td>{{(dataset?.description?.length > 40) ? (dataset?.description | slice:0:40)+'...':(dataset?.description) }}</td>
|
||||
<td>{{dataset?.created | date:'yyyy-MM-dd HH:mm:ss Z'}}</td>
|
||||
<td>{{dataset?.status | statusToString }}</td>
|
||||
<td>
|
||||
<a class="editGridColumn cursor-hand disabled" (click)="editRow(dataset, $event)">
|
||||
<a [ngClass]="{'hidden-keepspace': dataset.status==2 }" class="editGridColumn cursor-hand disabled" (click)="editRow(dataset, $event)">
|
||||
<i class="fa fa-pencil fa-fw" data-toggle="tooltip" title="edit Properties" id="editDataset"></i></a>
|
||||
<a class="editGridColumn cursor-hand" (click)="editRow(dataset, $event)">
|
||||
<i class="fa fa-eraser fa-fw" data-toggle="modal" data-target="#delete-dataset-confirm" (click)="markDatasetForDelete(dataset)" title="delete Dataset"></i></a>
|
||||
|
@ -87,31 +87,26 @@
|
|||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" >Dataset</h5>
|
||||
<h4 class="modal-title" id="modalLabel"><b>{{ dataset?.id ? "Edit Dataset" : "New Dataset" }}</b></h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form #newProjectForm="ngForm" (ngSubmit)="SaveDataset()">
|
||||
<form #newDatasetForm="ngForm" (ngSubmit)="SaveDataset()">
|
||||
<div class="form-group">
|
||||
<label for="recipient-name" class="col-form-label">Dataset Profile:</label>
|
||||
<select class="form-control" id="datasetProfileDropDownKey" [(ngModel)]="dataset.profile" name="datasetProfileDropDown"
|
||||
#datasetfield>
|
||||
<select class="form-control" id="datasetProfileDropDownKey" [(ngModel)]="dataset.profile" name="datasetProfileDropDown" #datasetfield>
|
||||
<option *ngFor="let opt of datasetProfileDropDown.options" [value]="opt.key">{{opt.value}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="label-name" class="form-control-label">Label:</label>
|
||||
<input type="text" class="form-control" id="label-name" [(ngModel)]="dataset.label" name="label">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="abbreviation-text" class="form-control-label">DMP:</label>
|
||||
<input class="form-control" id="abbreviation-text" [(ngModel)]="dataset.dmp" name="dmp" disabled>
|
||||
<input type="text" class="form-control" id="label-name" [(ngModel)]="dataset.label" name="label" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="uri-text" class="form-control-label">Uri:</label>
|
||||
<input class="form-control" id="uri-text" [(ngModel)]="dataset.uri" name="uri">
|
||||
<input class="form-control" id="uri-text" [(ngModel)]="dataset.uri" name="uri" pattern="^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="status-name" class="col-form-label">Status:</label>
|
||||
|
|
|
@ -62,3 +62,8 @@ tr.hover:hover > * {
|
|||
.centered-text{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.url-like{
|
||||
color: #0645AD;
|
||||
cursor: pointer;
|
||||
}
|
|
@ -45,7 +45,7 @@ export class DmpComponent implements OnInit{
|
|||
showIDs : boolean = false;
|
||||
|
||||
|
||||
dmp : any = null;
|
||||
dmp : any;
|
||||
|
||||
@Input() projectsDropDown:DropdownField;
|
||||
@Input() statusDropDown: DropdownField;
|
||||
|
@ -60,10 +60,9 @@ export class DmpComponent implements OnInit{
|
|||
this.projectsDropDown = new DropdownField();
|
||||
this.projectsDropDown.options = [];
|
||||
this.statusDropDown = new DropdownField();
|
||||
this.statusDropDown.options= [{key:'', value:null},{key:'0', value:"Active"},{key:'1', value:"Inactive"}, {key:'2', value:"Submitted"}, {key:'3', value:"Cancel"}]
|
||||
this.statusDropDown.options= [{key:'', value:null},{key:'0', value:"Active"},{key:'1', value:"Inactive"}]
|
||||
//this.projects = [];
|
||||
|
||||
this.dmp = this.clearDmp();
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,7 +73,7 @@ export class DmpComponent implements OnInit{
|
|||
label: '',
|
||||
previous:'',
|
||||
version:'',
|
||||
profileData:'',
|
||||
//profileData:'',
|
||||
//project: '',
|
||||
//profile:{}
|
||||
}
|
||||
|
@ -101,15 +100,10 @@ export class DmpComponent implements OnInit{
|
|||
}
|
||||
)
|
||||
|
||||
}
|
||||
this.clearDmp();
|
||||
|
||||
showDMPDetails(dmp) {
|
||||
console.log("Showing details for dmp : " + JSON.stringify(dmp));
|
||||
// TODO: Add here code to show details of dmp.
|
||||
//1. hide dmp table and show component for detailed dmp
|
||||
//2. also edit the breadcrumb
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
getDmps(muted? : boolean){
|
||||
|
@ -146,6 +140,7 @@ export class DmpComponent implements OnInit{
|
|||
updateDMP(){
|
||||
|
||||
this.dmp.project = {"id":this.dmp.project};
|
||||
this.dmp.creator = {"id": this.dmp.creator};
|
||||
|
||||
this.serverService.updateDmp(this.dmp)
|
||||
.subscribe(
|
||||
|
@ -198,7 +193,7 @@ export class DmpComponent implements OnInit{
|
|||
|
||||
newDmpForm(item){
|
||||
|
||||
this.dmp = this.clearDmp();
|
||||
this.clearDmp();
|
||||
|
||||
$("#newDmpModal").modal("show");
|
||||
}
|
||||
|
@ -222,7 +217,11 @@ export class DmpComponent implements OnInit{
|
|||
this.getDmps();
|
||||
},
|
||||
(err: HttpErrorResponse) => {
|
||||
if(err.status>=200 && err.status<300)
|
||||
simple_notifier("success",null,"Successfully deleted the DMP");
|
||||
else
|
||||
simple_notifier("danger",null,"Failed to delete the DMP");
|
||||
this.getDmps();
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -264,6 +263,11 @@ export class DmpComponent implements OnInit{
|
|||
this.router.navigate(['/dataset'], { queryParams: { "dmpid":item.id , "label":item.label}});
|
||||
}
|
||||
|
||||
viewDetailedDMP(dmp){
|
||||
console.log(dmp)
|
||||
this.router.navigate(['/dmp'], { queryParams: { "dmpid":dmp.id, "label":dmp.label }});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -65,11 +65,11 @@
|
|||
|
||||
<tr *ngFor="let dmp of mf.data" class="hover">
|
||||
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{dmp?.id}}</td>
|
||||
<td>{{dmp?.label}}</td>
|
||||
<td class="url-like" (click)="viewDetailedDMP(dmp)">{{(dmp?.label?.length > 40) ? (dmp?.label | slice:0:40)+'...':(dmp?.label) }}</td>
|
||||
<td style="width:20px;">{{dmp?.version}}</td>
|
||||
<td style="width:300px;">{{dmp?.previous}}</td>
|
||||
<td>{{dmp?.project?.label}}</td>
|
||||
<td>{{(dmp?.description?.length > 20) ? (dmp?.description | slice:0:20)+'...':(dmp?.description) }}</td>
|
||||
<td>{{(dmp?.project?.label?.length > 40) ? (dmp?.project?.label | slice:0:40)+'...':(dmp?.project?.label) }}</td>
|
||||
<td>{{(dmp?.description?.length > 40) ? (dmp?.description | slice:0:40)+'...':(dmp?.description) }}</td>
|
||||
<td>{{dmp?.created | date:'yyyy-MM-dd HH:mm:ss Z'}}</td>
|
||||
<td>{{dmp?.status | statusToString }}</td>
|
||||
<td>
|
||||
|
@ -105,20 +105,20 @@
|
|||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header centered-text">
|
||||
<h4 class="modal-title" id="exampleModalLabel"><b>{{ dmp?.id ? "Edit Data Management Plan" : "New Data Management Plan" }}</b></h4>
|
||||
<h4 class="modal-title" id="modalLabel"><b>{{ dmp?.id ? "Edit Data Management Plan" : "New Data Management Plan" }}</b></h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form #newProjectForm="ngForm" (ngSubmit)="SaveNewDmp()">
|
||||
<form #dmpForm="ngForm" (ngSubmit)="SaveNewDmp()">
|
||||
<div class="form-group">
|
||||
<div class="form-group">
|
||||
<label for="label-name" class="form-control-label">Label:</label>
|
||||
<input type="text" class="form-control" id="label-name" [ngModel]="dmp?.label" (ngModelChange)="dmp.label=$event" name="label">
|
||||
<input type="text" class="form-control" id="label-name" [ngModel]="dmp?.label" (ngModelChange)="dmp.label=$event" name="label" required>
|
||||
</div>
|
||||
<label for="recipient-name" class="col-form-label">Project:</label>
|
||||
<select class="form-control" id="projectsDropDownKey" [ngModel]="dmp?.project" (ngModelChange)="dmp.project=$event" name="projectsDropDown">
|
||||
<select class="form-control" id="projectsDropDownKey" [ngModel]="dmp?.project" (ngModelChange)="dmp.project=$event" name="projectsDropDown" required>
|
||||
<option *ngFor="let opt of projectsDropDown.options" [value]="opt.key">{{opt.value}}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
@ -170,13 +170,13 @@
|
|||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">DMP</h5>
|
||||
<h4 class="modal-title" id="modalLabel"><b>Clone Data Management Plan</b></h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form #newProjectForm="ngForm" (ngSubmit)="SaveNewDmp()">
|
||||
<form #dmpForm="ngForm" (ngSubmit)="SaveNewDmp()">
|
||||
<div class="form-group">
|
||||
<label for="label-name" class="form-control-label">Label:</label>
|
||||
<input type="text" class="form-control" id="label-name" [ngModel]="dmp?.label" (ngModelChange)="dmp.label=$event" name="label">
|
||||
|
@ -201,7 +201,7 @@
|
|||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="submit" class="btn btn-primary" (click)="cloneDMP(dmp);">Save Dmp</button>
|
||||
<button type="submit" class="btn btn-primary" [disabled]="!dmpForm.form.valid" (click)="cloneDMP(dmp);">Save Dmp</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -229,5 +229,3 @@
|
|||
|
||||
<!-- Confirmation module- do not delete -->
|
||||
<confirmation [confirmationID]="'delete-dmp-confirm'" [confirmationTitle]="'Caution'" [confirmationDescr]="'This action will delete this DMP. Are you sure ? This is not revertable !'" (responseSender)="deleteDMP($event)"></confirmation>
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
template: ''
|
||||
})
|
||||
export class EmptyComponent {}
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
<div >
|
||||
<div class="progress">
|
||||
<div class="progress-bar" role="progressbar" aria-valuenow= "" aria-valuemin="0" aria-valuemax="100" [ngStyle]="{'width': dirtyValues + '%'}">
|
||||
<div class="progress-bar progress-bar-info progress-bar-striped" role="progressbar" aria-valuenow= "" aria-valuemin="0" aria-valuemax="100" [ngStyle]="{'width': dirtyValues + '%'}">
|
||||
<!-- {{dirtyValues}}% -->
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -238,6 +238,8 @@ export class DynamicFormComponent implements OnInit {
|
|||
//data.properties = "<root><formValues><![CDATA["+JSON.stringify(this.form.value)+"]]></formValues><dataModel><![CDATA["+JSON.stringify(this.dataModel)+"]]></dataModel></root>";
|
||||
data.properties = JSON.stringify(this.form.value);
|
||||
|
||||
data.profile = {"id": data.profile.id};
|
||||
|
||||
this.serverService.setDataset(data).subscribe(
|
||||
(data) => {
|
||||
console.log("Updated dataset");
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
<div class="jumbotron">
|
||||
<h1>Hello {{ userInfo?.name!=null ? userInfo?.name : userInfo?.email }}</h1>
|
||||
<p>Welcome {{ userInfo?.created != userInfo?.lastloggedin ? "back" : "" }} to the <a href="https://en.wikipedia.org/wiki/Data_management_plan">Data Management Plans</a> application. </p>
|
||||
<!--
|
||||
<p><a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a></p>
|
||||
-->
|
||||
</div>
|
||||
|
||||
<!--
|
||||
{{userInfo | json}}
|
||||
-->
|
|
@ -0,0 +1,32 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { ServerService } from '../../app/services/server.service';
|
||||
|
||||
@Component({
|
||||
selector: 'homepage',
|
||||
templateUrl: './homepage.component.html',
|
||||
styleUrls: ['./homepage.component.css'],
|
||||
providers: []
|
||||
})
|
||||
export class HomepageComponent implements OnInit{
|
||||
|
||||
private userInfo: any;
|
||||
|
||||
constructor(private serverService: ServerService, private route: ActivatedRoute, private router: Router){
|
||||
|
||||
}
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
this.serverService.whoami().subscribe(
|
||||
userInfo => {
|
||||
this.userInfo = userInfo;
|
||||
},
|
||||
error => {
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -6,22 +6,23 @@ import {Pipe, PipeTransform} from "@angular/core";
|
|||
})
|
||||
export class ProjectTableFilterPipe implements PipeTransform {
|
||||
|
||||
transform(array: any[], query: string): any {
|
||||
transform(array: any[], query: string, userid : string, onlyMyProjects : boolean): any {
|
||||
|
||||
if (query) {
|
||||
if (query || userid) {
|
||||
|
||||
return _.filter(array, row => {
|
||||
|
||||
return (
|
||||
if(onlyMyProjects){
|
||||
return (row.label.indexOf(query) > -1) && (row.creationUser.id==userid);
|
||||
}
|
||||
else{
|
||||
return row.label.indexOf(query) > -1;
|
||||
}
|
||||
|
||||
row.label.indexOf(query) > -1
|
||||
|
||||
//|| row.version == query
|
||||
//|| row.id.indexOf(query) > -1
|
||||
)
|
||||
});
|
||||
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
}
|
|
@ -50,3 +50,13 @@ tr.hover:hover > * {
|
|||
color:white;
|
||||
margin-top:15px;
|
||||
}
|
||||
|
||||
a{
|
||||
cursor: pointer;
|
||||
}
|
||||
.not-active {
|
||||
pointer-events: none;
|
||||
cursor:not-allowed;
|
||||
opacity: 0.5;
|
||||
filter: alpha(opacity=50); /* For IE8 and earlier */
|
||||
}
|
|
@ -1,17 +1,22 @@
|
|||
<meta name="google-signin-client_id" content="524432312250-vhgidft856v8qftsc81kls4c74v87d8o.apps.googleusercontent.com">
|
||||
|
||||
<table class="table table-striped" [mfData]="tableData | projectTableFilter : filterQuery"
|
||||
<table class="table table-striped" [mfData]="tableData | projectTableFilter : filterQuery : whoami?.id : onlyMyProjects"
|
||||
#mf="mfDataTable" [mfRowsOnPage]="rowsOnPage" [(mfSortBy)]="sortBy" [(mfSortOrder)]="sortOrder">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="1">
|
||||
<input class="form-control" [(ngModel)]="filterQuery" placeholder='Filter' />
|
||||
</th>
|
||||
<th>
|
||||
<th style="width:50px;">
|
||||
<button class="btn btn-default" (click)="getProjects('false')">
|
||||
<span class="glyphicon glyphicon-refresh"></span>
|
||||
</button>
|
||||
</th>
|
||||
<th colspan="1">
|
||||
<div class="checkbox">
|
||||
<label><input type="checkbox" [(ngModel)]="onlyMyProjects" >Show only my projects</label>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th [ngClass]="{true:'visible', false:'invisible'}[showIDs]">
|
||||
|
@ -24,10 +29,10 @@
|
|||
<mfDefaultSorter by="abbreviation">Αbbreviation</mfDefaultSorter>
|
||||
</th>
|
||||
<th>
|
||||
<mfDefaultSorter by="startDate">Start Date</mfDefaultSorter>
|
||||
<mfDefaultSorter by="startdate">Start Date</mfDefaultSorter>
|
||||
</th>
|
||||
<th>
|
||||
<mfDefaultSorter by="endDate">End Date</mfDefaultSorter>
|
||||
<mfDefaultSorter by="enddate">End Date</mfDefaultSorter>
|
||||
</th>
|
||||
<th>
|
||||
<mfDefaultSorter by="status">Status</mfDefaultSorter>
|
||||
|
@ -48,14 +53,22 @@
|
|||
|
||||
<tr *ngFor="let project of mf.data" class="hover">
|
||||
<td [ngClass]="{true:'visible', false:'invisible'}[showIDs]">{{project?.id}}</td>
|
||||
<td>{{project?.label}}</td>
|
||||
<td>{{(project?.label?.length > 40) ? (project?.label | slice:0:40)+'...':(project?.label) }}</td>
|
||||
<td>{{project?.abbreviation}}</td>
|
||||
<td>{{project?.startdate | date:'yyyy-MM-dd HH:mm:ss Z' }}</td>
|
||||
<td>{{project?.enddate | date:'yyyy-MM-dd HH:mm:ss Z'}}</td>
|
||||
<td>{{project?.status | statusToString}}</td>
|
||||
<td>{{project?.description}}</td>
|
||||
<td><a href="#" class="editGridColumn" (click)="editRow(project, $event)"><i class="fa fa-pencil fa-fw" data-toggle="tooltip" title="edit properties" id="editDMP"></i>
|
||||
<i class="fa fa-eraser fa-fw" data-toggle="tooltip" title="delete project"></i></a></td>
|
||||
<td>{{(project?.description?.length > 40) ? (project?.description | slice:0:40)+'...':(project?.description) }}</td>
|
||||
<td>
|
||||
<a [ngClass]="{'not-active': whoami?.id!=project?.creationUser?.id }" class="editGridColumn" (click)="editRow(project, $event)">
|
||||
<i class="fa fa-pencil fa-fw" data-toggle="tooltip" title="edit properties" id="editDMP" ></i>
|
||||
</a>
|
||||
<!--
|
||||
<a>
|
||||
<i class="fa fa-eraser fa-fw" data-toggle="tooltip" title="delete project"></i>
|
||||
</a>
|
||||
-->
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
|
@ -59,6 +59,8 @@ export class ProjectsComponent implements OnInit{
|
|||
|
||||
project: any;
|
||||
|
||||
whoami: any;
|
||||
onlyMyProjects : boolean = false;
|
||||
|
||||
options: DatepickerOptions = {
|
||||
minYear: 1900,
|
||||
|
@ -101,11 +103,22 @@ getEmptyProject(){
|
|||
|
||||
this.getProjects();
|
||||
|
||||
this.serverService.whoami().subscribe(
|
||||
response => {
|
||||
this.whoami = response;
|
||||
console.log(this.whoami)
|
||||
},
|
||||
err => {
|
||||
simple_notifier("danger",null,"Could not retrieve user config");
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
getProjects(muted? : boolean){
|
||||
this.serverService.getProjectsOfUser().subscribe(
|
||||
//this.serverService.getProjectsOfUser().subscribe(
|
||||
this.serverService.getAllProjects().subscribe(
|
||||
response => {
|
||||
this.tableData = response;
|
||||
if(muted && muted!=true)
|
||||
|
|
|
@ -17,13 +17,16 @@ export class RestBase {
|
|||
|
||||
|
||||
|
||||
protocol: string = "http";
|
||||
hostname: string ="localhost"
|
||||
port: number = 8080;
|
||||
webappname: string = "dmp-backend";
|
||||
|
||||
|
||||
/* protocol: string = "http";
|
||||
hostname: string ="dl010.madgik.di.uoa.gr" ;//"localhost";//"dl010.madgik.di.uoa.gr";//
|
||||
port: number = 8080;//8080;//
|
||||
webappname: string = "dmp-backend";//"dmp-backend-new";//*/
|
||||
|
||||
/*
|
||||
protocol: string = "http";
|
||||
hostname: string ="dl010.madgik.di.uoa.gr"
|
||||
port: number = 8080;
|
||||
webappname: string = "dmp-backend";
|
||||
|
||||
|
||||
|
||||
|
@ -31,6 +34,7 @@ export class RestBase {
|
|||
hostname: string = "dionysus.di.uoa.gr" ;
|
||||
port: number = 7070;
|
||||
webappname: string = "dmp-backend";
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -99,7 +99,6 @@ export class ServerService {
|
|||
return this.restBase.get("dmp/getofuser");
|
||||
}
|
||||
|
||||
|
||||
public createDmpForCurrentUser(data:any){
|
||||
return this.restBase.post("dmp/createofuser", data);
|
||||
}
|
||||
|
@ -140,6 +139,10 @@ public deleteDataset(dataset: any){
|
|||
return this.restBase.post("dataset/softdelete", dataset);
|
||||
}
|
||||
|
||||
public whoami(){
|
||||
return this.restBase.get("user/whoami");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
logOut() {
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<p>
|
||||
Under construction
|
||||
</p>
|
|
@ -0,0 +1,18 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'dmp-detailed',
|
||||
templateUrl: './dmp-detailed.component.html',
|
||||
styleUrls: ['./dmp-detailed.component.css']
|
||||
})
|
||||
export class DmpDetailedComponent implements OnInit {
|
||||
|
||||
constructor() {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -33,10 +33,7 @@ export class BreadcrumbComponent implements OnInit {
|
|||
//this.breadcrumbData.length = 0;
|
||||
this.route.children.forEach( child => {
|
||||
let menuItem : MenuItem = this.guessMenuItemFromActivatedRoute(child, event);
|
||||
if(menuItem != null) {
|
||||
this.adaptBreadcrumbByMenuItem(menuItem);
|
||||
//this.breadcrumbData.push(menuItem);
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
@ -55,7 +52,7 @@ export class BreadcrumbComponent implements OnInit {
|
|||
let label = null;
|
||||
|
||||
if(componentName == "ProjectsComponent") {
|
||||
label = "My Projects";
|
||||
label = "Projects";
|
||||
}
|
||||
if(componentName == "DmpComponent"){
|
||||
label = "My Data Management Plans";
|
||||
|
@ -69,6 +66,10 @@ export class BreadcrumbComponent implements OnInit {
|
|||
label = "Form of dataset '"+params["label"]+"'";
|
||||
}
|
||||
|
||||
if(componentName == "DmpDetailedComponent"){
|
||||
label = "Details of DMP '"+params["label"]+"'";
|
||||
}
|
||||
|
||||
|
||||
if(label != null)
|
||||
menuItem = {"label": label, "routerLink": url, "queryParams" : params };
|
||||
|
@ -81,6 +82,11 @@ export class BreadcrumbComponent implements OnInit {
|
|||
|
||||
adaptBreadcrumbByMenuItem(menuItem : MenuItem){
|
||||
|
||||
if(menuItem==null){
|
||||
this.breadcrumbData.length = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
let breadcrumbDataNew: MenuItem[] = new Array<MenuItem>();
|
||||
for(var i=0; i<this.breadcrumbData.length;i++){
|
||||
if(this.breadcrumbData[i].label == menuItem.label)
|
||||
|
|
Loading…
Reference in New Issue