Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring

This commit is contained in:
Diamantis Tziotzios 2023-10-23 11:27:27 +03:00
commit 6d6a4e0341
24 changed files with 579 additions and 43 deletions

View File

@ -87,6 +87,18 @@ public class DMPEntity {
public static final String _isActive = "isActive"; public static final String _isActive = "isActive";
@Column(name = "\"FinalizedAt\"")
@Convert(converter = DateToUTCConverter.class)
private Instant finalizedAt;
public static final String _finalizedAt = "finalizedAt";
@Column(name = "\"PublishedAt\"")
@Convert(converter = DateToUTCConverter.class)
private Instant publishedAt;
public static final String _publishedAt = "publishedAt";
//TODO: (thgiannos) Handle using the DMPEntity builder //TODO: (thgiannos) Handle using the DMPEntity builder
// @OneToMany(mappedBy = "dmp", fetch = FetchType.LAZY) // @OneToMany(mappedBy = "dmp", fetch = FetchType.LAZY)
// private Set<Dataset> dataset; // private Set<Dataset> dataset;
@ -96,6 +108,8 @@ public class DMPEntity {
//TODO: (thgiannos) Previously 'Grant' //TODO: (thgiannos) Previously 'Grant'
private UUID grant; private UUID grant;
public static final String _grant = "grant";
//TODO: (thgiannos) Handle using the DMPEntity builder //TODO: (thgiannos) Handle using the DMPEntity builder
// @OneToMany(fetch = FetchType.LAZY, mappedBy = "dmp") // @OneToMany(fetch = FetchType.LAZY, mappedBy = "dmp")
// private Set<DMPDatasetProfile> associatedDmps; // private Set<DMPDatasetProfile> associatedDmps;
@ -105,11 +119,15 @@ public class DMPEntity {
//TODO: (thgiannos) Previously 'DMPProfile' //TODO: (thgiannos) Previously 'DMPProfile'
private UUID profile; private UUID profile;
public static final String _profile = "profile";
// @ManyToOne(fetch = FetchType.LAZY) // @ManyToOne(fetch = FetchType.LAZY)
// @JoinColumn(name = "\"Creator\"") // @JoinColumn(name = "\"Creator\"")
//TODO: (thgiannos) Previously 'UserInfo' //TODO: (thgiannos) Previously 'UserInfo'
private UUID creator; private UUID creator;
public static final String _creator = "creator";
//TODO: (thgiannos) Handle using the DMPEntity builder //TODO: (thgiannos) Handle using the DMPEntity builder
// @OneToMany(mappedBy = "entityId", fetch = FetchType.LAZY) // @OneToMany(mappedBy = "entityId", fetch = FetchType.LAZY)
// private Set<EntityDoiEntity> dois; // private Set<EntityDoiEntity> dois;
@ -119,6 +137,8 @@ public class DMPEntity {
//TODO: (thgiannos) Previously 'Project' //TODO: (thgiannos) Previously 'Project'
private UUID project; private UUID project;
public static final String _project = "project";
// TODO: (thgiannos) Implement join entity // TODO: (thgiannos) Implement join entity
// @OneToMany(fetch = FetchType.LAZY) // @OneToMany(fetch = FetchType.LAZY)
// @JoinTable(name = "\"DMPOrganisation\"", // @JoinTable(name = "\"DMPOrganisation\"",
@ -138,14 +158,6 @@ public class DMPEntity {
//TODO: (thgiannos) Handle using the DMPEntity builder //TODO: (thgiannos) Handle using the DMPEntity builder
// private Set<UserDMP> users; // private Set<UserDMP> users;
// @Column(name = "\"FinalizedAt\"")
// @Convert(converter = DateToUTCConverter.class)
// private Date finalizedAt;
//
// @Column(name = "\"PublishedAt\"")
// @Convert(converter = DateToUTCConverter.class)
// private Date publishedAt;
public UUID getId() { public UUID getId() {
return id; return id;
} }
@ -210,11 +222,11 @@ public class DMPEntity {
this.description = description; this.description = description;
} }
public boolean getPublic() { public boolean getIsPublic() {
return isPublic; return isPublic;
} }
public void setPublic(boolean aPublic) { public void setIsPublic(boolean aPublic) {
isPublic = aPublic; isPublic = aPublic;
} }
@ -250,6 +262,22 @@ public class DMPEntity {
this.isActive = isActive; this.isActive = isActive;
} }
public Instant getFinalizedAt() {
return finalizedAt;
}
public void setFinalizedAt(Instant finalizedAt) {
this.finalizedAt = finalizedAt;
}
public Instant getPublishedAt() {
return publishedAt;
}
public void setPublishedAt(Instant publishedAt) {
this.publishedAt = publishedAt;
}
public UUID getGrant() { public UUID getGrant() {
return grant; return grant;
} }

View File

@ -1,5 +1,250 @@
package eu.eudat.model; package eu.eudat.model;
import eu.eudat.commons.enums.DMPStatus;
import eu.eudat.commons.enums.IsActive;
import java.time.Instant;
import java.util.UUID;
public class DMP { public class DMP {
private UUID id;
public static final String _id = "id";
private String label;
public static final String _label = "label";
private Integer version;
public static final String _version = "version";
private DMPStatus status;
public static final String _status = "status";
private String properties;
public static final String _properties = "properties";
private String dmpProperties;
public static final String _dmpProperties = "dmpProperties";
private UUID groupId;
public static final String _groupId = "groupId";
private String description;
public static final String _description = "description";
private boolean isPublic;
public static final String _isPublic = "isPublic";
private String extraProperties;
public static final String _extraProperties = "extraProperties";
private Instant createdAt;
public static final String _createdAt = "createdAt";
private Instant updatedAt;
public static final String _updatedAt = "updatedAt";
private IsActive isActive;
public static final String _isActive = "isActive";
private Instant finalizedAt;
public static final String _finalizedAt = "finalizedAt";
private Instant publishedAt;
public static final String _publishedAt = "publishedAt";
private UUID grant;
public static final String _grant = "grant";
private UUID profile;
public static final String _profile = "profile";
private UUID creator;
public static final String _creator = "creator";
private UUID project;
public static final String _project = "project";
public final static String _hash = "hash";
private String hash;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public DMPStatus getStatus() {
return status;
}
public void setStatus(DMPStatus status) {
this.status = status;
}
public String getProperties() {
return properties;
}
public void setProperties(String properties) {
this.properties = properties;
}
public String getDmpProperties() {
return dmpProperties;
}
public void setDmpProperties(String dmpProperties) {
this.dmpProperties = dmpProperties;
}
public UUID getGroupId() {
return groupId;
}
public void setGroupId(UUID groupId) {
this.groupId = groupId;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean getIsPublic() {
return isPublic;
}
public void setIsPublic(boolean aPublic) {
isPublic = aPublic;
}
public String getExtraProperties() {
return extraProperties;
}
public void setExtraProperties(String extraProperties) {
this.extraProperties = extraProperties;
}
public Instant getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Instant createdAt) {
this.createdAt = createdAt;
}
public Instant getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Instant updatedAt) {
this.updatedAt = updatedAt;
}
public IsActive getIsActive() {
return isActive;
}
public void setIsActive(IsActive isActive) {
this.isActive = isActive;
}
public Instant getFinalizedAt() {
return finalizedAt;
}
public void setFinalizedAt(Instant finalizedAt) {
this.finalizedAt = finalizedAt;
}
public Instant getPublishedAt() {
return publishedAt;
}
public void setPublishedAt(Instant publishedAt) {
this.publishedAt = publishedAt;
}
public UUID getGrant() {
return grant;
}
public void setGrant(UUID grant) {
this.grant = grant;
}
public UUID getProfile() {
return profile;
}
public void setProfile(UUID profile) {
this.profile = profile;
}
public UUID getCreator() {
return creator;
}
public void setCreator(UUID creator) {
this.creator = creator;
}
public UUID getProject() {
return project;
}
public void setProject(UUID project) {
this.project = project;
}
public String getHash() {
return hash;
}
public void setHash(String hash) {
this.hash = hash;
}
} }

View File

@ -1,5 +1,66 @@
package eu.eudat.model.builder; package eu.eudat.model.builder;
public class DMPBuilder { import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.convention.ConventionService;
import eu.eudat.data.DMPEntity;
import eu.eudat.model.DMP;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.fieldset.FieldSet;
import gr.cite.tools.logging.DataLogEntry;
import gr.cite.tools.logging.LoggerService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.util.*;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class DMPBuilder extends BaseBuilder<DMP, DMPEntity> {
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
@Autowired
public DMPBuilder(ConventionService conventionService) {
super(conventionService, new LoggerService(LoggerFactory.getLogger(DMPBuilder.class)));
}
public DMPBuilder authorize(EnumSet<AuthorizationFlags> values) {
this.authorize = values;
return this;
}
@Override
public List<DMP> build(FieldSet fields, List<DMPEntity> data) throws MyApplicationException {
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
this.logger.trace(new DataLogEntry("requested fields", fields));
if (fields == null || data == null || fields.isEmpty())
return new ArrayList<>();
List<DMP> models = new ArrayList<>();
for (DMPEntity d : data) {
DMP m = new DMP();
if (fields.hasField(this.asIndexer(DMP._id))) m.setId(d.getId());
if (fields.hasField(this.asIndexer(DMP._label))) m.setLabel(d.getLabel());
if (fields.hasField(this.asIndexer(DMP._version))) m.setVersion(d.getVersion());
if (fields.hasField(this.asIndexer(DMP._status))) m.setStatus(d.getStatus());
if (fields.hasField(this.asIndexer(DMP._properties))) m.setProperties(d.getProperties());
if (fields.hasField(this.asIndexer(DMP._dmpProperties))) m.setDmpProperties(d.getDmpProperties());
if (fields.hasField(this.asIndexer(DMP._groupId))) m.setGroupId(d.getGroupId());
if (fields.hasField(this.asIndexer(DMP._description))) m.setDescription(d.getDescription());
if (fields.hasField(this.asIndexer(DMP._isPublic))) m.setIsPublic(d.getIsPublic());
if (fields.hasField(this.asIndexer(DMP._extraProperties))) m.setExtraProperties(d.getExtraProperties());
if (fields.hasField(this.asIndexer(DMP._createdAt))) m.setCreatedAt(d.getCreatedAt());
if (fields.hasField(this.asIndexer(DMP._updatedAt))) m.setUpdatedAt(d.getUpdatedAt());
if (fields.hasField(this.asIndexer(DMP._isActive))) m.setIsActive(d.getIsActive());
if (fields.hasField(this.asIndexer(DMP._finalizedAt))) m.setFinalizedAt(d.getFinalizedAt());
if (fields.hasField(this.asIndexer(DMP._publishedAt))) m.setPublishedAt(d.getPublishedAt());
if (fields.hasField(this.asIndexer(DMP._hash))) m.setHash(this.hashValue(d.getUpdatedAt()));
models.add(m);
}
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
return models;
}
} }

View File

@ -1,5 +1,208 @@
package eu.eudat.query; package eu.eudat.query;
public class DMPQueryV2 { import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.DMPStatus;
import eu.eudat.commons.enums.IsActive;
import eu.eudat.commons.scope.user.UserScope;
import eu.eudat.data.DMPEntity;
import eu.eudat.model.DMP;
import gr.cite.commons.web.authz.service.AuthorizationService;
import gr.cite.tools.data.query.FieldResolver;
import gr.cite.tools.data.query.QueryBase;
import gr.cite.tools.data.query.QueryContext;
import jakarta.persistence.Tuple;
import jakarta.persistence.criteria.CriteriaBuilder;
import jakarta.persistence.criteria.Predicate;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.time.Instant;
import java.util.*;
@Component
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class DMPQueryV2 extends QueryBase<DMPEntity> {
private String like;
private Collection<UUID> ids;
private Collection<IsActive> isActives;
private Collection<DMPStatus> statuses;
private Collection<UUID> excludedIds;
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
private final UserScope userScope;
private final AuthorizationService authService;
public DMPQueryV2(UserScope userScope, AuthorizationService authService) {
this.userScope = userScope;
this.authService = authService;
}
public DMPQueryV2 like(String value) {
this.like = value;
return this;
}
public DMPQueryV2 ids(UUID value) {
this.ids = List.of(value);
return this;
}
public DMPQueryV2 ids(UUID... value) {
this.ids = Arrays.asList(value);
return this;
}
public DMPQueryV2 ids(Collection<UUID> values) {
this.ids = values;
return this;
}
public DMPQueryV2 isActive(IsActive value) {
this.isActives = List.of(value);
return this;
}
public DMPQueryV2 isActive(IsActive... value) {
this.isActives = Arrays.asList(value);
return this;
}
public DMPQueryV2 isActive(Collection<IsActive> values) {
this.isActives = values;
return this;
}
public DMPQueryV2 statuses(DMPStatus value) {
this.statuses = List.of(value);
return this;
}
public DMPQueryV2 statuses(DMPStatus... value) {
this.statuses = Arrays.asList(value);
return this;
}
public DMPQueryV2 statuses(Collection<DMPStatus> values) {
this.statuses = values;
return this;
}
public DMPQueryV2 excludedIds(Collection<UUID> values) {
this.excludedIds = values;
return this;
}
public DMPQueryV2 excludedIds(UUID value) {
this.excludedIds = List.of(value);
return this;
}
public DMPQueryV2 excludedIds(UUID... value) {
this.excludedIds = Arrays.asList(value);
return this;
}
public DMPQueryV2 authorize(EnumSet<AuthorizationFlags> values) {
this.authorize = values;
return this;
}
@Override
protected Boolean isFalseQuery() {
return this.isEmpty(this.ids) || this.isEmpty(this.isActives) || this.isEmpty(this.excludedIds) || this.isEmpty(this.statuses);
}
@Override
protected Class<DMPEntity> entityClass() {
return DMPEntity.class;
}
@Override
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
List<Predicate> predicates = new ArrayList<>();
if (this.ids != null) {
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DMPEntity._id));
for (UUID item : this.ids)
inClause.value(item);
predicates.add(inClause);
}
if (this.like != null && !this.like.isEmpty()) {
predicates.add(queryContext.CriteriaBuilder.like(queryContext.Root.get(DMPEntity._label), this.like));
}
if (this.isActives != null) {
CriteriaBuilder.In<IsActive> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DMPEntity._isActive));
for (IsActive item : this.isActives)
inClause.value(item);
predicates.add(inClause);
}
if (this.statuses != null) {
CriteriaBuilder.In<DMPStatus> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DMPEntity._status));
for (DMPStatus item : this.statuses)
inClause.value(item);
predicates.add(inClause);
}
if (this.excludedIds != null) {
CriteriaBuilder.In<UUID> notInClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DMPEntity._id));
for (UUID item : this.excludedIds)
notInClause.value(item);
predicates.add(notInClause.not());
}
if (!predicates.isEmpty()) {
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
return queryContext.CriteriaBuilder.and(predicatesArray);
} else {
return null;
}
}
@Override
protected String fieldNameOf(FieldResolver item) {
if (item.match(DMP._id)) return DMPEntity._id;
else if (item.match(DMP._label)) return DMPEntity._label;
else if (item.match(DMP._version)) return DMPEntity._version;
else if (item.match(DMP._status)) return DMPEntity._status;
else if (item.match(DMP._properties)) return DMPEntity._properties;
else if (item.match(DMP._dmpProperties)) return DMPEntity._dmpProperties;
else if (item.match(DMP._groupId)) return DMPEntity._groupId;
else if (item.match(DMP._description)) return DMPEntity._description;
else if (item.match(DMP._isPublic)) return DMPEntity._isPublic;
else if (item.match(DMP._extraProperties)) return DMPEntity._extraProperties;
else if (item.match(DMP._createdAt)) return DMPEntity._createdAt;
else if (item.match(DMP._updatedAt)) return DMPEntity._updatedAt;
else if (item.match(DMP._isActive)) return DMPEntity._isActive;
else if (item.match(DMP._finalizedAt)) return DMPEntity._finalizedAt;
else if (item.match(DMP._publishedAt)) return DMPEntity._publishedAt;
else return null;
}
@Override
protected DMPEntity convert(Tuple tuple, Set<String> columns) {
DMPEntity item = new DMPEntity();
item.setId(QueryBase.convertSafe(tuple, columns, DMPEntity._id, UUID.class));
item.setLabel(QueryBase.convertSafe(tuple, columns, DMPEntity._label, String.class));
item.setVersion(QueryBase.convertSafe(tuple, columns, DMPEntity._version, Integer.class));
item.setStatus(QueryBase.convertSafe(tuple, columns, DMPEntity._status, DMPStatus.class));
item.setProperties(QueryBase.convertSafe(tuple, columns, DMPEntity._properties, String.class));
item.setDmpProperties(QueryBase.convertSafe(tuple, columns, DMPEntity._dmpProperties, String.class));
item.setGroupId(QueryBase.convertSafe(tuple, columns, DMPEntity._groupId, UUID.class));
item.setDescription(QueryBase.convertSafe(tuple, columns, DMPEntity._description, String.class));
item.setIsPublic(QueryBase.convertSafe(tuple, columns, DMPEntity._isPublic, Boolean.class));
item.setExtraProperties(QueryBase.convertSafe(tuple, columns, DMPEntity._extraProperties, String.class));
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, DMPEntity._createdAt, Instant.class));
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, DMPEntity._updatedAt, Instant.class));
item.setIsActive(QueryBase.convertSafe(tuple, columns, DMPEntity._isActive, IsActive.class));
item.setFinalizedAt(QueryBase.convertSafe(tuple, columns, DMPEntity._finalizedAt, Instant.class));
item.setPublishedAt(QueryBase.convertSafe(tuple, columns, DMPEntity._publishedAt, Instant.class));
return item;
}
} }

