Package com.dotmarketing.portlets.categories.model

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


    //    Add User Categories
    if(userForm.getCategory() != null){
      String[] categories = userForm.getCategory();
      for(int i = 0 ; i < categories.length ;++i){
        Category cat = categoryAPI.find(categories[i], adminUser, false);
        categoryAPI.addChild(userProxy, cat, adminUser, false);
      }
    }

    HibernateUtil.flush();
View Full Code Here


    return find(Long.parseLong(id), user, respectFrontendRoles);
  }*/

  public Category find(String id, User user, boolean respectFrontendRoles) throws DotDataException, DotSecurityException {

    Category cat = catFactory.find(id);
    if(cat != null && !perAPI.doesUserHavePermission(cat, PermissionAPI.PERMISSION_USE, user, respectFrontendRoles))
      throw new DotSecurityException("User doesn't have permission to read the category = " + cat.getInode());
    return cat;

  }
View Full Code Here

    catFactory.addParent(child, parent);

  }

  public Category findByKey(String key, User user, boolean respectFrontendRoles) throws DotDataException, DotSecurityException {
    Category cat = catFactory.findByKey(key);

    if(!InodeUtils.isSet(cat.getCategoryId()))
      return null;

    if(!perAPI.doesUserHavePermission(cat, PermissionAPI.PERMISSION_USE, user, respectFrontendRoles))
      throw new DotSecurityException("User doesn't have permission to save this category = " +
          cat.getInode() + " having as parent the category = " + cat.getInode());

    return cat;
  }
View Full Code Here

    return cat;
  }

  public Category findByName(String name, User user, boolean respectFrontendRoles) throws DotDataException, DotSecurityException {
    Category cat = catFactory.findByName(name);

    if(cat == null)
      return null;

    if(!perAPI.doesUserHavePermission(cat, PermissionAPI.PERMISSION_USE, user, respectFrontendRoles))
      throw new DotSecurityException("User doesn't have permission to save this category = " +
          cat.getInode() + " having as parent the category = " + cat.getInode());
    return cat;
  }
View Full Code Here

      throws DotDataException, DotSecurityException {
    List<Category> categoryTree = new ArrayList<Category>();
    LinkedList<Category> children = new LinkedList<Category>(getChildren(category, user, respectFrontendRoles));
    if (children != null) {
      while(children.size() > 0) {
        Category child = children.poll();
        children.addAll(getChildren(child, user, respectFrontendRoles));
        categoryTree.add(child);
      }
    }
    return categoryTree;
View Full Code Here

    if (InodeUtils.isSet(child.getInode())) {
      l.add(0, child);
    }
    List<Category> parents = getParents(child, user, respectFrontendRoles);
    if (parents.size() > 0) {
      Category parent = (Category) parents.get(0);
      return getCategoryTree(parent, l, user, respectFrontendRoles);
    } else {
      Category fakeCat = new Category();
      fakeCat.setCategoryName("Top Level");
      l.add(0, fakeCat);
    }
    return l;
  }
View Full Code Here

              idsToClear.addAll(dc.loadResults());
            }
        }
      } else if(isCategory) {
          if(!ran09) {
            Category cat = (Category) permissionable;
            CategoryAPI catAPI = APILocator.getCategoryAPI();
            User systemUser = APILocator.getUserAPI().getSystemUser();
            try {
              List<Category> children = catAPI.getCategoryTreeDown(cat, cat, systemUser, false);
              for(Category child : children) {
                dc.setSQL(updatePermissionReferenceByAssetIdSQL);
                dc.addParam(cat.getInode());
                dc.addParam(Category.class.getCanonicalName());
                dc.addParam(child.getInode());
                dc.loadResult();
                idsToClear.add(child.getMap());
              }
View Full Code Here

      }

    } else if(isCategory) {

      CategoryAPI catAPI = APILocator.getCategoryAPI();
      Category cat = (Category) permissionable;
      UserAPI userAPI = APILocator.getUserAPI();
      List<Category> children;
      try {
        children = catAPI.getCategoryTreeDown(cat, cat, userAPI.getSystemUser(), false);
      } catch (DotSecurityException e) {
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
 
  protected void remove(Category object) throws DotDataException, DotCacheException {
   
    Category oldCat = this.get(object.getCategoryId());
    if(oldCat != null && UtilMethods.isSet(oldCat.getKey())){
      cache.remove(categoryByKeyCacheGroup + oldCat.getKey(), categoryByKeyCacheGroup);
    }
   
    if(object != null && UtilMethods.isSet(object.getKey())){
      cache.remove(categoryByKeyCacheGroup + object.getKey(), categoryByKeyCacheGroup);
    }
View Full Code Here

    List<Field> fields = st.getFields();
    for (Field field : fields) {
      if(field.getFieldType().equals(Field.FieldType.CATEGORY.toString())){
        try {
          Category category = categoryAPI.find(field.getValues(), user, respectFrontendRoles);
          if(category != null && !catsMaps.contains(category.getMap()) && field.isSearchable())
            catsMaps.add(category.getMap());
        } catch (DotSecurityException e) {
          Logger.debug(this, "Ignoring a category the user has no permission on");
        }
      }
    }
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.