Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KPMP-5467_upgrade-to-java21 #143

Merged
merged 5 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="bin/main" path="src/main/java">
<classpathentry kind="src" output="bin/test" path="src/test/java">
<attributes>
<attribute name="gradle_scope" value="main"/>
<attribute name="gradle_used_by_scope" value="main,test"/>
<attribute name="gradle_scope" value="test"/>
<attribute name="gradle_used_by_scope" value="test"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/main" path="src/main/resources">
Expand All @@ -12,14 +13,13 @@
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="bin/test" path="src/test/java">
<classpathentry kind="src" output="bin/main" path="src/main/java">
<attributes>
<attribute name="gradle_scope" value="test"/>
<attribute name="gradle_used_by_scope" value="test"/>
<attribute name="test" value="true"/>
<attribute name="gradle_scope" value="main"/>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>
4 changes: 2 additions & 2 deletions .github/workflows/build-gradle-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ jobs:
uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '8'
java-version: '21'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: 7.4
gradle-version: 8.5

- name: Login to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM alpine:3.19.1
FROM --platform=linux/amd64 alpine:3.19.1

RUN apk update
RUN apk add openjdk8
RUN apk add openjdk21

VOLUME /tmp
ARG DEPENDENCY=target/dependency
Expand Down
38 changes: 21 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,54 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.6.3")
classpath("org.springframework.boot:spring-boot-gradle-plugin:3.2.5")
}
}

plugins {
id 'com.palantir.docker' version '0.22.1'
id 'com.palantir.docker' version '0.35.0'
id 'org.springframework.boot' version '3.2.5'
}

group = 'kingstonduo'
version = '300'

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

jar {
baseName='pegasus-data'
version= '2.5.0'
}

repositories {
mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = '21'
targetCompatibility = '21'

dependencies {

implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework:spring-test:5.0.5.RELEASE'
implementation 'commons-io:commons-io:2.6'
implementation 'mysql:mysql-connector-java:8.0.15'
implementation 'org.apache.commons:commons-compress:1.17'
implementation 'org.apache.commons:commons-text:1.7'

implementation 'commons-io:commons-io:2.16.1'
implementation 'com.mysql:mysql-connector-j:9.0.0'
implementation 'org.apache.commons:commons-compress:1.26.2'
implementation 'org.apache.commons:commons-text:1.12.0'
implementation 'com.graphql-java:graphql-spring-boot-starter:5.0.2'
implementation 'com.graphql-java:graphiql-spring-boot-starter:5.0.2'
implementation 'com.graphql-java:graphql-java-tools:5.2.4'
testImplementation 'org.mockito:mockito-core'
testImplementation 'org.springframework.boot:spring-boot-starter-test:2.2.0.RELEASE'
implementation 'org.springframework.graphql:spring-graphql'
implementation 'org.springframework.boot:spring-boot-starter-cache'
implementation 'com.hazelcast:hazelcast-all:4.2.5'

testImplementation('org.mockito:mockito-junit-jupiter:3.12.4')
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework:spring-test:5.2.25.RELEASE'
testImplementation 'org.mockito:mockito-core'

}

springBoot {
Expand Down Expand Up @@ -75,15 +79,15 @@ def getCurrentGitBranch() {
} catch (e) {
}
if (gitBranch == "develop" || gitBranch == "master"){
return jar.version
return project.version
}else{
return gitBranch
}
}
}

docker {
name "kingstonduo/${jar.baseName}:" + getCurrentGitBranch()
name "kingstonduo/pegasus-data:" + getCurrentGitBranch()
copySpec.from(tasks.unpack.outputs).into("dependency")
buildArgs(['DEPENDENCY': "dependency"])
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
2 changes: 1 addition & 1 deletion src/main/java/org/kpmp/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/graphql").allowedOrigins("http://localhost:3000");
registry.addMapping("/graphql").allowedOrigins("*");
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.graphql.data.method.annotation.Argument;
import org.springframework.graphql.data.method.annotation.QueryMapping;
import org.springframework.stereotype.Controller;

import com.coxautodev.graphql.tools.GraphQLQueryResolver;

@Component
public class Query implements GraphQLQueryResolver {
@Controller
public class QueryController implements GraphQLQueryResolver {

private AutocompleteService autocompleteService;
private CellTypeService cellTypeService;
Expand All @@ -46,11 +48,11 @@ public class Query implements GraphQLQueryResolver {

private RPExpressionDataService rpExpressionDataService;
private ParticipantService participantService;
private AtlasMessageService atlasMessageService;
private Logger logger = LoggerFactory.getLogger(Query.class);
private AtlasMessageService atlasMessageService;
private Logger logger = LoggerFactory.getLogger(QueryController.class);

@Autowired
public Query(AutocompleteService autocompleteService, CellTypeService cellTypeService,
public QueryController(AutocompleteService autocompleteService, CellTypeService cellTypeService,
UmapDataService umapService, GeneExpressionSummaryService geneExpressionSummaryService,
DataSummaryService dataSummaryService, ClusterHierarchyService clusterHierarchyService,
RTExpressionDataService rtExpressionDataService, RPExpressionDataService rpExpressionDataService,
Expand All @@ -68,16 +70,19 @@ public Query(AutocompleteService autocompleteService, CellTypeService cellTypeSe
this.atlasMessageService = atlasMessageService;
}

public List<AutocompleteResult> autocomplete(String searchTerm) throws IOException, Exception {
@QueryMapping
public List<AutocompleteResult> autocomplete(@Argument String searchTerm) throws IOException, Exception {
return autocompleteService.query(searchTerm);
}

public CellTypeHierarchy getCellTypeHierarchy() throws IOException {
@QueryMapping
public CellTypeHierarchy cellTypeHierarchy() throws IOException {
return cellTypeService.getCellTypeHierarchy();
}

public List<? extends GeneExpressionSummary> geneExpressionSummary(String dataType, String geneSymbol,
String cellType, String tissueType) throws IOException {
@QueryMapping
public List<? extends GeneExpressionSummary> geneExpressionSummary(@Argument String dataType, @Argument String geneSymbol,
@Argument String cellType, @Argument String tissueType) throws IOException {
List<? extends GeneExpressionSummary> results = new ArrayList<>();
if (cellType.isEmpty()) {
results = geneExpressionSummaryService.getByDataTypeTissueTypeAndGene(dataType, geneSymbol, tissueType);
Expand All @@ -88,11 +93,13 @@ public List<? extends GeneExpressionSummary> geneExpressionSummary(String dataTy
return results;
}

public List<ClusterHierarchy> getClusterHieararchies(String cellType) throws IOException {
@QueryMapping
public List<ClusterHierarchy> getClusterHieararchies(@Argument String cellType) throws IOException {
return clusterHierarchyService.findClustersByCellType(cellType);
}

public PlotData getUmapPlotData(String dataType, String geneSymbol, String tissueType) throws Exception {
@QueryMapping
public PlotData getUmapPlotData(@Argument String dataType, @Argument String geneSymbol, @Argument String tissueType) throws Exception {
try {
return umapService.getPlotData(dataType, geneSymbol, tissueType);
} catch (Exception e) {
Expand All @@ -101,6 +108,7 @@ public PlotData getUmapPlotData(String dataType, String geneSymbol, String tissu
}
}

@QueryMapping
public List<DataTypeSummary> getDataTypeSummaryInformation() throws Exception {
try {
return geneExpressionSummaryService.getDataTypeSummaryInformation();
Expand All @@ -110,6 +118,7 @@ public List<DataTypeSummary> getDataTypeSummaryInformation() throws Exception {
}
}

@QueryMapping
public List<DataTypeSummary> getSummaryData() throws Exception {
try {
return dataSummaryService.getSummaryData();
Expand All @@ -119,7 +128,8 @@ public List<DataTypeSummary> getSummaryData() throws Exception {
}
}

public List<String> dataTypesForConcept(String geneSymbol, String clusterName) throws Exception {
@QueryMapping
public List<String> dataTypesForConcept(@Argument String geneSymbol, @Argument String clusterName) throws Exception {
if (geneSymbol != null && !geneSymbol.isEmpty()) {
return geneExpressionSummaryService.findDataTypesByGene(geneSymbol);
} else if (clusterName != null && !clusterName.isEmpty()) {
Expand All @@ -129,7 +139,8 @@ public List<String> dataTypesForConcept(String geneSymbol, String clusterName) t

}

public RTExpressionByTissueType getRTGeneExpressionByTissue(String comparisonType, String geneSymbol)
@QueryMapping
public RTExpressionByTissueType getRTGeneExpressionByTissue(@Argument String comparisonType, @Argument String geneSymbol)
throws Exception {
try {
return rtExpressionDataService.getByComparisonTypeAndGeneSymbolPerTissue(comparisonType, geneSymbol);
Expand All @@ -139,7 +150,8 @@ public RTExpressionByTissueType getRTGeneExpressionByTissue(String comparisonTyp
}
}

public RPExpressionByTissueType getRPGeneExpressionByTissueAndProtein(String geneSymbol, String protein) throws Exception {
@QueryMapping
public RPExpressionByTissueType getRPGeneExpressionByTissueAndProtein(@Argument String geneSymbol, @Argument String protein) throws Exception {
try {
return rpExpressionDataService.getByGeneSymbolAndProteinPerTissue(geneSymbol, protein);
} catch (Exception e) {
Expand All @@ -148,7 +160,8 @@ public RPExpressionByTissueType getRPGeneExpressionByTissueAndProtein(String gen
}
}

public List<? extends RTExpressionData> getRTGeneExpressionByStructure(String structure) throws Exception {
@QueryMapping
public List<? extends RTExpressionData> getRTGeneExpressionByStructure(@Argument String structure) throws Exception {
try {
return rtExpressionDataService.getByStructure(structure);
} catch (Exception e) {
Expand All @@ -157,15 +170,18 @@ public List<? extends RTExpressionData> getRTGeneExpressionByStructure(String st
}
}

public List<RPExpressionData> getRPGeneExpressionByStructure(String structure) throws Exception {
@QueryMapping
public List<RPExpressionData> getRPGeneExpressionByStructure(@Argument String structure) throws Exception {
try {
return rpExpressionDataService.getByStructure(structure);
} catch (Exception e) {
logger.error(e.getMessage());
throw e;
}
}
public List<RPAccessionGroup> getRPGeneExpressionByTissue(String geneSymbol)

@QueryMapping
public List<RPAccessionGroup> getRPGeneExpressionByTissue(@Argument String geneSymbol)
throws Exception {
try {
return rpExpressionDataService.getByGeneSymbolPerTissue(geneSymbol);
Expand All @@ -175,35 +191,40 @@ public List<RPAccessionGroup> getRPGeneExpressionByTissue(String geneSymbol)
}
}

public ParticipantDataTypeSummary getDataTypeInformationByParticipant(String redcapId) {
@QueryMapping
public ParticipantDataTypeSummary getDataTypeInformationByParticipant(@Argument String redcapId) {
return participantService.getExperimentCounts(redcapId);
}

public ParticipantRepoDataTypeSummary getRepoDataTypeInformationByParticipant(String redcapId) {
@QueryMapping
public ParticipantRepoDataTypeSummary getRepoDataTypeInformationByParticipant(@Argument String redcapId) {
return participantService.getDataTypeCounts(redcapId);
}

public ParticipantSummaryDataset participantSummaryDataset(String redcap_id) throws Exception {
@QueryMapping
public ParticipantSummaryDataset participantSummaryDataset(@Argument String redcapId) throws Exception {
try {
return participantService.getParticipantSummaryDataset(redcap_id);
return participantService.getParticipantSummaryDataset(redcapId);
} catch (Exception e) {
logger.error(e.getMessage());
ParticipantSummaryDataset emptyResult = new ParticipantSummaryDataset();
emptyResult.setRedcapId(redcap_id);
emptyResult.setRedcapId(redcapId);

return emptyResult;
}
}

public ParticipantRepoDataTypeInformation getTotalParticipantFilesCount(String redcap_id) throws Exception {
@QueryMapping
public ParticipantRepoDataTypeInformation getTotalParticipantFilesCount(@Argument String redcapId) throws Exception {
try {
return this.participantService.getTotalFilesCount(redcap_id);
return this.participantService.getTotalFilesCount(redcapId);
} catch (Exception e) {
logger.error(e.getMessage());
throw e;
}
}

@QueryMapping
public List<ParticipantTissueTypeSummary> getTissueTypeSummaryData() throws Exception {
try {
return participantService.getTissueData();
Expand All @@ -213,6 +234,7 @@ public List<ParticipantTissueTypeSummary> getTissueTypeSummaryData() throws Exce
}
}

@QueryMapping
public AtlasRepoSummaryResult getAtlasSummaryRows() throws Exception {
try {
return dataSummaryService.getAtlasRepoSummary();
Expand All @@ -222,6 +244,7 @@ public AtlasRepoSummaryResult getAtlasSummaryRows() throws Exception {
}
}

@QueryMapping
public List<AtlasMessage> getAtlasMessages() throws Exception {
try{
return atlasMessageService.getAtlasMessage();
Expand All @@ -231,7 +254,8 @@ public List<AtlasMessage> getAtlasMessages() throws Exception {
}
}

public List<ParticipantRepoDataTypeInformation> getExperimentalStrategyCountsByParticipant(String redcapId) {
@QueryMapping
public List<ParticipantRepoDataTypeInformation> getExperimentalStrategyCountsByParticipant(@Argument String redcapId) {
return participantService.getExperimentalStrategyCountsByParticipant(redcapId);
}
}
6 changes: 3 additions & 3 deletions src/main/java/org/kpmp/atlasMessage/AtlasMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

@Entity
@Table(name = "atlas_messages")
Expand Down
Loading
Loading