Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Chore: Update CWA-Parent to 2.0.2 #288

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>app.coronawarn</groupId>
<artifactId>cwa-parent</artifactId>
<version>1.8</version>
<version>2.0.2</version>
</parent>
<artifactId>cwa-quick-test-backend</artifactId>
<version>1.0.0-SNAPSHOT</version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@

package app.coronawarn.quicktest.archive.domain;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Lob;
import jakarta.persistence.Table;
import jakarta.persistence.Version;
import java.time.LocalDateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Version;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Setter;
import lombok.ToString;

@Data
@ToString(exclude = { "secret", "ciphertext" })
@ToString(exclude = {"secret", "ciphertext"})
@Entity
@Table(name = "archive")
public class Archive {
Expand All @@ -44,7 +44,7 @@ public class Archive {

@Column(name = "identifier", columnDefinition = "varchar(255)", nullable = false)
private String identifier;

@Column(name = "tenant_id", columnDefinition = "varchar(255)", nullable = false)
private String tenantId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
package app.coronawarn.quicktest.archive.repository;

import app.coronawarn.quicktest.archive.domain.Archive;
import jakarta.persistence.EntityManager;
import jakarta.persistence.RollbackException;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.RollbackException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.exception.ConstraintViolationException;
Expand Down Expand Up @@ -66,8 +66,8 @@ public List<Archive> findAll() {
this.em.getTransaction().begin();

final List<Archive> result = em
.createQuery("SELECT a FROM Archive a", Archive.class)
.getResultList();
.createQuery("SELECT a FROM Archive a", Archive.class)
.getResultList();

this.em.getTransaction().commit();
return result;
Expand All @@ -82,10 +82,10 @@ public List<Archive> findAllByPocId(final String pocId, final String tenantId) {
em.getTransaction().begin();

final List<Archive> result = em
.createQuery("SELECT a FROM Archive a WHERE a.pocId = ?1 AND a.tenantId = ?2", Archive.class)
.setParameter(1, pocId)
.setParameter(2, tenantId)
.getResultList();
.createQuery("SELECT a FROM Archive a WHERE a.pocId = ?1 AND a.tenantId = ?2", Archive.class)
.setParameter(1, pocId)
.setParameter(2, tenantId)
.getResultList();

em.getTransaction().commit();
return result;
Expand All @@ -100,8 +100,8 @@ public List<Archive> findAllByTenantId(final String tenantId) {
em.getTransaction().begin();

final List<Archive> result = em
.createQuery("SELECT a FROM Archive a WHERE a.tenantId = ?1", Archive.class)
.setParameter(1, tenantId).getResultList();
.createQuery("SELECT a FROM Archive a WHERE a.tenantId = ?1", Archive.class)
.setParameter(1, tenantId).getResultList();

em.getTransaction().commit();
return result;
Expand All @@ -116,11 +116,11 @@ public List<Archive> findAllByTenantId(final String tenantId, PageRequest pageRe
em.getTransaction().begin();

final List<Archive> result = em
.createQuery("SELECT a FROM Archive a WHERE a.tenantId = ?1", Archive.class)
.setFirstResult(pageRequest.getPageNumber() * pageRequest.getPageSize())
.setMaxResults(pageRequest.getPageSize())
.setParameter(1, tenantId)
.getResultList();
.createQuery("SELECT a FROM Archive a WHERE a.tenantId = ?1", Archive.class)
.setFirstResult(pageRequest.getPageNumber() * pageRequest.getPageSize())
.setMaxResults(pageRequest.getPageSize())
.setParameter(1, tenantId)
.getResultList();

em.getTransaction().commit();
return result;
Expand All @@ -133,9 +133,9 @@ public void deleteAllByTenantId(final String tenantId) {
em.getTransaction().begin();

em
.createQuery("DELETE FROM Archive a WHERE a.tenantId = ?1")
.setParameter(1, tenantId)
.executeUpdate();
.createQuery("DELETE FROM Archive a WHERE a.tenantId = ?1")
.setParameter(1, tenantId)
.executeUpdate();

em.getTransaction().commit();
}
Expand All @@ -149,9 +149,9 @@ public List<String> findAllHashedGuids(final List<String> search) {
this.em.getTransaction().begin();

final List<String> result = em
.createQuery("SELECT a.hashedGuid FROM Archive a WHERE a.hashedGuid IN ?1", String.class)
.setParameter(1, search)
.getResultList();
.createQuery("SELECT a.hashedGuid FROM Archive a WHERE a.hashedGuid IN ?1", String.class)
.setParameter(1, search)
.getResultList();

this.em.getTransaction().commit();
return result;
Expand All @@ -167,10 +167,10 @@ public Integer countAllByTenantId(final String tenantId) {
em.getTransaction().begin();

final Integer result = em
.createQuery("SELECT COUNT(*) FROM Archive a WHERE a.tenantId = ?1", Long.class)
.setParameter(1, tenantId)
.getSingleResult()
.intValue();
.createQuery("SELECT COUNT(*) FROM Archive a WHERE a.tenantId = ?1", Long.class)
.setParameter(1, tenantId)
.getSingleResult()
.intValue();

em.getTransaction().commit();
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import app.coronawarn.quicktest.model.dcc.DccPublicKey;
import app.coronawarn.quicktest.model.dcc.DccUploadData;
import app.coronawarn.quicktest.model.dcc.DccUploadResult;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import java.util.List;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -34,18 +34,18 @@
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(
name = "dccServerClient",
url = "${cwa-dcc-server.url}",
configuration = DccServerClientConfig.class
name = "dccServerClient",
url = "${cwa-dcc-server.url}",
configuration = DccServerClientConfig.class
)
public interface DccServerClient {
@GetMapping(value = "/version/v1/publicKey/search/{labId}",
consumes = MediaType.APPLICATION_JSON_VALUE
consumes = MediaType.APPLICATION_JSON_VALUE
)
List<DccPublicKey> searchPublicKeys(@PathVariable("labId") String labId);

@PostMapping(value = "/version/v1/test/{testId}/dcc",
consumes = MediaType.APPLICATION_JSON_VALUE
consumes = MediaType.APPLICATION_JSON_VALUE
)
DccUploadResult uploadDcc(@PathVariable("testId") String testId,
@RequestBody @NotNull @Valid DccUploadData dccUploadData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import app.coronawarn.quicktest.model.map.MapCenterList;
import app.coronawarn.quicktest.model.map.MapEntryResponse;
import app.coronawarn.quicktest.model.map.MapEntrySingleResponse;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import java.util.List;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
Expand All @@ -37,22 +37,22 @@
import org.springframework.web.bind.annotation.RequestHeader;

@FeignClient(
name = "MapServerClient",
url = "${quicktest-map-server.url}",
configuration = QuicktestMapClientConfig.class
name = "MapServerClient",
url = "${quicktest-map-server.url}",
configuration = QuicktestMapClientConfig.class
)
public interface QuicktestMapClient {
String AUTH_TOKEN = "Authorization";

@PostMapping(value = "/api/centers",
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
)
List<MapEntryResponse> createOrUpdateMapEntry(@RequestHeader(AUTH_TOKEN) String bearerToken,
@RequestBody @NotNull @Valid MapCenterList mapCenterList);

@GetMapping(value = "/api/centers/reference/{userReference}",
produces = MediaType.APPLICATION_JSON_VALUE
produces = MediaType.APPLICATION_JSON_VALUE
)
MapEntrySingleResponse getMapEntry(@RequestHeader(AUTH_TOKEN) String bearerToken,
@PathVariable("userReference") String userReference);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@
package app.coronawarn.quicktest.client;

import app.coronawarn.quicktest.model.quicktest.QuickTestResultList;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(
name = "testResultServerClient",
url = "${cwa-testresult-server.url}",
configuration = TestResultServerClientConfig.class
name = "testResultServerClient",
url = "${cwa-testresult-server.url}",
configuration = TestResultServerClientConfig.class
)
public interface TestResultServerClient {

Expand All @@ -42,7 +42,7 @@ public interface TestResultServerClient {
* @param quickTestResults for QuickTestResults
*/
@PostMapping(value = "/api/v1/quicktest/results",
consumes = MediaType.APPLICATION_JSON_VALUE
consumes = MediaType.APPLICATION_JSON_VALUE
)
ResponseEntity<Void> results(@RequestBody @NotNull @Valid QuickTestResultList quickTestResults);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
package app.coronawarn.quicktest.client;

import app.coronawarn.quicktest.model.quicktest.PcrTestResultList;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
Expand All @@ -31,9 +31,9 @@


@FeignClient(
name = "testResultServerPcrClient",
url = "${cwa-testresult-server.url-pcr}",
configuration = TestResultServerPcrClientConfig.class
name = "testResultServerPcrClient",
url = "${cwa-testresult-server.url-pcr}",
configuration = TestResultServerPcrClientConfig.class
)
public interface TestResultServerPcrClient {

Expand All @@ -43,7 +43,7 @@ public interface TestResultServerPcrClient {
* @param testResults for TestResults
*/
@PostMapping(value = "/api/v1/pocnat/results",
consumes = MediaType.APPLICATION_JSON_VALUE
consumes = MediaType.APPLICATION_JSON_VALUE
)
ResponseEntity<Void> pcrResults(@RequestBody @NotNull @Valid PcrTestResultList testResults);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
package app.coronawarn.quicktest.config;

import app.coronawarn.quicktest.archive.repository.ArchiveRepository;
import jakarta.persistence.EntityManager;
import java.util.Properties;
import javax.persistence.EntityManager;
import javax.sql.DataSource;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.cfg.AvailableSettings;
Expand All @@ -40,7 +40,7 @@
@Configuration
public class ArchiveEntityManagerConfig {

private static final String[] ENTITY_PACKAGES = { "app.coronawarn.quicktest.archive.domain" };
private static final String[] ENTITY_PACKAGES = {"app.coronawarn.quicktest.archive.domain"};

@Value("${spring.profiles.active:}")
private String activeProfile;
Expand All @@ -51,8 +51,8 @@ public class ArchiveEntityManagerConfig {

@Autowired
public ArchiveEntityManagerConfig(
@Qualifier("archiveDataSource") final DataSource archiveDataSource,
final JpaHibernateProperties jpaHibernateProperties) {
@Qualifier("archiveDataSource") final DataSource archiveDataSource,
final JpaHibernateProperties jpaHibernateProperties) {
this.archiveDataSource = archiveDataSource;
this.jpaHibernateProperties = jpaHibernateProperties;
}
Expand All @@ -66,8 +66,8 @@ public ArchiveRepository archiveRepository() {
private EntityManager archiveEntityManager() {
log.debug("Creating Archive EntityManager");
return this.archiveJpaTransactionManager()
.getEntityManagerFactory()
.createEntityManager();
.getEntityManagerFactory()
.createEntityManager();
}

private JpaTransactionManager archiveJpaTransactionManager() {
Expand Down Expand Up @@ -107,11 +107,11 @@ private Properties buildJpaHibernateProperties() {
}
if (this.jpaHibernateProperties.getJdbc().getFetchSize() != null) {
properties.put(AvailableSettings.STATEMENT_FETCH_SIZE,
this.jpaHibernateProperties.getJdbc().getFetchSize());
this.jpaHibernateProperties.getJdbc().getFetchSize());
}
if (this.jpaHibernateProperties.getJdbc().getBatchSize() != null) {
properties.put(AvailableSettings.STATEMENT_BATCH_SIZE,
this.jpaHibernateProperties.getJdbc().getBatchSize());
this.jpaHibernateProperties.getJdbc().getBatchSize());
}
if (this.jpaHibernateProperties.getShowSql() != null) {
properties.put(AvailableSettings.SHOW_SQL, this.jpaHibernateProperties.getShowSql());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

package app.coronawarn.quicktest.config;

import jakarta.validation.constraints.NotNull;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
Expand Down
Loading