public boolean canSendPublicationEvent(LeafNode leafNode, PublishedItem publishedItem) {
        if (!canSendEvents()) {
            return false;
        }
        // Check that any defined keyword was matched (applies only if an item was published)
        if (publishedItem != null && !isKeywordMatched(publishedItem)) {
            Log.trace("Cannot send publication event: published item does not match the configured keyword filter.");
            return false;
        }
        // Check special conditions when subscribed to collection node
        if (node.isCollectionNode()) {
            // Check if not subscribe to items
            if (Type.items != type) {
                Log.trace("Cannot send publication event: not subscribed to 'items' of this collection node.");
                return false;
            }
            // Check if published node is a first-level child of the subscribed node
            if (getDepth() == 1 && !node.isChildNode(leafNode)) {
                Log.trace("Cannot send publication event: published node is not a first-level node of this subscribed node.");
                return false;
            }
            // Check if published node is a descendant child of the subscribed node
            if (getDepth() == 0 && !node.isDescendantNode(leafNode)) {
                Log.trace("Cannot send publication event: published node is not a descendant child of the subscribed node.");
                return false;
            }
        }
        if (!leafNode.getAccessModel().canAccessItems(leafNode, this.owner, this.getJID())) {
            return false;
        }

        Log.trace("Can send publication node event.");
        return true;
    }
Returns true if an event notification can be sent to the subscriber for the specified
published item based on the subscription configuration and subscriber status.

@param leafNode the node that received the publication.
@param publishedItem the published item to send or null if the publication didn't
       contain an item.
@return true if an event notification can be sent to the subscriber for the specified
        published item.
xmppserver/src/main/java/org/jivesoftware/openfire/pubsub/NodeSubscription.java