commit
This commit is contained in:
parent
b8affa3033
commit
f67ada842e
|
@ -0,0 +1,11 @@
|
||||||
|
package eu.eudat.commons.enums;
|
||||||
|
|
||||||
|
public enum ExternalReferencesType {
|
||||||
|
|
||||||
|
taxonomies,
|
||||||
|
licenses,
|
||||||
|
publications,
|
||||||
|
journals,
|
||||||
|
pubRepositories,
|
||||||
|
dataRepositories
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package eu.eudat.commons.enums;
|
||||||
|
|
||||||
|
public enum SupportiveMaterialFieldType {
|
||||||
|
|
||||||
|
faq,
|
||||||
|
about,
|
||||||
|
glossary,
|
||||||
|
termsofservice,
|
||||||
|
userguide
|
||||||
|
}
|
|
@ -0,0 +1,124 @@
|
||||||
|
package eu.eudat.model;
|
||||||
|
|
||||||
|
import eu.eudat.data.entities.DataRepository;
|
||||||
|
import eu.eudat.data.entities.UserInfo;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class ExternalReference {
|
||||||
|
private UUID id;
|
||||||
|
private String name;
|
||||||
|
private String pid;
|
||||||
|
private String abbreviation;
|
||||||
|
private String uri;
|
||||||
|
private Date created;
|
||||||
|
private Date modified;
|
||||||
|
private String tag; // Api fetching the data
|
||||||
|
private String source; // Actual harvested source
|
||||||
|
|
||||||
|
public UUID getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setId(UUID id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPid() {
|
||||||
|
return pid;
|
||||||
|
}
|
||||||
|
public void setPid(String pid) {
|
||||||
|
this.pid = pid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAbbreviation() {
|
||||||
|
return abbreviation;
|
||||||
|
}
|
||||||
|
public void setAbbreviation(String abbreviation) {
|
||||||
|
this.abbreviation = abbreviation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUri() {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
public void setUri(String uri) {
|
||||||
|
this.uri = uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreated() {
|
||||||
|
return created;
|
||||||
|
}
|
||||||
|
public void setCreated(Date created) {
|
||||||
|
this.created = created;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getModified() {
|
||||||
|
return modified;
|
||||||
|
}
|
||||||
|
public void setModified(Date modified) {
|
||||||
|
this.modified = modified;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTag() {
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
public void setTag(String tag) {
|
||||||
|
this.tag = tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
public void setSource(String source) {
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ExternalReference fromDataModel(DataRepository entity) {
|
||||||
|
this.setAbbreviation(entity.getAbbreviation());
|
||||||
|
this.setName(entity.getLabel());
|
||||||
|
this.setUri(entity.getUri());
|
||||||
|
this.setId(entity.getId());
|
||||||
|
this.setPid(entity.getReference());
|
||||||
|
String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":"));
|
||||||
|
if (source1.equals("dmp")) {
|
||||||
|
this.source = "Internal";
|
||||||
|
} else {
|
||||||
|
this.source = source1;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataRepository toDataModel() throws Exception {
|
||||||
|
DataRepository dataRepository = new DataRepository();
|
||||||
|
dataRepository.setId(this.id != null ? this.id : UUID.randomUUID());
|
||||||
|
dataRepository.setAbbreviation(this.abbreviation);
|
||||||
|
dataRepository.setCreated(this.created != null ? this.created : new Date());
|
||||||
|
dataRepository.setModified(new Date());
|
||||||
|
dataRepository.setLabel(this.name);
|
||||||
|
if (this.source != null) {
|
||||||
|
if (this.source.equals("Internal") || this.source.equals(this.id.toString().substring(0, this.source.length()))) {
|
||||||
|
dataRepository.setReference(this.id.toString());
|
||||||
|
} else {
|
||||||
|
dataRepository.setReference(this.source + ":" + dataRepository.getId());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dataRepository.setReference("dmp:" + dataRepository.getId());
|
||||||
|
}
|
||||||
|
dataRepository.setUri(this.uri);
|
||||||
|
dataRepository.setStatus((short) 0);
|
||||||
|
dataRepository.setCreationUser(new UserInfo());
|
||||||
|
return dataRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHint() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,178 @@
|
||||||
|
package eu.eudat.model;
|
||||||
|
|
||||||
|
import eu.eudat.data.entities.Registry;
|
||||||
|
import eu.eudat.data.entities.Service;
|
||||||
|
import eu.eudat.data.entities.UserInfo;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class ExternalReference2 {
|
||||||
|
private UUID id;
|
||||||
|
private String label;
|
||||||
|
private String name;
|
||||||
|
private String pid;
|
||||||
|
private String abbreviation;
|
||||||
|
private String uri;
|
||||||
|
private Date created;
|
||||||
|
private Date modified;
|
||||||
|
private String reference;
|
||||||
|
private String tag;
|
||||||
|
private String source;
|
||||||
|
|
||||||
|
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 String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPid() {
|
||||||
|
return pid;
|
||||||
|
}
|
||||||
|
public void setPid(String pid) {
|
||||||
|
this.pid = pid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAbbreviation() {
|
||||||
|
return abbreviation;
|
||||||
|
}
|
||||||
|
public void setAbbreviation(String abbreviation) {
|
||||||
|
this.abbreviation = abbreviation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUri() {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
public void setUri(String uri) {
|
||||||
|
this.uri = uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreated() {
|
||||||
|
return created;
|
||||||
|
}
|
||||||
|
public void setCreated(Date created) {
|
||||||
|
this.created = created;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getModified() {
|
||||||
|
return modified;
|
||||||
|
}
|
||||||
|
public void setModified(Date modified) {
|
||||||
|
this.modified = modified;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReference() {
|
||||||
|
return reference;
|
||||||
|
}
|
||||||
|
public void setReference(String reference) {
|
||||||
|
this.reference = reference;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTag() {
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
public void setTag(String tag) {
|
||||||
|
this.tag = tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
public void setSource(String source) {
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExternalReference2 fromDataModel(Service entity) {
|
||||||
|
this.abbreviation = entity.getAbbreviation();
|
||||||
|
this.created = entity.getCreated();
|
||||||
|
this.id = entity.getId();
|
||||||
|
this.label = entity.getLabel();
|
||||||
|
this.name = entity.getLabel();
|
||||||
|
this.modified = entity.getModified();
|
||||||
|
this.uri = entity.getUri();
|
||||||
|
String source = entity.getReference().substring(0, entity.getReference().indexOf(":"));
|
||||||
|
if (source.equals("dmp")) {
|
||||||
|
this.source = "Internal";
|
||||||
|
} else {
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExternalReference2 fromDataModel(Registry entity) {
|
||||||
|
this.id = entity.getId();
|
||||||
|
this.abbreviation = entity.getAbbreviation();
|
||||||
|
this.created = entity.getCreated();
|
||||||
|
this.label = entity.getLabel();
|
||||||
|
this.name = entity.getLabel();
|
||||||
|
this.modified = entity.getModified();
|
||||||
|
this.uri = entity.getUri();
|
||||||
|
String source1 = entity.getReference().substring(0, entity.getReference().indexOf(":"));
|
||||||
|
if (source1.equals("dmp")) {
|
||||||
|
this.source = "Internal";
|
||||||
|
} else {
|
||||||
|
this.source = source1;
|
||||||
|
}
|
||||||
|
this.reference = entity.getReference();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Service toDataModelService() throws Exception {
|
||||||
|
Service service = new Service();
|
||||||
|
service.setId(this.id != null ? this.id : UUID.randomUUID());
|
||||||
|
service.setAbbreviation(this.abbreviation);
|
||||||
|
service.setCreated(this.created != null ? this.created : new Date());
|
||||||
|
service.setLabel(this.label != null ? this.label : this.name);
|
||||||
|
service.setModified(new Date());
|
||||||
|
service.setUri(this.uri);
|
||||||
|
if (this.source == null) this.source = "dmp";
|
||||||
|
if (this.reference == null) this.reference = service.getId().toString();
|
||||||
|
if (this.source.equals(this.reference.substring(0, this.source.length()))) {
|
||||||
|
service.setReference(this.reference);
|
||||||
|
} else {
|
||||||
|
service.setReference(this.source + ":" + this.reference);
|
||||||
|
}
|
||||||
|
service.setModified(new Date());
|
||||||
|
service.setStatus((short) 0);
|
||||||
|
service.setCreationUser(new UserInfo());
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Registry toDataModelRegistry() throws Exception {
|
||||||
|
Registry registry = new Registry();
|
||||||
|
registry.setAbbreviation(this.abbreviation);
|
||||||
|
registry.setCreated(this.created != null ? this.created : new Date());
|
||||||
|
registry.setId(this.id != null ? this.id : UUID.randomUUID());
|
||||||
|
registry.setLabel(this.label != null ? this.label : this.name);
|
||||||
|
registry.setUri(this.uri);
|
||||||
|
registry.setModified(new Date());
|
||||||
|
if (this.source == null) this.source = "dmp";
|
||||||
|
if (this.source.equals(registry.getId().toString().substring(0, this.source.length()))) {
|
||||||
|
registry.setReference(registry.getId().toString());
|
||||||
|
} else {
|
||||||
|
registry.setReference(this.source + ":" + registry.getId());
|
||||||
|
}
|
||||||
|
registry.setStatus((short)0);
|
||||||
|
registry.setCreationUser(new UserInfo());
|
||||||
|
return registry;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHint() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package eu.eudat.model.persist;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
public class UserGuidePersist {
|
||||||
|
|
||||||
|
@NotNull(message = "{validation.empty}")
|
||||||
|
@NotEmpty(message = "{validation.empty}")
|
||||||
|
private String name;
|
||||||
|
@NotNull(message = "{validation.empty}")
|
||||||
|
@NotEmpty(message = "{validation.empty}")
|
||||||
|
private String html;
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHtml() {
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHtml(String html) {
|
||||||
|
this.html = html;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package eu.eudat.service;
|
||||||
|
|
||||||
|
import eu.eudat.logic.proxy.config.ExternalUrlCriteria;
|
||||||
|
import eu.eudat.logic.proxy.config.exceptions.HugeResultSet;
|
||||||
|
import eu.eudat.logic.proxy.config.exceptions.NoURLFound;
|
||||||
|
import eu.eudat.logic.proxy.fetching.RemoteFetcher;
|
||||||
|
import eu.eudat.models.data.security.Principal;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ValidationService {
|
||||||
|
|
||||||
|
private RemoteFetcher remoteFetcher;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ValidationService(RemoteFetcher remoteFetcher) {
|
||||||
|
super();
|
||||||
|
this.remoteFetcher = remoteFetcher;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean validateIdentifier(String identifier, String type, Principal principal) throws NoURLFound, HugeResultSet {
|
||||||
|
ExternalUrlCriteria externalUrlCriteria = new ExternalUrlCriteria(identifier);
|
||||||
|
Integer count = this.remoteFetcher.findEntries(externalUrlCriteria, type);
|
||||||
|
return principal != null && count > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package eu.eudat.service.externalreferences;
|
||||||
|
|
||||||
|
import gr.cite.tools.cache.CacheOptions;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties(prefix = "cache.external-reference")
|
||||||
|
public class ExternalReferencesCacheOptions extends CacheOptions {
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
package eu.eudat.service.externalreferences;
|
||||||
|
|
||||||
|
import eu.eudat.proxy.config.ExternalUrlCriteria;
|
||||||
|
import gr.cite.tools.cache.CacheService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ExternalReferencesCacheService extends CacheService<ExternalReferencesCacheService.ExternalReferencesCacheValue> {
|
||||||
|
|
||||||
|
public static class ExternalReferencesCacheValue {
|
||||||
|
|
||||||
|
public ExternalReferencesCacheValue() {}
|
||||||
|
|
||||||
|
public ExternalReferencesCacheValue(String externalType, ExternalUrlCriteria externalUrlCriteria) {
|
||||||
|
this.externalType = externalType;
|
||||||
|
this.externalUrlCriteria = externalUrlCriteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String externalType;
|
||||||
|
|
||||||
|
private ExternalUrlCriteria externalUrlCriteria;
|
||||||
|
|
||||||
|
public String getExternalType() {
|
||||||
|
return externalType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExternalType(String externalType) {
|
||||||
|
this.externalType = externalType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExternalUrlCriteria getExternalUrlCriteria() {
|
||||||
|
return externalUrlCriteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExternalUrlCriteria(ExternalUrlCriteria externalUrlCriteria) {
|
||||||
|
this.externalUrlCriteria = externalUrlCriteria;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ExternalReferencesCacheService(ExternalReferencesCacheOptions options) {
|
||||||
|
super(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<ExternalReferencesCacheService.ExternalReferencesCacheValue> valueClass() {return ExternalReferencesCacheService.ExternalReferencesCacheValue.class;}
|
||||||
|
|
||||||
|
public String keyOf(ExternalReferencesCacheService.ExternalReferencesCacheValue value) {
|
||||||
|
return this.buildKey(value.getExternalType(), value.getExternalUrlCriteria());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String buildKey(String externalType, ExternalUrlCriteria externalUrlCriteria) {
|
||||||
|
HashMap<String, String> keyParts = new HashMap<>();
|
||||||
|
|
||||||
|
keyParts.put("$type$", externalType.toLowerCase(Locale.ROOT));
|
||||||
|
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
stringBuffer.append(externalUrlCriteria);
|
||||||
|
keyParts.put("$criteria$", stringBuffer.toString().toLowerCase(Locale.ROOT));
|
||||||
|
|
||||||
|
return this.generateKey(keyParts);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package eu.eudat.service.externalreferences;
|
||||||
|
|
||||||
|
import eu.eudat.data.entities.DataRepository;
|
||||||
|
import eu.eudat.logic.proxy.config.exceptions.HugeResultSet;
|
||||||
|
import eu.eudat.logic.proxy.config.exceptions.NoURLFound;
|
||||||
|
import eu.eudat.model.ExternalReference2;
|
||||||
|
|
||||||
|
import eu.eudat.model.ExternalReference;
|
||||||
|
import eu.eudat.models.data.security.Principal;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public interface ExternalReferencesService {
|
||||||
|
|
||||||
|
DataRepository create(ExternalReference externalReference, Principal principal) throws Exception;
|
||||||
|
|
||||||
|
List<ExternalReference> getExternal(String externalType, String query, String type, Principal principal) throws HugeResultSet, NoURLFound;
|
||||||
|
|
||||||
|
List<ExternalReference2> getExternal2(String externalType, String query, String type, Principal principal) throws HugeResultSet,NoURLFound;
|
||||||
|
}
|
|
@ -0,0 +1,97 @@
|
||||||
|
package eu.eudat.service.externalreferences;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import eu.eudat.data.dao.criteria.DataRepositoryCriteria;
|
||||||
|
import eu.eudat.data.dao.criteria.RegistryCriteria;
|
||||||
|
import eu.eudat.data.dao.criteria.ServiceCriteria;
|
||||||
|
import eu.eudat.data.entities.DataRepository;
|
||||||
|
import eu.eudat.data.entities.Registry;
|
||||||
|
import eu.eudat.data.entities.Service;
|
||||||
|
import eu.eudat.logic.proxy.config.ExternalUrlCriteria;
|
||||||
|
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.model.ExternalReference2;
|
||||||
|
import eu.eudat.model.ExternalReference;
|
||||||
|
import eu.eudat.models.data.security.Principal;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class ExternalReferencesServiceImpl implements ExternalReferencesService{
|
||||||
|
|
||||||
|
private final ApiContext apiContext;
|
||||||
|
|
||||||
|
public ExternalReferencesServiceImpl(ApiContext apiContext) {
|
||||||
|
this.apiContext = apiContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataRepository create(ExternalReference externalReference, Principal principal) throws Exception {
|
||||||
|
// only dataRepositories, pubRepositories, journals
|
||||||
|
DataRepository dataRepository = externalReference.toDataModel();
|
||||||
|
dataRepository.getCreationUser().setId(principal.getId());
|
||||||
|
return apiContext.getOperationsContext().getDatabaseRepository().getDataRepositoryDao().createOrUpdate(dataRepository);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ExternalReference> getExternal(String externalType, String query, String type, Principal principal) throws HugeResultSet, NoURLFound {
|
||||||
|
ExternalUrlCriteria externalUrlCriteria = new ExternalUrlCriteria(query);
|
||||||
|
List<Map<String, String>> remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().get(externalType, externalUrlCriteria, type);
|
||||||
|
|
||||||
|
DataRepositoryCriteria criteria = new DataRepositoryCriteria();
|
||||||
|
if (!query.isEmpty()) criteria.setLike(query);
|
||||||
|
|
||||||
|
List<ExternalReference> list = new LinkedList<>();
|
||||||
|
if((externalType.equals("dataRepositories") || externalType.equals("pubRepositories") || externalType.equals("journals"))){
|
||||||
|
criteria.setCreationUserId(principal.getId());
|
||||||
|
if (type.equals("")) {
|
||||||
|
List<DataRepository> dataRepositoryList = (this.apiContext.getOperationsContext().getDatabaseRepository().getDataRepositoryDao().getWithCriteria(criteria)).toList();
|
||||||
|
list = dataRepositoryList.stream().map(item -> new ExternalReference().fromDataModel(item)).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
|
list.addAll(remoteRepos.stream().map(item -> mapper.convertValue(item, ExternalReference.class)).collect(Collectors.toList()));
|
||||||
|
list = list.stream().filter(licenseModel -> licenseModel.getName().toLowerCase().contains(query.toLowerCase())).collect(Collectors.toList());
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ExternalReference2> getExternal2(String externalType, String query, String type, Principal principal) throws HugeResultSet,NoURLFound {
|
||||||
|
ExternalUrlCriteria externalUrlCriteria = new ExternalUrlCriteria(query);
|
||||||
|
List<Map<String, String>> remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().get(externalType,externalUrlCriteria, type);
|
||||||
|
|
||||||
|
List<ExternalReference2> list = new LinkedList<>();
|
||||||
|
|
||||||
|
if (externalType.equals("registries")){
|
||||||
|
RegistryCriteria criteria = new RegistryCriteria();
|
||||||
|
|
||||||
|
if (!query.isEmpty()) criteria.setLike(query);
|
||||||
|
criteria.setCreationUserId(principal.getId());
|
||||||
|
|
||||||
|
if (type.equals("")) {
|
||||||
|
List<Registry> registryList = (this.apiContext.getOperationsContext().getDatabaseRepository().getRegistryDao().getWithCriteria(criteria)).toList();
|
||||||
|
list = registryList.stream().map(item -> new ExternalReference2().fromDataModel(item)).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
} else if (externalType.equals("services")) {
|
||||||
|
ServiceCriteria criteria = new ServiceCriteria();
|
||||||
|
|
||||||
|
if (!query.isEmpty()) criteria.setLike(query);
|
||||||
|
criteria.setCreationUserId(principal.getId());
|
||||||
|
|
||||||
|
if (type.equals("")) {
|
||||||
|
List<Service> serviceList = (this.apiContext.getOperationsContext().getDatabaseRepository().getServiceDao().getWithCriteria(criteria)).toList();
|
||||||
|
list = serviceList.stream().map(item -> new ExternalReference2().fromDataModel(item)).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
|
list.addAll(remoteRepos.stream().map(item -> mapper.convertValue(item, ExternalReference2.class)).collect(Collectors.toList()));
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package eu.eudat.service.externalreferences;
|
||||||
|
|
||||||
|
import eu.eudat.data.query.items.item.funder.FunderCriteriaRequest;
|
||||||
|
import eu.eudat.logic.builders.model.models.FunderBuilder;
|
||||||
|
import eu.eudat.proxy.config.ExternalUrlCriteria;
|
||||||
|
import eu.eudat.proxy.config.exceptions.HugeResultSet;
|
||||||
|
import eu.eudat.proxy.config.exceptions.NoURLFound;
|
||||||
|
import eu.eudat.proxy.fetching.RemoteFetcher;
|
||||||
|
import eu.eudat.logic.utilities.helpers.ListHelper;
|
||||||
|
import eu.eudat.models.data.external.ExternalSourcesItemModel;
|
||||||
|
import eu.eudat.models.data.external.FundersExternalSourcesModel;
|
||||||
|
import eu.eudat.models.data.funder.Funder;
|
||||||
|
import eu.eudat.models.data.security.Principal;
|
||||||
|
import eu.eudat.queryable.QueryableList;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class FunderService {
|
||||||
|
|
||||||
|
private ApiContext apiContext;
|
||||||
|
private RemoteFetcher remoteFetcher;
|
||||||
|
private ListHelper listHelper;
|
||||||
|
|
||||||
|
public FunderService(ApiContext apiContext, RemoteFetcher remoteFetcher, ListHelper listHelper) {
|
||||||
|
this.apiContext = apiContext;
|
||||||
|
this.remoteFetcher = remoteFetcher;
|
||||||
|
this.listHelper = listHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Funder> getCriteriaWithExternal(FunderCriteriaRequest funderCriteria, Principal principal) throws HugeResultSet, NoURLFound {
|
||||||
|
eu.eudat.data.entities.UserInfo userInfo = new eu.eudat.data.entities.UserInfo();
|
||||||
|
userInfo.setId(principal.getId());
|
||||||
|
funderCriteria.getCriteria().setReference("dmp:");
|
||||||
|
QueryableList<eu.eudat.data.entities.Funder> items = apiContext.getOperationsContext().getDatabaseRepository().getFunderDao().getWithCritetia(funderCriteria.getCriteria());
|
||||||
|
QueryableList<eu.eudat.data.entities.Funder> authItems = apiContext.getOperationsContext().getDatabaseRepository().getFunderDao().getAuthenticated(items, userInfo);
|
||||||
|
List<Funder> funders = authItems.select(item -> new Funder().fromDataModel(item));
|
||||||
|
ExternalUrlCriteria externalUrlCriteria = new ExternalUrlCriteria(funderCriteria.getCriteria().getLike());
|
||||||
|
List<Map<String, String>> remoteRepos = remoteFetcher.getFunders(externalUrlCriteria);
|
||||||
|
FundersExternalSourcesModel fundersExternalSourcesModel = new FundersExternalSourcesModel().fromExternalItem(remoteRepos);
|
||||||
|
for (ExternalSourcesItemModel externalListingItem : fundersExternalSourcesModel) {
|
||||||
|
Funder funder = apiContext.getOperationsContext().getBuilderFactory().getBuilder(FunderBuilder.class)
|
||||||
|
.reference(externalListingItem.getRemoteId()).label(externalListingItem.getName())
|
||||||
|
.status(eu.eudat.data.entities.Funder.Status.fromInteger(0))
|
||||||
|
.key(externalListingItem.getKey())
|
||||||
|
.source(externalListingItem.getTag())
|
||||||
|
.build();
|
||||||
|
if (externalListingItem.getSource() != null) {
|
||||||
|
funder.setSource(externalListingItem.getSource());
|
||||||
|
} else {
|
||||||
|
funder.setSource(externalListingItem.getTag());
|
||||||
|
}
|
||||||
|
|
||||||
|
funders.add(funder);
|
||||||
|
}
|
||||||
|
funders.sort(Comparator.comparing(Funder::getLabel));
|
||||||
|
funders = funders.stream().filter(listHelper.distinctByKey(Funder::getLabel)).collect(Collectors.toList());
|
||||||
|
return funders;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package eu.eudat.service.externalreferences;
|
||||||
|
|
||||||
|
import eu.eudat.data.query.items.item.project.ProjectCriteriaRequest;
|
||||||
|
import eu.eudat.logic.builders.model.models.ProjectBuilder;
|
||||||
|
import eu.eudat.proxy.config.ExternalUrlCriteria;
|
||||||
|
import eu.eudat.proxy.config.exceptions.HugeResultSet;
|
||||||
|
import eu.eudat.proxy.config.exceptions.NoURLFound;
|
||||||
|
import eu.eudat.proxy.fetching.RemoteFetcher;
|
||||||
|
import eu.eudat.logic.utilities.helpers.ListHelper;
|
||||||
|
import eu.eudat.models.data.external.ExternalSourcesItemModel;
|
||||||
|
import eu.eudat.models.data.external.ProjectsExternalSourcesModel;
|
||||||
|
import eu.eudat.models.data.project.Project;
|
||||||
|
import eu.eudat.models.data.security.Principal;
|
||||||
|
import eu.eudat.queryable.QueryableList;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ProjectService {
|
||||||
|
|
||||||
|
private ApiContext apiContext;
|
||||||
|
private RemoteFetcher remoteFetcher;
|
||||||
|
private ListHelper listHelper;
|
||||||
|
|
||||||
|
public ProjectService(ApiContext apiContext, ListHelper listHelper) {
|
||||||
|
this.apiContext = apiContext;
|
||||||
|
this.remoteFetcher = apiContext.getOperationsContext().getRemoteFetcher();
|
||||||
|
this.listHelper = listHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Project> getCriteriaWithExternal(ProjectCriteriaRequest projectCriteria, Principal principal) throws HugeResultSet, NoURLFound {
|
||||||
|
eu.eudat.data.entities.UserInfo userInfo = new eu.eudat.data.entities.UserInfo();
|
||||||
|
userInfo.setId(principal.getId());
|
||||||
|
projectCriteria.getCriteria().setReference("dmp:");
|
||||||
|
QueryableList<eu.eudat.data.entities.Project> items = apiContext.getOperationsContext().getDatabaseRepository().getProjectDao().getWithCritetia(projectCriteria.getCriteria());
|
||||||
|
QueryableList<eu.eudat.data.entities.Project> authItems = apiContext.getOperationsContext().getDatabaseRepository().getProjectDao().getAuthenticated(items, userInfo);
|
||||||
|
List<Project> projects = authItems.select(item -> new Project().fromDataModel(item));
|
||||||
|
ExternalUrlCriteria externalUrlCriteria = new ExternalUrlCriteria(projectCriteria.getCriteria().getLike());
|
||||||
|
List<Map<String, String>> remoteRepos = remoteFetcher.getProjects(externalUrlCriteria);
|
||||||
|
ProjectsExternalSourcesModel projectsExternalSourcesModel = new ProjectsExternalSourcesModel().fromExternalItem(remoteRepos);
|
||||||
|
for (ExternalSourcesItemModel externalListingItem : projectsExternalSourcesModel) {
|
||||||
|
Project project = apiContext.getOperationsContext().getBuilderFactory().getBuilder(ProjectBuilder.class)
|
||||||
|
.reference(externalListingItem.getRemoteId()).label(externalListingItem.getName())
|
||||||
|
.description(externalListingItem.getDescription()).uri(externalListingItem.getUri())
|
||||||
|
.abbreviation(externalListingItem.getAbbreviation()).status(eu.eudat.data.entities.Project.Status.fromInteger(0))
|
||||||
|
.key(externalListingItem.getKey())
|
||||||
|
.source(externalListingItem.getTag())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
projects.add(project);
|
||||||
|
}
|
||||||
|
projects.sort(Comparator.comparing(Project::getLabel));
|
||||||
|
projects = projects.stream().filter(listHelper.distinctByKey(Project::getLabel)).collect(Collectors.toList());
|
||||||
|
return projects;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package eu.eudat.service.supportivematerial;
|
||||||
|
|
||||||
|
|
||||||
|
import gr.cite.tools.cache.CacheOptions;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties(prefix = "cache.supportive-material")
|
||||||
|
public class SupportiveMaterialCacheOptions extends CacheOptions {
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
package eu.eudat.service.supportivematerial;
|
||||||
|
|
||||||
|
|
||||||
|
import gr.cite.tools.cache.CacheService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class SupportiveMaterialCacheService extends CacheService<SupportiveMaterialCacheService.SupportiveMaterialCacheValue> {
|
||||||
|
|
||||||
|
public static class SupportiveMaterialCacheValue {
|
||||||
|
|
||||||
|
public SupportiveMaterialCacheValue() {}
|
||||||
|
|
||||||
|
public SupportiveMaterialCacheValue(String name, byte[] content) {
|
||||||
|
this.name = name;
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private byte[] content;
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(byte[] content) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public SupportiveMaterialCacheService(SupportiveMaterialCacheOptions options) {
|
||||||
|
super(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<SupportiveMaterialCacheValue> valueClass() {return SupportiveMaterialCacheValue.class;}
|
||||||
|
|
||||||
|
|
||||||
|
public String keyOf(SupportiveMaterialCacheValue value) {
|
||||||
|
return this.buildKey(value.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String buildKey(String name) {
|
||||||
|
HashMap<String, String> keyParts = new HashMap<>();
|
||||||
|
|
||||||
|
keyParts.put("$material$", name.toLowerCase(Locale.ROOT));
|
||||||
|
//keyParts.put("$material_content$", new String(content, StandardCharsets.UTF_8).toLowerCase(Locale.ROOT));
|
||||||
|
|
||||||
|
return this.generateKey(keyParts);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
package eu.eudat.service.supportivematerial;
|
||||||
|
|
||||||
|
import eu.eudat.model.persist.UserGuidePersist;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class SupportiveMaterialService {
|
||||||
|
|
||||||
|
private final SupportiveMaterialCacheService supportiveMaterialCacheService;
|
||||||
|
|
||||||
|
public SupportiveMaterialService(
|
||||||
|
SupportiveMaterialCacheService supportiveMaterialCacheService
|
||||||
|
) {
|
||||||
|
this.supportiveMaterialCacheService = supportiveMaterialCacheService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponseEntity<byte[]> getResponseEntity(String lang, Stream<Path> paths) throws IOException {
|
||||||
|
List<String> result = paths.filter(Files::isRegularFile)
|
||||||
|
.map(Path::toString).collect(Collectors.toList());
|
||||||
|
|
||||||
|
String fileName = result.stream().filter(about -> about.contains("_" + lang)).findFirst().orElse(null);
|
||||||
|
|
||||||
|
if (fileName == null) {
|
||||||
|
fileName = result.stream().filter(about -> about.contains("_en")).findFirst().get();
|
||||||
|
}
|
||||||
|
|
||||||
|
SupportiveMaterialCacheService.SupportiveMaterialCacheValue supportiveMaterialCacheItem = this.supportiveMaterialCacheService.lookup(this.supportiveMaterialCacheService.buildKey(fileName));
|
||||||
|
|
||||||
|
if(supportiveMaterialCacheItem == null){
|
||||||
|
InputStream is = new FileInputStream(fileName);
|
||||||
|
|
||||||
|
// Path path = Paths.get(fileName);
|
||||||
|
|
||||||
|
byte[] content = new byte[is.available()];
|
||||||
|
is.read(content);
|
||||||
|
is.close();
|
||||||
|
|
||||||
|
supportiveMaterialCacheItem = new SupportiveMaterialCacheService.SupportiveMaterialCacheValue(fileName, content);
|
||||||
|
this.supportiveMaterialCacheService.put(supportiveMaterialCacheItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpHeaders responseHeaders = new HttpHeaders();
|
||||||
|
responseHeaders.setContentLength(supportiveMaterialCacheItem.getContent().length);
|
||||||
|
responseHeaders.setContentType(MediaType.TEXT_HTML);
|
||||||
|
responseHeaders.set("Content-Disposition", "attachment;filename=" + fileName);
|
||||||
|
responseHeaders.set("Access-Control-Expose-Headers", "Content-Disposition");
|
||||||
|
responseHeaders.get("Access-Control-Expose-Headers").add("Content-Type");
|
||||||
|
|
||||||
|
return new ResponseEntity<>(supportiveMaterialCacheItem.getContent(), responseHeaders, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void persist(UserGuidePersist userGuidePersist, String fileName) throws IOException {
|
||||||
|
this.supportiveMaterialCacheService.evict(fileName);
|
||||||
|
OutputStream os = new FileOutputStream(fileName);
|
||||||
|
os.write(userGuidePersist.getHtml().getBytes());
|
||||||
|
os.close();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,39 +0,0 @@
|
||||||
package eu.eudat.controllers;
|
|
||||||
|
|
||||||
import eu.eudat.logic.managers.MaterialManager;
|
|
||||||
import eu.eudat.logic.managers.MetricsManager;
|
|
||||||
import eu.eudat.types.MetricNames;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.core.env.Environment;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@CrossOrigin
|
|
||||||
@RequestMapping(value = {"/api/material/about/"})
|
|
||||||
public class AboutController {
|
|
||||||
|
|
||||||
private Environment environment;
|
|
||||||
private MaterialManager materialManager;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public AboutController(Environment environment, MaterialManager materialManager, MetricsManager metricsManager) {
|
|
||||||
this.environment = environment;
|
|
||||||
this.materialManager = materialManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(path = "{lang}", method = RequestMethod.GET )
|
|
||||||
public ResponseEntity<byte[]> getAbout(@PathVariable(name = "lang") String lang) throws IOException {
|
|
||||||
try (Stream<Path> paths = Files.walk(Paths.get(Objects.requireNonNull(this.environment.getProperty("about.path"))))) {
|
|
||||||
return this.materialManager.getResponseEntity(lang, paths);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
package eu.eudat.controllers;
|
|
||||||
|
|
||||||
import eu.eudat.logic.managers.MaterialManager;
|
|
||||||
import eu.eudat.logic.managers.MetricsManager;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.core.env.Environment;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@CrossOrigin
|
|
||||||
@RequestMapping(value = {"/api/material/faq/"})
|
|
||||||
public class FaqController {
|
|
||||||
|
|
||||||
private Environment environment;
|
|
||||||
private MaterialManager materialManager;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public FaqController(Environment environment, MaterialManager materialManager, MetricsManager metricsManager) {
|
|
||||||
this.environment = environment;
|
|
||||||
this.materialManager = materialManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(path = "{lang}", method = RequestMethod.GET )
|
|
||||||
public ResponseEntity<byte[]> getFaq(@PathVariable(name = "lang") String lang) throws IOException {
|
|
||||||
try (Stream<Path> paths = Files.walk(Paths.get(Objects.requireNonNull(this.environment.getProperty("faq.path"))))) {
|
|
||||||
return this.materialManager.getResponseEntity(lang, paths);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
package eu.eudat.controllers;
|
|
||||||
|
|
||||||
import eu.eudat.logic.managers.MaterialManager;
|
|
||||||
import eu.eudat.logic.managers.MetricsManager;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.core.env.Environment;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@CrossOrigin
|
|
||||||
@RequestMapping(value = {"/api/material/glossary/"})
|
|
||||||
public class GlossaryController {
|
|
||||||
|
|
||||||
private Environment environment;
|
|
||||||
private MaterialManager materialManager;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public GlossaryController(Environment environment, MaterialManager materialManager, MetricsManager metricsManager) {
|
|
||||||
this.environment = environment;
|
|
||||||
this.materialManager = materialManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(path = "{lang}", method = RequestMethod.GET )
|
|
||||||
public ResponseEntity<byte[]> getGlossary(@PathVariable(name = "lang") String lang) throws IOException {
|
|
||||||
try (Stream<Path> paths = Files.walk(Paths.get(Objects.requireNonNull(this.environment.getProperty("glossary.path"))))) {
|
|
||||||
return this.materialManager.getResponseEntity(lang, paths);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
package eu.eudat.controllers;
|
|
||||||
|
|
||||||
import eu.eudat.logic.managers.MaterialManager;
|
|
||||||
import eu.eudat.logic.managers.MetricsManager;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.core.env.Environment;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@CrossOrigin
|
|
||||||
@RequestMapping(value = {"/api/material/termsofservice/"})
|
|
||||||
public class TermsOfServiceController {
|
|
||||||
|
|
||||||
private Environment environment;
|
|
||||||
private MaterialManager materialManager;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public TermsOfServiceController(Environment environment, MaterialManager materialManager, MetricsManager metricsManager) {
|
|
||||||
this.environment = environment;
|
|
||||||
this.materialManager = materialManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(path = "{lang}", method = RequestMethod.GET )
|
|
||||||
public ResponseEntity<byte[]> getTermsOfService(@PathVariable(name = "lang") String lang) throws IOException {
|
|
||||||
try (Stream<Path> paths = Files.walk(Paths.get(Objects.requireNonNull(this.environment.getProperty("termsofservice.path"))))) {
|
|
||||||
return this.materialManager.getResponseEntity(lang, paths);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
package eu.eudat.controllers;
|
|
||||||
|
|
||||||
import eu.eudat.logic.managers.MaterialManager;
|
|
||||||
import eu.eudat.logic.managers.MetricsManager;
|
|
||||||
import eu.eudat.logic.security.claims.ClaimedAuthorities;
|
|
||||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
|
||||||
import eu.eudat.models.data.security.Principal;
|
|
||||||
import eu.eudat.models.data.userguide.UserGuide;
|
|
||||||
import eu.eudat.types.ApiMessageCode;
|
|
||||||
import eu.eudat.types.MetricNames;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.core.env.Environment;
|
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
import static eu.eudat.types.Authorities.ADMIN;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@CrossOrigin
|
|
||||||
@RequestMapping(value = {"/api/userguide/"})
|
|
||||||
public class UserGuideController {
|
|
||||||
|
|
||||||
private Environment environment;
|
|
||||||
private MaterialManager materialManager;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public UserGuideController(Environment environment, MaterialManager materialManager, MetricsManager metricsManager) {
|
|
||||||
this.environment = environment;
|
|
||||||
this.materialManager = materialManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(path = "{lang}", method = RequestMethod.GET )
|
|
||||||
public ResponseEntity<byte[]> getUserGuide(@PathVariable(name = "lang") String lang) throws IOException {
|
|
||||||
try (Stream<Path> paths = Files.walk(Paths.get(Objects.requireNonNull(this.environment.getProperty("userguide.path"))))) {
|
|
||||||
return this.materialManager.getResponseEntity(lang, paths);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(value = "current", method = RequestMethod.POST)
|
|
||||||
public @ResponseBody
|
|
||||||
ResponseEntity<ResponseItem<String>> updateGuide(@RequestBody UserGuide guide, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws Exception {
|
|
||||||
String fileName = this.environment.getProperty("userguide.path") + guide.getName();
|
|
||||||
OutputStream os = new FileOutputStream(fileName);
|
|
||||||
os.write(guide.getHtml().getBytes());
|
|
||||||
os.close();
|
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<String>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Updated").payload("Updated"));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
package eu.eudat.controllers.v2;
|
||||||
|
|
||||||
|
import eu.eudat.controllers.BaseController;
|
||||||
|
import eu.eudat.data.query.items.item.funder.FunderCriteriaRequest;
|
||||||
|
import eu.eudat.data.query.items.item.project.ProjectCriteriaRequest;
|
||||||
|
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.model.ExternalReference;
|
||||||
|
import eu.eudat.models.data.funder.Funder;
|
||||||
|
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||||
|
import eu.eudat.models.data.project.Project;
|
||||||
|
import eu.eudat.models.data.security.Principal;
|
||||||
|
import eu.eudat.service.externalreferences.*;
|
||||||
|
import eu.eudat.types.ApiMessageCode;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@CrossOrigin
|
||||||
|
@RequestMapping(path = {"/api/external-references"})
|
||||||
|
public class ExternalReferencesController extends BaseController {
|
||||||
|
|
||||||
|
private final FunderService funderService;
|
||||||
|
private final ExternalReferencesService externalReferencesService;
|
||||||
|
private final ProjectService projectService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ExternalReferencesController(
|
||||||
|
ApiContext apiContext,
|
||||||
|
FunderService funderService,
|
||||||
|
ExternalReferencesService externalReferencesService,
|
||||||
|
ProjectService projectService
|
||||||
|
) {
|
||||||
|
super(apiContext);
|
||||||
|
this.funderService = funderService;
|
||||||
|
this.externalReferencesService = externalReferencesService;
|
||||||
|
this.projectService = projectService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(path = {"funders"}, consumes = "application/json", produces = "application/json")
|
||||||
|
public @ResponseBody ResponseEntity<ResponseItem<List<Funder>>> getWithExternal(@RequestBody FunderCriteriaRequest funderCriteria, Principal principal) throws NoURLFound, InstantiationException, HugeResultSet, IllegalAccessException {
|
||||||
|
List<Funder> dataTable = this.funderService.getCriteriaWithExternal(funderCriteria, principal);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<Funder>>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(path = {"projects"}, consumes = "application/json", produces = "application/json")
|
||||||
|
public @ResponseBody
|
||||||
|
ResponseEntity<ResponseItem<List<Project>>> getWithExternal(@RequestBody ProjectCriteriaRequest projectCriteria, Principal principal) throws NoURLFound, InstantiationException, HugeResultSet, IllegalAccessException {
|
||||||
|
List<Project> dataTable = this.projectService.getCriteriaWithExternal(projectCriteria, principal);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<Project>>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(path = {"{externalType"}, produces = "application/json")
|
||||||
|
public @ResponseBody ResponseEntity<ResponseItem<List<ExternalReference>>> listExternalReferecnes(@RequestParam(value = "externalType") String externalType, @RequestParam(value = "query", required = false) String query,
|
||||||
|
@RequestParam(value = "type", required = false) String type, Principal principal
|
||||||
|
) throws HugeResultSet, NoURLFound {
|
||||||
|
List<ExternalReference> externalReferences = this.externalReferencesService.getExternal(externalType, query, type, principal);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<ExternalReference>>().status(ApiMessageCode.NO_MESSAGE).payload(externalReferences));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package eu.eudat.controllers.v2;
|
||||||
|
|
||||||
|
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.models.data.helpers.responses.ResponseItem;
|
||||||
|
import eu.eudat.models.data.security.Principal;
|
||||||
|
import eu.eudat.service.ValidationService;
|
||||||
|
import eu.eudat.types.ApiMessageCode;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@CrossOrigin
|
||||||
|
@RequestMapping(path = {"api/validation"})
|
||||||
|
public class ExternalValidationController extends BaseController {
|
||||||
|
|
||||||
|
private ValidationService validationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ExternalValidationController(ApiContext apiContext, ValidationService validationService) {
|
||||||
|
super(apiContext);
|
||||||
|
this.validationService = validationService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(path = {""}, produces = "application/json")
|
||||||
|
public @ResponseBody
|
||||||
|
ResponseEntity<ResponseItem<Boolean>> validate(
|
||||||
|
@RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type, Principal principal
|
||||||
|
) throws HugeResultSet, NoURLFound {
|
||||||
|
Boolean isValid = this.validationService.validateIdentifier(query, type, principal);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Boolean>().payload(isValid).status(ApiMessageCode.NO_MESSAGE));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
package eu.eudat.controllers.v2;
|
||||||
|
|
||||||
|
import eu.eudat.commons.enums.SupportiveMaterialFieldType;
|
||||||
|
import eu.eudat.logic.managers.MetricsManager;
|
||||||
|
import eu.eudat.logic.security.claims.ClaimedAuthorities;
|
||||||
|
import eu.eudat.model.persist.UserGuidePersist;
|
||||||
|
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||||
|
import eu.eudat.models.data.security.Principal;
|
||||||
|
import eu.eudat.service.supportivematerial.SupportiveMaterialService;
|
||||||
|
import eu.eudat.types.ApiMessageCode;
|
||||||
|
import org.apache.commons.lang3.EnumUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.core.env.Environment;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import static eu.eudat.types.Authorities.ADMIN;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@CrossOrigin
|
||||||
|
@RequestMapping(path = {"/api/material"})
|
||||||
|
public class SupportiveMaterialController {
|
||||||
|
|
||||||
|
private Environment environment;
|
||||||
|
private SupportiveMaterialService supportiveMaterialService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public SupportiveMaterialController(Environment environment, SupportiveMaterialService supportiveMaterialService, MetricsManager metricsManager) {
|
||||||
|
this.environment = environment;
|
||||||
|
this.supportiveMaterialService = supportiveMaterialService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("{lang}")
|
||||||
|
public ResponseEntity<byte[]> getMaterial(@PathVariable(name = "lang") String lang, String field) throws IOException {
|
||||||
|
if( !EnumUtils.isValidEnum(SupportiveMaterialFieldType.class, field)){
|
||||||
|
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
try (Stream<Path> paths = Files.walk(Paths.get(Objects.requireNonNull(this.environment.getProperty(field +".path"))))) {
|
||||||
|
return this.supportiveMaterialService.getResponseEntity(lang, paths);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// @PostMapping("userguide/current")
|
||||||
|
// public @ResponseBody
|
||||||
|
// ResponseEntity<ResponseItem<String>> updateGuide(@RequestBody UserGuidePersist guide, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws IOException {
|
||||||
|
// String fileName = this.environment.getProperty("userguide.path") + guide.getName();
|
||||||
|
// this.supportiveMaterialService.persist(guide, fileName);
|
||||||
|
// return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<String>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Updated").payload("Updated"));
|
||||||
|
// }
|
||||||
|
|
||||||
|
@PostMapping("current")
|
||||||
|
public @ResponseBody
|
||||||
|
ResponseEntity<ResponseItem<String>> persist(@RequestBody UserGuidePersist guide, String field, @ClaimedAuthorities(claims = {ADMIN}) Principal principal) throws IOException {
|
||||||
|
if( !EnumUtils.isValidEnum(SupportiveMaterialFieldType.class, field)){
|
||||||
|
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
String fileName = this.environment.getProperty(field+ ".path") + guide.getName();
|
||||||
|
this.supportiveMaterialService.persist(guide, fileName);
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<String>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Updated").payload("Updated"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package eu.eudat.logic.proxy.config.entitiesV2;
|
||||||
|
|
||||||
|
import eu.eudat.proxy.config.FetchStrategy;
|
||||||
|
import eu.eudat.proxy.config.UrlConfiguration;
|
||||||
|
import eu.eudat.proxy.config.entities.GenericUrls;
|
||||||
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
|
import jakarta.xml.bind.annotation.XmlElementWrapper;
|
||||||
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "repositories")
|
||||||
|
public class DataRepositoryUrls extends GenericUrls implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -5076364662014107275L;
|
||||||
|
|
||||||
|
List<UrlConfiguration> urls;
|
||||||
|
FetchStrategy fetchMode;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UrlConfiguration> getUrls() {
|
||||||
|
return urls;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElementWrapper
|
||||||
|
@XmlElement(name = "urlConfig")
|
||||||
|
public void setUrls(List<UrlConfiguration> urls) {
|
||||||
|
this.urls = urls;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FetchStrategy getFetchMode() {
|
||||||
|
return fetchMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "fetchMode")
|
||||||
|
public void setFetchMode(FetchStrategy fetchMode) {
|
||||||
|
this.fetchMode = fetchMode;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
package eu.eudat.logic.proxy.config.entitiesV2;
|
||||||
|
|
||||||
|
|
||||||
|
public class ExternalUrlsBase {
|
||||||
|
|
||||||
|
TaxonomyUrls taxonomyUrls;
|
||||||
|
|
||||||
|
DataRepositoryUrls dataRepositoryUrls;
|
||||||
|
|
||||||
|
JournalUrls journalUrls;
|
||||||
|
|
||||||
|
LicenseUrls licenseUrls;
|
||||||
|
|
||||||
|
PublicationUrls publicationUrls;
|
||||||
|
|
||||||
|
PubRepositoryUrls pubRepositoryUrls;
|
||||||
|
|
||||||
|
public TaxonomyUrls getTaxonomyUrls() {
|
||||||
|
return taxonomyUrls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaxonomyUrls(TaxonomyUrls taxonomyUrls) {
|
||||||
|
this.taxonomyUrls = taxonomyUrls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataRepositoryUrls getDataRepositoryUrls() {
|
||||||
|
return dataRepositoryUrls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataRepositoryUrls(DataRepositoryUrls dataRepositoryUrls) {
|
||||||
|
this.dataRepositoryUrls = dataRepositoryUrls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JournalUrls getJournalUrls() {
|
||||||
|
return journalUrls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJournalUrls(JournalUrls journalUrls) {
|
||||||
|
this.journalUrls = journalUrls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LicenseUrls getLicenseUrls() {
|
||||||
|
return licenseUrls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLicenseUrls(LicenseUrls licenseUrls) {
|
||||||
|
this.licenseUrls = licenseUrls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PublicationUrls getPublicationUrls() {
|
||||||
|
return publicationUrls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPublicationUrls(PublicationUrls publicationUrls) {
|
||||||
|
this.publicationUrls = publicationUrls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PubRepositoryUrls getPubRepositoryUrls() {
|
||||||
|
return pubRepositoryUrls;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPubRepositoryUrls(PubRepositoryUrls pubRepositoryUrls) {
|
||||||
|
this.pubRepositoryUrls = pubRepositoryUrls;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
package eu.eudat.logic.proxy.config.entitiesV2;
|
||||||
|
|
||||||
|
import eu.eudat.proxy.config.FetchStrategy;
|
||||||
|
import eu.eudat.proxy.config.UrlConfiguration;
|
||||||
|
import eu.eudat.proxy.config.entities.GenericUrls;
|
||||||
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
|
import jakarta.xml.bind.annotation.XmlElementWrapper;
|
||||||
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "journal")
|
||||||
|
public class JournalUrls extends GenericUrls implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -5076364662014107275L;
|
||||||
|
|
||||||
|
List<UrlConfiguration> urls;
|
||||||
|
FetchStrategy fetchMode;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UrlConfiguration> getUrls() {
|
||||||
|
return urls;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElementWrapper
|
||||||
|
@XmlElement(name = "urlConfig")
|
||||||
|
public void setUrls(List<UrlConfiguration> urls) {
|
||||||
|
this.urls = urls;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FetchStrategy getFetchMode() {
|
||||||
|
return fetchMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "fetchMode")
|
||||||
|
public void setFetchMode(FetchStrategy fetchMode) {
|
||||||
|
this.fetchMode = fetchMode;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package eu.eudat.logic.proxy.config.entitiesV2;
|
||||||
|
|
||||||
|
import eu.eudat.proxy.config.FetchStrategy;
|
||||||
|
import eu.eudat.proxy.config.UrlConfiguration;
|
||||||
|
import eu.eudat.proxy.config.entities.GenericUrls;
|
||||||
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
|
import jakarta.xml.bind.annotation.XmlElementWrapper;
|
||||||
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "licenses")
|
||||||
|
public class LicenseUrls extends GenericUrls implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -5076364662014107275L;
|
||||||
|
|
||||||
|
List<UrlConfiguration> urls;
|
||||||
|
FetchStrategy fetchMode;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UrlConfiguration> getUrls() {
|
||||||
|
return urls;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElementWrapper
|
||||||
|
@XmlElement(name = "urlConfig")
|
||||||
|
public void setUrls(List<UrlConfiguration> urls) {
|
||||||
|
this.urls = urls;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FetchStrategy getFetchMode() {
|
||||||
|
return fetchMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "fetchMode")
|
||||||
|
public void setFetchMode(FetchStrategy fetchMode) {
|
||||||
|
this.fetchMode = fetchMode;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package eu.eudat.logic.proxy.config.entitiesV2;
|
||||||
|
|
||||||
|
import eu.eudat.proxy.config.FetchStrategy;
|
||||||
|
import eu.eudat.proxy.config.UrlConfiguration;
|
||||||
|
import eu.eudat.proxy.config.entities.GenericUrls;
|
||||||
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
|
import jakarta.xml.bind.annotation.XmlElementWrapper;
|
||||||
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "pubRepositories")
|
||||||
|
public class PubRepositoryUrls extends GenericUrls implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -5076364662014107275L;
|
||||||
|
|
||||||
|
List<UrlConfiguration> urls;
|
||||||
|
FetchStrategy fetchMode;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UrlConfiguration> getUrls() {
|
||||||
|
return urls;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElementWrapper
|
||||||
|
@XmlElement(name = "urlConfig")
|
||||||
|
public void setUrls(List<UrlConfiguration> urls) {
|
||||||
|
this.urls = urls;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FetchStrategy getFetchMode() {
|
||||||
|
return fetchMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "fetchMode")
|
||||||
|
public void setFetchMode(FetchStrategy fetchMode) {
|
||||||
|
this.fetchMode = fetchMode;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package eu.eudat.logic.proxy.config.entitiesV2;
|
||||||
|
|
||||||
|
import eu.eudat.proxy.config.FetchStrategy;
|
||||||
|
import eu.eudat.proxy.config.UrlConfiguration;
|
||||||
|
import eu.eudat.proxy.config.entities.GenericUrls;
|
||||||
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
|
import jakarta.xml.bind.annotation.XmlElementWrapper;
|
||||||
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "publications")
|
||||||
|
public class PublicationUrls extends GenericUrls implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -5076364662014107275L;
|
||||||
|
|
||||||
|
List<UrlConfiguration> urls;
|
||||||
|
FetchStrategy fetchMode;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UrlConfiguration> getUrls() {
|
||||||
|
return urls;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElementWrapper
|
||||||
|
@XmlElement(name = "urlConfig")
|
||||||
|
public void setUrls(List<UrlConfiguration> urls) {
|
||||||
|
this.urls = urls;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FetchStrategy getFetchMode() {
|
||||||
|
return fetchMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "fetchMode")
|
||||||
|
public void setFetchMode(FetchStrategy fetchMode) {
|
||||||
|
this.fetchMode = fetchMode;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package eu.eudat.logic.proxy.config.entitiesV2;
|
||||||
|
|
||||||
|
import eu.eudat.proxy.config.FetchStrategy;
|
||||||
|
import eu.eudat.proxy.config.UrlConfiguration;
|
||||||
|
import eu.eudat.proxy.config.entities.GenericUrls;
|
||||||
|
import jakarta.xml.bind.annotation.XmlElement;
|
||||||
|
import jakarta.xml.bind.annotation.XmlElementWrapper;
|
||||||
|
import jakarta.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "taxonomies")
|
||||||
|
public class TaxonomyUrls extends GenericUrls implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -5076364662014107275L;
|
||||||
|
|
||||||
|
List<UrlConfiguration> urls;
|
||||||
|
FetchStrategy fetchMode;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UrlConfiguration> getUrls() {
|
||||||
|
return urls;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElementWrapper
|
||||||
|
@XmlElement(name = "urlConfig")
|
||||||
|
public void setUrls(List<UrlConfiguration> urls) {
|
||||||
|
this.urls = urls;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FetchStrategy getFetchMode() {
|
||||||
|
return fetchMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "fetchMode")
|
||||||
|
public void setFetchMode(FetchStrategy fetchMode) {
|
||||||
|
this.fetchMode = fetchMode;
|
||||||
|
}
|
||||||
|
}
|
|
@ -50,6 +50,56 @@ public class RemoteFetcher {
|
||||||
).clientConnector(new ReactorClientHttpConnector(HttpClient.create().followRedirect(true))).build();
|
).clientConnector(new ReactorClientHttpConnector(HttpClient.create().followRedirect(true))).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//@Cacheable(value = "tempexternalType", keyGenerator = "externalUrlsKeyGenerator")
|
||||||
|
public List<Map<String, String>> get(String externalType, ExternalUrlCriteria externalUrlCriteria, String key) throws eu.eudat.proxy.config.exceptions.NoURLFound, eu.eudat.proxy.config.exceptions.HugeResultSet {
|
||||||
|
List<UrlConfiguration> urlConfigs = null;
|
||||||
|
FetchStrategy fetchStrategy = null;
|
||||||
|
switch (externalType){
|
||||||
|
case "taxonomies":
|
||||||
|
urlConfigs = key != null && !key.isEmpty() ? configLoader.getExternalUrls().getTaxonomies().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList())
|
||||||
|
: configLoader.getExternalUrls().getTaxonomies().getUrls();
|
||||||
|
fetchStrategy = configLoader.getExternalUrls().getTaxonomies().getFetchMode();
|
||||||
|
break;
|
||||||
|
case "licenses":
|
||||||
|
urlConfigs = key != null && !key.isEmpty() ? configLoader.getExternalUrls().getLicenses().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList())
|
||||||
|
: configLoader.getExternalUrls().getLicenses().getUrls();
|
||||||
|
fetchStrategy = configLoader.getExternalUrls().getLicenses().getFetchMode();
|
||||||
|
break;
|
||||||
|
case "publications":
|
||||||
|
urlConfigs = key != null && !key.isEmpty() ? configLoader.getExternalUrls().getPublications().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList())
|
||||||
|
: configLoader.getExternalUrls().getPublications().getUrls();
|
||||||
|
fetchStrategy = configLoader.getExternalUrls().getPublications().getFetchMode();
|
||||||
|
break;
|
||||||
|
case "journals":
|
||||||
|
urlConfigs = key != null && !key.isEmpty() ? configLoader.getExternalUrls().getJournals().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList())
|
||||||
|
: configLoader.getExternalUrls().getJournals().getUrls();
|
||||||
|
fetchStrategy = configLoader.getExternalUrls().getJournals().getFetchMode();
|
||||||
|
break;
|
||||||
|
case "pubRepositories":
|
||||||
|
urlConfigs = key != null && !key.isEmpty() ? configLoader.getExternalUrls().getPubRepositories().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList())
|
||||||
|
: configLoader.getExternalUrls().getPubRepositories().getUrls();
|
||||||
|
fetchStrategy = configLoader.getExternalUrls().getPubRepositories().getFetchMode();
|
||||||
|
break;
|
||||||
|
case "dataRepositories":
|
||||||
|
urlConfigs = key != null && !key.isEmpty() ? configLoader.getExternalUrls().getRepositories().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList())
|
||||||
|
: configLoader.getExternalUrls().getRepositories().getUrls();
|
||||||
|
fetchStrategy = configLoader.getExternalUrls().getRepositories().getFetchMode();
|
||||||
|
break;
|
||||||
|
case "registries":
|
||||||
|
urlConfigs = key != null && !key.isEmpty() ? configLoader.getExternalUrls().getRegistries().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList())
|
||||||
|
: configLoader.getExternalUrls().getRegistries().getUrls();
|
||||||
|
fetchStrategy = configLoader.getExternalUrls().getRegistries().getFetchMode();
|
||||||
|
break;
|
||||||
|
case "services":
|
||||||
|
urlConfigs = key != null && !key.isEmpty() ? configLoader.getExternalUrls().getServices().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList())
|
||||||
|
: configLoader.getExternalUrls().getServices().getUrls();
|
||||||
|
fetchStrategy = configLoader.getExternalUrls().getServices().getFetchMode();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return getAll(urlConfigs, fetchStrategy, externalUrlCriteria);
|
||||||
|
}
|
||||||
|
|
||||||
@Cacheable(value = "repositories", keyGenerator = "externalUrlsKeyGenerator")
|
@Cacheable(value = "repositories", keyGenerator = "externalUrlsKeyGenerator")
|
||||||
public List<Map<String, String>> getRepositories(ExternalUrlCriteria externalUrlCriteria, String key) throws NoURLFound, HugeResultSet {
|
public List<Map<String, String>> getRepositories(ExternalUrlCriteria externalUrlCriteria, String key) throws NoURLFound, HugeResultSet {
|
||||||
List<UrlConfiguration> urlConfigs =
|
List<UrlConfiguration> urlConfigs =
|
||||||
|
|
|
@ -1,32 +1,32 @@
|
||||||
package eu.eudat.publicapi.configurations;
|
package eu.eudat.publicapi.configurations;
|
||||||
|
|
||||||
import io.swagger.v3.oas.models.OpenAPI;
|
//import io.swagger.v3.oas.models.OpenAPI;
|
||||||
import io.swagger.v3.oas.models.info.Contact;
|
//import io.swagger.v3.oas.models.info.Contact;
|
||||||
import io.swagger.v3.oas.models.info.Info;
|
//import io.swagger.v3.oas.models.info.Info;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
//import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
//import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.core.env.Environment;
|
//import org.springframework.core.env.Environment;
|
||||||
|
//
|
||||||
@Configuration
|
//@Configuration
|
||||||
public class SwaggerConfiguration {
|
//public class SwaggerConfiguration {
|
||||||
|
//
|
||||||
// private static final TypeResolver resolver = new TypeResolver();
|
// // private static final TypeResolver resolver = new TypeResolver();
|
||||||
|
//
|
||||||
@Autowired
|
// @Autowired
|
||||||
private Environment environment;
|
// private Environment environment;
|
||||||
|
//
|
||||||
@Bean
|
// @Bean
|
||||||
public OpenAPI ArgosOpenApi() {
|
// public OpenAPI ArgosOpenApi() {
|
||||||
return new OpenAPI().info(apiInfo());
|
// return new OpenAPI().info(apiInfo());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private Info apiInfo() {
|
// private Info apiInfo() {
|
||||||
return new Info()
|
// return new Info()
|
||||||
.title("OpenDMP public API")
|
// .title("OpenDMP public API")
|
||||||
.description("Argos public API.")
|
// .description("Argos public API.")
|
||||||
.version("1.0")
|
// .version("1.0")
|
||||||
.termsOfService("https://argos.openaire.eu/terms-and-conditions")
|
// .termsOfService("https://argos.openaire.eu/terms-and-conditions")
|
||||||
.contact(new Contact().name("Argos").url("https://argos.openaire.eu/").email("argos@openaire.eu "));
|
// .contact(new Contact().name("Argos").url("https://argos.openaire.eu/").email("argos@openaire.eu "));
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
|
@ -26,6 +26,14 @@ cache:
|
||||||
expireAfterWriteMinutes: 10
|
expireAfterWriteMinutes: 10
|
||||||
expireAfterAccessMinutes: 10
|
expireAfterAccessMinutes: 10
|
||||||
refreshAfterWriteMinutes: 10
|
refreshAfterWriteMinutes: 10
|
||||||
|
- names: [ "externalReference" ]
|
||||||
|
allowNullValues: true
|
||||||
|
initialCapacity: 100
|
||||||
|
maximumSize: 500
|
||||||
|
enableRecordStats: false
|
||||||
|
expireAfterWriteMinutes: 10
|
||||||
|
expireAfterAccessMinutes: 10
|
||||||
|
refreshAfterWriteMinutes: 10
|
||||||
mapCaches:
|
mapCaches:
|
||||||
apiKey:
|
apiKey:
|
||||||
name: apikey
|
name: apikey
|
||||||
|
@ -35,4 +43,7 @@ cache:
|
||||||
keyPattern: user_by_subject_$subject$:v0
|
keyPattern: user_by_subject_$subject$:v0
|
||||||
supportiveMaterial:
|
supportiveMaterial:
|
||||||
name: supportiveMaterial
|
name: supportiveMaterial
|
||||||
keyPattern: supportive_material_$material$:v0
|
keyPattern: supportive_material_$material$:v0
|
||||||
|
externalReference:
|
||||||
|
name: externalReference
|
||||||
|
keyPattern: external_reference_$type$_$criteria$:v0
|
|
@ -0,0 +1,215 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<funders>
|
||||||
|
<urls>
|
||||||
|
<urlConfig>
|
||||||
|
<key>openaire</key>
|
||||||
|
<label>OpenAIRE</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<url>https://services.openaire.eu/search/v2/api/publications?&refine=true&fields=relfunder&page={page}&size=0&format=json</url>
|
||||||
|
<firstPage>0</firstPage>
|
||||||
|
<contenttype>application/json; charset=utf-8</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$['refineResults']['relfunder'][*]</path>
|
||||||
|
<fields>
|
||||||
|
<name>'name'</name>
|
||||||
|
<id>'id'</id>
|
||||||
|
<count>'count'</count>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<filterType>local</filterType>
|
||||||
|
</urlConfig>
|
||||||
|
<!-- <urlConfig>
|
||||||
|
<key>openaire</key>
|
||||||
|
<label>OpenAIRE</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<url>https://services.openaire.eu/search/v2/api/datasets?&refine=true&fields=relfunder&page=0&size={page}&format=json</url>
|
||||||
|
<firstPage>0</firstPage>
|
||||||
|
<contenttype>application/json; charset=utf-8</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$['refineResults']['relfunder'][*]</path>
|
||||||
|
<fields>
|
||||||
|
<name>'name'</name>
|
||||||
|
<id>'id'</id>
|
||||||
|
<count>'count'</count>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
</urlConfig>
|
||||||
|
<urlConfig>
|
||||||
|
<key>openaire</key>
|
||||||
|
<label>OpenAIRE</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<url>https://services.openaire.eu/search/v2/api/software?&refine=true&fields=relfunder&page={page}&size=0&format=json</url>
|
||||||
|
<firstPage>0</firstPage>
|
||||||
|
<contenttype>application/json; charset=utf-8</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$['refineResults']['relfunder'][*]</path>
|
||||||
|
<fields>
|
||||||
|
<name>'name'</name>
|
||||||
|
<id>'id'</id>
|
||||||
|
<count>'count'</count>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
</urlConfig>
|
||||||
|
<urlConfig>
|
||||||
|
<key>openaire</key>
|
||||||
|
<label>OpenAIRE</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<url>https://services.openaire.eu/search/v2/api/other?&refine=true&fields=relfunder&page={page}&size=0&format=json</url>
|
||||||
|
<firstPage>0</firstPage>
|
||||||
|
<contenttype>application/json; charset=utf-8</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$['refineResults']['relfunder'][*]</path>
|
||||||
|
<fields>
|
||||||
|
<name>'name'</name>
|
||||||
|
<id>'id'</id>
|
||||||
|
<count>'count'</count>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
</urlConfig>-->
|
||||||
|
<!-- <urlConfig>
|
||||||
|
<key>cristin</key>
|
||||||
|
<label>Cristin</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<url>https://eestore.paas2.uninett.no/api/projectrepo/?search={like}&page={page}&size={pageSize}</url>
|
||||||
|
<firstPage>1</firstPage>
|
||||||
|
<contenttype>application/vnd.api+json; charset=utf-8</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$['data'][*]['attributes']</path>
|
||||||
|
<fields>
|
||||||
|
<id>'pid'</id>
|
||||||
|
<name>'name'</name>
|
||||||
|
<uri>'uri'</uri>
|
||||||
|
<description>'description'</description>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||||
|
</urlConfig>-->
|
||||||
|
<urlConfig>
|
||||||
|
<key>cristin</key>
|
||||||
|
<label>Cristin</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<url>https://eestore.paas2.uninett.no/api/projectrepo/?search={like}&page={page}&size={pageSize}</url>
|
||||||
|
<firstPage>1</firstPage>
|
||||||
|
<contenttype>application/vnd.api+json; charset=utf-8</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$['data'][*]['attributes']</path>
|
||||||
|
<fields>
|
||||||
|
<id>'pid'</id>
|
||||||
|
<name>'name'</name>
|
||||||
|
<uri>'uri'</uri>
|
||||||
|
<description>'description'</description>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||||
|
</urlConfig>
|
||||||
|
<urlConfig>
|
||||||
|
<key>crossref</key>
|
||||||
|
<label>Crossref Funder Registry</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<url>https://api.crossref.org/funders?query={like}&rows={pageSize}</url>
|
||||||
|
<contenttype>application/json; charset=utf-8</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$['message']['items'][*]</path>
|
||||||
|
<fields>
|
||||||
|
<name>'name'</name>
|
||||||
|
<id>'id'</id>
|
||||||
|
<count>'count'</count>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
</urlConfig>
|
||||||
|
<!-- <urlConfig>
|
||||||
|
<key>servicesOpenAire</key>
|
||||||
|
<label>OpenAIRE</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<url>https://services.openaire.eu/search/v2/api/publications?&refine=true&fields=relfunder&page={page}&size=0&format=json</url>
|
||||||
|
<firstPage>0</firstPage>
|
||||||
|
<contenttype>application/json; charset=utf-8</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$['refineResults']['relfunder'][*]</path>
|
||||||
|
<fields>
|
||||||
|
<name>'name'</name>
|
||||||
|
<id>'id'</id>
|
||||||
|
<count>'count'</count>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
</urlConfig>
|
||||||
|
<urlConfig>
|
||||||
|
<key>servicesOpenAire</key>
|
||||||
|
<label>OpenAIRE</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<url>https://services.openaire.eu/search/v2/api/datasets?&refine=true&fields=relfunder&page=0&size={page}&format=json</url>
|
||||||
|
<firstPage>0</firstPage>
|
||||||
|
<contenttype>application/json; charset=utf-8</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$['refineResults']['relfunder'][*]</path>
|
||||||
|
<fields>
|
||||||
|
<name>'name'</name>
|
||||||
|
<id>'id'</id>
|
||||||
|
<count>'count'</count>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
</urlConfig>
|
||||||
|
<urlConfig>
|
||||||
|
<key>servicesOpenAire</key>
|
||||||
|
<label>OpenAIRE</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<url>https://services.openaire.eu/search/v2/api/software?&refine=true&fields=relfunder&page={page}&size=0&format=json</url>
|
||||||
|
<firstPage>0</firstPage>
|
||||||
|
<contenttype>application/json; charset=utf-8</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$['refineResults']['relfunder'][*]</path>
|
||||||
|
<fields>
|
||||||
|
<name>'name'</name>
|
||||||
|
<id>'id'</id>
|
||||||
|
<count>'count'</count>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
</urlConfig>
|
||||||
|
<urlConfig>
|
||||||
|
<key>servicesOpenAire</key>
|
||||||
|
<label>OpenAIRE</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<url>https://services.openaire.eu/search/v2/api/other?&refine=true&fields=relfunder&page={page}&size=0&format=json</url>
|
||||||
|
<firstPage>0</firstPage>
|
||||||
|
<contenttype>application/json; charset=utf-8</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$['refineResults']['relfunder'][*]</path>
|
||||||
|
<fields>
|
||||||
|
<name>'name'</name>
|
||||||
|
<id>'id'</id>
|
||||||
|
<count>'count'</count>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
</urlConfig>-->
|
||||||
|
<!-- <urlConfig>
|
||||||
|
<key>internal</key>
|
||||||
|
<label>Internal</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>Internal</type>
|
||||||
|
<url>web/src/main/resources/mockData/FunderInternalMockUpData.json</url>
|
||||||
|
<data>
|
||||||
|
<path>$['data'][*]['attributes']</path>
|
||||||
|
<fields>
|
||||||
|
<id>'pid'</id>
|
||||||
|
<name>'name'</name>
|
||||||
|
<uri>'uri'</uri>
|
||||||
|
<description>'description'</description>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||||
|
</urlConfig>-->
|
||||||
|
</urls>
|
||||||
|
<fetchMode>FIRST</fetchMode> <!-- EITHER 'FIRST' OR 'ALL' -->
|
||||||
|
</funders>
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<journals>
|
||||||
|
<urls>
|
||||||
|
<urlConfig>
|
||||||
|
<key>openaire</key>
|
||||||
|
<label>OpenAIRE Journals</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<request>POST</request>
|
||||||
|
<url>https://services.openaire.eu/openaire/ds/searchdetails/{page}/{pageSize}?requestSortBy=id&order=ASCENDING</url>
|
||||||
|
<firstPage>0</firstPage>
|
||||||
|
<contenttype>application/json</contenttype>
|
||||||
|
<requestBody>{"officialname": "{like}", "typology":"journal"}</requestBody>
|
||||||
|
<data>
|
||||||
|
<path>$['datasourceInfo'][*]</path>
|
||||||
|
<fields>
|
||||||
|
<id>'id'</id>
|
||||||
|
<name>'officialname'</name>
|
||||||
|
<count>'count'</count>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||||
|
</urlConfig>
|
||||||
|
</urls>
|
||||||
|
<fetchMode>FIRST</fetchMode> <!-- EITHER 'FIRST' OR 'ALL' -->
|
||||||
|
</journals>
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<licenses>
|
||||||
|
<urls>
|
||||||
|
<urlConfig>
|
||||||
|
<key>opendefinition</key>
|
||||||
|
<label>Open Definition</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<url>https://licenses.opendefinition.org/licenses/groups/all.json</url>
|
||||||
|
<firstPage>1</firstPage>
|
||||||
|
<contenttype>application/vnd.api+json; charset=utf-8</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$[*]</path>
|
||||||
|
<fields>
|
||||||
|
<id>'id'</id>
|
||||||
|
<name>'title'</name>
|
||||||
|
<uri>'url'</uri>
|
||||||
|
<description>'maintainer'</description>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
</urlConfig>
|
||||||
|
</urls>
|
||||||
|
<fetchMode>FIRST</fetchMode>
|
||||||
|
</licenses>
|
|
@ -0,0 +1,80 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<projects>
|
||||||
|
<urls>
|
||||||
|
<!-- <urlConfig>
|
||||||
|
<key>cristin</key>
|
||||||
|
<label>Cristin</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<url>https://eestore.paas2.uninett.no/api/projectrepo/?search={like}&page={page}&size={pageSize}</url>
|
||||||
|
<firstPage>1</firstPage>
|
||||||
|
<contenttype>application/vnd.api+json; charset=utf-8</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$['data'][*]['attributes']</path>
|
||||||
|
<fields>
|
||||||
|
<id>'pid'</id>
|
||||||
|
<name>'name'</name>
|
||||||
|
<uri>'uri'</uri>
|
||||||
|
<description>'description'</description>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||||
|
</urlConfig>
|
||||||
|
<urlConfig>
|
||||||
|
<key>openaire</key>
|
||||||
|
<label>OpenAIRE</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<url>https://services.openaire.eu/search/v2/api/resources?query=((oaftype exact project) and ((projectcode_nt exact "*")or(*)))&fq=(funder exact {funderId})&page={page}&size={pageSize}&format=json</url>
|
||||||
|
<firstPage>0</firstPage>
|
||||||
|
<contenttype>application/json; charset=utf-8</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$['response']['results']['result'][*]['metadata']['oaf:entity']['oaf:project']</path>
|
||||||
|
<fields>
|
||||||
|
<id>'originalId'</id>
|
||||||
|
<name>'title'</name>
|
||||||
|
<count>'count'</count>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||||
|
</urlConfig>
|
||||||
|
<urlConfig>
|
||||||
|
<key>openAire</key>
|
||||||
|
<label>OpenAIRE</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<url>https://eestore.paas2.uninett.no/api/projectrepo/?search={like}&page={page}&size={pageSize}</url>
|
||||||
|
<firstPage>1</firstPage>
|
||||||
|
<contenttype>application/vnd.api+json; charset=utf-8</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$['data'][*]['attributes']</path>
|
||||||
|
<fields>
|
||||||
|
<id>'pid'</id>
|
||||||
|
<name>'name'</name>
|
||||||
|
<uri>'uri'</uri>
|
||||||
|
<description>'description'</description>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||||
|
</urlConfig>
|
||||||
|
<urlConfig>
|
||||||
|
<key>internal</key>
|
||||||
|
<label>Internal</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>Internal</type>
|
||||||
|
<url>web/src/main/resources/mockData/ProjectInternalMockUpData.json</url>
|
||||||
|
<data>
|
||||||
|
<path>$['data'][*]['attributes']</path>
|
||||||
|
<fields>
|
||||||
|
<id>'pid'</id>
|
||||||
|
<name>'name'</name>
|
||||||
|
<uri>'uri'</uri>
|
||||||
|
<description>'description'</description>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||||
|
</urlConfig>-->
|
||||||
|
</urls>
|
||||||
|
<fetchMode>FIRST</fetchMode> <!-- EITHER 'FIRST' OR 'ALL' -->
|
||||||
|
</projects>
|
|
@ -0,0 +1,67 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<pubRepositories>
|
||||||
|
<urls>
|
||||||
|
<urlConfig>
|
||||||
|
<key>openaire</key>
|
||||||
|
<label>OpenAIRE publication repositories 1</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<request>POST</request>
|
||||||
|
<url>https://services.openaire.eu/openaire/ds/searchdetails/{page}/{pageSize}?requestSortBy=id&order=ASCENDING</url>
|
||||||
|
<firstPage>0</firstPage>
|
||||||
|
<contenttype>application/json</contenttype>
|
||||||
|
<requestBody>{"officialname": "{like}", "typology":"pubsrepository::institutional"}</requestBody>
|
||||||
|
<data>
|
||||||
|
<path>$['datasourceInfo'][*]</path>
|
||||||
|
<fields>
|
||||||
|
<id>'id'</id>
|
||||||
|
<name>'officialname'</name>
|
||||||
|
<count>'count'</count>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||||
|
</urlConfig>
|
||||||
|
<urlConfig>
|
||||||
|
<key>openaire</key>
|
||||||
|
<label>OpenAIRE publication repositories 2</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<request>POST</request>
|
||||||
|
<url>https://services.openaire.eu/openaire/ds/searchdetails/{page}/{pageSize}?requestSortBy=id&order=ASCENDING</url>
|
||||||
|
<firstPage>0</firstPage>
|
||||||
|
<contenttype>application/json</contenttype>
|
||||||
|
<requestBody>{"officialname": "{like}", "typology":"pubsrepository::thematic"}</requestBody>
|
||||||
|
<data>
|
||||||
|
<path>$['datasourceInfo'][*]</path>
|
||||||
|
<fields>
|
||||||
|
<id>'id'</id>
|
||||||
|
<name>'officialname'</name>
|
||||||
|
<count>'count'</count>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||||
|
</urlConfig>
|
||||||
|
<urlConfig>
|
||||||
|
<key>openaire</key>
|
||||||
|
<label>OpenAIRE publication repositories 3</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<request>POST</request>
|
||||||
|
<url>https://services.openaire.eu/openaire/ds/searchdetails/{page}/{pageSize}?requestSortBy=id&order=ASCENDING</url>
|
||||||
|
<firstPage>0</firstPage>
|
||||||
|
<contenttype>application/json</contenttype>
|
||||||
|
<requestBody>{"officialname": "{like}", "typology":"pubsrepository::unknown"}</requestBody>
|
||||||
|
<data>
|
||||||
|
<path>$['datasourceInfo'][*]</path>
|
||||||
|
<fields>
|
||||||
|
<id>'id'</id>
|
||||||
|
<name>'officialname'</name>
|
||||||
|
<count>'count'</count>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||||
|
</urlConfig>
|
||||||
|
</urls>
|
||||||
|
<fetchMode>FIRST</fetchMode> <!-- EITHER 'FIRST' OR 'ALL' -->
|
||||||
|
</pubRepositories>
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<publications>
|
||||||
|
<urls>
|
||||||
|
<urlConfig>
|
||||||
|
<key>openaire</key>
|
||||||
|
<label>OpenAIRE Publications</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<url>https://services.openaire.eu/search/v2/api/resources?query=oaftype exact result and {query}&page={page}&size={pageSize}&format=json</url>
|
||||||
|
<firstPage>0</firstPage>
|
||||||
|
<contenttype>application/json;charset=UTF-8</contenttype>
|
||||||
|
<queries>
|
||||||
|
<query>
|
||||||
|
<ordinal>0</ordinal>
|
||||||
|
<condition>(10[.][0-9]{4,}(?:[.][0-9]+)*\/(?:(?!["&\'<>])[[:graph:]])+)</condition>
|
||||||
|
<value>(pidclassid exact "doi" and pid="{like}")</value>
|
||||||
|
</query>
|
||||||
|
<query>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<condition>(10[.][0-9]{4,}(?:[.][0-9]+)*\/(?:(?!["&\'<>])\S)+)</condition>
|
||||||
|
<value>(pidclassid exact "doi" and pid="{like}")</value>
|
||||||
|
</query>
|
||||||
|
<query>
|
||||||
|
<ordinal>2</ordinal>
|
||||||
|
<condition>.+</condition>
|
||||||
|
<value>{like}</value>
|
||||||
|
</query>
|
||||||
|
</queries>
|
||||||
|
<data>
|
||||||
|
<path>$['results'][*]['result']['metadata']['oaf:entity']['oaf:result']</path>
|
||||||
|
<fields>
|
||||||
|
<id>'originalId'</id>
|
||||||
|
<pid>pid.content</pid>
|
||||||
|
<pidTypeField>pid.classid</pidTypeField>
|
||||||
|
<name>'title'</name>
|
||||||
|
<count>'count'</count>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||||
|
</urlConfig>
|
||||||
|
</urls>
|
||||||
|
<fetchMode>FIRST</fetchMode> <!-- EITHER 'FIRST' OR 'ALL' -->
|
||||||
|
</publications>
|
|
@ -0,0 +1,124 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<urls>
|
||||||
|
<!-- <urlConfig>
|
||||||
|
<key>openaire</key>
|
||||||
|
<label>OpenAIRE</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<!– <url>https://services.openaire.eu/search/v2/api/datasources?q={like}&fq=datasourcetypeuiname exact "Data Repository"&page={page}&size={pageSize}&format=json</url>–>
|
||||||
|
<!– Replaced with id field instead of name–>
|
||||||
|
<url>https://services.openaire.eu/search/v2/api/datasources?q={like}&fq=datasourcetypeuiid exact "datarepository::unknown"&page={page}&size={pageSize}&format=json</url>
|
||||||
|
<firstPage>0</firstPage>
|
||||||
|
<contenttype>application/json;charset=UTF-8</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$['results'][*]['result']['metadata']['oaf:entity']['oaf:datasource']</path>
|
||||||
|
<fields>
|
||||||
|
<id>'originalId'</id>
|
||||||
|
<name>'officialname'</name>
|
||||||
|
<count>'count'</count>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||||
|
</urlConfig>
|
||||||
|
<urlConfig>
|
||||||
|
<key>openairealt</key>
|
||||||
|
<label>OpenAIRE Alternative</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<!– Uncomment to exclude Journals–>
|
||||||
|
<!– <url>https://services.openaire.eu/search/v2/api/resources?query=oaftype exact datasource and {like} and datasourcetypeuiid <> "pubsrepository::journal" and datasourcetypeuiid <> "aggregator::pubsrepository::journals"&page={page}&size=2&format=json</url>–>
|
||||||
|
<url>https://services.openaire.eu/search/v2/api/resources?query=oaftype exact datasource and {like}&page={page}&size={pageSize}&format=json</url>
|
||||||
|
<firstPage>0</firstPage>
|
||||||
|
<contenttype>application/json;charset=UTF-8</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$['results'][*]['result']['metadata']['oaf:entity']['oaf:datasource']</path>
|
||||||
|
<fields>
|
||||||
|
<id>'originalId'</id>
|
||||||
|
<name>'officialname'</name>
|
||||||
|
<count>'count'</count>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||||
|
</urlConfig>-->
|
||||||
|
<urlConfig>
|
||||||
|
<key>openairealt2</key>
|
||||||
|
<label>Another OpenAIRE Alternative</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<request>POST</request>
|
||||||
|
<url>https://services.openaire.eu/openaire/ds/searchdetails/{page}/{pageSize}?requestSortBy=id&order=ASCENDING</url>
|
||||||
|
<!-- <url>https://services.openaire.eu/openaire/ds/searchregistered/{page}/{pageSize}?requestSortBy=id&order=ASCENDING</url>-->
|
||||||
|
<firstPage>0</firstPage>
|
||||||
|
<contenttype>application/json</contenttype>
|
||||||
|
<requestBody>{"officialname": "{like}", "typology":"data"}</requestBody>
|
||||||
|
<data>
|
||||||
|
<path>$['datasourceInfo'][*]</path>
|
||||||
|
<fields>
|
||||||
|
<id>'id'</id>
|
||||||
|
<name>'officialname'</name>
|
||||||
|
<count>'count'</count>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||||
|
</urlConfig>
|
||||||
|
<!--<urlConfig>
|
||||||
|
<key>cristin</key>
|
||||||
|
<label>Cristin</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<url>https://eestore.paas2.uninett.no/api/datarepo/?search={like}&page={page}&size={pageSize}</url>
|
||||||
|
<firstPage>1</firstPage>
|
||||||
|
<contenttype>application/vnd.api+json; charset=utf-8</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$['data'][*]['attributes']</path>
|
||||||
|
<fields>
|
||||||
|
<id>'pid'</id>
|
||||||
|
<name>'name'</name>
|
||||||
|
<uri>'uri'</uri>
|
||||||
|
<description>'description'</description>
|
||||||
|
<source>'source'</source>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||||
|
</urlConfig>-->
|
||||||
|
<!-- <urlConfig>
|
||||||
|
<key>openAire</key>
|
||||||
|
<label>OpenAIRE</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<url>https://eestore.paas2.uninett.no/api/datarepo/?search={like}&page={page}&size={pageSize}</url>
|
||||||
|
<firstPage>1</firstPage>
|
||||||
|
<contenttype>application/vnd.api+json; charset=utf-8</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$['data'][*]['attributes']</path>
|
||||||
|
<fields>
|
||||||
|
<id>'pid'</id>
|
||||||
|
<name>'name'</name>
|
||||||
|
<uri>'uri'</uri>
|
||||||
|
<description>'description'</description>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||||
|
</urlConfig>-->
|
||||||
|
<!--<urlConfig>
|
||||||
|
<key>internal</key>
|
||||||
|
<label>Internal</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>Internal</type>
|
||||||
|
<url>web/src/main/resources/mockData/RepositoriesInternalMockUpData.json</url>
|
||||||
|
<data>
|
||||||
|
<path>$['data'][*]['attributes']</path>
|
||||||
|
<fields>
|
||||||
|
<id>'pid'</id>
|
||||||
|
<name>'name'</name>
|
||||||
|
<uri>'uri'</uri>
|
||||||
|
<description>'description'</description>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
|
||||||
|
</urlConfig>-->
|
||||||
|
</urls>
|
||||||
|
<fetchMode>FIRST</fetchMode> <!-- EITHER 'FIRST' OR 'ALL' -->
|
||||||
|
</repositories>
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<taxonomies>
|
||||||
|
<urls>
|
||||||
|
<urlConfig>
|
||||||
|
<key>taxonomy</key>
|
||||||
|
<label>Taxonomies</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<url>https://eestore.paas2.uninett.no/api/taxonomy/</url>
|
||||||
|
<firstPage>0</firstPage>
|
||||||
|
<contenttype>application/vnd.api+json</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$['data'][*]['attributes']</path>
|
||||||
|
<fields>
|
||||||
|
<id>'pid'</id>
|
||||||
|
<name>'name'</name>
|
||||||
|
<count>'count'</count>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<!-- <paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>-->
|
||||||
|
</urlConfig>
|
||||||
|
</urls>
|
||||||
|
<fetchMode>ALL</fetchMode> <!-- EITHER 'FIRST' OR 'ALL' -->
|
||||||
|
</taxonomies>
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<validators>
|
||||||
|
<urls>
|
||||||
|
<urlConfig>
|
||||||
|
<key>zenodo</key>
|
||||||
|
<label>Zenodo</label>
|
||||||
|
<ordinal>1</ordinal>
|
||||||
|
<type>External</type>
|
||||||
|
<url>https://sandbox.zenodo.org/api/records/?page={page}&size={pageSize}&q="{like}"</url>
|
||||||
|
<firstPage>1</firstPage>
|
||||||
|
<contenttype>application/json</contenttype>
|
||||||
|
<data>
|
||||||
|
<path>$[*]</path>
|
||||||
|
<fields>
|
||||||
|
<id>'conceptrecid'</id>
|
||||||
|
<name>'conceptdoi'</name>
|
||||||
|
<uri>'doi'</uri>
|
||||||
|
<description>'created'</description>
|
||||||
|
</fields>
|
||||||
|
</data>
|
||||||
|
<paginationpath>$['hits']['total']</paginationpath>
|
||||||
|
</urlConfig>
|
||||||
|
</urls>
|
||||||
|
<fetchMode>FIRST</fetchMode>
|
||||||
|
</validators>
|
|
@ -0,0 +1,7 @@
|
||||||
|
export enum SupportiveMaterialFieldType {
|
||||||
|
faq = 'faq',
|
||||||
|
about = 'about',
|
||||||
|
glossary = 'glossary',
|
||||||
|
termsofservice = 'termsofservice',
|
||||||
|
userguide = 'userguide'
|
||||||
|
}
|
|
@ -54,11 +54,12 @@ import { TermsOfServiceService } from './services/terms-of-service/terms-of-serv
|
||||||
import { UnlinkAccountEmailConfirmationService } from './services/unlink-account-email-confirmation/unlink-account-email-confirmation.service';
|
import { UnlinkAccountEmailConfirmationService } from './services/unlink-account-email-confirmation/unlink-account-email-confirmation.service';
|
||||||
import { DescriptionTemplateTypeService } from './services/description-template-type/description-template-type.service';
|
import { DescriptionTemplateTypeService } from './services/description-template-type/description-template-type.service';
|
||||||
import { BaseHttpV2Service } from './services/http/base-http-v2.service';
|
import { BaseHttpV2Service } from './services/http/base-http-v2.service';
|
||||||
import { KeycloakService } from 'keycloak-angular';
|
//import { KeycloakService } from 'keycloak-angular';
|
||||||
import { PrincipalService } from './services/http/principal.service';
|
import { PrincipalService } from './services/http/principal.service';
|
||||||
import { InterceptorType } from '@common/http/interceptors/interceptor-type';
|
import { InterceptorType } from '@common/http/interceptors/interceptor-type';
|
||||||
import { BaseHttpParams } from '@common/http/base-http-params';
|
import { BaseHttpParams } from '@common/http/base-http-params';
|
||||||
import { from } from 'rxjs';
|
import { from } from 'rxjs';
|
||||||
|
import { SupportiveMaterialService } from './services/supportive-material/supportive-material.service';
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// This is shared module that provides all the services. Its imported only once on the AppModule.
|
// This is shared module that provides all the services. Its imported only once on the AppModule.
|
||||||
|
@ -126,6 +127,7 @@ export class CoreServiceModule {
|
||||||
FaqService,
|
FaqService,
|
||||||
GlossaryService,
|
GlossaryService,
|
||||||
TermsOfServiceService,
|
TermsOfServiceService,
|
||||||
|
SupportiveMaterialService,
|
||||||
CurrencyService,
|
CurrencyService,
|
||||||
MergeEmailConfirmationService,
|
MergeEmailConfirmationService,
|
||||||
UnlinkAccountEmailConfirmationService,
|
UnlinkAccountEmailConfirmationService,
|
||||||
|
|
|
@ -11,11 +11,11 @@ export class FaqService {
|
||||||
private http: HttpClient,
|
private http: HttpClient,
|
||||||
private configurationService: ConfigurationService
|
private configurationService: ConfigurationService
|
||||||
) {
|
) {
|
||||||
this.faqUrl = `${configurationService.server}material/faq`;
|
this.faqUrl = `${configurationService.server}material`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getFaq(lang: string): Observable<HttpResponse<Blob>> {
|
public getFaq(lang: string, field: string): Observable<HttpResponse<Blob>> {
|
||||||
return this.http.get(`${this.faqUrl}/${lang}`, { responseType: 'blob', observe: 'response', headers: {'Content-type': 'text/html',
|
return this.http.get(`${this.faqUrl}/${lang}`, {params: {field}, responseType: 'blob', observe: 'response', headers: {'Content-type': 'text/html',
|
||||||
'Accept': 'text/html',
|
'Accept': 'text/html',
|
||||||
'Access-Control-Allow-Origin': this.configurationService.app,
|
'Access-Control-Allow-Origin': this.configurationService.app,
|
||||||
'Access-Control-Allow-Credentials': 'true'} });
|
'Access-Control-Allow-Credentials': 'true'} });
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
import { Injectable } from "@angular/core";
|
||||||
|
import { ConfigurationService } from "../configuration/configuration.service";
|
||||||
|
import { HttpClient, HttpResponse } from "@angular/common/http";
|
||||||
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class SupportiveMaterialService{
|
||||||
|
private baseUrl : string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private http: HttpClient,
|
||||||
|
private configurationService: ConfigurationService
|
||||||
|
) {
|
||||||
|
this.baseUrl = `${configurationService.server}material`;
|
||||||
|
}
|
||||||
|
|
||||||
|
public getMaterial(lang: string, field: string): Observable<HttpResponse<Blob>> {
|
||||||
|
return this.http.get(`${this.baseUrl}/${lang}`, {params: {field}, responseType: 'blob', observe: 'response', headers: {'Content-type': 'text/html',
|
||||||
|
'Accept': 'text/html',
|
||||||
|
'Access-Control-Allow-Origin': this.configurationService.app,
|
||||||
|
'Access-Control-Allow-Credentials': 'true'} });
|
||||||
|
}
|
||||||
|
|
||||||
|
public persist(data: any, field: string): Observable<String> {
|
||||||
|
return this.http.post<string>(`${this.baseUrl}/current`, data, {params: {field}});
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,7 +16,7 @@ export class UserGuideService {
|
||||||
private baseHttp: BaseHttpService,
|
private baseHttp: BaseHttpService,
|
||||||
private configurationService: ConfigurationService
|
private configurationService: ConfigurationService
|
||||||
) {
|
) {
|
||||||
this.userGuideUrl = `${configurationService.server}userguide`;
|
this.userGuideUrl = `${configurationService.server}material/userguide`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getUserGuide(lang: string): Observable<HttpResponse<Blob>> {
|
public getUserGuide(lang: string): Observable<HttpResponse<Blob>> {
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
|
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { AboutService } from '@app/core/services/about/about.service';
|
import { SupportiveMaterialFieldType } from '@app/core/common/enum/supportive-material-field-type';
|
||||||
import { LanguageService } from '@app/core/services/language/language.service';
|
import { LanguageService } from '@app/core/services/language/language.service';
|
||||||
import { MatomoService } from '@app/core/services/matomo/matomo-service';
|
import { MatomoService } from '@app/core/services/matomo/matomo-service';
|
||||||
|
import { SupportiveMaterialService } from '@app/core/services/supportive-material/supportive-material.service';
|
||||||
import { BaseComponent } from '@common/base/base.component';
|
import { BaseComponent } from '@common/base/base.component';
|
||||||
import { TranslateService, LangChangeEvent } from '@ngx-translate/core';
|
import { TranslateService, LangChangeEvent } from '@ngx-translate/core';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
@ -19,7 +20,7 @@ export class AboutComponent extends BaseComponent implements OnInit {
|
||||||
sanitizedGuideUrl: any;
|
sanitizedGuideUrl: any;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private aboutService: AboutService,
|
private supportiveMaterialService: SupportiveMaterialService,
|
||||||
private sanitizer: DomSanitizer,
|
private sanitizer: DomSanitizer,
|
||||||
private languageService: LanguageService,
|
private languageService: LanguageService,
|
||||||
private matomoService: MatomoService,
|
private matomoService: MatomoService,
|
||||||
|
@ -32,7 +33,7 @@ export class AboutComponent extends BaseComponent implements OnInit {
|
||||||
this.translate.onLangChange.subscribe((event: LangChangeEvent) => {
|
this.translate.onLangChange.subscribe((event: LangChangeEvent) => {
|
||||||
this.router.navigate(['/reload'], { skipLocationChange: true }).then(() => this.router.navigate(['/about']));
|
this.router.navigate(['/reload'], { skipLocationChange: true }).then(() => this.router.navigate(['/about']));
|
||||||
});
|
});
|
||||||
this.aboutService.getAbout(this.languageService.getCurrentLanguage())
|
this.supportiveMaterialService.getMaterial(this.languageService.getCurrentLanguage(), SupportiveMaterialFieldType.about)
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(response => {
|
.subscribe(response => {
|
||||||
const blob = new Blob([response.body], { type: 'text/html' });
|
const blob = new Blob([response.body], { type: 'text/html' });
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { DatasetProfileComboBoxType } from '@app/core/common/enum/dataset-profil
|
||||||
import { FieldDataOptionEditorModel } from './field-data-option-editor-model';
|
import { FieldDataOptionEditorModel } from './field-data-option-editor-model';
|
||||||
import { UntypedFormGroup, Validators } from '@angular/forms';
|
import { UntypedFormGroup, Validators } from '@angular/forms';
|
||||||
import { AutoCompleteFieldData, AutoCompleteSingleData } from '@app/core/model/dataset-profile-definition/field-data/field-data';
|
import { AutoCompleteFieldData, AutoCompleteSingleData } from '@app/core/model/dataset-profile-definition/field-data/field-data';
|
||||||
import { AuthFieldEditorModel } from './auto-complete-auth-field-data.model';
|
//import { AuthFieldEditorModel } from './auto-complete-auth-field-data.model';
|
||||||
|
|
||||||
export class AutoCompleteSingleDataEditorModel extends FieldDataEditorModel<AutoCompleteSingleDataEditorModel> {
|
export class AutoCompleteSingleDataEditorModel extends FieldDataEditorModel<AutoCompleteSingleDataEditorModel> {
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ export class AutoCompleteSingleDataEditorModel extends FieldDataEditorModel<Auto
|
||||||
public autoCompleteType: number;
|
public autoCompleteType: number;
|
||||||
public method: string;
|
public method: string;
|
||||||
public hasAuth: boolean;
|
public hasAuth: boolean;
|
||||||
public auth: AuthFieldEditorModel = new AuthFieldEditorModel();
|
//public auth: AuthFieldEditorModel = new AuthFieldEditorModel();
|
||||||
//public multiAutoCompleteOptions: FieldDataOptionEditorModel = new FieldDataOptionEditorModel();
|
//public multiAutoCompleteOptions: FieldDataOptionEditorModel = new FieldDataOptionEditorModel();
|
||||||
|
|
||||||
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
|
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): UntypedFormGroup {
|
||||||
|
@ -27,7 +27,7 @@ export class AutoCompleteSingleDataEditorModel extends FieldDataEditorModel<Auto
|
||||||
method: [{ value: this.method, disabled: (disabled && !skipDisable.includes('AutoCompleteSingleDataEditorModel.method')) }]
|
method: [{ value: this.method, disabled: (disabled && !skipDisable.includes('AutoCompleteSingleDataEditorModel.method')) }]
|
||||||
});
|
});
|
||||||
formGroup.addControl('autoCompleteOptions', this.autoCompleteOptions.buildForm(disabled, skipDisable));
|
formGroup.addControl('autoCompleteOptions', this.autoCompleteOptions.buildForm(disabled, skipDisable));
|
||||||
formGroup.addControl('auth', this.auth.buildForm(disabled, skipDisable));
|
//formGroup.addControl('auth', this.auth.buildForm(disabled, skipDisable));
|
||||||
|
|
||||||
return formGroup;
|
return formGroup;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ export class AutoCompleteSingleDataEditorModel extends FieldDataEditorModel<Auto
|
||||||
this.hasAuth = item.hasAuth;
|
this.hasAuth = item.hasAuth;
|
||||||
this.method = item.method ? item.method : 'GET';
|
this.method = item.method ? item.method : 'GET';
|
||||||
this.autoCompleteOptions = new FieldDataOptionEditorModel().fromModel(item.autoCompleteOptions);
|
this.autoCompleteOptions = new FieldDataOptionEditorModel().fromModel(item.autoCompleteOptions);
|
||||||
this.auth = new AuthFieldEditorModel().fromModel(item.auth);
|
//this.auth = new AuthFieldEditorModel().fromModel(item.auth);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@ import { UntypedFormGroup, UntypedFormArray, AbstractControl } from '@angular/fo
|
||||||
import { DatasetProfileComboBoxType } from '../../../../../../../core/common/enum/dataset-profile-combo-box-type';
|
import { DatasetProfileComboBoxType } from '../../../../../../../core/common/enum/dataset-profile-combo-box-type';
|
||||||
import { AutoCompleteFieldDataEditorModel } from '../../../../admin/field-data/auto-complete-field-data-editor-model';
|
import { AutoCompleteFieldDataEditorModel } from '../../../../admin/field-data/auto-complete-field-data-editor-model';
|
||||||
import { AutoCompleteSingleDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/auto-complete-single-data';
|
import { AutoCompleteSingleDataEditorModel } from '@app/ui/admin/dataset-profile/admin/field-data/auto-complete-single-data';
|
||||||
import { HtmlMethod } from '@app/core/model/dataset-profile-definition/html-method.enum';
|
// import { HtmlMethod } from '@app/core/model/dataset-profile-definition/html-method.enum';
|
||||||
import { AuthType } from '@app/core/model/dataset-profile-definition/auth-type.enum';
|
// import { AuthType } from '@app/core/model/dataset-profile-definition/auth-type.enum';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dataset-profile-editor-auto-complete-field-component',
|
selector: 'app-dataset-profile-editor-auto-complete-field-component',
|
||||||
|
@ -13,8 +13,8 @@ import { AuthType } from '@app/core/model/dataset-profile-definition/auth-type.e
|
||||||
})
|
})
|
||||||
export class DatasetProfileEditorAutoCompleteFieldComponent implements OnInit {
|
export class DatasetProfileEditorAutoCompleteFieldComponent implements OnInit {
|
||||||
|
|
||||||
public htmlMethods = HtmlMethod;
|
// public htmlMethods = HtmlMethod;
|
||||||
public authTypes = AuthType;
|
// public authTypes = AuthType;
|
||||||
|
|
||||||
@Input() form: UntypedFormGroup;
|
@Input() form: UntypedFormGroup;
|
||||||
private data: AutoCompleteFieldDataEditorModel = new AutoCompleteFieldDataEditorModel();
|
private data: AutoCompleteFieldDataEditorModel = new AutoCompleteFieldDataEditorModel();
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import { Component, OnInit, Input } from '@angular/core';
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
import { SafeResourceUrl, DomSanitizer } from '@angular/platform-browser';
|
import { SafeResourceUrl, DomSanitizer } from '@angular/platform-browser';
|
||||||
import { FaqService } from '@app/core/services/faq/faq.service';
|
|
||||||
import { LanguageService } from '@app/core/services/language/language.service';
|
import { LanguageService } from '@app/core/services/language/language.service';
|
||||||
import { MatomoService } from '@app/core/services/matomo/matomo-service';
|
import { MatomoService } from '@app/core/services/matomo/matomo-service';
|
||||||
|
import { SupportiveMaterialService } from '@app/core/services/supportive-material/supportive-material.service';
|
||||||
import { BaseComponent } from '@common/base/base.component';
|
import { BaseComponent } from '@common/base/base.component';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
import { SupportiveMaterialFieldType } from '@app/core/common/enum/supportive-material-field-type';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-faq-content',
|
selector: 'app-faq-content',
|
||||||
|
@ -19,7 +20,7 @@ export class FaqContentComponent extends BaseComponent implements OnInit {
|
||||||
sanitizedGuideUrl: any;
|
sanitizedGuideUrl: any;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private faqService: FaqService,
|
private supportiveMaterialService: SupportiveMaterialService,
|
||||||
private sanitizer: DomSanitizer,
|
private sanitizer: DomSanitizer,
|
||||||
private languageService: LanguageService,
|
private languageService: LanguageService,
|
||||||
private matomoService: MatomoService
|
private matomoService: MatomoService
|
||||||
|
@ -27,7 +28,7 @@ export class FaqContentComponent extends BaseComponent implements OnInit {
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.matomoService.trackPageView('FAQ');
|
this.matomoService.trackPageView('FAQ');
|
||||||
this.faqService.getFaq(this.languageService.getCurrentLanguage())
|
this.supportiveMaterialService.getMaterial(this.languageService.getCurrentLanguage(), SupportiveMaterialFieldType.faq)
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(response => {
|
.subscribe(response => {
|
||||||
const blob = new Blob([response.body], { type: 'text/html' });
|
const blob = new Blob([response.body], { type: 'text/html' });
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import { Component, OnInit, Input } from '@angular/core';
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
|
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { GlossaryService } from '@app/core/services/glossary/glossary.service';
|
import { SupportiveMaterialFieldType } from '@app/core/common/enum/supportive-material-field-type';
|
||||||
import { LanguageService } from '@app/core/services/language/language.service';
|
import { LanguageService } from '@app/core/services/language/language.service';
|
||||||
import { MatomoService } from '@app/core/services/matomo/matomo-service';
|
import { MatomoService } from '@app/core/services/matomo/matomo-service';
|
||||||
|
import { SupportiveMaterialService } from '@app/core/services/supportive-material/supportive-material.service';
|
||||||
import { BaseComponent } from '@common/base/base.component';
|
import { BaseComponent } from '@common/base/base.component';
|
||||||
import { LangChangeEvent, TranslateService } from '@ngx-translate/core';
|
import { LangChangeEvent, TranslateService } from '@ngx-translate/core';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
@ -21,7 +22,7 @@ export class GlossaryContentComponent extends BaseComponent implements OnInit {
|
||||||
sanitizedGuideUrl: any;
|
sanitizedGuideUrl: any;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private glossaryService: GlossaryService,
|
private supportiveMaterialService: SupportiveMaterialService,
|
||||||
private sanitizer: DomSanitizer,
|
private sanitizer: DomSanitizer,
|
||||||
private languageService: LanguageService,
|
private languageService: LanguageService,
|
||||||
private matomoService: MatomoService,
|
private matomoService: MatomoService,
|
||||||
|
@ -35,7 +36,7 @@ export class GlossaryContentComponent extends BaseComponent implements OnInit {
|
||||||
this.router.navigate(['/reload'], { skipLocationChange: true }).then(() => this.router.navigate(['/glossary']));
|
this.router.navigate(['/reload'], { skipLocationChange: true }).then(() => this.router.navigate(['/glossary']));
|
||||||
|
|
||||||
});
|
});
|
||||||
this.glossaryService.getGlossary(this.languageService.getCurrentLanguage())
|
this.supportiveMaterialService.getMaterial(this.languageService.getCurrentLanguage(), SupportiveMaterialFieldType.glossary)
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(response => {
|
.subscribe(response => {
|
||||||
const blob = new Blob([response.body], { type: 'text/html' });
|
const blob = new Blob([response.body], { type: 'text/html' });
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { SafeResourceUrl, DomSanitizer } from '@angular/platform-browser';
|
import { SafeResourceUrl, DomSanitizer } from '@angular/platform-browser';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
import { SupportiveMaterialFieldType } from '@app/core/common/enum/supportive-material-field-type';
|
||||||
import { LanguageService } from '@app/core/services/language/language.service';
|
import { LanguageService } from '@app/core/services/language/language.service';
|
||||||
import { MatomoService } from '@app/core/services/matomo/matomo-service';
|
import { MatomoService } from '@app/core/services/matomo/matomo-service';
|
||||||
import { TermsOfServiceService } from '@app/core/services/terms-of-service/terms-of-service.service';
|
import { SupportiveMaterialService } from '@app/core/services/supportive-material/supportive-material.service';
|
||||||
import { BaseComponent } from '@common/base/base.component';
|
import { BaseComponent } from '@common/base/base.component';
|
||||||
import { TranslateService, LangChangeEvent } from '@ngx-translate/core';
|
import { TranslateService, LangChangeEvent } from '@ngx-translate/core';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
@ -19,7 +20,7 @@ export class TermsComponent extends BaseComponent implements OnInit {
|
||||||
sanitizedGuideUrl: any;
|
sanitizedGuideUrl: any;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private termsService: TermsOfServiceService,
|
private supportiveMaterialService: SupportiveMaterialService,
|
||||||
private sanitizer: DomSanitizer,
|
private sanitizer: DomSanitizer,
|
||||||
private languageService: LanguageService,
|
private languageService: LanguageService,
|
||||||
private matomoService: MatomoService,
|
private matomoService: MatomoService,
|
||||||
|
@ -32,7 +33,7 @@ export class TermsComponent extends BaseComponent implements OnInit {
|
||||||
this.translate.onLangChange.subscribe((event: LangChangeEvent) => {
|
this.translate.onLangChange.subscribe((event: LangChangeEvent) => {
|
||||||
this.router.navigate(['/reload'], { skipLocationChange: true }).then(() => this.router.navigate(['/terms-and-conditions']));
|
this.router.navigate(['/reload'], { skipLocationChange: true }).then(() => this.router.navigate(['/terms-and-conditions']));
|
||||||
});
|
});
|
||||||
this.termsService.getTermsOfService(this.languageService.getCurrentLanguage())
|
this.supportiveMaterialService.getMaterial(this.languageService.getCurrentLanguage(), SupportiveMaterialFieldType.termsofservice)
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(response => {
|
.subscribe(response => {
|
||||||
const blob = new Blob([response.body], { type: 'text/html' });
|
const blob = new Blob([response.body], { type: 'text/html' });
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { UntypedFormGroup, UntypedFormBuilder } from '@angular/forms';
|
import { UntypedFormGroup, UntypedFormBuilder } from '@angular/forms';
|
||||||
import { BaseComponent } from '@common/base/base.component';
|
import { BaseComponent } from '@common/base/base.component';
|
||||||
import { UserGuideService } from '@app/core/services/user-guide/user-guide.service';
|
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service';
|
import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
@ -13,6 +12,8 @@ import { AuthService } from '@app/core/services/auth/auth.service';
|
||||||
import { LanguageService } from '@app/core/services/language/language.service';
|
import { LanguageService } from '@app/core/services/language/language.service';
|
||||||
import { MatomoService } from '@app/core/services/matomo/matomo-service';
|
import { MatomoService } from '@app/core/services/matomo/matomo-service';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { SupportiveMaterialService } from '@app/core/services/supportive-material/supportive-material.service';
|
||||||
|
import { SupportiveMaterialFieldType } from '@app/core/common/enum/supportive-material-field-type';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-user-guide-editor',
|
selector: 'app-user-guide-editor',
|
||||||
|
@ -23,7 +24,7 @@ export class UserGuideEditorComponent extends BaseComponent implements OnInit {
|
||||||
public formGroup: UntypedFormGroup;
|
public formGroup: UntypedFormGroup;
|
||||||
private formBuilder: UntypedFormBuilder;
|
private formBuilder: UntypedFormBuilder;
|
||||||
|
|
||||||
constructor(private userGuideService: UserGuideService,
|
constructor(private supportiveMaterialService: SupportiveMaterialService,
|
||||||
private uiNotificationService: UiNotificationService,
|
private uiNotificationService: UiNotificationService,
|
||||||
private translate: TranslateService,
|
private translate: TranslateService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
|
@ -40,7 +41,7 @@ export class UserGuideEditorComponent extends BaseComponent implements OnInit {
|
||||||
name: [''],
|
name: [''],
|
||||||
html: ['']
|
html: ['']
|
||||||
});
|
});
|
||||||
this.userGuideService.getUserGuide(this.languageService.getCurrentLanguage()).pipe(takeUntil(this._destroyed)).subscribe(data => {
|
this.supportiveMaterialService.getMaterial(this.languageService.getCurrentLanguage(), SupportiveMaterialFieldType.userguide).pipe(takeUntil(this._destroyed)).subscribe(data => {
|
||||||
const contentDispositionHeader = data.headers.get('Content-Disposition');
|
const contentDispositionHeader = data.headers.get('Content-Disposition');
|
||||||
const filename = contentDispositionHeader.split(';')[1].trim().split('=')[1].replace(/"/g, '');
|
const filename = contentDispositionHeader.split(';')[1].trim().split('=')[1].replace(/"/g, '');
|
||||||
|
|
||||||
|
@ -76,7 +77,7 @@ export class UserGuideEditorComponent extends BaseComponent implements OnInit {
|
||||||
let result = this.parseText(this.formGroup.get('html').value);
|
let result = this.parseText(this.formGroup.get('html').value);
|
||||||
//result = result.replace(/href="#/g, 'class="href" path="');
|
//result = result.replace(/href="#/g, 'class="href" path="');
|
||||||
this.formGroup.get('html').patchValue(result);
|
this.formGroup.get('html').patchValue(result);
|
||||||
this.userGuideService.updateUserGuide(this.formGroup.value).pipe(takeUntil(this._destroyed))
|
this.supportiveMaterialService.persist(this.formGroup.value, "userguide").pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
complete => {
|
complete => {
|
||||||
this.onCallbackSuccess(complete);
|
this.onCallbackSuccess(complete);
|
||||||
|
|
|
@ -2,10 +2,11 @@ import { HttpClient } from '@angular/common/http';
|
||||||
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||||
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
|
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
import { SupportiveMaterialFieldType } from '@app/core/common/enum/supportive-material-field-type';
|
||||||
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
|
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
|
||||||
import { LanguageService } from '@app/core/services/language/language.service';
|
import { LanguageService } from '@app/core/services/language/language.service';
|
||||||
import { MatomoService } from '@app/core/services/matomo/matomo-service';
|
import { MatomoService } from '@app/core/services/matomo/matomo-service';
|
||||||
import { UserGuideService } from '@app/core/services/user-guide/user-guide.service';
|
import { SupportiveMaterialService } from '@app/core/services/supportive-material/supportive-material.service';
|
||||||
import { BaseComponent } from '@common/base/base.component';
|
import { BaseComponent } from '@common/base/base.component';
|
||||||
import { LangChangeEvent, TranslateService } from '@ngx-translate/core';
|
import { LangChangeEvent, TranslateService } from '@ngx-translate/core';
|
||||||
import { interval, Subject } from 'rxjs';
|
import { interval, Subject } from 'rxjs';
|
||||||
|
@ -30,7 +31,7 @@ export class UserGuideContentComponent extends BaseComponent implements OnInit {
|
||||||
@ViewChild('guide') guide: ElementRef;
|
@ViewChild('guide') guide: ElementRef;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private userGuideService: UserGuideService,
|
private supportiveMaterialService: SupportiveMaterialService,
|
||||||
private sanitizer: DomSanitizer,
|
private sanitizer: DomSanitizer,
|
||||||
private languageService: LanguageService,
|
private languageService: LanguageService,
|
||||||
private httpClient: HttpClient,
|
private httpClient: HttpClient,
|
||||||
|
@ -50,7 +51,7 @@ export class UserGuideContentComponent extends BaseComponent implements OnInit {
|
||||||
this.translate.onLangChange.subscribe((event: LangChangeEvent) => {
|
this.translate.onLangChange.subscribe((event: LangChangeEvent) => {
|
||||||
this.router.navigate(['/reload'], { skipLocationChange: true }).then(() => this.router.navigate(['/user-guide']));
|
this.router.navigate(['/reload'], { skipLocationChange: true }).then(() => this.router.navigate(['/user-guide']));
|
||||||
});
|
});
|
||||||
this.userGuideService.getUserGuide(this.languageService.getCurrentLanguage())
|
this.supportiveMaterialService.getMaterial(this.languageService.getCurrentLanguage(), SupportiveMaterialFieldType.userguide)
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(response => {
|
.subscribe(response => {
|
||||||
const blob = new Blob([response.body], { type: 'text/html' });
|
const blob = new Blob([response.body], { type: 'text/html' });
|
||||||
|
|
|
@ -52,19 +52,51 @@
|
||||||
],
|
],
|
||||||
"keycloak": {
|
"keycloak": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"address": null,
|
"address": "http://dev03.local.cite.gr:60201/auth",
|
||||||
"realm": null,
|
"realm": "dmp-development",
|
||||||
"flow": "standard",
|
"flow": "standard",
|
||||||
"clientId": null,
|
"clientId": "dmp_webapp",
|
||||||
"silentCheckSsoRedirectUri": "http://localhost:4200/assets/silent-check-sso.html",
|
"silentCheckSsoRedirectUri": "http://localhost:4200/assets/silent-check-sso.html",
|
||||||
"scope": "openid profile email address phone",
|
"scope": "openid profile email address phone dmp_web",
|
||||||
"clientSecret": null,
|
"clientSecret": null,
|
||||||
"grantType": "code"
|
"grantType": "code"
|
||||||
},
|
},
|
||||||
"zenodoConfiguration": {
|
"loginProviders": {
|
||||||
"clientId": "",
|
"enabled": [1, 2, 3, 4, 5, 6, 7, 8],
|
||||||
"oauthUrl": "https://sandbox.zenodo.org/oauth/authorize",
|
"facebookConfiguration": { "clientId": "" },
|
||||||
"redirectUri": "http://localhost:4200/login/external/zenodo"
|
"googleConfiguration": { "clientId": "524432312250-sc9qsmtmbvlv05r44onl6l93ia3k9deo.apps.googleusercontent.com" },
|
||||||
|
"linkedInConfiguration": {
|
||||||
|
"clientId": "",
|
||||||
|
"oauthUrl": "https://www.linkedin.com/oauth/v2/authorization",
|
||||||
|
"redirectUri": "http://localhost:4200/login/linkedin",
|
||||||
|
"state": "987654321"
|
||||||
|
},
|
||||||
|
"twitterConfiguration": {
|
||||||
|
"clientId": "",
|
||||||
|
"oauthUrl": "https://api.twitter.com/oauth/authenticate"
|
||||||
|
},
|
||||||
|
"b2accessConfiguration": {
|
||||||
|
"clientId": "",
|
||||||
|
"oauthUrl": "https://b2access-integration.fz-juelich.de:443/oauth2-as/oauth2-authz",
|
||||||
|
"redirectUri": "http://localhost:4200/api/oauth/authorized/b2access",
|
||||||
|
"state": ""
|
||||||
|
},
|
||||||
|
"orcidConfiguration": {
|
||||||
|
"clientId": "",
|
||||||
|
"oauthUrl": "https://orcid.org/oauth/authorize",
|
||||||
|
"redirectUri": "http://localhost:4200/login/external/orcid"
|
||||||
|
},
|
||||||
|
"openAireConfiguration": {
|
||||||
|
"clientId": "",
|
||||||
|
"oauthUrl": "",
|
||||||
|
"redirectUri": "",
|
||||||
|
"state": "987654321"
|
||||||
|
},
|
||||||
|
"zenodoConfiguration": {
|
||||||
|
"clientId": "",
|
||||||
|
"oauthUrl": "https://sandbox.zenodo.org/oauth/authorize",
|
||||||
|
"redirectUri": "http://localhost:4200/login/external/zenodo"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"logging": {
|
"logging": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
|
Loading…
Reference in New Issue