Codota Logo
Subscription.<init>
Code IndexAdd Codota to your IDE (free)

How to use
org.jivesoftware.smackx.pubsub.Subscription
constructor

Best Java code snippets using org.jivesoftware.smackx.pubsub.Subscription.<init> (Showing top 5 results out of 315)

  • Common ways to obtain Subscription
private void myMethod () {
Subscription s =
  • Codota IconPubSub pubSub;PubSubElementType elem;(Subscription) pubSub.getExtension(elem)
  • Smart code suggestions by Codota
}
origin: igniterealtime/Smack

@Override
public Subscription parse(XmlPullParser parser, int initialDepth)
        throws XmlPullParserException, IOException {
  Jid jid = ParserUtils.getJidAttribute(parser);
  String nodeId = parser.getAttributeValue(null, "node");
  String subId = parser.getAttributeValue(null, "subid");
  String state = parser.getAttributeValue(null, "subscription");
  boolean isRequired = false;
  int tag = parser.next();
  if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("subscribe-options")) {
    tag = parser.next();
    if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("required"))
      isRequired = true;
    while (tag != XmlPullParser.END_TAG && !parser.getName().equals("subscribe-options")) tag = parser.next();
  }
  while (parser.getEventType() != XmlPullParser.END_TAG) parser.next();
  return new Subscription(jid, nodeId, subId, (state == null ? null : Subscription.State.valueOf(state)), isRequired);
}
origin: igniterealtime/Smack

@Test
public void modifySubscriptionsAsOwnerTest() throws InterruptedException, SmackException, IOException, XMPPException, Exception {
  ThreadedDummyConnection con = ThreadedDummyConnection.newInstance();
  PubSubManager mgr = new PubSubManager(con, JidTestUtil.PUBSUB_EXAMPLE_ORG);
  Node testNode = new LeafNode(mgr, "princely_musings");
  List<Subscription> ChangeSubs = Arrays.asList(
    new Subscription(JidCreate.from("romeo@montague.org"), Subscription.State.subscribed),
    new Subscription(JidCreate.from("juliet@capulet.org"), Subscription.State.none)
  );
  testNode.modifySubscriptionsAsOwner(ChangeSubs);
  PubSub request = con.getSentPacket();
  assertEquals("http://jabber.org/protocol/pubsub#owner", request.getChildElementNamespace());
  assertEquals("pubsub", request.getChildElementName());
  XmlPullParser parser = TestUtils.getIQParser(request.toXML(null).toString());
  PubSub pubsubResult = (PubSub) PacketParserUtils.parseIQ(parser);
  SubscriptionsExtension subElem = pubsubResult.getExtension(PubSubElementType.SUBSCRIPTIONS_OWNER);
  List<Subscription> subscriptions = subElem.getSubscriptions();
  assertEquals(2, subscriptions.size());
  Subscription sub1 = subscriptions.get(0);
  assertEquals("romeo@montague.org", sub1.getJid().toString());
  assertEquals(Subscription.State.subscribed, sub1.getState());
  Subscription sub2 = subscriptions.get(1);
  assertEquals("juliet@capulet.org", sub2.getJid().toString());
  assertEquals(Subscription.State.none, sub2.getState());
}
origin: org.littleshoot/smack-xmpp-3-2-2

public PacketExtension parseExtension(XmlPullParser parser) throws Exception
{
  String jid = parser.getAttributeValue(null, "jid");
  String nodeId = parser.getAttributeValue(null, "node");
  String subId = parser.getAttributeValue(null, "subid");
  String state = parser.getAttributeValue(null, "subscription");
  boolean isRequired = false;
  int tag = parser.next();
  
  if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("subscribe-options"))
  {
    tag = parser.next();
    
    if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("required"))
      isRequired = true;
    
    while (parser.next() != XmlPullParser.END_TAG && parser.getName() != "subscribe-options");
  }
  while (parser.getEventType() != XmlPullParser.END_TAG) parser.next();
  return new Subscription(jid, nodeId, subId, (state == null ? null : Subscription.State.valueOf(state)), isRequired);
}
origin: org.igniterealtime.smack/smackx

public PacketExtension parseExtension(XmlPullParser parser) throws Exception
{
  String jid = parser.getAttributeValue(null, "jid");
  String nodeId = parser.getAttributeValue(null, "node");
  String subId = parser.getAttributeValue(null, "subid");
  String state = parser.getAttributeValue(null, "subscription");
  boolean isRequired = false;
  int tag = parser.next();
  
  if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("subscribe-options"))
  {
    tag = parser.next();
    
    if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("required"))
      isRequired = true;
    
    while (parser.next() != XmlPullParser.END_TAG && parser.getName() != "subscribe-options");
  }
  while (parser.getEventType() != XmlPullParser.END_TAG) parser.next();
  return new Subscription(jid, nodeId, subId, (state == null ? null : Subscription.State.valueOf(state)), isRequired);
}
origin: tiandawu/IotXmpp

public PacketExtension parseExtension(XmlPullParser parser) throws Exception
{
  String jid = parser.getAttributeValue(null, "jid");
  String nodeId = parser.getAttributeValue(null, "node");
  String subId = parser.getAttributeValue(null, "subid");
  String state = parser.getAttributeValue(null, "subscription");
  boolean isRequired = false;
  int tag = parser.next();
  
  if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("subscribe-options"))
  {
    tag = parser.next();
    
    if ((tag == XmlPullParser.START_TAG) && parser.getName().equals("required"))
      isRequired = true;
    
    while (parser.next() != XmlPullParser.END_TAG && parser.getName() != "subscribe-options");
  }
  while (parser.getEventType() != XmlPullParser.END_TAG) parser.next();
  return new Subscription(jid, nodeId, subId, (state == null ? null : Subscription.State.valueOf(state)), isRequired);
}
org.jivesoftware.smackx.pubsubSubscription<init>

Javadoc

Used to constructs a subscription request to the root node with the specified JID.

Popular methods of Subscription

  • getNode
  • toXML
  • appendAttribute
  • getJid
    Gets the JID the subscription is created for.
  • getId
    Gets the subscription id
  • getState
    Gets the current subscription state.

Popular in Java

  • Finding current android device location
  • setScale (BigDecimal)
  • setContentView (Activity)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • JFrame (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now