2016-07-21 16:40:26 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Copyright © 2016 Fernando Ramirez
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
package org.jivesoftware.smackx.mam.element;
|
|
|
|
|
|
|
|
import org.jivesoftware.smack.packet.IQ;
|
2017-06-14 17:12:43 +02:00
|
|
|
|
2016-07-21 16:40:26 +02:00
|
|
|
import org.jivesoftware.smackx.rsm.packet.RSMSet;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* MAM fin IQ class.
|
2018-05-09 23:06:12 +02:00
|
|
|
*
|
2016-07-21 16:40:26 +02:00
|
|
|
* @see <a href="http://xmpp.org/extensions/xep-0313.html">XEP-0313: Message
|
|
|
|
* Archive Management</a>
|
|
|
|
* @author Fernando Ramirez
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public class MamFinIQ extends IQ {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* fin element.
|
|
|
|
*/
|
|
|
|
public static final String ELEMENT = "fin";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* RSM set.
|
|
|
|
*/
|
|
|
|
private final RSMSet rsmSet;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* if is complete.
|
|
|
|
*/
|
|
|
|
private final boolean complete;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* if is stable.
|
|
|
|
*/
|
|
|
|
private final boolean stable;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* the query id.
|
|
|
|
*/
|
|
|
|
private final String queryId;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* MamFinIQ constructor.
|
2018-05-09 23:06:12 +02:00
|
|
|
*
|
2021-08-26 16:43:34 +02:00
|
|
|
* @param version TODO javadoc me please
|
2019-08-30 12:08:30 +02:00
|
|
|
* @param queryId TODO javadoc me please
|
|
|
|
* @param rsmSet TODO javadoc me please
|
|
|
|
* @param complete TODO javadoc me please
|
|
|
|
* @param stable TODO javadoc me please
|
2016-07-21 16:40:26 +02:00
|
|
|
*/
|
2021-08-26 16:43:34 +02:00
|
|
|
public MamFinIQ(MamVersion version, String queryId, RSMSet rsmSet, boolean complete, boolean stable) {
|
|
|
|
super(ELEMENT, version.getNamespace());
|
2016-07-21 16:40:26 +02:00
|
|
|
if (rsmSet == null) {
|
|
|
|
throw new IllegalArgumentException("rsmSet must not be null");
|
|
|
|
}
|
|
|
|
this.rsmSet = rsmSet;
|
|
|
|
this.complete = complete;
|
|
|
|
this.stable = stable;
|
|
|
|
this.queryId = queryId;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get RSM set.
|
2018-05-09 23:06:12 +02:00
|
|
|
*
|
2016-07-21 16:40:26 +02:00
|
|
|
* @return the RSM set
|
|
|
|
*/
|
|
|
|
public RSMSet getRSMSet() {
|
|
|
|
return rsmSet;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return if it is complete.
|
2018-05-09 23:06:12 +02:00
|
|
|
*
|
2016-07-21 16:40:26 +02:00
|
|
|
* @return true if it is complete
|
|
|
|
*/
|
|
|
|
public boolean isComplete() {
|
|
|
|
return complete;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return if it is stable.
|
2018-05-09 23:06:12 +02:00
|
|
|
*
|
2016-07-21 16:40:26 +02:00
|
|
|
* @return true if it is stable
|
|
|
|
*/
|
|
|
|
public boolean isStable() {
|
|
|
|
return stable;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get query id.
|
2018-05-09 23:06:12 +02:00
|
|
|
*
|
2016-07-21 16:40:26 +02:00
|
|
|
* @return the query id
|
|
|
|
*/
|
|
|
|
public final String getQueryId() {
|
|
|
|
return queryId;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {
|
|
|
|
xml.optAttribute("queryid", queryId);
|
|
|
|
xml.optBooleanAttribute("complete", complete);
|
|
|
|
xml.optBooleanAttribute("stable", stable);
|
|
|
|
if (rsmSet == null) {
|
|
|
|
xml.setEmptyElement();
|
|
|
|
} else {
|
|
|
|
xml.rightAngleBracket();
|
2019-09-07 18:17:08 +02:00
|
|
|
xml.append(rsmSet);
|
2016-07-21 16:40:26 +02:00
|
|
|
}
|
|
|
|
return xml;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|