Class CmsCategoriesBean

java.lang.Object
io.goobi.viewer.managedbeans.CmsCategoriesBean
All Implemented Interfaces:
Serializable

@Named("cmsCategoriesBean") @SessionScoped public class CmsCategoriesBean extends Object implements Serializable
Managed Bean for editing, deleting and creating categories
Author:
florian
See Also:
  • Constructor Details

    • CmsCategoriesBean

      public CmsCategoriesBean()
  • Method Details

    • isValid

      public boolean isValid() throws DAOException
      Check if getCategoryName() is empty or equal (ignoring case) to the name of any existing category. If we are editing a category, obviously ignore this category for the check
      Returns:
      true if getCategoryName() returns a valid name for a category
      Throws:
      DAOException - if any.
    • edit

      public void edit(CMSCategory category)
      Start editing the given category. Editing will continue until either saveCategoryAction() or cancelAction() is executed
      Parameters:
      category - The category to edit
    • saveCategoryAction

      public String saveCategoryAction()
      If editing mode is active, set categoryName and categoryDescription to the currently selected category, persist it and end the editing mode. Otherwise, if isValid() is true, create a new category based on getCategoryName() and getCategoryDescription() and persist it. Also clear categoryName and categoryDescription.
      Returns:
      Navigation outcome
    • deleteCategoryAction

      public String deleteCategoryAction(CMSCategory category)
      Delete the given Category in DAO. Also clear categoryName and categoryDescription
      Parameters:
      category - a CMSCategory object.
      Returns:
      Navigation outcome
    • cancelAction

      public String cancelAction()
      End the editing mode if active without persisting anything. Also clear categoryName and categoryDescription
      Returns:
      Navigation outcome
    • isEditing

      public boolean isEditing()
      Check is we are currently editing an existing category, i.e. getSelectedCategory() doesn't return null
      Returns:
      true if we are currently editing an existing category, i.e. getSelectedCategory() doesn't return null
    • endEditing

      public void endEditing()

      endEditing.

    • getAllCategories

      public List<CMSCategory> getAllCategories() throws DAOException
      Returns a newly created list of all saved categories
      Returns:
      a newly created list of all saved categories
      Throws:
      DAOException - if any.
    • getCategoryName

      public String getCategoryName()

      Getter for the field categoryName.

      Returns:
      the categoryName
    • setCategoryName

      public void setCategoryName(String categoryName)

      Setter for the field categoryName.

      Parameters:
      categoryName - the categoryName to set
    • getCategoryDescription

      public String getCategoryDescription()

      Getter for the field categoryDescription.

      Returns:
      the categoryDescription
    • setCategoryDescription

      public void setCategoryDescription(String categoryDescription)

      Setter for the field categoryDescription.

      Parameters:
      categoryDescription - the categoryDescription to set
    • getSelectedCategory

      public CMSCategory getSelectedCategory()

      Getter for the field selectedCategory.

      Returns:
      the selectedCategory
    • getSelectedCategoryId

      public Long getSelectedCategoryId()

      getSelectedCategoryId.

      Returns:
      ID of the selected category
    • setSelectedCategoryId

      public void setSelectedCategoryId(Long id) throws DAOException

      setSelectedCategoryId.

      Parameters:
      id - a Long object
      Throws:
      DAOException