diff --git a/goci-interfaces/goci-ui/pom.xml b/goci-interfaces/goci-ui/pom.xml
index 440247fa8..ffc38d691 100644
--- a/goci-interfaces/goci-ui/pom.xml
+++ b/goci-interfaces/goci-ui/pom.xml
@@ -42,7 +42,7 @@
true
-
+
central
Maven Central
default
@@ -71,18 +71,27 @@
org.apache.httpcomponents
httpclient
- 4.5.2
org.springframework.boot
spring-boot-starter-web
- 1.4.1.RELEASE
+
+
+ org.springframework.boot
+ spring-boot-starter-validation
+
+
+ org.springframework.data
+ spring-data-commons
+
+
org.springframework.boot
spring-boot-starter-thymeleaf
+
org.springframework.boot
spring-boot-starter-actuator
@@ -91,8 +100,10 @@
joda-time
joda-time
+ 2.9.1
+
org.apache.commons
commons-lang3
@@ -103,10 +114,10 @@
org.springframework.hateoas
spring-hateoas
-
- org.springframework.data
- spring-data-rest-hal-browser
-
+
+
+
+
org.springframework.boot
@@ -134,21 +145,23 @@
jackson-dataformat-csv
2.9.9
-
- com.fasterxml.jackson.core
- jackson-core
- 2.9.9
-
-
- com.fasterxml.jackson.core
- jackson-databind
- 2.9.9
-
-
- com.fasterxml.jackson.core
- jackson-annotations
- 2.9.9
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/SearchApplication.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/SearchApplication.java
index 6d71bcbc9..21bf4342e 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/SearchApplication.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/SearchApplication.java
@@ -2,7 +2,7 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.web.support.SpringBootServletInitializer;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication(scanBasePackages = "uk.ac.ebi.spot.goci")
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/Doc.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/Doc.java
index caa172635..ca93efb2c 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/Doc.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/Doc.java
@@ -1,15 +1,12 @@
package uk.ac.ebi.spot.goci.model.solr;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
import java.io.Serializable;
import java.util.List;
import java.util.Set;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
//@Builder
@JsonIgnoreProperties(ignoreUnknown = true)
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/Params.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/Params.java
index b8f732da3..7db9d9299 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/Params.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/Params.java
@@ -1,7 +1,6 @@
package uk.ac.ebi.spot.goci.model.solr;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import lombok.AllArgsConstructor;
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/Response.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/Response.java
index 0d76170e2..9812ec466 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/Response.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/Response.java
@@ -1,6 +1,5 @@
package uk.ac.ebi.spot.goci.model.solr;
-import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@@ -8,8 +7,8 @@
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
-import uk.ac.ebi.spot.goci.model.solr.Doc;
-import uk.ac.ebi.spot.goci.refactoring.model.StudyDoc;
+
+import java.util.List;
@Data
@Builder
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/ResponseHeader.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/ResponseHeader.java
index b10711e36..f89cf7278 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/ResponseHeader.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/ResponseHeader.java
@@ -7,7 +7,6 @@
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
-import uk.ac.ebi.spot.goci.model.solr.Params;
@Data
@Builder
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/SolrData.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/SolrData.java
index 7a1344230..6d00e545c 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/SolrData.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/SolrData.java
@@ -1,8 +1,8 @@
package uk.ac.ebi.spot.goci.model.solr;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/SumStatDownloadDto.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/SumStatDownloadDto.java
index caaad871b..82405293a 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/SumStatDownloadDto.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/model/solr/SumStatDownloadDto.java
@@ -7,8 +7,6 @@
import lombok.Data;
import lombok.NoArgsConstructor;
-import java.util.List;
-
@Data
@Builder
@AllArgsConstructor
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/component/EFOTraitIdentifierMap.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/component/EFOTraitIdentifierMap.java
index ec8456023..cae98fe1b 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/component/EFOTraitIdentifierMap.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/component/EFOTraitIdentifierMap.java
@@ -6,7 +6,6 @@
import org.springframework.stereotype.Component;
import uk.ac.ebi.spot.goci.refactoring.service.RestAPIEFOService;
import uk.ac.ebi.spot.goci.ui.SearchConfiguration;
-import uk.ac.ebi.spot.goci.ui.cache.EFOTraitMapperCache;
import java.util.HashMap;
import java.util.Map;
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/component/SumstatsIdentifierMap.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/component/SumstatsIdentifierMap.java
index 71134d91c..10dce6425 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/component/SumstatsIdentifierMap.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/component/SumstatsIdentifierMap.java
@@ -6,7 +6,6 @@
import org.springframework.stereotype.Component;
import uk.ac.ebi.spot.goci.refactoring.service.SumstatsAPIService;
import uk.ac.ebi.spot.goci.ui.SearchConfiguration;
-import uk.ac.ebi.spot.goci.ui.cache.SSMapperCache;
import java.util.HashMap;
import java.util.Map;
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/AssociationSolrDTO.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/AssociationSolrDTO.java
index 11f256227..b1e33035c 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/AssociationSolrDTO.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/AssociationSolrDTO.java
@@ -7,8 +7,8 @@
import lombok.Builder;
import lombok.EqualsAndHashCode;
import org.joda.time.LocalDate;
-import org.springframework.hateoas.ResourceSupport;
-import org.springframework.hateoas.core.Relation;
+import org.springframework.hateoas.RepresentationModel;
+import org.springframework.hateoas.server.core.Relation;
import uk.ac.ebi.spot.goci.refactoring.model.EFOKeyLabel;
import uk.ac.ebi.spot.goci.refactoring.util.JsonJodaLocalDateSerializer;
@@ -21,8 +21,8 @@
@JsonPropertyOrder({"riskAllele","riskFrequency","pValueExponent","pValue","pValueAnnotation","orValue","beta",
"ci","mappedGenes","traitName","efoTraits","bgTraits","locations","author","publicationDate","accessionId","riskAlleleSep",
"chromLocation","pubmedId"})
-@Relation(value = "association", collectionRelation = "associations")
-public class AssociationSolrDTO extends ResourceSupport implements Serializable {
+@Relation(itemRelation = "association", collectionRelation = "associations")
+public class AssociationSolrDTO extends RepresentationModel implements Serializable {
@JsonProperty("riskAllele")
public List riskAllele;
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/AssociationSolrDTOAssembler.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/AssociationSolrDTOAssembler.java
index c7d6137dd..638278d4c 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/AssociationSolrDTOAssembler.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/AssociationSolrDTOAssembler.java
@@ -4,24 +4,22 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.hateoas.Resource;
-import org.springframework.hateoas.ResourceAssembler;
-import org.springframework.hateoas.mvc.ControllerLinkBuilder;
+import org.springframework.hateoas.server.mvc.RepresentationModelAssemblerSupport;
import org.springframework.stereotype.Component;
import uk.ac.ebi.spot.goci.refactoring.model.AssociationDoc;
import uk.ac.ebi.spot.goci.refactoring.model.EFOKeyLabel;
import uk.ac.ebi.spot.goci.refactoring.rest.SolrSearchPublicationController;
import uk.ac.ebi.spot.goci.refactoring.util.SolrEntityTransformerUtility;
import uk.ac.ebi.spot.goci.ui.SearchConfiguration;
-import uk.ac.ebi.spot.goci.ui.constants.SearchUIConstants;
-import uk.ac.ebi.spot.goci.util.BackendUtil;
-import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
+import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
+import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
+
@Component
-public class AssociationSolrDTOAssembler implements ResourceAssembler> {
+public class AssociationSolrDTOAssembler extends RepresentationModelAssemblerSupport {
private static final Logger log = LoggerFactory.getLogger(StudySolrDTOAssembler.class);
@@ -31,20 +29,15 @@ public class AssociationSolrDTOAssembler implements ResourceAssembler toResource(AssociationDoc associationDoc) {
+ public AssociationSolrDTOAssembler() {
+ super(SolrSearchPublicationController.class, AssociationSolrDTO.class);
+ }
+ @Override
+ public AssociationSolrDTO toModel(AssociationDoc associationDoc) {
AssociationSolrDTO associationSolrDTO = assemble(associationDoc);
- try {
- final ControllerLinkBuilder lb = ControllerLinkBuilder.linkTo(
- ControllerLinkBuilder.methodOn(SolrSearchPublicationController.class).searchAssociations(null, "Pmid", null, null));
- Resource resource = new Resource<>(associationSolrDTO);
- resource.add(BackendUtil.underBasePath(lb, searchConfiguration.getProxy_prefix()).withSelfRel());
- return resource;
- } catch(IOException ex ){
- log.error("IO Exception "+ex.getMessage(),ex);
- }
- return null;
+ //associationSolrDTO.add(linkTo(methodOn(SolrSearchPublicationController.class)).withSelfRel());
+ return associationSolrDTO;
}
public AssociationSolrDTO assemble(AssociationDoc associationDoc) {
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/EFOTableExportDTO.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/EFOTableExportDTO.java
index ab0644de5..867473567 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/EFOTableExportDTO.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/EFOTableExportDTO.java
@@ -23,7 +23,6 @@ public class EFOTableExportDTO {
@JsonProperty("associationCount")
private Integer associationCount;
-
public EFOTableExportDTO(@JsonProperty("efoTraits") String efoTraits,
@JsonProperty("reportedTrait") String reportedTrait,
@JsonProperty("associationCount") Integer associationCount) {
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/EFOTraitSolrDTO.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/EFOTraitSolrDTO.java
index 65f4fd9d6..4599e999a 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/EFOTraitSolrDTO.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/EFOTraitSolrDTO.java
@@ -1,11 +1,15 @@
package uk.ac.ebi.spot.goci.refactoring.dto;
+import org.springframework.hateoas.RepresentationModel;
+import org.springframework.hateoas.server.core.Relation;
+
+import java.io.Serializable;
+
+
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Builder;
import lombok.EqualsAndHashCode;
-import org.springframework.hateoas.ResourceSupport;
-import org.springframework.hateoas.core.Relation;
import uk.ac.ebi.spot.goci.refactoring.model.EFOKeyLabel;
import java.io.Serializable;
@@ -13,8 +17,8 @@
@EqualsAndHashCode
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
-@Relation(value = "efoData", collectionRelation = "efos")
-public class EFOTraitSolrDTO extends ResourceSupport implements Serializable {
+@Relation(itemRelation = "efoData", collectionRelation = "efos")
+public class EFOTraitSolrDTO extends RepresentationModel implements Serializable {
@JsonProperty("efoTraits")
private List efoTraits;
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/EFOTraitSolrDTOAssembler.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/EFOTraitSolrDTOAssembler.java
index 508fec5f4..f79c3c95a 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/EFOTraitSolrDTOAssembler.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/EFOTraitSolrDTOAssembler.java
@@ -3,44 +3,47 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.hateoas.Resource;
-import org.springframework.hateoas.ResourceAssembler;
-import org.springframework.hateoas.mvc.ControllerLinkBuilder;
+import org.springframework.hateoas.server.mvc.RepresentationModelAssemblerSupport;
import org.springframework.stereotype.Component;
import uk.ac.ebi.spot.goci.refactoring.model.EFOKeyLabel;
import uk.ac.ebi.spot.goci.refactoring.model.EFOTraitDoc;
import uk.ac.ebi.spot.goci.refactoring.rest.SolrSearchVariantController;
import uk.ac.ebi.spot.goci.ui.SearchConfiguration;
-import uk.ac.ebi.spot.goci.util.BackendUtil;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
+import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
+import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
+
@Component
-public class EFOTraitSolrDTOAssembler implements ResourceAssembler> {
+public class EFOTraitSolrDTOAssembler extends RepresentationModelAssemblerSupport {
private static final Logger log = LoggerFactory.getLogger(EFOTraitSolrDTOAssembler.class);
@Autowired
SearchConfiguration searchConfiguration;
+ public EFOTraitSolrDTOAssembler() {
+ super(SolrSearchVariantController.class, EFOTraitSolrDTO.class);
+ }
+
@Override
- public Resource toResource(EFOTraitDoc efoTraitDoc) {
+ public EFOTraitSolrDTO toModel(EFOTraitDoc efoTraitDoc) {
EFOTraitSolrDTO efoTraitSolrDTO = assemble(efoTraitDoc);
+ efoTraitSolrDTO.add(linkTo(methodOn(SolrSearchVariantController.class)).withSelfRel());
+ return efoTraitSolrDTO;
- try {
- final ControllerLinkBuilder lb = ControllerLinkBuilder.linkTo(
- ControllerLinkBuilder.methodOn(SolrSearchVariantController.class).searchEFOTraits(null, "rs123456", null, null));
- Resource resource = new Resource<>(efoTraitSolrDTO);
- resource.add(BackendUtil.underBasePath(lb, searchConfiguration.getProxy_prefix()).withSelfRel());
- return resource;
- } catch (IOException ex) {
- log.error("IO Exception " + ex.getMessage(), ex);
- }
- return null;
+// try {
+// final ControllerLinkBuilder lb = ControllerLinkBuilder.linkTo(
+// ControllerLinkBuilder.methodOn(SolrSearchVariantController.class).searchEFOTraits(null, "rs123456", null, null));
+// Resource resource = new Resource<>(efoTraitSolrDTO);
+// resource.add(BackendUtil.underBasePath(lb, searchConfiguration.getProxy_prefix()).withSelfRel());
+// return resource;
+// } catch (IOException ex) {
+// log.error("IO Exception " + ex.getMessage(), ex);
+// }
+// return null;
}
public EFOTraitSolrDTO assemble(EFOTraitDoc efoTraitDoc) {
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/StudySolrDTO.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/StudySolrDTO.java
index 230ac8894..85be9fbd0 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/StudySolrDTO.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/StudySolrDTO.java
@@ -6,8 +6,8 @@
import lombok.Builder;
import lombok.EqualsAndHashCode;
import org.joda.time.LocalDate;
-import org.springframework.hateoas.ResourceSupport;
-import org.springframework.hateoas.core.Relation;
+import org.springframework.hateoas.RepresentationModel;
+import org.springframework.hateoas.server.core.Relation;
import uk.ac.ebi.spot.goci.refactoring.model.EFOKeyLabel;
import uk.ac.ebi.spot.goci.refactoring.util.JsonJodaLocalDateSerializer;
@@ -17,8 +17,8 @@
@EqualsAndHashCode
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
-@Relation(value = "study", collectionRelation = "studies")
-public class StudySolrDTO extends ResourceSupport implements Serializable {
+@Relation(itemRelation = "study", collectionRelation = "studies")
+public class StudySolrDTO extends RepresentationModel implements Serializable {
@JsonProperty("accessionId")
private String accessionId;
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/StudySolrDTOAssembler.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/StudySolrDTOAssembler.java
index ef4341014..df2d86a0b 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/StudySolrDTOAssembler.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/dto/StudySolrDTOAssembler.java
@@ -2,21 +2,18 @@
package uk.ac.ebi.spot.goci.refactoring.dto;
import org.apache.commons.lang3.StringUtils;
-import org.joda.time.LocalDate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.hateoas.Resource;
-import org.springframework.hateoas.ResourceAssembler;
-import org.springframework.hateoas.mvc.ControllerLinkBuilder;
+import org.springframework.hateoas.server.mvc.RepresentationModelAssemblerSupport;
import org.springframework.stereotype.Component;
import uk.ac.ebi.spot.goci.refactoring.component.SumstatsIdentifierMap;
import uk.ac.ebi.spot.goci.refactoring.model.EFOKeyLabel;
import uk.ac.ebi.spot.goci.refactoring.model.StudyDoc;
+import uk.ac.ebi.spot.goci.refactoring.rest.SolrSearchPublicationController;
import uk.ac.ebi.spot.goci.refactoring.rest.SolrSearchVariantController;
import uk.ac.ebi.spot.goci.refactoring.util.SolrEntityTransformerUtility;
import uk.ac.ebi.spot.goci.ui.SearchConfiguration;
-import uk.ac.ebi.spot.goci.ui.constants.SearchUIConstants;
import uk.ac.ebi.spot.goci.util.BackendUtil;
import java.io.IOException;
@@ -24,9 +21,12 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
-@Component
-public class StudySolrDTOAssembler implements ResourceAssembler> {
+import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
+import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
+
+@Component
+public class StudySolrDTOAssembler extends RepresentationModelAssemblerSupport {
private static final Logger log = LoggerFactory.getLogger(StudySolrDTOAssembler.class);
//private final static String INITIAL_SAMPLE_DESC_REGEX = "([1-9][0-9]{0,9}(?:,[0-9]{3,5})*)";
@@ -40,22 +40,27 @@ public class StudySolrDTOAssembler implements ResourceAssembler toResource(StudyDoc studyDoc) {
+ public StudySolrDTO toModel(StudyDoc studyDoc) {
StudySolrDTO studySolrDTO = assemble(studyDoc);
-
- try {
- final ControllerLinkBuilder lb = ControllerLinkBuilder.linkTo(
- ControllerLinkBuilder.methodOn(SolrSearchVariantController.class).searchStudies(null, "rsidxxxx", null, null));
- Resource resource = new Resource<>(studySolrDTO);
- resource.add(BackendUtil.underBasePath(lb, searchConfiguration.getProxy_prefix()).withSelfRel());
- return resource;
- } catch(IOException ex ){
- log.error("IO Exception "+ex.getMessage(),ex);
- }
- return null;
+ // studySolrDTO.add(linkTo(methodOn(SolrSearchVariantController.class)).withSelfRel());
+ return studySolrDTO;
+
+// try {
+// final ControllerLinkBuilder lb = ControllerLinkBuilder.linkTo(
+// ControllerLinkBuilder.methodOn(SolrSearchVariantController.class).searchStudies(null, "rsidxxxx", null, null));
+// Resource resource = new Resource<>(studySolrDTO);
+// resource.add(BackendUtil.underBasePath(lb, searchConfiguration.getProxy_prefix()).withSelfRel());
+// return resource;
+// } catch(IOException ex ){
+// log.error("IO Exception "+ex.getMessage(),ex);
+// }
+// return null;
}
public StudySolrDTO assemble(StudyDoc studyDoc ){
@@ -111,7 +116,6 @@ private String getBooleanText(Boolean flag){
public StudyTableExportDTO assembleStudyExport(StudyDoc studyDoc) {
- //log.info("The Accession Id in question is -> "+studyDoc.getAccessionId());
return StudyTableExportDTO.builder()
.accessionId(studyDoc.getAccessionId())
.reportedTrait(studyDoc.getTraitName_s())
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/model/AssociationDoc.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/model/AssociationDoc.java
index b3af40aa5..2eba3c4f4 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/model/AssociationDoc.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/model/AssociationDoc.java
@@ -4,7 +4,6 @@
import uk.ac.ebi.spot.goci.model.solr.Doc;
import java.io.Serializable;
-import java.util.Collection;
import java.util.List;
import java.util.Set;
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/model/PublicationDoc.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/model/PublicationDoc.java
index f3742b69e..5ed41f37a 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/model/PublicationDoc.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/model/PublicationDoc.java
@@ -2,10 +2,6 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
import uk.ac.ebi.spot.goci.model.solr.Doc;
import java.io.Serializable;
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/model/RestApiEFOTraitDoc.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/model/RestApiEFOTraitDoc.java
index a874469e1..0dee45828 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/model/RestApiEFOTraitDoc.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/model/RestApiEFOTraitDoc.java
@@ -8,7 +8,7 @@
import lombok.NoArgsConstructor;
import java.io.Serializable;
-import java.util.List;
+
@Data
@Builder
@AllArgsConstructor
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/model/StudyDoc.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/model/StudyDoc.java
index 2aeccc094..079df46cd 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/model/StudyDoc.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/model/StudyDoc.java
@@ -3,8 +3,8 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import uk.ac.ebi.spot.goci.model.solr.Doc;
+
import java.io.Serializable;
-import java.util.Collection;
import java.util.List;
import java.util.Set;
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/model/SumstatsResponseDoc.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/model/SumstatsResponseDoc.java
index 51a78263f..cb4869147 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/model/SumstatsResponseDoc.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/model/SumstatsResponseDoc.java
@@ -6,6 +6,7 @@
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
+
import java.io.Serializable;
import java.util.List;
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchEFOTraitsController.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchEFOTraitsController.java
index 4d1e4f1ed..1940cd020 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchEFOTraitsController.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchEFOTraitsController.java
@@ -5,11 +5,14 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
+import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
import org.springframework.data.web.PagedResourcesAssembler;
+import org.springframework.data.web.SortDefault;
+import org.springframework.hateoas.CollectionModel;
import org.springframework.hateoas.Link;
-import org.springframework.hateoas.PagedResources;
-import org.springframework.hateoas.mvc.ControllerLinkBuilder;
+import org.springframework.hateoas.MediaTypes;
+import org.springframework.hateoas.PagedModel;
import org.springframework.http.*;
import org.springframework.web.bind.annotation.*;
import uk.ac.ebi.spot.goci.refactoring.dto.AssociationSolrDTO;
@@ -25,7 +28,11 @@
import uk.ac.ebi.spot.goci.util.BackendUtil;
import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+
@RestController
@RequestMapping(value = SearchUIConstants.API_V2+SearchUIConstants.EFOTRAITS)
@@ -62,14 +69,12 @@ public class SolrSearchEFOTraitsController {
@GetMapping(value = "/{efotraitId}/studies", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
- public PagedResources searchStudies(SearchStudyDTO searchStudyDTO,
+ public ResponseEntity> searchStudies(SearchStudyDTO searchStudyDTO,
@PathVariable String efotraitId,
- @RequestParam(value = SearchUIConstants.INCLUDE_CHILD_TRAITS,
- required = false) Boolean includeChildTraits,
- @RequestParam(value = SearchUIConstants.INCLUDE_BG_TRAITS,
- required = false) Boolean includeBgTraits,
+ @RequestParam(value = SearchUIConstants.INCLUDE_CHILD_TRAITS, required = false) Boolean includeChildTraits,
+ @RequestParam(value = SearchUIConstants.INCLUDE_BG_TRAITS, required = false) Boolean includeBgTraits,
@PageableDefault(size = 10, page = 0) Pageable pageable,
- PagedResourcesAssembler assembler) throws IOException {
+ PagedResourcesAssembler assembler) throws IOException {
String query = "";
if(includeChildTraits != null && includeChildTraits) {
Map olsTerms = solrSearchEFOTraitService.getOLSTerms(efotraitId);
@@ -89,27 +94,21 @@ public PagedResources searchStudies(SearchStudyDTO searchStudyDTO,
}
}
- //log.info("Query for EFO Traits is->"+query);
Page pageStudyDocs = solrSearchService.searchStudies(query, pageable, searchStudyDTO);
- final ControllerLinkBuilder lb = ControllerLinkBuilder.linkTo(ControllerLinkBuilder
- .methodOn(SolrSearchEFOTraitsController.class).searchStudies(searchStudyDTO, efotraitId,false, false, pageable, assembler));
- return assembler.toResource(pageStudyDocs, studySolrDTOAssembler,
- new Link(BackendUtil.underBasePath(lb, searchConfiguration.getProxy_prefix()).toUri().toString()));
-
+ PagedModel pagedModel = assembler.toModel(pageStudyDocs, studySolrDTOAssembler);
+ return new ResponseEntity<>(pagedModel, HttpStatus.OK);
}
@GetMapping(value = "/{efotraitId}/associations", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
- public PagedResources searchAssociations(SearchAssociationDTO searchAssociationDTO,
+ public ResponseEntity> searchAssociations(SearchAssociationDTO searchAssociationDTO,
@PathVariable String efotraitId,
- @RequestParam(value = SearchUIConstants.INCLUDE_CHILD_TRAITS,
- required = false) Boolean includeChildTraits,
- @RequestParam(value = SearchUIConstants.INCLUDE_BG_TRAITS,
- required = false) Boolean includeBgTraits,
+ @RequestParam(value = SearchUIConstants.INCLUDE_CHILD_TRAITS, required = false) Boolean includeChildTraits,
+ @RequestParam(value = SearchUIConstants.INCLUDE_BG_TRAITS, required = false) Boolean includeBgTraits,
@PageableDefault(size = 10, page = 0) Pageable pageable,
- PagedResourcesAssembler assembler) throws IOException {
+ PagedResourcesAssembler assembler) throws IOException {
String query = "";
if(includeChildTraits != null && includeChildTraits) {
Map olsTerms = solrSearchEFOTraitService.getOLSTerms(efotraitId);
@@ -126,10 +125,8 @@ public PagedResources searchAssociations(SearchAssociationDT
log.info("Query for EFO Traits is->"+query);
Page pageAssociationDocs = solrSearchAssociationService.searchAssociations(query, pageable, searchAssociationDTO );
- final ControllerLinkBuilder lb = ControllerLinkBuilder.linkTo(ControllerLinkBuilder
- .methodOn(SolrSearchEFOTraitsController.class).searchAssociations(searchAssociationDTO, efotraitId,false, false, pageable, assembler));
- return assembler.toResource(pageAssociationDocs, associationSolrDTOAssembler,
- new Link(BackendUtil.underBasePath(lb, searchConfiguration.getProxy_prefix()).toUri().toString()));
+ PagedModel pagedModel = assembler.toModel(pageAssociationDocs, associationSolrDTOAssembler);
+ return new ResponseEntity<>(pagedModel, HttpStatus.OK);
}
@GetMapping(value = "/{efotraitId}/traits/children", produces = MediaType.APPLICATION_JSON_VALUE)
@@ -146,13 +143,11 @@ public ResponseEntity> getChildTraits(@PathVariable String efo
@GetMapping(value = "/{efotraitId}/locuszoom/associations", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
- public PagedResources searchLocusAssociations(@PathVariable(value = "efotraitId") String efotraitId,
- @RequestParam(value = SearchUIConstants.INCLUDE_CHILD_TRAITS,
- required = false) Boolean includeChildTraits,
- @RequestParam(value = SearchUIConstants.INCLUDE_BG_TRAITS,
- required = false) Boolean includeBgTraits,
+ public ResponseEntity> searchLocusAssociations(@PathVariable(value = "efotraitId") String efotraitId,
+ @RequestParam(value = SearchUIConstants.INCLUDE_CHILD_TRAITS, required = false) Boolean includeChildTraits,
+ @RequestParam(value = SearchUIConstants.INCLUDE_BG_TRAITS, required = false) Boolean includeBgTraits,
@PageableDefault(size = 10, page = 0) Pageable pageable,
- PagedResourcesAssembler assembler) throws IOException {
+ PagedResourcesAssembler assembler) throws IOException {
String query = "";
if(includeChildTraits != null && includeChildTraits) {
@@ -173,11 +168,8 @@ public PagedResources searchLocusAssociations(@PathVariable(
}
Page pageAssociationDocs = solrSearchEFOTraitService.searchAssociations(query, pageable );
- final ControllerLinkBuilder lb = ControllerLinkBuilder.linkTo(ControllerLinkBuilder
- .methodOn(SolrSearchEFOTraitsController.class).searchLocusAssociations(efotraitId, false, false, pageable, assembler));
- return assembler.toResource(pageAssociationDocs, associationSolrDTOAssembler,
- new Link(BackendUtil.underBasePath(lb, searchConfiguration.getProxy_prefix()).toUri().toString()));
-
+ PagedModel pagedModel = assembler.toModel(pageAssociationDocs, associationSolrDTOAssembler);
+ return new ResponseEntity<>(pagedModel, HttpStatus.OK);
}
@@ -186,10 +178,8 @@ public PagedResources searchLocusAssociations(@PathVariable(
@ResponseBody
public HttpEntity downloadStudies(SearchStudyDTO searchStudyDTO,
@PathVariable String efotraitId,
- @RequestParam(value = SearchUIConstants.INCLUDE_CHILD_TRAITS,
- required = false) Boolean includeChildTraits,
- @RequestParam(value = SearchUIConstants.INCLUDE_BG_TRAITS,
- required = false) Boolean includeBgTraits,
+ @RequestParam(value = SearchUIConstants.INCLUDE_CHILD_TRAITS, required = false) Boolean includeChildTraits,
+ @RequestParam(value = SearchUIConstants.INCLUDE_BG_TRAITS, required = false) Boolean includeBgTraits,
@PageableDefault(size = 10, page = 0) Pageable pageable) throws IOException {
String query = "";
if(includeChildTraits != null && includeChildTraits) {
@@ -224,10 +214,8 @@ public HttpEntity downloadStudies(SearchStudyDTO searchStudyDTO,
@ResponseBody
public HttpEntity downloadAssociations(SearchAssociationDTO searchAssociationDTO,
@PathVariable String efotraitId,
- @RequestParam(value = SearchUIConstants.INCLUDE_CHILD_TRAITS,
- required = false) Boolean includeChildTraits,
- @RequestParam(value = SearchUIConstants.INCLUDE_BG_TRAITS,
- required = false) Boolean includeBgTraits,
+ @RequestParam(value = SearchUIConstants.INCLUDE_CHILD_TRAITS, required = false) Boolean includeChildTraits,
+ @RequestParam(value = SearchUIConstants.INCLUDE_BG_TRAITS, required = false) Boolean includeBgTraits,
@PageableDefault(size = 10, page = 0) Pageable pageable) throws IOException {
String query = "";
if(includeChildTraits != null && includeChildTraits) {
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchGeneController.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchGeneController.java
index 2a6dbbb9c..dd82bccc0 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchGeneController.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchGeneController.java
@@ -7,13 +7,10 @@
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.data.web.PagedResourcesAssembler;
+import org.springframework.hateoas.CollectionModel;
import org.springframework.hateoas.Link;
-import org.springframework.hateoas.PagedResources;
-import org.springframework.hateoas.mvc.ControllerLinkBuilder;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
+import org.springframework.hateoas.PagedModel;
+import org.springframework.http.*;
import org.springframework.web.bind.annotation.*;
import uk.ac.ebi.spot.goci.refactoring.dto.*;
import uk.ac.ebi.spot.goci.refactoring.model.*;
@@ -61,53 +58,44 @@ public class SolrSearchGeneController {
@GetMapping(value = "/{geneId}/studies", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
- public PagedResources searchStudies(SearchStudyDTO searchStudyDTO,
- @PathVariable String geneId,
- @PageableDefault(size = 10, page = 0) Pageable pageable,
- PagedResourcesAssembler assembler) throws IOException {
+ public ResponseEntity> searchStudies(SearchStudyDTO searchStudyDTO,
+ @PathVariable String geneId,
+ @PageableDefault(size = 10, page = 0) Pageable pageable,
+ PagedResourcesAssembler assembler) throws IOException {
String query = solrQueryParamBuilder.buildQueryParam("GENE", geneId);
Page pageStudyDocs = solrSearchService.searchStudies(query, pageable, searchStudyDTO);
- final ControllerLinkBuilder lb = ControllerLinkBuilder.linkTo(ControllerLinkBuilder
- .methodOn(SolrSearchVariantController.class).searchStudies(searchStudyDTO, geneId, pageable, assembler));
- return assembler.toResource(pageStudyDocs, studySolrDTOAssembler,
- new Link(BackendUtil.underBasePath(lb, searchConfiguration.getProxy_prefix()).toUri().toString()));
-
+ PagedModel pagedModel = assembler.toModel(pageStudyDocs, studySolrDTOAssembler);
+ return new ResponseEntity<>(pagedModel, HttpStatus.OK);
}
@GetMapping(value = "/{geneId}/associations", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
- public PagedResources searchAssociations(SearchAssociationDTO searchAssociationDTO,
+ public ResponseEntity> searchAssociations(SearchAssociationDTO searchAssociationDTO,
@PathVariable String geneId,
- @RequestParam(value = SearchUIConstants.INCLUDE_CHILD_TRAITS,
- required = false) Boolean includeChildTraits,
- @RequestParam(value = SearchUIConstants.INCLUDE_BG_TRAITS,
- required = false) Boolean includeBgTraits,
+ @RequestParam(value = SearchUIConstants.INCLUDE_CHILD_TRAITS, required = false) Boolean includeChildTraits,
+ @RequestParam(value = SearchUIConstants.INCLUDE_BG_TRAITS, required = false) Boolean includeBgTraits,
@PageableDefault(size = 10, page = 0) Pageable pageable,
- PagedResourcesAssembler assembler) throws IOException {
+ PagedResourcesAssembler assembler) throws IOException {
String query = solrQueryParamBuilder.buildQueryParam("GENE", geneId);
Page pageAssociationDocs = solrSearchAssociationService.searchAssociations(query, pageable, searchAssociationDTO );
- final ControllerLinkBuilder lb = ControllerLinkBuilder.linkTo(ControllerLinkBuilder
- .methodOn(SolrSearchVariantController.class).searchAssociations(searchAssociationDTO, geneId, pageable, assembler));
- return assembler.toResource(pageAssociationDocs, associationSolrDTOAssembler,
- new Link(BackendUtil.underBasePath(lb, searchConfiguration.getProxy_prefix()).toUri().toString()));
+ PagedModel pagedModel = assembler.toModel(pageAssociationDocs, associationSolrDTOAssembler);
+ return new ResponseEntity<>(pagedModel, HttpStatus.OK);
}
@GetMapping(value = "/{geneId}/traits", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
- public PagedResources searchEFOTraits(SearchEFOTraitDTO searchEFOTraitDTO,
+ public ResponseEntity> searchEFOTraits(SearchEFOTraitDTO searchEFOTraitDTO,
@PathVariable String geneId,
@PageableDefault(size = 10, page = 0) Pageable pageable,
- PagedResourcesAssembler assembler) throws IOException {
+ PagedResourcesAssembler assembler) throws IOException {
String query = solrQueryParamBuilder.buildQueryParam("GENE", geneId);
Page efoTraitDocs = solrSearchEFOTraitsService.searchEFOTraits(searchEFOTraitDTO, query, pageable);
- final ControllerLinkBuilder lb = ControllerLinkBuilder.linkTo(ControllerLinkBuilder
- .methodOn(SolrSearchRegionController.class).searchEFOTraits( searchEFOTraitDTO, geneId, pageable, assembler));
- return assembler.toResource(efoTraitDocs, efoTraitSolrDTOAssembler,
- new Link(BackendUtil.underBasePath(lb, searchConfiguration.getProxy_prefix()).toUri().toString()));
+ PagedModel pagedModel = assembler.toModel(efoTraitDocs, efoTraitSolrDTOAssembler);
+ return new ResponseEntity<>(pagedModel, HttpStatus.OK);
}
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchPublicationController.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchPublicationController.java
index e89cb9990..e8ae35a94 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchPublicationController.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchPublicationController.java
@@ -8,13 +8,9 @@
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.data.web.PagedResourcesAssembler;
-import org.springframework.hateoas.Link;
-import org.springframework.hateoas.PagedResources;
-import org.springframework.hateoas.mvc.ControllerLinkBuilder;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
+import org.springframework.hateoas.CollectionModel;
+import org.springframework.hateoas.PagedModel;
+import org.springframework.http.*;
import org.springframework.web.bind.annotation.*;
import uk.ac.ebi.spot.goci.refactoring.dto.AssociationSolrDTO;
import uk.ac.ebi.spot.goci.refactoring.dto.AssociationSolrDTOAssembler;
@@ -27,12 +23,10 @@
import uk.ac.ebi.spot.goci.refactoring.service.SolrSearchAssociationService;
import uk.ac.ebi.spot.goci.refactoring.service.SolrSearchStudyService;
import uk.ac.ebi.spot.goci.refactoring.service.SolrTableExportService;
-import uk.ac.ebi.spot.goci.refactoring.service.impl.RestInteractionServiceImpl;
import uk.ac.ebi.spot.goci.refactoring.util.FileHandler;
import uk.ac.ebi.spot.goci.refactoring.util.SolrQueryParamBuilder;
import uk.ac.ebi.spot.goci.ui.SearchConfiguration;
import uk.ac.ebi.spot.goci.ui.constants.SearchUIConstants;
-import uk.ac.ebi.spot.goci.util.BackendUtil;
import java.io.IOException;
import java.util.List;
@@ -67,33 +61,29 @@ public class SolrSearchPublicationController {
@GetMapping(value = "/{publicationId}/studies", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
- public PagedResources searchStudies(SearchStudyDTO searchStudyDTO,
- @PathVariable String publicationId,
- @PageableDefault(size = 10, page = 0) Pageable pageable,
- PagedResourcesAssembler assembler) throws IOException {
+ public ResponseEntity> searchStudies(SearchStudyDTO searchStudyDTO,
+ @PathVariable String publicationId,
+ @PageableDefault(size = 10, page = 0) Pageable pageable,
+ PagedResourcesAssembler assembler) throws IOException {
String query = solrQueryParamBuilder.buildQueryParam("PMID", publicationId);
Page pageStudyDocs = solrSearchService.searchStudies(query, pageable, searchStudyDTO);
- final ControllerLinkBuilder lb = ControllerLinkBuilder.linkTo(ControllerLinkBuilder
- .methodOn(SolrSearchVariantController.class).searchStudies(searchStudyDTO, publicationId, pageable, assembler));
- return assembler.toResource(pageStudyDocs, studySolrDTOAssembler,
- new Link(BackendUtil.underBasePath(lb, searchConfiguration.getProxy_prefix()).toUri().toString()));
+
+ PagedModel pagedModel = assembler.toModel(pageStudyDocs, studySolrDTOAssembler);
+ return new ResponseEntity<>(pagedModel, HttpStatus.OK);
}
@GetMapping(value = "/{publicationId}/associations", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
- public PagedResources searchAssociations(SearchAssociationDTO searchAssociationDTO,
+ public ResponseEntity> searchAssociations(SearchAssociationDTO searchAssociationDTO,
@PathVariable String publicationId,
@PageableDefault(size = 10, page = 0) Pageable pageable,
- PagedResourcesAssembler assembler) throws IOException {
+ PagedResourcesAssembler assembler) throws IOException {
log.info(" Inside searchAssociations ");
String query = solrQueryParamBuilder.buildQueryParam("PMID", publicationId);
Page pageStudyAsscns = solrSearchAssociationService.searchAssociations(query,pageable,searchAssociationDTO);
- final ControllerLinkBuilder lb = ControllerLinkBuilder.linkTo(ControllerLinkBuilder
- .methodOn(SolrSearchPublicationController.class).searchAssociations(searchAssociationDTO, publicationId, pageable, assembler));
- return assembler.toResource(pageStudyAsscns, associationSolrDTOAssembler,
- new Link(BackendUtil.underBasePath(lb, searchConfiguration.getProxy_prefix()).toUri().toString()));
-
+ PagedModel pagedModel = assembler.toModel(pageStudyAsscns, associationSolrDTOAssembler);
+ return new ResponseEntity<>(pagedModel, HttpStatus.OK);
}
@GetMapping(value = "/{publicationId}/studies/download", produces = MediaType.MULTIPART_FORM_DATA_VALUE)
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchRegionController.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchRegionController.java
index e0637077f..b8ecc64af 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchRegionController.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchRegionController.java
@@ -5,13 +5,9 @@
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.data.web.PagedResourcesAssembler;
-import org.springframework.hateoas.Link;
-import org.springframework.hateoas.PagedResources;
-import org.springframework.hateoas.mvc.ControllerLinkBuilder;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
+import org.springframework.hateoas.CollectionModel;
+import org.springframework.hateoas.PagedModel;
+import org.springframework.http.*;
import org.springframework.web.bind.annotation.*;
import uk.ac.ebi.spot.goci.refactoring.dto.*;
import uk.ac.ebi.spot.goci.refactoring.model.*;
@@ -20,7 +16,6 @@
import uk.ac.ebi.spot.goci.refactoring.util.SolrQueryParamBuilder;
import uk.ac.ebi.spot.goci.ui.SearchConfiguration;
import uk.ac.ebi.spot.goci.ui.constants.SearchUIConstants;
-import uk.ac.ebi.spot.goci.util.BackendUtil;
import java.io.IOException;
import java.util.List;
@@ -59,10 +54,10 @@ public class SolrSearchRegionController {
@GetMapping(value = "/{regionId}/associations", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
- public PagedResources searchAssociations(SearchAssociationDTO searchAssociationDTO,
- @PathVariable String regionId,
- @PageableDefault(size = 10, page = 0) Pageable pageable,
- PagedResourcesAssembler assembler) throws IOException {
+ public ResponseEntity> searchAssociations(SearchAssociationDTO searchAssociationDTO,
+ @PathVariable String regionId,
+ @PageableDefault(size = 10, page = 0) Pageable pageable,
+ PagedResourcesAssembler assembler) throws IOException {
String query = "";
if(solrQueryParamBuilder.checkCytoBandPattern(regionId)) {
query = regionId;
@@ -70,20 +65,17 @@ public PagedResources searchAssociations(SearchAssociationDT
query = solrQueryParamBuilder.buildQueryParam("REGION", regionId);
}
Page pageAsssns = solrSearchAssociationService.searchAssociations(query, pageable, searchAssociationDTO);
- final ControllerLinkBuilder lb = ControllerLinkBuilder.linkTo(ControllerLinkBuilder
- .methodOn(SolrSearchRegionController.class).searchAssociations(searchAssociationDTO, regionId, pageable, assembler));
- return assembler.toResource(pageAsssns, associationSolrDTOAssembler,
- new Link(BackendUtil.underBasePath(lb, searchConfiguration.getProxy_prefix()).toUri().toString()));
-
+ PagedModel pagedModel = assembler.toModel(pageAsssns, associationSolrDTOAssembler);
+ return new ResponseEntity<>(pagedModel, HttpStatus.OK);
}
@GetMapping(value = "/{regionId}/studies", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
- public PagedResources searchStudies(SearchStudyDTO searchStudyDTO,
+ public ResponseEntity> searchStudies(SearchStudyDTO searchStudyDTO,
@PathVariable String regionId,
@PageableDefault(size = 10, page = 0) Pageable pageable,
- PagedResourcesAssembler assembler) throws IOException {
+ PagedResourcesAssembler assembler) throws IOException {
String query = "";
if(solrQueryParamBuilder.checkCytoBandPattern(regionId)) {
query = regionId;
@@ -94,20 +86,17 @@ public PagedResources searchStudies(SearchStudyDTO searchStudyDTO,
query = solrQueryParamBuilder.buildAccessionIdQueryParam(accIds);
}
Page pageStudyDocs = solrSearchService.searchStudies(query, pageable, searchStudyDTO);
- final ControllerLinkBuilder lb = ControllerLinkBuilder.linkTo(ControllerLinkBuilder
- .methodOn(SolrSearchRegionController.class).searchStudies(searchStudyDTO, regionId, pageable, assembler));
- return assembler.toResource(pageStudyDocs, studySolrDTOAssembler,
- new Link(BackendUtil.underBasePath(lb, searchConfiguration.getProxy_prefix()).toUri().toString()));
-
-
+ PagedModel pagedModel = assembler.toModel(pageStudyDocs, studySolrDTOAssembler);
+ return new ResponseEntity<>(pagedModel, HttpStatus.OK);
}
+
@GetMapping(value = "/{regionId}/traits", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
- public PagedResources searchEFOTraits(SearchEFOTraitDTO searchEFOTraitDTO,
+ public ResponseEntity> searchEFOTraits(SearchEFOTraitDTO searchEFOTraitDTO,
@PathVariable String regionId,
@PageableDefault(size = 10, page = 0) Pageable pageable,
- PagedResourcesAssembler assembler) throws IOException {
+ PagedResourcesAssembler assembler) throws IOException {
String query = "";
if(solrQueryParamBuilder.checkCytoBandPattern(regionId)) {
query = regionId;
@@ -115,10 +104,8 @@ public PagedResources searchEFOTraits(SearchEFOTraitDTO searchE
query = solrQueryParamBuilder.buildQueryParam("REGION", regionId);
}
Page efoTraitDocs = solrSearchEFOTraitsService.searchEFOTraits(searchEFOTraitDTO, query, pageable);
- final ControllerLinkBuilder lb = ControllerLinkBuilder.linkTo(ControllerLinkBuilder
- .methodOn(SolrSearchRegionController.class).searchEFOTraits( searchEFOTraitDTO, regionId, pageable, assembler));
- return assembler.toResource(efoTraitDocs, efoTraitSolrDTOAssembler,
- new Link(BackendUtil.underBasePath(lb, searchConfiguration.getProxy_prefix()).toUri().toString()));
+ PagedModel pagedModel = assembler.toModel(efoTraitDocs, efoTraitSolrDTOAssembler);
+ return new ResponseEntity<>(pagedModel, HttpStatus.OK);
}
@GetMapping(value = "/{regionId}/studies/download", produces = MediaType.MULTIPART_FORM_DATA_VALUE)
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchStudiesController.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchStudiesController.java
index 24f3c24bb..c291d8586 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchStudiesController.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchStudiesController.java
@@ -7,13 +7,9 @@
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.data.web.PagedResourcesAssembler;
-import org.springframework.hateoas.Link;
-import org.springframework.hateoas.PagedResources;
-import org.springframework.hateoas.mvc.ControllerLinkBuilder;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
+import org.springframework.hateoas.CollectionModel;
+import org.springframework.hateoas.PagedModel;
+import org.springframework.http.*;
import org.springframework.web.bind.annotation.*;
import uk.ac.ebi.spot.goci.refactoring.dto.AssociationSolrDTO;
import uk.ac.ebi.spot.goci.refactoring.dto.AssociationSolrDTOAssembler;
@@ -25,7 +21,6 @@
import uk.ac.ebi.spot.goci.refactoring.util.SolrQueryParamBuilder;
import uk.ac.ebi.spot.goci.ui.SearchConfiguration;
import uk.ac.ebi.spot.goci.ui.constants.SearchUIConstants;
-import uk.ac.ebi.spot.goci.util.BackendUtil;
import java.io.IOException;
import java.util.List;
@@ -52,21 +47,17 @@ public class SolrSearchStudiesController {
@GetMapping(value = "/{accessionId}/associations", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
- public PagedResources searchAssociations(SearchAssociationDTO searchAssociationDTO,
- @PathVariable String accessionId,
- @PageableDefault(size = 10, page = 0) Pageable pageable,
- PagedResourcesAssembler assembler) throws IOException {
+ public ResponseEntity> searchAssociations(SearchAssociationDTO searchAssociationDTO,
+ @PathVariable String accessionId,
+ @PageableDefault(size = 10, page = 0) Pageable pageable,
+ PagedResourcesAssembler assembler) throws IOException {
log.info(" Inside searchAssociations ");
String query = solrQueryParamBuilder.buildQueryParam("GCST", accessionId);
Page pageStudyAsscns = solrSearchAssociationService.searchAssociations(query,pageable,searchAssociationDTO);
- final ControllerLinkBuilder lb = ControllerLinkBuilder.linkTo(ControllerLinkBuilder
- .methodOn(SolrSearchPublicationController.class).searchAssociations(searchAssociationDTO, accessionId, pageable, assembler));
- return assembler.toResource(pageStudyAsscns, associationSolrDTOAssembler,
- new Link(BackendUtil.underBasePath(lb, searchConfiguration.getProxy_prefix()).toUri().toString()));
-
+ PagedModel pagedModel = assembler.toModel(pageStudyAsscns, associationSolrDTOAssembler);
+ return new ResponseEntity<>(pagedModel, HttpStatus.OK);
}
-
@GetMapping(value = "/{accessionId}/associations/download", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchSummaryStatsController.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchSummaryStatsController.java
index 1be88d207..0bd4c38bf 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchSummaryStatsController.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchSummaryStatsController.java
@@ -5,13 +5,9 @@
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.data.web.PagedResourcesAssembler;
-import org.springframework.hateoas.Link;
-import org.springframework.hateoas.PagedResources;
-import org.springframework.hateoas.mvc.ControllerLinkBuilder;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
+import org.springframework.hateoas.CollectionModel;
+import org.springframework.hateoas.PagedModel;
+import org.springframework.http.*;
import org.springframework.web.bind.annotation.*;
import uk.ac.ebi.spot.goci.refactoring.dto.StudySolrDTO;
import uk.ac.ebi.spot.goci.refactoring.dto.StudySolrDTOAssembler;
@@ -23,12 +19,9 @@
import uk.ac.ebi.spot.goci.refactoring.util.SolrQueryParamBuilder;
import uk.ac.ebi.spot.goci.ui.SearchConfiguration;
import uk.ac.ebi.spot.goci.ui.constants.SearchUIConstants;
-import uk.ac.ebi.spot.goci.util.BackendUtil;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
@RestController
@RequestMapping(value = SearchUIConstants.API_V2+SearchUIConstants.SUMMARY_STATISTICS)
@@ -51,18 +44,16 @@ public class SolrSearchSummaryStatsController {
@GetMapping(value = "/studies", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
- public PagedResources searchStudies(SearchStudyDTO searchStudyDTO,
- @PageableDefault(size = 10, page = 0) Pageable pageable,
- PagedResourcesAssembler assembler) throws IOException {
+ public ResponseEntity> searchStudies(SearchStudyDTO searchStudyDTO,
+ @PageableDefault(size = 10, page = 0) Pageable pageable,
+ PagedResourcesAssembler assembler) throws IOException {
String query= solrQueryParamBuilder.buildQueryParam("SUMSTATS",null);
//log.info("Query for EFO Traits is->"+query);
Page pageStudyDocs = solrSearchSumstatsService.searchStudies(query, pageable, searchStudyDTO);
- final ControllerLinkBuilder lb = ControllerLinkBuilder.linkTo(ControllerLinkBuilder
- .methodOn(SolrSearchSummaryStatsController.class).searchStudies(searchStudyDTO, pageable, assembler));
- return assembler.toResource(pageStudyDocs, studySolrDTOAssembler,
- new Link(BackendUtil.underBasePath(lb, searchConfiguration.getProxy_prefix()).toUri().toString()));
+ PagedModel pagedModel = assembler.toModel(pageStudyDocs, studySolrDTOAssembler);
+ return new ResponseEntity<>(pagedModel, HttpStatus.OK);
}
@GetMapping(value = "/studies/download", produces = MediaType.MULTIPART_FORM_DATA_VALUE)
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchVariantController.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchVariantController.java
index 61cf53e25..3ebd34d15 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchVariantController.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/rest/SolrSearchVariantController.java
@@ -8,13 +8,9 @@
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.data.web.PagedResourcesAssembler;
-import org.springframework.hateoas.Link;
-import org.springframework.hateoas.PagedResources;
-import org.springframework.hateoas.mvc.ControllerLinkBuilder;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
+import org.springframework.hateoas.CollectionModel;
+import org.springframework.hateoas.PagedModel;
+import org.springframework.http.*;
import org.springframework.web.bind.annotation.*;
import uk.ac.ebi.spot.goci.refactoring.dto.*;
import uk.ac.ebi.spot.goci.refactoring.model.*;
@@ -26,11 +22,9 @@
import uk.ac.ebi.spot.goci.refactoring.util.SolrQueryParamBuilder;
import uk.ac.ebi.spot.goci.ui.SearchConfiguration;
import uk.ac.ebi.spot.goci.ui.constants.SearchUIConstants;
-import uk.ac.ebi.spot.goci.util.BackendUtil;
import java.io.IOException;
import java.util.List;
-import java.util.stream.Collectors;
@RestController
@RequestMapping(value = SearchUIConstants.API_V2+SearchUIConstants.VARIANTS)
@@ -64,54 +58,55 @@ public class SolrSearchVariantController {
@GetMapping(value = "/{variantId}/studies", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
- public PagedResources searchStudies(SearchStudyDTO searchStudyDTO,
- @PathVariable String variantId,
- @PageableDefault(size = 10, page = 0) Pageable pageable,
- PagedResourcesAssembler assembler) throws IOException {
+ public ResponseEntity> searchStudies(SearchStudyDTO searchStudyDTO,
+ @PathVariable String variantId,
+ @PageableDefault(size = 10, page = 0) Pageable pageable,
+ PagedResourcesAssembler assembler) throws IOException {
log.info(" Inside searchStudies ");
String query = solrQueryParamBuilder.buildQueryParam("VARIANT",variantId);
Page pageStudyDocs = solrSearchService.searchStudies(query,pageable,searchStudyDTO);
- final ControllerLinkBuilder lb = ControllerLinkBuilder.linkTo(ControllerLinkBuilder
- .methodOn(SolrSearchVariantController.class).searchStudies(searchStudyDTO, variantId, pageable, assembler));
- return assembler.toResource(pageStudyDocs, studySolrDTOAssembler,
- new Link(BackendUtil.underBasePath(lb, searchConfiguration.getProxy_prefix()).toUri().toString()));
-
+ PagedModel pagedModel = assembler.toModel(pageStudyDocs, studySolrDTOAssembler);
+ return new ResponseEntity<>(pagedModel, HttpStatus.OK);
}
-
@GetMapping(value = "/{variantId}/associations", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
- public PagedResources searchAssociations(SearchAssociationDTO searchAssociationDTO,
+ public ResponseEntity> searchAssociations(SearchAssociationDTO searchAssociationDTO,
@PathVariable String variantId,
@PageableDefault(size = 10, page = 0) Pageable pageable,
- PagedResourcesAssembler assembler) throws IOException {
+ PagedResourcesAssembler assembler) throws IOException {
log.info(" Inside searchAssociations ");
String query = solrQueryParamBuilder.buildQueryParam("VARIANT",variantId);
Page pageAsscnDocs = solrSearchAssociationService.searchAssociations(query, pageable, searchAssociationDTO);
- final ControllerLinkBuilder lb = ControllerLinkBuilder.linkTo(ControllerLinkBuilder
- .methodOn(SolrSearchPublicationController.class).searchAssociations(searchAssociationDTO, variantId, pageable, assembler));
- return assembler.toResource(pageAsscnDocs, associationSolrDTOAssembler,
- new Link(BackendUtil.underBasePath(lb, searchConfiguration.getProxy_prefix()).toUri().toString()));
-
+ PagedModel pagedModel = assembler.toModel(pageAsscnDocs, associationSolrDTOAssembler);
+ return new ResponseEntity<>(pagedModel, HttpStatus.OK);
}
+
+ /*
+AssociationDoc, AssociationSolrDTO
+StudyDoc, StudySolrDTO
+EFOTraitDoc, EFOTraitSolrDTO
+ResponseEntity>
+PagedModel pagedModel = assembler.toModel(pageAssociationDocs, associationSolrDTOAssembler);
+return new ResponseEntity<>(pagedModel, HttpStatus.OK);
+*/
+
+
@GetMapping(value = "/{variantId}/traits", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
- public PagedResources searchEFOTraits(SearchEFOTraitDTO searchEFOTraitDTO,
+ public ResponseEntity> searchEFOTraits(SearchEFOTraitDTO searchEFOTraitDTO,
@PathVariable String variantId,
@PageableDefault(size = 10, page = 0) Pageable pageable,
- PagedResourcesAssembler assembler) throws IOException {
+ PagedResourcesAssembler assembler) throws IOException {
log.info(" Inside searchEFOTraits ");
String query = solrQueryParamBuilder.buildQueryParam("VARIANT",variantId);
- Page efoTraitDocs = solrSearchEFOTraitsService.searchEFOTraits(searchEFOTraitDTO, query, pageable);
- final ControllerLinkBuilder lb = ControllerLinkBuilder.linkTo(ControllerLinkBuilder
- .methodOn(SolrSearchVariantController.class).searchEFOTraits( searchEFOTraitDTO, variantId, pageable, assembler));
- return assembler.toResource(efoTraitDocs, efoTraitSolrDTOAssembler,
- new Link(BackendUtil.underBasePath(lb, searchConfiguration.getProxy_prefix()).toUri().toString()));
-
+ Page efoTraitDocs = solrSearchEFOTraitsService.searchEFOTraits(searchEFOTraitDTO, query, pageable);
+ PagedModel pagedModel = assembler.toModel(efoTraitDocs, efoTraitSolrDTOAssembler);
+ return new ResponseEntity<>(pagedModel, HttpStatus.OK);
}
@GetMapping(value = "/{variantId}/studies/download", produces = MediaType.MULTIPART_FORM_DATA_VALUE)
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/RestAPIEFOService.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/RestAPIEFOService.java
index 94cb26d8f..b022b2d58 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/RestAPIEFOService.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/RestAPIEFOService.java
@@ -1,8 +1,5 @@
package uk.ac.ebi.spot.goci.refactoring.service;
-import uk.ac.ebi.spot.goci.refactoring.model.RestApiEFOTraitDoc;
-
-import java.util.List;
import java.util.Map;
public interface RestAPIEFOService {
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/RestInteractionService.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/RestInteractionService.java
index a97781c2f..f5907d934 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/RestInteractionService.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/RestInteractionService.java
@@ -2,7 +2,6 @@
import org.springframework.util.MultiValueMap;
import uk.ac.ebi.spot.goci.model.solr.SolrData;
-import uk.ac.ebi.spot.goci.refactoring.model.OLSResponseDoc;
import uk.ac.ebi.spot.goci.refactoring.model.OLSTermApiDoc;
import uk.ac.ebi.spot.goci.refactoring.model.RestApiEFOTraitDoc;
import uk.ac.ebi.spot.goci.refactoring.model.SumstatsAPIDoc;
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/SolrSearchAssociationService.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/SolrSearchAssociationService.java
index 156735331..5136796af 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/SolrSearchAssociationService.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/SolrSearchAssociationService.java
@@ -1,12 +1,10 @@
package uk.ac.ebi.spot.goci.refactoring.service;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.util.MultiValueMap;
import uk.ac.ebi.spot.goci.refactoring.model.AssociationDoc;
import uk.ac.ebi.spot.goci.refactoring.model.SearchAssociationDTO;
-import uk.ac.ebi.spot.goci.ui.SearchConfiguration;
public interface SolrSearchAssociationService {
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/SolrSearchEFOTraitsService.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/SolrSearchEFOTraitsService.java
index 4bcf228ef..0f6727353 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/SolrSearchEFOTraitsService.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/SolrSearchEFOTraitsService.java
@@ -4,7 +4,6 @@
import org.springframework.data.domain.Pageable;
import uk.ac.ebi.spot.goci.refactoring.model.AssociationDoc;
import uk.ac.ebi.spot.goci.refactoring.model.EFOTraitDoc;
-import uk.ac.ebi.spot.goci.refactoring.model.SearchAssociationDTO;
import uk.ac.ebi.spot.goci.refactoring.model.SearchEFOTraitDTO;
import java.util.List;
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/impl/SolrSearchEFOTraitServiceImpl.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/impl/SolrSearchEFOTraitServiceImpl.java
index 3b21c65e6..543bcd859 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/impl/SolrSearchEFOTraitServiceImpl.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/impl/SolrSearchEFOTraitServiceImpl.java
@@ -23,7 +23,10 @@
import uk.ac.ebi.spot.goci.ui.SearchConfiguration;
import uk.ac.ebi.spot.goci.ui.constants.SearchUIConstants;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
import java.util.stream.Collectors;
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/impl/SolrSearchEFOTraitsServiceImpl.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/impl/SolrSearchEFOTraitsServiceImpl.java
index 43ef0a79c..2ac7a31e3 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/impl/SolrSearchEFOTraitsServiceImpl.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/impl/SolrSearchEFOTraitsServiceImpl.java
@@ -15,7 +15,10 @@
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
import uk.ac.ebi.spot.goci.model.solr.SolrData;
-import uk.ac.ebi.spot.goci.refactoring.model.*;
+import uk.ac.ebi.spot.goci.refactoring.model.AssociationDoc;
+import uk.ac.ebi.spot.goci.refactoring.model.EFOKeyLabel;
+import uk.ac.ebi.spot.goci.refactoring.model.EFOTraitDoc;
+import uk.ac.ebi.spot.goci.refactoring.model.SearchEFOTraitDTO;
import uk.ac.ebi.spot.goci.refactoring.service.RestInteractionService;
import uk.ac.ebi.spot.goci.refactoring.service.SolrSearchEFOTraitsService;
import uk.ac.ebi.spot.goci.refactoring.util.SolrEntityTransformerUtility;
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/impl/SolrSearchSumstatsServiceImpl.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/impl/SolrSearchSumstatsServiceImpl.java
index f9be6d5bf..86aaf3a8e 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/impl/SolrSearchSumstatsServiceImpl.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/impl/SolrSearchSumstatsServiceImpl.java
@@ -15,7 +15,6 @@
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
import uk.ac.ebi.spot.goci.model.solr.SolrData;
-import uk.ac.ebi.spot.goci.refactoring.model.SearchAssociationDTO;
import uk.ac.ebi.spot.goci.refactoring.model.SearchStudyDTO;
import uk.ac.ebi.spot.goci.refactoring.model.StudyDoc;
import uk.ac.ebi.spot.goci.refactoring.service.RestInteractionService;
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/impl/SumstatsAPIServiceImpl.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/impl/SumstatsAPIServiceImpl.java
index 1a38ea678..a5f6d6ed5 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/impl/SumstatsAPIServiceImpl.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/service/impl/SumstatsAPIServiceImpl.java
@@ -2,7 +2,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import uk.ac.ebi.spot.goci.refactoring.model.Links;
import uk.ac.ebi.spot.goci.refactoring.model.SSDoc;
import uk.ac.ebi.spot.goci.refactoring.model.SumstatsAPIDoc;
import uk.ac.ebi.spot.goci.refactoring.model.SumstatsResponseDoc;
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/util/DateTimeCommon.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/util/DateTimeCommon.java
old mode 100755
new mode 100644
diff --git a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/util/FileHandler.java b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/util/FileHandler.java
index 4bfda05d3..e6443c734 100644
--- a/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/util/FileHandler.java
+++ b/goci-interfaces/goci-ui/src/main/java/uk/ac/ebi/spot/goci/refactoring/util/FileHandler.java
@@ -1,17 +1,13 @@
package uk.ac.ebi.spot.goci.refactoring.util;
import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.MappingIterator;
import com.fasterxml.jackson.dataformat.csv.CsvMapper;
import com.fasterxml.jackson.dataformat.csv.CsvSchema;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import uk.ac.ebi.spot.goci.ui.exception.FileProcessingException;
-
-import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -29,8 +25,7 @@ public class FileHandler {
public byte[] serializePojoToTsv(List> pojoList) {
CsvMapper csvMapper = new CsvMapper();
- List