Skip to content

Commit c84b697

Browse files
committed
Move applying failIfMissing to its own function
1 parent 46107e7 commit c84b697

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

applications/graph-store-catalog/src/main/java/org/neo4j/gds/applications/graphstorecatalog/DefaultGraphCatalogApplications.java

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -548,17 +548,11 @@ public GraphDropNodePropertiesResult dropNodeProperties(
548548
var graphStoreWithConfig = graphStoreCatalogService.get(CatalogRequest.of(user, databaseId), graphName);
549549
var graphStore = graphStoreWithConfig.graphStore();
550550

551-
552-
List<String> droppedProperties;
553-
if (configuration.failIfMissing()) {
554-
graphStoreValidationService.ensureNodePropertiesExist(graphStore, configuration.nodeProperties());
555-
droppedProperties = configuration.nodeProperties();
556-
} else {
557-
droppedProperties = graphStoreValidationService.filterExistingNodeProperties(
558-
graphStore,
559-
configuration.nodeProperties()
560-
);
561-
}
551+
var droppedProperties = gatherDroppedProperties(
552+
graphStore,
553+
configuration.nodeProperties(),
554+
configuration.failIfMissing()
555+
);
562556

563557
var numberOfPropertiesRemoved = dropNodePropertiesApplication.compute(
564558
taskRegistryFactory,
@@ -574,6 +568,19 @@ public GraphDropNodePropertiesResult dropNodeProperties(
574568
);
575569
}
576570

571+
private List<String> gatherDroppedProperties(
572+
GraphStore graphStore,
573+
List<String> nodeProperties,
574+
boolean failIfMissing
575+
) {
576+
if (failIfMissing) {
577+
graphStoreValidationService.ensureNodePropertiesExist(graphStore, nodeProperties);
578+
return nodeProperties;
579+
} else {
580+
return graphStoreValidationService.filterExistingNodeProperties(graphStore, nodeProperties);
581+
}
582+
}
583+
577584
@Override
578585
public GraphDropRelationshipResult dropRelationships(
579586
User user,

0 commit comments

Comments
 (0)