rename External Reference to Reference
This commit is contained in:
parent
f006587f4a
commit
aecac1995d
|
@ -62,15 +62,15 @@ public final class Permission {
|
|||
public static String ViewDescriptionTemplateTypePage = "ViewDescriptionTemplateTypePage";
|
||||
public static String ViewDmpBlueprintPage = "ViewDmpBlueprintPage";
|
||||
|
||||
//ExternalReference
|
||||
public static String BrowseExternalReference = "BrowseExternalReference";
|
||||
public static String EditExternalReference = "EditExternalReference";
|
||||
public static String DeleteExternalReference = "DeleteExternalReference";
|
||||
//Reference
|
||||
public static String BrowseReference = "BrowseReference";
|
||||
public static String EditReference = "EditReference";
|
||||
public static String DeleteReference = "DeleteReference";
|
||||
|
||||
//DmpExternalReference
|
||||
public static String BrowseDmpExternalReference = "BrowseDmpExternalReference";
|
||||
public static String EditDmpExternalReference = "EditDmpExternalReference";
|
||||
public static String DeleteDmpExternalReference = "DeleteDmpExternalReference";
|
||||
//DmpReference
|
||||
public static String BrowseDmpReference = "BrowseDmpReference";
|
||||
public static String EditDmpReference = "EditDmpReference";
|
||||
public static String DeleteDmpReference = "DeleteDmpReference";
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import eu.eudat.data.converters.enums.DatabaseEnum;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
public enum ExternalReferencesType implements DatabaseEnum<Short> {
|
||||
public enum ReferenceType implements DatabaseEnum<Short> {
|
||||
Taxonomies((short) 0),
|
||||
Licenses((short) 1),
|
||||
Publications((short) 2),
|
||||
|
@ -22,7 +22,7 @@ public enum ExternalReferencesType implements DatabaseEnum<Short> {
|
|||
Researcher((short) 13);
|
||||
private final Short value;
|
||||
|
||||
ExternalReferencesType(Short value) {
|
||||
ReferenceType(Short value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
@ -31,9 +31,9 @@ public enum ExternalReferencesType implements DatabaseEnum<Short> {
|
|||
return value;
|
||||
}
|
||||
|
||||
private static final Map<Short, ExternalReferencesType> map = EnumUtils.getEnumValueMap(ExternalReferencesType.class);
|
||||
private static final Map<Short, ReferenceType> map = EnumUtils.getEnumValueMap(ReferenceType.class);
|
||||
|
||||
public static ExternalReferencesType of(Short i) {
|
||||
public static ReferenceType of(Short i) {
|
||||
return map.get(i);
|
||||
}
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
package eu.eudat.data;
|
||||
|
||||
import eu.eudat.commons.enums.ExternalReferencesType;
|
||||
import eu.eudat.commons.enums.ReferenceType;
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
import eu.eudat.commons.enums.SourceType;
|
||||
import eu.eudat.data.converters.enums.ExternalReferencesTypeConverter;
|
||||
import eu.eudat.data.converters.enums.ReferenceTypeConverter;
|
||||
import eu.eudat.data.converters.enums.IsActiveConverter;
|
||||
import jakarta.persistence.*;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
@ -25,8 +25,8 @@ public class ReferenceEntity {
|
|||
public static final String _label = "label";
|
||||
|
||||
@Column(name = "type", nullable = false)
|
||||
@Convert(converter = ExternalReferencesTypeConverter.class)
|
||||
private ExternalReferencesType type;
|
||||
@Convert(converter = ReferenceTypeConverter.class)
|
||||
private ReferenceType type;
|
||||
public static final String _type = "type";
|
||||
|
||||
@Column(name = "description")
|
||||
|
@ -87,11 +87,11 @@ public class ReferenceEntity {
|
|||
this.label = label;
|
||||
}
|
||||
|
||||
public ExternalReferencesType getType() {
|
||||
public ReferenceType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(ExternalReferencesType type) {
|
||||
public void setType(ReferenceType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
package eu.eudat.data.converters.enums;
|
||||
|
||||
import eu.eudat.commons.enums.ExternalReferencesType;
|
||||
import jakarta.persistence.Converter;
|
||||
|
||||
@Converter
|
||||
public class ExternalReferencesTypeConverter extends DatabaseEnumConverter<ExternalReferencesType, Short> {
|
||||
public ExternalReferencesType of(Short i) {
|
||||
return ExternalReferencesType.of(i);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package eu.eudat.data.converters.enums;
|
||||
|
||||
import eu.eudat.commons.enums.ReferenceType;
|
||||
import jakarta.persistence.Converter;
|
||||
|
||||
@Converter
|
||||
public class ReferenceTypeConverter extends DatabaseEnumConverter<ReferenceType, Short> {
|
||||
public ReferenceType of(Short i) {
|
||||
return ReferenceType.of(i);
|
||||
}
|
||||
}
|
|
@ -93,7 +93,7 @@ public class Dmp {
|
|||
|
||||
public static final String _dmpDescriptions = "dmpDescriptions";
|
||||
|
||||
public static final String _dmpExternalReferences = "dmpExternalReferences";
|
||||
public static final String _dmpReferences = "dmpReferences";
|
||||
private List<DmpReference> dmpReferences;
|
||||
|
||||
public UUID getId() {
|
||||
|
@ -264,11 +264,11 @@ public class Dmp {
|
|||
this.dmpDescriptions = dmpDescriptions;
|
||||
}
|
||||
|
||||
public List<DmpReference> getDmpExternalReferences() {
|
||||
public List<DmpReference> getDmpReferences() {
|
||||
return dmpReferences;
|
||||
}
|
||||
|
||||
public void setDmpExternalReferences(List<DmpReference> dmpReferences) {
|
||||
public void setDmpReferences(List<DmpReference> dmpReferences) {
|
||||
this.dmpReferences = dmpReferences;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ public class DmpReference {
|
|||
public static final String _dmp = "dmp";
|
||||
|
||||
private Reference reference;
|
||||
public static final String _externalReference = "externalReference";
|
||||
public static final String _reference = "reference";
|
||||
|
||||
private String data;
|
||||
public static final String _data = "data";
|
||||
|
@ -32,11 +32,11 @@ public class DmpReference {
|
|||
this.dmp = dmp;
|
||||
}
|
||||
|
||||
public Reference getExternalReference() {
|
||||
public Reference getReference() {
|
||||
return reference;
|
||||
}
|
||||
|
||||
public void setExternalReference(Reference reference) {
|
||||
public void setReference(Reference reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package eu.eudat.model;
|
||||
|
||||
import eu.eudat.commons.enums.ExternalReferencesType;
|
||||
import eu.eudat.commons.enums.ReferenceType;
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
import eu.eudat.commons.enums.SourceType;
|
||||
|
||||
|
@ -16,7 +16,7 @@ public class Reference {
|
|||
private String label;
|
||||
public static final String _label = "label";
|
||||
|
||||
private ExternalReferencesType type;
|
||||
private ReferenceType type;
|
||||
public static final String _type = "type";
|
||||
|
||||
private String description;
|
||||
|
@ -50,7 +50,7 @@ public class Reference {
|
|||
//public static final String _createdBy = "createdBy";
|
||||
|
||||
private List<DmpReference> dmpReferences;
|
||||
public static final String _dmpExternalReferences = "dmpExternalReferences";
|
||||
public static final String _dmpReferences = "dmpReferences";
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
|
@ -68,11 +68,11 @@ public class Reference {
|
|||
this.label = label;
|
||||
}
|
||||
|
||||
public ExternalReferencesType getType() {
|
||||
public ReferenceType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(ExternalReferencesType type) {
|
||||
public void setType(ReferenceType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
@ -148,11 +148,11 @@ public class Reference {
|
|||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public List<DmpReference> getDmpExternalReferences() {
|
||||
public List<DmpReference> getDmpReferences() {
|
||||
return dmpReferences;
|
||||
}
|
||||
|
||||
public void setDmpExternalReferences(List<DmpReference> dmpReferences) {
|
||||
public void setDmpReferences(List<DmpReference> dmpReferences) {
|
||||
this.dmpReferences = dmpReferences;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
|||
|
||||
FieldSet dmpDescriptionsFields = fields.extractPrefixed(this.asPrefix(Dmp._dmpDescriptions));
|
||||
Map<UUID, List<Description>> dmpDescriptionsMap = this.collectDmpDescriptions(dmpDescriptionsFields, data);
|
||||
FieldSet dmpReferencesFields = fields.extractPrefixed(this.asPrefix(Reference._dmpExternalReferences));
|
||||
FieldSet dmpReferencesFields = fields.extractPrefixed(this.asPrefix(Reference._dmpReferences));
|
||||
Map<UUID, List<DmpReference>> dmpReferenceMap = this.collectDmpReferences(dmpReferencesFields, data);
|
||||
|
||||
for (DmpEntity d : data) {
|
||||
|
@ -98,7 +98,7 @@ public class DmpBuilder extends BaseBuilder<Dmp, DmpEntity> {
|
|||
if (!dmpDescriptionsFields.isEmpty() && dmpDescriptionsMap != null && dmpDescriptionsMap.containsKey(d.getId()))
|
||||
m.setDmpDescriptions(dmpDescriptionsMap.get(d.getId()));
|
||||
|
||||
if (dmpReferenceMap != null && !dmpReferenceMap.isEmpty() && dmpReferenceMap.containsKey(d.getId())) m.setDmpExternalReferences(dmpReferenceMap.get(d.getId()));
|
||||
if (dmpReferenceMap != null && !dmpReferenceMap.isEmpty() && dmpReferenceMap.containsKey(d.getId())) m.setDmpReferences(dmpReferenceMap.get(d.getId()));
|
||||
models.add(m);
|
||||
}
|
||||
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||
|
|
|
@ -52,7 +52,7 @@ public class DmpReferenceBuilder extends BaseBuilder<DmpReference, DmpReferenceE
|
|||
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||
if (fields == null || data == null || fields.isEmpty())
|
||||
return new ArrayList<>();
|
||||
FieldSet referenceFields = fields.extractPrefixed(this.asPrefix(DmpReference._externalReference));
|
||||
FieldSet referenceFields = fields.extractPrefixed(this.asPrefix(DmpReference._reference));
|
||||
Map<UUID, Reference> referenceItemsMap = this.collectReferences(referenceFields, data);
|
||||
|
||||
FieldSet dmpFields = fields.extractPrefixed(this.asPrefix(DmpReference._dmp));
|
||||
|
@ -64,7 +64,7 @@ public class DmpReferenceBuilder extends BaseBuilder<DmpReference, DmpReferenceE
|
|||
if (fields.hasField(this.asIndexer(DmpReference._id))) m.setId(d.getId());
|
||||
if (fields.hasField(this.asIndexer(DmpReference._data))) m.setData(d.getData());
|
||||
if(!referenceFields.isEmpty() && referenceItemsMap != null && referenceItemsMap.containsKey(d.getReferenceId())){
|
||||
m.setExternalReference(referenceItemsMap.get(d.getReferenceId()));
|
||||
m.setReference(referenceItemsMap.get(d.getReferenceId()));
|
||||
}
|
||||
if(!dmpFields.isEmpty() && dmpItemsMap != null && dmpItemsMap.containsKey(d.getDmpId())){
|
||||
m.setDmp(dmpItemsMap.get(d.getDmpId()));
|
||||
|
|
|
@ -51,9 +51,9 @@ public class ReferenceBuilder extends BaseBuilder<Reference, ReferenceEntity>{
|
|||
if (fields == null || data == null || fields.isEmpty())
|
||||
return new ArrayList<>();
|
||||
|
||||
//FieldSet userInfoFields = fields.extractPrefixed(this.asPrefix(ExternalReference._createdBy));
|
||||
//FieldSet userInfoFields = fields.extractPrefixed(this.asPrefix(Reference._createdBy));
|
||||
|
||||
FieldSet dmpReferencesFields = fields.extractPrefixed(this.asPrefix(Reference._dmpExternalReferences));
|
||||
FieldSet dmpReferencesFields = fields.extractPrefixed(this.asPrefix(Reference._dmpReferences));
|
||||
Map<UUID, List<DmpReference>> dmpReferenceMap = this.collectDmpReferences(dmpReferencesFields, data);
|
||||
|
||||
List<Reference> models = new ArrayList<>();
|
||||
|
@ -74,7 +74,7 @@ public class ReferenceBuilder extends BaseBuilder<Reference, ReferenceEntity>{
|
|||
// if (!userInfoFields.isEmpty() && d.getCreatedBy() != null){
|
||||
// //ToDo
|
||||
// }
|
||||
if (!dmpReferenceMap.isEmpty() && dmpReferenceMap != null && dmpReferenceMap.containsKey(d.getId())) m.setDmpExternalReferences(dmpReferenceMap.get(d.getId()));
|
||||
if (!dmpReferenceMap.isEmpty() && dmpReferenceMap != null && dmpReferenceMap.containsKey(d.getId())) m.setDmpReferences(dmpReferenceMap.get(d.getId()));
|
||||
models.add(m);
|
||||
}
|
||||
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||
|
@ -86,13 +86,13 @@ public class ReferenceBuilder extends BaseBuilder<Reference, ReferenceEntity>{
|
|||
this.logger.debug("checking related - {}", DmpReference.class.getSimpleName());
|
||||
|
||||
Map<UUID, List<DmpReference>> itemMap = null;
|
||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpReference._externalReference, Reference._id));
|
||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpReference._reference, Reference._id));
|
||||
DmpReferenceQuery query = this.queryFactory.query(DmpReferenceQuery.class).authorize(this.authorize).referenceIds(datas.stream().map(x -> x.getId()).distinct().collect(Collectors.toList()));
|
||||
itemMap = this.builderFactory.builder(DmpReferenceBuilder.class).authorize(this.authorize).authorize(this.authorize).asMasterKey(query, clone, x -> x.getExternalReference().getId());
|
||||
itemMap = this.builderFactory.builder(DmpReferenceBuilder.class).authorize(this.authorize).authorize(this.authorize).asMasterKey(query, clone, x -> x.getReference().getId());
|
||||
|
||||
if (!fields.hasField(this.asIndexer(DmpReference._externalReference, Reference._id))) {
|
||||
itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getExternalReference() != null).map(x -> {
|
||||
x.getExternalReference().setId(null);
|
||||
if (!fields.hasField(this.asIndexer(DmpReference._reference, Reference._id))) {
|
||||
itemMap.values().stream().flatMap(List::stream).filter(x -> x != null && x.getReference() != null).map(x -> {
|
||||
x.getReference().setId(null);
|
||||
return x;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ public class DmpCensor extends BaseCensor {
|
|||
|
||||
FieldSet dmpDescriptionsFields = fields.extractPrefixed(this.asIndexerPrefix(Dmp._dmpDescriptions));
|
||||
this.censorFactory.censor(DescriptionCensor.class).censor(dmpDescriptionsFields, userId);
|
||||
FieldSet dmpExternalReferencesFields = fields.extractPrefixed(this.asIndexerPrefix(Dmp._dmpExternalReferences));
|
||||
this.censorFactory.censor(DmpReferenceCensor.class).censor(dmpExternalReferencesFields, userId);
|
||||
FieldSet dmpReferencesFields = fields.extractPrefixed(this.asIndexerPrefix(Dmp._dmpReferences));
|
||||
this.censorFactory.censor(DmpReferenceCensor.class).censor(dmpReferencesFields, userId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,11 +37,11 @@ public class DmpReferenceCensor extends BaseCensor {
|
|||
if (fields == null || fields.isEmpty())
|
||||
return;
|
||||
|
||||
this.authService.authorizeForce(Permission.BrowseDmpExternalReference);
|
||||
this.authService.authorizeForce(Permission.BrowseDmpReference);
|
||||
FieldSet dmpFields = fields.extractPrefixed(this.asIndexerPrefix(DmpReference._dmp));
|
||||
this.censorFactory.censor(DmpCensor.class).censor(dmpFields, userId);
|
||||
FieldSet externalReferenceFields = fields.extractPrefixed(this.asIndexerPrefix(DmpReference._externalReference));
|
||||
this.censorFactory.censor(ReferenceCensor.class).censor(externalReferenceFields, userId);
|
||||
FieldSet referenceFields = fields.extractPrefixed(this.asIndexerPrefix(DmpReference._reference));
|
||||
this.censorFactory.censor(ReferenceCensor.class).censor(referenceFields, userId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,11 +37,11 @@ public class ReferenceCensor extends BaseCensor {
|
|||
if (fields == null || fields.isEmpty())
|
||||
return;
|
||||
|
||||
this.authService.authorizeForce(Permission.BrowseExternalReference);
|
||||
FieldSet dmpExternalReferencesFields = fields.extractPrefixed(this.asIndexerPrefix(Reference._dmpExternalReferences));
|
||||
this.censorFactory.censor(DmpReferenceCensor.class).censor(dmpExternalReferencesFields, userId);
|
||||
this.authService.authorizeForce(Permission.BrowseReference);
|
||||
FieldSet dmpReferencesFields = fields.extractPrefixed(this.asIndexerPrefix(Reference._dmpReferences));
|
||||
this.censorFactory.censor(DmpReferenceCensor.class).censor(dmpReferencesFields, userId);
|
||||
//ToDo
|
||||
//FieldSet definitionFields = fields.extractPrefixed(this.asIndexerPrefix(ExternalReference._createdBy));
|
||||
//FieldSet definitionFields = fields.extractPrefixed(this.asIndexerPrefix(Reference._createdBy));
|
||||
//this.censorFactory.censor(UserInfo.class).censor(definitionFields, userId);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package eu.eudat.query;
|
||||
|
||||
import eu.eudat.authorization.AuthorizationFlags;
|
||||
import eu.eudat.commons.enums.ExternalReferencesType;
|
||||
import eu.eudat.commons.enums.ReferenceType;
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
import eu.eudat.commons.enums.SourceType;
|
||||
import eu.eudat.commons.scope.user.UserScope;
|
||||
|
@ -32,7 +32,7 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
|
|||
|
||||
private Collection<SourceType> sourceTypes;
|
||||
|
||||
private Collection<ExternalReferencesType> externalReferenceTypes;
|
||||
private Collection<ReferenceType> referenceTypes;
|
||||
|
||||
private Collection<UUID> excludedIds;
|
||||
|
||||
|
@ -73,18 +73,18 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public ReferenceQuery externalReferenceTypes(ExternalReferencesType value) {
|
||||
this.externalReferenceTypes = List.of(value);
|
||||
public ReferenceQuery referenceTypes(ReferenceType value) {
|
||||
this.referenceTypes = List.of(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReferenceQuery externalReferenceTypes(ExternalReferencesType... value) {
|
||||
this.externalReferenceTypes = Arrays.asList(value);
|
||||
public ReferenceQuery referenceTypes(ReferenceType... value) {
|
||||
this.referenceTypes = Arrays.asList(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReferenceQuery externalReferenceTypes(Collection<ExternalReferencesType> values) {
|
||||
this.externalReferenceTypes = values;
|
||||
public ReferenceQuery referenceTypes(Collection<ReferenceType> values) {
|
||||
this.referenceTypes = values;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
|
|||
|
||||
@Override
|
||||
protected Boolean isFalseQuery() {
|
||||
return this.isEmpty(this.ids) || this.isEmpty(this.isActives) || this.isEmpty(this.excludedIds) || this.isEmpty(this.externalReferenceTypes) || this.isEmpty(this.sourceTypes);
|
||||
return this.isEmpty(this.ids) || this.isEmpty(this.isActives) || this.isEmpty(this.excludedIds) || this.isEmpty(this.referenceTypes) || this.isEmpty(this.sourceTypes);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -171,9 +171,9 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
|
|||
inClause.value(item);
|
||||
predicates.add(inClause);
|
||||
}
|
||||
if (this.externalReferenceTypes != null) {
|
||||
CriteriaBuilder.In<ExternalReferencesType> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(ReferenceEntity._type));
|
||||
for (ExternalReferencesType item : this.externalReferenceTypes)
|
||||
if (this.referenceTypes != null) {
|
||||
CriteriaBuilder.In<ReferenceType> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(ReferenceEntity._type));
|
||||
for (ReferenceType item : this.referenceTypes)
|
||||
inClause.value(item);
|
||||
predicates.add(inClause);
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
|
|||
item.setReference(QueryBase.convertSafe(tuple, columns, ReferenceEntity._reference, String.class));
|
||||
item.setSource(QueryBase.convertSafe(tuple, columns, ReferenceEntity._source, String.class));
|
||||
item.setSourceType(QueryBase.convertSafe(tuple, columns, ReferenceEntity._sourceType, SourceType.class));
|
||||
item.setType(QueryBase.convertSafe(tuple, columns, ReferenceEntity._type, ExternalReferencesType.class));
|
||||
item.setType(QueryBase.convertSafe(tuple, columns, ReferenceEntity._type, ReferenceType.class));
|
||||
item.setCreatedBy(QueryBase.convertSafe(tuple, columns, ReferenceEntity._createdBy, UUID.class));
|
||||
return item;
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
|
|||
else if (item.match(ReferenceEntity._source)) return ReferenceEntity._source;
|
||||
else if (item.match(ReferenceEntity._sourceType)) return ReferenceEntity._sourceType;
|
||||
else if (item.match(ReferenceEntity._type)) return ReferenceEntity._type;
|
||||
//else if (item.prefix(ExternalReferenceEntity._createdBy)) return ExternalReferenceEntity._createdBy;
|
||||
//else if (item.prefix(ReferenceEntity._createdBy)) return ReferenceEntity._createdBy;
|
||||
else return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package eu.eudat.query.lookup;
|
||||
|
||||
import eu.eudat.commons.enums.ExternalReferencesType;
|
||||
import eu.eudat.commons.enums.ReferenceType;
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
import eu.eudat.commons.enums.SourceType;
|
||||
import eu.eudat.query.ReferenceQuery;
|
||||
|
@ -19,7 +19,7 @@ public class ReferenceLookup extends Lookup {
|
|||
|
||||
private Collection<SourceType> sourceTypes;
|
||||
|
||||
private Collection<ExternalReferencesType> externalReferenceTypes;
|
||||
private Collection<ReferenceType> referenceTypes;
|
||||
|
||||
private List<UUID> ids;
|
||||
|
||||
|
@ -65,19 +65,19 @@ public class ReferenceLookup extends Lookup {
|
|||
this.sourceTypes = sourceTypes;
|
||||
}
|
||||
|
||||
public Collection<ExternalReferencesType> getExternalReferenceTypes() {
|
||||
return externalReferenceTypes;
|
||||
public Collection<ReferenceType> getReferenceTypes() {
|
||||
return referenceTypes;
|
||||
}
|
||||
|
||||
public void setExternalReferenceTypes(Collection<ExternalReferencesType> externalReferenceTypes) {
|
||||
this.externalReferenceTypes = externalReferenceTypes;
|
||||
public void setReferenceTypes(Collection<ReferenceType> referenceTypes) {
|
||||
this.referenceTypes = referenceTypes;
|
||||
}
|
||||
|
||||
public ReferenceQuery enrich(QueryFactory queryFactory) {
|
||||
ReferenceQuery query = queryFactory.query(ReferenceQuery.class);
|
||||
if (this.like != null) query.like(this.like);
|
||||
if (this.isActive != null) query.isActive(this.isActive);
|
||||
if (this.externalReferenceTypes != null) query.externalReferenceTypes(this.externalReferenceTypes);
|
||||
if (this.referenceTypes != null) query.referenceTypes(this.referenceTypes);
|
||||
if (this.sourceTypes != null) query.sourceTypes(this.sourceTypes);
|
||||
if (this.ids != null) query.ids(this.ids);
|
||||
if (this.excludedIds != null) query.excludedIds(this.excludedIds);
|
||||
|
|
|
@ -3,7 +3,7 @@ package eu.eudat.controllers.v2;
|
|||
import eu.eudat.audit.AuditableAction;
|
||||
import eu.eudat.authorization.AuthorizationFlags;
|
||||
import eu.eudat.authorization.Permission;
|
||||
import eu.eudat.commons.enums.ExternalReferencesType;
|
||||
import eu.eudat.commons.enums.ReferenceType;
|
||||
import eu.eudat.controllers.BaseController;
|
||||
import eu.eudat.data.ReferenceEntity;
|
||||
import eu.eudat.logic.proxy.config.exceptions.HugeResultSet;
|
||||
|
@ -14,7 +14,7 @@ import eu.eudat.model.Reference;
|
|||
import eu.eudat.model.builder.ReferenceBuilder;
|
||||
import eu.eudat.model.censorship.ReferenceCensor;
|
||||
import eu.eudat.model.result.QueryResult;
|
||||
import eu.eudat.models.data.FetcherExternalReference;
|
||||
import eu.eudat.models.data.FetcherReference;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
import eu.eudat.query.ReferenceQuery;
|
||||
import eu.eudat.query.lookup.ReferenceLookup;
|
||||
|
@ -46,7 +46,7 @@ import java.util.Map;
|
|||
import java.util.UUID;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(path = {"api/external-references"})
|
||||
@RequestMapping(path = {"api/reference"})
|
||||
public class ReferenceController extends BaseController {
|
||||
|
||||
private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(ReferenceController.class));
|
||||
|
@ -113,15 +113,15 @@ public class ReferenceController extends BaseController {
|
|||
}
|
||||
|
||||
@GetMapping(path = {"search/{externalType}"}, produces = "application/json")
|
||||
public @ResponseBody ResponseEntity<ResponseItem<List<FetcherExternalReference>>> searchExternalReference(@PathVariable(value = "externalType") int externalType,
|
||||
@RequestParam(value = "query", required = false) String query,
|
||||
@RequestParam(value = "type", required = false) String type
|
||||
public @ResponseBody ResponseEntity<ResponseItem<List<FetcherReference>>> searchReference(@PathVariable(value = "externalType") int externalType,
|
||||
@RequestParam(value = "query", required = false) String query,
|
||||
@RequestParam(value = "type", required = false) String type
|
||||
) throws HugeResultSet, NoURLFound, InvalidApplicationException {
|
||||
this.authorizationService.authorizeForce(Permission.AuthenticatedRole);
|
||||
ExternalReferencesType externalReferencesType = ExternalReferencesType.of((short) externalType);
|
||||
ReferenceType referenceType = ReferenceType.of((short) externalType);
|
||||
|
||||
List<FetcherExternalReference> fetcherExternalReferences = this.referenceService.searchExternalReference(externalReferencesType, query, type);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<FetcherExternalReference>>().status(ApiMessageCode.NO_MESSAGE).payload(fetcherExternalReferences));
|
||||
List<FetcherReference> fetcherReferences = this.referenceService.searchReference(referenceType, query, type);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<FetcherReference>>().status(ApiMessageCode.NO_MESSAGE).payload(fetcherReferences));
|
||||
}
|
||||
|
||||
@DeleteMapping("{id}")
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.jayway.jsonpath.DocumentContext;
|
||||
import com.jayway.jsonpath.JsonPath;
|
||||
import eu.eudat.commons.enums.ExternalReferencesType;
|
||||
import eu.eudat.commons.enums.ReferenceType;
|
||||
import eu.eudat.logic.proxy.config.*;
|
||||
import eu.eudat.logic.proxy.config.configloaders.ConfigLoader;
|
||||
import eu.eudat.logic.proxy.config.entities.GenericUrls;
|
||||
|
@ -51,7 +51,7 @@ public class RemoteFetcher {
|
|||
).clientConnector(new ReactorClientHttpConnector(HttpClient.create().followRedirect(true))).build();
|
||||
}
|
||||
|
||||
public List<Map<String, String>> get(ExternalReferencesType externalType, ExternalUrlCriteria externalUrlCriteria, String key) throws NoURLFound, HugeResultSet {
|
||||
public List<Map<String, String>> get(ReferenceType externalType, ExternalUrlCriteria externalUrlCriteria, String key) throws NoURLFound, HugeResultSet {
|
||||
FetchStrategy fetchStrategy = null;
|
||||
GenericUrls exGenericUrls = this.getExternalUrls(externalType);
|
||||
List<UrlConfiguration> urlConfigs = key != null && !key.isEmpty() ? exGenericUrls.getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList())
|
||||
|
@ -60,7 +60,7 @@ public class RemoteFetcher {
|
|||
return getAll(urlConfigs, fetchStrategy, externalUrlCriteria);
|
||||
}
|
||||
|
||||
public GenericUrls getExternalUrls(ExternalReferencesType externalType) {
|
||||
public GenericUrls getExternalUrls(ReferenceType externalType) {
|
||||
switch (externalType){
|
||||
case Taxonomies: return configLoader.getExternalUrls().getTaxonomies();
|
||||
case Licenses: return configLoader.getExternalUrls().getLicenses();
|
||||
|
|
|
@ -5,6 +5,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
|||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "cache.external-reference")
|
||||
public class ExternalReferencesCacheOptions extends CacheOptions {
|
||||
@ConfigurationProperties(prefix = "cache.reference")
|
||||
public class ReferenceCacheOptions extends CacheOptions {
|
||||
}
|
|
@ -9,27 +9,27 @@ import java.util.HashMap;
|
|||
import java.util.Locale;
|
||||
|
||||
@Service
|
||||
public class ExternalReferencesCacheService extends CacheService<ExternalReferencesCacheService.ExternalReferencesCacheValue> {
|
||||
public class ReferenceCacheService extends CacheService<ReferenceCacheService.ReferenceCacheValue> {
|
||||
|
||||
public static class ExternalReferencesCacheValue {
|
||||
public static class ReferenceCacheValue {
|
||||
|
||||
public ExternalReferencesCacheValue() {}
|
||||
public ReferenceCacheValue() {}
|
||||
|
||||
public ExternalReferencesCacheValue(String externalType, ExternalUrlCriteria externalUrlCriteria) {
|
||||
this.externalType = externalType;
|
||||
public ReferenceCacheValue(String type, ExternalUrlCriteria externalUrlCriteria) {
|
||||
this.type = type;
|
||||
this.externalUrlCriteria = externalUrlCriteria;
|
||||
}
|
||||
|
||||
private String externalType;
|
||||
private String type;
|
||||
|
||||
private ExternalUrlCriteria externalUrlCriteria;
|
||||
|
||||
public String getExternalType() {
|
||||
return externalType;
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setExternalType(String externalType) {
|
||||
this.externalType = externalType;
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public ExternalUrlCriteria getExternalUrlCriteria() {
|
||||
|
@ -42,15 +42,15 @@ public class ExternalReferencesCacheService extends CacheService<ExternalReferen
|
|||
}
|
||||
|
||||
@Autowired
|
||||
public ExternalReferencesCacheService(ExternalReferencesCacheOptions options) {
|
||||
public ReferenceCacheService(ReferenceCacheOptions options) {
|
||||
super(options);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<ExternalReferencesCacheValue> valueClass() {return ExternalReferencesCacheValue.class;}
|
||||
protected Class<ReferenceCacheValue> valueClass() {return ReferenceCacheValue.class;}
|
||||
|
||||
public String keyOf(ExternalReferencesCacheValue value) {
|
||||
return this.buildKey(value.getExternalType(), value.getExternalUrlCriteria());
|
||||
public String keyOf(ReferenceCacheValue value) {
|
||||
return this.buildKey(value.getType(), value.getExternalUrlCriteria());
|
||||
}
|
||||
|
||||
public String buildKey(String externalType, ExternalUrlCriteria externalUrlCriteria) {
|
|
@ -1,7 +1,7 @@
|
|||
package eu.eudat.logic.services.references;
|
||||
|
||||
import eu.eudat.authorization.Permission;
|
||||
import eu.eudat.commons.enums.ExternalReferencesType;
|
||||
import eu.eudat.commons.enums.ReferenceType;
|
||||
import eu.eudat.commons.scope.user.UserScope;
|
||||
import eu.eudat.convention.ConventionService;
|
||||
import eu.eudat.data.dao.criteria.DataRepositoryCriteria;
|
||||
|
@ -19,7 +19,7 @@ import eu.eudat.logic.proxy.config.exceptions.NoURLFound;
|
|||
import eu.eudat.logic.proxy.fetching.RemoteFetcher;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.model.deleter.ReferenceDeleter;
|
||||
import eu.eudat.models.data.FetcherExternalReference;
|
||||
import eu.eudat.models.data.FetcherReference;
|
||||
import eu.eudat.queryable.QueryableList;
|
||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||
import gr.cite.tools.data.builder.BuilderFactory;
|
||||
|
@ -75,7 +75,7 @@ public class ReferenceService {
|
|||
public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException {
|
||||
logger.debug("deleting : {}", id);
|
||||
|
||||
this.authorizationService.authorizeForce(Permission.DeleteExternalReference);
|
||||
this.authorizationService.authorizeForce(Permission.DeleteReference);
|
||||
|
||||
this.deleterFactory.deleter(ReferenceDeleter.class).deleteAndSaveByIds(List.of(id));
|
||||
}
|
||||
|
@ -89,26 +89,26 @@ public class ReferenceService {
|
|||
// dataRepositories
|
||||
// registries,
|
||||
// services
|
||||
public List<FetcherExternalReference> searchExternalReference(ExternalReferencesType externalType, String query, String type) throws HugeResultSet, NoURLFound, InvalidApplicationException {
|
||||
public List<FetcherReference> searchReference(ReferenceType externalType, String query, String type) throws HugeResultSet, NoURLFound, InvalidApplicationException {
|
||||
ExternalUrlCriteria externalUrlCriteria = new ExternalUrlCriteria(query);
|
||||
|
||||
List<Map<String, String>> remoteRepos = null;
|
||||
if (externalType.equals(ExternalReferencesType.Datasets)){
|
||||
if (externalType.equals(ReferenceType.Datasets)){
|
||||
remoteRepos = remoteFetcher.getDatasets(externalUrlCriteria, type);
|
||||
}else {
|
||||
remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().get(externalType, externalUrlCriteria, type);
|
||||
}
|
||||
|
||||
List<FetcherExternalReference> list = this.fetchFromDb(externalType, query, type, remoteRepos);
|
||||
List<FetcherReference> list = this.fetchFromDb(externalType, query, type, remoteRepos);
|
||||
|
||||
list.addAll(remoteRepos.stream().map(FetcherExternalReference::fromRemoteModel).toList());
|
||||
list.addAll(remoteRepos.stream().map(FetcherReference::fromRemoteModel).toList());
|
||||
list = list.stream().filter(x -> x.getName().toLowerCase().contains(query.toLowerCase())).collect(Collectors.toList());
|
||||
list.sort(Comparator.comparing(FetcherExternalReference::getName));
|
||||
list.sort(Comparator.comparing(FetcherReference::getName));
|
||||
return list;
|
||||
}
|
||||
|
||||
private List<FetcherExternalReference> fetchFromDb(ExternalReferencesType externalType, String query, String type, List<Map<String, String>> remoteRepos) throws InvalidApplicationException {
|
||||
List<FetcherExternalReference> list = new LinkedList<>();
|
||||
private List<FetcherReference> fetchFromDb(ReferenceType externalType, String query, String type, List<Map<String, String>> remoteRepos) throws InvalidApplicationException {
|
||||
List<FetcherReference> list = new LinkedList<>();
|
||||
switch (externalType) {
|
||||
case DataRepositories:
|
||||
case PubRepositories:
|
||||
|
@ -118,7 +118,7 @@ public class ReferenceService {
|
|||
criteria.setCreationUserId(this.userScope.getUserId());
|
||||
if (type.equals("")) {
|
||||
List<DataRepository> dataRepositoryList = (this.apiContext.getOperationsContext().getDatabaseRepository().getDataRepositoryDao().getWithCriteria(criteria)).toList();
|
||||
list = dataRepositoryList.stream().map(item -> new FetcherExternalReference().fromDataRepository(item)).collect(Collectors.toList());
|
||||
list = dataRepositoryList.stream().map(item -> new FetcherReference().fromDataRepository(item)).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
case Registries: {
|
||||
|
@ -127,7 +127,7 @@ public class ReferenceService {
|
|||
criteria.setCreationUserId(this.userScope.getUserId());
|
||||
if (type.equals("")) {
|
||||
List<Registry> registryList = (this.apiContext.getOperationsContext().getDatabaseRepository().getRegistryDao().getWithCriteria(criteria)).toList();
|
||||
list = registryList.stream().map(item -> new FetcherExternalReference().fromRegistry(item)).collect(Collectors.toList());
|
||||
list = registryList.stream().map(item -> new FetcherReference().fromRegistry(item)).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
case Services:
|
||||
|
@ -139,7 +139,7 @@ public class ReferenceService {
|
|||
|
||||
if (type.equals("")) {
|
||||
List<Service> serviceList = (this.apiContext.getOperationsContext().getDatabaseRepository().getServiceDao().getWithCriteria(criteria)).toList();
|
||||
list = serviceList.stream().map(item -> new FetcherExternalReference().fromService(item)).collect(Collectors.toList());
|
||||
list = serviceList.stream().map(item -> new FetcherReference().fromService(item)).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
case Datasets:{
|
||||
|
@ -149,7 +149,7 @@ public class ReferenceService {
|
|||
criteria.setCreationUserId(this.userScope.getUserId());
|
||||
QueryableList<ExternalDataset> items = apiContext.getOperationsContext().getDatabaseRepository().getExternalDatasetDao().getWithCriteria(criteria);
|
||||
|
||||
list = items.select(item -> new FetcherExternalReference().fromDataset(item));
|
||||
list = items.select(item -> new FetcherReference().fromDataset(item));
|
||||
}
|
||||
case Taxonomies:
|
||||
case Publications:
|
||||
|
|
|
@ -4,7 +4,7 @@ import eu.eudat.data.old.*;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
public class FetcherExternalReference {
|
||||
public class FetcherReference {
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
|
@ -133,28 +133,28 @@ public class FetcherExternalReference {
|
|||
this.tag = tag;
|
||||
}
|
||||
|
||||
public static FetcherExternalReference fromRemoteModel(Map<String, String> data) {
|
||||
FetcherExternalReference fetcherExternalReference = new FetcherExternalReference();
|
||||
if (data == null) return fetcherExternalReference;
|
||||
public static FetcherReference fromRemoteModel(Map<String, String> data) {
|
||||
FetcherReference fetcherReference = new FetcherReference();
|
||||
if (data == null) return fetcherReference;
|
||||
|
||||
fetcherExternalReference.setId(data.getOrDefault("id", null));
|
||||
fetcherExternalReference.setName(data.getOrDefault("name", null));
|
||||
fetcherExternalReference.setPid(data.getOrDefault("pid", null));
|
||||
fetcherExternalReference.setPidTypeField(data.getOrDefault("pidTypeField", null));
|
||||
fetcherExternalReference.setUri(data.getOrDefault("uri", null));
|
||||
fetcherExternalReference.setDescription(data.getOrDefault("description", null));
|
||||
fetcherExternalReference.setSource(data.getOrDefault("source", null));
|
||||
fetcherExternalReference.setCount(data.getOrDefault("count", null));
|
||||
fetcherExternalReference.setPath(data.getOrDefault("path", null));
|
||||
fetcherExternalReference.setHost(data.getOrDefault("host", null));
|
||||
fetcherExternalReference.setTypes(data.getOrDefault("types", null));
|
||||
fetcherExternalReference.setFirstName(data.getOrDefault("firstName", null));
|
||||
fetcherExternalReference.setLastName(data.getOrDefault("lastName", null));
|
||||
fetcherExternalReference.setTag(data.getOrDefault("tag", null));
|
||||
return fetcherExternalReference;
|
||||
fetcherReference.setId(data.getOrDefault("id", null));
|
||||
fetcherReference.setName(data.getOrDefault("name", null));
|
||||
fetcherReference.setPid(data.getOrDefault("pid", null));
|
||||
fetcherReference.setPidTypeField(data.getOrDefault("pidTypeField", null));
|
||||
fetcherReference.setUri(data.getOrDefault("uri", null));
|
||||
fetcherReference.setDescription(data.getOrDefault("description", null));
|
||||
fetcherReference.setSource(data.getOrDefault("source", null));
|
||||
fetcherReference.setCount(data.getOrDefault("count", null));
|
||||
fetcherReference.setPath(data.getOrDefault("path", null));
|
||||
fetcherReference.setHost(data.getOrDefault("host", null));
|
||||
fetcherReference.setTypes(data.getOrDefault("types", null));
|
||||
fetcherReference.setFirstName(data.getOrDefault("firstName", null));
|
||||
fetcherReference.setLastName(data.getOrDefault("lastName", null));
|
||||
fetcherReference.setTag(data.getOrDefault("tag", null));
|
||||
return fetcherReference;
|
||||
}
|
||||
|
||||
public FetcherExternalReference fromDataRepository(DataRepository entity) {
|
||||
public FetcherReference fromDataRepository(DataRepository entity) {
|
||||
// this.setAbbreviation(entity.getAbbreviation());
|
||||
this.setName(entity.getLabel());
|
||||
this.setUri(entity.getUri());
|
||||
|
@ -169,7 +169,7 @@ public class FetcherExternalReference {
|
|||
return this;
|
||||
}
|
||||
|
||||
public FetcherExternalReference fromRegistry(Registry entity){
|
||||
public FetcherReference fromRegistry(Registry entity){
|
||||
this.id = entity.getId().toString();
|
||||
// this.abbreviation = entity.getAbbreviation();
|
||||
// this.created = entity.getCreated();
|
||||
|
@ -186,7 +186,7 @@ public class FetcherExternalReference {
|
|||
// this.reference = entity.getReference();
|
||||
return this;
|
||||
}
|
||||
public FetcherExternalReference fromService(Service entity) {
|
||||
public FetcherReference fromService(Service entity) {
|
||||
// this.abbreviation = entity.getAbbreviation();
|
||||
// this.created = entity.getCreated();
|
||||
this.id = entity.getId().toString();
|
||||
|
@ -203,7 +203,7 @@ public class FetcherExternalReference {
|
|||
return this;
|
||||
}
|
||||
|
||||
public FetcherExternalReference fromResearcher(Researcher entity){
|
||||
public FetcherReference fromResearcher(Researcher entity){
|
||||
this.id = entity.getId().toString();
|
||||
this.name = entity.getLabel();
|
||||
String refParts[] = entity.getReference().split(":");
|
||||
|
@ -216,7 +216,7 @@ public class FetcherExternalReference {
|
|||
return this;
|
||||
}
|
||||
|
||||
public FetcherExternalReference fromOrganisation(Organisation entity){
|
||||
public FetcherReference fromOrganisation(Organisation entity){
|
||||
this.id = entity.getId().toString();
|
||||
this.name = entity.getLabel();
|
||||
String refParts[] = entity.getReference().split(":");
|
||||
|
@ -229,7 +229,7 @@ public class FetcherExternalReference {
|
|||
return this;
|
||||
}
|
||||
|
||||
public FetcherExternalReference fromDataset(ExternalDataset entity){
|
||||
public FetcherReference fromDataset(ExternalDataset entity){
|
||||
this.id = entity.getId().toString();
|
||||
this.name = entity.getLabel();
|
||||
String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":"));
|
|
@ -26,7 +26,7 @@ cache:
|
|||
expireAfterWriteMinutes: 10
|
||||
expireAfterAccessMinutes: 10
|
||||
refreshAfterWriteMinutes: 10
|
||||
- names: [ "externalReference" ]
|
||||
- names: [ "Reference" ]
|
||||
allowNullValues: true
|
||||
initialCapacity: 100
|
||||
maximumSize: 500
|
||||
|
@ -44,6 +44,6 @@ cache:
|
|||
supportiveMaterial:
|
||||
name: supportiveMaterial
|
||||
keyPattern: supportive_material_$material$:v0
|
||||
externalReference:
|
||||
name: externalReference
|
||||
keyPattern: external_reference_$type$_$criteria$:v0
|
||||
Reference:
|
||||
name: Reference
|
||||
keyPattern: reference_$type$_$criteria$:v0
|
|
@ -196,20 +196,20 @@ permissions:
|
|||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
|
||||
# ExternalReference Permissions
|
||||
BrowseExternalReference:
|
||||
# Reference Permissions
|
||||
BrowseReference:
|
||||
roles:
|
||||
- Admin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditExternalReference:
|
||||
EditReference:
|
||||
roles:
|
||||
- Admin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteExternalReference:
|
||||
DeleteReference:
|
||||
roles:
|
||||
- Admin
|
||||
claims: [ ]
|
||||
|
@ -217,20 +217,20 @@ permissions:
|
|||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
|
||||
# DmpExternalReference Permissions
|
||||
BrowseDmpExternalReference:
|
||||
# DmpReference Permissions
|
||||
BrowseDmpReference:
|
||||
roles:
|
||||
- Admin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
EditDmpExternalReference:
|
||||
EditDmpReference:
|
||||
roles:
|
||||
- Admin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteDmpExternalReference:
|
||||
DeleteDmpReference:
|
||||
roles:
|
||||
- Admin
|
||||
claims: [ ]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export enum ExternalReferencesType {
|
||||
export enum ReferenceType {
|
||||
Taxonomies = 0,
|
||||
Licenses = 1,
|
||||
Publications = 2,
|
|
@ -1,13 +1,13 @@
|
|||
import { ExternalReferencesType } from "@app/core/common/enum/external-references-type";
|
||||
import { ReferenceType } from "@app/core/common/enum/reference-type";
|
||||
import { IsActive } from "@app/core/common/enum/is-active.enum";
|
||||
import { SourceType } from "@app/core/common/enum/source-type";
|
||||
import { UUID } from "crypto";
|
||||
import { DmpBlueprint } from "../dmp-blueprint/dmp-blueprint";
|
||||
import { DmpModel } from "../dmp/dmp";
|
||||
|
||||
export interface Reference {
|
||||
id: UUID;
|
||||
label: string;
|
||||
type: ExternalReferencesType;
|
||||
type: ReferenceType;
|
||||
description: string;
|
||||
definition: string;
|
||||
reference: string;
|
||||
|
@ -17,17 +17,17 @@ export interface Reference {
|
|||
isActive: IsActive;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
dmpExternalReferences: DmpReference[];
|
||||
dmpReferences: DmpReference[];
|
||||
}
|
||||
|
||||
export interface DmpReference {
|
||||
id: UUID;
|
||||
dmpBlueprint: DmpBlueprint;
|
||||
externalReference: Reference;
|
||||
dmp: DmpModel;
|
||||
reference: Reference;
|
||||
data: string;
|
||||
}
|
||||
|
||||
export interface FetcherExternalReference {
|
||||
export interface FetcherReference {
|
||||
id: string;
|
||||
name: string;
|
||||
pid: string;
|
|
@ -14,8 +14,8 @@ import { BaseHttpService } from '../http/base-http.service';
|
|||
import { ConfigurationService } from '../configuration/configuration.service';
|
||||
import { LicenseCriteria } from '@app/core/query/license/license-criteria';
|
||||
import {PublicationCriteria} from "@app/core/query/publication/publication-criteria";
|
||||
import { FetcherExternalReference } from '@app/core/model/external-reference/external-reference';
|
||||
import { ExternalReferencesType } from '@app/core/common/enum/external-references-type';
|
||||
import { FetcherReference } from '@app/core/model/reference/reference';
|
||||
import { ReferenceType } from '@app/core/common/enum/reference-type';
|
||||
@Injectable()
|
||||
export class ExternalSourcesService {
|
||||
|
||||
|
@ -59,11 +59,11 @@ export class ExternalSourcesService {
|
|||
return this.http.get<ExternalSourceItemModel[]>(this.actionUrl + 'licenses' + '?query=' + requestItem.criteria.like + '&type=' + requestItem.criteria.type, { headers: this.headers });
|
||||
}
|
||||
|
||||
public listExternal(externalType: ExternalReferencesType, query: string, type: string): Observable<FetcherExternalReference[]> {
|
||||
const url = this.configurationService.server + `external-references/search/${externalType}`;
|
||||
public listExternal(externalType: ReferenceType, query: string, type: string): Observable<FetcherReference[]> {
|
||||
const url = this.configurationService.server + `reference/search/${externalType}`;
|
||||
const options = { params: { query: query, type: type } };
|
||||
|
||||
return this.http.get<FetcherExternalReference[]>(url, options);
|
||||
return this.http.get<FetcherReference[]>(url, options);
|
||||
}
|
||||
|
||||
public searchDatasetTags(requestItem: RequestItem<TagCriteria>): Observable<ExternalSourceItemModel[]> {
|
||||
|
|
|
@ -48,8 +48,8 @@ import {MatDialog} from "@angular/material/dialog";
|
|||
import {HttpError} from "@common/modules/errors/error-handling/http-error-handling.service";
|
||||
import {HttpErrorResponse} from "@angular/common/http";
|
||||
import * as FileSaver from "file-saver";
|
||||
import { FetcherExternalReference } from '@app/core/model/external-reference/external-reference';
|
||||
import { ExternalReferencesType } from '@app/core/common/enum/external-references-type';
|
||||
import { FetcherReference } from '@app/core/model/reference/reference';
|
||||
import { ReferenceType } from '@app/core/common/enum/reference-type';
|
||||
import { FileUtils } from '@app/core/services/utilities/file-utils.service';
|
||||
|
||||
@Component({
|
||||
|
@ -466,72 +466,72 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
searchDatasetExternalDatasets(query: string): Observable<FetcherExternalReference[]> {
|
||||
searchDatasetExternalDatasets(query: string): Observable<FetcherReference[]> {
|
||||
const requestItem: RequestItem<ExternalDatasetCriteria> = new RequestItem();
|
||||
requestItem.criteria = new ExternalDatasetCriteria();
|
||||
requestItem.criteria.like = query;
|
||||
requestItem.criteria.type = '';
|
||||
//return this.externalSourcesService.searchDatasetSExternalDatasetservice(requestItem);
|
||||
return this.externalSourcesService.listExternal(ExternalReferencesType.Datasets, requestItem.criteria.like, requestItem.criteria.type);
|
||||
return this.externalSourcesService.listExternal(ReferenceType.Datasets, requestItem.criteria.like, requestItem.criteria.type);
|
||||
}
|
||||
|
||||
searchDatasetExternalDataRepositories(query: string): Observable<FetcherExternalReference[]> {
|
||||
searchDatasetExternalDataRepositories(query: string): Observable<FetcherReference[]> {
|
||||
const requestItem: RequestItem<DataRepositoryCriteria> = new RequestItem();
|
||||
requestItem.criteria = new DataRepositoryCriteria();
|
||||
requestItem.criteria.like = query;
|
||||
requestItem.criteria.type = '';
|
||||
return this.externalSourcesService.listExternal(ExternalReferencesType.DataRepositories, requestItem.criteria.like, requestItem.criteria.type);
|
||||
return this.externalSourcesService.listExternal(ReferenceType.DataRepositories, requestItem.criteria.like, requestItem.criteria.type);
|
||||
}
|
||||
searchDatasetExternalPubRepositories(query: string): Observable<FetcherExternalReference[]> {
|
||||
searchDatasetExternalPubRepositories(query: string): Observable<FetcherReference[]> {
|
||||
const requestItem: RequestItem<DataRepositoryCriteria> = new RequestItem();
|
||||
requestItem.criteria = new DataRepositoryCriteria();
|
||||
requestItem.criteria.like = query;
|
||||
requestItem.criteria.type = '';
|
||||
return this.externalSourcesService.listExternal(ExternalReferencesType.PubRepositories, requestItem.criteria.like, requestItem.criteria.type);
|
||||
return this.externalSourcesService.listExternal(ReferenceType.PubRepositories, requestItem.criteria.like, requestItem.criteria.type);
|
||||
}
|
||||
searchDatasetExternalJournalRepositories(query: string): Observable<FetcherExternalReference[]> {
|
||||
searchDatasetExternalJournalRepositories(query: string): Observable<FetcherReference[]> {
|
||||
const requestItem: RequestItem<DataRepositoryCriteria> = new RequestItem();
|
||||
requestItem.criteria = new DataRepositoryCriteria();
|
||||
requestItem.criteria.like = query;
|
||||
requestItem.criteria.type = '';
|
||||
return this.externalSourcesService.listExternal(ExternalReferencesType.Journals, requestItem.criteria.like, requestItem.criteria.type);
|
||||
return this.externalSourcesService.listExternal(ReferenceType.Journals, requestItem.criteria.like, requestItem.criteria.type);
|
||||
}
|
||||
searchDatasetExternalTaxonomies(query: string): Observable<FetcherExternalReference[]> {
|
||||
searchDatasetExternalTaxonomies(query: string): Observable<FetcherReference[]> {
|
||||
const requestItem: RequestItem<TaxonomyCriteria> = new RequestItem();
|
||||
requestItem.criteria = new TaxonomyCriteria();
|
||||
requestItem.criteria.like = query;
|
||||
requestItem.criteria.type = '';
|
||||
return this.externalSourcesService.listExternal(ExternalReferencesType.Taxonomies, requestItem.criteria.like, requestItem.criteria.type);
|
||||
return this.externalSourcesService.listExternal(ReferenceType.Taxonomies, requestItem.criteria.like, requestItem.criteria.type);
|
||||
}
|
||||
searchDatasetExternalLicences(query: string): Observable<FetcherExternalReference[]> {
|
||||
searchDatasetExternalLicences(query: string): Observable<FetcherReference[]> {
|
||||
const requestItem: RequestItem<LicenseCriteria> = new RequestItem();
|
||||
requestItem.criteria = new LicenseCriteria();
|
||||
requestItem.criteria.like = query;
|
||||
requestItem.criteria.type = '';
|
||||
return this.externalSourcesService.listExternal(ExternalReferencesType.Licenses, requestItem.criteria.like, requestItem.criteria.type);
|
||||
return this.externalSourcesService.listExternal(ReferenceType.Licenses, requestItem.criteria.like, requestItem.criteria.type);
|
||||
}
|
||||
searchDatasetExternalPublications(query: string): Observable<FetcherExternalReference[]> {
|
||||
searchDatasetExternalPublications(query: string): Observable<FetcherReference[]> {
|
||||
const requestItem: RequestItem<PublicationCriteria> = new RequestItem();
|
||||
requestItem.criteria = new PublicationCriteria();
|
||||
requestItem.criteria.like = query;
|
||||
requestItem.criteria.type = '';
|
||||
return this.externalSourcesService.listExternal(ExternalReferencesType.Publications, requestItem.criteria.like, requestItem.criteria.type);
|
||||
return this.externalSourcesService.listExternal(ReferenceType.Publications, requestItem.criteria.like, requestItem.criteria.type);
|
||||
}
|
||||
|
||||
searchDatasetExternalRegistries(query: string): Observable<FetcherExternalReference[]> {
|
||||
searchDatasetExternalRegistries(query: string): Observable<FetcherReference[]> {
|
||||
const requestItem: RequestItem<RegistryCriteria> = new RequestItem();
|
||||
requestItem.criteria = new RegistryCriteria();
|
||||
requestItem.criteria.like = query;
|
||||
requestItem.criteria.type = '';
|
||||
return this.externalSourcesService.listExternal(ExternalReferencesType.Registries, requestItem.criteria.like, requestItem.criteria.type);
|
||||
return this.externalSourcesService.listExternal(ReferenceType.Registries, requestItem.criteria.like, requestItem.criteria.type);
|
||||
}
|
||||
|
||||
searchDatasetExternalServices(query: string): Observable<FetcherExternalReference[]> {
|
||||
searchDatasetExternalServices(query: string): Observable<FetcherReference[]> {
|
||||
const requestItem: RequestItem<ServiceCriteria> = new RequestItem();
|
||||
requestItem.criteria = new ServiceCriteria();
|
||||
requestItem.criteria.like = query;
|
||||
requestItem.criteria.type = '';
|
||||
return this.externalSourcesService.listExternal(ExternalReferencesType.Services, requestItem.criteria.like, requestItem.criteria.type);
|
||||
return this.externalSourcesService.listExternal(ReferenceType.Services, requestItem.criteria.like, requestItem.criteria.type);
|
||||
}
|
||||
|
||||
searchDatasetTags(query: string): Observable<ExternalSourceItemModel[]> {
|
||||
|
@ -593,14 +593,14 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
filterOrganisations(value: string): Observable<FetcherExternalReference[]> {
|
||||
filterOrganisations(value: string): Observable<FetcherReference[]> {
|
||||
//return this.externalSourcesService.searchDMPOrganizations(value);
|
||||
return this.externalSourcesService.listExternal(ExternalReferencesType.Organizations, value, '');
|
||||
return this.externalSourcesService.listExternal(ReferenceType.Organizations, value, '');
|
||||
}
|
||||
|
||||
filterResearchers(value: string): Observable<FetcherExternalReference[]> {
|
||||
filterResearchers(value: string): Observable<FetcherReference[]> {
|
||||
//return this.externalSourcesService.searchDMPResearchers({ criteria: { name: value, like: null } });
|
||||
return this.externalSourcesService.listExternal(ExternalReferencesType.Researcher, value, '');
|
||||
return this.externalSourcesService.listExternal(ReferenceType.Researcher, value, '');
|
||||
}
|
||||
|
||||
getDatasetIdControl(name: string): UntypedFormControl {
|
||||
|
|
Loading…
Reference in New Issue