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.ark.auth2.model.ActionDef.java

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 *//*from w  w  w  .  j  a va2  s  .co m*/
public void toXMLElement(Element _element) throws PureException {
    _element.addAttribute("index", String.valueOf(m_nIndex));
    _element.addAttribute("name", m_sName);
    _element.addAttribute("desc", m_sDesc);
}

From source file:com.pureinfo.ark.auth2.model.AllowDef.java

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 *///w  w  w . j  a v  a2  s  . c o m
public void toXMLElement(Element _element) throws PureException {
    _element.addAttribute("action", m_sActions);
    if (m_rules != null) {
        for (int i = 0; i < m_rules.length; i++) {
            _element.add(XMLUtil.toXMLElement(m_rules[i], "rule"));
        }
    }
}

From source file:com.pureinfo.ark.auth2.model.CaseDef.java

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 *///w w  w . ja  v  a  2  s  .c o m
public void toXMLElement(Element _element) throws PureException {
    _element.addAttribute("value", m_values.toString());
    super.toXMLElement(_element);
}

From source file:com.pureinfo.ark.auth2.model.ResourceDef.java

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 *///  w  ww .  j a va2 s  .  co  m
public void toXMLElement(Element _element) throws PureException {
    _element.addAttribute("type", String.valueOf(m_type.getId()));
    _element.addAttribute("desc", m_type.getDesc());

    if (m_base != null) {
        _element.add(XMLUtil.toXMLElement(m_base, "base"));
    }
    if (m_rights != null) {
        for (int i = 0; i < m_rights.length; i++) {
            _element.add(XMLUtil.toXMLElement(m_rights[i], "right"));
        }
    }
}

From source file:com.pureinfo.ark.auth2.model.RightDef.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("role", m_sRoles);
    super.toXMLElement(_element);
}

From source file:com.pureinfo.ark.auth2.model.RoleDef.java

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 *//*from w ww  .  j  a v  a 2 s  .  com*/
public void toXMLElement(Element _element) throws PureException {
    _element.addAttribute("id", String.valueOf(m_nId));
    _element.addAttribute("name", m_sName);
    _element.addAttribute("desc", m_sDesc);
}

From source file:com.pureinfo.ark.auth2.model.RuleDef.java

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 */// www .  java  2 s  .  co  m
public void toXMLElement(Element _element) throws PureException {
    _element.addAttribute("res-property", m_sResProperty);
    if (m_sResProperty4sql != null) {
        _element.addAttribute("res-property4sql", m_sResProperty4sql);
        _element.addAttribute("type", DataTypes.getName(m_nValueType));
    }
    if (m_sUserProperty != null) {
        _element.addAttribute("user-property", m_sUserProperty);
    }
    if (m_values != null) {
        _element.addAttribute("value", m_values.toString());
    }
    _element.addAttribute("test", ScriptOperator.getSymbol(m_nTestOp));

    //to export children
    if (m_children != null) {
        for (int i = 0; i < m_children.length; i++) {
            _element.add(XMLUtil.toXMLElement(m_children[i], "rule"));
        }
    }
}

From source file:com.pureinfo.ark.auth2.model.SwitchDef.java

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 *///  w  w  w.  j  av  a 2 s  . c  o m
public void toXMLElement(Element _element) throws PureException {
    _element.addAttribute("property", m_sProperty);
    if (m_sProperty4sql != null) {
        _element.addAttribute("property4sql", m_sProperty4sql);
        _element.addAttribute("type", DataTypes.getName(m_nValueType));
    }

    if (m_cases != null) {
        for (int i = 0; i < m_cases.length; i++) {
            _element.add(XMLUtil.toXMLElement(m_cases[i], "case"));
        }
    }
}

From source file:com.pureinfo.ark.content.model.ContentType.java

License:Open Source License

/**
 * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
 *//*  ww  w  .  j a  va 2s  .c  om*/
public void toXMLElement(Element _element) throws PureException {
    _element.addAttribute("type", String.valueOf(m_nId));
    _element.addAttribute("class", m_sContentClassName);
    _element.addAttribute("desc", m_sDesc);
    if (m_sManagerId != null) {
        _element.addAttribute("manager", m_sManagerId);
    }
    if (m_sCacheId != null) {
        _element.addAttribute("cache", m_sCacheId);
    }

    /**
     * @since 1.2 to define whether this object has any appendix
     */
    _element.addAttribute("has-appendix", String.valueOf(m_bHasAppendix));

    if (m_arrListenerIds != null) {
        Element eleListener;
        for (int i = 0; i < m_arrListenerIds.length; i++) {
            eleListener = _element.addElement("listener");
            eleListener.addAttribute("id", m_arrListenerIds[i]);
        }
    }
}

From source file:com.pureinfo.common.namedvalue.action.TreenamedValueQueryAction.java

License:Open Source License

/**
 * // w w w .j ava2 s . c o  m
 */
private Document makeDoc() {
    Document doc = DocumentHelper.createDocument();
    Element root = doc.addElement("tree-named-values");
    for (int i = 0; i < m_defaults.length; i++) {
        if (m_defaults == null && m_nvs == null) {
            continue;
        }
        Element ele = root.addElement("values");
        ele.addAttribute("level", "" + i + 1);
        ele.addAttribute("default", m_defaults[i] == null ? "" : m_defaults[i]);
        addValues(ele, m_nvs[i]);
    }
    return doc;
}