com.dotmarketing.portlets.categories.business
Class CategoryAPIImpl

java.lang.Object
  extended by com.dotmarketing.portlets.categories.business.CategoryAPIImpl
All Implemented Interfaces:
CategoryAPI

public class CategoryAPIImpl
extends java.lang.Object
implements CategoryAPI

This class is an specific implementation of the CategoryAPI API to manage dotCMS categories

Since:
1.5.1.1
Author:
Jason Tesser & David Torres

Constructor Summary
CategoryAPIImpl()
           
 
Method Summary
 void addChild(Categorizable parent, Category child, java.lang.String relationType, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          This method adds the given category to parent children list
 void addChild(Categorizable parent, Category child, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          This method adds the given category to parent children list
 void addParent(Categorizable child, Category parent, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Adds the given category as a parent of the given children category
 boolean canAddChildren(Category cat, com.liferay.portal.model.User user, boolean respectFrontendRoles)
           
 boolean canAddToTopLevel(com.liferay.portal.model.User user)
           
 boolean canEditCategory(Category cat, com.liferay.portal.model.User user, boolean respectFrontendRoles)
           
 boolean canUseCategory(Category cat, com.liferay.portal.model.User user, boolean respectFrontendRoles)
           
 void clearCache()
          This is a low level method only intended to be use for maintenance purposes
 void delete(Category object, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Totally removes a category from the system
 Category find(java.lang.String id, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          This method get a category object from the cache based on the passed inode, if the object does not exist a null value is returned
 java.util.List<Category> findAll(com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Retrieves the list of all the categories in the system
 Category findByKey(java.lang.String key, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          This method get a category object from the cache based on the passed key, if the object does not exist a null value is returned
 Category findByName(java.lang.String name, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          This method get a category object based on its name this method needs to be used carefully because it might have more than one category with the same name
 java.util.List<Category> findTopLevelCategories(com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Retrieves the list of all top level categories in the system
 void flushChildrenCache()
          This method flushes the children cache
 java.util.List<Category> getAllChildren(Category category, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Recursive Method that returns a list of categories given a parent category, it does not take into account the whole hierarchy, instead all categories are being added to the categories list being returned.
 java.util.List<Category> getCategoryTreeDown(Categorizable categorizable, Category catToSearchFrom, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Will return to you all category hierarchy (children and subchildren and so on) who are attached to the categorizable and are below the passed category
 java.util.List<Category> getCategoryTreeUp(Category child, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Retrieves a list all the line of parent categories of the given child category a final fake top category is added at the beginning of the list to represent the top of the hierarchy
 java.util.List<Category> getChildren(Categorizable parent, boolean onlyActive, java.lang.String orderBy, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Retrieves the list of children categories associated to the given id/inode, this method can be used to retrived associated categories to another type of objects like categories associated to contentlets
 java.util.List<Category> getChildren(Categorizable parent, boolean onlyActive, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Retrieves the list of children categories associated to the given id/inode, this method can be used to retrived associated categories to another type of objects like categories associated to contentlets
 java.util.List<Category> getChildren(Categorizable parent, java.lang.String relationType, boolean onlyActive, java.lang.String orderBy, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Retrieves the list of children categories associated to the given id/inode, this method can be used to retrived associated categories to another type of objects like categories associated to contentlets
 java.util.List<Category> getChildren(Categorizable parent, java.lang.String orderBy, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Retrieves the list of children categories associated to the given id/inode, this method can be used to retrived associated categories to another type of objects like categories associated to contentlets
 java.util.List<Category> getChildren(Categorizable parent, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Retrieves the list of children categories associated to the given id/inode, this method can be used to retrived associated categories to another type of objects like categories associated to contentlets
 java.util.List<Category> getParents(Categorizable child, boolean onlyActive, java.lang.String relationType, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Retrieves the list of parents categories associated to the given id/inode
 java.util.List<Category> getParents(Categorizable child, boolean onlyActive, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Retrieves the list of parents categories associated to the given id/inode
 java.util.List<Category> getParents(Categorizable child, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Retrieves the list of parents categories associated to the given id/inode
 boolean hasDependencies(Category cat)
          check If the category has dependencies.
 void removeChild(Categorizable parent, Category child, java.lang.String relationType, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Removes from the list of children categories the given child
 void removeChild(Categorizable parent, Category child, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Removes from the list of children categories the given child
 void removeChildren(Categorizable parent, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Removes all the associated children categories of the given parent
 void removeParent(Categorizable child, Category parent, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Associates the given the list of categories as parents of the given children id Older parents gets removed from the list
 void removeParents(Categorizable child, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Removes the parents associated to the given children category
 void save(Category parent, Category object, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Saves categories, When saving a new category the parent should be passed to the API to check if the user has permissions to add children to the parent and the parent will be associated to the passed category object
 void setChildren(Categorizable parent, java.util.List<Category> children, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          This methods associates the given children list to the given parent
 void setParents(Categorizable child, java.util.List<Category> parents, com.liferay.portal.model.User user, boolean respectFrontendRoles)
          Associates to the given list of categories as parents of the child id/inode Older parents gets replaced by the new list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CategoryAPIImpl

public CategoryAPIImpl()
Method Detail

canUseCategory

public boolean canUseCategory(Category cat,
                              com.liferay.portal.model.User user,
                              boolean respectFrontendRoles)
                       throws DotDataException
Specified by:
canUseCategory in interface CategoryAPI
Parameters:
cat -
user -
respectFrontendRoles -
Returns:
boolean on whether or not a user can use a category.
Throws:
DotDataException

canAddChildren

public boolean canAddChildren(Category cat,
                              com.liferay.portal.model.User user,
                              boolean respectFrontendRoles)
                       throws DotDataException
Specified by:
canAddChildren in interface CategoryAPI
Parameters:
cat -
user -
respectFrontendRoles -
Returns:
boolean on whether or not a user can add a child category.
Throws:
DotDataException

canAddToTopLevel

public boolean canAddToTopLevel(com.liferay.portal.model.User user)
Specified by:
canAddToTopLevel in interface CategoryAPI
Parameters:
user -
Returns:
Whether the user can add a category to the top level. If it is a top parent category.

canEditCategory

public boolean canEditCategory(Category cat,
                               com.liferay.portal.model.User user,
                               boolean respectFrontendRoles)
                        throws DotDataException
Specified by:
canEditCategory in interface CategoryAPI
Parameters:
cat -
user -
respectFrontendRoles -
Returns:
boolean on whether or not a user can edit a category.
Throws:
DotDataException

delete

public void delete(Category object,
                   com.liferay.portal.model.User user,
                   boolean respectFrontendRoles)
            throws DotDataException,
                   DotSecurityException
Description copied from interface: CategoryAPI
Totally removes a category from the system

Specified by:
delete in interface CategoryAPI
Throws:
DotDataException
DotSecurityException

find

public Category find(java.lang.String id,
                     com.liferay.portal.model.User user,
                     boolean respectFrontendRoles)
              throws DotDataException,
                     DotSecurityException
Description copied from interface: CategoryAPI
This method get a category object from the cache based on the passed inode, if the object does not exist a null value is returned

Specified by:
find in interface CategoryAPI
Returns:
Throws:
DotDataException
DotSecurityException

findAll

public java.util.List<Category> findAll(com.liferay.portal.model.User user,
                                        boolean respectFrontendRoles)
                                 throws DotDataException,
                                        DotSecurityException
Description copied from interface: CategoryAPI
Retrieves the list of all the categories in the system

Specified by:
findAll in interface CategoryAPI
Returns:
Throws:
DotDataException
DotSecurityException

save

public void save(Category parent,
                 Category object,
                 com.liferay.portal.model.User user,
                 boolean respectFrontendRoles)
          throws DotDataException,
                 DotSecurityException
Description copied from interface: CategoryAPI
Saves categories, When saving a new category the parent should be passed to the API to check if the user has permissions to add children to the parent and the parent will be associated to the passed category object

Specified by:
save in interface CategoryAPI
Parameters:
parent - Parent can be null if saving an old category
Throws:
DotDataException
DotSecurityException

addChild

public void addChild(Categorizable parent,
                     Category child,
                     com.liferay.portal.model.User user,
                     boolean respectFrontendRoles)
              throws DotDataException,
                     DotSecurityException
Description copied from interface: CategoryAPI
This method adds the given category to parent children list

Specified by:
addChild in interface CategoryAPI
Throws:
DotDataException
DotSecurityException

addChild

public void addChild(Categorizable parent,
                     Category child,
                     java.lang.String relationType,
                     com.liferay.portal.model.User user,
                     boolean respectFrontendRoles)
              throws DotDataException,
                     DotSecurityException
Description copied from interface: CategoryAPI
This method adds the given category to parent children list

Specified by:
addChild in interface CategoryAPI
Throws:
DotDataException
DotSecurityException

addParent

public void addParent(Categorizable child,
                      Category parent,
                      com.liferay.portal.model.User user,
                      boolean respectFrontendRoles)
               throws DotDataException,
                      DotSecurityException
Description copied from interface: CategoryAPI
Adds the given category as a parent of the given children category

Specified by:
addParent in interface CategoryAPI
Throws:
DotDataException
DotSecurityException

findByKey

public Category findByKey(java.lang.String key,
                          com.liferay.portal.model.User user,
                          boolean respectFrontendRoles)
                   throws DotDataException,
                          DotSecurityException
Description copied from interface: CategoryAPI
This method get a category object from the cache based on the passed key, if the object does not exist a null value is returned

Specified by:
findByKey in interface CategoryAPI
Returns:
Throws:
DotDataException
DotSecurityException

findByName

public Category findByName(java.lang.String name,
                           com.liferay.portal.model.User user,
                           boolean respectFrontendRoles)
                    throws DotDataException,
                           DotSecurityException
Description copied from interface: CategoryAPI
This method get a category object based on its name this method needs to be used carefully because it might have more than one category with the same name

Specified by:
findByName in interface CategoryAPI
Returns:
Throws:
DotDataException
DotSecurityException

findTopLevelCategories

public java.util.List<Category> findTopLevelCategories(com.liferay.portal.model.User user,
                                                       boolean respectFrontendRoles)
                                                throws DotDataException,
                                                       DotSecurityException
Description copied from interface: CategoryAPI
Retrieves the list of all top level categories in the system

Specified by:
findTopLevelCategories in interface CategoryAPI
Returns:
Throws:
DotDataException
DotSecurityException

getChildren

public java.util.List<Category> getChildren(Categorizable parent,
                                            com.liferay.portal.model.User user,
                                            boolean respectFrontendRoles)
                                     throws DotDataException,
                                            DotSecurityException
Description copied from interface: CategoryAPI
Retrieves the list of children categories associated to the given id/inode, this method can be used to retrived associated categories to another type of objects like categories associated to contentlets

Specified by:
getChildren in interface CategoryAPI
Returns:
Throws:
DotDataException
DotSecurityException

getChildren

public java.util.List<Category> getChildren(Categorizable parent,
                                            boolean onlyActive,
                                            com.liferay.portal.model.User user,
                                            boolean respectFrontendRoles)
                                     throws DotDataException,
                                            DotSecurityException
Description copied from interface: CategoryAPI
Retrieves the list of children categories associated to the given id/inode, this method can be used to retrived associated categories to another type of objects like categories associated to contentlets

Specified by:
getChildren in interface CategoryAPI
Returns:
Throws:
DotDataException
DotSecurityException

getChildren

public java.util.List<Category> getChildren(Categorizable parent,
                                            java.lang.String relationType,
                                            boolean onlyActive,
                                            java.lang.String orderBy,
                                            com.liferay.portal.model.User user,
                                            boolean respectFrontendRoles)
                                     throws DotDataException,
                                            DotSecurityException
Description copied from interface: CategoryAPI
Retrieves the list of children categories associated to the given id/inode, this method can be used to retrived associated categories to another type of objects like categories associated to contentlets

Specified by:
getChildren in interface CategoryAPI
orderBy - - can be null
Returns:
Throws:
DotDataException
DotSecurityException

getChildren

public java.util.List<Category> getChildren(Categorizable parent,
                                            boolean onlyActive,
                                            java.lang.String orderBy,
                                            com.liferay.portal.model.User user,
                                            boolean respectFrontendRoles)
                                     throws DotDataException,
                                            DotSecurityException
Description copied from interface: CategoryAPI
Retrieves the list of children categories associated to the given id/inode, this method can be used to retrived associated categories to another type of objects like categories associated to contentlets

Specified by:
getChildren in interface CategoryAPI
Returns:
Throws:
DotDataException
DotSecurityException

getChildren

public java.util.List<Category> getChildren(Categorizable parent,
                                            java.lang.String orderBy,
                                            com.liferay.portal.model.User user,
                                            boolean respectFrontendRoles)
                                     throws DotDataException,
                                            DotSecurityException
Description copied from interface: CategoryAPI
Retrieves the list of children categories associated to the given id/inode, this method can be used to retrived associated categories to another type of objects like categories associated to contentlets

Specified by:
getChildren in interface CategoryAPI
Returns:
Throws:
DotDataException
DotSecurityException

getParents

public java.util.List<Category> getParents(Categorizable child,
                                           com.liferay.portal.model.User user,
                                           boolean respectFrontendRoles)
                                    throws DotDataException,
                                           DotSecurityException
Description copied from interface: CategoryAPI
Retrieves the list of parents categories associated to the given id/inode

Specified by:
getParents in interface CategoryAPI
Returns:
Throws:
DotDataException
DotSecurityException

getParents

public java.util.List<Category> getParents(Categorizable child,
                                           boolean onlyActive,
                                           java.lang.String relationType,
                                           com.liferay.portal.model.User user,
                                           boolean respectFrontendRoles)
                                    throws DotDataException,
                                           DotSecurityException
Description copied from interface: CategoryAPI
Retrieves the list of parents categories associated to the given id/inode

Specified by:
getParents in interface CategoryAPI
Returns:
Throws:
DotDataException
DotSecurityException

getParents

public java.util.List<Category> getParents(Categorizable child,
                                           boolean onlyActive,
                                           com.liferay.portal.model.User user,
                                           boolean respectFrontendRoles)
                                    throws DotDataException,
                                           DotSecurityException
Description copied from interface: CategoryAPI
Retrieves the list of parents categories associated to the given id/inode

Specified by:
getParents in interface CategoryAPI
Returns:
Throws:
DotDataException
DotSecurityException

removeChild

public void removeChild(Categorizable parent,
                        Category child,
                        com.liferay.portal.model.User user,
                        boolean respectFrontendRoles)
                 throws DotDataException,
                        DotSecurityException
Description copied from interface: CategoryAPI
Removes from the list of children categories the given child

Specified by:
removeChild in interface CategoryAPI
Throws:
DotDataException
DotSecurityException

removeChild

public void removeChild(Categorizable parent,
                        Category child,
                        java.lang.String relationType,
                        com.liferay.portal.model.User user,
                        boolean respectFrontendRoles)
                 throws DotDataException,
                        DotSecurityException
Description copied from interface: CategoryAPI
Removes from the list of children categories the given child

Specified by:
removeChild in interface CategoryAPI
Throws:
DotDataException
DotSecurityException

removeChildren

public void removeChildren(Categorizable parent,
                           com.liferay.portal.model.User user,
                           boolean respectFrontendRoles)
                    throws DotDataException,
                           DotSecurityException
Description copied from interface: CategoryAPI
Removes all the associated children categories of the given parent

Specified by:
removeChildren in interface CategoryAPI
Throws:
DotDataException
DotSecurityException

removeParent

public void removeParent(Categorizable child,
                         Category parent,
                         com.liferay.portal.model.User user,
                         boolean respectFrontendRoles)
                  throws DotDataException,
                         DotSecurityException
Description copied from interface: CategoryAPI
Associates the given the list of categories as parents of the given children id Older parents gets removed from the list

Specified by:
removeParent in interface CategoryAPI
Throws:
DotDataException
DotSecurityException

removeParents

public void removeParents(Categorizable child,
                          com.liferay.portal.model.User user,
                          boolean respectFrontendRoles)
                   throws DotDataException,
                          DotSecurityException
Description copied from interface: CategoryAPI
Removes the parents associated to the given children category

Specified by:
removeParents in interface CategoryAPI
Throws:
DotDataException
DotSecurityException

setChildren

public void setChildren(Categorizable parent,
                        java.util.List<Category> children,
                        com.liferay.portal.model.User user,
                        boolean respectFrontendRoles)
                 throws DotDataException,
                        DotSecurityException
Description copied from interface: CategoryAPI
This methods associates the given children list to the given parent

Specified by:
setChildren in interface CategoryAPI
Throws:
DotDataException
DotSecurityException

setParents

public void setParents(Categorizable child,
                       java.util.List<Category> parents,
                       com.liferay.portal.model.User user,
                       boolean respectFrontendRoles)
                throws DotDataException,
                       DotSecurityException
Description copied from interface: CategoryAPI
Associates to the given list of categories as parents of the child id/inode Older parents gets replaced by the new list

Specified by:
setParents in interface CategoryAPI
Throws:
DotDataException
DotSecurityException

getAllChildren

public java.util.List<Category> getAllChildren(Category category,
                                               com.liferay.portal.model.User user,
                                               boolean respectFrontendRoles)
                                        throws DotDataException,
                                               DotSecurityException
Description copied from interface: CategoryAPI
Recursive Method that returns a list of categories given a parent category, it does not take into account the whole hierarchy, instead all categories are being added to the categories list being returned.

Specified by:
getAllChildren in interface CategoryAPI
Returns:
Throws:
DotDataException
DotSecurityException

clearCache

public void clearCache()
Description copied from interface: CategoryAPI
This is a low level method only intended to be use for maintenance purposes

Specified by:
clearCache in interface CategoryAPI

getCategoryTreeUp

public java.util.List<Category> getCategoryTreeUp(Category child,
                                                  com.liferay.portal.model.User user,
                                                  boolean respectFrontendRoles)
                                           throws DotDataException,
                                                  DotSecurityException
Description copied from interface: CategoryAPI
Retrieves a list all the line of parent categories of the given child category a final fake top category is added at the beginning of the list to represent the top of the hierarchy

Specified by:
getCategoryTreeUp in interface CategoryAPI
Returns:
Throws:
DotDataException
DotSecurityException

getCategoryTreeDown

public java.util.List<Category> getCategoryTreeDown(Categorizable categorizable,
                                                    Category catToSearchFrom,
                                                    com.liferay.portal.model.User user,
                                                    boolean respectFrontendRoles)
                                             throws DotDataException,
                                                    DotSecurityException
Description copied from interface: CategoryAPI
Will return to you all category hierarchy (children and subchildren and so on) who are attached to the categorizable and are below the passed category

Specified by:
getCategoryTreeDown in interface CategoryAPI
Returns:
Throws:
DotDataException
DotSecurityException

hasDependencies

public boolean hasDependencies(Category cat)
                        throws DotDataException
Description copied from interface: CategoryAPI
check If the category has dependencies.

Specified by:
hasDependencies in interface CategoryAPI
Returns:
Throws:
DotDataException

flushChildrenCache

public void flushChildrenCache()
Description copied from interface: CategoryAPI
This method flushes the children cache

Specified by:
flushChildrenCache in interface CategoryAPI


Copyright © 2010 dotCMS Inc. All Rights Reserved.