@Override
    public Iterator<Element> getUserItems(String name, JID senderJID) {
        ArrayList<Element> items = new ArrayList<>();

        JID recipientJID = XMPPServer.getInstance().createJID(name, null, true).asBareJID();
        PEPService pepService = pepServiceManager.getPEPService(recipientJID, false);

        if (pepService != null) {
            CollectionNode rootNode = pepService.getRootCollectionNode();

            Element defaultItem = DocumentHelper.createElement("item");
            defaultItem.addAttribute("jid", recipientJID.toString());

            for (Node node : pepService.getNodes()) {
                // Do not include the root node as an item element.
                if (node == rootNode) {
                    continue;
                }

                AccessModel accessModel = node.getAccessModel();
                if (accessModel.canAccessItems(node, senderJID, recipientJID)) {
                    Element item = defaultItem.createCopy();
                    item.addAttribute("node", node.getUniqueIdentifier().getNodeId());
                    items.add(item);
                }
            }
        }

        return items.iterator();
    }
Implements UserItemsProvider, adding PEP related items to a disco#items
result.
xmppserver/src/main/java/org/jivesoftware/openfire/pep/IQPEPHandler.java