/** * 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(); entityDom.init(); entityDom.setId(String.valueOf(this.getId())); entityDom.setTypeCode(this._typeCode); entityDom.setTypeDescr(this._typeDescr); entityDom.setDescr(this._descr); 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; }
@Override public String getXML() { IApsEntityDOM entityDOM = this.getBuildJDOM(); String xml = entityDOM.getXMLDocument(); entityDOM.dispose(); return xml; }