Search in sources :

Example 66 with Element

use of org.dom4j.Element in project Openfire by igniterealtime.

the class AdminConsole method overrideTab.

private static void overrideTab(Element tab, Element overrideTab) {
    // Override name, url, description.
    if (overrideTab.attributeValue("name") != null) {
        tab.addAttribute("name", overrideTab.attributeValue("name"));
    }
    if (overrideTab.attributeValue("url") != null) {
        tab.addAttribute("url", overrideTab.attributeValue("url"));
    }
    if (overrideTab.attributeValue("description") != null) {
        tab.addAttribute("description", overrideTab.attributeValue("description"));
    }
    if (overrideTab.attributeValue("plugin") != null) {
        tab.addAttribute("plugin", overrideTab.attributeValue("plugin"));
    }
    // Override sidebar items.
    for (Iterator i = overrideTab.elementIterator(); i.hasNext(); ) {
        Element sidebar = (Element) i.next();
        String id = sidebar.attributeValue("id");
        Element existingSidebar = getElemnetByID(id);
        // Simple case, there is no existing sidebar with the same id.
        if (existingSidebar == null) {
            tab.add(sidebar.createCopy());
        } else // More complex case -- a sidebar with the same id already exists.
        // In this case, we have to overrite only the difference between
        // the two elements.
        {
            overrideSidebar(existingSidebar, sidebar);
        }
    }
}
Also used : Element(org.dom4j.Element) Iterator(java.util.Iterator)

Example 67 with Element

use of org.dom4j.Element in project Openfire by igniterealtime.

the class ChangeNickname method readExternal.

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    super.readExternal(in);
    Element packetElement = (Element) ExternalizableUtil.getInstance().readSerializable(in);
    presence = new Presence(packetElement, true);
    oldNick = ExternalizableUtil.getInstance().readSafeUTF(in);
    newNick = ExternalizableUtil.getInstance().readSafeUTF(in);
}
Also used : DefaultElement(org.dom4j.tree.DefaultElement) Element(org.dom4j.Element) Presence(org.xmpp.packet.Presence)

Example 68 with Element

use of org.dom4j.Element in project Openfire by igniterealtime.

the class OccupantAddedEvent method readExternal.

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    super.readExternal(in);
    Element packetElement = (Element) ExternalizableUtil.getInstance().readSerializable(in);
    presence = new Presence(packetElement, true);
    role = ExternalizableUtil.getInstance().readInt(in);
    affiliation = ExternalizableUtil.getInstance().readInt(in);
    voiceOnly = ExternalizableUtil.getInstance().readBoolean(in);
    roleAddress = (JID) ExternalizableUtil.getInstance().readSerializable(in);
    userAddress = (JID) ExternalizableUtil.getInstance().readSerializable(in);
    nodeID = NodeID.getInstance(ExternalizableUtil.getInstance().readByteArray(in));
    sendPresence = ExternalizableUtil.getInstance().readBoolean(in);
}
Also used : DefaultElement(org.dom4j.tree.DefaultElement) Element(org.dom4j.Element) Presence(org.xmpp.packet.Presence)

Example 69 with Element

use of org.dom4j.Element in project Openfire by igniterealtime.

the class UpdateOccupant method readExternal.

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    super.readExternal(in);
    Element packetElement = (Element) ExternalizableUtil.getInstance().readSerializable(in);
    presence = new Presence(packetElement, true);
    nickname = ExternalizableUtil.getInstance().readSafeUTF(in);
    role = ExternalizableUtil.getInstance().readInt(in);
    affiliation = ExternalizableUtil.getInstance().readInt(in);
}
Also used : DefaultElement(org.dom4j.tree.DefaultElement) Element(org.dom4j.Element) Presence(org.xmpp.packet.Presence)

Example 70 with Element

use of org.dom4j.Element in project Openfire by igniterealtime.

the class UpdatePresence method readExternal.

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    super.readExternal(in);
    Element packetElement = (Element) ExternalizableUtil.getInstance().readSerializable(in);
    presence = new Presence(packetElement, true);
    nickname = ExternalizableUtil.getInstance().readSafeUTF(in);
}
Also used : DefaultElement(org.dom4j.tree.DefaultElement) Element(org.dom4j.Element) Presence(org.xmpp.packet.Presence)

Aggregations

Element (org.dom4j.Element)2207 Document (org.dom4j.Document)500 ArrayList (java.util.ArrayList)294 List (java.util.List)249 SAXReader (org.dom4j.io.SAXReader)196 Iterator (java.util.Iterator)163 IQ (org.xmpp.packet.IQ)142 HashMap (java.util.HashMap)135 IOException (java.io.IOException)114 File (java.io.File)101 Attribute (org.dom4j.Attribute)97 StringReader (java.io.StringReader)90 DefaultElement (org.dom4j.tree.DefaultElement)87 JID (org.xmpp.packet.JID)87 Test (org.junit.jupiter.api.Test)78 DocumentException (org.dom4j.DocumentException)74 QName (org.dom4j.QName)68 AnnotatedElement (java.lang.reflect.AnnotatedElement)64 Node (org.dom4j.Node)64 Test (org.junit.Test)64