Example usage for org.dom4j Element addAttribute

List of usage examples for org.dom4j Element addAttribute

Introduction

In this page you can find the example usage for org.dom4j Element addAttribute.

Prototype

Element addAttribute(QName qName, String value);

Source Link

Document

Adds the attribute value of the given fully qualified name.

Usage

From source file:com.pureinfo.srm.config.notice.model.NoticeItem.java

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 *///w  ww  .  ja v a  2  s  . c o m
public void toXMLElement(Element _element) throws PureException {
    _element.addAttribute(ATTRIBUTE_NAME, m_sName);
    _element.addElement(ELEMENT_CHECKED).addText(String.valueOf(m_bChecked));
    _element.addElement(ELEMENT_DAY).addText(String.valueOf(m_nDay));
    _element.add(XMLUtil.createElement(ELEMENT_TEXT, m_sText, true));
}

From source file:com.pureinfo.srm.config.workflow.model.WfActivity.java

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 *///from  www  . jav  a2s. c om
public void toXMLElement(Element _element) throws PureException {
    _element.addAttribute(ATTRIBUTE_NAME, m_sName);

    if (m_roles == null)
        return;

    for (Iterator iter = m_roles.keySet().iterator(); iter.hasNext();) {
        Element role = _element.addElement(ELEMENT_ROLEREF);
        role.addAttribute(ATTRIBUTE_ID, (String) iter.next());
    }
}

From source file:com.pureinfo.srm.config.workflow.model.WfProcess.java

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 *///  w  w w. ja  va 2 s .  co  m
public void toXMLElement(Element _element) throws PureException {
    _element.addAttribute(ATTRIBUTE_NAME, m_sName);
    _element.addAttribute(ATTRIBUTE_TYPE, m_sType);

    for (Iterator iter = m_actities.keySet().iterator(); iter.hasNext();) {
        WfActivity act = (WfActivity) m_actities.get(iter.next());
        Element actEle = _element.addElement(ELEMENT_ACTIVITY);
        act.toXMLElement(actEle);
    }
}

From source file:com.pureinfo.srm.config.workflow.model.WfRole.java

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 *//* w ww .  j ava 2 s .co  m*/
public void toXMLElement(Element _element) throws PureException {
    _element.addAttribute(ATTRIBUTE_ID, m_sName);
    _element.addAttribute(ATTRIBUTE_DESC, m_sDesc);
}

From source file:com.pureinfo.srm.org.action.SubQueryAction.java

License:Open Source License

/**
 * @param _groups/*from   w  w  w. ja v a  2s  .c  o m*/
 * @return
 */
private Document groups2Doc(OPGroup[] _groups) {
    Document doc = DocumentHelper.createDocument();

    Element xRoot = doc.addElement("datas");
    Element xType = xRoot.addElement("types");
    xType.addAttribute("default", _groups[0].sDefault);
    Element xOP = xType.addElement("type");
    xOP.addText("----");
    xOP.addAttribute("value", "");
    for (int i = 0; i < _groups[0].options.length; i++) {
        xOP = xType.addElement("type");
        xOP.addText(_groups[0].options[i][1]);
        xOP.addAttribute("value", _groups[0].options[i][0]);
    }

    if (_groups[1] == null) {
        Element xV1 = xRoot.addElement("level0");
        xOP = xV1.addElement("org");
        xOP.addText("----");
        xOP.addAttribute("value", "");
    } else {
        Element xV1 = xRoot.addElement("level0");
        xV1.addAttribute("default", _groups[1].sDefault);
        xOP = xV1.addElement("org");
        xOP.addText("----");
        xOP.addAttribute("value", "");
        for (int i = 0; i < _groups[1].options.length; i++) {
            xOP = xV1.addElement("org");
            xOP.addText(_groups[1].options[i][1]);
            xOP.addAttribute("value", _groups[1].options[i][0]);
            if (_groups[1].options[i].length > 2) {
                xOP.addAttribute("code", _groups[1].options[i][2]);
            }
        }
    }

    if (_groups[2] == null) {
        Element xV1 = xRoot.addElement("level1");
        xOP = xV1.addElement("org");
        xOP.addText("----");
        xOP.addAttribute("value", "");
    } else {
        OPGroup group = _groups[2];
        if (group.options.length == 0) {
            Element xV1 = xRoot.addElement("level1");
            xV1.addAttribute("default", group.sDefault);
            xOP = xV1.addElement("org");
            xOP.addText("");
            xOP.addAttribute("value", "");
        } else {
            Element xV1 = xRoot.addElement("level1");
            xV1.addAttribute("default", group.sDefault);
            xOP = xV1.addElement("org");
            xOP.addText("----");
            xOP.addAttribute("value", "");
            for (int i = 0; i < group.options.length; i++) {
                xOP = xV1.addElement("org");
                xOP.addText(group.options[i][1]);
                xOP.addAttribute("value", group.options[i][0]);
                if (group.options[i].length > 2) {
                    xOP.addAttribute("code", group.options[i][2]);
                }
            }
        }
    }

    if (_groups.length > 3 && _groups[3] != null) {
        OPGroup group = _groups[3];
        if (group.options.length == 0) {
            Element xV1 = xRoot.addElement("level1_2");
            xV1.addAttribute("default", group.sDefault);
            xOP = xV1.addElement("org");
            xOP.addText("");
            xOP.addAttribute("value", "");
        } else {
            Element xV1 = xRoot.addElement("level1_2");
            xV1.addAttribute("default", group.sDefault);
            xOP = xV1.addElement("org");
            xOP.addText("----");
            xOP.addAttribute("value", "");
            for (int i = 0; i < group.options.length; i++) {
                xOP = xV1.addElement("org");
                xOP.addText(group.options[i][1]);
                xOP.addAttribute("value", _groups[3].options[i][0]);
                if (group.options[i].length > 2) {
                    xOP.addAttribute("code", group.options[i][2]);
                }
            }
        }
    }

    return doc;
}

