fix issue

This commit is contained in:
amentis 2023-10-18 13:00:17 +03:00
parent e97479aa03
commit 1cda821d9c
10 changed files with 0 additions and 427 deletions

View File

@ -1,11 +0,0 @@
package eu.eudat.commons.enums;
public enum ExternalReferencesType {
taxonomies,
licenses,
publications,
journals,
pubRepositories,
dataRepositories
}

View File

@ -1,66 +0,0 @@
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));
}
}

View File

@ -1,37 +0,0 @@
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));
}
}

View File

@ -1,41 +0,0 @@
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;
}
}

View File

@ -1,67 +0,0 @@
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;
}
}

View File

@ -1,41 +0,0 @@
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;
}
}

View File

@ -1,41 +0,0 @@
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;
}
}

View File

@ -1,41 +0,0 @@
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;
}
}

View File

@ -1,41 +0,0 @@
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;
}
}

View File

@ -1,41 +0,0 @@
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;
}
}