Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
vadere
vadere
Commits
6cc1e7a2
Commit
6cc1e7a2
authored
Jan 25, 2020
by
Benedikt Kleinmeier
Browse files
Added "TargetVersionV1_10" to remove "threatMemory" node
parent
dab8187a
Changes
2
Hide whitespace changes
Inline
Side-by-side
VadereSimulator/src/org/vadere/simulator/entrypoints/Version.java
View file @
6cc1e7a2
...
...
@@ -34,6 +34,7 @@ public enum Version {
V1_7
(
1
,
7
),
V1_8
(
1
,
8
),
V1_9
(
1
,
9
),
V1_10
(
1
,
10
),
;
...
...
VadereSimulator/src/org/vadere/simulator/projects/migration/jsontranformation/json/TargetVersionV1_10.java
0 → 100644
View file @
6cc1e7a2
package
org.vadere.simulator.projects.migration.jsontranformation.json
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
org.vadere.annotation.factories.migrationassistant.MigrationTransformation
;
import
org.vadere.simulator.entrypoints.Version
;
import
org.vadere.simulator.projects.migration.MigrationException
;
import
org.vadere.simulator.projects.migration.jsontranformation.SimpleJsonTransformation
;
/**
* Remove node "threatMemory" under "scenario.topography.dynamicElements.psychologyStatus"
*/
@MigrationTransformation
(
targetVersionLabel
=
"1.10"
)
public
class
TargetVersionV1_10
extends
SimpleJsonTransformation
{
public
TargetVersionV1_10
(){
super
(
Version
.
V1_10
);
}
@Override
protected
void
initDefaultHooks
()
{
addPostHookFirst
(
this
::
removeThreatMemoryNode
);
addPostHookLast
(
this
::
sort
);
}
public
JsonNode
removeThreatMemoryNode
(
JsonNode
node
)
throws
MigrationException
{
String
nodeNameToRemove
=
"threatMemory"
;
JsonNode
dynamicElementsNode
=
path
(
node
,
"scenario/topography/dynamicElements"
);
if
(
dynamicElementsNode
.
isArray
())
{
for
(
JsonNode
dynamicElementNode
:
dynamicElementsNode
)
{
JsonNode
psychologyStatusNode
=
path
(
dynamicElementNode
,
"psychologyStatus"
);
remove
(
psychologyStatusNode
,
nodeNameToRemove
);
}
}
return
node
;
}
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment