Skip to content
Snippets Groups Projects
Commit 63211420 authored by Felix Reichenbach's avatar Felix Reichenbach
Browse files

Merge branch 'OZG-7038-EvaluationDMSQuittung' into 'main'

Ozg 7038 evaluation dms quittung

See merge request !3
parents dbdaa10d 17c8456d
No related branches found
No related tags found
1 merge request!3Ozg 7038 evaluation dms quittung
Showing
with 214 additions and 76 deletions
...@@ -26,6 +26,7 @@ package de.ozgcloud.archive; ...@@ -26,6 +26,7 @@ package de.ozgcloud.archive;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import de.ozgcloud.apilib.client_attribute.OzgCloudClientAttributeService; import de.ozgcloud.apilib.client_attribute.OzgCloudClientAttributeService;
import de.ozgcloud.apilib.client_attribute.grpc.OzgCloudClientAttributeGrpcService; import de.ozgcloud.apilib.client_attribute.grpc.OzgCloudClientAttributeGrpcService;
...@@ -50,43 +51,44 @@ import net.devh.boot.grpc.client.inject.GrpcClient; ...@@ -50,43 +51,44 @@ import net.devh.boot.grpc.client.inject.GrpcClient;
@Configuration @Configuration
@RequiredArgsConstructor @RequiredArgsConstructor
@EnableScheduling
public class ArchiveManagerConfiguration { public class ArchiveManagerConfiguration {
public static final String VORGANG_SERVICE_NAME = "archive_VorgangService"; public static final String VORGANG_SERVICE_NAME = "archiveVorgangService";
public static final String VORGANG_REMOTE_MANAGER_SERVICE_NAME = "archive_VorgangRemoteService"; public static final String VORGANG_REMOTE_MANAGER_SERVICE_NAME = "archiveVorgangRemoteService";
public static final String VORGANG_WITH_EINGANG_MAPPER_NAME = "archive_VorgangWithEingangMapper"; public static final String VORGANG_WITH_EINGANG_MAPPER_NAME = "archiveVorgangWithEingangMapper";
public static final String CURRENT_USER_SERVICE_NAME = "archive_CurrentUserService"; public static final String CURRENT_USER_SERVICE_NAME = "archiveCurrentUserService";
public static final String DOCUMENT_MAPPER_NAME = "archive_DocumentMapper"; public static final String DOCUMENT_MAPPER_NAME = "archiveDocumentMapper";
public static final String DOCUMENT_REMOTE_SERVICE_NAME = "archive_DocumentRemoteService"; public static final String DOCUMENT_REMOTE_SERVICE_NAME = "archiveDocumentRemoteService";
public static final String USER_SERVICE_NAME = "archive_UserService"; public static final String USER_SERVICE_NAME = "archiveUserService";
public static final String USER_PROFILE_MAPPER_NAME = "archive_UserProfileMapper"; public static final String USER_PROFILE_MAPPER_NAME = "archiveUserProfileMapper";
public static final String OZGCLOUD_USER_PROFILE_SERVICE_NAME = "archive_OzgCloudUserProfileService"; public static final String OZGCLOUD_USER_PROFILE_SERVICE_NAME = "archiveOzgCloudUserProfileService";
public static final String COMMAND_SERVICE_NAME = "archive_CommandService"; public static final String COMMAND_SERVICE_NAME = "archiveCommandService";
public static final String COMMAND_REMOTE_SERVICE_NAME = "archive_CommandRemoteService"; public static final String COMMAND_REMOTE_SERVICE_NAME = "archiveCommandRemoteService";
public static final String COMMAND_MAPPER_NAME = "archive_CommandMapper"; public static final String COMMAND_MAPPER_NAME = "archiveCommandMapper";
public static final String OZGCLOUD_COMMAND_SERVICE_NAME = "archive_OzgCloudCommandService"; public static final String OZGCLOUD_COMMAND_SERVICE_NAME = "archiveOzgCloudCommandService";
public static final String BINARY_FILE_SERVICE_NAME = "archive_BinaryFileService"; public static final String BINARY_FILE_SERVICE_NAME = "archiveBinaryFileService";
public static final String BINARY_FILE_REMOTE_SERVICE_NAME = "archive_BinaryFileRemoteService"; public static final String BINARY_FILE_REMOTE_SERVICE_NAME = "archiveBinaryFileRemoteService";
public static final String OZGCLOUD_FILE_SERVICE_NAME = "archive_OzgCloudFileService"; public static final String OZGCLOUD_FILE_SERVICE_NAME = "archiveOzgCloudFileService";
public static final String FILE_ID_MAPPER_NAME = "archive_FileIdMapper"; public static final String FILE_ID_MAPPER_NAME = "archiveFileIdMapper";
public static final String BESCHEID_REMOTE_SERVICE_NAME = "archive_BescheidRemoteService"; public static final String BESCHEID_REMOTE_SERVICE_NAME = "archiveBescheidRemoteService";
public static final String BESCHEID_MAPPER_NAME = "archive_BescheidMapper"; public static final String BESCHEID_MAPPER_NAME = "archiveBescheidMapper";
public static final String CALL_CONTEXT_PROVIDER_NAME = "archive_CallContextProvider"; public static final String CALL_CONTEXT_PROVIDER_NAME = "archiveCallContextProvider";
public static final String CALL_CONTEXT_MAPPER_NAME = "archive_CallContextMapper"; public static final String CALL_CONTEXT_MAPPER_NAME = "archiveCallContextMapper";
public static final String OZGCLOUD_CLIENT_ATTRIBUTE_SERVICE_NAME = "archive_OzgCloudClientAttributeService"; public static final String OZGCLOUD_CLIENT_ATTRIBUTE_SERVICE_NAME = "archiveOzgCloudClientAttributeService";
public static final String KOMMENTAR_SERVICE_NAME = "archive_KommentarService"; public static final String KOMMENTAR_SERVICE_NAME = "archiveKommentarService";
public static final String KOMMENTAR_REMOTE_SERVICE_NAME = "archive_KommentarRemoteService"; public static final String KOMMENTAR_REMOTE_SERVICE_NAME = "archiveKommentarRemoteService";
public static final String CALL_CONTEXT_SERVER_INTERCEPTOR_NAME = "archive_CallContextGrpcServerInterceptor"; public static final String CALL_CONTEXT_SERVER_INTERCEPTOR_NAME = "archiveCallContextGrpcServerInterceptor";
public static final String GRPC_VORGANG_MANAGER_CLIENT_NAME = "vorgang-manager"; public static final String GRPC_VORGANG_MANAGER_CLIENT_NAME = "vorgang-manager";
public static final String GRPC_COMMAND_MANAGER_CLIENT_NAME = "command-manager"; public static final String GRPC_COMMAND_MANAGER_CLIENT_NAME = "command-manager";
...@@ -108,25 +110,25 @@ public class ArchiveManagerConfiguration { ...@@ -108,25 +110,25 @@ public class ArchiveManagerConfiguration {
@GrpcClient(GRPC_FILE_MANAGER_CLIENT_NAME) @GrpcClient(GRPC_FILE_MANAGER_CLIENT_NAME)
private final BinaryFileServiceStub binaryFileServiceStub; private final BinaryFileServiceStub binaryFileServiceStub;
@Bean(ArchiveManagerConfiguration.OZGCLOUD_FILE_SERVICE_NAME) // NOSONAR @Bean(ArchiveManagerConfiguration.OZGCLOUD_FILE_SERVICE_NAME)
OzgCloudFileService ozgCloudFileService(OzgCloudFileMapper mapper, OzgCloudFileService ozgCloudFileService(OzgCloudFileMapper mapper,
@Qualifier(CALL_CONTEXT_PROVIDER_NAME) CallContextProvider callContextProvider) { @Qualifier(CALL_CONTEXT_PROVIDER_NAME) CallContextProvider callContextProvider) {
return new GrpcOzgCloudFileService(binaryFileServiceBlockingStub, binaryFileServiceStub, callContextProvider, mapper); return new GrpcOzgCloudFileService(binaryFileServiceBlockingStub, binaryFileServiceStub, callContextProvider, mapper);
} }
@Bean(ArchiveManagerConfiguration.OZGCLOUD_USER_PROFILE_SERVICE_NAME) // NOSONAR @Bean(ArchiveManagerConfiguration.OZGCLOUD_USER_PROFILE_SERVICE_NAME)
OzgCloudUserProfileService grpcOzgCloudUserProfileService(UserProfileMapper userProfileMapper, OzgCloudUserProfileService grpcOzgCloudUserProfileService(UserProfileMapper userProfileMapper,
@Qualifier(CALL_CONTEXT_PROVIDER_NAME) CallContextProvider callContextProvider) { @Qualifier(CALL_CONTEXT_PROVIDER_NAME) CallContextProvider callContextProvider) {
return new GrpcOzgCloudUserProfileService(userProfileServiceBlockingStub, userProfileMapper, callContextProvider); return new GrpcOzgCloudUserProfileService(userProfileServiceBlockingStub, userProfileMapper, callContextProvider);
} }
@Bean(OZGCLOUD_CLIENT_ATTRIBUTE_SERVICE_NAME) // NOSONAR @Bean(OZGCLOUD_CLIENT_ATTRIBUTE_SERVICE_NAME)
OzgCloudClientAttributeService ozgCloudAttributesService(OzgCloudClientAttributeMapper mapper, OzgCloudClientAttributeService ozgCloudAttributesService(OzgCloudClientAttributeMapper mapper,
@Qualifier(CALL_CONTEXT_PROVIDER_NAME) CallContextProvider callContextProvider) { @Qualifier(CALL_CONTEXT_PROVIDER_NAME) CallContextProvider callContextProvider) {
return new OzgCloudClientAttributeGrpcService(clientAttributeServiceBlockingStub, mapper, callContextProvider); return new OzgCloudClientAttributeGrpcService(clientAttributeServiceBlockingStub, mapper, callContextProvider);
} }
@Bean(OZGCLOUD_COMMAND_SERVICE_NAME) // NOSONAR @Bean(OZGCLOUD_COMMAND_SERVICE_NAME)
OzgCloudCommandService ozgCloudCommandService(CommandMapper commandMapper, OzgCloudCommandService ozgCloudCommandService(CommandMapper commandMapper,
@Qualifier(CALL_CONTEXT_PROVIDER_NAME) CallContextProvider callContextProvider) { @Qualifier(CALL_CONTEXT_PROVIDER_NAME) CallContextProvider callContextProvider) {
return new GrpcOzgCloudCommandService(commandServiceStub, commandMapper, callContextProvider, return new GrpcOzgCloudCommandService(commandServiceStub, commandMapper, callContextProvider,
......
...@@ -65,15 +65,15 @@ public class ArchiveEventListener { ...@@ -65,15 +65,15 @@ public class ArchiveEventListener {
public static final Predicate<Command> IS_LOCK_BY_ARCHIVE_MANAGER_COMMAND = command -> CallContextUser.ARCHIVE_MANAGER_CLIENT_NAME public static final Predicate<Command> IS_LOCK_BY_ARCHIVE_MANAGER_COMMAND = command -> CallContextUser.ARCHIVE_MANAGER_CLIENT_NAME
.equals(command.getCreatedByClientName()); .equals(command.getCreatedByClientName());
@Qualifier(ArchiveManagerConfiguration.CURRENT_USER_SERVICE_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.CURRENT_USER_SERVICE_NAME)
private final CurrentUserService currentUserService; private final CurrentUserService currentUserService;
@Qualifier(ArchiveManagerConfiguration.VORGANG_SERVICE_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.VORGANG_SERVICE_NAME)
private final VorgangService vorgangService; private final VorgangService vorgangService;
private final ApplicationEventPublisher eventPublisher; private final ApplicationEventPublisher eventPublisher;
@Qualifier(ArchiveManagerConfiguration.COMMAND_SERVICE_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.COMMAND_SERVICE_NAME)
private final CommandService commandService; private final CommandService commandService;
private final ArchiveService archiveService; private final ArchiveService archiveService;
......
...@@ -53,7 +53,7 @@ class ArchiveService { ...@@ -53,7 +53,7 @@ class ArchiveService {
public static final String ATTRIBUTE_NAME_ANTRAG_ARCHIVING = "ARCHIVING"; public static final String ATTRIBUTE_NAME_ANTRAG_ARCHIVING = "ARCHIVING";
private final XtaService xtaService; private final XtaService xtaService;
private final ExportService exportService; private final ExportService exportService;
@Qualifier(ArchiveManagerConfiguration.OZGCLOUD_CLIENT_ATTRIBUTE_SERVICE_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.OZGCLOUD_CLIENT_ATTRIBUTE_SERVICE_NAME)
private final OzgCloudClientAttributeService ozgCloudAttributesService; private final OzgCloudClientAttributeService ozgCloudAttributesService;
private final OzgCloudVorgangIdMapper vorgangIdMapper; private final OzgCloudVorgangIdMapper vorgangIdMapper;
......
...@@ -36,15 +36,15 @@ import de.ozgcloud.document.bescheid.GrpcGetAllBescheidRequest; ...@@ -36,15 +36,15 @@ import de.ozgcloud.document.bescheid.GrpcGetAllBescheidRequest;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import net.devh.boot.grpc.client.inject.GrpcClient; import net.devh.boot.grpc.client.inject.GrpcClient;
@Service(ArchiveManagerConfiguration.BESCHEID_REMOTE_SERVICE_NAME) // NOSONAR @Service(ArchiveManagerConfiguration.BESCHEID_REMOTE_SERVICE_NAME)
@RequiredArgsConstructor @RequiredArgsConstructor
class BescheidRemoteService { class BescheidRemoteService {
@GrpcClient(ArchiveManagerConfiguration.GRPC_VORGANG_MANAGER_CLIENT_NAME) @GrpcClient(ArchiveManagerConfiguration.GRPC_VORGANG_MANAGER_CLIENT_NAME)
private final BescheidServiceBlockingStub grpcService; private final BescheidServiceBlockingStub grpcService;
@Qualifier(ArchiveManagerConfiguration.CALL_CONTEXT_PROVIDER_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.CALL_CONTEXT_PROVIDER_NAME)
private final OzgCloudCallContextProvider contextProvider; private final OzgCloudCallContextProvider contextProvider;
@Qualifier(ArchiveManagerConfiguration.BESCHEID_MAPPER_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.BESCHEID_MAPPER_NAME)
private final BescheidMapper bescheidMapper; private final BescheidMapper bescheidMapper;
public Stream<Bescheid> findByVorgangId(String vorgangId) { public Stream<Bescheid> findByVorgangId(String vorgangId) {
......
...@@ -35,15 +35,15 @@ import de.ozgcloud.document.GrpcGetDocumentRequest; ...@@ -35,15 +35,15 @@ import de.ozgcloud.document.GrpcGetDocumentRequest;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import net.devh.boot.grpc.client.inject.GrpcClient; import net.devh.boot.grpc.client.inject.GrpcClient;
@Service(ArchiveManagerConfiguration.DOCUMENT_REMOTE_SERVICE_NAME) // NOSONAR @Service(ArchiveManagerConfiguration.DOCUMENT_REMOTE_SERVICE_NAME)
@RequiredArgsConstructor @RequiredArgsConstructor
class DocumentRemoteService { class DocumentRemoteService {
@GrpcClient(ArchiveManagerConfiguration.GRPC_VORGANG_MANAGER_CLIENT_NAME) // NOSONAR @GrpcClient(ArchiveManagerConfiguration.GRPC_VORGANG_MANAGER_CLIENT_NAME)
private final DocumentServiceBlockingStub grpcService; private final DocumentServiceBlockingStub grpcService;
@Qualifier(ArchiveManagerConfiguration.DOCUMENT_MAPPER_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.DOCUMENT_MAPPER_NAME)
private final DocumentMapper documentMapper; private final DocumentMapper documentMapper;
@Qualifier(ArchiveManagerConfiguration.CALL_CONTEXT_PROVIDER_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.CALL_CONTEXT_PROVIDER_NAME)
private final OzgCloudCallContextProvider contextProvider; private final OzgCloudCallContextProvider contextProvider;
public FileId getDocument(String documentId) { public FileId getDocument(String documentId) {
......
...@@ -40,16 +40,16 @@ import lombok.RequiredArgsConstructor; ...@@ -40,16 +40,16 @@ import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor @RequiredArgsConstructor
public class ExportBescheidService { public class ExportBescheidService {
@Qualifier(ArchiveManagerConfiguration.BESCHEID_REMOTE_SERVICE_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.BESCHEID_REMOTE_SERVICE_NAME)
private final BescheidRemoteService bescheidRemoteService; private final BescheidRemoteService bescheidRemoteService;
@Qualifier(ArchiveManagerConfiguration.BINARY_FILE_SERVICE_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.BINARY_FILE_SERVICE_NAME)
private final BinaryFileService binaryFileService; private final BinaryFileService binaryFileService;
@Qualifier(ArchiveManagerConfiguration.DOCUMENT_REMOTE_SERVICE_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.DOCUMENT_REMOTE_SERVICE_NAME)
private final DocumentRemoteService documentRemoteService; private final DocumentRemoteService documentRemoteService;
@Qualifier(ArchiveManagerConfiguration.USER_SERVICE_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.USER_SERVICE_NAME)
private final UserService userService; private final UserService userService;
public BescheidExportData createExportData(VorgangWithEingang vorgang) { public BescheidExportData createExportData(VorgangWithEingang vorgang) {
......
...@@ -43,22 +43,22 @@ import de.ozgcloud.vorgang.grpc.binaryFile.GrpcFindFilesResponse; ...@@ -43,22 +43,22 @@ import de.ozgcloud.vorgang.grpc.binaryFile.GrpcFindFilesResponse;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import net.devh.boot.grpc.client.inject.GrpcClient; import net.devh.boot.grpc.client.inject.GrpcClient;
@Service(ArchiveManagerConfiguration.BINARY_FILE_REMOTE_SERVICE_NAME) // NOSONAR @Service(ArchiveManagerConfiguration.BINARY_FILE_REMOTE_SERVICE_NAME)
@RequiredArgsConstructor @RequiredArgsConstructor
class BinaryFileRemoteService { class BinaryFileRemoteService {
@GrpcClient(ArchiveManagerConfiguration.GRPC_VORGANG_MANAGER_CLIENT_NAME) // NOSONAR @GrpcClient(ArchiveManagerConfiguration.GRPC_VORGANG_MANAGER_CLIENT_NAME)
private final BinaryFileServiceBlockingStub grpcService; private final BinaryFileServiceBlockingStub grpcService;
@Qualifier(ArchiveManagerConfiguration.OZGCLOUD_FILE_SERVICE_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.OZGCLOUD_FILE_SERVICE_NAME)
private final OzgCloudFileService ozgCloudFileService; private final OzgCloudFileService ozgCloudFileService;
private final OzgFileMapper ozgFileMapper; private final OzgFileMapper ozgFileMapper;
@Qualifier(ArchiveManagerConfiguration.CALL_CONTEXT_PROVIDER_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.CALL_CONTEXT_PROVIDER_NAME)
private final OzgCloudCallContextProvider contextProvider; private final OzgCloudCallContextProvider contextProvider;
@Qualifier(ArchiveManagerConfiguration.FILE_ID_MAPPER_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.FILE_ID_MAPPER_NAME)
private final FileIdMapper fileIdMapper; private final FileIdMapper fileIdMapper;
public Stream<OzgFile> getFiles(List<FileId> fileIds) { public Stream<OzgFile> getFiles(List<FileId> fileIds) {
......
...@@ -35,11 +35,11 @@ import de.ozgcloud.archive.file.OzgFile; ...@@ -35,11 +35,11 @@ import de.ozgcloud.archive.file.OzgFile;
import de.ozgcloud.common.binaryfile.FileId; import de.ozgcloud.common.binaryfile.FileId;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@Service(ArchiveManagerConfiguration.BINARY_FILE_SERVICE_NAME) // NOSONAR @Service(ArchiveManagerConfiguration.BINARY_FILE_SERVICE_NAME)
@RequiredArgsConstructor @RequiredArgsConstructor
public class BinaryFileService { public class BinaryFileService {
@Qualifier(ArchiveManagerConfiguration.BINARY_FILE_REMOTE_SERVICE_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.BINARY_FILE_REMOTE_SERVICE_NAME)
private final BinaryFileRemoteService binaryFileRemoteService; private final BinaryFileRemoteService binaryFileRemoteService;
public Stream<OzgFile> getFiles(List<FileId> attachments) { public Stream<OzgFile> getFiles(List<FileId> attachments) {
......
...@@ -40,13 +40,13 @@ import io.grpc.ServerCallHandler; ...@@ -40,13 +40,13 @@ import io.grpc.ServerCallHandler;
import io.grpc.ServerInterceptor; import io.grpc.ServerInterceptor;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@Component(ArchiveManagerConfiguration.CALL_CONTEXT_SERVER_INTERCEPTOR_NAME) // NOSONAR @Component(ArchiveManagerConfiguration.CALL_CONTEXT_SERVER_INTERCEPTOR_NAME)
@RequiredArgsConstructor @RequiredArgsConstructor
public class CallContextGrpcServerInterceptor implements ServerInterceptor { public class CallContextGrpcServerInterceptor implements ServerInterceptor {
@Qualifier(ArchiveManagerConfiguration.CURRENT_USER_SERVICE_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.CURRENT_USER_SERVICE_NAME)
private final CurrentUserService currentUserService; private final CurrentUserService currentUserService;
@Qualifier(ArchiveManagerConfiguration.CALL_CONTEXT_MAPPER_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.CALL_CONTEXT_MAPPER_NAME)
private final CallContextMapper callContextMapper; private final CallContextMapper callContextMapper;
@Override @Override
......
...@@ -31,13 +31,13 @@ import de.ozgcloud.apilib.common.callcontext.OzgCloudCallContextProvider; ...@@ -31,13 +31,13 @@ import de.ozgcloud.apilib.common.callcontext.OzgCloudCallContextProvider;
import de.ozgcloud.archive.ArchiveManagerConfiguration; import de.ozgcloud.archive.ArchiveManagerConfiguration;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@Component(ArchiveManagerConfiguration.CALL_CONTEXT_PROVIDER_NAME) // NOSONAR @Component(ArchiveManagerConfiguration.CALL_CONTEXT_PROVIDER_NAME)
@RequiredArgsConstructor @RequiredArgsConstructor
public class CallContextProvider implements OzgCloudCallContextProvider { public class CallContextProvider implements OzgCloudCallContextProvider {
@Qualifier(ArchiveManagerConfiguration.CURRENT_USER_SERVICE_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.CURRENT_USER_SERVICE_NAME)
private final CurrentUserService currentUserService; private final CurrentUserService currentUserService;
@Qualifier(ArchiveManagerConfiguration.CALL_CONTEXT_MAPPER_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.CALL_CONTEXT_MAPPER_NAME)
private final CallContextMapper mapper; private final CallContextMapper mapper;
@Override @Override
......
...@@ -42,7 +42,7 @@ import de.ozgcloud.common.grpc.GrpcUtil; ...@@ -42,7 +42,7 @@ import de.ozgcloud.common.grpc.GrpcUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor @RequiredArgsConstructor
@Service(ArchiveManagerConfiguration.CURRENT_USER_SERVICE_NAME) // NOSONAR @Service(ArchiveManagerConfiguration.CURRENT_USER_SERVICE_NAME)
public class CurrentUserService { public class CurrentUserService {
private final AuthenticationTrustResolver trustResolver; private final AuthenticationTrustResolver trustResolver;
...@@ -97,7 +97,6 @@ public class CurrentUserService { ...@@ -97,7 +97,6 @@ public class CurrentUserService {
return ThreadContext.getContext().getOrDefault(GrpcUtil.KEY_REQUEST_ID, UUID.randomUUID().toString()); return ThreadContext.getContext().getOrDefault(GrpcUtil.KEY_REQUEST_ID, UUID.randomUUID().toString());
} }
public SecurityContext startAndReturnPreviousSecurityContext(CallContextUser user) { public SecurityContext startAndReturnPreviousSecurityContext(CallContextUser user) {
var prevContext = SecurityContextHolder.getContext(); var prevContext = SecurityContextHolder.getContext();
......
...@@ -24,18 +24,47 @@ ...@@ -24,18 +24,47 @@
package de.ozgcloud.archive.common.command; package de.ozgcloud.archive.common.command;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.util.Collections;
import java.util.Map; import java.util.Map;
import de.ozgcloud.command.Command;
import de.ozgcloud.command.CommandStatus;
import lombok.Builder; import lombok.Builder;
import lombok.Getter; import lombok.Getter;
import lombok.ToString;
@Builder(toBuilder = true) @ToString
@Getter @Getter
public class ArchiveManagerCommand { @Builder(toBuilder = true)
public class ArchiveManagerCommand implements Command {
private String id;
private String vorgangId;
private ZonedDateTime createdAt;
private ZonedDateTime finishedAt; private ZonedDateTime finishedAt;
private String createdBy;
private String createdByName; private String createdByName;
private String createdByClientName;
private CommandStatus status;
private String order; private String order;
private Map<String, ?> body; private String relationId;
private Long relationVersion;
@Builder.Default
private Map<String, Object> bodyObject = Collections.emptyMap();
/*
* @deprecated use {@link ArchiveManagerCommand#bodyObject}
*/
@Deprecated(since = "0.2.0", forRemoval = true)
private Map<String, String> body;
private String errorMessage;
private String createdResource;
} }
...@@ -41,7 +41,10 @@ import de.ozgcloud.vorgang.grpc.command.GrpcCommand; ...@@ -41,7 +41,10 @@ import de.ozgcloud.vorgang.grpc.command.GrpcCommand;
@AnnotateWith(value = Component.class, elements = @Element(strings = ArchiveManagerConfiguration.COMMAND_MAPPER_NAME)) @AnnotateWith(value = Component.class, elements = @Element(strings = ArchiveManagerConfiguration.COMMAND_MAPPER_NAME))
interface CommandMapper { interface CommandMapper {
@Mapping(target = "body", source = "bodyObj") @Mapping(target = "createdByClientName", ignore = true) // TODO Ergänzen sobald der aktueller Stand das zulässt
@Mapping(target = "relationVersion", ignore = true)
@Mapping(target = "body", ignore = true)
@Mapping(target = "bodyObject", source = "bodyObj")
@Mapping(target = "order", source = "orderString") @Mapping(target = "order", source = "orderString")
@Mapping(target = "finishedAt", expression = "java(mapToZonedDateTime(grpcCommand.getFinishedAt()))") @Mapping(target = "finishedAt", expression = "java(mapToZonedDateTime(grpcCommand.getFinishedAt()))")
ArchiveManagerCommand fromGrpc(GrpcCommand grpcCommand); ArchiveManagerCommand fromGrpc(GrpcCommand grpcCommand);
......
...@@ -39,14 +39,14 @@ import lombok.RequiredArgsConstructor; ...@@ -39,14 +39,14 @@ import lombok.RequiredArgsConstructor;
import net.devh.boot.grpc.client.inject.GrpcClient; import net.devh.boot.grpc.client.inject.GrpcClient;
@RequiredArgsConstructor @RequiredArgsConstructor
@Service(ArchiveManagerConfiguration.COMMAND_REMOTE_SERVICE_NAME) // NOSONAR @Service(ArchiveManagerConfiguration.COMMAND_REMOTE_SERVICE_NAME)
class CommandRemoteService { class CommandRemoteService {
@GrpcClient(ArchiveManagerConfiguration.GRPC_VORGANG_MANAGER_CLIENT_NAME) // NOSONAR @GrpcClient(ArchiveManagerConfiguration.GRPC_VORGANG_MANAGER_CLIENT_NAME)
private final CommandServiceBlockingStub grpcService; private final CommandServiceBlockingStub grpcService;
@Qualifier(ArchiveManagerConfiguration.COMMAND_MAPPER_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.COMMAND_MAPPER_NAME)
private final CommandMapper mapper; private final CommandMapper mapper;
@Qualifier(ArchiveManagerConfiguration.CALL_CONTEXT_PROVIDER_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.CALL_CONTEXT_PROVIDER_NAME)
private final OzgCloudCallContextProvider contextProvider; private final OzgCloudCallContextProvider contextProvider;
public Stream<ArchiveManagerCommand> findCommands(String vorgangId, Optional<String> status, Optional<String> order) { public Stream<ArchiveManagerCommand> findCommands(String vorgangId, Optional<String> status, Optional<String> order) {
......
...@@ -35,20 +35,25 @@ import de.ozgcloud.apilib.common.command.OzgCloudCommand; ...@@ -35,20 +35,25 @@ import de.ozgcloud.apilib.common.command.OzgCloudCommand;
import de.ozgcloud.apilib.common.command.OzgCloudCommandService; import de.ozgcloud.apilib.common.command.OzgCloudCommandService;
import de.ozgcloud.apilib.vorgang.OzgCloudVorgangId; import de.ozgcloud.apilib.vorgang.OzgCloudVorgangId;
import de.ozgcloud.archive.ArchiveManagerConfiguration; import de.ozgcloud.archive.ArchiveManagerConfiguration;
import de.ozgcloud.command.CommandStatus;
import lombok.NonNull; import lombok.NonNull;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@Service(ArchiveManagerConfiguration.COMMAND_SERVICE_NAME) // NOSONAR @Service(ArchiveManagerConfiguration.COMMAND_SERVICE_NAME)
@RequiredArgsConstructor @RequiredArgsConstructor
public class CommandService { public class CommandService {
@Qualifier(ArchiveManagerConfiguration.COMMAND_REMOTE_SERVICE_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.COMMAND_REMOTE_SERVICE_NAME)
private final CommandRemoteService remoteService; private final CommandRemoteService remoteService;
@Qualifier(ArchiveManagerConfiguration.OZGCLOUD_COMMAND_SERVICE_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.OZGCLOUD_COMMAND_SERVICE_NAME)
private final OzgCloudCommandService ozgCloudCommandService; private final OzgCloudCommandService ozgCloudCommandService;
public Stream<ArchiveManagerCommand> findPending(String vorgangId, String order) {
return remoteService.findCommands(vorgangId, Optional.of(CommandStatus.PENDING.name()), Optional.of(order));
}
public Stream<ArchiveManagerCommand> findFinishedCommands(@NonNull String vorgangId) { public Stream<ArchiveManagerCommand> findFinishedCommands(@NonNull String vorgangId) {
return remoteService.findCommands(vorgangId, Optional.of("FINISHED"), Optional.empty()); return remoteService.findCommands(vorgangId, Optional.of(CommandStatus.FINISHED.name()), Optional.empty());
} }
public boolean hasPendingCommandsExceptWithOrder(String vorgangId, String order) { public boolean hasPendingCommandsExceptWithOrder(String vorgangId, String order) {
...@@ -59,5 +64,4 @@ public class CommandService { ...@@ -59,5 +64,4 @@ public class CommandService {
private Predicate<? super OzgCloudCommand> hasNotOrder(String order) { private Predicate<? super OzgCloudCommand> hasNotOrder(String order) {
return command -> !StringUtils.equals(command.getOrder(), order); return command -> !StringUtils.equals(command.getOrder(), order);
} }
} }
\ No newline at end of file
...@@ -33,16 +33,16 @@ import de.ozgcloud.apilib.user.OzgCloudUserProfileService; ...@@ -33,16 +33,16 @@ import de.ozgcloud.apilib.user.OzgCloudUserProfileService;
import de.ozgcloud.archive.ArchiveManagerConfiguration; import de.ozgcloud.archive.ArchiveManagerConfiguration;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@Service(ArchiveManagerConfiguration.USER_SERVICE_NAME) // NOSONAR @Service(ArchiveManagerConfiguration.USER_SERVICE_NAME)
@RequiredArgsConstructor @RequiredArgsConstructor
public class UserService { public class UserService {
private static final String SYSTEM_USER_ID_PREFIX = "system_"; private static final String SYSTEM_USER_ID_PREFIX = "system_";
@Qualifier(ArchiveManagerConfiguration.OZGCLOUD_USER_PROFILE_SERVICE_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.OZGCLOUD_USER_PROFILE_SERVICE_NAME)
private final OzgCloudUserProfileService grpcOzgCloudUserProfileService; private final OzgCloudUserProfileService grpcOzgCloudUserProfileService;
@Qualifier(ArchiveManagerConfiguration.USER_PROFILE_MAPPER_NAME) // NOSONAR @Qualifier(ArchiveManagerConfiguration.USER_PROFILE_MAPPER_NAME)
private final UserProfileMapper mapper; private final UserProfileMapper mapper;
public String getFullNameById(String userId) { public String getFullNameById(String userId) {
......
...@@ -2,6 +2,10 @@ package de.ozgcloud.archive.common.xta; ...@@ -2,6 +2,10 @@ package de.ozgcloud.archive.common.xta;
import java.io.IOException; import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -58,4 +62,9 @@ class XtaConfiguration { ...@@ -58,4 +62,9 @@ class XtaConfiguration {
ObjectMapper objectMapper() { ObjectMapper objectMapper() {
return new ObjectMapper(); return new ObjectMapper();
} }
@Bean
DocumentBuilder documentBuilder() throws ParserConfigurationException {
return DocumentBuilderFactory.newDefaultInstance().newDocumentBuilder();
}
} }
package de.ozgcloud.archive.common.xta;
import org.springframework.stereotype.Component;
import de.ozgcloud.xta.client.model.XtaFile;
@Component
public class XtaFileHelper {
public XtaImportConfirmationHandler initImportConfirmationHandler(XtaFile file) {
return XtaImportConfirmationHandler.createFrom(file);
}
}
\ No newline at end of file
package de.ozgcloud.archive.common.xta;
import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import org.springframework.stereotype.Component;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import de.ozgcloud.xta.client.model.XtaFile;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
@Log4j2
@RequiredArgsConstructor
@Component
public class XtaFileParser {
private final DocumentBuilder documentBuilder;
public boolean isType(XtaFile file, XtaFileType type) {
try {
var doc = parse(file);
return type.getTypeStr().equals(getRootTagName(doc));
} catch (Exception e) {
LOG.warn("Error parsing xta file.", e);
return false;
}
}
Document parse(XtaFile file) throws SAXException, IOException {
var document = documentBuilder.parse(file.content().getDataSource().getInputStream());
document.getDocumentElement().normalize();
return document;
}
private String getRootTagName(Document doc) {
return doc.getDocumentElement().getTagName();
}
}
\ No newline at end of file
package de.ozgcloud.archive.common.xta;
import java.io.IOException;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Unmarshaller;
import de.ozgcloud.common.errorhandling.TechnicalException;
import de.ozgcloud.xta.client.model.XtaFile;
import de.xoev.xdomea.AbgabeImportBestaetigen0402;
class XtaFileReader<T> {
private final Unmarshaller unmarshaller;
public static XtaFileReader<AbgabeImportBestaetigen0402> createAbgabeImportBestaetigen0402Reader() {
return new XtaFileReader<>(AbgabeImportBestaetigen0402.class);
}
private XtaFileReader(Class<T> clazz) {
try {
unmarshaller = JAXBContext.newInstance(clazz).createUnmarshaller();
} catch (JAXBException e) {
throw new TechnicalException("Error reading xta file content", e);
}
}
@SuppressWarnings("unchecked")
public T read(XtaFile xtaFile) {
try {
return (T) unmarshaller.unmarshal(xtaFile.content().getInputStream());
} catch (JAXBException | IOException e) {
throw new TechnicalException("Error on reading file %s.".formatted(xtaFile.name()), e);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment