Skip to content
Snippets Groups Projects
Commit 6260c38e authored by OZGCloud's avatar OZGCloud
Browse files

Merge branch 'master' into OZG-6710-update-common-lib

# Conflicts:
#	zufi-manager-interface/pom.xml
parents 00f9e98c 21eda9ce
No related branches found
No related tags found
No related merge requests found
Showing
with 110 additions and 38 deletions
......@@ -35,7 +35,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.ozgcloud.zufi</groupId>
<artifactId>zufi-manager</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.5.0-SNAPSHOT</version>
<name>OZG-Cloud Zufi Manager</name>
<packaging>pom</packaging>
......
......@@ -40,7 +40,7 @@ spec:
- port: 9090
from:
- namespaceSelector: {}
- podSelector:
podSelector:
matchLabels:
component: vorgang-manager
- ports:
......
......@@ -91,7 +91,7 @@ tests:
ingress:
- from:
- namespaceSelector: {}
- podSelector:
podSelector:
matchLabels:
component: vorgang-manager
ports:
......
......@@ -30,7 +30,7 @@
<parent>
<groupId>de.ozgcloud.common</groupId>
<artifactId>ozgcloud-common-dependencies</artifactId>
<version>4.4.0-PR-25-SNAPSHOT</version>
<version>4.5.0-SNAPSHOT</version>
<relativePath/>
</parent>
......
......@@ -2,8 +2,6 @@ syntax = "proto3";
package de.ozgcloud.zufi.grpc.fachstelle;
import "fachstelleregistration.model.proto";
option java_multiple_files = true;
option java_package = "de.ozgcloud.zufi.grpc.fachstelle";
option java_outer_classname = "FachstelleModelProto";
......@@ -15,3 +13,23 @@ message GrpcFachstelleSearchRequest {
message GrpcFachstelleSearchResponse {
repeated GrpcFachstelle fachstellen = 1;
}
message GrpcFachstelleGetRequest {
string id = 1;
}
message GrpcFachstelleGetResponse {
GrpcFachstelle fachstelle = 1;
}
message GrpcFachstelle {
string id = 1;
string mukId = 2;
string firmenName = 3;
string rechtsform = 4;
string rechtsformText = 5;
string registerNummer = 6;
string registerArt = 7;
string emailAdresse = 8;
string anschrift = 9;
}
\ No newline at end of file
......@@ -10,4 +10,6 @@ option java_outer_classname = "FachstelleProto";
service FachstelleService {
rpc Search(GrpcFachstelleSearchRequest) returns (GrpcFachstelleSearchResponse);
rpc GetById(GrpcFachstelleGetRequest) returns (GrpcFachstelleGetResponse);
}
\ No newline at end of file
......@@ -7,14 +7,6 @@ option java_package = "de.ozgcloud.zufi.grpc.fachstelle";
option java_outer_classname = "FachstelleRegistrationModelProto";
message GrpcFachstelleRegistrationRequest {
GrpcFachstelle fachstelle = 1;
}
message GrpcFachstelleRegistrationResponse {
}
message GrpcFachstelle {
string mukId = 1;
string firmenName = 2;
string rechtsform = 3;
......@@ -24,3 +16,7 @@ message GrpcFachstelle {
string emailAdresse = 7;
string anschrift = 8;
}
message GrpcFachstelleRegistrationResponse {
}
\ No newline at end of file
......@@ -23,6 +23,14 @@ message GrpcOrganisationsEinheitSearchResponse {
repeated GrpcOrganisationsEinheit organisationsEinheiten = 1;
}
message GrpcGetByOrganisationsEinheitIdRequest {
string organisationsEinheitId = 1;
}
message GrpcGetByOrganisationsEinheitIdResponse {
repeated GrpcOrganisationsEinheit organisationsEinheiten = 1;
}
message GrpcOrganisationsEinheit {
string id = 1;
string name = 2;
......
......@@ -12,4 +12,6 @@ service OrganisationsEinheitService {
rpc Search(GrpcOrganisationsEinheitSearchRequest) returns (GrpcOrganisationsEinheitSearchResponse);
rpc GetById(GrpcOrganisationsEinheitGetRequest) returns (GrpcOrganisationsEinheitGetResponse);
rpc GetByOrganisationsEinheitId(GrpcGetByOrganisationsEinheitIdRequest) returns (GrpcGetByOrganisationsEinheitIdResponse);
}
\ No newline at end of file
......@@ -4,7 +4,7 @@
<parent>
<groupId>de.ozgcloud.zufi</groupId>
<artifactId>zufi-manager</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.5.0-SNAPSHOT</version>
</parent>
<artifactId>zufi-manager-model</artifactId>
<name>OZG-Cloud Zufi Manager Model</name>
......
......@@ -3,6 +3,7 @@ package de.ozgcloud.zufi.fachstelle;
import jakarta.validation.constraints.NotBlank;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.TypeAlias;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.index.TextIndexed;
import org.springframework.data.mongodb.core.mapping.Document;
......@@ -18,6 +19,7 @@ import lombok.extern.jackson.Jacksonized;
@Jacksonized
@Document(language = "german")
@ToString
@TypeAlias("Fachstelle")
public class Fachstelle {
@Id
......
......@@ -4,6 +4,7 @@ import java.util.HashSet;
import java.util.Set;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.TypeAlias;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.HashIndexed;
import org.springframework.data.mongodb.core.index.TextIndexed;
......@@ -19,6 +20,7 @@ import lombok.extern.jackson.Jacksonized;
@Jacksonized
@Document(language = "german")
@CompoundIndex(name = "organisationseinheit_id", def = "{ 'xzufiId.id': 1 }")
@TypeAlias("OrganisationsEinheit")
public class OrganisationsEinheit {
@Id
......
......@@ -28,6 +28,7 @@ import java.util.Optional;
import org.springframework.data.mongodb.core.query.TextCriteria;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.stereotype.Repository;
@Repository
......@@ -54,4 +55,9 @@ interface OrganisationsEinheitRepository extends MongoRepository<OrganisationsEi
default TextCriteria buildTextCriteria(String text) {
return TextCriteria.forDefaultLanguage().matching(text);
}
@Query("{ 'xzufiId._id': ?0 }")
List<OrganisationsEinheit> findByOrganisationsEinheitId(String organisationsEinheitId);
}
......@@ -4,6 +4,7 @@ import static org.assertj.core.api.Assertions.*;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
......@@ -241,4 +242,37 @@ class OrganisationsEinheitRepositoryITCase {
.containsExactly(organisationsEinheit1, organisationsEinheit3, organisationsEinheit2);
}
}
@Nested
class TestFindByOrganisationsEinheitId {
public static final String ORGANISATIONS_EINHEIT_ID = OrganisationsEinheitTestFactory.XZUFI_ID.getId();
private final OrganisationsEinheit organisationsEinheit1 = OrganisationsEinheitTestFactory.createBuilder()
.id(null)
.xzufiId(XzufiId.builder().id(ORGANISATIONS_EINHEIT_ID).schemeAgencyId(UUID.randomUUID().toString()).build())
.build();
private final OrganisationsEinheit organisationsEinheit2 = OrganisationsEinheitTestFactory.createBuilder()
.id(null)
.xzufiId(XzufiId.builder().id(UUID.randomUUID().toString()).schemeAgencyId(UUID.randomUUID().toString()).build())
.build();
private final OrganisationsEinheit organisationsEinheit3 = OrganisationsEinheitTestFactory.createBuilder()
.id(null)
.xzufiId(XzufiId.builder().id(ORGANISATIONS_EINHEIT_ID).schemeAgencyId(UUID.randomUUID().toString()).build())
.build();
@BeforeEach
void initDatabase() {
repository.save(organisationsEinheit1);
repository.save(organisationsEinheit2);
repository.save(organisationsEinheit3);
}
@Test
void shouldFindAllOrganisationsEinheitenWithId() {
var result = repository.findByOrganisationsEinheitId(ORGANISATIONS_EINHEIT_ID);
assertThat(result).usingRecursiveFieldByFieldElementComparatorIgnoringFields("id").containsExactlyInAnyOrder(organisationsEinheit1, organisationsEinheit3);
}
}
}
......@@ -5,7 +5,7 @@
<parent>
<groupId>de.ozgcloud.zufi</groupId>
<artifactId>zufi-manager</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.5.0-SNAPSHOT</version>
</parent>
<artifactId>zufi-manager-pvog</artifactId>
......
......@@ -24,6 +24,7 @@
package de.ozgcloud.zufi.metadocument;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.TypeAlias;
import org.springframework.data.mongodb.core.mapping.Document;
import lombok.Builder;
......@@ -34,6 +35,7 @@ import lombok.extern.jackson.Jacksonized;
@Getter
@Jacksonized
@Document
@TypeAlias("MetaDocument")
public class MetaDocument {
@Id
private String id;
......
......@@ -30,7 +30,7 @@
<parent>
<groupId>de.ozgcloud.zufi</groupId>
<artifactId>zufi-manager</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.5.0-SNAPSHOT</version>
</parent>
<artifactId>zufi-manager-server</artifactId>
......
......@@ -43,11 +43,11 @@ public class GrpcExceptionHandlers {
static final String KEY_EXCEPTION_ID = "EXCEPTION_ID";
@GrpcExceptionHandler
public StatusException handleOrganisationsEinheitNotFoundException(OrganisationsEinheitNotFoundException e) {
public StatusException handleResourceNotFoundException(ResourceNotFoundException e) {
return new StatusException(buildNotFoundStatus(e), buildMetadata(e.getExceptionId()));
}
private Status buildNotFoundStatus(OrganisationsEinheitNotFoundException e) {
private Status buildNotFoundStatus(ResourceNotFoundException e) {
return Status.NOT_FOUND.withDescription(e.getMessage()).withCause(e.getCause());
}
......
package de.ozgcloud.zufi.common.errorhandling;
import de.ozgcloud.common.errorhandling.TechnicalException;
public class OrganisationsEinheitNotFoundException extends TechnicalException {
private static final String NOT_FOUND_MESSAGE = "OrganisationseinheitID %s could not be found.";
public OrganisationsEinheitNotFoundException(String organisationsEinheitId) {
super(buildMessage(organisationsEinheitId));
}
public OrganisationsEinheitNotFoundException(String organisationsEinheitId, Throwable cause) {
super(buildMessage(organisationsEinheitId), cause);
}
private static String buildMessage(String organisationsEinheitId) {
return String.format(NOT_FOUND_MESSAGE, organisationsEinheitId);
}
}
package de.ozgcloud.zufi.common.errorhandling;
import de.ozgcloud.common.errorhandling.TechnicalException;
public class ResourceNotFoundException extends TechnicalException {
private static final String NOT_FOUND_MESSAGE = "%s with ID %s could not be found";
public ResourceNotFoundException(String resourceId, String resourceName) {
super(buildMessage(resourceId, resourceName));
}
public ResourceNotFoundException(String resourceId, String resourceName, Throwable cause) {
super(buildMessage(resourceId, resourceName), cause);
}
private static String buildMessage(String resourceId, String resourceName) {
return String.format(NOT_FOUND_MESSAGE, resourceName, resourceId);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment