Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ozg-cloud/app/nachrichten-manager
1 result
Show changes
Commits on Source (9)
Showing
with 24 additions and 53 deletions
......@@ -24,20 +24,21 @@
unter der Lizenz sind dem Lizenztext zu entnehmen.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.ozgcloud.common</groupId>
<artifactId>ozgcloud-common-dependencies</artifactId>
<version>4.7.0</version>
<version>4.11.0</version>
<relativePath />
</parent>
<groupId>de.ozgcloud.nachrichten</groupId>
<artifactId>nachrichten-manager-interface</artifactId>
<version>2.17.0</version>
<version>2.18.0</version>
<name>OZG-Cloud Nachrichten Manager gRPC Interface</name>
<description>Interface (gRPC) for Nachrichten Manager</description>
......@@ -110,7 +111,9 @@
</outputTarget>
<outputTarget>
<type>grpc-java</type>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${protoc-gen.version}</pluginArtifact>
<pluginArtifact>
io.grpc:protoc-gen-grpc-java:${protoc-gen.version}
</pluginArtifact>
</outputTarget>
</outputTargets>
</configuration>
......
......@@ -31,7 +31,7 @@
<parent>
<groupId>de.ozgcloud.nachrichten</groupId>
<artifactId>nachrichten-manager</artifactId>
<version>2.17.0</version>
<version>2.18.0</version>
<relativePath>../</relativePath>
</parent>
......
......@@ -25,7 +25,5 @@ package de.ozgcloud.nachrichten.postfach;
public interface PostfachAddressIdentifier {
default boolean isStringBasedIdentifier() {
return false;
}
String getStringRepresentation();
}
......@@ -26,22 +26,20 @@ package de.ozgcloud.nachrichten.postfach;
import jakarta.validation.constraints.NotBlank;
import lombok.Builder;
import lombok.Getter;
@Builder
@Getter
public class StringBasedIdentifier implements PostfachAddressIdentifier {
@NotBlank
private String postfachId;
@Override
public boolean isStringBasedIdentifier() {
return true;
public String toString() {
return postfachId;
}
@Override
public String toString() {
public String getStringRepresentation() {
return postfachId;
}
}
......@@ -32,7 +32,7 @@
<parent>
<groupId>de.ozgcloud.nachrichten</groupId>
<artifactId>nachrichten-manager</artifactId>
<version>2.17.0</version>
<version>2.18.0</version>
<relativePath>../</relativePath>
</parent>
......@@ -49,7 +49,6 @@
<vorgang-manager.version>2.17.0</vorgang-manager.version>
<muk-postfach.version>0.1.0</muk-postfach.version>
<api-lib.version>0.16.0</api-lib.version>
<ozgcloud-common.version>4.7.0</ozgcloud-common.version>
</properties>
<dependencies>
......@@ -101,12 +100,6 @@
<version>${api-lib.version}</version>
</dependency>
<dependency>
<groupId>de.ozgcloud.common</groupId>
<artifactId>ozgcloud-common-lib</artifactId>
<version>${ozgcloud-common.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
......@@ -241,10 +234,6 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>de.ozgcloud.common</groupId>
<artifactId>ozgcloud-common-lib</artifactId>
</dependency>
</dependencies>
<build>
......
......@@ -34,7 +34,6 @@ import de.ozgcloud.nachrichten.postfach.PostfachAddress;
import de.ozgcloud.nachrichten.postfach.PostfachException;
import de.ozgcloud.nachrichten.postfach.PostfachMessageCode;
import de.ozgcloud.nachrichten.postfach.PostfachNachricht;
import de.ozgcloud.nachrichten.postfach.StringBasedIdentifier;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
......@@ -71,12 +70,6 @@ public class InfoManagerService {
}
String getPostfachId(@NonNull PostfachAddress address) {
var postfachIdentifier = address.getIdentifier();
if (postfachIdentifier.isStringBasedIdentifier()) {
return ((StringBasedIdentifier) postfachIdentifier).getPostfachId();
} else {
throw new IllegalStateException("Illegal Type of Postfach Identifier: " + postfachIdentifier.getClass().getName());
}
return address.getIdentifier().getStringRepresentation();
}
}
......@@ -239,7 +239,6 @@ public abstract class PostfachNachrichtMapper {
}
private Map<String, Object> buildPostfachAddressIdentifierMap(PostfachAddress postfachAddress) {
var identifier = (StringBasedIdentifier) postfachAddress.getIdentifier();
return Map.of(PostfachAddress.FIELD_POSTFACH_ID, identifier.getPostfachId());
return Map.of(PostfachAddress.FIELD_POSTFACH_ID, postfachAddress.getIdentifier().getStringRepresentation());
}
}
\ No newline at end of file
......@@ -38,7 +38,6 @@ import org.mapstruct.ReportingPolicy;
import de.ozgcloud.common.errorhandling.TechnicalException;
import de.ozgcloud.nachrichten.postfach.PostfachAddress;
import de.ozgcloud.nachrichten.postfach.PostfachNachricht;
import de.ozgcloud.nachrichten.postfach.StringBasedIdentifier;
import de.ozgcloud.nachrichten.postfach.bayernid.proxy.GrpcAbsender;
import de.ozgcloud.nachrichten.postfach.bayernid.proxy.GrpcAttachmentMetadata;
import de.ozgcloud.nachrichten.postfach.bayernid.proxy.GrpcBayernIdMessageMetadata;
......@@ -85,7 +84,7 @@ interface BayernIdPostfachNachrichtMapper {
BayernIdResponse fromSendBayernIdMessageResponse(GrpcSendBayernIdMessageResponse response);
default String toPostkorbId(PostfachAddress postfachAddress) {
return ((StringBasedIdentifier) postfachAddress.getIdentifier()).getPostfachId();
return (postfachAddress.getIdentifier()).getStringRepresentation();
}
@Condition
......
......@@ -35,6 +35,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import de.ozgcloud.nachrichten.postfach.FileId;
import de.ozgcloud.nachrichten.postfach.PostfachAddress;
import de.ozgcloud.nachrichten.postfach.PostfachAddressIdentifier;
import de.ozgcloud.nachrichten.postfach.PostfachNachricht;
import de.ozgcloud.nachrichten.postfach.StringBasedIdentifier;
......@@ -78,9 +79,7 @@ public abstract class OsiPostfachMessageMapper {
String toPostfachId(PostfachNachricht nachricht) {
return Optional.ofNullable(nachricht.getPostfachAddress())
.map(PostfachAddress::getIdentifier)
.filter(StringBasedIdentifier.class::isInstance)
.map(StringBasedIdentifier.class::cast)
.map(StringBasedIdentifier::getPostfachId)
.map(PostfachAddressIdentifier::getStringRepresentation)
.orElse(StringUtils.EMPTY);
}
......
......@@ -35,7 +35,6 @@ import org.mockito.Mock;
import org.mockito.Spy;
import de.ozgcloud.nachrichten.NachrichtenManagerProperties;
import de.ozgcloud.nachrichten.postfach.PostfachAddressIdentifier;
import de.ozgcloud.nachrichten.postfach.PostfachAddressTestFactory;
import de.ozgcloud.nachrichten.postfach.PostfachException;
import de.ozgcloud.nachrichten.postfach.PostfachMessageCode;
......@@ -138,13 +137,5 @@ class InfoManagerServiceTest {
assertThat(id).isEqualTo(StringBasedIdentifierTestFactory.STRING_BASED_IDENTIFIER_POSTFACH_ID_VALUE);
}
@Test
void shouldThrowExceptionForUnkownIdentifer() {
var identifier = new PostfachAddressIdentifier() {
};
var address = PostfachAddressTestFactory.createBuilder().identifier(identifier).build();
assertThatThrownBy(() -> service.getPostfachId(address)).isInstanceOf(IllegalStateException.class);
}
}
}
......@@ -24,18 +24,20 @@
unter der Lizenz sind dem Lizenztext zu entnehmen.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.ozgcloud.common</groupId>
<artifactId>ozgcloud-common-parent</artifactId>
<version>4.7.0</version>
<version>4.11.0</version>
</parent>
<groupId>de.ozgcloud.nachrichten</groupId>
<artifactId>nachrichten-manager</artifactId>
<version>2.17.0</version>
<version>2.18.0</version>
<name>OZG-Cloud Nachrichten Manager</name>
<packaging>pom</packaging>
......