001/**
002 *
003 * Copyright © 2016 Fernando Ramirez
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.jivesoftware.smackx.push_notifications.element;
018
019import org.jivesoftware.smack.packet.IQ;
020
021import org.jxmpp.jid.Jid;
022
023/**
024 * Disable Push Notifications IQ.
025 *
026 * @see <a href="http://xmpp.org/extensions/xep-0357.html">XEP-0357: Push
027 *      Notifications</a>
028 * @author Fernando Ramirez
029 *
030 */
031public class DisablePushNotificationsIQ extends IQ {
032
033    /**
034     * disable element.
035     */
036    public static final String ELEMENT = "disable";
037
038    /**
039     * the IQ NAMESPACE.
040     */
041    public static final String NAMESPACE = PushNotificationsElements.NAMESPACE;
042
043    private final Jid jid;
044    private final String node;
045
046    public DisablePushNotificationsIQ(Jid jid, String node) {
047        super(ELEMENT, NAMESPACE);
048        this.jid = jid;
049        this.node = node;
050        this.setType(Type.set);
051    }
052
053    public DisablePushNotificationsIQ(Jid jid) {
054        this(jid, null);
055    }
056
057    /**
058     * Get the JID.
059     *
060     * @return the JID
061     */
062    public Jid getJid() {
063        return jid;
064    }
065
066    /**
067     * Get the node.
068     *
069     * @return the node
070     */
071    public String getNode() {
072        return node;
073    }
074
075    @Override
076    protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {
077        xml.attribute("jid", jid);
078        xml.optAttribute("node", node);
079        xml.rightAngleBracket();
080        return xml;
081    }
082
083}