From source file:com.pureinfo.srm.reports.table.data.institute.InstituteQueryAction.java

License:Open Source License

private Document makeXML(List _sListIns) {
    Document doc = DocumentHelper.createDocument();
    Element xRoot = doc.addElement("datas");
    Element inses = xRoot.addElement("inses");
    for (Iterator iter = _sListIns.iterator(); iter.hasNext();) {
        Organization org = (Organization) iter.next();
        int id = org.getId();
        String sName = org.getName();
        Element xIns = inses.addElement("ins");
        xIns.addAttribute("id", Integer.toString(id));
        xIns.addAttribute("name", sName);
        xIns.addAttribute("code", org.getCode());
    }//from   ww w . j a va  2  s  .c  o  m
    return doc;
}

From source file:com.rayo.core.xml.providers.ColibriProvider.java

License:Apache License

private void createColibriOfferEvent(ColibriOfferEvent event, Document document) {
    Element root = document.addElement(new QName("offer", NAMESPACE));
    root.addAttribute("muc", event.getMuc().toString());
    root.addAttribute("videobridge", event.getMuc().getNode());
    root.addAttribute("nickname", event.getNickname());
    root.addAttribute("participant", event.getParticipant().toString());
    root.add(event.getConference().createCopy());
}

From source file:com.rayo.core.xml.providers.ColibriProvider.java

License:Apache License

private void createAddSourceEvent(AddSourceEvent event, Document document) {
    Element root = document.addElement(new QName("addsource", NAMESPACE));
    root.addAttribute("muc", event.getMuc().toString());
    root.addAttribute("videobridge", event.getMuc().getNode());
    root.addAttribute("nickname", event.getNickname());
    root.addAttribute("participant", event.getParticipant().toString());
    root.add(event.getConference().createCopy());
}

From source file:com.rayo.core.xml.providers.ColibriProvider.java

License:Apache License

private void createRemoveSourceEvent(RemoveSourceEvent event, Document document) {
    Element root = document.addElement(new QName("removesource", NAMESPACE));
    root.addAttribute("muc", event.getMuc().toString());
    root.addAttribute("videobridge", event.getMuc().getNode());
    root.addAttribute("nickname", event.getNickname());
    root.addAttribute("participant", event.getParticipant().toString());
    root.addAttribute("active", event.isActive() ? "true" : "false");
    root.add(event.getConference().createCopy());
}

From source file:com.rayo.core.xml.providers.ColibriProvider.java

License:Apache License

private void createJoinBridgeEvent(JoinBridgeEvent joined, Document document) {
    Element root = document.addElement(new QName("joined", NAMESPACE));
    root.addAttribute("mixer-name", joined.getMixer());
    root.addAttribute("nickname", joined.getNickname());
    root.addAttribute("participant", joined.getParticipant().toString());
}