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.dolphin.mapping.EntityRelative.java

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 *//*from   w  w  w.  j ava  2 s .  com*/
public void toXMLElement(Element _element) throws PureException {
    _element.addAttribute("alias", m_sAlias);
    _element.addAttribute("type", m_sType);
    _element.addAttribute("join-condition", m_sJoinCondition);
    if (m_depends != null) {
        _element.addAttribute("depends", StringUtils.join(m_depends, ','));
    }

    if (m_hPropertyDescs != null) {
        Map.Entry entry;
        Element ele;
        Iterator iter = m_hPropertyDescs.entrySet().iterator();
        while (iter.hasNext()) {
            entry = (Map.Entry) iter.next();
            ele = _element.addElement("property");
            ele.addAttribute("name", (String) entry.getKey());
            ele.addAttribute("desc", (String) entry.getValue());
        }
    }
}

From source file:com.pureinfo.dolphin.mapping.PropertyRef.java

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 *///  w  ww  .  ja  va2s.com
public void toXMLElement(Element _element) throws PureException {
    _element.addAttribute("type", m_sType);
    _element.addAttribute("key", m_sKey);
    _element.addAttribute("locator", m_sLocator);

    //to export indexes
    Element ele;
    for (int i = 1; i < m_indexes.length; i++) {
        ele = DocumentHelper.createElement("index");
        m_indexes[i].toXMLElement(ele);
        _element.add(ele);
    }
}

From source file:com.pureinfo.dolphin.script.lang.Expression.java

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 *//*from   w w w. j a  v a  2s  .  c o m*/
public void toXMLElement(Element _element) throws PureException {
    //to export body
    Element ele;
    switch (m_nType) {
    case TYPE_STRING: {
        ele = _element.addElement("str");
        ele.addCDATA((String) m_body);
        break;
    }
    case TYPE_VARIABLE: {
        ele = _element.addElement("var");
        ((IXMLSupporter) m_body).toXMLElement(ele);
        break;
    }
    case TYPE_FUNCTION: {
        ele = _element.addElement("func");
        ((IXMLSupporter) m_body).toXMLElement(ele);
        break;
    }
    }

    //to export formatters
    Object formatter;
    for (int i = 0; i < m_formatters.size(); i++) {
        formatter = m_formatters.get(i);
        ele = _element.addElement("op");
        ele.addAttribute("name", ">>");

        if (formatter instanceof String) {
            ele = _element.addElement("str");
            ele.addCDATA((String) formatter);
        } else {
            ele = _element.addElement("var");
            ((Variable) formatter).toXMLElement(ele);
        }
    }
}

From source file:com.pureinfo.dolphin.script.lang.Function.java

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 *//*  w  w w.j  a v a  2s  . c  o  m*/
public void toXMLElement(Element _element) throws PureException {
    _element.addAttribute("name", m_sName);

    Expression param;
    Element eleParam;
    for (int i = 0; i < m_parameters.size(); i++) {
        param = (Expression) m_parameters.get(i);
        eleParam = _element.addElement("param");
        param.toXMLElement(eleParam);
    }
}

From source file:com.pureinfo.dolphin.script.lang.Variable.java

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 *///w w  w.j a v  a 2s. c  o m
public void toXMLElement(Element _element) throws PureException {
    _element.addAttribute("namespace", m_sNamespace);
    _element.addAttribute("name", m_sName);
}

From source file:com.pureinfo.dolphin.script.param.ParameterMetadata.java

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 *//*from  w  w w .j ava 2  s  .  co m*/
public void toXMLElement(Element _element) throws PureException {
    if (_element == null) {
        throw new PureException(200, "request can't be null");
    }

    if (getName() == null) {
        throw new PureException(502, "element attribute[" + ATTRIBUTE_NAME + "] can't be null");
    }
    _element.addAttribute(ATTRIBUTE_NAME, getName());

    _element.addAttribute(ATTRIBUTE_REQUIRED, String.valueOf(isRequired()));

    if (getDescription() == null) {
        throw new PureException(502, "element attribute[" + ATTRIBUTE_DESCRIPTION + "] can't be null");
    }
    _element.addAttribute(ATTRIBUTE_DESCRIPTION, getDescription());

    if (getDefault() == null) {
        _element.addText("");
    } else {
        _element.addText(getDefault());
    }
}

From source file:com.pureinfo.force.fileserver.PathConfig.java

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 *//*from  ww w .ja  v a2  s. co m*/
public void toXMLElement(Element _element) throws PureException {
    _element.addAttribute("flag", m_sFlag);
    _element.addAttribute("desc", m_sDesc);
    _element.addAttribute("local", m_sLocalPath);
    if (m_sHttpPath != null) {
        _element.addAttribute("http", m_sHttpPath);
    }
}

From source file:com.pureinfo.force.runtime.engine.EngineBean.java

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 *///from w  ww. j a  v  a  2 s.  c  o  m
public void toXMLElement(Element _element) throws PureException {
    _element.addAttribute("id", m_sId);
    _element.addAttribute("name", m_sName);
    _element.addAttribute("type", m_type.getName());
    _element.addAttribute("ignore-failure", String.valueOf(m_bIgnoreFailure));
}

From source file:com.pureinfo.srm.config.affirm.model.Affirm.java

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 *//*from ww  w .  j  av  a  2s  . c  o  m*/
public void toXMLElement(Element _element) throws PureException {
    for (Iterator iter = m_affirms.entrySet().iterator(); iter.hasNext();) {
        Element element = _element.addElement(ELEMENT_AFFIRM);
        Map.Entry entry = (Entry) iter.next();
        element.addAttribute(ATTRIBUTE_NAME, (String) entry.getKey());
        element.addAttribute(ATTRIBUTE_DAY, (String) entry.getValue());
    }
}

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

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 *//*from  w  w  w .ja  v  a  2s  .c o  m*/
public void toXMLElement(Element _element) throws PureException {
    _element.addAttribute(ATTRIBUTE_NAME, m_sName);
    for (Iterator iter = m_items.values().iterator(); iter.hasNext();) {
        NoticeItem item = (NoticeItem) iter.next();
        item.toXMLElement(_element.addElement(ELEMENT_ITEM));
    }
}