View File

@ -1,4 +1,4 @@
package eu.eudat.service; package eu.eudat.service.descriptiontemplatetype;
import eu.eudat.model.DescriptionTemplateType; import eu.eudat.model.DescriptionTemplateType;
import eu.eudat.model.persist.DescriptionTemplateTypePersist; import eu.eudat.model.persist.DescriptionTemplateTypePersist;

View File

@ -1,4 +1,4 @@
package eu.eudat.service; package eu.eudat.service.descriptiontemplatetype;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.authorization.Permission; import eu.eudat.authorization.Permission;
@ -31,7 +31,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource; import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.context.annotation.RequestScope;
import javax.management.InvalidApplicationException; import javax.management.InvalidApplicationException;
import java.time.Instant; import java.time.Instant;

View File

@ -1,4 +1,4 @@
package eu.eudat.service; package eu.eudat.service.dmp;
public interface DMPService { public interface DMPService {

View File

@ -1,4 +1,4 @@
package eu.eudat.service; package eu.eudat.service.dmp;
public class DMPServiceImpl implements DMPService { public class DMPServiceImpl implements DMPService {

View File

@ -1,4 +1,4 @@
package eu.eudat.service; package eu.eudat.service.entitydoi;
import eu.eudat.model.DescriptionTemplateType; import eu.eudat.model.DescriptionTemplateType;
import eu.eudat.model.EntityDoi; import eu.eudat.model.EntityDoi;

View File

@ -1,4 +1,4 @@
package eu.eudat.service; package eu.eudat.service.entitydoi;
import eu.eudat.authorization.AuthorizationFlags; import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.authorization.Permission; import eu.eudat.authorization.Permission;
@ -6,20 +6,14 @@ import eu.eudat.commons.JsonHandlingService;
import eu.eudat.commons.enums.EntityType; import eu.eudat.commons.enums.EntityType;
import eu.eudat.commons.enums.IsActive; import eu.eudat.commons.enums.IsActive;
import eu.eudat.convention.ConventionService; import eu.eudat.convention.ConventionService;
import eu.eudat.data.DescriptionTemplateTypeEntity;
import eu.eudat.data.EntityDoiEntity; import eu.eudat.data.EntityDoiEntity;
import eu.eudat.data.old.DMP; import eu.eudat.data.old.DMP;
import eu.eudat.errorcode.ErrorThesaurusProperties; import eu.eudat.errorcode.ErrorThesaurusProperties;
import eu.eudat.event.DescriptionTemplateTypeTouchedEvent;
import eu.eudat.event.EntityDoiTouchedEvent; import eu.eudat.event.EntityDoiTouchedEvent;
import eu.eudat.event.EventBroker; import eu.eudat.event.EventBroker;
import eu.eudat.model.DescriptionTemplateType;
import eu.eudat.model.EntityDoi; import eu.eudat.model.EntityDoi;
import eu.eudat.model.builder.DescriptionTemplateTypeBuilder;
import eu.eudat.model.builder.EntityDoiBuilder; import eu.eudat.model.builder.EntityDoiBuilder;
import eu.eudat.model.deleter.DescriptionTemplateTypeDeleter;
import eu.eudat.model.deleter.EntityDoiDeleter; import eu.eudat.model.deleter.EntityDoiDeleter;
import eu.eudat.model.persist.DescriptionTemplateTypePersist;
import eu.eudat.model.persist.EntityDoiPersist; import eu.eudat.model.persist.EntityDoiPersist;
import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.commons.web.authz.service.AuthorizationService;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
@ -38,14 +32,11 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource; import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.management.InvalidApplicationException; import javax.management.InvalidApplicationException;
import java.time.Instant; import java.time.Instant;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
@Service @Service

View File

@ -191,6 +191,14 @@
<artifactId>saaj-impl</artifactId> <artifactId>saaj-impl</artifactId>
<version>3.0.0-M2</version> <version>3.0.0-M2</version>
</dependency> </dependency>
<!--CITE DEPENDENCIES-->
<dependency>
<groupId>gr.cite</groupId>
<artifactId>cors-web</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -19,7 +19,7 @@ import eu.eudat.models.data.datasetprofile.DatasetProfileListingModel;
import eu.eudat.models.data.helpers.common.DataTableData; import eu.eudat.models.data.helpers.common.DataTableData;
import eu.eudat.models.data.helpers.responses.ResponseItem; import eu.eudat.models.data.helpers.responses.ResponseItem;
import eu.eudat.models.data.user.composite.PagedDatasetProfile; import eu.eudat.models.data.user.composite.PagedDatasetProfile;
import eu.eudat.service.DescriptionTemplateTypeService; import eu.eudat.service.descriptiontemplatetype.DescriptionTemplateTypeService;
import eu.eudat.types.ApiMessageCode; import eu.eudat.types.ApiMessageCode;
import eu.eudat.types.MetricNames; import eu.eudat.types.MetricNames;
import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.commons.web.authz.service.AuthorizationService;
@ -37,9 +37,6 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import static eu.eudat.types.Authorities.ADMIN;
import static eu.eudat.types.Authorities.DATASET_PROFILE_MANAGER;
@RestController @RestController
@CrossOrigin @CrossOrigin
@RequestMapping(value = {"/api/admin/"}) @RequestMapping(value = {"/api/admin/"})

View File

@ -10,7 +10,7 @@ import eu.eudat.model.persist.DescriptionTemplateTypePersist;
import eu.eudat.model.result.QueryResult; import eu.eudat.model.result.QueryResult;
import eu.eudat.query.DescriptionTemplateTypeQuery; import eu.eudat.query.DescriptionTemplateTypeQuery;
import eu.eudat.query.lookup.DescriptionTemplateTypeLookup; import eu.eudat.query.lookup.DescriptionTemplateTypeLookup;
import eu.eudat.service.DescriptionTemplateTypeService; import eu.eudat.service.descriptiontemplatetype.DescriptionTemplateTypeService;
import gr.cite.tools.auditing.AuditService; import gr.cite.tools.auditing.AuditService;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.censor.CensorFactory; import gr.cite.tools.data.censor.CensorFactory;
@ -32,7 +32,6 @@ import javax.management.InvalidApplicationException;
import java.util.*; import java.util.*;
@RestController @RestController
@CrossOrigin
@RequestMapping(path = "api/description-template-type") @RequestMapping(path = "api/description-template-type")
public class DescriptionTemplateTypeController { public class DescriptionTemplateTypeController {

View File

@ -30,7 +30,6 @@ import javax.management.InvalidApplicationException;
import java.util.*; import java.util.*;
@RestController @RestController
@CrossOrigin
@RequestMapping(path = "api/dmp-blueprint") @RequestMapping(path = "api/dmp-blueprint")
public class DmpBlueprintController { public class DmpBlueprintController {

View File

@ -11,7 +11,7 @@ import eu.eudat.model.persist.EntityDoiPersist;
import eu.eudat.model.result.QueryResult; import eu.eudat.model.result.QueryResult;
import eu.eudat.query.EntityDoiQuery; import eu.eudat.query.EntityDoiQuery;
import eu.eudat.query.lookup.EntityDoiLookup; import eu.eudat.query.lookup.EntityDoiLookup;
import eu.eudat.service.EntityDoiService; import eu.eudat.service.entitydoi.EntityDoiService;
import gr.cite.tools.auditing.AuditService; import gr.cite.tools.auditing.AuditService;
import gr.cite.tools.data.builder.BuilderFactory; import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.censor.CensorFactory; import gr.cite.tools.data.censor.CensorFactory;
@ -33,7 +33,6 @@ import javax.management.InvalidApplicationException;
import java.util.*; import java.util.*;
@RestController @RestController
@CrossOrigin
@RequestMapping(path = "api/entity-doi") @RequestMapping(path = "api/entity-doi")
public class EntityDoiController { public class EntityDoiController {

View File

@ -28,7 +28,6 @@ import javax.management.InvalidApplicationException;
import java.util.List; import java.util.List;
@RestController @RestController
@CrossOrigin
@RequestMapping(path = {"api/external-references"}) @RequestMapping(path = {"api/external-references"})
public class ExternalReferencesController extends BaseController { public class ExternalReferencesController extends BaseController {

View File

@ -15,7 +15,6 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@RestController @RestController
@CrossOrigin
@RequestMapping(path = {"api/validation"}) @RequestMapping(path = {"api/validation"})
public class ExternalValidationController extends BaseController { public class ExternalValidationController extends BaseController {

View File

@ -21,7 +21,6 @@ import eu.eudat.models.v2.Account;
import javax.management.InvalidApplicationException; import javax.management.InvalidApplicationException;
@RestController @RestController
@CrossOrigin
@RequestMapping(value = { "/api/principal/" }) @RequestMapping(value = { "/api/principal/" })
public class PrincipalController { public class PrincipalController {
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PrincipalController.class)); private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(PrincipalController.class));

View File

@ -25,7 +25,6 @@ import java.util.stream.Stream;
import static eu.eudat.types.Authorities.ADMIN; import static eu.eudat.types.Authorities.ADMIN;
@RestController @RestController
@CrossOrigin
@RequestMapping(path = {"/api/material"}) @RequestMapping(path = {"/api/material"})
public class SupportiveMaterialController { public class SupportiveMaterialController {

View File

@ -11,7 +11,7 @@ import eu.eudat.models.data.admin.composite.DatasetProfile;
import eu.eudat.logic.services.ApiContext; import eu.eudat.logic.services.ApiContext;
import eu.eudat.logic.utilities.builders.ModelBuilder; import eu.eudat.logic.utilities.builders.ModelBuilder;
import eu.eudat.commons.types.xml.XmlBuilder; import eu.eudat.commons.types.xml.XmlBuilder;
import eu.eudat.service.DescriptionTemplateTypeService; import eu.eudat.service.descriptiontemplatetype.DescriptionTemplateTypeService;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;

View File

@ -29,7 +29,7 @@ import eu.eudat.models.data.helpers.common.DataTableData;
import eu.eudat.models.data.listingmodels.UserInfoListingModel; import eu.eudat.models.data.listingmodels.UserInfoListingModel;
import eu.eudat.models.data.mail.SimpleMail; import eu.eudat.models.data.mail.SimpleMail;
import eu.eudat.queryable.QueryableList; import eu.eudat.queryable.QueryableList;
import eu.eudat.service.DescriptionTemplateTypeService; import eu.eudat.service.descriptiontemplatetype.DescriptionTemplateTypeService;
import eu.eudat.types.MetricNames; import eu.eudat.types.MetricNames;
import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.commons.web.authz.service.AuthorizationService;
import org.slf4j.Logger; import org.slf4j.Logger;

View File

@ -15,5 +15,6 @@ spring:
optional:classpath:config/file-path.yml[.yml], optional:classpath:config/file-path-${spring.profiles.active}.yml[.yml], optional:file:../config/file-path-${spring.profiles.active}.yml[.yml], optional:classpath:config/file-path.yml[.yml], optional:classpath:config/file-path-${spring.profiles.active}.yml[.yml], optional:file:../config/file-path-${spring.profiles.active}.yml[.yml],
optional:classpath:config/idpclaims.yml[.yml], optional:classpath:config/idpclaims-${spring.profiles.active}.yml[.yml], optional:file:../config/idpclaims-${spring.profiles.active}.yml[.yml], optional:classpath:config/idpclaims.yml[.yml], optional:classpath:config/idpclaims-${spring.profiles.active}.yml[.yml], optional:file:../config/idpclaims-${spring.profiles.active}.yml[.yml],
optional:classpath:config/external.yml[.yml], optional:classpath:config/external-${spring.profiles.active}.yml[.yml], optional:file:../config/external-${spring.profiles.active}.yml[.yml], optional:classpath:config/external.yml[.yml], optional:classpath:config/external-${spring.profiles.active}.yml[.yml], optional:file:../config/external-${spring.profiles.active}.yml[.yml],
optional:classpath:config/cors.yml[.yml], optional:classpath:config/cors-${spring.profiles.active}.yml[.yml], optional:file:../config/cors-${spring.profiles.active}.yml[.yml],
optional:classpath:config/swagger.yml[.yml], optional:classpath:config/swagger-${spring.profiles.active}.yml[.yml], optional:file:../config/swagger-${spring.profiles.active}.yml[.yml], optional:classpath:config/swagger.yml[.yml], optional:classpath:config/swagger-${spring.profiles.active}.yml[.yml], optional:file:../config/swagger-${spring.profiles.active}.yml[.yml],
optional:classpath:config/deposit.yml[.yml], optional:classpath:config/deposit-${spring.profiles.active}.yml[.yml], optional:file:../config/deposit-${spring.profiles.active}.yml[.yml] optional:classpath:config/deposit.yml[.yml], optional:classpath:config/deposit-${spring.profiles.active}.yml[.yml], optional:file:../config/deposit-${spring.profiles.active}.yml[.yml]

View File

@ -0,0 +1,3 @@
web:
cors:
allowed-origins: [ http://localhost, http://localhost:4200 ]

View File

@ -0,0 +1,7 @@
web:
cors:
enabled: true
allowed-methods: [ HEAD, GET, POST, PUT, DELETE, PATCH ]
allowed-headers: [ Authorization, Cache-Control, Content-Type, Content-Disposition, x-tenant ]
exposed-headers: [ Authorization, Cache-Control, Content-Type, Content-Disposition ]
allow-credentials: false