Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring
This commit is contained in:
commit
9ed94450bd
|
@ -0,0 +1,29 @@
|
|||
package eu.eudat.commons.enums;
|
||||
|
||||
import eu.eudat.data.converters.enums.DatabaseEnum;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public enum DMPStatus implements DatabaseEnum<Short> {
|
||||
|
||||
ACTIVE((short) 0), FINALISED((short) 1),DELETED((short) 99);
|
||||
|
||||
private final Short value;
|
||||
|
||||
DMPStatus(Short value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Short getValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static final Map<Short, DMPStatus> map = EnumUtils.getEnumValueMap(DMPStatus.class);
|
||||
|
||||
public static DMPStatus of(Short i) {
|
||||
return map.get(i);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,8 +1,10 @@
|
|||
package eu.eudat.commons.enums;
|
||||
|
||||
import eu.eudat.data.converters.enums.DatabaseEnum;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public enum ExternalReferencesType {
|
||||
public enum ExternalReferencesType implements DatabaseEnum<Short> {
|
||||
Taxonomies((short) 0),
|
||||
Licenses((short) 1),
|
||||
Publications((short) 2),
|
||||
|
@ -12,13 +14,13 @@ public enum ExternalReferencesType {
|
|||
Registries((short) 6),
|
||||
Services((short) 7),
|
||||
Project((short) 8),
|
||||
Founder((short) 8),
|
||||
Datasets((short) 9),
|
||||
Organizations((short) 10),
|
||||
Grants((short) 11),
|
||||
Prefillings((short) 12),
|
||||
Funder((short) 9),
|
||||
Datasets((short) 10),
|
||||
Organizations((short) 11),
|
||||
Grants((short) 12),
|
||||
Validators((short) 13),
|
||||
Researcher((short) 14);
|
||||
Researcher((short) 14),
|
||||
Prefillings((short) 15);
|
||||
private final Short value;
|
||||
|
||||
ExternalReferencesType(Short value) {
|
||||
|
@ -29,9 +31,9 @@ public enum ExternalReferencesType {
|
|||
return value;
|
||||
}
|
||||
|
||||
private static final Map<Short, IsActive> map = EnumUtils.getEnumValueMap(IsActive.class);
|
||||
private static final Map<Short, ExternalReferencesType> map = EnumUtils.getEnumValueMap(ExternalReferencesType.class);
|
||||
|
||||
public static IsActive of(Short i) {
|
||||
public static ExternalReferencesType of(Short i) {
|
||||
return map.get(i);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,285 @@
|
|||
package eu.eudat.data;
|
||||
|
||||
import eu.eudat.commons.enums.DMPStatus;
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
import eu.eudat.data.converters.DateToUTCConverter;
|
||||
import eu.eudat.data.converters.enums.IsActiveConverter;
|
||||
import jakarta.persistence.*;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
|
||||
//TODO: (thgiannos) Wire up when all other dependent entities are refactored
|
||||
//@Entity
|
||||
//@Table(name = "\"DMP\"")
|
||||
public class DMPEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||
@Column(name = "id", updatable = false, nullable = false, columnDefinition = "BINARY(16)")
|
||||
private UUID id;
|
||||
|
||||
public static final String _id = "id";
|
||||
|
||||
@Column(name = "label")
|
||||
private String label;
|
||||
|
||||
public static final String _label = "label";
|
||||
|
||||
@Column(name = "version")
|
||||
private Integer version;
|
||||
|
||||
public static final String _version = "version";
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "status", nullable = false)
|
||||
private DMPStatus status;
|
||||
|
||||
public static final String _status = "status";
|
||||
|
||||
@Column(name = "properties")
|
||||
private String properties;
|
||||
|
||||
public static final String _properties = "properties";
|
||||
|
||||
@Column(name = "dmp_properties")
|
||||
private String dmpProperties;
|
||||
|
||||
public static final String _dmpProperties = "dmpProperties";
|
||||
|
||||
@Column(name = "group_id", columnDefinition = "BINARY(16)")
|
||||
private UUID groupId;
|
||||
|
||||
public static final String _groupId = "groupId";
|
||||
|
||||
@Column(name = "description")
|
||||
private String description;
|
||||
|
||||
public static final String _description = "description";
|
||||
|
||||
@Column(name = "is_public", nullable = false)
|
||||
private boolean isPublic;
|
||||
|
||||
public static final String _isPublic = "isPublic";
|
||||
|
||||
@Column(name = "extra_properties")
|
||||
private String extraProperties;
|
||||
|
||||
public static final String _extraProperties = "extraProperties";
|
||||
|
||||
@Column(name = "created_at")
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Instant createdAt;
|
||||
|
||||
public static final String _createdAt = "createdAt";
|
||||
|
||||
@Column(name = "updated_at")
|
||||
@Convert(converter = DateToUTCConverter.class)
|
||||
private Instant updatedAt;
|
||||
|
||||
public static final String _updatedAt = "updatedAt";
|
||||
|
||||
@Column(name = "is_active", nullable = false)
|
||||
@Convert(converter = IsActiveConverter.class)
|
||||
private IsActive isActive;
|
||||
|
||||
public static final String _isActive = "isActive";
|
||||
|
||||
//TODO: (thgiannos) Handle using the DMPEntity builder
|
||||
// @OneToMany(mappedBy = "dmp", fetch = FetchType.LAZY)
|
||||
// private Set<Dataset> dataset;
|
||||
|
||||
// @ManyToOne(fetch = FetchType.LAZY)
|
||||
// @JoinColumn(name = "\"Grant\"")
|
||||
//TODO: (thgiannos) Previously 'Grant'
|
||||
private UUID grant;
|
||||
|
||||
//TODO: (thgiannos) Handle using the DMPEntity builder
|
||||
// @OneToMany(fetch = FetchType.LAZY, mappedBy = "dmp")
|
||||
// private Set<DMPDatasetProfile> associatedDmps;
|
||||
|
||||
// @ManyToOne(fetch = FetchType.LAZY)
|
||||
// @JoinColumn(name = "\"Profile\"")
|
||||
//TODO: (thgiannos) Previously 'DMPProfile'
|
||||
private UUID profile;
|
||||
|
||||
// @ManyToOne(fetch = FetchType.LAZY)
|
||||
// @JoinColumn(name = "\"Creator\"")
|
||||
//TODO: (thgiannos) Previously 'UserInfo'
|
||||
private UUID creator;
|
||||
|
||||
//TODO: (thgiannos) Handle using the DMPEntity builder
|
||||
// @OneToMany(mappedBy = "entityId", fetch = FetchType.LAZY)
|
||||
// private Set<EntityDoiEntity> dois;
|
||||
|
||||
// @ManyToOne(fetch = FetchType.LAZY)
|
||||
// @JoinColumn(name = "\"Project\"")
|
||||
//TODO: (thgiannos) Previously 'Project'
|
||||
private UUID project;
|
||||
|
||||
// TODO: (thgiannos) Implement join entity
|
||||
// @OneToMany(fetch = FetchType.LAZY)
|
||||
// @JoinTable(name = "\"DMPOrganisation\"",
|
||||
// joinColumns = {@JoinColumn(name = "\"DMP\"", referencedColumnName = "\"ID\"")},
|
||||
// inverseJoinColumns = {@JoinColumn(name = "\"Organisation\"", referencedColumnName = "\"ID\"")}
|
||||
// )
|
||||
// private Set<Organisation> organisations;
|
||||
|
||||
// TODO: (thgiannos) Implement join entity
|
||||
// @OneToMany(fetch = FetchType.LAZY)
|
||||
// @JoinTable(name = "\"DMPResearcher\"",
|
||||
// joinColumns = {@JoinColumn(name = "\"DMP\"", referencedColumnName = "\"ID\"")},
|
||||
// inverseJoinColumns = {@JoinColumn(name = "\"Researcher\"", referencedColumnName = "\"ID\"")}
|
||||
// )
|
||||
// private Set<Researcher> researchers;
|
||||
|
||||
//TODO: (thgiannos) Handle using the DMPEntity builder
|
||||
// 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() {
|
||||
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 getPublic() {
|
||||
return isPublic;
|
||||
}
|
||||
|
||||
public void setPublic(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 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package eu.eudat.data.converters.enums;
|
||||
|
||||
import eu.eudat.commons.enums.DMPStatus;
|
||||
import jakarta.persistence.Converter;
|
||||
|
||||
@Converter
|
||||
public class DMPStatusConverter extends DatabaseEnumConverter<DMPStatus, Short> {
|
||||
|
||||
@Override
|
||||
protected DMPStatus of(Short i) {
|
||||
return DMPStatus.of(i);
|
||||
}
|
||||
|
||||
}
|
|
@ -341,7 +341,6 @@ public class DMP implements DataEntity<DMP, UUID> {
|
|||
this.publishedAt = publishedAt;
|
||||
}
|
||||
|
||||
//TODO: Dois will no longer be fetched by hibernate but using the query builders eventually. Use builder where this is called.
|
||||
public Set<EntityDoiEntity> getDois() {
|
||||
return dois;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package eu.eudat.model;
|
||||
|
||||
public class DMP {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package eu.eudat.model.builder;
|
||||
|
||||
public class DMPBuilder {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package eu.eudat.model.censorship;
|
||||
|
||||
public class DMPCensor {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package eu.eudat.model.deleter;
|
||||
|
||||
public class DMPDeleter {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package eu.eudat.model.persist;
|
||||
|
||||
public class DMPPersist {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package eu.eudat.query;
|
||||
|
||||
public class DMPQueryV2 {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package eu.eudat.query.lookup;
|
||||
|
||||
public class DMPLookup {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package eu.eudat.service;
|
||||
|
||||
public interface DMPService {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package eu.eudat.service;
|
||||
|
||||
public class DMPServiceImpl implements DMPService {
|
||||
|
||||
}
|
|
@ -70,14 +70,15 @@ public class ExternalReferencesController extends BaseController {
|
|||
|
||||
|
||||
|
||||
@GetMapping(path = {"data-repo/{externalType}"}, produces = "application/json")
|
||||
public @ResponseBody ResponseEntity<ResponseItem<List<ExternalReference>>> listExternalReferecnes(@RequestParam(value = "externalType") ExternalReferencesType externalType,
|
||||
@GetMapping(path = {"{externalType}"}, produces = "application/json")
|
||||
public @ResponseBody ResponseEntity<ResponseItem<List<ExternalReference>>> listExternalReferecnes(@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);
|
||||
|
||||
List<ExternalReference> externalReferences = this.externalReferencesService.getExternalReference(externalType, query, type);
|
||||
List<ExternalReference> externalReferences = this.externalReferencesService.getExternalReference(externalReferencesType, query, type);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<ExternalReference>>().status(ApiMessageCode.NO_MESSAGE).payload(externalReferences));
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import eu.eudat.controllers.BaseController;
|
|||
import eu.eudat.logic.proxy.config.exceptions.HugeResultSet;
|
||||
import eu.eudat.logic.proxy.config.exceptions.NoURLFound;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.logic.services.ValidationService;
|
||||
import eu.eudat.logic.services.ExternalValidationService;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
import eu.eudat.types.ApiMessageCode;
|
||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||
|
@ -17,15 +17,15 @@ import org.springframework.web.bind.annotation.*;
|
|||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(path = {"api/validation"})
|
||||
public class ValidationController extends BaseController {
|
||||
public class ExternalValidationController extends BaseController {
|
||||
|
||||
private ValidationService validationService;
|
||||
private ExternalValidationService externalValidationService;
|
||||
private final AuthorizationService authorizationService;
|
||||
|
||||
@Autowired
|
||||
public ValidationController(ApiContext apiContext, ValidationService validationService, AuthorizationService authorizationService) {
|
||||
public ExternalValidationController(ApiContext apiContext, ExternalValidationService externalValidationService, AuthorizationService authorizationService) {
|
||||
super(apiContext);
|
||||
this.validationService = validationService;
|
||||
this.externalValidationService = externalValidationService;
|
||||
this.authorizationService = authorizationService;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class ValidationController extends BaseController {
|
|||
) throws HugeResultSet, NoURLFound {
|
||||
this.authorizationService.authorizeForce(Permission.AuthenticatedRole);
|
||||
|
||||
Boolean isValid = this.validationService.validateIdentifier(query, type);
|
||||
Boolean isValid = this.externalValidationService.validateIdentifier(query, type);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Boolean>().payload(isValid).status(ApiMessageCode.NO_MESSAGE));
|
||||
}
|
||||
}
|
|
@ -367,7 +367,7 @@ public class DataManagementPlanManager {
|
|||
throw new UnauthorisedException();
|
||||
} else
|
||||
if (!isPublic && dataManagementPlanEntity.getUsers()
|
||||
.stream().noneMatch(userInfo -> userInfo.getUser().getId() == this.userScope.getUserIdSafe())) {
|
||||
.stream().noneMatch(userInfo -> userInfo.getUser().getId().equals(this.userScope.getUserIdSafe()))) {
|
||||
throw new UnauthorisedException();
|
||||
} else if (isPublic && !dataManagementPlanEntity.isPublic()) {
|
||||
throw new ForbiddenException("Selected DMP is not public");
|
||||
|
@ -1321,7 +1321,7 @@ public class DataManagementPlanManager {
|
|||
XWPFDocument document = configLoader.getDocument();
|
||||
|
||||
DMP dmpEntity = databaseRepository.getDmpDao().find(UUID.fromString(id));
|
||||
if (!dmpEntity.isPublic() && dmpEntity.getUsers().stream().filter(userInfo -> userInfo.getUser().getId() == this.userScope.getUserIdSafe()).collect(Collectors.toList()).size() == 0)
|
||||
if (!dmpEntity.isPublic() && dmpEntity.getUsers().stream().filter(userInfo -> userInfo.getUser().getId().equals(this.userScope.getUserIdSafe())).collect(Collectors.toList()).size() == 0)
|
||||
throw new UnauthorisedException();
|
||||
|
||||
wordBuilder.fillFirstPage(dmpEntity, null, document, false);
|
||||
|
|
|
@ -73,7 +73,7 @@ public class RemoteFetcher {
|
|||
case Grants: return configLoader.getExternalUrls().getGrants();
|
||||
case Organizations: return configLoader.getExternalUrls().getOrganisations();
|
||||
case Datasets: return configLoader.getExternalUrls().getDatasets();
|
||||
case Founder: return configLoader.getExternalUrls().getFunders();
|
||||
case Funder: return configLoader.getExternalUrls().getFunders();
|
||||
case Project: return configLoader.getExternalUrls().getProjects();
|
||||
case Researcher: return configLoader.getExternalUrls().getResearchers();
|
||||
case Validators: return configLoader.getExternalUrls().getValidations();
|
||||
|
|
|
@ -9,13 +9,13 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ValidationService {
|
||||
public class ExternalValidationService {
|
||||
|
||||
private RemoteFetcher remoteFetcher;
|
||||
private final UserScope userScope;
|
||||
|
||||
@Autowired
|
||||
public ValidationService(RemoteFetcher remoteFetcher, UserScope userScope) {
|
||||
public ExternalValidationService(RemoteFetcher remoteFetcher, UserScope userScope) {
|
||||
super();
|
||||
this.remoteFetcher = remoteFetcher;
|
||||
this.userScope = userScope;
|
|
@ -25,7 +25,7 @@ import java.util.Map;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@org.springframework.stereotype.Service
|
||||
public class ExternalReferencesService {//implements ExternalReferencesService{
|
||||
public class ExternalReferencesService {
|
||||
|
||||
private final ApiContext apiContext;
|
||||
private final UserScope userScope;
|
||||
|
|
|
@ -217,7 +217,11 @@ public class DataManagementPlanOverviewModel implements DataModel<DMP, DataManag
|
|||
}
|
||||
this.isPublic = entity.isPublic();
|
||||
this.publishedAt = entity.getPublishedAt();
|
||||
this.dois = entity.getDois().stream().map(item -> new Doi().fromDataModel(item)).collect(Collectors.toList());
|
||||
if (entity.getDois() != null) {
|
||||
this.dois = entity.getDois().stream().map(item -> new Doi().fromDataModel(item)).collect(Collectors.toList());
|
||||
} else {
|
||||
this.dois = new ArrayList<>();
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
export enum ExternalReferencesType {
|
||||
Taxonomies = 0,
|
||||
Licenses = 1,
|
||||
Publications = 2,
|
||||
Journals = 3,
|
||||
PubRepositories = 4,
|
||||
DataRepositories = 5,
|
||||
Registries = 6,
|
||||
Services = 7,
|
||||
Project = 8,
|
||||
Funder = 9,
|
||||
Datasets = 10,
|
||||
Organizations = 11,
|
||||
Grants = 12,
|
||||
Validators = 13,
|
||||
Researcher = 14,
|
||||
Prefillings = 15
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
export interface ExternalReference {
|
||||
id: string;
|
||||
name: string;
|
||||
abbreviation: string;
|
||||
pid: string;
|
||||
originalId: string;
|
||||
key: string;
|
||||
pidTypeField: string;
|
||||
uri: string;
|
||||
description: string;
|
||||
source: string;
|
||||
count: string;
|
||||
path: string;
|
||||
host: string;
|
||||
types: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
tag: string;
|
||||
}
|
|
@ -14,7 +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 { ExternalReference } from '@app/core/model/external-reference/external-reference';
|
||||
import { ExternalReferencesType } from '@app/core/common/enum/external-references-type';
|
||||
@Injectable()
|
||||
export class ExternalSourcesService {
|
||||
|
||||
|
@ -58,6 +59,13 @@ 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<ExternalReference[]> {
|
||||
const url = this.configurationService.server + `external-references/${externalType}`;
|
||||
const options = { params: { query: query, type: type } };
|
||||
|
||||
return this.http.get<ExternalReference[]>(url, options);
|
||||
}
|
||||
|
||||
public searchDatasetTags(requestItem: RequestItem<TagCriteria>): Observable<ExternalSourceItemModel[]> {
|
||||
// return Observable.of([
|
||||
// { id: '1', name: 'Tag 1', description: '' },
|
||||
|
|
|
@ -48,6 +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 { ExternalReference } from '@app/core/model/external-reference/external-reference';
|
||||
import { ExternalReferencesType } from '@app/core/common/enum/external-references-type';
|
||||
|
||||
@Component({
|
||||
selector: 'app-form-field',
|
||||
|
@ -470,63 +472,63 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
|
|||
return this.externalSourcesService.searchDatasetSExternalDatasetservice(requestItem);
|
||||
}
|
||||
|
||||
searchDatasetExternalDataRepositories(query: string): Observable<ExternalSourceItemModel[]> {
|
||||
searchDatasetExternalDataRepositories(query: string): Observable<ExternalReference[]> {
|
||||
const requestItem: RequestItem<DataRepositoryCriteria> = new RequestItem();
|
||||
requestItem.criteria = new DataRepositoryCriteria();
|
||||
requestItem.criteria.like = query;
|
||||
requestItem.criteria.type = '';
|
||||
return this.externalSourcesService.searchDatasetRepository(requestItem);
|
||||
return this.externalSourcesService.listExternal(ExternalReferencesType.DataRepositories, requestItem.criteria.like, requestItem.criteria.type);
|
||||
}
|
||||
searchDatasetExternalPubRepositories(query: string): Observable<ExternalSourceItemModel[]> {
|
||||
searchDatasetExternalPubRepositories(query: string): Observable<ExternalReference[]> {
|
||||
const requestItem: RequestItem<DataRepositoryCriteria> = new RequestItem();
|
||||
requestItem.criteria = new DataRepositoryCriteria();
|
||||
requestItem.criteria.like = query;
|
||||
requestItem.criteria.type = '';
|
||||
return this.externalSourcesService.searchPublicationRepository(requestItem);
|
||||
return this.externalSourcesService.listExternal(ExternalReferencesType.PubRepositories, requestItem.criteria.like, requestItem.criteria.type);
|
||||
}
|
||||
searchDatasetExternalJournalRepositories(query: string): Observable<ExternalSourceItemModel[]> {
|
||||
searchDatasetExternalJournalRepositories(query: string): Observable<ExternalReference[]> {
|
||||
const requestItem: RequestItem<DataRepositoryCriteria> = new RequestItem();
|
||||
requestItem.criteria = new DataRepositoryCriteria();
|
||||
requestItem.criteria.like = query;
|
||||
requestItem.criteria.type = '';
|
||||
return this.externalSourcesService.searchJournals(requestItem);
|
||||
return this.externalSourcesService.listExternal(ExternalReferencesType.Journals, requestItem.criteria.like, requestItem.criteria.type);
|
||||
}
|
||||
searchDatasetExternalTaxonomies(query: string): Observable<ExternalSourceItemModel[]> {
|
||||
searchDatasetExternalTaxonomies(query: string): Observable<ExternalReference[]> {
|
||||
const requestItem: RequestItem<TaxonomyCriteria> = new RequestItem();
|
||||
requestItem.criteria = new TaxonomyCriteria();
|
||||
requestItem.criteria.like = query;
|
||||
requestItem.criteria.type = '';
|
||||
return this.externalSourcesService.searchTaxonomies(requestItem);
|
||||
return this.externalSourcesService.listExternal(ExternalReferencesType.Taxonomies, requestItem.criteria.like, requestItem.criteria.type);
|
||||
}
|
||||
searchDatasetExternalLicences(query: string): Observable<ExternalSourceItemModel[]> {
|
||||
searchDatasetExternalLicences(query: string): Observable<ExternalReference[]> {
|
||||
const requestItem: RequestItem<LicenseCriteria> = new RequestItem();
|
||||
requestItem.criteria = new LicenseCriteria();
|
||||
requestItem.criteria.like = query;
|
||||
requestItem.criteria.type = '';
|
||||
return this.externalSourcesService.searchLicense(requestItem);
|
||||
return this.externalSourcesService.listExternal(ExternalReferencesType.Licenses, requestItem.criteria.like, requestItem.criteria.type);
|
||||
}
|
||||
searchDatasetExternalPublications(query: string): Observable<ExternalSourceItemModel[]> {
|
||||
searchDatasetExternalPublications(query: string): Observable<ExternalReference[]> {
|
||||
const requestItem: RequestItem<PublicationCriteria> = new RequestItem();
|
||||
requestItem.criteria = new PublicationCriteria();
|
||||
requestItem.criteria.like = query;
|
||||
requestItem.criteria.type = '';
|
||||
return this.externalSourcesService.searchPublications(requestItem);
|
||||
return this.externalSourcesService.listExternal(ExternalReferencesType.Publications, requestItem.criteria.like, requestItem.criteria.type);
|
||||
}
|
||||
|
||||
searchDatasetExternalRegistries(query: string): Observable<ExternalSourceItemModel[]> {
|
||||
searchDatasetExternalRegistries(query: string): Observable<ExternalReference[]> {
|
||||
const requestItem: RequestItem<RegistryCriteria> = new RequestItem();
|
||||
requestItem.criteria = new RegistryCriteria();
|
||||
requestItem.criteria.like = query;
|
||||
requestItem.criteria.type = '';
|
||||
return this.externalSourcesService.searchDatasetRegistry(requestItem);
|
||||
return this.externalSourcesService.listExternal(ExternalReferencesType.Registries, requestItem.criteria.like, requestItem.criteria.type);
|
||||
}
|
||||
|
||||
searchDatasetExternalServices(query: string): Observable<ExternalSourceItemModel[]> {
|
||||
searchDatasetExternalServices(query: string): Observable<ExternalReference[]> {
|
||||
const requestItem: RequestItem<ServiceCriteria> = new RequestItem();
|
||||
requestItem.criteria = new ServiceCriteria();
|
||||
requestItem.criteria.like = query;
|
||||
requestItem.criteria.type = '';
|
||||
return this.externalSourcesService.searchDatasetService(requestItem);
|
||||
return this.externalSourcesService.listExternal(ExternalReferencesType.Services, requestItem.criteria.like, requestItem.criteria.type);
|
||||
}
|
||||
|
||||
searchDatasetTags(query: string): Observable<ExternalSourceItemModel[]> {
|
||||
|
|
Loading…
Reference in New Issue