Package com.dotmarketing.portlets.categories.model

Examples of com.dotmarketing.portlets.categories.model.Category


        categoryAPI.removeChild(userProxy, (Category) object, APILocator.getUserAPI().getSystemUser(), false);
      }
    }

    if (UtilMethods.isSet(form.getCategory())) {
      Category category;
      for (String categoryId: form.getCategory()) {
        category = categoryAPI.find(categoryId, APILocator.getUserAPI().getSystemUser(), false);
        if(InodeUtils.isSet(category.getInode())) {
          categoryAPI.addChild(userProxy, category, APILocator.getUserAPI().getSystemUser(), false);
        }
      }
    }
View Full Code Here


    // Save the new categories
    String[] arr = form.getCategory();
    if (arr != null) {
      for (int i = 0; i < arr.length; i++) {
        Category node = (Category) InodeFactory.getInode(arr[i],
            Category.class);
        node.addChild(userProxy);
      }
    }

    HibernateUtil.flush();
View Full Code Here

    String categories = "";
    String[] categoriesArray = request.getParameterValues("categories");
    if (categoriesArray != null) {
      HashMap hashCategories = new HashMap<String, String>();
      for (int i = 0; i < categoriesArray.length; i++) {
        Category node = (Category) InodeFactory.getInode(categoriesArray[i], Category.class);
        Category parent = (Category) InodeFactory.getParentOfClass(node, Category.class);
        String parentCategoryName = parent.getCategoryName();

        if (hashCategories.containsKey(parentCategoryName)) {
          String childCategoryName = (String) hashCategories.get(parentCategoryName);
          if (UtilMethods.isSet(childCategoryName)) {
            childCategoryName += ", ";
View Full Code Here

  public List<Category> getChildrenCategoriesByKey(String key) {
    if (key == null) {
      return new ArrayList<Category>();
    }
    try {
      Category cat = categoryAPI.findByKey(key, user, true);
      if (!InodeUtils.isSet(cat.getInode())) {
        return new ArrayList<Category>();
      }
      return categoryAPI.getChildren(cat, user, true);
    } catch (DotSecurityException se) {
      Logger.info(this, "The logged in user cannot access the categories with key : " + key);
View Full Code Here

   * @return
   */
  public List<Category> getChildrenCategories(String inode, boolean includeGrandChildren, int maxDepth) {   
    try {
      List<Category> categories = new ArrayList<Category>();
      Category cat = categoryAPI.find(inode, user, true);
      List<Category> cats = categoryAPI.getChildren(cat, user, true);

      if(!UtilMethods.isSet(maxDepth))
        maxDepth = 5;
      for (Category childCat : cats) {
View Full Code Here

  public List<Category> getActiveChildrenCategoriesByKey(String key) {
    if (key == null) {
      return new ArrayList();
    }
    try {
      Category cat = categoryAPI.findByKey(key, user, true);
      if (!InodeUtils.isSet(cat.getInode())) {
        return new ArrayList();
      }
      return categoryAPI.getChildren(cat, true, user, true);
    } catch (DotSecurityException se) {
      Logger.info(this, "The logged in user cannot access the categories");
View Full Code Here

  public List<Category> getActiveChildrenCategoriesByParent(ArrayList<String> o) {
    try {
      List<Category> children = new ArrayList<Category>();
      for (String key : o) {
        if (UtilMethods.isSet(key)) {
          Category cat = getCategoryByKey(key);
          if (!InodeUtils.isSet(cat.getInode())) {
            cat = getCategoryByName(key);
          }
          children.addAll(categoryAPI.getChildren(cat, user, true));
        }
      }
View Full Code Here

  public List<Map<String, Object>> getAllActiveChildrenCategoriesByKey(String key) {
    if (key == null) {
      return new ArrayList<Map<String, Object>>();
    }
    try {
      Category cat = categoryAPI.findByKey(key, user, true);
      if (!InodeUtils.isSet(cat.getInode())) {
        return new ArrayList<Map<String, Object>>();
      }
      List<Category> children = categoryAPI.getChildren(cat, true, user, true);
      return getAllActiveChildrenCategories(children, 1);
    } catch (DotSecurityException se) {
View Full Code Here

   * @return
   */

  public List<Map<String, Object>> getAllActiveChildrenCategories(String inode) {
    try {
      Category parent = categoryAPI.find(inode, user, true);
      List<Category> children = categoryAPI.getChildren(parent, true, user, true);
      return getAllActiveChildrenCategories(children, 1);
    } catch (DotSecurityException se) {
      Logger.info(this, "The logged in user cannot access the categories");
      return null;
View Full Code Here

      ArrayList<Category> cats = new ArrayList<Category>();
      String[] arr = request.getParameterValues("categories") == null?new String[0]:request.getParameterValues("categories");
      if (arr != null && arr.length > 0) {
        for (int i = 0; i < arr.length; i++) {
          if(UtilMethods.isSet(arr[i])){
            Category c = catAPI.find(arr[i], SubmitContentUtil.getUserFromId(userId), true);
            if(UtilMethods.isSet(c))
              cats.add(c);
          }
        }
      }

      for (int i = 0; i < parametersName.size(); ++i) {
        Field field = st.getFieldVar(parametersName.get(i));
        String[] fieldValue = values.get(i);
        int size = 0;
                if(fieldValue!= null && !fieldValue[0].equals("") ){
                  size=1;
          if (fieldValue[0].contains(",")) {
            String[] fieldValueaux = fieldValue[0].split(",");
            fieldValue = fieldValueaux;
            size = fieldValue.length;
          }
         }

        for (int j = 0; j < size; j++) {
          if ((field != null)&& (field.getFieldType() != null)&& (field.getFieldType().equals(Field.FieldType.CATEGORY.toString()))){
            Category c = catAPI.find(com.dotmarketing.util.VelocityUtil.cleanVelocity(fieldValue[j].trim()),SubmitContentUtil.getUserFromId(userId), true);
            if(UtilMethods.isSet(c))
              cats.add(c);
          }

        }
View Full Code Here

TOP

Related Classes of com.dotmarketing.portlets.categories.model.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.