diff --git a/gemma-web/src/main/java/ubic/gemma/web/services/rest/AnalysisResultSetsWebService.java b/gemma-web/src/main/java/ubic/gemma/web/services/rest/AnalysisResultSetsWebService.java index 66a6877c62..ef9fb22ec0 100644 --- a/gemma-web/src/main/java/ubic/gemma/web/services/rest/AnalysisResultSetsWebService.java +++ b/gemma-web/src/main/java/ubic/gemma/web/services/rest/AnalysisResultSetsWebService.java @@ -51,6 +51,7 @@ import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * Endpoint for {@link ubic.gemma.model.analysis.AnalysisResultSet} @@ -61,18 +62,17 @@ public class AnalysisResultSetsWebService { private static final String TEXT_TAB_SEPARATED_VALUE_Q9_MEDIA_TYPE = MediaTypeUtils.TEXT_TAB_SEPARATED_VALUES_UTF8 + "; q=0.9"; - private final ExpressionAnalysisResultSetService expressionAnalysisResultSetService; - private final ExpressionExperimentService expressionExperimentService; - private final DatabaseEntryService databaseEntryService; - private final ExpressionAnalysisResultSetFileService expressionAnalysisResultSetFileService; + @Autowired + private ExpressionAnalysisResultSetService expressionAnalysisResultSetService; @Autowired - public AnalysisResultSetsWebService( ExpressionAnalysisResultSetService expressionAnalysisResultSetService, ExpressionExperimentService expressionExperimentService, DatabaseEntryService databaseEntryService, ExpressionAnalysisResultSetFileService expressionAnalysisResultSetFileService ) { - this.expressionAnalysisResultSetService = expressionAnalysisResultSetService; - this.expressionExperimentService = expressionExperimentService; - this.databaseEntryService = databaseEntryService; - this.expressionAnalysisResultSetFileService = expressionAnalysisResultSetFileService; - } + private ExpressionExperimentService expressionExperimentService; + + @Autowired + private DatabaseEntryService databaseEntryService; + + @Autowired + private ExpressionAnalysisResultSetFileService expressionAnalysisResultSetFileService; /** * Retrieve all {@link AnalysisResultSet} matching a set of criteria. diff --git a/gemma-web/src/main/java/ubic/gemma/web/services/rest/AnnotationsWebService.java b/gemma-web/src/main/java/ubic/gemma/web/services/rest/AnnotationsWebService.java index 626333fe44..a89bd5bb08 100644 --- a/gemma-web/src/main/java/ubic/gemma/web/services/rest/AnnotationsWebService.java +++ b/gemma-web/src/main/java/ubic/gemma/web/services/rest/AnnotationsWebService.java @@ -68,11 +68,17 @@ public class AnnotationsWebService { private static final String URL_PREFIX = "http://"; - private final OntologyService ontologyService; - private final SearchService searchService; - private final CharacteristicService characteristicService; - private final ExpressionExperimentService expressionExperimentService; - private final TaxonService taxonService; + private OntologyService ontologyService; + private SearchService searchService; + private CharacteristicService characteristicService; + private ExpressionExperimentService expressionExperimentService; + private TaxonService taxonService; + + /** + * Required by spring + */ + public AnnotationsWebService() { + } /** * Constructor for service autowiring diff --git a/gemma-web/src/main/java/ubic/gemma/web/services/rest/DatasetsWebService.java b/gemma-web/src/main/java/ubic/gemma/web/services/rest/DatasetsWebService.java index 38441ae576..086fb59f24 100644 --- a/gemma-web/src/main/java/ubic/gemma/web/services/rest/DatasetsWebService.java +++ b/gemma-web/src/main/java/ubic/gemma/web/services/rest/DatasetsWebService.java @@ -81,18 +81,24 @@ public class DatasetsWebService { private static final String ERROR_DATA_FILE_NOT_AVAILABLE = "Data file for experiment %s can not be created."; private static final String ERROR_DESIGN_FILE_NOT_AVAILABLE = "Design file for experiment %s can not be created."; - private final ExpressionExperimentService service; - private final ExpressionExperimentService expressionExperimentService; - private final ExpressionDataFileService expressionDataFileService; - private final ArrayDesignService arrayDesignService; - private final BioAssayService bioAssayService; - private final ProcessedExpressionDataVectorService processedExpressionDataVectorService; - private final GeneService geneService; - private final SVDService svdService; - private final DifferentialExpressionAnalysisService differentialExpressionAnalysisService; - private final AuditEventService auditEventService; - private final OutlierDetectionService outlierDetectionService; - private final QuantitationTypeService quantitationTypeService; + private ExpressionExperimentService service; + private ExpressionExperimentService expressionExperimentService; + private ExpressionDataFileService expressionDataFileService; + private ArrayDesignService arrayDesignService; + private BioAssayService bioAssayService; + private ProcessedExpressionDataVectorService processedExpressionDataVectorService; + private GeneService geneService; + private SVDService svdService; + private DifferentialExpressionAnalysisService differentialExpressionAnalysisService; + private AuditEventService auditEventService; + private OutlierDetectionService outlierDetectionService; + private QuantitationTypeService quantitationTypeService; + + /** + * Required by spring + */ + public DatasetsWebService() { + } /** * Constructor for service autowiring diff --git a/gemma-web/src/main/java/ubic/gemma/web/services/rest/GeneWebService.java b/gemma-web/src/main/java/ubic/gemma/web/services/rest/GeneWebService.java index d0a8bfe517..41667bc89f 100644 --- a/gemma-web/src/main/java/ubic/gemma/web/services/rest/GeneWebService.java +++ b/gemma-web/src/main/java/ubic/gemma/web/services/rest/GeneWebService.java @@ -53,11 +53,17 @@ @Path("/genes") public class GeneWebService { - private final GeneService geneService; - private final GeneOntologyService geneOntologyService; - private final CompositeSequenceService compositeSequenceService; - private final PhenotypeAssociationManagerService phenotypeAssociationManagerService; - private final GeneCoexpressionSearchService geneCoexpressionSearchService; + private GeneService geneService; + private GeneOntologyService geneOntologyService; + private CompositeSequenceService compositeSequenceService; + private PhenotypeAssociationManagerService phenotypeAssociationManagerService; + private GeneCoexpressionSearchService geneCoexpressionSearchService; + + /** + * Required by spring + */ + public GeneWebService() { + } /** * Constructor for service autowiring diff --git a/gemma-web/src/main/java/ubic/gemma/web/services/rest/PhenotypeWebService.java b/gemma-web/src/main/java/ubic/gemma/web/services/rest/PhenotypeWebService.java index 9f97820d40..02b0896810 100644 --- a/gemma-web/src/main/java/ubic/gemma/web/services/rest/PhenotypeWebService.java +++ b/gemma-web/src/main/java/ubic/gemma/web/services/rest/PhenotypeWebService.java @@ -42,7 +42,13 @@ @Path("/phenotypes") public class PhenotypeWebService { - private final PhenotypeAssociationManagerService phenotypeAssociationManagerService; + private PhenotypeAssociationManagerService phenotypeAssociationManagerService; + + /** + * Required by spring + */ + public PhenotypeWebService() { + } /** * Constructor for service autowiring diff --git a/gemma-web/src/main/java/ubic/gemma/web/services/rest/PlatformsWebService.java b/gemma-web/src/main/java/ubic/gemma/web/services/rest/PlatformsWebService.java index 502b4896f3..f3e3841394 100644 --- a/gemma-web/src/main/java/ubic/gemma/web/services/rest/PlatformsWebService.java +++ b/gemma-web/src/main/java/ubic/gemma/web/services/rest/PlatformsWebService.java @@ -58,11 +58,17 @@ public class PlatformsWebService { private static final Log log = LogFactory.getLog( PlatformsWebService.class.getName() ); private static final String ERROR_ANNOTATION_FILE_NOT_AVAILABLE = "Annotation file for platform %s does not exist or can not be accessed."; - private final GeneService geneService; - private final ArrayDesignService arrayDesignService; - private final ExpressionExperimentService expressionExperimentService; - private final CompositeSequenceService compositeSequenceService; - private final ArrayDesignAnnotationService annotationFileService; + private GeneService geneService; + private ArrayDesignService arrayDesignService; + private ExpressionExperimentService expressionExperimentService; + private CompositeSequenceService compositeSequenceService; + private ArrayDesignAnnotationService annotationFileService; + + /** + * Required by spring + */ + public PlatformsWebService() { + } /** * Constructor for service autowiring diff --git a/gemma-web/src/main/java/ubic/gemma/web/services/rest/RootWebService.java b/gemma-web/src/main/java/ubic/gemma/web/services/rest/RootWebService.java index e2c399e809..b8b82647e7 100644 --- a/gemma-web/src/main/java/ubic/gemma/web/services/rest/RootWebService.java +++ b/gemma-web/src/main/java/ubic/gemma/web/services/rest/RootWebService.java @@ -5,12 +5,14 @@ import io.swagger.v3.oas.annotations.enums.SecuritySchemeType; import io.swagger.v3.oas.annotations.security.SecurityScheme; import io.swagger.v3.oas.models.OpenAPI; +import lombok.Getter; import lombok.Value; import lombok.extern.apachecommons.CommonsLog; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Service; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; +import org.springframework.web.util.UriComponentsBuilder; import ubic.gemma.core.security.authentication.UserManager; import ubic.gemma.model.common.auditAndSecurity.User; import ubic.gemma.model.common.description.ExternalDatabaseValueObject; @@ -56,14 +58,11 @@ public class RootWebService { */ private static final String[] EXTERNAL_DATABASE_NAMES = Settings.getStringArray( "gemma.externalDatabases.featured" ); - private final ExternalDatabaseService externalDatabaseService; - private final UserManager userManager; + @Autowired + private ExternalDatabaseService externalDatabaseService; @Autowired - public RootWebService( ExternalDatabaseService externalDatabaseService, UserManager userManager ) { - this.externalDatabaseService = externalDatabaseService; - this.userManager = userManager; - } + private UserManager userManager; /** * Returns an object with API information. diff --git a/gemma-web/src/main/java/ubic/gemma/web/services/rest/SearchWebService.java b/gemma-web/src/main/java/ubic/gemma/web/services/rest/SearchWebService.java index dc091bcd27..a41ba1971b 100644 --- a/gemma-web/src/main/java/ubic/gemma/web/services/rest/SearchWebService.java +++ b/gemma-web/src/main/java/ubic/gemma/web/services/rest/SearchWebService.java @@ -65,16 +65,12 @@ public class SearchWebService { */ public static final int MAX_SEARCH_RESULTS = 1000; - private final SearchService searchService; - private final TaxonService taxonService; - private final ArrayDesignService arrayDesignService; - @Autowired - public SearchWebService( SearchService searchService, TaxonService taxonService, ArrayDesignService arrayDesignService ) { - this.searchService = searchService; - this.taxonService = taxonService; - this.arrayDesignService = arrayDesignService; - } + private SearchService searchService; + @Autowired + private TaxonService taxonService; + @Autowired + private ArrayDesignService arrayDesignService; /** * Search everything subject to taxon and platform constraints. diff --git a/gemma-web/src/main/java/ubic/gemma/web/services/rest/TaxaWebService.java b/gemma-web/src/main/java/ubic/gemma/web/services/rest/TaxaWebService.java index 6be0d3722b..e85d3db5eb 100644 --- a/gemma-web/src/main/java/ubic/gemma/web/services/rest/TaxaWebService.java +++ b/gemma-web/src/main/java/ubic/gemma/web/services/rest/TaxaWebService.java @@ -61,11 +61,17 @@ public class TaxaWebService { protected static final Log log = LogFactory.getLog( TaxaWebService.class.getName() ); - private final TaxonService taxonService; - private final GeneService geneService; - private final ExpressionExperimentService expressionExperimentService; - private final PhenotypeAssociationManagerService phenotypeAssociationManagerService; - private final ChromosomeService chromosomeService; + private TaxonService taxonService; + private GeneService geneService; + private ExpressionExperimentService expressionExperimentService; + private PhenotypeAssociationManagerService phenotypeAssociationManagerService; + private ChromosomeService chromosomeService; + + /** + * Required by spring + */ + public TaxaWebService() { + } /** * Constructor for service autowiring diff --git a/gemma-web/src/test/java/ubic/gemma/web/services/rest/SearchWebServiceTest.java b/gemma-web/src/test/java/ubic/gemma/web/services/rest/SearchWebServiceTest.java index 90e3f5c084..bf999848a2 100644 --- a/gemma-web/src/test/java/ubic/gemma/web/services/rest/SearchWebServiceTest.java +++ b/gemma-web/src/test/java/ubic/gemma/web/services/rest/SearchWebServiceTest.java @@ -40,8 +40,8 @@ public class SearchWebServiceTest extends AbstractJUnit4SpringContextTests { public static class SearchWebServiceTestContextConfiguration { @Bean - public SearchWebService searchWebService( SearchService searchService, TaxonService taxonService, ArrayDesignService arrayDesignService ) { - return new SearchWebService( searchService, taxonService, arrayDesignService ); + public SearchWebService searchWebService() { + return new SearchWebService(); } @Bean