class WhitelistAccess extends AccessModel {

    WhitelistAccess() {
    }

    @Override
    public boolean canSubscribe(Node node, JID owner, JID subscriber) {<FILL_FUNCTION_BODY>}

    @Override
    public boolean canAccessItems(Node node, JID owner, JID subscriber) {
        return canSubscribe(node, owner, subscriber);
    }

    @Override
    public String getName() {
        return "whitelist";
    }

    @Override
    public PacketError.Condition getSubsriptionError() {
        return PacketError.Condition.not_allowed;
    }

    @Override
    public Element getSubsriptionErrorDetail() {
        return DocumentHelper.createElement(
                QName.get("closed-node", "http://jabber.org/protocol/pubsub#errors"));
    }

    @Override
    public boolean isAuthorizationRequired() {
        return false;
    }
}

        // Let node owners and sysadmins always subcribe to the node
        if (node.isAdmin(owner)) {
            return true;
        }
        // User is in the whitelist if he has an affiliation and it is not of type outcast
        NodeAffiliate nodeAffiliate = node.getAffiliate(owner);
        return nodeAffiliate != null &&
                nodeAffiliate.getAffiliation() != NodeAffiliate.Affiliation.outcast;
    
<methods>public non-sealed void <init>() ,public abstract boolean canAccessItems(org.jivesoftware.openfire.pubsub.Node, JID, JID) ,public abstract boolean canSubscribe(org.jivesoftware.openfire.pubsub.Node, JID, JID) ,public abstract java.lang.String getName() ,public abstract PacketError.Condition getSubsriptionError() ,public abstract Element getSubsriptionErrorDetail() ,public abstract boolean isAuthorizationRequired() ,public static org.jivesoftware.openfire.pubsub.models.AccessModel valueOf(java.lang.String) <variables>public static final org.jivesoftware.openfire.pubsub.models.AccessModel authorize,public static final org.jivesoftware.openfire.pubsub.models.AccessModel open,public static final org.jivesoftware.openfire.pubsub.models.AccessModel presence,public static final org.jivesoftware.openfire.pubsub.models.AccessModel roster,public static final org.jivesoftware.openfire.pubsub.models.AccessModel whitelist