congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Affiliation
Code IndexAdd Tabnine to your IDE (free)

How to use
Affiliation
in
org.jivesoftware.smackx.pubsub

Best Java code snippets using org.jivesoftware.smackx.pubsub.Affiliation (Showing top 13 results out of 315)

origin: igniterealtime/Smack

@Override
public Affiliation parse(XmlPullParser parser, int initialDepth)
    throws Exception {
  String node = parser.getAttributeValue(null, "node");
  BareJid jid = ParserUtils.getBareJidAttribute(parser);
  String namespaceString = parser.getNamespace();
  AffiliationNamespace namespace = AffiliationNamespace.fromXmlns(namespaceString);
  String affiliationString = parser.getAttributeValue(null, "affiliation");
  Affiliation.Type affiliationType = null;
  if (affiliationString != null) {
    affiliationType = Affiliation.Type.valueOf(affiliationString);
  }
  Affiliation affiliation;
  if (node != null && jid == null) {
    // affiliationType may be empty
    affiliation = new Affiliation(node, affiliationType, namespace);
  }
  else if (node == null && jid != null) {
    affiliation = new Affiliation(jid, affiliationType, namespace);
  }
  else {
    throw new SmackException("Invalid affililation. Either one of 'node' or 'jid' must be set"
        + ". Node: " + node
        + ". Jid: " + jid
        + '.');
  }
  return affiliation;
}
origin: igniterealtime/Smack

  new Affiliation(JidTestUtil.BARE_JID_1, Affiliation.Type.member),
  new Affiliation(JidTestUtil.BARE_JID_2, Affiliation.Type.publisher)
);
AffiliationsExtension affiliationsExtension = new AffiliationsExtension(AffiliationNamespace.owner, affiliations);
assertEquals(affiliationOne.getJid(), JidTestUtil.BARE_JID_1);
assertEquals(affiliationOne.getAffiliation(), Affiliation.Type.member);
assertEquals(affiliationTwo.getJid(), JidTestUtil.BARE_JID_2);
assertEquals(affiliationTwo.getAffiliation(), Affiliation.Type.publisher);
origin: tiandawu/IotXmpp

public String toXML()
{
  StringBuilder builder = new StringBuilder("<");
  builder.append(getElementName());
  if (node != null)
    appendAttribute(builder, "node", node);
  appendAttribute(builder, "jid", jid);
  appendAttribute(builder, "affiliation", type.toString());
  
  builder.append("/>");
  return builder.toString();
}
origin: org.igniterealtime.smack/smackx

  @Override
  public String toXML()
  {
    if ((items == null) || (items.size() == 0))
    {
      return super.toXML();
    }
    else
    {
      StringBuilder builder = new StringBuilder("<");
      builder.append(getElementName());
      builder.append(">");
      
      for (Affiliation item : items)
      {
        builder.append(item.toXML());
      }
      
      builder.append("</");
      builder.append(getElementName());
      builder.append(">");
      return builder.toString();
    }
  }
}
origin: igniterealtime/Smack

/**
 * Get the type.
 *
 * @return the type.
 * @deprecated use {@link #getAffiliation()} instead.
 */
@Deprecated
public Type getType() {
  return getAffiliation();
}
origin: org.littleshoot/smack-xmpp-3-2-2

public String toXML()
{
  StringBuilder builder = new StringBuilder("<");
  builder.append(getElementName());
  appendAttribute(builder, "node", node);
  appendAttribute(builder, "affiliation", type.toString());
  
  builder.append("/>");
  return builder.toString();
}
origin: org.littleshoot/smack-xmpp-3-2-2

  @Override
  public String toXML()
  {
    if ((items == null) || (items.size() == 0))
    {
      return super.toXML();
    }
    else
    {
      StringBuilder builder = new StringBuilder("<");
      builder.append(getElementName());
      builder.append(">");
      
      for (Affiliation item : items)
      {
        builder.append(item.toXML());
      }
      
      builder.append("</");
      builder.append(getElementName());
      builder.append(">");
      return builder.toString();
    }
  }
}
origin: igniterealtime/Smack

@Test
public void testAffiliationsExtensionToXml() throws SAXException, IOException {
  BareJid affiliatedJid = JidTestUtil.BARE_JID_1;
  Affiliation affiliation = new Affiliation(affiliatedJid, Type.member);
  List<Affiliation> affiliationsList = new ArrayList<>();
  affiliationsList.add(affiliation);
  AffiliationsExtension affiliationsExtension = new AffiliationsExtension(affiliationsList, "testNode");
  CharSequence xml = affiliationsExtension.toXML(null);
  assertXMLEqual("<affiliations node='testNode'><affiliation xmlns='http://jabber.org/protocol/pubsub#owner' jid='one@exampleone.org' affiliation='member'/></affiliations>",
          xml.toString());
}
origin: org.igniterealtime.smack/smackx

public String toXML()
{
  StringBuilder builder = new StringBuilder("<");
  builder.append(getElementName());
  appendAttribute(builder, "node", node);
  appendAttribute(builder, "affiliation", type.toString());
  
  builder.append("/>");
  return builder.toString();
}
origin: tiandawu/IotXmpp

builder.append(item.toXML());
origin: org.littleshoot/smack-xmpp-3-2-2

@Override
protected PacketExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
{
  return new Affiliation(attributeMap.get("node"), Affiliation.Type.valueOf(attributeMap.get("affiliation")));
}
origin: tiandawu/IotXmpp

@Override
protected PacketExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
{
  return new Affiliation(attributeMap.get("jid"), attributeMap.get("node"), Affiliation.Type.valueOf(attributeMap.get("affiliation")));
}
origin: org.igniterealtime.smack/smackx

@Override
protected PacketExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
{
  return new Affiliation(attributeMap.get("node"), Affiliation.Type.valueOf(attributeMap.get("affiliation")));
}
org.jivesoftware.smackx.pubsubAffiliation

Javadoc

Represents a affiliation between a user and a node, where the #type defines the type of affiliation. Affiliations are retrieved from the PubSubManager#getAffiliations() method, which gets affiliations for the calling user, based on the identity that is associated with the Connection.

Most used methods

  • <init>
  • appendAttribute
  • getElementName
  • toXML
  • getAffiliation
  • getJid
  • getNode
  • getPubSubNamespace

Popular in Java

  • Reading from database using SQL prepared statement
  • requestLocationUpdates (LocationManager)
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Runner (org.openjdk.jmh.runner)
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now