Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vorgang-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
vorgang-manager
Commits
f782963c
Commit
f782963c
authored
4 months ago
by
Felix Reichenbach
Browse files
Options
Downloads
Patches
Plain Diff
OZG-7515 remove comand objects from migration
parent
0657c181
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!11
Ozg 7515 migrate patch item command
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
vorgang-manager-server/src/main/java/de/ozgcloud/vorgang/common/migration/M014_AddItemNameBescheidToPatchAttachedItemCommand.java
+7
-5
7 additions, 5 deletions
...n/M014_AddItemNameBescheidToPatchAttachedItemCommand.java
with
7 additions
and
5 deletions
vorgang-manager-server/src/main/java/de/ozgcloud/vorgang/common/migration/M014_AddItemNameBescheidToPatchAttachedItemCommand.java
+
7
−
5
View file @
f782963c
...
@@ -25,13 +25,13 @@ package de.ozgcloud.vorgang.common.migration;
...
@@ -25,13 +25,13 @@ package de.ozgcloud.vorgang.common.migration;
import
java.util.List
;
import
java.util.List
;
import
org.bson.Document
;
import
org.bson.types.ObjectId
;
import
org.springframework.data.mongodb.core.MongoOperations
;
import
org.springframework.data.mongodb.core.MongoOperations
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Update
;
import
org.springframework.data.mongodb.core.query.Update
;
import
de.ozgcloud.command.Command
;
import
de.ozgcloud.vorgang.command.PersistedCommand
;
import
io.mongock.api.annotations.ChangeUnit
;
import
io.mongock.api.annotations.ChangeUnit
;
import
io.mongock.api.annotations.Execution
;
import
io.mongock.api.annotations.Execution
;
import
io.mongock.api.annotations.RollbackExecution
;
import
io.mongock.api.annotations.RollbackExecution
;
...
@@ -39,6 +39,7 @@ import io.mongock.api.annotations.RollbackExecution;
...
@@ -39,6 +39,7 @@ import io.mongock.api.annotations.RollbackExecution;
@ChangeUnit
(
id
=
"2025-01-17 16:00:00 OZG-7515"
,
order
=
"M014"
,
author
=
"freichenbach"
,
runAlways
=
true
)
@ChangeUnit
(
id
=
"2025-01-17 16:00:00 OZG-7515"
,
order
=
"M014"
,
author
=
"freichenbach"
,
runAlways
=
true
)
public
class
M014_AddItemNameBescheidToPatchAttachedItemCommand
{
// NOSONAR
public
class
M014_AddItemNameBescheidToPatchAttachedItemCommand
{
// NOSONAR
private
static
final
String
COMMAND_COLLECTION_NAME
=
"command"
;
private
static
final
String
ORDER_FIELD
=
"order"
;
private
static
final
String
ORDER_FIELD
=
"order"
;
private
static
final
String
SEND_BESCHEID_ORDER
=
"SEND_BESCHEID"
;
private
static
final
String
SEND_BESCHEID_ORDER
=
"SEND_BESCHEID"
;
private
static
final
String
PARENT_ID_FIELD
=
"bodyObject.parentId"
;
private
static
final
String
PARENT_ID_FIELD
=
"bodyObject.parentId"
;
...
@@ -53,8 +54,9 @@ public class M014_AddItemNameBescheidToPatchAttachedItemCommand { // NOSONAR
...
@@ -53,8 +54,9 @@ public class M014_AddItemNameBescheidToPatchAttachedItemCommand { // NOSONAR
}
}
List
<
String
>
getSendBescheidCommandIds
(
MongoOperations
mongoOperations
)
{
List
<
String
>
getSendBescheidCommandIds
(
MongoOperations
mongoOperations
)
{
var
commands
=
mongoOperations
.
find
(
Query
.
query
(
Criteria
.
where
(
ORDER_FIELD
).
is
(
SEND_BESCHEID_ORDER
)),
PersistedCommand
.
class
);
var
commands
=
mongoOperations
.
find
(
Query
.
query
(
Criteria
.
where
(
ORDER_FIELD
).
is
(
SEND_BESCHEID_ORDER
)),
Document
.
class
,
return
commands
.
stream
().
map
(
Command:
:
getId
).
toList
();
COMMAND_COLLECTION_NAME
);
return
commands
.
stream
().
map
(
command
->
command
.
getObjectId
(
"_id"
)).
map
(
ObjectId:
:
toString
).
toList
();
}
}
private
void
updateDocuments
(
MongoOperations
mongoOperations
,
List
<
String
>
parentIds
)
{
private
void
updateDocuments
(
MongoOperations
mongoOperations
,
List
<
String
>
parentIds
)
{
...
@@ -63,7 +65,7 @@ public class M014_AddItemNameBescheidToPatchAttachedItemCommand { // NOSONAR
...
@@ -63,7 +65,7 @@ public class M014_AddItemNameBescheidToPatchAttachedItemCommand { // NOSONAR
Criteria
.
where
(
ORDER_FIELD
).
is
(
PATCH_ATTACHED_ITEM_ORDER
),
Criteria
.
where
(
ORDER_FIELD
).
is
(
PATCH_ATTACHED_ITEM_ORDER
),
Criteria
.
where
(
ITEM_NAME_FILED
).
exists
(
false
)));
Criteria
.
where
(
ITEM_NAME_FILED
).
exists
(
false
)));
var
update
=
new
Update
().
set
(
ITEM_NAME_FILED
,
BESCHEID_ITEM_NAME
);
var
update
=
new
Update
().
set
(
ITEM_NAME_FILED
,
BESCHEID_ITEM_NAME
);
mongoOperations
.
updateMulti
(
query
,
update
,
PersistedCommand
.
class
);
mongoOperations
.
updateMulti
(
query
,
update
,
COMMAND_COLLECTION_NAME
);
}
}
@RollbackExecution
@RollbackExecution
...
...
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