📄 pubsubentity.java
字号:
package edu.ou.kmi.buddyspace.plugins.pubsub.xml;
/*
* PubsubEntity.java
*
* Project: BuddySpace
* (C) Copyright Knowledge Media Institute 2003
*
*
* Created on 9 October 2003, 18:37
*/
import java.util.*;
import org.jabber.jabberbeans.util.*;
import org.jabber.jabberbeans.*;
import org.jabber.jabberbeans.Extension.*;
/**
* <code>PubsubEntity</code> contains <entity> tag
* from pubsub.
*
* @author Jiri Komzak, Knowledge Media Institute, Open University, United Kingdom
*/
public class PubsubEntity
extends XMLData
{
/** Node name */
private String node;
/** JID */
private JID jid;
/** Subscription */
private String subscription;
/** Affilitation */
private String affiliation;
/** Subscribe-options */
private PubsubSubscribeOpt subOpt;
/** Error code */
private String errCode;
/** Error text */
private String errText;
/**
* Creates a new <code>PubsubEntity</code> instance, based on the builder
* state.
*
* @param builder an <code>PubsubEntityBuilder</code> value
* @exception InstantiationException if malformed or insufficient data is
* in the builder.
*/
public PubsubEntity(PubsubEntityBuilder builder)
throws InstantiationException
{
subscription = builder.getSubscription();
affiliation = builder.getAffiliation();
node = builder.getNode();
subOpt = builder.getSubscribeOpt();
jid = builder.getJID();
errCode = builder.getErrorCode();
errText = builder.getErrorText();
}
public String getNode() {
return node;
}
public String getSubscription() {
return subscription;
}
public String getAffiliation() {
return affiliation;
}
public XMLData getSubscribeOpt() {
return subOpt;
}
public JID getJID() {
return jid;
}
public String getErrorCode() {
return errCode;
}
public String getErrorText() {
return errText;
}
/**
* <code>appendItem</code> appends the XML representation of the
* current packet data to the specified <code>StringBuffer</code>.
*
* @param retval The <code>StringBuffer</code> to append to
*/
public void appendItem(StringBuffer retval)
{
retval.append("<entity");
if (node != null)
retval.append(" node='" + node + "'");
if (jid != null)
retval.append(" jid='" + jid.toString() + "'");
if (subscription != null)
retval.append(" subscription='" + subscription + "'");
if (affiliation != null)
retval.append(" affiliation='" + affiliation + "'");
boolean emptyTag = true;
if (subOpt != null) {
retval.append(">");
emptyTag = false;
subOpt.appendItem(retval);
}
if (errCode != null || errText != null) {
if (emptyTag)
retval.append(">");
emptyTag = false;
retval.append("<error");
if (errCode != null)
retval.append(" code='" + errCode + "'");
if (errText != null)
retval.append(">" + errText + "</error>");
else
retval.append("/>");
}
if (!emptyTag)
retval.append("</entity>");
else
retval.append("/>");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -