diff --git a/dmp-backend/web/src/main/java/eu/eudat/cache/ResponsesCache.java b/dmp-backend/web/src/main/java/eu/eudat/cache/ResponsesCache.java index 80da105bc..324f3c91d 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/cache/ResponsesCache.java +++ b/dmp-backend/web/src/main/java/eu/eudat/cache/ResponsesCache.java @@ -32,6 +32,10 @@ public class ResponsesCache { SimpleCacheManager simpleCacheManager = new SimpleCacheManager(); List caches = new ArrayList(); caches.add(new CaffeineCache("repositories", Caffeine.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build())); + caches.add(new CaffeineCache("pubrepos", Caffeine.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build())); + caches.add(new CaffeineCache("journals", Caffeine.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build())); + caches.add(new CaffeineCache("taxonomies", Caffeine.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build())); + caches.add(new CaffeineCache("publications", Caffeine.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build())); caches.add(new CaffeineCache("grants", Caffeine.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build())); caches.add(new CaffeineCache("projects", Caffeine.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build())); caches.add(new CaffeineCache("funders", Caffeine.newBuilder().expireAfterAccess(HOW_MANY, TIME_UNIT).build())); diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/JournalsController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/JournalsController.java new file mode 100644 index 000000000..5f597eb7c --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/JournalsController.java @@ -0,0 +1,45 @@ +package eu.eudat.controllers; + +import eu.eudat.data.entities.DataRepository; +import eu.eudat.logic.managers.DataRepositoryManager; +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.datarepository.DataRepositoryModel; +import eu.eudat.models.data.helpers.responses.ResponseItem; +import eu.eudat.models.data.security.Principal; +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.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + + +@RestController +@CrossOrigin +@RequestMapping(value = {"/api/external/journals"}) +public class JournalsController extends BaseController { + + private DataRepositoryManager dataRepositoryManager; + + @Autowired + public JournalsController(ApiContext apiContext, DataRepositoryManager dataRepositoryManager) { + super(apiContext); + this.dataRepositoryManager = dataRepositoryManager; + } + + @RequestMapping(method = RequestMethod.GET, produces = "application/json") + public @ResponseBody + ResponseEntity>> listExternalDataRepositories( + @RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type, Principal principal + ) throws HugeResultSet, NoURLFound { + List dataRepositoryModels = this.dataRepositoryManager.getJournals(query, type, principal); + return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(dataRepositoryModels)); + } + + +} + diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/PubRepositoriesController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/PubRepositoriesController.java new file mode 100644 index 000000000..12b0558b9 --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/PubRepositoriesController.java @@ -0,0 +1,43 @@ +package eu.eudat.controllers; + +import eu.eudat.logic.managers.DataRepositoryManager; +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.datarepository.DataRepositoryModel; +import eu.eudat.models.data.helpers.responses.ResponseItem; +import eu.eudat.models.data.security.Principal; +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(value = {"/api/external/pubrepos"}) +public class PubRepositoriesController extends BaseController { + + private DataRepositoryManager dataRepositoryManager; + + @Autowired + public PubRepositoriesController(ApiContext apiContext, DataRepositoryManager dataRepositoryManager) { + super(apiContext); + this.dataRepositoryManager = dataRepositoryManager; + } + + @RequestMapping(method = RequestMethod.GET, produces = "application/json") + public @ResponseBody + ResponseEntity>> listExternalDataRepositories( + @RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type, Principal principal + ) throws HugeResultSet, NoURLFound { + List dataRepositoryModels = this.dataRepositoryManager.getPubRepositories(query, type, principal); + return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(dataRepositoryModels)); + } + + +} + diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/PublicationsController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/PublicationsController.java new file mode 100644 index 000000000..578cd9cbe --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/PublicationsController.java @@ -0,0 +1,41 @@ +package eu.eudat.controllers; + +import eu.eudat.logic.managers.PublicationManager; +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.publication.PublicationModel; +import eu.eudat.models.data.security.Principal; +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(value = {"/api/external/publications"}) +public class PublicationsController extends BaseController { + + private PublicationManager publicationManager; + + @Autowired + public PublicationsController(ApiContext apiContext, PublicationManager publicationManager) { + super(apiContext); + this.publicationManager = publicationManager; + } + + @RequestMapping(method = RequestMethod.GET, produces = "application/json") + public @ResponseBody + ResponseEntity>> listExternalPublications( + @RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type, Principal principal + ) throws HugeResultSet, NoURLFound { + List publicationModels = this.publicationManager.getPublications(query, type); + return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(publicationModels)); + } +} + diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/TaxonomiesController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/TaxonomiesController.java new file mode 100644 index 000000000..a9f722e90 --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/TaxonomiesController.java @@ -0,0 +1,41 @@ +package eu.eudat.controllers; + +import eu.eudat.logic.managers.TaxonomyManager; +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.models.data.taxonomy.TaxonomyModel; +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(value = {"/api/external/taxonomies"}) +public class TaxonomiesController extends BaseController { + + private TaxonomyManager taxonomyManager; + + @Autowired + public TaxonomiesController(ApiContext apiContext, TaxonomyManager taxonomyManager) { + super(apiContext); + this.taxonomyManager = taxonomyManager; + } + + @RequestMapping(method = RequestMethod.GET, produces = "application/json") + public @ResponseBody + ResponseEntity>> listExternalPublications( + @RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type, Principal principal + ) throws HugeResultSet, NoURLFound { + List taxonomyModels = this.taxonomyManager.getTaxonomies(query, type); + return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(taxonomyModels)); + } +} + diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataRepositoryManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataRepositoryManager.java index 31634fe0c..2a45bc6ba 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataRepositoryManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DataRepositoryManager.java @@ -53,6 +53,44 @@ public class DataRepositoryManager { ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); dataRepositoryModels.addAll(remoteRepos.stream().map(item -> mapper.convertValue(item, DataRepositoryModel.class)).collect(Collectors.toList())); + return dataRepositoryModels; + } + public List getPubRepositories(String query, String type, Principal principal) throws HugeResultSet, NoURLFound { + ExternalUrlCriteria externalUrlCriteria = new ExternalUrlCriteria(query); + List> remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().getPubRepositories(externalUrlCriteria, type); + + DataRepositoryCriteria criteria = new DataRepositoryCriteria(); + if (!query.isEmpty()) criteria.setLike(query); + criteria.setCreationUserId(principal.getId()); + + List dataRepositoryModels = new LinkedList<>(); + if (type.equals("")) { + List dataRepositoryList = (this.apiContext.getOperationsContext().getDatabaseRepository().getDataRepositoryDao().getWithCriteria(criteria)).toList(); + dataRepositoryModels = dataRepositoryList.stream().map(item -> new DataRepositoryModel().fromDataModel(item)).collect(Collectors.toList()); + } + + ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + dataRepositoryModels.addAll(remoteRepos.stream().map(item -> mapper.convertValue(item, DataRepositoryModel.class)).collect(Collectors.toList())); + + return dataRepositoryModels; + } + public List getJournals(String query, String type, Principal principal) throws HugeResultSet, NoURLFound { + ExternalUrlCriteria externalUrlCriteria = new ExternalUrlCriteria(query); + List> remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().getJournals(externalUrlCriteria, type); + + DataRepositoryCriteria criteria = new DataRepositoryCriteria(); + if (!query.isEmpty()) criteria.setLike(query); + criteria.setCreationUserId(principal.getId()); + + List dataRepositoryModels = new LinkedList<>(); + if (type.equals("")) { + List dataRepositoryList = (this.apiContext.getOperationsContext().getDatabaseRepository().getDataRepositoryDao().getWithCriteria(criteria)).toList(); + dataRepositoryModels = dataRepositoryList.stream().map(item -> new DataRepositoryModel().fromDataModel(item)).collect(Collectors.toList()); + } + + ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + dataRepositoryModels.addAll(remoteRepos.stream().map(item -> mapper.convertValue(item, DataRepositoryModel.class)).collect(Collectors.toList())); + return dataRepositoryModels; } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetProfileManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetProfileManager.java index 68707978b..0030df516 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetProfileManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/DatasetProfileManager.java @@ -210,7 +210,7 @@ public class DatasetProfileManager { return parseItem(listedItems.get(0)); } if (item instanceof Map) { - return (String) ((Map)item).get("$"); + return String.valueOf(((Map)item).get("$")); } return item != null ? item.toString() : null; } diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/PublicationManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/PublicationManager.java new file mode 100644 index 000000000..6116b62d4 --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/PublicationManager.java @@ -0,0 +1,42 @@ +package eu.eudat.logic.managers; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import eu.eudat.data.dao.criteria.DataRepositoryCriteria; +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.models.data.publication.PublicationModel; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Component +public class PublicationManager { + private ApiContext apiContext; + + @Autowired + public PublicationManager(ApiContext apiContext) { + this.apiContext = apiContext; + } + + public List getPublications(String query, String type) throws HugeResultSet, NoURLFound { + ExternalUrlCriteria externalUrlCriteria = new ExternalUrlCriteria(query); + List> remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().getPublications(externalUrlCriteria, type); + + DataRepositoryCriteria criteria = new DataRepositoryCriteria(); + if (!query.isEmpty()) criteria.setLike(query); + + List publicationModels = new LinkedList<>(); + + ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + publicationModels.addAll(remoteRepos.stream().map(item -> mapper.convertValue(item, PublicationModel.class)).collect(Collectors.toList())); +// publicationModels = publicationModels.stream().filter(publicationModel -> publicationModel.getName().toLowerCase().contains(query.toLowerCase())).collect(Collectors.toList()); + return publicationModels; + } +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/TaxonomyManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/TaxonomyManager.java new file mode 100644 index 000000000..978b88e00 --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/TaxonomyManager.java @@ -0,0 +1,43 @@ +package eu.eudat.logic.managers; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import eu.eudat.data.dao.criteria.DataRepositoryCriteria; +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.models.data.taxonomy.TaxonomyModel; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + + +@Component +public class TaxonomyManager { + private ApiContext apiContext; + + @Autowired + public TaxonomyManager(ApiContext apiContext) { + this.apiContext = apiContext; + } + + public List getTaxonomies(String query, String type) throws HugeResultSet, NoURLFound { + ExternalUrlCriteria externalUrlCriteria = new ExternalUrlCriteria(query); + List> remoteRepos = this.apiContext.getOperationsContext().getRemoteFetcher().getTaxonomies(externalUrlCriteria, type); + + DataRepositoryCriteria criteria = new DataRepositoryCriteria(); + if (!query.isEmpty()) criteria.setLike(query); + + List taxonomyModels = new LinkedList<>(); + + ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + taxonomyModels.addAll(remoteRepos.stream().map(item -> mapper.convertValue(item, TaxonomyModel.class)).collect(Collectors.toList())); + taxonomyModels = taxonomyModels.stream().filter(licenseModel -> licenseModel.getName().toLowerCase().contains(query.toLowerCase())).collect(Collectors.toList()); + return taxonomyModels; + } +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/ExternalUrls.java b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/ExternalUrls.java index 7a008d853..e4f90e7a7 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/ExternalUrls.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/ExternalUrls.java @@ -5,7 +5,6 @@ import eu.eudat.logic.proxy.config.entities.*; import eu.eudat.logic.proxy.config.prefilling.PrefillingConfigMapAdapter; import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import java.io.Serializable; @@ -22,6 +21,10 @@ public class ExternalUrls implements Serializable { ProjectUrls projects; RegistryUrls registries; RepositoryUrls repositories; + PubRepositoryUrls pubRepositories; + JournalUrls journals; + TaxonomiesUrls taxonomies; + PublicationsUrls publications; ServiceUrls services; ResearcherUrls researchers; OrganisationUrls organisations; @@ -52,6 +55,45 @@ public class ExternalUrls implements Serializable { this.repositories = repositories; } + public PubRepositoryUrls getPubRepositories() { + return pubRepositories; + } + + public void setPubRepositories(PubRepositoryUrls pubRepositories) { + this.pubRepositories = pubRepositories; + } + + public void setJournals(JournalUrls journals) { + this.journals = journals; + } + + public JournalUrls getJournals() { + return journals; + } + + public JournalUrls getJournal() { + return journals; + } + @XmlElement(name = "journals") + public void setJournal(JournalUrls journal) { + this.journals = journal; + } + + public TaxonomiesUrls getTaxonomies() { + return taxonomies; + } + @XmlElement(name = "taxonomies") + public void setTaxonomies(TaxonomiesUrls taxonomies) { + this.taxonomies = taxonomies; + } + + public PublicationsUrls getPublications() { + return publications; + } + + public void setPublications(PublicationsUrls publications) { + this.publications = publications; + } public ServiceUrls getServices() { return services; diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/entities/JournalUrls.java b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/entities/JournalUrls.java new file mode 100644 index 000000000..9ed1f2e93 --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/entities/JournalUrls.java @@ -0,0 +1,34 @@ +package eu.eudat.logic.proxy.config.entities; + +import eu.eudat.logic.proxy.config.FetchStrategy; +import eu.eudat.logic.proxy.config.UrlConfiguration; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import java.util.List; + +public class JournalUrls extends GenericUrls{ + + List urls; + FetchStrategy fetchMode; + + public List getUrls() { + return urls; + } + + @XmlElementWrapper + @XmlElement(name = "urlConfig") + public void setUrls(List urls) { + this.urls = urls; + } + + public FetchStrategy getFetchMode() { + return fetchMode; + } + + @XmlElement(name = "fetchMode") + public void setFetchMode(FetchStrategy fetchMode) { + this.fetchMode = fetchMode; + } + +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/entities/PubRepositoryUrls.java b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/entities/PubRepositoryUrls.java new file mode 100644 index 000000000..0ce26719f --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/entities/PubRepositoryUrls.java @@ -0,0 +1,34 @@ +package eu.eudat.logic.proxy.config.entities; + +import eu.eudat.logic.proxy.config.FetchStrategy; +import eu.eudat.logic.proxy.config.UrlConfiguration; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import java.util.List; + +public class PubRepositoryUrls extends GenericUrls{ + + List urls; + FetchStrategy fetchMode; + + public List getUrls() { + return urls; + } + + @XmlElementWrapper + @XmlElement(name = "urlConfig") + public void setUrls(List urls) { + this.urls = urls; + } + + public FetchStrategy getFetchMode() { + return fetchMode; + } + + @XmlElement(name = "fetchMode") + public void setFetchMode(FetchStrategy fetchMode) { + this.fetchMode = fetchMode; + } + +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/entities/PublicationsUrls.java b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/entities/PublicationsUrls.java new file mode 100644 index 000000000..ed4ae0fe0 --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/entities/PublicationsUrls.java @@ -0,0 +1,34 @@ +package eu.eudat.logic.proxy.config.entities; + +import eu.eudat.logic.proxy.config.FetchStrategy; +import eu.eudat.logic.proxy.config.UrlConfiguration; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import java.util.List; + +public class PublicationsUrls extends GenericUrls{ + + List urls; + FetchStrategy fetchMode; + + public List getUrls() { + return urls; + } + + @XmlElementWrapper + @XmlElement(name = "urlConfig") + public void setUrls(List urls) { + this.urls = urls; + } + + public FetchStrategy getFetchMode() { + return fetchMode; + } + + @XmlElement(name = "fetchMode") + public void setFetchMode(FetchStrategy fetchMode) { + this.fetchMode = fetchMode; + } + +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/entities/TaxonomiesUrls.java b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/entities/TaxonomiesUrls.java new file mode 100644 index 000000000..cd205f798 --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/entities/TaxonomiesUrls.java @@ -0,0 +1,34 @@ +package eu.eudat.logic.proxy.config.entities; + +import eu.eudat.logic.proxy.config.FetchStrategy; +import eu.eudat.logic.proxy.config.UrlConfiguration; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import java.util.List; + +public class TaxonomiesUrls extends GenericUrls{ + + List urls; + FetchStrategy fetchMode; + + public List getUrls() { + return urls; + } + + @XmlElementWrapper + @XmlElement(name = "urlConfig") + public void setUrls(List urls) { + this.urls = urls; + } + + public FetchStrategy getFetchMode() { + return fetchMode; + } + + @XmlElement(name = "fetchMode") + public void setFetchMode(FetchStrategy fetchMode) { + this.fetchMode = fetchMode; + } + +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/RemoteFetcher.java b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/RemoteFetcher.java index e19c14aee..71708096b 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/RemoteFetcher.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/RemoteFetcher.java @@ -50,6 +50,38 @@ public class RemoteFetcher { FetchStrategy fetchStrategy = configLoader.getExternalUrls().getRepositories().getFetchMode(); return getAll(urlConfigs, fetchStrategy, externalUrlCriteria); } + @Cacheable(value = "pubrepos", keyGenerator = "externalUrlsKeyGenerator") + public List> getPubRepositories(ExternalUrlCriteria externalUrlCriteria, String key) throws NoURLFound, HugeResultSet { + List urlConfigs = + key != null && !key.isEmpty() ? configLoader.getExternalUrls().getPubRepositories().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList()) + : configLoader.getExternalUrls().getPubRepositories().getUrls(); + FetchStrategy fetchStrategy = configLoader.getExternalUrls().getPubRepositories().getFetchMode(); + return getAll(urlConfigs, fetchStrategy, externalUrlCriteria); + } + @Cacheable(value = "journals", keyGenerator = "externalUrlsKeyGenerator") + public List> getJournals(ExternalUrlCriteria externalUrlCriteria, String key) throws NoURLFound, HugeResultSet { + List urlConfigs = + key != null && !key.isEmpty() ? configLoader.getExternalUrls().getJournals().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList()) + : configLoader.getExternalUrls().getJournals().getUrls(); + FetchStrategy fetchStrategy = configLoader.getExternalUrls().getJournals().getFetchMode(); + return getAll(urlConfigs, fetchStrategy, externalUrlCriteria); + } + @Cacheable(value = "taxonomies", keyGenerator = "externalUrlsKeyGenerator") + public List> getTaxonomies(ExternalUrlCriteria externalUrlCriteria, String key) throws NoURLFound, HugeResultSet { + List urlConfigs = + key != null && !key.isEmpty() ? configLoader.getExternalUrls().getTaxonomies().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList()) + : configLoader.getExternalUrls().getTaxonomies().getUrls(); + FetchStrategy fetchStrategy = configLoader.getExternalUrls().getTaxonomies().getFetchMode(); + return getAll(urlConfigs, fetchStrategy, externalUrlCriteria); + } + @Cacheable(value = "publications", keyGenerator = "externalUrlsKeyGenerator") + public List> getPublications(ExternalUrlCriteria externalUrlCriteria, String key) throws NoURLFound, HugeResultSet { + List urlConfigs = + key != null && !key.isEmpty() ? configLoader.getExternalUrls().getPublications().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList()) + : configLoader.getExternalUrls().getPublications().getUrls(); + FetchStrategy fetchStrategy = configLoader.getExternalUrls().getPublications().getFetchMode(); + return getAll(urlConfigs, fetchStrategy, externalUrlCriteria); + } @Cacheable(value = "grants", keyGenerator = "externalUrlsKeyGenerator") public List> getGrants(ExternalUrlCriteria externalUrlCriteria) throws NoURLFound, HugeResultSet { diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/builders/ModelBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/builders/ModelBuilder.java index 31c4727b2..b0bc60318 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/builders/ModelBuilder.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/builders/ModelBuilder.java @@ -88,6 +88,11 @@ public class ModelBuilder { if (type.equals("datePicker")) return (FieldData) new DatePickerData().fromData(data); if (type.equals("externalDatasets")) return (FieldData) new ExternalDatasetsData().fromData(data); if (type.equals("dataRepositories")) return (FieldData) new DataRepositoriesData().fromData(data); + if (type.equals("pubRepositories")) return (FieldData) new DataRepositoriesData().fromData(data); + if (type.equals("journalRepositories")) return (FieldData) new DataRepositoriesData().fromData(data); + if (type.equals("taxonomies")) return (FieldData) new TaxonomiesData().fromData(data); + if (type.equals("licenses")) return (FieldData) new LicensesData().fromData(data); + if (type.equals("publications")) return (FieldData) new PublicationsData().fromData(data); if (type.equals("registries")) return (FieldData) new RegistriesData().fromData(data); if (type.equals("services")) return (FieldData) new ServicesData().fromData(data); if (type.equals("tags")) return (FieldData) new TagsData().fromData(data); @@ -128,6 +133,11 @@ public class ModelBuilder { if (type.equals("datePicker")) return (FieldData) new DatePickerData().fromData(data); if (type.equals("externalDatasets")) return (FieldData) new ExternalDatasetsData().fromData(data); if (type.equals("dataRepositories")) return (FieldData) new DataRepositoriesData().fromData(data); + if (type.equals("pubRepositories")) return (FieldData) new DataRepositoriesData().fromData(data); + if (type.equals("journalRepositories")) return (FieldData) new DataRepositoriesData().fromData(data); + if (type.equals("taxonomies")) return (FieldData) new TaxonomiesData().fromData(data); + if (type.equals("licenses")) return (FieldData) new LicensesData().fromData(data); + if (type.equals("publications")) return (FieldData) new PublicationsData().fromData(data); if (type.equals("registries")) return (FieldData) new RegistriesData().fromData(data); if (type.equals("services")) return (FieldData) new ServicesData().fromData(data); if (type.equals("tags")) return (FieldData) new TagsData().fromData(data); diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/WordBuilder.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/WordBuilder.java index 1abfd5f98..1a299e244 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/WordBuilder.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/word/WordBuilder.java @@ -328,6 +328,11 @@ public class WordBuilder { case "organizations": case "externalDatasets": case "dataRepositories": + case "pubRepositories": + case "journalRepositories": + case "taxonomies": + case "licenses": + case "publications": case "registries": case "services": case "tags": diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/datasetProfileXml/ExportXmlBuilderDatasetProfile.java b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/datasetProfileXml/ExportXmlBuilderDatasetProfile.java index f818ee50b..c88e39b9b 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/datasetProfileXml/ExportXmlBuilderDatasetProfile.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/utilities/documents/xml/datasetProfileXml/ExportXmlBuilderDatasetProfile.java @@ -300,10 +300,27 @@ public class ExportXmlBuilderDatasetProfile { dataOut.setAttribute("type", externalDatasetsData.getType()); break; case DATA_REPOSITORIES: + case JOURNAL_REPOSITORIES: + case PUB_REPOSITORIES: DataRepositoriesData dataRepositoriesData = (DataRepositoriesData) field.getData(); dataOut.setAttribute("label", dataRepositoriesData.getLabel()); dataOut.setAttribute("multiAutocomplete", dataRepositoriesData.getMultiAutoComplete().toString()); break; + case TAXONOMIES: + TaxonomiesData taxonomiesData = (TaxonomiesData) field.getData(); + dataOut.setAttribute("label", taxonomiesData.getLabel()); + dataOut.setAttribute("multiAutocomplete", taxonomiesData.getMultiAutoComplete().toString()); + break; + case LICENSES: + LicensesData licensesData = (LicensesData) field.getData(); + dataOut.setAttribute("label", licensesData.getLabel()); + dataOut.setAttribute("multiAutocomplete", licensesData.getMultiAutoComplete().toString()); + break; + case PUBLICATIONS: + PublicationsData publicationsData = (PublicationsData) field.getData(); + dataOut.setAttribute("label", publicationsData.getLabel()); + dataOut.setAttribute("multiAutocomplete", publicationsData.getMultiAutoComplete().toString()); + break; case ORGANIZATIONS: OrganizationsData organizationsData = (OrganizationsData) field.getData(); dataOut.setAttribute("label", organizationsData.getLabel()); diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/ViewStyle.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/ViewStyle.java index 96181212a..bfaf52cbd 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/ViewStyle.java +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/ViewStyle.java @@ -32,6 +32,11 @@ public class ViewStyle { DATE_PICKER("datePicker"), EXTERNAL_DATASETS("externalDatasets"), DATA_REPOSITORIES("dataRepositories"), + JOURNAL_REPOSITORIES("journalRepositories"), + PUB_REPOSITORIES("pubRepositories"), + LICENSES("licenses"), + TAXONOMIES("taxonomies"), + PUBLICATIONS("publications"), REGISTRIES("registries"), SERVICES("services"), TAGS("tags"), diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/LicensesData.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/LicensesData.java new file mode 100644 index 000000000..ccfe38a20 --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/LicensesData.java @@ -0,0 +1,58 @@ +package eu.eudat.models.data.components.commons.datafield; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import java.util.HashMap; +import java.util.Map; + +public class LicensesData extends FieldData { + private Boolean multiAutoComplete; + + public Boolean getMultiAutoComplete() { + return multiAutoComplete; + } + + public void setMultiAutoComplete(Boolean multiAutoComplete) { + this.multiAutoComplete = multiAutoComplete; + } + + @Override + public LicensesData fromData(Object data) { + if (data != null) { + this.setLabel((String) ((Map) data).get("label")); + this.setMultiAutoComplete(((Map) data).get("multiAutoComplete") != null && !((Map) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean(((Map) data).get("multiAutoComplete").toString()) : false); + } + return this; + } + + @Override + public Object toData() { + return null; + } + + @Override + public Element toXml(Document doc) { + Element root = doc.createElement("data"); + root.setAttribute("label", this.getLabel()); + if (this.getMultiAutoComplete() != null) { + root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString()); + } + return root; + } + + @Override + public LicensesData fromXml(Element item) { + this.setLabel(item != null ? item.getAttribute("label") : ""); + this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete"))); + return this; + } + + @Override + public Map toMap(Element item) { + HashMap dataMap = new HashMap(); + dataMap.put("label", item != null && item.getAttributes().getLength() > 0? item.getAttribute("label") : ""); + dataMap.put("multiAutoComplete", item != null && item.getAttributes().getLength() > 0 ? item.getAttribute("multiAutocomplete") : false); + return dataMap; + } +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/PublicationsData.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/PublicationsData.java new file mode 100644 index 000000000..491b6d00a --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/PublicationsData.java @@ -0,0 +1,58 @@ +package eu.eudat.models.data.components.commons.datafield; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import java.util.HashMap; +import java.util.Map; + +public class PublicationsData extends FieldData { + private Boolean multiAutoComplete; + + public Boolean getMultiAutoComplete() { + return multiAutoComplete; + } + + public void setMultiAutoComplete(Boolean multiAutoComplete) { + this.multiAutoComplete = multiAutoComplete; + } + + @Override + public PublicationsData fromData(Object data) { + if (data != null) { + this.setLabel((String) ((Map) data).get("label")); + this.setMultiAutoComplete(((Map) data).get("multiAutoComplete") != null && !((Map) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean(((Map) data).get("multiAutoComplete").toString()) : false); + } + return this; + } + + @Override + public Object toData() { + return null; + } + + @Override + public Element toXml(Document doc) { + Element root = doc.createElement("data"); + root.setAttribute("label", this.getLabel()); + if (this.getMultiAutoComplete() != null) { + root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString()); + } + return root; + } + + @Override + public PublicationsData fromXml(Element item) { + this.setLabel(item != null ? item.getAttribute("label") : ""); + this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete"))); + return this; + } + + @Override + public Map toMap(Element item) { + HashMap dataMap = new HashMap(); + dataMap.put("label", item != null && item.getAttributes().getLength() > 0? item.getAttribute("label") : ""); + dataMap.put("multiAutoComplete", item != null && item.getAttributes().getLength() > 0 ? item.getAttribute("multiAutocomplete") : false); + return dataMap; + } +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/TaxonomiesData.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/TaxonomiesData.java new file mode 100644 index 000000000..e568b284f --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/components/commons/datafield/TaxonomiesData.java @@ -0,0 +1,58 @@ +package eu.eudat.models.data.components.commons.datafield; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import java.util.HashMap; +import java.util.Map; + +public class TaxonomiesData extends FieldData { + private Boolean multiAutoComplete; + + public Boolean getMultiAutoComplete() { + return multiAutoComplete; + } + + public void setMultiAutoComplete(Boolean multiAutoComplete) { + this.multiAutoComplete = multiAutoComplete; + } + + @Override + public TaxonomiesData fromData(Object data) { + if (data != null) { + this.setLabel((String) ((Map) data).get("label")); + this.setMultiAutoComplete(((Map) data).get("multiAutoComplete") != null && !((Map) data).get("multiAutoComplete").toString().isEmpty()? Boolean.parseBoolean(((Map) data).get("multiAutoComplete").toString()) : false); + } + return this; + } + + @Override + public Object toData() { + return null; + } + + @Override + public Element toXml(Document doc) { + Element root = doc.createElement("data"); + root.setAttribute("label", this.getLabel()); + if (this.getMultiAutoComplete() != null) { + root.setAttribute("multiAutoComplete", this.getMultiAutoComplete().toString()); + } + return root; + } + + @Override + public TaxonomiesData fromXml(Element item) { + this.setLabel(item != null ? item.getAttribute("label") : ""); + this.setMultiAutoComplete(Boolean.parseBoolean(item.getAttribute("multiAutoComplete"))); + return this; + } + + @Override + public Map toMap(Element item) { + HashMap dataMap = new HashMap(); + dataMap.put("label", item != null && item.getAttributes().getLength() > 0? item.getAttribute("label") : ""); + dataMap.put("multiAutoComplete", item != null && item.getAttributes().getLength() > 0 ? item.getAttribute("multiAutocomplete") : false); + return dataMap; + } +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/publication/PublicationModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/publication/PublicationModel.java new file mode 100644 index 000000000..df71a9a7b --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/publication/PublicationModel.java @@ -0,0 +1,157 @@ +package eu.eudat.models.data.publication; + +import eu.eudat.data.entities.DataRepository; +import eu.eudat.data.entities.UserInfo; +import eu.eudat.models.DataModel; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.UUID; + +public class PublicationModel implements DataModel { + private UUID id; + private List titles; + private List ids; + 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 List getTitles() { + return titles; + } + + public void setTitles(List titles) { + this.titles = titles; + } + + public List getIds() { + return ids; + } + + public void setIds(List ids) { + this.ids = ids; + } + + 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 String getPid() { + return pid; + } + + public void setPid(String pid) { + this.pid = pid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public PublicationModel fromDataModel(DataRepository entity) { + this.setAbbreviation(entity.getAbbreviation()); + this.setName(entity.getLabel()); + + this.setTitles(new ArrayList<>()); + this.getTitles().add(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; + } + + @Override + 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; + } + + @Override + public String getHint() { + return null; + } +} diff --git a/dmp-backend/web/src/main/java/eu/eudat/models/data/taxonomy/TaxonomyModel.java b/dmp-backend/web/src/main/java/eu/eudat/models/data/taxonomy/TaxonomyModel.java new file mode 100644 index 000000000..76de9d55b --- /dev/null +++ b/dmp-backend/web/src/main/java/eu/eudat/models/data/taxonomy/TaxonomyModel.java @@ -0,0 +1,134 @@ +package eu.eudat.models.data.taxonomy; + +import eu.eudat.data.entities.DataRepository; +import eu.eudat.data.entities.UserInfo; +import eu.eudat.models.DataModel; +import java.util.Date; +import java.util.UUID; + +public class TaxonomyModel implements DataModel { + 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 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 String getPid() { + return pid; + } + + public void setPid(String pid) { + this.pid = pid; + } + + @Override + public TaxonomyModel 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; + } + + @Override + 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; + } + + @Override + public String getHint() { + return null; + } +} diff --git a/dmp-backend/web/src/main/resources/externalUrls/ExternalUrls.xml b/dmp-backend/web/src/main/resources/externalUrls/ExternalUrls.xml index c9b9d3cae..59feb1b92 100644 --- a/dmp-backend/web/src/main/resources/externalUrls/ExternalUrls.xml +++ b/dmp-backend/web/src/main/resources/externalUrls/ExternalUrls.xml @@ -496,12 +496,14 @@ - + openairealt2 1 External POST - https://services.openaire.eu/openaire/ds/searchregistered/{page}/{pageSize}?requestSortBy=id&order=ASCENDING + https://services.openaire.eu/openaire/ds/searchdetails/{page}/{pageSize}?requestSortBy=id&order=ASCENDING + 0 application/json - {"officialname": "{like}"} + {"officialname": "{like}", "typology":"data"} $['datasourceInfo'][*] @@ -611,8 +616,153 @@ FIRST - - + + + + + openaire + + 1 + External + POST + https://services.openaire.eu/openaire/ds/searchdetails/{page}/{pageSize}?requestSortBy=id&order=ASCENDING + 0 + application/json + {"officialname": "{like}", "typology":"pubsrepository::institutional"} + + $['datasourceInfo'][*] + + 'id' + 'officialname' + 'count' + + + $['meta']['pagination']['page','pages','count'] + + + openaire + + 1 + External + POST + https://services.openaire.eu/openaire/ds/searchdetails/{page}/{pageSize}?requestSortBy=id&order=ASCENDING + 0 + application/json + {"officialname": "{like}", "typology":"pubsrepository::thematic"} + + $['datasourceInfo'][*] + + 'id' + 'officialname' + 'count' + + + $['meta']['pagination']['page','pages','count'] + + + openaire + + 1 + External + POST + https://services.openaire.eu/openaire/ds/searchdetails/{page}/{pageSize}?requestSortBy=id&order=ASCENDING + 0 + application/json + {"officialname": "{like}", "typology":"pubsrepository::unknown"} + + $['datasourceInfo'][*] + + 'id' + 'officialname' + 'count' + + + $['meta']['pagination']['page','pages','count'] + + + FIRST + + + + + openaire + + 1 + External + POST + https://services.openaire.eu/openaire/ds/searchdetails/{page}/{pageSize}?requestSortBy=id&order=ASCENDING + 0 + application/json + {"officialname": "{like}", "typology":"journal"} + + $['datasourceInfo'][*] + + 'id' + 'officialname' + 'count' + + + $['meta']['pagination']['page','pages','count'] + + + FIRST + + + + + taxonomy + + 1 + External + https://eestore.paas2.uninett.no/api/taxonomy/ + 0 + application/vnd.api+json + + $['data'][*]['attributes'] + + 'pid' + 'name' + 'count' + + + + + + ALL + + + + + openaire + + 1 + External + https://services.openaire.eu/search/v2/api/resources?query=oaftype exact result and {like}&page={page}&size={pageSize}&format=json + 0 + application/json;charset=UTF-8 + + $['results'][*]['result']['metadata']['oaf:entity']['oaf:result'] + + 'originalId' + 'title' + 'count' + + + $['meta']['pagination']['page','pages','count'] + + + FIRST + diff --git a/dmp-frontend/src/app/core/common/enum/dataset-profile-field-view-style.ts b/dmp-frontend/src/app/core/common/enum/dataset-profile-field-view-style.ts index 4344a5eea..93ce46160 100644 --- a/dmp-frontend/src/app/core/common/enum/dataset-profile-field-view-style.ts +++ b/dmp-frontend/src/app/core/common/enum/dataset-profile-field-view-style.ts @@ -10,6 +10,11 @@ export enum DatasetProfileFieldViewStyle { InternalDmpEntities = "internalDmpEntities", ExternalDatasets = "externalDatasets", DataRepositories = "dataRepositories", + PubRepositories = "pubRepositories", + JournalRepositories = "journalRepositories", + Taxonomies = "taxonomies", + Licenses = "licenses", + Publications = "publications", Registries = "registries", Services = "services", Tags = "tags", diff --git a/dmp-frontend/src/app/core/model/dataset-profile-definition/field-data/field-data.ts b/dmp-frontend/src/app/core/model/dataset-profile-definition/field-data/field-data.ts index c1714c52b..e86e386b1 100644 --- a/dmp-frontend/src/app/core/model/dataset-profile-definition/field-data/field-data.ts +++ b/dmp-frontend/src/app/core/model/dataset-profile-definition/field-data/field-data.ts @@ -84,6 +84,18 @@ export interface DataRepositoriesFieldData extends FieldData { multiAutoComplete: boolean; } +export interface TaxonomiesFieldData extends FieldData { + multiAutoComplete: boolean; +} + +export interface LicensesFieldData extends FieldData { + multiAutoComplete: boolean; +} + +export interface PublicationsFieldData extends FieldData { + multiAutoComplete: boolean; +} + export interface RegistriesFieldData extends FieldData { multiAutoComplete: boolean; } diff --git a/dmp-frontend/src/app/core/model/license/license.ts b/dmp-frontend/src/app/core/model/license/license.ts new file mode 100644 index 000000000..9ac8d7ad5 --- /dev/null +++ b/dmp-frontend/src/app/core/model/license/license.ts @@ -0,0 +1,9 @@ +export interface LicenseModel { + id: string; + name: string; + abbreviation: string; + uri: string; + pid: string; + info: string; + source: string; +} diff --git a/dmp-frontend/src/app/core/model/publication/publication.ts b/dmp-frontend/src/app/core/model/publication/publication.ts new file mode 100644 index 000000000..5f4954ddb --- /dev/null +++ b/dmp-frontend/src/app/core/model/publication/publication.ts @@ -0,0 +1,9 @@ +export interface PublicationModel { + id: string; + name: string; + abbreviation: string; + uri: string; + pid: string; + info: string; + source: string; +} diff --git a/dmp-frontend/src/app/core/model/taxonomy/taxonomy.ts b/dmp-frontend/src/app/core/model/taxonomy/taxonomy.ts new file mode 100644 index 000000000..b8be84ca4 --- /dev/null +++ b/dmp-frontend/src/app/core/model/taxonomy/taxonomy.ts @@ -0,0 +1,9 @@ +export interface TaxonomyModel { + id: string; + name: string; + abbreviation: string; + uri: string; + pid: string; + info: string; + source: string; +} diff --git a/dmp-frontend/src/app/core/query/publication/publication-criteria.ts b/dmp-frontend/src/app/core/query/publication/publication-criteria.ts new file mode 100644 index 000000000..c7d7d6b27 --- /dev/null +++ b/dmp-frontend/src/app/core/query/publication/publication-criteria.ts @@ -0,0 +1,4 @@ +import { BaseCriteria } from "../base-criteria"; +export class PublicationCriteria extends BaseCriteria { + public type: string; +} diff --git a/dmp-frontend/src/app/core/query/taxonomy/taxonomy-criteria.ts b/dmp-frontend/src/app/core/query/taxonomy/taxonomy-criteria.ts new file mode 100644 index 000000000..0d94bc701 --- /dev/null +++ b/dmp-frontend/src/app/core/query/taxonomy/taxonomy-criteria.ts @@ -0,0 +1,5 @@ +import { BaseCriteria } from "../base-criteria"; + +export class TaxonomyCriteria extends BaseCriteria { + public type: string; +} diff --git a/dmp-frontend/src/app/core/services/external-sources/external-sources.service.ts b/dmp-frontend/src/app/core/services/external-sources/external-sources.service.ts index dc04b7f3a..7aa2644fd 100644 --- a/dmp-frontend/src/app/core/services/external-sources/external-sources.service.ts +++ b/dmp-frontend/src/app/core/services/external-sources/external-sources.service.ts @@ -13,6 +13,7 @@ import { TagCriteria } from '../../query/tag/tag-criteria'; import { BaseHttpService } from '../http/base-http.service'; import { ConfigurationService } from '../configuration/configuration.service'; import { LicenseCriteria } from '@app/core/query/license/license-criteria'; +import {PublicationCriteria} from "@app/core/query/publication/publication-criteria"; @Injectable() export class ExternalSourcesService { @@ -36,6 +37,18 @@ export class ExternalSourcesService { public searchDatasetRepository(requestItem: RequestItem): Observable { return this.http.get(this.actionUrl + 'datarepos' + '?query=' + requestItem.criteria.like + '&type=' + requestItem.criteria.type, { headers: this.headers }); } + public searchPublicationRepository(requestItem: RequestItem): Observable { + return this.http.get(this.actionUrl + 'pubrepos' + '?query=' + requestItem.criteria.like + '&type=' + requestItem.criteria.type, { headers: this.headers }); + } + public searchJournals(requestItem: RequestItem): Observable { + return this.http.get(this.actionUrl + 'journals' + '?query=' + requestItem.criteria.like + '&type=' + requestItem.criteria.type, { headers: this.headers }); + } + public searchTaxonomies(requestItem: RequestItem): Observable { + return this.http.get(this.actionUrl + 'taxonomies' + '?query=' + requestItem.criteria.like + '&type=' + requestItem.criteria.type, { headers: this.headers }); + } + public searchPublications(requestItem: RequestItem): Observable { + return this.http.get(this.actionUrl + 'publications' + '?query=' + requestItem.criteria.like + '&type=' + requestItem.criteria.type, { headers: this.headers }); + } public searchDatasetService(requestItem: RequestItem): Observable { return this.http.get(this.actionUrl + 'services' + '?query=' + requestItem.criteria.like + '&type=' + requestItem.criteria.type, { headers: this.headers }); diff --git a/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts b/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts index 985806d78..548dde92d 100644 --- a/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts +++ b/dmp-frontend/src/app/core/services/utilities/enum-utils.service.ts @@ -83,6 +83,11 @@ export class EnumUtils { case DatasetProfileFieldViewStyle.DatePicker: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.DATE-PICKER'); case DatasetProfileFieldViewStyle.ExternalDatasets: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.EXTERNAL-DATASETS'); case DatasetProfileFieldViewStyle.DataRepositories: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.DATA-REPOSITORIES'); + case DatasetProfileFieldViewStyle.PubRepositories: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.PUB-REPOSITORIES'); + case DatasetProfileFieldViewStyle.JournalRepositories: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.JOURNALS-REPOSITORIES'); + case DatasetProfileFieldViewStyle.Taxonomies: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.TAXONOMIES'); + case DatasetProfileFieldViewStyle.Licenses: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.LICENSES'); + case DatasetProfileFieldViewStyle.Publications: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.PUBLICATIONS'); case DatasetProfileFieldViewStyle.Registries: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.REGISTRIES'); case DatasetProfileFieldViewStyle.Services: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.SERVICES'); case DatasetProfileFieldViewStyle.Tags: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.TAGS'); @@ -106,6 +111,11 @@ export class EnumUtils { case ViewStyleType.DatePicker: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.DATE-PICKER'); case ViewStyleType.ExternalDatasets: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.EXTERNAL-DATASETS'); case ViewStyleType.DataRepositories: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.DATA-REPOSITORIES'); + case ViewStyleType.PubRepositories: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.PUB-REPOSITORIES'); + case ViewStyleType.JournalRepositories: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.JOURNALS-REPOSITORIES'); + case ViewStyleType.Taxonomies: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.TAXONOMIES'); + case ViewStyleType.Licenses: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.LICENSES'); + case ViewStyleType.Publications: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.PUBLICATIONS'); case ViewStyleType.Registries: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.REGISTRIES'); case ViewStyleType.Services: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.SERVICES'); case ViewStyleType.Tags: return this.language.instant('TYPES.DATASET-PROFILE-FIELD-VIEW-STYLE.TAGS'); diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-data/licenses-data-editor-models.ts b/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-data/licenses-data-editor-models.ts new file mode 100644 index 000000000..42c57b4c4 --- /dev/null +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-data/licenses-data-editor-models.ts @@ -0,0 +1,21 @@ +import { FormGroup } from '@angular/forms'; +import { FieldDataEditorModel } from './field-data-editor-model'; +import { LicensesFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data'; +export class LicensesDataEditorModel extends FieldDataEditorModel { + public label: string; + public multiAutoComplete: boolean; + + buildForm(disabled: boolean = false, skipDisable: Array = []): FormGroup { + const formGroup = this.formBuilder.group({ + label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('ServicesDataEditorModel.label')) }], + multiAutoComplete: [{ value: this.multiAutoComplete, disabled: (disabled && !skipDisable.includes('ServicesDataEditorModel.multiAutoComplete')) }] + }); + return formGroup; + } + + fromModel(item: LicensesFieldData): LicensesDataEditorModel { + this.label = item.label; + this.multiAutoComplete = item.multiAutoComplete; + return this; + } +} diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-data/publications-data-editor-models.ts b/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-data/publications-data-editor-models.ts new file mode 100644 index 000000000..af2c2ebdc --- /dev/null +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-data/publications-data-editor-models.ts @@ -0,0 +1,21 @@ +import { FormGroup } from '@angular/forms'; +import { FieldDataEditorModel } from './field-data-editor-model'; +import { PublicationsFieldData } from '../../../../../core/model/dataset-profile-definition/field-data/field-data'; +export class PublicationsDataEditorModel extends FieldDataEditorModel { + public label: string; + public multiAutoComplete: boolean; + + buildForm(disabled: boolean = false, skipDisable: Array = []): FormGroup { + const formGroup = this.formBuilder.group({ + label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('ServicesDataEditorModel.label')) }], + multiAutoComplete: [{ value: this.multiAutoComplete, disabled: (disabled && !skipDisable.includes('ServicesDataEditorModel.multiAutoComplete')) }] + }); + return formGroup; + } + + fromModel(item: PublicationsFieldData): PublicationsDataEditorModel { + this.label = item.label; + this.multiAutoComplete = item.multiAutoComplete; + return this; + } +} diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-data/taxonomies-data-editor-models.ts b/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-data/taxonomies-data-editor-models.ts new file mode 100644 index 000000000..31a8eef97 --- /dev/null +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-data/taxonomies-data-editor-models.ts @@ -0,0 +1,22 @@ +import { FormGroup } from '@angular/forms'; +import { FieldDataEditorModel } from './field-data-editor-model'; +import {TaxonomiesFieldData} from "@app/core/model/dataset-profile-definition/field-data/field-data"; + +export class TaxonomiesDataEditorModel extends FieldDataEditorModel { + public label: string; + public multiAutoComplete: boolean; + + buildForm(disabled: boolean = false, skipDisable: Array = []): FormGroup { + const formGroup = this.formBuilder.group({ + label: [{ value: this.label, disabled: (disabled && !skipDisable.includes('ServicesDataEditorModel.label')) }], + multiAutoComplete: [{ value: this.multiAutoComplete, disabled: (disabled && !skipDisable.includes('ServicesDataEditorModel.multiAutoComplete')) }] + }); + return formGroup; + } + + fromModel(item: TaxonomiesFieldData): TaxonomiesDataEditorModel { + this.label = item.label; + this.multiAutoComplete = item.multiAutoComplete; + return this; + } +} diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-editor-model.ts b/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-editor-model.ts index ad245c0c1..58159732f 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-editor-model.ts +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/admin/field-editor-model.ts @@ -31,6 +31,9 @@ import { CurrencyDataEditorModel } from './field-data/currency-data-editor-model import { DatasetProfileComboBoxType } from '@app/core/common/enum/dataset-profile-combo-box-type'; import { EditorCustomValidators } from '../editor/custom-validators/editor-custom-validators'; import { ValidationDataEditorModel } from './field-data/validation-data-editor-models'; +import {PublicationsDataEditorModel} from "@app/ui/admin/dataset-profile/admin/field-data/publications-data-editor-models"; +import {LicensesDataEditorModel} from "@app/ui/admin/dataset-profile/admin/field-data/licenses-data-editor-models"; +import {TaxonomiesDataEditorModel} from "@app/ui/admin/dataset-profile/admin/field-data/taxonomies-data-editor-models"; export class FieldEditorModel extends BaseFormModel { @@ -73,6 +76,11 @@ export class FieldEditorModel extends BaseFormModel { if (this.viewStyle.renderStyle === 'datePicker') { this.data = new DatePickerDataEditorModel().fromModel(item.data); } if (this.viewStyle.renderStyle === 'externalDatasets') { this.data = new ExternalDatasetsDataEditorModel().fromModel(item.data); } if (this.viewStyle.renderStyle === 'dataRepositories') { this.data = new DataRepositoriesDataEditorModel().fromModel(item.data); } + if (this.viewStyle.renderStyle === 'pubRepositories') { this.data = new DataRepositoriesDataEditorModel().fromModel(item.data); } + if (this.viewStyle.renderStyle === 'journalRepositories') { this.data = new DataRepositoriesDataEditorModel().fromModel(item.data); } + if (this.viewStyle.renderStyle === 'taxonomies') { this.data = new TaxonomiesDataEditorModel().fromModel(item.data); } + if (this.viewStyle.renderStyle === 'licenses') { this.data = new LicensesDataEditorModel().fromModel(item.data); } + if (this.viewStyle.renderStyle === 'publications') { this.data = new PublicationsDataEditorModel().fromModel(item.data); } if (this.viewStyle.renderStyle === 'registries') { this.data = new RegistriesDataEditorModel().fromModel(item.data); } if (this.viewStyle.renderStyle === 'services') { this.data = new ServicesDataEditorModel().fromModel(item.data); } if (this.viewStyle.renderStyle === 'tags') { this.data = new TagsDataEditorModel().fromModel(item.data); } @@ -111,7 +119,7 @@ export class FieldEditorModel extends BaseFormModel { // //setting up listeners // formGroup.get('viewStyle').valueChanges.subscribe(changes=>{ // // const viewStyleChanges:{cssClass:string, renderStyle: string} = changes; - + // this._removeCustomValidators(formGroup); // this._appendCustomValidators(formGroup); diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/dataset-profile.module.ts b/dmp-frontend/src/app/ui/admin/dataset-profile/dataset-profile.module.ts index b5fd6b6b0..5d4bdf5b1 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/dataset-profile.module.ts +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/dataset-profile.module.ts @@ -54,6 +54,11 @@ import { DatasetProfileTableOfContentsInternalSection } from './table-of-content import {TransitionGroupModule} from "@app/ui/transition-group/transition-group.module"; import { RichTextEditorModule } from "@app/library/rich-text-editor/rich-text-editor.module"; import {DatasetProfileEditorRichTextAreaFieldComponent} from "@app/ui/admin/dataset-profile/editor/components/field-type/rich-textarea/dataset-profile-editor-rich-text-area-field.component"; +import {DatasetProfileEditorTaxonomiesFieldComponent} from "@app/ui/admin/dataset-profile/editor/components/field-type/taxonomies/dataset-profile-editor-taxonomies-field.component"; +import {DatasetProfileEditorLicensesFieldComponent} from "@app/ui/admin/dataset-profile/editor/components/field-type/licenses/dataset-profile-editor-licenses-field.component"; +import {DatasetProfileEditorPublicationsFieldComponent} from "@app/ui/admin/dataset-profile/editor/components/field-type/publications/dataset-profile-editor-publications-field.component"; +import {DatasetProfileEditorJournalRepositoriesFieldComponent} from "@app/ui/admin/dataset-profile/editor/components/field-type/journal-repositories/dataset-profile-editor-journal-repositories-field.component"; +import {DatasetProfileEditorPubRepositoriesFieldComponent} from "@app/ui/admin/dataset-profile/editor/components/field-type/pub-repositories/dataset-profile-editor-pub-repositories-field.component"; @@ -103,6 +108,11 @@ import {DatasetProfileEditorRichTextAreaFieldComponent} from "@app/ui/admin/data ParseStatus, DatasetProfileEditorExternalDatasetsFieldComponent, DatasetProfileEditorDataRepositoriesFieldComponent, + DatasetProfileEditorPubRepositoriesFieldComponent, + DatasetProfileEditorJournalRepositoriesFieldComponent, + DatasetProfileEditorTaxonomiesFieldComponent, + DatasetProfileEditorLicensesFieldComponent, + DatasetProfileEditorPublicationsFieldComponent, DatasetProfileEditorRegistriesFieldComponent, DatasetProfileEditorServicesFieldComponent, DatasetProfileEditorTagsFieldComponent, diff --git a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.html b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.html index 73f3c306a..f12a8eb17 100644 --- a/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.html +++ b/dmp-frontend/src/app/ui/admin/dataset-profile/editor/components/composite-field/dataset-profile-editor-composite-field.component.html @@ -347,6 +347,26 @@ DataRepositories icon {{enumUtils.toDatasetProfileViewTypeString(viewTypeEnum.DataRepositories)}} + + + + +