Package com.agiletec.aps.system.services.category

Examples of com.agiletec.aps.system.services.category.Category


  public List<Category> getCategories(String contentType) {
    List<Category> categories = new ArrayList<Category>();
    List<String> categoryCodes = this.getContentTypeElements().get(contentType);
    if (null != categoryCodes) {
      for (int i=0; i<categoryCodes.size(); i++) {
        Category category = this.getCategoryManager().getCategory(categoryCodes.get(i));
        categories.add(category);
      }
      Collections.sort(categories);
    }
    return categories;
View Full Code Here


    return contentTypes;
  }
 
  @Override
  protected void checkReference(String elementCode) {
    Category category = this.getCategoryManager().getCategory(elementCode);
    if (null == category) {
      throw new RuntimeException("Codice Categoria '" + elementCode + "' non riconosciuto");
    }
  }
View Full Code Here

      if (!this.isValidContentType()) return "intro";
      if (!this.isValidCategory()) {
        //TODO MESSAGGIO DI ERRORE
        return SUCCESS;
      }
      Category category = this.getCategoryManager().getCategory(this.getSelectedNode());
      if (!category.getCode().equals(category.getParentCode())) {//se non è la Home
        this.getContentCategoryRefManager().addRelation(this.getSelectedNode(), this.getContentTypeCode());
      }
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "join");
      return FAILURE;
View Full Code Here

   */
  private Set<String> extractCategoryCodes(Content content) {
    Set<String> categoryCodes = new HashSet<String>();
    Iterator<Category> categoryIter = content.getCategories().iterator();
    while (categoryIter.hasNext()) {
      Category category = categoryIter.next();
      this.addCategoryCode(category, categoryCodes);
    }
    return categoryCodes;
  }
View Full Code Here

   * @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);
    }
  }
View Full Code Here

    return false;
  }
 
  private boolean isContained(Category category, Set<Object> categories) {
    boolean contain = false;
    Category categoryTemp = category;
    while (!contain && !categoryTemp.getCode().equals(categoryTemp.getParentCode())) {
      contain = (categories.contains(categoryTemp.getCode()));
      categoryTemp = categoryTemp.getParent();
    }
    return contain;
  }
View Full Code Here

    return false;
  }
 
  private boolean isContained(Category category, Set<Object> categories) {
    boolean contain = false;
    Category categoryTemp = category;
    while (!contain && !categoryTemp.getCode().equals(categoryTemp.getParentCode())) {
      contain = (categories.contains(categoryTemp.getCode()));
      categoryTemp = categoryTemp.getParent();
    }
    return contain;
  }
View Full Code Here

    return this.joinRemoveCategory(false, this.getCategoryCode());
  }
 
  private String joinRemoveCategory(boolean isJoin, String categoryCode) {
    try {
      Category category = this.getCategory(categoryCode);
      if (category == null) return SUCCESS;
      List<String> categories = this.getCategoryCodes();
      if (isJoin) {
        if (!categories.contains(categoryCode)) {
          categories.add(categoryCode);
View Full Code Here

  public List<Category> getCategories() {
    List<Category> categories = new ArrayList<Category>(this.getCategoryCodes().size());
    Iterator<String> iter = this.getCategoryCodes().iterator();
    while (iter.hasNext()) {
      String categoryCode = iter.next();
      Category category = this.getCategoryManager().getCategory(categoryCode);
      if (null != category) categories.add(category);
    }
    return categories;
  }
View Full Code Here

        this.checkCategoryRoot();
        ApsSystemUtils.getLogger().debug(this.getClass().getName() + ": initialized");
    }
   
    private void checkCategoryRoot() {
        Category tagCloudRoot = this.getCategoryManager().getCategory(this.getTagCloudCategoryRoot());
        if (null != tagCloudRoot) {
            return;
        }
        try {
            tagCloudRoot = new Category();
            tagCloudRoot.setCode(this.getTagCloudCategoryRoot());
            Category root = this.getCategoryManager().getRoot();
            ApsProperties titles = new ApsProperties();
            Set<Object> langCodes = root.getTitles().keySet();
            Iterator<Object> iter = langCodes.iterator();
            while (iter.hasNext()) {
                Object langCode = (Object) iter.next();
                titles.put(langCode, "Tag Cloud Root");
            }
            tagCloudRoot.setTitles(titles);
            tagCloudRoot.setParent(root);
            tagCloudRoot.setParentCode(root.getCode());
            this.getCategoryManager().addCategory(tagCloudRoot);
            ApsSystemUtils.getLogger().debug(this.getClass().getName() + ": TagCloud category root Created ");
        } catch (Throwable t) {
            ApsSystemUtils.logThrowable(t, this, "checkCategoryRoot");
            throw new RuntimeException("Error on adding tag cloud category root", t);
View Full Code Here

TOP

Related Classes of com.agiletec.aps.system.services.category.Category

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.