Ejemplo n.º 1
0
 /**
  * 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;
 }
 /**
  * Aggiunge al {@link Set} dei codici il codice della categoria data.
  *
  * @param category La categoria da aggiungere.
  * @param codes Il {@link Set} dei codici delle categorie.
  */
 private void addCategoryCode(Category category, Set<String> codes) {
   codes.add(category.getCode());
   Category parentCategory = (Category) category.getParent();
   if (null != parentCategory
       && !parentCategory.getCode().equals(parentCategory.getParentCode())) {
     this.addCategoryCode(parentCategory, codes);
   }
 }
Ejemplo n.º 3
0
 /**
  * Restituisce il titolo (comprensivo delle progenitrici) della singola categoria. Il titolo viene
  * restituito nella lingua corrente (precedentemente impostata con il metodo setRenderingLang) o,
  * se non disponibile, nella lingua di default.
  *
  * @return Il titolo della categoria.
  */
 public String getFullTitle() {
   String title = this.getTitle();
   Category parent = this.getParent();
   if (parent != null
       && parent.getParent() != null
       && !parent.getCode().equals(parent.getParentCode())) {
     String parentTitle = parent.getFullTitle();
     title = parentTitle + " / " + title;
   }
   return title;
 }
Ejemplo n.º 4
0
 /**
  * Crea un clone dell'oggetto categoria copiano solo gli elementi necessari ad essere erogata. Il
  * metodo viene invocato dal Wrapper dei contenuti esclusivamente quando viene chiesto di erogare
  * la lista di categorie.
  *
  * @return La categoria clonata.
  */
 public Category getCloneForWrapper() {
   Category clone = new Category();
   clone.setCode(this.getCode());
   clone.setDefaultLang(this._defaultLang);
   ApsProperties cloneProperties = new ApsProperties();
   Set<Object> keySet = this.getTitles().keySet();
   Iterator<Object> iter = keySet.iterator();
   while (iter.hasNext()) {
     String currentLangCode = (String) iter.next();
     String title = (String) this.getTitles().get(currentLangCode);
     cloneProperties.put(currentLangCode, title);
   }
   clone.setTitles(cloneProperties);
   if (!this.getParent().getCode().equals(this.getCode())) {
     Category parent = this.getParent();
     clone.setParent(parent.getCloneForWrapper());
   }
   return clone;
 }