Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nachrichten-manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OZG-Cloud
app
nachrichten-manager
Commits
abd99cb8
Commit
abd99cb8
authored
9 months ago
by
OZGCloud
Browse files
Options
Downloads
Patches
Plain Diff
OZG-6362 Laden der Ausgangsnachricht verbessert.
parent
adef2143
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nachrichten-manager-server/src/main/java/de/ozgcloud/nachrichten/postfach/PostfachService.java
+9
-23
9 additions, 23 deletions
...ava/de/ozgcloud/nachrichten/postfach/PostfachService.java
with
9 additions
and
23 deletions
nachrichten-manager-server/src/main/java/de/ozgcloud/nachrichten/postfach/PostfachService.java
+
9
−
23
View file @
abd99cb8
...
@@ -22,8 +22,6 @@
...
@@ -22,8 +22,6 @@
*/
*/
package
de.ozgcloud.nachrichten.postfach
;
package
de.ozgcloud.nachrichten.postfach
;
import
static
de
.
ozgcloud
.
nachrichten
.
postfach
.
PersistPostfachNachrichtServiceImpl
.*;
import
java.time.ZonedDateTime
;
import
java.time.ZonedDateTime
;
import
java.util.EnumSet
;
import
java.util.EnumSet
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -41,7 +39,6 @@ import org.springframework.context.ApplicationEventPublisher;
...
@@ -41,7 +39,6 @@ import org.springframework.context.ApplicationEventPublisher;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
de.ozgcloud.common.errorhandling.TechnicalException
;
import
de.ozgcloud.nachrichten.antragraum.AntragraumService
;
import
de.ozgcloud.nachrichten.antragraum.AntragraumService
;
import
de.ozgcloud.nachrichten.attributes.ClientAttributeService
;
import
de.ozgcloud.nachrichten.attributes.ClientAttributeService
;
import
de.ozgcloud.nachrichten.info.InfoManagerService
;
import
de.ozgcloud.nachrichten.info.InfoManagerService
;
...
@@ -57,16 +54,13 @@ import lombok.extern.log4j.Log4j2;
...
@@ -57,16 +54,13 @@ import lombok.extern.log4j.Log4j2;
@Validated
@Validated
class
PostfachService
{
class
PostfachService
{
private
static
final
Predicate
<
PostfachNachricht
>
IS_FROM_HUMAN_USER
=
nachricht
->
!
StringUtils
.
startsWith
(
nachricht
.
getCreatedBy
(),
"system"
);
static
final
Predicate
<
PostfachNachricht
>
IS_MUK_ANTWORT
=
nachricht
->
StringUtils
.
isEmpty
(
nachricht
.
getVorgangId
())
&&
StringUtils
.
isNotEmpty
(
static
final
Predicate
<
PostfachNachricht
>
IS_MUK_ANTWORT
=
nachricht
->
StringUtils
.
isEmpty
(
nachricht
.
getVorgangId
())
&&
StringUtils
.
isNotEmpty
(
nachricht
.
getReferencedNachricht
());
nachricht
.
getReferencedNachricht
());
static
final
Set
<
ReplyOption
>
REPLY_POSSIBLE_OPTION
=
EnumSet
.
of
(
ReplyOption
.
POSSIBLE
,
ReplyOption
.
MANDATORY
);
private
static
final
Predicate
<
PostfachNachricht
>
IS_FROM_HUMAN_USER
=
nachricht
->
!
StringUtils
.
startsWith
(
nachricht
.
getCreatedBy
(),
"system"
);
private
static
final
Set
<
String
>
POSTFACH_TYPES_WITH_ANTRAGSRAUM
=
Set
.
of
(
"BayernId"
);
private
static
final
Set
<
String
>
POSTFACH_TYPES_WITH_ANTRAGSRAUM
=
Set
.
of
(
"BayernId"
);
@Autowired
(
required
=
false
)
@Autowired
(
required
=
false
)
private
PostfachRemoteService
postfachRemoteService
;
private
PostfachRemoteService
postfachRemoteService
;
static
final
Set
<
ReplyOption
>
REPLY_POSSIBLE_OPTION
=
EnumSet
.
of
(
ReplyOption
.
POSSIBLE
,
ReplyOption
.
MANDATORY
);
@Autowired
@Autowired
private
PostfachNachrichtMapper
mapper
;
private
PostfachNachrichtMapper
mapper
;
...
@@ -131,27 +125,19 @@ class PostfachService {
...
@@ -131,27 +125,19 @@ class PostfachService {
}
}
private
void
persistReceivedMail
(
PostfachNachricht
nachricht
)
{
private
void
persistReceivedMail
(
PostfachNachricht
nachricht
)
{
Optional
<
PostfachNachricht
>
linkedNachrichtOptional
=
Optional
.
of
(
nachricht
);
if
(
IS_MUK_ANTWORT
.
test
(
nachricht
))
{
if
(
IS_MUK_ANTWORT
.
test
(
nachricht
))
{
var
vorgangMapOptional
=
findById
(
nachricht
.
getReferencedNachricht
());
var
persistedNachricht
=
getNachricht
(
nachricht
.
getReferencedNachricht
());
linkedNachrichtOptional
=
vorgangMapOptional
.
map
(
nachricht
=
nachricht
.
toBuilder
().
vorgangId
(
persistedNachricht
.
getVorgangId
()).
build
();
vorgangMap
->
Optional
.
of
(
setVorgangId
((
String
)
vorgangMap
.
get
(
VORGANG_ID_FIELD
),
nachricht
)))
.
orElseThrow
();
}
}
linkedNachrichtOptional
.
ifPresent
(
linkedNachricht
->
{
persistMail
(
Optional
.
empty
(),
nachricht
);
persistMail
(
Optional
.
empty
(),
linkedNachricht
);
postfachRemoteService
.
deleteMessage
(
linkedNachricht
.
getMessageId
());
postfachRemoteService
.
deleteMessage
(
nachricht
.
getMessageId
());
});
}
PostfachNachricht
setVorgangId
(
String
vorgangId
,
PostfachNachricht
nachricht
)
{
}
if
(
StringUtils
.
isNotEmpty
(
vorgangId
))
{
return
nachricht
.
toBuilder
().
vorgangId
(
vorgangId
).
build
();
}
throw
new
TechnicalException
(
"Cannot link nachricht ["
+
nachricht
+
"] to vorgang because vorgangId is empty"
);
PostfachNachricht
getNachricht
(
String
id
)
{
return
mapper
.
fromMapToPostfachMail
(
persistingService
.
getById
(
id
));
}
}
void
persistMail
(
Optional
<
String
>
userId
,
PostfachNachricht
mail
)
{
void
persistMail
(
Optional
<
String
>
userId
,
PostfachNachricht
mail
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment