Skip to content

Commit 1f71890

Browse files
authored
Merge pull request #953 from qbicsoftware/development
Release PR
2 parents 082788a + e70a389 commit 1f71890

File tree

72 files changed

+1527
-2488
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1527
-2488
lines changed

.github/workflows/sonarcloud.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: SonarCloud Analysis
2+
3+
# Run this workflow on commits to the development branch
4+
on:
5+
push:
6+
branches:
7+
- development
8+
pull_request:
9+
branches:
10+
- development
11+
- main
12+
jobs:
13+
sonarcloud:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
- name: Set up JDK 17
20+
uses: actions/setup-java@v4
21+
with:
22+
distribution: 'zulu'
23+
java-version: '17'
24+
- name: Load local Maven repository cache
25+
uses: actions/cache@v4
26+
with:
27+
path: ~/.m2/repository
28+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
29+
restore-keys: |
30+
${{ runner.os }}-maven-
31+
32+
# Build the project using Maven
33+
- name: Build with Maven
34+
run: mvn clean install
35+
36+
# Run SonarCloud analysis
37+
- name: SonarCloud Scan
38+
env:
39+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Use the token stored in GitHub secrets
40+
run: mvn sonar:sonar

domain-concept/src/main/java/life/qbic/domain/concepts/DomainEventPublisher.java

-84
This file was deleted.

email-service-provider/src/main/java/life/qbic/infrastructure/email/project/ProjectManagementEmailServiceProvider.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
public class ProjectManagementEmailServiceProvider implements EmailService {
2525

2626
private static final Logger log = logger(ProjectManagementEmailServiceProvider.class);
27+
public static final String EMAIL_SUBMISSION_FAILED = "Email submission failed";
2728

2829
private final EmailServiceProvider emailServiceProvider;
2930

@@ -39,7 +40,7 @@ public void send(Subject subject, Recipient recipient, Content content)
3940
MessageTranslator.translate(content));
4041
} catch (EmailSubmissionException e) {
4142
log.error("Email submission failed!", e);
42-
throw new CommunicationException("Email submission failed");
43+
throw new CommunicationException(EMAIL_SUBMISSION_FAILED);
4344
}
4445
}
4546

@@ -50,8 +51,8 @@ public void send(Subject subject, Recipient recipient, Content content, Attachme
5051
emailServiceProvider.send(MessageTranslator.translate(subject), MessageTranslator.translate(recipient),
5152
MessageTranslator.translate(content), MessageTranslator.translate(attachment));
5253
} catch (EmailSubmissionException e) {
53-
log.error("Email submission failed", e);
54-
throw new CommunicationException("Email submission failed");
54+
log.error(EMAIL_SUBMISSION_FAILED, e);
55+
throw new CommunicationException(EMAIL_SUBMISSION_FAILED);
5556
}
5657
}
5758

pom.xml

+8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
<jakarta.persistence.version>3.2.0</jakarta.persistence.version>
3737
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3838
<jackson.version>2.18.1</jackson.version>
39+
<sonar.projectKey>qbicsoftware_data-manager-app</sonar.projectKey>
40+
<sonar.organization>qbicsoftware</sonar.organization>
41+
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
3942
</properties>
4043

4144
<parent>
@@ -233,6 +236,11 @@
233236
<target>${maven.compiler.target}</target>
234237
</configuration>
235238
</plugin>
239+
<plugin>
240+
<groupId>org.sonarsource.scanner.maven</groupId>
241+
<artifactId>sonar-maven-plugin</artifactId>
242+
<version>5.0.0.4389</version>
243+
</plugin>
236244
</plugins>
237245
</build>
238246
</project>

project-management-infrastructure/src/main/java/life/qbic/projectmanagement/infrastructure/CachedOrganisationRepository.java

-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import life.qbic.logging.api.Logger;
2121
import life.qbic.projectmanagement.application.OrganisationRepository;
2222
import life.qbic.projectmanagement.domain.Organisation;
23-
import org.springframework.stereotype.Component;
2423

2524
/**
2625
* <b>Cached Organisation Repository</b>
@@ -35,7 +34,6 @@
3534
*
3635
* @since 1.0.0s
3736
*/
38-
@Component
3937
public class CachedOrganisationRepository implements OrganisationRepository {
4038

4139
private static final Logger log = logger(CachedOrganisationRepository.class);
@@ -53,7 +51,6 @@ public CachedOrganisationRepository(int cacheSize) {
5351
this.configuredCacheSize = cacheSize;
5452
}
5553

56-
5754
public CachedOrganisationRepository() {
5855
this.configuredCacheSize = DEFAULT_CACHE_SIZE;
5956
}

project-management-infrastructure/src/main/java/life/qbic/projectmanagement/infrastructure/ontology/TIBTerminologyServiceIntegration.java

+2
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ public List<OntologyClass> query(String searchTerm, int offset, int limit)
164164
} catch (IOException e) {
165165
throw wrapIO(e);
166166
} catch (InterruptedException e) {
167+
Thread.currentThread().interrupt();
167168
throw wrapInterrupted(e);
168169
} catch (Exception e) {
169170
throw wrapUnknown(e);
@@ -193,6 +194,7 @@ public List<OntologyClass> search(String searchTerm, int offset, int limit)
193194
} catch (IOException e) {
194195
throw wrapIO(e);
195196
} catch (InterruptedException e) {
197+
Thread.currentThread().interrupt();
196198
throw wrapInterrupted(e);
197199
} catch (Exception e) {
198200
throw wrapUnknown(e);

project-management/src/main/java/life/qbic/projectmanagement/application/AppContextProvider.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ public interface AppContextProvider {
2222
* Returns a resolvable URL to the target project's sample page resource in the application.
2323
*
2424
* @param projectId the project id
25+
* @param experimentId the experiment id
2526
* @return a fully resolvable URL
2627
* @since 1.0.0
2728
*/
28-
String urlToSamplePage(String projectId);
29+
String urlToSamplePage(String projectId, String experimentId);
2930
}

project-management/src/main/java/life/qbic/projectmanagement/application/authorization/QbicOidcUser.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818
public class QbicOidcUser extends DefaultOidcUser {
1919

20-
private final QbicUserInfo qbicUserInfo;
20+
private final transient QbicUserInfo qbicUserInfo;
2121
private final String originalAuthName;
2222

2323
public record QbicUserInfo(String userId, String fullName, String email, boolean active) {

project-management/src/main/java/life/qbic/projectmanagement/application/authorization/QbicUserDetails.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
public class QbicUserDetails implements UserDetails {
2222
@Serial
2323
private static final long serialVersionUID = 5812210012669790933L;
24-
private final User user;
24+
private final transient User user;
2525
private final List<GrantedAuthority> grantedAuthorities;
2626

2727
/**

project-management/src/main/java/life/qbic/projectmanagement/application/authorization/acl/ProjectAccessServiceImpl.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
public class ProjectAccessServiceImpl implements ProjectAccessService {
4444

4545
private static final Logger log = logger(ProjectAccessServiceImpl.class);
46+
public static final String SELECT_IDENTITY = "SELECT @@IDENTITY";
4647
private final MutableAclService aclService;
4748
private final JdbcTemplate jdbcTemplate;
4849

@@ -59,8 +60,8 @@ private static MutableAcl getAclForProject(ProjectId projectId, List<Sid> sids,
5960
JdbcMutableAclService serviceImpl = (JdbcMutableAclService) mutableAclService;
6061
// these settings are necessary for MySQL to correctly throw several types of exceptions
6162
// instead of an unrelated exception related to the identity function
62-
serviceImpl.setClassIdentityQuery("SELECT @@IDENTITY");
63-
serviceImpl.setSidIdentityQuery("SELECT @@IDENTITY");
63+
serviceImpl.setClassIdentityQuery(SELECT_IDENTITY);
64+
serviceImpl.setSidIdentityQuery(SELECT_IDENTITY);
6465
try {
6566
acl = (MutableAcl) serviceImpl.readAclById(objectIdentity, sids);
6667
} catch (NotFoundException e) {
@@ -75,8 +76,8 @@ private static MutableAcl createAclForProject(ProjectId projectId,
7576
JdbcMutableAclService serviceImpl = (JdbcMutableAclService) mutableAclService;
7677
// these settings are necessary for MySQL to correctly throw several types of exceptions
7778
// instead of an unrelated exception related to the identity function
78-
serviceImpl.setClassIdentityQuery("SELECT @@IDENTITY");
79-
serviceImpl.setSidIdentityQuery("SELECT @@IDENTITY");
79+
serviceImpl.setClassIdentityQuery(SELECT_IDENTITY);
80+
serviceImpl.setSidIdentityQuery(SELECT_IDENTITY);
8081
return serviceImpl.createAcl(objectIdentity);
8182
}
8283

project-management/src/main/java/life/qbic/projectmanagement/application/batch/BatchRegistrationService.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import life.qbic.projectmanagement.application.sample.SampleRegistrationService;
1616
import life.qbic.projectmanagement.domain.model.batch.Batch;
1717
import life.qbic.projectmanagement.domain.model.batch.BatchId;
18+
import life.qbic.projectmanagement.domain.model.experiment.ExperimentId;
1819
import life.qbic.projectmanagement.domain.model.project.ProjectId;
1920
import life.qbic.projectmanagement.domain.model.sample.Sample;
2021
import life.qbic.projectmanagement.domain.model.sample.SampleId;
@@ -70,21 +71,23 @@ public BatchRegistrationService(BatchRepository batchRepository,
7071
* are usually followed by a complete batch that represents the measurements of
7172
* the complete experiment.
7273
* @param projectId id of the project this batch is added to
74+
* @param experimentId id of the experiment this batch is added to
7375
* @return a result object with the response. If the registration failed, a response code will be
7476
* provided.
7577
* @since 1.0.0
7678
*/
7779
@PreAuthorize("hasPermission(#projectId, 'life.qbic.projectmanagement.domain.model.project.Project', 'WRITE')")
7880
public Result<BatchId, ResponseCode> registerBatch(String label, boolean isPilot,
79-
ProjectId projectId) {
81+
ProjectId projectId, ExperimentId experimentId) {
8082
var project = projectInformationService.find(projectId);
8183
if (project.isEmpty()) {
8284
log.error(
8385
"Batch registration aborted. Reason: project with id:" + projectId + " was not found");
8486
return Result.fromError(ResponseCode.BATCH_CREATION_FAILED);
8587
}
8688
String projectTitle = project.get().getProjectIntent().projectTitle().title();
87-
var result = batchDomainService.register(label, isPilot, projectTitle, projectId);
89+
var result = batchDomainService.register(label, isPilot, projectTitle, projectId,
90+
experimentId);
8891
if (result.isError()) {
8992
return Result.fromError(ResponseCode.BATCH_REGISTRATION_FAILED);
9093
}

0 commit comments

Comments
 (0)