Search in sources :

Example 1 with IApsEntityDOM

use of com.agiletec.aps.system.common.entity.parse.IApsEntityDOM in project entando-core by entando.

the class ApsEntity method getXML.

@Override
public String getXML() {
    IApsEntityDOM entityDOM = this.getBuildJDOM();
    String xml = entityDOM.getXMLDocument();
    entityDOM.dispose();
    return xml;
}
Also used : IApsEntityDOM(com.agiletec.aps.system.common.entity.parse.IApsEntityDOM)

Example 2 with IApsEntityDOM

use of com.agiletec.aps.system.common.entity.parse.IApsEntityDOM in project entando-core by entando.

the class ApsEntity method getBuildJDOM.

/**
 * Return the DOM class that generates the XML corresponding to the entity
 * with its data.
 * This method must be extended to support customized XML structures;
 * this happen when, for example, a custom entity is based on an
 * object class which, in turn, extends ApsEntity.
 * @return The DOM class that generates the XML
 */
protected IApsEntityDOM getBuildJDOM() {
    IApsEntityDOM entityDom = this.getEntityDOM().clone();
    entityDom.init();
    entityDom.setId(String.valueOf(this.getId()));
    entityDom.setTypeCode(this._typeCode);
    entityDom.setTypeDescription(this._typeDescription);
    entityDom.setDescription(this._description);
    entityDom.setMainGroup(this._mainGroup);
    Iterator<String> iterGroups = this.getGroups().iterator();
    while (iterGroups.hasNext()) {
        String groupName = iterGroups.next();
        entityDom.addGroup(groupName);
    }
    Iterator<Category> iterCategory = this._categories.iterator();
    while (iterCategory.hasNext()) {
        Category category = iterCategory.next();
        entityDom.addCategory(category.getCode());
    }
    Iterator<AttributeInterface> iterAttribute = this._attributeList.iterator();
    while (iterAttribute.hasNext()) {
        AttributeInterface currentAttribute = iterAttribute.next();
        Element attributeElement = currentAttribute.getJDOMElement();
        if (attributeElement != null) {
            entityDom.addAttribute(currentAttribute.getJDOMElement());
        }
    }
    return entityDom;
}
Also used : Category(com.agiletec.aps.system.services.category.Category) IApsEntityDOM(com.agiletec.aps.system.common.entity.parse.IApsEntityDOM) Element(org.jdom.Element) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Aggregations

IApsEntityDOM (com.agiletec.aps.system.common.entity.parse.IApsEntityDOM)2 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)1 Category (com.agiletec.aps.system.services.category.Category)1 Element (org.jdom.Element)1