github-code-scanning[bot] commented on code in PR #757:
URL: 
https://github.com/apache/incubator-baremaps/pull/757#discussion_r1308259880


##########
baremaps-core/src/main/java/org/apache/baremaps/openstreetmap/repository/ChangeImporter.java:
##########
@@ -47,28 +51,53 @@
   /** {@inheritDoc} */
   @Override
   public void accept(Change change) {
+    var nodes = change.getEntities().stream()
+        .filter(entity -> entity instanceof Node)
+        .map(entity -> (Node) entity)
+        .toList();
+    var nodeIds = nodes.stream().map(Node::id).toList();
+    var ways = change.getEntities().stream()
+        .filter(entity -> entity instanceof Way)
+        .map(entity -> (Way) entity)
+        .toList();
+    var wayIds = ways.stream().map(Way::id).toList();
+    var relations = change.getEntities().stream()
+        .filter(entity -> entity instanceof Relation)
+        .map(entity -> (Relation) entity)
+        .toList();
+    var relationIds = relations.stream().map(Relation::id).toList();
     try {
-      for (var entity : change.getEntities()) {
-        switch (change.getType()) {
-          case CREATE:
-          case MODIFY:
-            if (entity instanceof Node node) {
-              nodeRepository.put(node);
-            } else if (entity instanceof Way way) {
-              wayRepository.put(way);
-            } else if (entity instanceof Relation relation) {
-              relationRepository.put(relation);
-            }
-            break;
-          case DELETE:
-            if (entity instanceof Node node) {
-              nodeRepository.delete(node.id());
-            } else if (entity instanceof Way way) {
-              wayRepository.delete(way.id());
-            } else if (entity instanceof Relation relation) {
-              relationRepository.delete(relation.id());
-            }
-            break;
+      switch (change.getType()) {

Review Comment:
   ## Missing enum case in switch
   
   Switch statement does not have a case for [MODIFY](1).
   
   [Show more 
details](https://github.com/apache/incubator-baremaps/security/code-scanning/800)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to