- private void searchForEntitiesOwnedBy(final String owner, final EntityWalker walker) {
- Optional<NormalizedNode<?, ?>> possibleEntityTypes = getDataStore().readNode(ENTITY_TYPES_PATH);
- if(!possibleEntityTypes.isPresent()) {
- return;
- }
-
- LOG.debug("{}: Searching for entities owned by {}", persistenceId(), owner);
-
- searchForEntities(new EntityWalker() {
- @Override
- public void onEntity(MapEntryNode entityTypeNode, MapEntryNode entityNode) {
- Optional<DataContainerChild<? extends PathArgument, ?>> possibleOwner =
- entityNode.getChild(ENTITY_OWNER_NODE_ID);
- if (possibleOwner.isPresent() && owner.equals(possibleOwner.get().getValue().toString())) {
- walker.onEntity(entityTypeNode, entityNode);
- }
- }
- });
- }
-