no message

This commit is contained in:
Ioannis Kalyvas 2018-10-02 17:33:58 +03:00
parent f2bfd402f8
commit e0c302e67e
148 changed files with 1952 additions and 872 deletions

1
.gitignore vendored
View File

@ -33,3 +33,4 @@ final/
temp/
*.jar
*.lst
dmp-frontend/.vscode/

View File

@ -0,0 +1,46 @@
package eu.eudat.data.converters;
import org.springframework.format.datetime.DateFormatter;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
/**
* Created by ikalyvas on 9/25/2018.
*/
@Converter
public class DateToUTCConverter implements AttributeConverter<Date, Date> {
@Override
public Date convertToDatabaseColumn(Date attribute) {
if(attribute == null) return null;
DateFormat formatterIST = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
formatterIST.setTimeZone(TimeZone.getTimeZone("UTC"));
try {
String date = formatterIST.format(attribute);
return formatterIST.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
@Override
public Date convertToEntityAttribute(Date dbData) {
if(dbData == null) return null;
DateFormat formatterIST = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
formatterIST.setTimeZone(TimeZone.getTimeZone("UTC"));
try {
String date = formatterIST.format(dbData);
return formatterIST.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
}

View File

@ -0,0 +1,49 @@
package eu.eudat.data.dao.criteria;
import eu.eudat.data.entities.Dataset;
import eu.eudat.types.project.ProjectStateType;
import java.util.List;
import java.util.UUID;
/**
* Created by ikalyvas on 10/2/2018.
*/
public class DatasetPublicCriteria extends Criteria<Dataset>{
public ProjectStateType projectStatus;
public List<UUID> projects;
public List<UUID> datasetProfile;
public List<String> dmpOrganisations;
public ProjectStateType getProjectStatus() {
return projectStatus;
}
public void setProjectStatus(ProjectStateType projectStatus) {
this.projectStatus = projectStatus;
}
public List<UUID> getProjects() {
return projects;
}
public void setProjects(List<UUID> projects) {
this.projects = projects;
}
public List<UUID> getDatasetProfile() {
return datasetProfile;
}
public void setDatasetProfile(List<UUID> datasetProfile) {
this.datasetProfile = datasetProfile;
}
public List<String> getDmpOrganisations() {
return dmpOrganisations;
}
public void setDmpOrganisations(List<String> dmpOrganisations) {
this.dmpOrganisations = dmpOrganisations;
}
}

View File

@ -4,6 +4,7 @@ import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.jpa.hibernatequeryablelist.QueryableHibernateList;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

View File

@ -5,6 +5,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.Content;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.UUID;
@ -27,6 +28,7 @@ public class ContentDaoImpl extends DatabaseAccess<Content> implements ContentDa
}
@Override
@Async
public CompletableFuture<Content> createOrUpdateAsync(Content item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}

View File

@ -10,6 +10,7 @@ import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.types.FieldSelectionType;
import eu.eudat.queryable.types.SelectionField;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.Arrays;
@ -78,6 +79,7 @@ public class DMPDaoImpl extends DatabaseAccess<DMP> implements DMPDao {
return this.getDatabaseService().getQueryable(DMP.class);
}
@Async
@Override
public CompletableFuture<DMP> createOrUpdateAsync(DMP item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));

View File

@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.DMPProfile;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.UUID;
@ -22,6 +23,7 @@ public class DMPProfileDaoImpl extends DatabaseAccess<DMPProfile> implements DMP
super(databaseService);
}
@Async
@Override
public CompletableFuture<DMPProfile> createOrUpdateAsync(DMPProfile item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));

View File

@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.DataRepository;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
@ -38,6 +39,7 @@ public class DataRepositoryDaoImpl extends DatabaseAccess<DataRepository> implem
}
@Override
@Async
public CompletableFuture<DataRepository> createOrUpdateAsync(DataRepository item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}

View File

@ -9,6 +9,7 @@ import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.types.FieldSelectionType;
import eu.eudat.queryable.types.SelectionField;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.Arrays;
@ -76,6 +77,7 @@ public class DatasetDaoImpl extends DatabaseAccess<Dataset> implements DatasetDa
return this.getDatabaseService().getQueryable(Dataset.class);
}
@Async
public CompletableFuture<Dataset> createOrUpdateAsync(Dataset item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));
}

View File

@ -6,6 +6,7 @@ import eu.eudat.data.entities.DatasetExternalDataset;
import eu.eudat.data.entities.DatasetProfile;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
@ -33,6 +34,7 @@ public class DatasetExternalDatasetDaoImpl extends DatabaseAccess<DatasetExterna
}
@Override
@Async
public DatasetExternalDataset find(UUID id) {
return getDatabaseService().getQueryable(DatasetExternalDataset.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
}

View File

@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.DatasetProfile;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
@ -52,6 +53,7 @@ public class DatasetProfileDaoImpl extends DatabaseAccess<DatasetProfile> implem
return this.getDatabaseService().getQueryable(DatasetProfile.class);
}
@Async
@Override
public CompletableFuture<DatasetProfile> createOrUpdateAsync(DatasetProfile item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));

View File

@ -7,6 +7,7 @@ import eu.eudat.data.entities.DatasetProfile;
import eu.eudat.data.entities.DatasetService;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
@ -28,6 +29,7 @@ public class DatasetServiceDaoImpl extends DatabaseAccess<DatasetService> implem
return this.getDatabaseService().createOrUpdate(item, DatasetService.class);
}
@Async
@Override
public CompletableFuture<DatasetService> createOrUpdateAsync(DatasetService item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));

View File

@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.ExternalDataset;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
@ -48,6 +49,7 @@ public class ExternalDatasetDaoImpl extends DatabaseAccess<ExternalDataset> impl
return this.getDatabaseService().getQueryable(ExternalDataset.class);
}
@Async
@Override
public CompletableFuture<ExternalDataset> createOrUpdateAsync(ExternalDataset item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));

View File

@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.Invitation;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.UUID;
@ -45,6 +46,7 @@ public class InvitationDaoImpl extends DatabaseAccess<Invitation> implements Inv
return this.getDatabaseService().getQueryable(Invitation.class);
}
@Async
@Override
public CompletableFuture<Invitation> createOrUpdateAsync(Invitation item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));

View File

@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.Organisation;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
@ -47,6 +48,7 @@ public class OrganisationDaoImpl extends DatabaseAccess<Organisation> implements
return this.getDatabaseService().getQueryable(Organisation.class);
}
@Async
@Override
public CompletableFuture<Organisation> createOrUpdateAsync(Organisation item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));

View File

@ -8,6 +8,7 @@ import eu.eudat.data.entities.UserInfo;
import eu.eudat.queryable.QueryableList;
import eu.eudat.types.project.ProjectStateType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.persistence.criteria.JoinType;
@ -71,6 +72,7 @@ public class ProjectDaoImpl extends DatabaseAccess<Project> implements ProjectDa
return query;
}
@Async
@Override
public CompletableFuture<Project> createOrUpdateAsync(Project item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));

View File

@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.Registry;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
@ -47,6 +48,7 @@ public class RegistryDaoImpl extends DatabaseAccess<Registry> implements Registr
return this.getDatabaseService().getQueryable(Registry.class);
}
@Async
@Override
public CompletableFuture<Registry> createOrUpdateAsync(Registry item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));

View File

@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.Researcher;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
@ -49,6 +50,7 @@ public class ResearcherDaoImpl extends DatabaseAccess<Researcher> implements Res
return this.getDatabaseService().getQueryable(Researcher.class);
}
@Async
@Override
public CompletableFuture<Researcher> createOrUpdateAsync(Researcher item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));

View File

@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.Service;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
@ -47,6 +48,7 @@ public class ServiceDaoImpl extends DatabaseAccess<Service> implements ServiceDa
return this.getDatabaseService().getQueryable(Service.class);
}
@Async
@Override
public CompletableFuture<Service> createOrUpdateAsync(Service item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));

View File

@ -5,6 +5,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.UserDMP;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
@ -41,6 +42,7 @@ public class UserDmpDaoImpl extends DatabaseAccess<UserDMP> implements UserDmpDa
return this.getDatabaseService().getQueryable(UserDMP.class);
}
@Async
@Override
public CompletableFuture<UserDMP> createOrUpdateAsync(UserDMP item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));

View File

@ -6,6 +6,7 @@ import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.UserInfo;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.UUID;
@ -51,6 +52,7 @@ public class UserInfoDaoImpl extends DatabaseAccess<UserInfo> implements UserInf
return this.getDatabaseService().getQueryable(UserInfo.class);
}
@Async
@Override
public CompletableFuture<UserInfo> createOrUpdateAsync(UserInfo item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));

View File

@ -7,6 +7,7 @@ import eu.eudat.data.entities.UserInfo;
import eu.eudat.data.entities.UserRole;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.List;
@ -57,6 +58,7 @@ public class UserRoleDaoImpl extends DatabaseAccess<UserRole> implements UserRol
return this.getDatabaseService().getQueryable(UserRole.class);
}
@Async
@Override
public CompletableFuture<UserRole> createOrUpdateAsync(UserRole item) {
return CompletableFuture.supplyAsync(() -> this.createOrUpdate(item));

View File

@ -4,6 +4,7 @@ import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.util.List;
import java.util.UUID;
/**
@ -143,4 +144,10 @@ public class Content implements DataEntity<Content, UUID> {
public UUID getKeys() {
return this.id;
}
@Override
public Content buildFromTuple(List<Tuple> tuple, String base) {
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
return this;
}
}

View File

@ -1,9 +1,11 @@
package eu.eudat.data.entities;
import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.queryable.queryableentity.DataEntity;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@ -33,9 +35,13 @@ public class Credential implements DataEntity<Credential,UUID> {
private String publicValue;
@Column(name = "\"Secret\"", nullable = false)
private String secret;
@Column(name = "\"CreationTime\"", nullable = false)
@Convert(converter = DateToUTCConverter.class)
private Date creationTime;
@Column(name = "\"LastUpdateTime\"", nullable = false)
@Convert(converter = DateToUTCConverter.class)
private Date lastUpdateTime;
@Column(name = "\"ExternalId\"", nullable = false)
@ -140,4 +146,10 @@ public class Credential implements DataEntity<Credential,UUID> {
public UUID getKeys() {
return this.id;
}
@Override
public Credential buildFromTuple(List<Tuple> tuple, String base) {
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
return this;
}
}

View File

@ -1,12 +1,14 @@
package eu.eudat.data.entities;
import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.util.*;
import java.util.stream.Collectors;
@Entity
@ -15,7 +17,7 @@ import java.util.*;
@NamedEntityGraph(
name = "dataManagementPlanListingModel",
attributeNodes = {@NamedAttributeNode("organisations"), @NamedAttributeNode("researchers"),
@NamedAttributeNode("project"),@NamedAttributeNode("users"), @NamedAttributeNode("creator"), @NamedAttributeNode("profile"), @NamedAttributeNode("dataset")}
@NamedAttributeNode("project"), @NamedAttributeNode("users"), @NamedAttributeNode("creator"), @NamedAttributeNode("profile"), @NamedAttributeNode("dataset")}
),
@NamedEntityGraph(
name = "fullyDetailed",
@ -132,9 +134,11 @@ public class DMP implements DataEntity<DMP, UUID> {
private String dmpProperties;
@Column(name = "\"Created\"")
@Convert(converter = DateToUTCConverter.class)
private Date created = null;
@Column(name = "\"Modified\"")
@Convert(converter = DateToUTCConverter.class)
private Date modified = new Date();
@ -319,4 +323,11 @@ public class DMP implements DataEntity<DMP, UUID> {
return this.id;
}
@Override
public DMP buildFromTuple(List<Tuple> tuple, String base) {
this.id = tuple.get(0).get(base.isEmpty() ? "id" : base + "." + "id", UUID.class);
this.dataset = tuple.stream().map(x -> new Dataset().buildFromTuple(tuple, base.isEmpty() ? "dataset" : base + "." + "dataset")).collect(Collectors.toSet());
this.creator = tuple.stream().map(x -> new UserInfo().buildFromTuple(tuple, base.isEmpty() ? "creator" : base + "." + "creator")).collect(Collectors.toList()).get(0);
return this;
}
}

View File

@ -1,12 +1,14 @@
package eu.eudat.data.entities;
import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.UUID;
@ -39,9 +41,11 @@ public class DMPProfile implements DataEntity<DMPProfile, UUID> {
@Column(name = "\"Created\"")
@Convert(converter = DateToUTCConverter.class)
private Date created = null;
@Column(name = "\"Modified\"")
@Convert(converter = DateToUTCConverter.class)
private Date modified = new Date();
public int getStatus() {
@ -111,4 +115,10 @@ public class DMPProfile implements DataEntity<DMPProfile, UUID> {
public UUID getKeys() {
return this.id;
}
@Override
public DMPProfile buildFromTuple(List<Tuple> tuple, String base) {
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
return this;
}
}

View File

@ -8,6 +8,7 @@ import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.UUID;
@ -145,4 +146,10 @@ public class DataRepository implements Serializable, DataEntity<DataRepository,U
public UUID getKeys() {
return this.id;
}
@Override
public DataRepository buildFromTuple(List<Tuple> tuple, String base) {
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
return this;
}
}

View File

@ -1,6 +1,7 @@
package eu.eudat.data.entities;
import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
@ -17,7 +18,7 @@ import java.util.stream.Collectors;
attributeNodes = {@NamedAttributeNode("services"), @NamedAttributeNode(value = "datasetDataRepositories", subgraph = "datasetDataRepositories"), @NamedAttributeNode("datasetExternalDatasets"), @NamedAttributeNode("registries"),
@NamedAttributeNode(value = "dmp", subgraph = "dmp"), @NamedAttributeNode("profile"), @NamedAttributeNode("creator")},
subgraphs = {
@NamedSubgraph(name = "dmp", attributeNodes = {@NamedAttributeNode("creator"), @NamedAttributeNode("users")}),
@NamedSubgraph(name = "dmp", attributeNodes = {@NamedAttributeNode("creator"), @NamedAttributeNode("users"), @NamedAttributeNode("project"),@NamedAttributeNode("organisations")}),
@NamedSubgraph(name = "datasetDataRepositories", attributeNodes = {@NamedAttributeNode("dataRepository")})
}),
@ -126,9 +127,11 @@ public class Dataset implements DataEntity<Dataset, UUID> {
private boolean isPublic;
@Column(name = "\"Created\"")
@Convert(converter = DateToUTCConverter.class)
private Date created = null;
@Column(name = "\"Modified\"")
@Convert(converter = DateToUTCConverter.class)
private Date modified = new Date();
@ManyToOne(fetch = FetchType.LAZY)
@ -328,4 +331,10 @@ public class Dataset implements DataEntity<Dataset, UUID> {
public UUID getKeys() {
return this.id;
}
@Override
public Dataset buildFromTuple(List<Tuple> tuple, String base) {
this.id = (UUID) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id");
return this;
}
}

View File

@ -5,6 +5,7 @@ import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.util.List;
import java.util.UUID;
/**
@ -32,7 +33,6 @@ public class DatasetDataRepository implements DataEntity<DatasetDataRepository,U
@Column(name = "\"Role\"")
private Integer role;
@Column(name = "\"Data\"")
private String data;
@ -87,4 +87,10 @@ public class DatasetDataRepository implements DataEntity<DatasetDataRepository,U
public UUID getKeys() {
return this.id;
}
@Override
public DatasetDataRepository buildFromTuple(List<Tuple> tuple, String base) {
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
return this;
}
}

View File

@ -5,6 +5,7 @@ import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.util.List;
import java.util.UUID;
@ -18,7 +19,6 @@ public class DatasetExternalDataset implements DataEntity<DatasetExternalDataset
@Column(name = "\"Id\"", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
private UUID id;
@ManyToOne
@JoinColumn(name = "\"Dataset\"", nullable = false)
private Dataset dataset;
@ -85,4 +85,10 @@ public class DatasetExternalDataset implements DataEntity<DatasetExternalDataset
public UUID getKeys() {
return this.id;
}
@Override
public DatasetExternalDataset buildFromTuple(List<Tuple> tuple, String base) {
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
return this;
}
}

View File

@ -1,12 +1,14 @@
package eu.eudat.data.entities;
import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.UUID;
@ -37,9 +39,11 @@ public class DatasetProfile implements DataEntity<DatasetProfile,UUID> {
@Column(name = "\"Created\"")
@Convert(converter = DateToUTCConverter.class)
private Date created;
@Column(name = "\"Modified\"")
@Convert(converter = DateToUTCConverter.class)
private Date modified = new Date();
@Column(name = "\"Description\"")
@ -135,4 +139,10 @@ public class DatasetProfile implements DataEntity<DatasetProfile,UUID> {
public UUID getKeys() {
return this.id;
}
@Override
public DatasetProfile buildFromTuple(List<Tuple> tuple, String base) {
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
return this;
}
}

View File

@ -7,6 +7,7 @@ import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
import java.util.UUID;
@ -87,4 +88,10 @@ public class DatasetService implements DataEntity<DatasetService, UUID> {
public UUID getKeys() {
return this.id;
}
@Override
public DatasetService buildFromTuple(List<Tuple> tuple, String base) {
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
return this;
}
}

View File

@ -1,10 +1,12 @@
package eu.eudat.data.entities;
import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.UUID;
@ -27,9 +29,11 @@ public class ExternalDataset implements DataEntity<ExternalDataset,UUID> {
private String reference;
@Column(name = "\"Created\"", nullable = false)
@Convert(converter = DateToUTCConverter.class)
private Date created;
@Column(name = "\"Modified\"", nullable = false)
@Convert(converter = DateToUTCConverter.class)
private Date modified;
@OneToMany(mappedBy = "externalDataset", cascade = CascadeType.ALL, orphanRemoval = true)
@ -102,4 +106,10 @@ public class ExternalDataset implements DataEntity<ExternalDataset,UUID> {
public UUID getKeys() {
return this.id;
}
@Override
public ExternalDataset buildFromTuple(List<Tuple> tuple, String base) {
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
return this;
}
}

View File

@ -5,6 +5,7 @@ import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.util.List;
import java.util.UUID;
@ -104,4 +105,10 @@ public class Invitation implements DataEntity<Invitation,UUID> {
public UUID getKeys() {
return this.id;
}
@Override
public Invitation buildFromTuple(List<Tuple> tuple, String base) {
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
return this;
}
}

View File

@ -1,6 +1,7 @@
package eu.eudat.data.entities;
import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
@ -8,6 +9,7 @@ import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.UUID;
@ -53,9 +55,11 @@ public class Organisation implements Serializable, DataEntity<Organisation,UUID>
@Column(name = "\"Created\"")
@Convert(converter = DateToUTCConverter.class)
private Date created = null;
@Column(name = "\"Modified\"")
@Convert(converter = DateToUTCConverter.class)
private Date modified = new Date();
@ -155,4 +159,10 @@ public class Organisation implements Serializable, DataEntity<Organisation,UUID>
public UUID getKeys() {
return this.id;
}
@Override
public Organisation buildFromTuple(List<Tuple> tuple, String base) {
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
return this;
}
}

View File

@ -1,14 +1,17 @@
package eu.eudat.data.entities;
import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
@Entity
@ -109,9 +112,11 @@ public class Project implements DataEntity<Project, UUID> {
@Column(name = "\"StartDate\"", nullable = false)
@Convert(converter = DateToUTCConverter.class)
private Date startdate = null;
@Column(name = "\"EndDate\"", nullable = false)
@Convert(converter = DateToUTCConverter.class)
private Date enddate = null;
@ -140,6 +145,13 @@ public class Project implements DataEntity<Project, UUID> {
@JoinColumn(name = "\"Content\"")
private Content content;
public Project() {
}
public Project(Project project) {
this.id = project.getId();
}
public String getDescription() {
return description;
}
@ -285,11 +297,17 @@ public class Project implements DataEntity<Project, UUID> {
this.enddate = entity.getEnddate();
this.modified = new Date();
if (entity.getContent() != null) this.content = entity.getContent();
//this.creationUser = entity.getCreationUser(); //TODO
}
@Override
public UUID getKeys() {
return this.id;
}
@Override
public Project buildFromTuple(List<Tuple> tuple, String base) {
this.id = (UUID) tuple.get(0).get(base.isEmpty() ? "id" : base + "." + "id" );
this.dmps = tuple.stream().map(x-> new DMP().buildFromTuple(tuple,"dmps")).collect(Collectors.toSet());
return this;
}
}

View File

@ -1,12 +1,14 @@
package eu.eudat.data.entities;
import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.UUID;
@ -50,9 +52,11 @@ public class Registry implements DataEntity<Registry,UUID> {
@Column(name = "\"Created\"")
@Convert(converter = DateToUTCConverter.class)
private Date created = null;
@Column(name = "\"Modified\"")
@Convert(converter = DateToUTCConverter.class)
private Date modified = new Date();
@ -151,4 +155,10 @@ public class Registry implements DataEntity<Registry,UUID> {
public UUID getKeys() {
return this.id;
}
@Override
public Registry buildFromTuple(List<Tuple> tuple, String base) {
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
return this;
}
}

View File

@ -1,12 +1,14 @@
package eu.eudat.data.entities;
import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.UUID;
@ -52,9 +54,11 @@ public class Researcher implements DataEntity<Researcher,UUID> {
@Column(name = "\"Created\"")
@Convert(converter = DateToUTCConverter.class)
private Date created = null;
@Column(name = "\"Modified\"")
@Convert(converter = DateToUTCConverter.class)
private Date modified = new Date();
@ -154,4 +158,10 @@ public class Researcher implements DataEntity<Researcher,UUID> {
public UUID getKeys() {
return this.id;
}
@Override
public Researcher buildFromTuple(List<Tuple> tuple, String base) {
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
return this;
}
}

View File

@ -1,12 +1,13 @@
package eu.eudat.data.entities;
import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.UUID;
@ -46,9 +47,11 @@ public class Service implements DataEntity<Service, UUID> {
@Column(name = "\"Created\"")
@Convert(converter = DateToUTCConverter.class)
private Date created = null;
@Column(name = "\"Modified\"")
@Convert(converter = DateToUTCConverter.class)
private Date modified = new Date();
@ -147,4 +150,10 @@ public class Service implements DataEntity<Service, UUID> {
public UUID getKeys() {
return this.id;
}
@Override
public Service buildFromTuple(List<Tuple> tuple, String base) {
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
return this;
}
}

View File

@ -4,6 +4,7 @@ import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.util.List;
import java.util.UUID;
@Entity
@ -94,4 +95,10 @@ public class UserDMP implements DataEntity<UserDMP, UUID> {
public UUID getKeys() {
return this.id;
}
@Override
public UserDMP buildFromTuple(List<Tuple> tuple, String base) {
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
return this;
}
}

View File

@ -1,14 +1,12 @@
package eu.eudat.data.entities;
import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import java.util.*;
@Entity
@ -44,10 +42,12 @@ public class UserInfo implements DataEntity<UserInfo, UUID> {
@Column(name = "created", nullable = false)
@Convert(converter = DateToUTCConverter.class)
private Date created = null;
@Column(name = "lastloggedin", nullable = true)
@Convert(converter = DateToUTCConverter.class)
private Date lastloggedin = null;
@ -177,4 +177,10 @@ public class UserInfo implements DataEntity<UserInfo, UUID> {
public UUID getKeys() {
return this.id;
}
@Override
public UserInfo buildFromTuple(List<Tuple> tuple, String base) {
this.id = (UUID) tuple.get(0).get(base.isEmpty() ? "id" : base + "." + "id" );
return this;
}
}

View File

@ -4,6 +4,7 @@ import eu.eudat.queryable.queryableentity.DataEntity;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.util.List;
import java.util.UUID;
@ -57,4 +58,10 @@ public class UserRole implements DataEntity<UserRole, UUID> {
public UUID getKeys() {
return this.id;
}
@Override
public UserRole buildFromTuple(List<Tuple> tuple, String base) {
this.id = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "id" : "id"));
return this;
}
}

View File

@ -1,9 +1,11 @@
package eu.eudat.data.entities;
import eu.eudat.data.converters.DateToUTCConverter;
import eu.eudat.queryable.queryableentity.DataEntity;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@ -20,10 +22,12 @@ public class UserToken implements DataEntity<UserToken, UUID> {
private UserInfo user;
@Column(name = "\"IssuedAt\"", nullable = false)
@Convert(converter = DateToUTCConverter.class)
private Date issuedAt = null;
@Column(name = "\"ExpiresAt\"", nullable = false)
@Convert(converter = DateToUTCConverter.class)
private Date expiresAt = null;
public UUID getToken() {
@ -67,4 +71,10 @@ public class UserToken implements DataEntity<UserToken, UUID> {
public UUID getKeys() {
return this.token;
}
@Override
public UserToken buildFromTuple(List<Tuple> tuple, String base) {
this.token = UUID.fromString((String) tuple.get(0).get(base.isEmpty() ? base + "." + "token" : "token"));
return this;
}
}

View File

@ -8,6 +8,16 @@ import eu.eudat.queryable.QueryableList;
import java.util.UUID;
public class ProjectCriteriaRequest extends Query<ProjectCriteria,Project> {
private Integer length;
public Integer getLength() {
return length;
}
public void setLength(Integer length) {
this.length = length;
}
private ProjectCriteriaRequest() {
}

View File

@ -0,0 +1,38 @@
package eu.eudat.data.query.items.table.dataset;
import eu.eudat.data.dao.criteria.DatasetPublicCriteria;
import eu.eudat.data.entities.Dataset;
import eu.eudat.data.query.definition.TableQuery;
import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.types.FieldSelectionType;
import eu.eudat.queryable.types.SelectionField;
import java.util.Arrays;
import java.util.UUID;
/**
* Created by ikalyvas on 10/2/2018.
*/
public class DatasetPublicTableRequest extends TableQuery<DatasetPublicCriteria, Dataset, UUID> {
@Override
public QueryableList<Dataset> applyCriteria() {
QueryableList<Dataset> query = this.getQuery();
query.initSubQuery(String.class).where((builder, root) -> builder.equal(root.get("dmp").get("version"),
query.<String>subQueryMax((builder1, externalRoot, nestedRoot) -> builder1.equal(externalRoot.get("dmp").get("groupId"), nestedRoot.get("dmp").get("groupId")),
Arrays.asList(new SelectionField(FieldSelectionType.COMPOSITE_FIELD, "dmp:version")), String.class)));
if (this.getCriteria().projects != null && !this.getCriteria().projects.isEmpty())
query.where(((builder, root) -> root.get("dmp").get("project").get("id").in(this.getCriteria().projects)));
if (this.getCriteria().projectStatus != null) query
.where(((builder, root) -> builder.equal(root.get("dmp").get("project").get("status"), this.getCriteria().projectStatus.getValue())));
if (this.getCriteria().datasetProfile != null && !this.getCriteria().datasetProfile.isEmpty()) query
.where(((builder, root) -> root.get("profile").get("id").in(this.getCriteria().datasetProfile)));
if(this.getCriteria().dmpOrganisations != null && !this.getCriteria().dmpOrganisations.isEmpty())query
.where(((builder, root) -> root.join("dmp").join("organisations").get("reference").in(this.getCriteria().dmpOrganisations)));
return query;
}
@Override
public QueryableList<Dataset> applyPaging(QueryableList<Dataset> items) {
return null;
}
}

View File

@ -2,25 +2,27 @@ package eu.eudat.queryable.jpa.hibernatequeryablelist;
import eu.eudat.queryable.QueryableList;
import eu.eudat.queryable.exceptions.NotSingleResultException;
import eu.eudat.queryable.jpa.predicates.*;
import eu.eudat.queryable.jpa.predicates.NestedQuerySinglePredicate;
import eu.eudat.queryable.jpa.predicates.OrderByPredicate;
import eu.eudat.queryable.jpa.predicates.SelectPredicate;
import eu.eudat.queryable.jpa.predicates.SinglePredicate;
import eu.eudat.queryable.queryableentity.DataEntity;
import eu.eudat.queryable.types.FieldSelectionType;
import eu.eudat.queryable.types.SelectionField;
import org.springframework.scheduling.annotation.Async;
import javax.persistence.EntityManager;
import javax.persistence.Tuple;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.*;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
public class QueryableHibernateList<T extends DataEntity> implements QueryableList<T> {
private EntityManager manager;
private CriteriaQuery<T> query;
private CriteriaQuery query;
private Class<T> tClass;
private Root<T> root;
private Root<T> nestedQueryRoot;
@ -57,15 +59,32 @@ public class QueryableHibernateList<T extends DataEntity> implements QueryableLi
}
private QueryableList<T> selectFields() {
List<Selection> rootFields = fields.stream().map(field -> root.get(field)).collect(Collectors.toList());
this.query.select(this.manager.getCriteriaBuilder().construct(tClass, rootFields.toArray(new Selection[rootFields.size()])));
List<Selection> rootFields = fields.stream().map(field -> this.convertFieldToPath(field)).collect(Collectors.toList());
this.query.select(this.manager.getCriteriaBuilder().tuple(rootFields.toArray(new Selection[rootFields.size()])));
return this;
}
private Path convertFieldToPath(String field) {
if (!field.contains(".")) {
Path path = this.root.get(field);
path.alias(field);
return path;
} else {
String[] fields = field.split("\\.");
Path path = this.root.get(fields[0]);
Join join = null;
path.alias(fields[0]);
for (int i = 1; i < fields.length; i++) {
join = join != null ? join.join(fields[i - 1], JoinType.LEFT) : this.root.join(fields[i - 1], JoinType.LEFT) ;
path = join.get(fields[i]);
path.alias(String.join(".", Arrays.asList(fields).subList(0, i + 1)));
}
return path;
}
}
public QueryableHibernateList<T> setEntity(Class<T> type) {
CriteriaBuilder builder = this.manager.getCriteriaBuilder();
this.query = builder.createQuery(type);
this.root = this.query.from(this.tClass);
return this;
}
@ -125,6 +144,7 @@ public class QueryableHibernateList<T extends DataEntity> implements QueryableLi
return this.manager.createQuery(criteriaQuery).getSingleResult();
}
@Async
public CompletableFuture<Long> countAsync() {
CriteriaBuilder criteriaBuilder = this.manager.getCriteriaBuilder();
CriteriaQuery<Long> criteriaQuery = criteriaBuilder.createQuery(Long.class);
@ -169,10 +189,33 @@ public class QueryableHibernateList<T extends DataEntity> implements QueryableLi
}
public List<T> toList() {
CriteriaBuilder builder = this.manager.getCriteriaBuilder();
if (!this.fields.isEmpty()) this.query = builder.createTupleQuery();
else this.query = builder.createQuery(this.tClass);
this.root = this.query.from(this.tClass);
this.query.where(this.generateWherePredicates(this.singlePredicates, this.root, this.nestedPredicates, this.nestedQueryRoot));
if (!this.orderings.isEmpty()) this.query.orderBy(this.generateOrderPredicates(this.orderings, this.root));
if (this.fields != null && !this.fields.isEmpty()) this.selectFields();
if (!this.fields.isEmpty()) this.selectFields();
if (distinct) this.query.distinct(true);
if (!this.fields.isEmpty()) return this.toListWithFields();
else return this.toListWithOutFields();
}
private List<T> toListWithFields() {
List<Tuple> results = this.manager.createQuery(query).getResultList();
Map<Object, List<Tuple>> groupedResults = results.stream()
.collect(Collectors.groupingBy(x -> x.get("id")));
return results.stream().map(x -> {
try {
return (T) this.tClass.newInstance().buildFromTuple(groupedResults.get(x.get("id")), "");
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
return null;
}).collect(Collectors.toList());
}
private List<T> toListWithOutFields() {
TypedQuery<T> typedQuery = this.manager.createQuery(this.query);
if (this.offset != null) typedQuery.setFirstResult(this.offset);
if (this.length != null) typedQuery.setMaxResults(this.length);
@ -183,11 +226,35 @@ public class QueryableHibernateList<T extends DataEntity> implements QueryableLi
return typedQuery.getResultList();
}
@Async
public CompletableFuture<List<T>> toListAsync() {
CriteriaBuilder builder = this.manager.getCriteriaBuilder();
if (!this.fields.isEmpty()) this.query = builder.createTupleQuery();
else this.query = builder.createQuery(this.tClass);
this.root = this.query.from(this.tClass);
this.query.where(this.generateWherePredicates(this.singlePredicates, this.root, this.nestedPredicates, this.nestedQueryRoot));
if (!this.orderings.isEmpty()) this.query.orderBy(this.generateOrderPredicates(this.orderings, this.root));
if (this.fields != null && !this.fields.isEmpty()) this.selectFields();
if (!this.fields.isEmpty()) this.selectFields();
if (distinct) this.query.distinct(true);
if (!this.fields.isEmpty()) return this.toListAsyncWithFields();
else return this.toListAsyncWithOutFields();
}
private CompletableFuture<List<T>> toListAsyncWithFields() {
List<Tuple> results = this.manager.createQuery(query).getResultList();
Map<Object, List<Tuple>> groupedResults = results.stream()
.collect(Collectors.groupingBy(x -> x.get("id")));
return CompletableFuture.supplyAsync(() -> results.stream().map(x -> {
try {
return (T) this.tClass.newInstance().buildFromTuple(groupedResults.get(x.get("id")), "");
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
return null;
}).collect(Collectors.toList()));
}
private CompletableFuture<List<T>> toListAsyncWithOutFields() {
TypedQuery<T> typedQuery = this.manager.createQuery(this.query);
if (this.offset != null) typedQuery.setFirstResult(this.offset);
if (this.length != null) typedQuery.setMaxResults(this.length);
@ -201,17 +268,26 @@ public class QueryableHibernateList<T extends DataEntity> implements QueryableLi
}
public T getSingle() {
CriteriaBuilder builder = this.manager.getCriteriaBuilder();
if (!this.fields.isEmpty()) this.query = builder.createTupleQuery();
else this.query = builder.createQuery(this.tClass);
this.root = this.query.from(this.tClass);
this.query.where(this.generateWherePredicates(this.singlePredicates, this.root, this.nestedPredicates, this.nestedQueryRoot));
if (this.fields != null && !this.fields.isEmpty()) this.selectFields();
if (!this.fields.isEmpty()) this.selectFields();
TypedQuery<T> typedQuery = this.manager.createQuery(this.query);
if (this.hint != null)
typedQuery.setHint("javax.persistence.fetchgraph", this.manager.getEntityGraph(this.hint));
return typedQuery.getSingleResult();
}
@Async
public CompletableFuture<T> getSingleAsync() {
CriteriaBuilder builder = this.manager.getCriteriaBuilder();
if (!this.fields.isEmpty()) this.query = builder.createTupleQuery();
else this.query = builder.createQuery(this.tClass);
this.root = this.query.from(this.tClass);
this.query.where(this.generateWherePredicates(this.singlePredicates, this.root, this.nestedPredicates, this.nestedQueryRoot));
if (this.fields != null && !this.fields.isEmpty()) this.selectFields();
if (!this.fields.isEmpty()) this.selectFields();
TypedQuery<T> typedQuery = this.manager.createQuery(this.query);
if (this.hint != null)
typedQuery.setHint("javax.persistence.fetchgraph", this.manager.getEntityGraph(this.hint));
@ -219,8 +295,12 @@ public class QueryableHibernateList<T extends DataEntity> implements QueryableLi
}
public T getSingleOrDefault() {
CriteriaBuilder builder = this.manager.getCriteriaBuilder();
if (!this.fields.isEmpty()) this.query = builder.createTupleQuery();
else this.query = builder.createQuery(this.tClass);
this.root = this.query.from(this.tClass);
this.query.where(this.generateWherePredicates(this.singlePredicates, this.root, this.nestedPredicates, this.nestedQueryRoot));
if (this.fields != null && !this.fields.isEmpty()) this.selectFields();
if (!this.fields.isEmpty()) this.selectFields();
TypedQuery<T> typedQuery = this.manager.createQuery(this.query);
if (this.hint != null)
typedQuery.setHint("javax.persistence.fetchgraph", this.manager.getEntityGraph(this.hint));
@ -230,9 +310,14 @@ public class QueryableHibernateList<T extends DataEntity> implements QueryableLi
else throw new NotSingleResultException("Query returned more than one items");
}
@Async
public CompletableFuture<T> getSingleOrDefaultAsync() {
CriteriaBuilder builder = this.manager.getCriteriaBuilder();
if (!this.fields.isEmpty()) this.query = builder.createTupleQuery();
else this.query = builder.createQuery(this.tClass);
this.root = this.query.from(this.tClass);
this.query.where(this.generateWherePredicates(this.singlePredicates, this.root, this.nestedPredicates, this.nestedQueryRoot));
if (this.fields != null && !this.fields.isEmpty()) this.selectFields();
if (!this.fields.isEmpty()) this.selectFields();
TypedQuery<T> typedQuery = this.manager.createQuery(this.query);
if (this.hint != null)
typedQuery.setHint("javax.persistence.fetchgraph", this.manager.getEntityGraph(this.hint));

View File

@ -1,7 +1,10 @@
package eu.eudat.queryable.queryableentity;
import javax.persistence.Tuple;
import java.util.List;
public interface DataEntity<T,K> {
void update(T entity);
K getKeys();
T buildFromTuple(List<Tuple> tuple, String base);
}

View File

@ -6,8 +6,10 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.scheduling.annotation.EnableAsync;
@SpringBootApplication
@EnableAsync
public class EuDatApplication extends SpringBootServletInitializer {
private static final Logger logger = LoggerFactory.getLogger(EuDatApplication.class);

View File

@ -2,10 +2,9 @@ package eu.eudat.configurations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.*;
import org.springframework.core.env.Environment;
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
@ -37,25 +36,26 @@ public class DevelDatabaseConfiguration {
JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
em.setJpaVendorAdapter(vendorAdapter);
em.setJpaProperties(additionalProperties());
return em;
}
@Bean
@Primary
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(env.getProperty("database.driver-class-name"));
dataSource.setUrl(env.getProperty("devel.database.url"));
dataSource.setUsername(env.getProperty("devel.database.username"));
dataSource.setPassword(env.getProperty("devel.database.password"));
return dataSource;
return DataSourceBuilder
.create()
.username(env.getProperty("devel.database.username"))
.password(env.getProperty("devel.database.password"))
.url(env.getProperty("devel.database.url"))
.driverClassName(env.getProperty("database.driver-class-name"))
.build();
}
@Bean
public PlatformTransactionManager transactionManager(EntityManagerFactory emf) {
JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(emf);
return transactionManager;
}
@ -69,6 +69,10 @@ public class DevelDatabaseConfiguration {
properties.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQL92Dialect");
properties.setProperty("hibernate.show_sql", "true");
properties.setProperty("hibernate.temp.use_jdbc_metadata_defaults", "false");
properties.setProperty("hibernate.c3p0.maxPoolSize", "70");
properties.setProperty("hibernate.c3p0.timeout", "5000");
properties.setProperty("hibernate.connection.release_mode", "after_transaction");
//properties.setProperty("hibernate.connection.provider_class", "org.hibernate.c3p0.internal.C3P0ConnectionProvider");
return properties;
}
}

View File

@ -0,0 +1,28 @@
package eu.eudat.configurations;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Created by ikalyvas on 9/26/2018.
*/
@Configuration
public class ExecutorServiceConfig {
@Bean
public Executor asyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(2);
executor.setMaxPoolSize(2);
executor.setQueueCapacity(500);
executor.setThreadNamePrefix("Rules-");
executor.initialize();
return executor;
}
}

View File

@ -1,11 +1,15 @@
package eu.eudat.controllers;
import eu.eudat.core.logger.Logger;
import eu.eudat.logic.managers.AdminManager;
import eu.eudat.logic.managers.UserManager;
import eu.eudat.logic.security.claims.ClaimedAuthorities;
import eu.eudat.logic.services.ApiContext;
import eu.eudat.logic.services.helpers.LoggerService;
import eu.eudat.models.data.admin.composite.DatasetProfile;
import eu.eudat.models.data.helpers.responses.ResponseItem;
import eu.eudat.models.data.security.Principal;
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
import eu.eudat.types.ApiMessageCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@ -24,13 +28,14 @@ import static eu.eudat.types.Authorities.ADMIN;
public class Admin extends BaseController {
@Autowired
public Admin(ApiContext apiContext) {
public Admin(ApiContext apiContext, Logger logger) {
super(apiContext);
}
@Transactional
@RequestMapping(method = RequestMethod.POST, value = {"/admin/addDmp"}, consumes = "application/json", produces = "application/json")
public ResponseEntity<Object> addDmp(@Valid @RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
//this.getLoggerService().info(principal, "Admin Added Dataset Profile");
eu.eudat.data.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile, getApiContext());
this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().createOrUpdate(modelDefinition);
return ResponseEntity.status(HttpStatus.OK).body(modelDefinition.getId());
@ -39,6 +44,7 @@ public class Admin extends BaseController {
@Transactional
@RequestMapping(method = RequestMethod.POST, value = {"/admin/addDmp/{id}"}, consumes = "application/json", produces = "application/json")
public ResponseEntity<ResponseItem<UUID>> updateDmp(@PathVariable String id, @RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
//this.getLoggerService().info(principal, "Admin Edited Dataset Profile");
eu.eudat.data.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile, getApiContext());
eu.eudat.data.entities.DatasetProfile datasetprofile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
@ -50,9 +56,20 @@ public class Admin extends BaseController {
@RequestMapping(method = RequestMethod.GET, value = {"/admin/get/{id}"}, produces = "application/json")
public ResponseEntity<ResponseItem<DatasetProfile>> get(@PathVariable String id, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
//this.getLoggerService().info(principal, "Admin Open Dataset Profile");
eu.eudat.data.entities.DatasetProfile profile = this.getApiContext().getOperationsContext().getDatabaseRepository().getDatasetProfileDao().find(UUID.fromString(id));
eu.eudat.models.data.admin.composite.DatasetProfile datasetprofile = AdminManager.generateDatasetProfileModel(profile);
datasetprofile.setLabel(profile.getLabel());
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DatasetProfile>().status(ApiMessageCode.NO_MESSAGE).payload(datasetprofile));
}
@RequestMapping(method = RequestMethod.POST, value = {"/admin/preview"}, consumes = "application/json",produces = "application/json")
public ResponseEntity<ResponseItem<PagedDatasetProfile>> getPreview(@RequestBody DatasetProfile profile, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) {
//this.getLoggerService().info(principal, "Admin Previewed Dataset Profile");
eu.eudat.data.entities.DatasetProfile modelDefinition = AdminManager.generateViewStyleDefinition(profile, getApiContext());
eu.eudat.models.data.user.composite.DatasetProfile datasetProfile = UserManager.generateDatasetProfileModel(modelDefinition);
PagedDatasetProfile pagedDatasetProfile = new PagedDatasetProfile();
pagedDatasetProfile.buildPagedDatasetProfile(datasetProfile);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<PagedDatasetProfile>().status(ApiMessageCode.NO_MESSAGE).payload(pagedDatasetProfile));
}
}

View File

@ -1,20 +1,30 @@
package eu.eudat.controllers;
import eu.eudat.core.logger.Logger;
import eu.eudat.logic.services.ApiContext;
import eu.eudat.logic.services.helpers.LoggerService;
import eu.eudat.models.validators.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
public abstract class BaseController {
private Logger logger;
private ApiContext apiContext;
public ApiContext getApiContext() {
return apiContext;
}
public Logger getLoggerService() {
return logger;
}
public BaseController(ApiContext apiContext) {
this.apiContext = apiContext;
}

View File

@ -1,6 +1,7 @@
package eu.eudat.controllers;
import eu.eudat.data.entities.Dataset;
import eu.eudat.data.query.items.table.dataset.DatasetPublicTableRequest;
import eu.eudat.data.query.items.table.dataset.DatasetTableRequest;
import eu.eudat.logic.managers.DatasetManager;
import eu.eudat.logic.security.claims.ClaimedAuthorities;
@ -33,7 +34,14 @@ public class Datasets extends BaseController {
@RequestMapping(method = RequestMethod.POST, value = {"/datasets/getPaged"}, consumes = "application/json", produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<DataTableData<DatasetListingModel>>> getPaged(@RequestBody DatasetTableRequest datasetTableRequest, @ClaimedAuthorities(claims = {Authorities.ANONYMOUS}) Principal principal) throws Exception {
ResponseEntity<ResponseItem<DataTableData<DatasetListingModel>>> getPaged(@RequestBody DatasetTableRequest datasetTableRequest, Principal principal) throws Exception {
DataTableData<DatasetListingModel> dataTable = new DatasetManager().getPaged(this.getApiContext(), datasetTableRequest, principal);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<DatasetListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
}
@RequestMapping(method = RequestMethod.POST, value = {"/datasets/public/paged"}, consumes = "application/json", produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<DataTableData<DatasetListingModel>>> getPublicPaged(@RequestBody DatasetPublicTableRequest datasetTableRequest, @ClaimedAuthorities(claims = {Authorities.ANONYMOUS}) Principal principal) throws Exception {
DataTableData<DatasetListingModel> dataTable = new DatasetManager().getPaged(this.getApiContext(), datasetTableRequest, principal);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<DatasetListingModel>>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable));
}

View File

@ -6,6 +6,7 @@ import eu.eudat.data.query.items.table.project.ProjectTableRequest;
import eu.eudat.logic.managers.ProjectManager;
import eu.eudat.logic.proxy.config.exceptions.HugeResultSet;
import eu.eudat.logic.proxy.config.exceptions.NoURLFound;
import eu.eudat.logic.security.claims.ClaimedAuthorities;
import eu.eudat.logic.services.ApiContext;
import eu.eudat.models.data.external.ProjectsExternalSourcesModel;
import eu.eudat.models.data.helpers.common.DataTableData;
@ -25,6 +26,9 @@ import java.text.ParseException;
import java.util.List;
import java.util.Map;
import static eu.eudat.types.Authorities.ADMIN;
import static eu.eudat.types.Authorities.ANONYMOUS;
@RestController
@CrossOrigin
@ -78,7 +82,7 @@ public class Projects extends BaseController {
@RequestMapping(method = RequestMethod.POST, value = {"/projects/get"}, consumes = "application/json", produces = "application/json")
public @ResponseBody
ResponseEntity<ResponseItem<List<eu.eudat.models.data.project.Project>>> get(@RequestBody ProjectCriteriaRequest projectCriteria, Principal principal) throws NoURLFound, InstantiationException, HugeResultSet, IllegalAccessException {
ResponseEntity<ResponseItem<List<eu.eudat.models.data.project.Project>>> get(@RequestBody ProjectCriteriaRequest projectCriteria, @ClaimedAuthorities(claims = {ANONYMOUS}) Principal principal) throws NoURLFound, InstantiationException, HugeResultSet, IllegalAccessException {
List<eu.eudat.models.data.project.Project> dataTable = new ProjectManager().getCriteria(this.getApiContext().getOperationsContext().getDatabaseRepository().getProjectDao(), projectCriteria, this.getApiContext().getOperationsContext().getRemoteFetcher());
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<eu.eudat.models.data.project.Project>>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE));
}

View File

@ -1,21 +1,19 @@
package eu.eudat.logic.handlers;
import eu.eudat.exceptions.security.UnauthorisedException;
import eu.eudat.models.data.security.Principal;
import eu.eudat.logic.security.claims.ClaimedAuthorities;
import eu.eudat.logic.services.operations.AuthenticationService;
import eu.eudat.models.data.security.Principal;
import eu.eudat.types.Authorities;
import org.springframework.core.MethodParameter;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.support.WebDataBinderFactory;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer;
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import java.util.*;
public final class PrincipalArgumentResolver implements HandlerMethodArgumentResolver {
@ -32,7 +30,8 @@ public final class PrincipalArgumentResolver implements HandlerMethodArgumentRes
String token = nativeWebRequest.getHeader("AuthToken");
Optional<Annotation> claimsAnnotation = Arrays.stream(methodParameter.getParameterAnnotations()).filter(annotation -> annotation.annotationType().equals(ClaimedAuthorities.class)).findAny();
List<Authorities> claimList = claimsAnnotation.map(annotation -> Arrays.asList(((ClaimedAuthorities) annotation).claims())).orElse(Authorities.all());
if(token == null && claimList.size() == 1 && claimList.get(0).equals(Authorities.ANONYMOUS)) return new Principal();
if (token == null && claimList.size() == 1 && claimList.get(0).equals(Authorities.ANONYMOUS))
return new Principal();
if (token == null) throw new UnauthorisedException("Authentication Information Is Missing");
UUID authToken;
try {
@ -45,6 +44,13 @@ public final class PrincipalArgumentResolver implements HandlerMethodArgumentRes
if (principal == null) throw new UnauthorisedException("Authentication Information Missing");
if (!claimList.contains(Authorities.ANONYMOUS) && !principal.isAuthorized(claimList))
throw new UnauthorisedException("You are not Authorized For this Action");
/*Principal principal1 = new Principal();
principal1.setId(UUID.fromString("46366b8a-a712-4e0c-a499-1a3a0f209325"));
principal1.setToken(UUID.fromString("19031e80-6534-4aa5-b68a-78e97042c968"));
principal1.setName("Ioannis Kalyvas");
principal1.setAvatarUrl("https://lh5.googleusercontent.com/-X65vX1QO_Ew/AAAAAAAAAAI/AAAAAAAAAAA/AAN31DU5lFIOwD_fZiYW96D410pn6v4E-Q/s96-c/photo.jpg");
principal1.setAuthorities(new HashSet<>(Arrays.asList(Authorities.ADMIN, Authorities.USER)));
principal1.setExpiresAt(addADay(new Date()));*/
return principal;
}
@ -52,4 +58,13 @@ public final class PrincipalArgumentResolver implements HandlerMethodArgumentRes
this.authenticationService = authenticationService;
}
private Date addADay(Date date) {
Date dt = new Date();
Calendar c = Calendar.getInstance();
c.setTime(dt);
c.add(Calendar.DATE, 1);
dt = c.getTime();
return dt;
}
}

View File

@ -235,7 +235,7 @@ public class DataManagementPlanManager {
}
}
@Async
private static void copyDatasets(DMP newDmp, DatasetDao datasetDao) {
List<CompletableFuture<Dataset>> futures = new LinkedList<>();
for (Dataset dataset : newDmp.getDataset()) {

View File

@ -6,6 +6,7 @@ import eu.eudat.data.dao.criteria.RegistryCriteria;
import eu.eudat.data.dao.criteria.ServiceCriteria;
import eu.eudat.data.dao.entities.*;
import eu.eudat.data.entities.*;
import eu.eudat.data.query.items.table.dataset.DatasetPublicTableRequest;
import eu.eudat.data.query.items.table.dataset.DatasetTableRequest;
import eu.eudat.elastic.criteria.DatasetCriteria;
import eu.eudat.elastic.repository.DatasetRepository;
@ -76,6 +77,25 @@ public class DatasetManager {
return dataTable;
}
public DataTableData<DatasetListingModel> getPaged(ApiContext apiContext, DatasetPublicTableRequest datasetTableRequest, Principal principal) throws Exception {
datasetTableRequest.setQuery(apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao().asQueryable().withHint(HintedModelFactory.getHint(DatasetListingModel.class)));
QueryableList<eu.eudat.data.entities.Dataset> pagedItems = PaginationManager.applyPaging(datasetTableRequest.applyCriteria(), datasetTableRequest);
DataTableData<DatasetListingModel> dataTable = new DataTableData<DatasetListingModel>();
CompletableFuture<List<DatasetListingModel>> itemsFuture = pagedItems.
selectAsync(item -> new DatasetListingModel().fromDataModel(item)).whenComplete((resultList, throwable) -> {
dataTable.setData(resultList);
});
CompletableFuture countFuture = pagedItems.countAsync().whenComplete((count, throwable) -> {
dataTable.setTotalCount(count);
});
CompletableFuture.allOf(itemsFuture, countFuture).join();
return dataTable;
}
public DatasetWizardModel getSingle(DatasetDao datatasetRepository, DatasetRepository elasticDatasetRepository, String id) throws InstantiationException, IllegalAccessException, IOException {
DatasetWizardModel dataset = new DatasetWizardModel();
eu.eudat.data.entities.Dataset datasetEntity = datatasetRepository.find(UUID.fromString(id), HintedModelFactory.getHint(DatasetWizardModel.class));

View File

@ -97,6 +97,7 @@ public class ProjectManager {
public List<eu.eudat.models.data.project.Project> getCriteria(ProjectDao projectRepository, ProjectCriteriaRequest projectCriteria, RemoteFetcher remoteFetcher) throws IllegalAccessException, InstantiationException, HugeResultSet, NoURLFound {
QueryableList<eu.eudat.data.entities.Project> items = projectRepository.getWithCriteria(projectCriteria.getCriteria());
if(projectCriteria.getLength() != null) items.take(projectCriteria.getLength());
List<eu.eudat.models.data.project.Project> projects = items.select(item -> new Project().fromDataModel(item));
return projects;
}

View File

@ -6,6 +6,7 @@ import eu.eudat.models.data.dmp.Organisation;
import eu.eudat.logic.utilities.helpers.LabelBuilder;
import eu.eudat.models.data.urls.DatasetUrlListing;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
@ -16,9 +17,9 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
private String label;
private String project;
private String profile;
private String creationTime;
private Date creationTime;
private String organisations;
private String version;
private int version;
private UUID groupId;
private List<DatasetUrlListing> datasets;
@ -54,11 +55,11 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
this.profile = profile;
}
public String getCreationTime() {
public Date getCreationTime() {
return creationTime;
}
public void setCreationTime(String creationTime) {
public void setCreationTime(Date creationTime) {
this.creationTime = creationTime;
}
@ -70,11 +71,11 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
this.organisations = organisations;
}
public String getVersion() {
public int getVersion() {
return version;
}
public void setVersion(String version) {
public void setVersion(int version) {
this.version = version;
}
@ -101,8 +102,8 @@ public class DataManagementPlanListingModel implements DataModel<DMP, DataManage
this.project = entity.getProject().getLabel();
if (entity.getProfile() != null) this.profile = entity.getProfile().getLabel();
this.organisations = LabelBuilder.getLabel(entity.getOrganisations().stream().map(item -> new Organisation().fromDataModel(item)).collect(Collectors.toList()));
this.creationTime = entity.getCreated().toString();
this.version = "" + entity.getVersion();
this.creationTime = entity.getCreated();
this.version = entity.getVersion();
this.groupId = entity.getGroupId();
this.datasets = entity.getDataset().stream().map(x-> new DatasetUrlListing().fromDataModel(x)).collect(Collectors.toList());
return this;

View File

@ -6,6 +6,7 @@ import eu.eudat.models.data.dataset.DataRepository;
import eu.eudat.models.data.dataset.Service;
import eu.eudat.logic.utilities.helpers.LabelBuilder;
import java.util.Date;
import java.util.stream.Collectors;
@ -17,8 +18,8 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
private String dataRepositories;
private String registries;
private String services;
private String status;
private String created;
private int status;
private Date created;
private String description;
public String getId() {
@ -77,19 +78,19 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
this.services = services;
}
public String getStatus() {
public int getStatus() {
return status;
}
public void setStatus(String status) {
public void setStatus(int status) {
this.status = status;
}
public String getCreated() {
public Date getCreated() {
return created;
}
public void setCreated(String created) {
public void setCreated(Date created) {
this.created = created;
}
@ -105,11 +106,11 @@ public class DatasetListingModel implements DataModel<Dataset, DatasetListingMod
public DatasetListingModel fromDataModel(Dataset entity) {
this.id = entity.getId().toString();
this.label = entity.getLabel();
this.created = entity.getCreated().toString();
this.created = entity.getCreated();
this.dmp = entity.getDmp() != null ? entity.getDmp().getLabel() : "";
this.profile = entity.getProfile() != null ? entity.getProfile().getLabel() : "";
this.description = entity.getDescription();
this.status = "" + entity.getStatus();
this.status = entity.getStatus();
this.registries = LabelBuilder.getLabel(entity.getRegistries().stream().map(item -> new eu.eudat.models.data.dataset.Registry().fromDataModel(item)).collect(Collectors.toList()));
this.dataRepositories = LabelBuilder.getLabel(entity.getDatasetDataRepositories().stream().map(item -> new DataRepository().fromDataModel(item.getDataRepository())).collect(Collectors.toList()));
this.services = LabelBuilder.getLabel(entity.getServices().stream().map(item -> new Service().fromDataModel(item.getService())).collect(Collectors.toList()));

View File

@ -7,6 +7,7 @@ import eu.eudat.models.data.files.ContentFile;
import eu.eudat.models.data.urls.DataManagementPlanUrlListing;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
@ -26,17 +27,17 @@ public class ProjectListingModel implements DataModel<eu.eudat.data.entities.Pro
private String definition;
private String startDate;
private Date startDate;
private String endDate;
private Date endDate;
private Project.Status status;
private UserInfo creationUser;
private String created;
private Date created;
private String modified;
private Date modified;
private String description;
@ -117,35 +118,39 @@ public class ProjectListingModel implements DataModel<eu.eudat.data.entities.Pro
this.creationUser = creationUser;
}
public String getStartDate() {
public Date getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public String getEndDate() {
public Date getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public String getCreated() {
public void setStatus(Project.Status status) {
this.status = status;
}
public Date getCreated() {
return created;
}
public void setCreated(String created) {
public void setCreated(Date created) {
this.created = created;
}
public String getModified() {
public Date getModified() {
return modified;
}
public void setModified(String modified) {
public void setModified(Date modified) {
this.modified = modified;
}
@ -173,11 +178,11 @@ public class ProjectListingModel implements DataModel<eu.eudat.data.entities.Pro
this.reference = entity.getReference();
this.uri = entity.getUri();
this.definition = entity.getDefinition();
this.startDate = entity.getStartdate() != null ? entity.getStartdate().toString() : null;
this.endDate = entity.getEnddate() != null ? entity.getEnddate().toString() : null;
this.startDate = entity.getStartdate();
this.endDate = entity.getEnddate();
this.setStatus(entity.getStatus());
this.created = entity.getCreated().toString();
this.modified = entity.getModified().toString();
this.created = entity.getCreated();
this.modified = entity.getModified();
this.description = entity.getDescription();
this.dmps = entity.getDmps().stream().map(item -> new DataManagementPlanUrlListing().fromDataModel(item)).collect(Collectors.toList());
this.files = entity.getContent() != null ? Arrays.asList(new ContentFile(entity.getContent().getLabel(), UUID.fromString(entity.getContent().getUri().split(":")[1]), "final", entity.getContent().getExtension())) : Arrays.asList(new ContentFile("default.png", null, null, null));

View File

@ -3,12 +3,13 @@
#eu.eudat.logic.security.portmapping.https = 7444
########################/Security########################################
server.port=8080
server.tomcat.max-threads = 1000
logging.file=/logs/spring-boot-logging.log
##########################Persistence##########################################
database.driver-class-name=org.postgresql.Driver
devel.database.url=jdbc:postgresql://dbserver02.local.cite.gr:5432/dmptool
devel.database.username=dmtadm
devel.database.password=t00L4DM@18!
devel.database.url=jdbc:postgresql://localhost:32768/dmptool
devel.database.username=postgres
devel.database.password=
production.database.url=jdbc:postgresql://develdb1.madgik.di.uoa.gr:5432/dmptool
production.database.username=dmptool
production.database.password=dmpt00lu$r
@ -69,7 +70,19 @@ project.configuration.grant.name = Grant
#################################################################################
http-logger.initial-delay = 0
http-logger.delay = 10
http-logger.server-address = http://logstash:31311
http-logger.server-address = http://localhost:31311
#############################Elastic Search######################################
elasticsearch.host = elasticsearch-dmp
elasticsearch.port = 9200
elasticsearch.host = localhost
elasticsearch.port = 9201
############################
# Number of ms to wait before throwing an exception if no connection is available.
spring.datasource.maxIdle: 10
spring.datasource.max-active: 70
spring.datasource.max-wait: 10000
spring.datasource.validationQuery: select 1
spring.datasource.removeAbandoned: true
spring.datasource.removeAbandonedTimeout: 1
spring.datasource.logAbandoned: true
spring.datasource.testOnBorrow: true
spring.datasource.testOnConnect: false
spring.datasource.testWhileIdle: false

View File

@ -12,4 +12,5 @@ RUN if [ "$env" = "prod" ]; then ng build --$env --$aot; else ng build --$aot;
# Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx
FROM nginx:1.13
COPY --from=angular /app/dist/ /usr/share/nginx/html
COPY --from=angular /app/static/ /usr/share/nginx/static
COPY ./nginx-custom.conf /etc/nginx/conf.d/default.conf

View File

@ -5,4 +5,8 @@ server {
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}
location /material/ {
alias /usr/share/nginx/static/;
}
}

View File

@ -35,6 +35,7 @@ import { BreadCrumbResolverService } from './services/breadcrumb/breadcrumb-reso
import { MAT_DATE_LOCALE } from '@angular/material';
import { CultureService } from './utilities/culture/culture-service';
@NgModule({
declarations: [
AppComponent,

View File

@ -1,70 +1,77 @@
<div>
<h4 style="font-weight: bold">Composite Field Description</h4>
<div fxLayout="row">
<mat-checkbox [(ngModel)]="isComposite" (ngModelChange)="onIsCompositeChange(isComposite)">Composite Field</mat-checkbox>
<mat-checkbox [(ngModel)]="isMultiplicityEnabled" (ngModelChange)="onIsMultiplicityEnabledChange(isMultiplicityEnabled)">Multiplicity</mat-checkbox>
<div [formGroup]="form">
<mat-checkbox formControlName="hasCommentField"> Comment</mat-checkbox>
<div class="row">
<div class="form-group col-md-6">
<mat-checkbox [formControl]="this.form.get('hasCommentField')"> Comment</mat-checkbox>
</div>
<div fxLayout="row">
<div fxFlex>
<mat-form-field class="full-width">
<input matInput type="text" placeholder="Title" formControlName="title">
</mat-form-field>
<mat-form-field class="full-width">
<input matInput type="text" placeholder="Description" formControlName="description">
</mat-form-field>
<mat-form-field class="full-width">
<input matInput type="text" placeholder="Extended Description" formControlName="extendedDescription">
<input matInput type="text" placeholder="Title" [formControl]="this.form.get('title')">
</mat-form-field>
</div>
<div class="form-group col-md-6">
<div *ngIf="isMultiplicityEnabled" class="col-md-6" formGroupName="multiplicity">
<div>
<div fxFlex>
<mat-form-field class="full-width">
<input matInput placeholder="Min" type="number" formControlName="min">
<input matInput type="text" placeholder="Description" [formControl]="this.form.get('description')">
</mat-form-field>
</div>
<div fxFlex>
<mat-form-field class="full-width">
<input matInput type="text" placeholder="Extended Description" [formControl]="this.form.get('extendedDescription')">
</mat-form-field>
</div>
</div>
<div fxLayout="row">
<div fxFlex *ngIf="isMultiplicityEnabled">
<mat-form-field class="full-width">
<input matInput placeholder="Max" type="number" formControlName="max">
<input matInput placeholder="Min" type="number" [formControl]="this.form.get('multiplicity').get('min')">
</mat-form-field>
</div>
</div>
<div fxFlex *ngIf="isMultiplicityEnabled">
<mat-form-field class="full-width">
<input matInput type="number" placeholder="Ordinal" formControlName="ordinal">
<input matInput placeholder="Max" type="number" [formControl]="this.form.get('multiplicity').get('max')">
</mat-form-field>
<div *ngIf="isComposite" class="col-md-6">
</div>
<div fxFlex>
<mat-form-field class="full-width">
<input matInput type="string" placeholder="Id" formControlName="id">
<input matInput type="number" placeholder="Ordinal" [formControl]="this.form.get('ordinal')">
</mat-form-field>
</div>
<div fxFlex *ngIf="isComposite">
<mat-form-field class="full-width">
<input matInput type="string" placeholder="Id" [formControl]="this.form.get('id')">
</mat-form-field>
</div>
</div>
</div>
</div>
</div>
<field-form *ngIf="!isComposite" [form]="form.get('fields').get(''+0)" [dataModel]="dataModel.fields[0]" [showMultiplicity]="false"
<div fxLayout="row">
<h4 style="font-weight: bold">Field Description</h4>
<div *ngIf="isComposite">
<button mat-button (click)="addNewField()" style="cursor: pointer">
Add Child Field +
</button>
</div>
</div>
<field-form *ngIf="!isComposite" [form]="form.get('fields').get(''+0)" [dataModel]="dataModel.fields[0]" [showMultiplicity]="false"
[indexPath]="indexPath + 'f' + 0"></field-form>
<div *ngIf="isComposite">
<mat-expansion-panel *ngFor="let field of dataModel.fields let i=index;">
<div *ngIf="isComposite">
<mat-expansion-panel *ngFor="let field of dataModel.fields let i=index;" #panel>
<mat-expansion-panel-header>
<mat-panel-title *ngIf="form.get('fields').get(''+i).get('title').value">{{i + 1}}. {{form.get('fields').get(''+i).get('title').value}}</mat-panel-title>
<mat-panel-title *ngIf="form.get('fields').get(''+i).get('title').value && !panel.expanded">{{i + 1}}. {{form.get('fields').get(''+i).get('title').value}}</mat-panel-title>
<div class="btn-group pull-right">
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteField(i);">
<span class="glyphicon glyphicon-erase"></span>
</button>
</div>
</mat-expansion-panel-header>
<div id="{{indexPath + 'f' + i}}">
<div id="{{indexPath + 'f' + i}}" *ngIf="panel.expanded">
<field-form [form]="form.get('fields').get(''+i)" [dataModel]="field" [indexPath]="indexPath + 'f' + i"></field-form>
</div>
</mat-expansion-panel>
</div>
<div *ngIf="isComposite">
<a (click)="addNewField()" style="cursor: pointer">
Add Child Field +
</a>
</div>
</div>

View File

@ -1,8 +1,8 @@
import { Component, Input } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { FieldSet } from 'app/models/datasetProfileAdmin/FieldSet';
import { Field } from 'app/models/datasetProfileAdmin/Field';
import { FormArray, FormControl } from '@angular/forms';
import { FieldSet } from '../../models/datasetProfileAdmin/FieldSet';
import { Field } from '../../models/datasetProfileAdmin/Field';
@Component({
selector: 'compositefield-form',

View File

@ -24,6 +24,8 @@ import { WordlistComponent } from '../shared/componentsAdmin/wordlist/wordlist-c
import { AutocompleteComponent } from '../shared/componentsAdmin/autocomplete/autocomplete-component';
import { ComboboxComponent } from '../shared/componentsAdmin/combobox/combobox-component';
import { SharedModule } from "../shared/shared.module";
import { DatasetProfilePreviewerComponent } from "./previewer/dataset-profile-previewer.component";
import { DynamicFormModule } from "../form/dynamic-form.module";
@NgModule({
imports: [
@ -33,6 +35,7 @@ import { SharedModule } from "../shared/shared.module";
ReactiveFormsModule,
RouterModule,
SharedModule,
DynamicFormModule,
RouterModule.forChild(DatasetProfileRoutes)
],
@ -51,7 +54,8 @@ import { SharedModule } from "../shared/shared.module";
ComboboxComponent,
AutocompleteComponent,
WordlistComponent,
RadioBoxComponent
RadioBoxComponent,
DatasetProfilePreviewerComponent
],
exports: [
@ -72,6 +76,9 @@ import { SharedModule } from "../shared/shared.module";
RadioBoxComponent
],
providers: [
],
entryComponents: [
DatasetProfilePreviewerComponent
]
})

View File

@ -1,13 +1,12 @@
<div>
<div [formGroup]="form">
<div class="row">
<mat-form-field>
<input matInput placeholder='Id' type="text" formControlName="id">
<div fxLayout="row" fxLayoutAlign="start center">
<div fxFlex>
<mat-form-field class="full-width">
<input matInput placeholder='Id' type="text" [formControl]="this.form.get('id')">
</mat-form-field>
<div>
<div formGroupName="viewStyle">
<mat-form-field>
<mat-select placeholder="View Style" formControlName="renderStyle" (change)="onchangeCombo()">
<div fxFlex>
<mat-form-field class="full-width">
<mat-select placeholder="View Style" [formControl]="this.form.get('viewStyle').get('renderStyle')" (change)="onchangeCombo()">
<mat-option value="textarea">textarea</mat-option>
<mat-option value="booleanDecision">booleanDecision</mat-option>
<mat-option value='combobox'>combobox</mat-option>
@ -19,26 +18,6 @@
</div>
</div>
</div>
<div class="form" [ngSwitch]="form.get('viewStyle').get('renderStyle').value">
<div *ngSwitchCase="'combobox'">
<combobox-component [form]="form" [dataModel]="dataModel"></combobox-component>
</div>
<div *ngSwitchCase="'radiobox'">
<radiobox-component [form]="form" [dataModel]="dataModel"></radiobox-component>
</div>
<div *ngSwitchCase="'freetext'">
<freetext-component [form]="form" [dataModel]="dataModel"></freetext-component>
</div>
<div *ngSwitchCase="'textarea'">
<textarea-component [form]="form" [dataModel]="dataModel"></textarea-component>
</div>
<div *ngSwitchCase="'booleanDecision'">
<booleanDecision-component [form]="form" [dataModel]="dataModel"></booleanDecision-component>
</div>
<div *ngSwitchCase="'checkBox'">
<checkbox-component [form]="form" [dataModel]="dataModel"></checkbox-component>
</div>
</div>
<!-- <div class="row">
<div class="form-group col-md-6">
<label>description</label>
@ -49,43 +28,68 @@
<input type="text" class="form-control" formControlName="extendedDescription">
</div>
</div> -->
<div class="row">
<div *ngIf="isFieldMultiplicityEnabled" formGroupName="multiplicity">
<div>
<div fxLayout="row" fxLayoutAlign="start center">
<div fxFlex *ngIf="isFieldMultiplicityEnabled">
<h5>Multiplicity</h5>
<mat-form-field class="full-width">
<input matInput type="number" placeholder="Min" formControlName="min">
<input matInput type="number" placeholder="Min" [formControl]="this.form.get('multiplicity').get('min')">
</mat-form-field>
<mat-form-field class="full-width">
<input matInput type="number" placeholder="Max" formControlName="max">
<input matInput type="number" placeholder="Max" [formControl]="this.form.get('multiplicity').get('max')">
</mat-form-field>
</div>
</div>
<div fxFlex>
<mat-form-field class="full-width">
<input matInput type="number" placeholder="Ordinal" formControlName="ordinal">
</mat-form-field>
<div formGroupName="defaultValue">
<mat-form-field class="full-width">
<input matInput type="text" placeholder="Default Value" formControlName="value">
<input matInput type="number" placeholder="Ordinal" [formControl]="this.form.get('ordinal')">
</mat-form-field>
</div>
<div class="col-md-5">
<div formArrayName="validations">
<div fxFlex>
<mat-form-field class="full-width">
<input matInput type="text" placeholder="Default Value" [formControl]="this.form.get('defaultValue').get('value')">
</mat-form-field>
</div>
<div fxFlex>
<div>
<div *ngFor="let validation of form['controls']['validations']['controls']; let i=index">
<mat-form-field>
<mat-select placeholder='Validation' [formControlName]="i">
<mat-form-field class="full-width">
<mat-select placeholder='Validation' [formControl]="this.form.get('validations').get(''+i)">
<mat-option *ngFor="let option of validationsOptions" [value]="option.key">{{option.value}}</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
</div>
</div>
<div fxLayout="row" fxLayoutAlign="start center" [ngSwitch]="form.get('viewStyle').get('renderStyle').value">
<div class="full-width" *ngSwitchCase="'combobox'">
<combobox-component [form]="form" [dataModel]="dataModel"></combobox-component>
</div>
<div class="full-width" *ngSwitchCase="'radiobox'">
<radiobox-component [form]="form" [dataModel]="dataModel"></radiobox-component>
</div>
<div class="full-width" *ngSwitchCase="'freetext'">
<freetext-component [form]="form" [dataModel]="dataModel"></freetext-component>
</div>
<div class="full-width" *ngSwitchCase="'textarea'">
<textarea-component [form]="form" [dataModel]="dataModel"></textarea-component>
</div>
<div class="full-width" *ngSwitchCase="'booleanDecision'">
<booleanDecision-component [form]="form" [dataModel]="dataModel"></booleanDecision-component>
</div>
<div class="full-width" *ngSwitchCase="'checkBox'">
<checkbox-component [form]="form" [dataModel]="dataModel"></checkbox-component>
</div>
</div>
<mat-checkbox *ngIf="showMultiplicity" [(ngModel)]="isFieldMultiplicityEnabled" (ngModelChange)="onIsFieldMultiplicityEnabledChange(isFieldMultiplicityEnabled)">Multiplicity</mat-checkbox>
<mat-expansion-panel *ngFor="let rule of dataModel.visible.rules let i=index;">
<div fxLayout="row">
<h4 style="font-weight: bold">Rules Description</h4>
<button mat-button (click)="addNewRule()" style="cursor: pointer">
Add Rule +
</button>
</div>
<mat-expansion-panel *ngFor="let rule of dataModel.visible.rules let i=index;" #panel>
<mat-expansion-panel-header>
<mat-panel-title>{{i + 1}}. Rule {{i + 1}}</mat-panel-title>
@ -95,11 +99,9 @@
</button>
</div>
</mat-expansion-panel-header>
<rule-form [form]="form.get('visible').get('rules').get(''+i)" [dataModel]="rule"></rule-form>
<rule-form *ngIf="panel.expanded" [form]="form.get('visible').get('rules').get(''+i)" [dataModel]="rule"></rule-form>
</mat-expansion-panel>
<a (click)="addNewRule()" style="cursor: pointer">
Add Rule +
</a>
</div>

View File

@ -1,5 +1,5 @@
<div class="container">
<mat-card>
<!-- <mat-card>
<form *ngIf="form" novalidate [formGroup]="form" (ngSubmit)="onSubmit()">
<div class="row">
<div class="form-group col-md-12">
@ -9,35 +9,26 @@
</div>
</div>
<div>
<mat-expansion-panel *ngFor="let section of dataModel.sections; let i=index;">
<mat-expansion-panel-header>
<mat-panel-title *ngIf="form.get('sections').get(''+i).get('title').value">{{i + 1}}. {{form.get('sections').get(''+i).get('title').value}}</mat-panel-title>
<div class="btn-group pull-right">
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteSection(i);">
<span class="glyphicon glyphicon-erase"></span>
</button>
</div>
</mat-expansion-panel-header>
<div id="{{'s' + i}}">
<div>
<section-form [form]="form.get('sections').get(''+i)" [dataModel]="section" [indexPath]="'s' + i"></section-form>
</div>
</div>
</mat-expansion-panel>
</div>
<button mat-raised-button color="primary" type="submit" [disabled]="!form.valid">Save</button>
</form>
</mat-card> -->
<mat-horizontal-stepper [linear]="true" #stepper>
<mat-step>
<div class="panel-group">
<mat-expansion-panel *ngFor="let page of dataModel.pages; let i=index;">
<mat-expansion-panel *ngFor="let page of dataModel.pages; let i=index;" #panel>
<mat-expansion-panel-header>
<mat-panel-title *ngIf="form.get('pages').at(i).get('title').value">{{i + 1}}.{{form.get('pages').at(i).get('title').value}}</mat-panel-title>
<mat-panel-title *ngIf="form.get('pages').at(i).get('title').value && !panel.expanded">{{i + 1}}.{{form.get('pages').at(i).get('title').value}}</mat-panel-title>
<div class="btn-group pull-right">
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeletePage(i);">
<span class="glyphicon glyphicon-erase"></span>
</button>
</div>
</mat-expansion-panel-header>
<div id="{{'p' + i}}">
<div id="{{'p' + i}}" *ngIf="panel.expanded">
<div>
<page-form [form]="form.get('pages').at(i)" [dataModel]="page"></page-form>
</div>
@ -46,18 +37,41 @@
</div>
<div style="margin-top:20px; padding-left: 15px;" class="row">
<a (click)="addSection()" style="cursor: pointer">
Add Section +
</a>
<button mat-button (click)="addPage()" style="cursor: pointer">
Add Page +
</button>
</div>
</mat-step>
<mat-step>
<div>
<mat-expansion-panel *ngFor="let section of dataModel.sections; let i=index;" #panel>
<mat-expansion-panel-header>
<mat-panel-title *ngIf="form.get('sections').get(''+i).get('title').value && !panel.expanded">{{i + 1}}. {{form.get('sections').get(''+i).get('title').value}}</mat-panel-title>
<div class="btn-group pull-right">
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteSection(i);">
<span class="glyphicon glyphicon-erase"></span>
</button>
</div>
</mat-expansion-panel-header>
<div id="{{'s' + i}}" *ngIf="panel.expanded">
<div>
<section-form [form]="form.get('sections').get(''+i)" [dataModel]="section" [indexPath]="'s' + i"></section-form>
</div>
</div>
</mat-expansion-panel>
</div>
<div style="margin-top:20px; padding-left: 15px;" class="row">
<a (click)="addPage()" style="cursor: pointer">
Add Page +
</a>
<button mat-button (click)="addSection()" style="cursor: pointer">
Add Section +
</button>
</div>
</mat-step>
</mat-horizontal-stepper>
<button mat-button (click)="preview()">Preview</button>
<button mat-raised-button color="primary" type="submit" [disabled]="!form.valid">Save</button>
</form>
</mat-card>
</div>

View File

@ -10,6 +10,8 @@ import { Router, ActivatedRoute, ParamMap, Params } from '@angular/router';
import { PageFormComponent } from '../page-form/page-component'
import { DatasetProfileAdmin } from '../../services/datasetProfileAdmin/datasetProfileAfmin.service';
import { Section } from '../../models/datasetProfileAdmin/Section';
import { MatDialog } from '@angular/material';
import { DatasetProfilePreviewerComponent } from '../previewer/dataset-profile-previewer.component';
@Component({
selector: 'form-comp',
@ -24,8 +26,13 @@ export class FormComponent {
form: FormGroup;
private profileID: string;
constructor(public datasetprofileAdmin: DatasetProfileAdmin, private datasetProfileService: DatasetProfileService, private route: ActivatedRoute,
private router: Router) {
constructor(
public datasetprofileAdmin: DatasetProfileAdmin,
private datasetProfileService: DatasetProfileService,
private route: ActivatedRoute,
private router: Router,
public dialog: MatDialog,
) {
this.profileID = route.snapshot.params['id'];
}
@ -41,7 +48,7 @@ export class FormComponent {
}
else {
this.addSection();
this.addPage(0);
this.addPage();
}
}
@ -58,7 +65,7 @@ export class FormComponent {
(<FormArray>this.form.get("sections")).push(section.buildForm());
}
addPage(number) {
addPage() {
let page: Page = new Page(this.dataModel.pages.length);
this.dataModel.pages.push(page);
(<FormArray>this.form.get("pages")).push(page.buildForm());
@ -91,4 +98,14 @@ export class FormComponent {
});
}
preview() {
let dialogRef = this.dialog.open(DatasetProfilePreviewerComponent, {
height: '355px',
width: '700px',
data: {
model: this.dataModel
}
});
}
}

View File

@ -1,8 +1,9 @@
<div>
<div [formGroup]="form" class="row">
<div class="col-md-4">
<label>Title</label>
<input type="text" class="form-control" formControlName="title">
<div [formGroup]="form">
<div fxLayout="row">
<div fxFlex>
<mat-form-field class="full-width">
<input matInput type="text" placeholder="Title" formControlName="title">
</mat-form-field>
</div>
</div>
</div>

View File

@ -0,0 +1,3 @@
.full-width {
width: 100%;
}

View File

@ -6,7 +6,7 @@ import { Page } from '../../models/datasetProfileAdmin/Page';
@Component({
selector: 'page-form',
templateUrl: './page-component.html',
styleUrls: []
styleUrls: ['./page-component.scss']
})
export class PageFormComponent {

View File

@ -0,0 +1,2 @@
<dynamic-form *ngIf="formGroup" [form]="this.formGroup"
[dataModel]="datasetWizardModel"></dynamic-form>

View File

@ -0,0 +1,36 @@
import { ViewEncapsulation, Component, Inject } from "@angular/core";
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material";
import { FormGroup } from "@angular/forms";
import { DatasetProfileDefinitionModel } from "../../models/DatasetProfileDefinitionModel";
import { JsonSerializer } from "../../utilities/JsonSerializer";
import { DatasetModel } from "../../models/datasets/DatasetModel";
import { DatasetWizardModel } from "../../models/datasets/DatasetWizardModel";
import { DatasetProfileService } from "../../services/dataset-profile.service";
import { DatasetProfileAdmin } from "../../services/datasetProfileAdmin/datasetProfileAfmin.service";
@Component({
selector: 'dataset-profile-previewer',
templateUrl: './dataset-profile-previewer.component.html',
styleUrls: ['./dataset-profile-previewer.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class DatasetProfilePreviewerComponent {
formGroup: FormGroup
datasetWizardModel: DatasetWizardModel
constructor(
private datasetProfileAdminService: DatasetProfileAdmin,
public dialogRef: MatDialogRef<DatasetProfilePreviewerComponent>,
@Inject(MAT_DIALOG_DATA) public data: any
) { }
ngOnInit(): void {
this.datasetProfileAdminService.preview(this.data['model']).subscribe(x => {
this.datasetWizardModel = new DatasetWizardModel();
this.datasetWizardModel.datasetProfileDefinition = JsonSerializer.fromJSONObject(x, DatasetProfileDefinitionModel)
this.formGroup = this.datasetWizardModel.buildForm();
})
}
}

View File

@ -1,20 +1,20 @@
<div [formGroup]="form">
<div class="container">
<div class="row">
<div class="col-md-6">
<mat-form-field>
<div>
<div fxLayout="row">
<div fxFlex>
<mat-form-field class="full-width">
<mat-select placeholder="Rule Type" formControlName="ruleType">
<mat-option>field value</mat-option>
</mat-select>
</mat-form-field>
</div>
<div class="col-md-6">
<mat-form-field>
<div fxFlex>
<mat-form-field class="full-width">
<input matInput type="text" placeholder="Target" formControlName="target" (change)="TargetValidation()">
</mat-form-field>
</div>
<div class="col-md-12">
<mat-form-field>
<div fxFlex>
<mat-form-field class="full-width">
<input matInput type="text" placeholder="Value" formControlName="value">
</mat-form-field>
</div>

View File

@ -0,0 +1,3 @@
.full-width {
width: 100%;
}

View File

@ -1,43 +1,59 @@
<div>
<div class="row" [formGroup]="form">
<div class="col-md-6">
<mat-form-field class="full-width">
<input matInput type="text" placeholder="Title" formControlName="title">
</mat-form-field>
<div [formGroup]="form">
<div fxLayout="row">
<h4 style="font-weight: bold">Section Description</h4>
<div>
<button mat-button (click)="addSectioninSection()" style="cursor: pointer">
Add Nested Section +
</button>
</div>
</div>
<div fxLayout="row" fxLayoutAlign="space-between center">
<div fxFlex>
<mat-form-field class="full-width">
<input matInput type="text" placeholder="Id" formControlName="id">
</mat-form-field>
</div>
<div fxFlex>
<mat-form-field class="full-width">
<input matInput type="number" placeholder="Ordinal" formControlName="ordinal">
<input matInput type="text" placeholder="Title" formControlName="title">
</mat-form-field>
</div>
<div class="col-md-6">
<div fxFlex>
<mat-form-field class="full-width">
<mat-select placeholder='Page' formControlName="page">
<mat-select placeholder='Page' formControlName="page" required>
<mat-option *ngFor="let pageGroup of form.root.get('pages')['controls'];" [value]="pageGroup.get('id').value">{{pageGroup.get('title').value}}</mat-option>
</mat-select>
<!-- <div *ngIf="form.get('page').invalid && (form.get('page').dirty || form.get('page').touched)" class="alert alert-danger">Page is required</div> -->
</mat-form-field>
</div>
</div>
<div fxLayout="row" fxLayoutAlign="start center">
<div fxFlex="10%">
<mat-form-field class="full-width">
<input matInput type="number" placeholder="Ordinal" formControlName="ordinal">
</mat-form-field>
</div>
<div fxFlex="50%">
<label>Default Visibility</label>
<mat-radio-group formControlName="defaultVisibility" class="full-width">
<mat-radio-button [value]="true">true</mat-radio-button>
<mat-radio-button [value]="false">false</mat-radio-button>
</mat-radio-group>
</div>
</div>
<div *ngIf="dataModel.sections.length > 0">
<mat-expansion-panel *ngFor="let section of dataModel.sections; let i=index;">
<mat-expansion-panel *ngFor="let section of dataModel.sections; let i=index;" #panel>
<mat-expansion-panel-header>
<mat-panel-title *ngIf="form.get('sections').get(''+i).get('title').value">{{i + 1}}. {{form.get('sections').get(''+i).get('title').value}}</mat-panel-title>
<mat-panel-title *ngIf="form.get('sections').get(''+i).get('title').value && !panel.expanded">{{i + 1}}. {{form.get('sections').get(''+i).get('title').value}}</mat-panel-title>
<div class="btn-group pull-right">
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteSectionInSection(i);">
<span class="glyphicon glyphicon-erase"></span>
</button>
</div>
</mat-expansion-panel-header>
<div id="{{indexPath + 's' + i}}">
<div id="{{indexPath + 's' + i}}" *ngIf="panel.expanded">
<section-form [form]="form.get('sections').get(''+i)" [dataModel]="section" [indexPath]="indexPath + 's' + i"></section-form>
</div>
</mat-expansion-panel>
@ -52,13 +68,22 @@
</div> -->
<div>
<mat-expansion-panel *ngFor="let field of dataModel.fieldSets let i=index;" class="panel panel-default">
<div fxLayout="row">
<h4>Field Sets</h4>
<div>
<button mat-button (click)="addField()" style="cursor: pointer">
Add Field +
</button>
</div>
</div>
<mat-expansion-panel *ngFor="let field of dataModel.fieldSets let i=index;" class="panel panel-default" #panel>
<mat-expansion-panel-header>
<!-- <a *ngIf="form.get('compositeFields').get(''+i).get('title').value" data-toggle="collapse" href="#{{'compositeFieldCollapse' + i}}"
class="panel-title pull-left" style="padding-top: 7.5px;">{{i + 1}}. {{form.get('compositeFields').get(''+i).get('title').value}}</a>
<a *ngIf="!form.get('compositeFields').get(''+i).get('title').value" data-toggle="collapse" href="#{{'compositeFieldCollapse' + i}}"
class="panel-title pull-left" style="padding-top: 7.5px;">{{i + 1}}. Field {{i + 1}}</a> -->
<mat-panel-title>{{i + 1}}. Field {{i + 1}}</mat-panel-title>
<mat-panel-title *ngIf="!panel.expanded">{{i + 1}}. Field {{i + 1}}</mat-panel-title>
<div>
<button type="button" class="btn btn-sm" style="margin-left:5px;" (click)="DeleteFieldSet(i);">
@ -67,7 +92,7 @@
</div>
</mat-expansion-panel-header>
<compositefield-form [form]="form.get('fieldSets').get(''+i)" [dataModel]="field" [indexPath]="indexPath + 'cf' + i"></compositefield-form>
<compositefield-form *ngIf="panel.expanded" [form]="form.get('fieldSets').get(''+i)" [dataModel]="field" [indexPath]="indexPath + 'cf' + i"></compositefield-form>
</mat-expansion-panel>
</div>
@ -98,14 +123,5 @@
Add Group +
</a>
</div> -->
<div>
<a (click)="addField()" style="cursor: pointer">
Add Field +
</a>
</div>
<div>
<a (click)="addSectioninSection()" style="cursor: pointer">
Add Section +
</a>
</div>
</div>

View File

@ -1,3 +1,3 @@
.full-width {
width: 100%;
width: 90%;
}

View File

@ -23,10 +23,9 @@ export class SectionFormComponent {
constructor() { }
ngOnInit() {
var self = this;
this.form.root.get("pages").valueChanges.subscribe(function (value) {
self.keepPageSelectionValid(value);
});
this.form.root.get("pages").valueChanges.subscribe(x =>
this.keepPageSelectionValid(x)
);
}
addField() {

View File

@ -1,4 +1,12 @@
<div>
<div class="container">
<div class="row">
<div class="col-md-2">
<app-facet (facetCriteriaChange)="onCriteriaChange($event)">
</app-facet>
</div>
<div class="col-md-10">
<div>
<h3>{{'DATASET-PUBLIC-LISTING.TITLE' | translate}} {{titlePrefix}}</h3>
@ -17,19 +25,21 @@
<!-- Column Definition: Dmp -->
<ng-container cdkColumnDef="dmp">
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|dmp:label">{{'DATASET-LISTING.COLUMNS.DMP' | translate}}</mat-header-cell>
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|dmp:label">{{'DATASET-LISTING.COLUMNS.DMP' |
translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.dmp}} </mat-cell>
</ng-container>
<!-- Column Definition: Profile -->
<ng-container cdkColumnDef="profile">
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|profile:label">{{'DATASET-LISTING.COLUMNS.PROFILE' | translate}}</mat-header-cell>
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|profile:label">{{'DATASET-LISTING.COLUMNS.PROFILE'
| translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.profile}} </mat-cell>
</ng-container>
<!-- Column Definition: Status -->
<ng-container cdkColumnDef="status">
<mat-header-cell *matHeaderCellDef >{{'DATASET-LISTING.COLUMNS.STATUS' | translate}}</mat-header-cell>
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.STATUS' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.status}} </mat-cell>
</ng-container>
@ -66,7 +76,8 @@
<!-- Column Definition: Created -->
<ng-container cdkColumnDef="created">
<mat-header-cell *matHeaderCellDef mat-sort-header="created">{{'DATASET-LISTING.COLUMNS.CREATED' | translate}}</mat-header-cell>
<mat-header-cell *matHeaderCellDef mat-sort-header="created">{{'DATASET-LISTING.COLUMNS.CREATED' |
translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.created | date:'shortDate'}}</mat-cell>
</ng-container>
@ -82,3 +93,7 @@
</mat-card>
</div>
</div>
</div>
</div>

View File

@ -11,6 +11,7 @@ import { DatasetCriteria } from "../../models/criteria/dataset/DatasetCriteria";
import { DataSource } from "@angular/cdk/table";
import { DatasetListingModel } from "../../models/datasets/DatasetListingModel";
import { DataTableRequest } from "../../models/data-table/DataTableRequest";
import { FacetSearchCriteriaModel } from "../../models/facet-search/FacetSearchCriteriaModel";
@Component({
@ -31,11 +32,6 @@ export class DatasetPublicListingComponent implements OnInit {
titlePrefix: String;
dmpId: string;
statuses = [
{ value: '0', viewValue: 'Active' },
{ value: '1', viewValue: 'Inactive' }
];
constructor(
private datasetService: DatasetService,
private router: Router,
@ -49,8 +45,6 @@ export class DatasetPublicListingComponent implements OnInit {
ngOnInit() {
this.route.params.subscribe(async (params: Params) => {
this.dmpId = params['dmpId'];
this.criteria.setCriteria(this.getDefaultCriteria(this.dmpId));
@ -64,6 +58,12 @@ export class DatasetPublicListingComponent implements OnInit {
});
}
onCriteriaChange(event){
//console.log(event)
this.criteria.setCriteria(event);
this.refresh();
}
refresh() {
this.dataSource = new DatasetDataSource(this.datasetService, this._paginator, this.sort, this.languageService, this.snackBar, this.criteria, this.dmpId);
}
@ -119,10 +119,10 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
const startIndex = this._paginator.pageIndex * this._paginator.pageSize;
let fields: Array<string> = new Array()
if (this._sort.active) fields = this._sort.direction === "asc" ? ["+" + this._sort.active] : ["-" + this._sort.active];
const request = new DataTableRequest<DatasetCriteria>(startIndex, this._paginator.pageSize, { fields: fields });
const request = new DataTableRequest<FacetSearchCriteriaModel>(startIndex, this._paginator.pageSize, { fields: fields });
request.criteria = this._criteria.criteria;
if (this.dmpId) request.criteria.allVersions = true;
return this._service.getPaged(request);
//if (this.dmpId) request.criteria.allVersions = true;
return this._service.getPublicPaged(request);
})
/*.catch((error: any) => {
this._snackBar.openFromComponent(SnackBarNotificationComponent, {

View File

@ -17,20 +17,22 @@
<!-- Column Definition: Dmp -->
<ng-container cdkColumnDef="dmp">
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|dmp:label">{{'DATASET-LISTING.COLUMNS.DMP' | translate}}</mat-header-cell>
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|dmp:label">{{'DATASET-LISTING.COLUMNS.DMP' |
translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.dmp}} </mat-cell>
</ng-container>
<!-- Column Definition: Profile -->
<ng-container cdkColumnDef="profile">
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|profile:label">{{'DATASET-LISTING.COLUMNS.PROFILE' | translate}}</mat-header-cell>
<mat-header-cell *matHeaderCellDef mat-sort-header="|join|profile:label">{{'DATASET-LISTING.COLUMNS.PROFILE' |
translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.profile}} </mat-cell>
</ng-container>
<!-- Column Definition: Status -->
<ng-container cdkColumnDef="status">
<mat-header-cell *matHeaderCellDef >{{'DATASET-LISTING.COLUMNS.STATUS' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.status}} </mat-cell>
<mat-header-cell *matHeaderCellDef>{{'DATASET-LISTING.COLUMNS.STATUS' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row"> {{this.utilities.convertFromDatasetStatus(row.status)}} </mat-cell>
</ng-container>
<!-- Column Definition: DataRepositories -->
@ -76,9 +78,11 @@
<mat-cell *matCellDef="let row" (click)="$event.stopPropagation()">
<mat-menu #actionsMenu="matMenu">
<button *ngIf="row.status == 0" (click)="rowClick(row.id)" mat-menu-item>
<mat-icon>mode_edit</mat-icon>{{'DATASET-LISTING.ACTIONS.EDIT' | translate}}</button>
<mat-icon>mode_edit</mat-icon>{{'DATASET-LISTING.ACTIONS.EDIT' | translate}}
</button>
<button *ngIf="row.status != 0" (click)="makeItPublic(row.id)" mat-menu-item>
<mat-icon>public</mat-icon>{{'DATASET-LISTING.ACTIONS.MAKE-IT-PUBLIC' | translate}}</button>
<mat-icon>public</mat-icon>{{'DATASET-LISTING.ACTIONS.MAKE-IT-PUBLIC' | translate}}
</button>
</mat-menu>
<button mat-icon-button [matMenuTriggerFor]="actionsMenu">

View File

@ -16,12 +16,15 @@ import { DataManagementPlanModel } from "../../models/data-managemnt-plans/DataM
import { DatasetCriteriaComponent } from '../../shared/components/criteria/datasets/datasets-criteria.component';
import { BreadcrumbItem } from '../../shared/components/breadcrumb/definition/breadcrumb-item';
import { IBreadCrumbComponent } from '../../shared/components/breadcrumb/definition/IBreadCrumbComponent';
import { Utilities } from '../../utilities/utilities';
import { JsonSerializer } from '../../utilities/JsonSerializer';
@Component({
selector: 'app-dataset-listing-component',
templateUrl: 'dataset-listing.component.html',
styleUrls: ['./dataset-listing.component.scss'],
providers:[Utilities]
})
export class DatasetListingComponent implements OnInit, IBreadCrumbComponent {
@ -48,7 +51,8 @@ export class DatasetListingComponent implements OnInit, IBreadCrumbComponent {
private languageService: TranslateService,
public snackBar: MatSnackBar,
public route: ActivatedRoute,
public dataManagementPlanService: DataManagementPlanService
public dataManagementPlanService: DataManagementPlanService,
public utilities: Utilities
) {
}
@ -141,6 +145,10 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
//this._criteria.criteria.onCallbackError(error);
return Observable.of(null);
})*/
.map(result => {
result.data = JsonSerializer.fromJSONArray(result.data, DatasetListingModel)
return result;
})
.map(result => {
setTimeout(() => {
this.isLoadingResults = false;

View File

@ -40,7 +40,8 @@ export class DataManagementPlanProfileEditorComponent implements AfterViewInit {
public snackBar: MatSnackBar,
public router: Router,
public language: TranslateService,
private dialogService: TdDialogService
private dialogService: TdDialogService,
private utilities: Utilities
) {
}
@ -153,7 +154,7 @@ export class DataManagementPlanProfileEditorComponent implements AfterViewInit {
getDMPProfileFieldDataTypeWithLanguage(role: DMPProfileFieldDataType): string {
let result = '';
this.language.get(new Utilities().convertFromDMPProfileDataType(role)).subscribe((value: string) => {
this.language.get(this.utilities.convertFromDMPProfileDataType(role)).subscribe((value: string) => {
result = value;
});
return result;
@ -168,7 +169,7 @@ export class DataManagementPlanProfileEditorComponent implements AfterViewInit {
getDMPProfileFieldTypeWithLanguage(role: DMPProfileType): string {
let result = '';
this.language.get(new Utilities().convertFromDMPProfileType(role)).subscribe((value: string) => {
this.language.get(this.utilities.convertFromDMPProfileType(role)).subscribe((value: string) => {
result = value;
});
return result;

View File

@ -17,6 +17,7 @@ import { DatasetRoutes } from '../../datasets/dataset.routes';
import { ProjectModel } from '../../models/projects/ProjectModel';
import { IBreadCrumbComponent } from '../../shared/components/breadcrumb/definition/IBreadCrumbComponent';
import { BreadcrumbItem } from '../../shared/components/breadcrumb/definition/breadcrumb-item';
import { JsonSerializer } from '../../utilities/JsonSerializer';
@ -173,6 +174,10 @@ export class DataManagementPlanDataSource extends DataSource<DataManagementPlanL
});
return Observable.of(null);
})*/
.map(result => {
result.data = JsonSerializer.fromJSONArray(result.data, DataManagementPlanListingModel)
return result;
})
.map(result => {
setTimeout(() => {
this.isLoadingResults = false;

View File

@ -31,6 +31,7 @@ import { CommonModule } from '@angular/common';
import { NgModule } from "@angular/core";
import { DatasetProfileAdmin } from '../services/datasetProfileAdmin/datasetProfileAfmin.service';
import { DatasetProfileService } from '../services/dataset-profile.service';
import { DatasetWizardService } from '../services/dataset-wizard/dataset-wizard.service';
@NgModule({
@ -90,7 +91,8 @@ import { DatasetProfileService } from '../services/dataset-profile.service';
VisibilityRulesService,
PaginationService,
DatasetProfileService,
DatasetProfileAdmin
DatasetProfileAdmin,
DatasetWizardService
]
})

View File

@ -9,7 +9,7 @@ export class DataManagementPlanListingModel implements Serializable<DataManageme
public organisations: String;
public groupId: string;
public version: number;
public datasets: any[]
fromJSONObject(item: any): DataManagementPlanListingModel {
this.id = item.id;
this.label = item.label;
@ -19,6 +19,7 @@ export class DataManagementPlanListingModel implements Serializable<DataManageme
this.organisations = item.organisations;
this.version = item.version;
this.groupId = item.groupId;
this.datasets = item.datasets;
return this;
}
}

View File

@ -1,10 +1,10 @@
import { BaseModel } from '../BaseModel';
import { FormBuilder, FormGroup, FormControl, Validators } from '@angular/forms';
import { FormGenerator } from '../interfaces/FormGenerator';
import { JsonSerializer } from 'app/utilities/JsonSerializer';
import { Section } from './Section';
import { Serializable } from '../interfaces/Serializable';
import { Page } from "./Page";
import { JsonSerializer } from '../../utilities/JsonSerializer';
export class DatasetProfileModelAdmin extends BaseModel implements Serializable<DatasetProfileModelAdmin>,FormGenerator<FormGroup>{

View File

@ -2,7 +2,7 @@ import { Serializable } from "../Serializable";
export class DatasetListingModel implements Serializable<DatasetListingModel> {
public id: String;
public label:String;
public label: String;
public dmp: String;
public profile: String;
public dataRepositories: String;

View File

@ -14,6 +14,11 @@ import { DataRepositoryModel } from "../dataRepositories/DataRepositoryModel";
import { ExternalDatasetModel } from '../../models/external-dataset/ExternalDatasetModel';
import { TagModel } from '../tags/TagModel';
export enum DatasetStatus {
Draft = 0,
Finalised = 1
}
export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
public id: string;
public label: string;

View File

@ -0,0 +1,8 @@
import { ProjectStateType } from "../projects/ProjectStateType";
export class FacetSearchCriteriaModel {
public projectStatus: ProjectStateType;
public projects: string[] = [];
public datasetProfile: string[] = [];
public dmpOrganisations: string[] = [];
}

View File

@ -24,8 +24,8 @@ export class ProjectListingModel implements Serializable<ProjectListingModel> {
this.reference = item.reference;
this.uri = item.uri;
this.status = item.status;
this.startDate = item.startdate ? new Date(item.startdate) : item.startDate;
this.endDate = item.enddate ? new Date(item.enddate) : item.endDate;
this.startDate = item.startDate ? new Date(item.startDate) : item.startDate;
this.endDate = item.endDate ? new Date(item.endDate) : item.endDate;
this.description = item.description;
this.files = JsonSerializer.fromJSONArray(item.files, ContentFile)
this.dmps = JsonSerializer.fromJSONArray(item.dmps, UrlListingItem)

View File

@ -15,6 +15,7 @@ import { LanguageResolverService } from '../../services/language-resolver/langua
import { BreadcrumbItem } from '../../shared/components/breadcrumb/definition/breadcrumb-item';
import { IBreadCrumbComponent } from '../../shared/components/breadcrumb/definition/IBreadCrumbComponent';
import { ProjectStateType } from '../../models/projects/ProjectStateType';
import { JsonSerializer } from '../../utilities/JsonSerializer';
@Component({
selector: 'app-project-listing-component',
@ -120,6 +121,10 @@ export class ProjectDataSource extends DataSource<ProjectListingModel> {
this._criteria.onCallbackError(error.error);
return Observable.of(null);
})*/
.map(result => {
result.data = JsonSerializer.fromJSONArray(result.data, ProjectListingModel)
return result;
})
.map(result => {
setTimeout(() => {
this.isLoadingResults = false;

View File

@ -10,6 +10,7 @@ import { DatasetListingModel } from '../../models/datasets/DatasetListingModel';
import { DatasetModel } from '../../models/datasets/DatasetModel';
import { DatasetCriteria } from '../../models/criteria/dataset/DatasetCriteria';
import { DatasetProfileModel } from '../../models/datasetprofile/DatasetProfileModel';
import { FacetSearchCriteriaModel } from '../../models/facet-search/FacetSearchCriteriaModel';
@ -32,6 +33,10 @@ export class DatasetService {
return this.http.post<DataTableData<DatasetListingModel>>(this.actionUrl + 'getPaged', dataTableRequest, { headers: this.headers });
}
getPublicPaged(dataTableRequest: DataTableRequest<FacetSearchCriteriaModel>): Observable<DataTableData<DatasetListingModel>> {
return this.http.post<DataTableData<DatasetListingModel>>(this.actionUrl + 'public/paged', dataTableRequest, { headers: this.headers });
}
makeDatasetPublic(id: String) {
return this.http.get(this.actionUrl + 'makepublic/' + id, { headers: this.headers })
}

View File

@ -42,4 +42,8 @@ export class DatasetProfileAdmin {
return this.http.post<DataTableData<DatasetListingModel>>(this.actionUrl + 'datasetprofiles/getPaged', dataTableRequest, { headers: this.headers });
}
preview(data: DatasetProfileModelAdmin): Observable<DatasetProfileModelAdmin> {
return this.http.post<DatasetProfileModelAdmin>(this.actionUrl + 'preview', data, { headers: this.headers });
}
}

View File

@ -27,12 +27,12 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
// public formStatus: ProjectStatus;
@Input()
public isPublic = false;
public criteria: DatasetCriteria = new DatasetCriteria();
public criteria:any
public filteringTagsAsync: boolean = false;
public filteredTags: ExternalSourcesItemModel[];
statuses = [
{ value: '0', viewValue: 'Saved' },
{ value: '0', viewValue: 'Draft' },
{ value: '1', viewValue: 'Finalised' }
];
@ -46,7 +46,7 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
ngOnInit() {
super.ngOnInit();
if (this.criteria == null) { this.criteria = new DatasetCriteria(); }
if (this.criteria == null) { this.criteria = {} }
}
setCriteria(criteria: DatasetCriteria): void {

View File

@ -12,6 +12,7 @@ import { FormBuilder, FormGroup } from '@angular/forms';
selector: 'users-criteria-component',
templateUrl: './users-criteria.component.html',
styleUrls: ['./users-criteria.component.scss'],
providers:[Utilities]
})
export class UsersCriteriaComponent extends BaseCriteriaComponent implements OnInit {
@ -21,7 +22,8 @@ export class UsersCriteriaComponent extends BaseCriteriaComponent implements OnI
constructor(
public language: TranslateService,
public formBuilder: FormBuilder
public formBuilder: FormBuilder,
public utilities: Utilities
) {
super(new UserCriteriaErrorModel());
}
@ -73,7 +75,7 @@ export class UsersCriteriaComponent extends BaseCriteriaComponent implements OnI
getPrincipalAppRoleWithLanguage(role: Principal.AppRole): string {
let result = '';
this.language.get(new Utilities().convertFromPrincipalAppRole(role)).subscribe((value: string) => {
this.language.get(this.utilities.convertFromPrincipalAppRole(role)).subscribe((value: string) => {
result = value;
});
return result;

Some files were not shown because too many files have changed in this diff Show More