Package io.goobi.viewer.managedbeans
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 Alpers
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionEnd the editing mode if active without persisting anything.deleteCategoryAction(CMSCategory category) Delete the given Category in DAO.voidedit(CMSCategory category) Start editing the given category.voidendEditing.Returns a newly created list of all saved categories.Getter for the fieldcategoryDescription.Getter for the fieldcategoryName.Getter for the fieldselectedCategory.getSelectedCategoryId.booleanCheck is we are currently editing an existing category, i.e.booleanisValid()Check ifgetCategoryName()is empty or equal (ignoring case) to the name of any existing category.If editing mode is active, set categoryName and categoryDescription to the currently selected category, persist it and end the editing mode.voidsetCategoryDescription(String categoryDescription) Setter for the fieldcategoryDescription.voidsetCategoryName(String categoryName) Setter for the fieldcategoryName.voidsetSelectedCategoryId.
-
Constructor Details
-
CmsCategoriesBean
public CmsCategoriesBean()
-
-
Method Details
-
isValid
Check ifgetCategoryName()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
Start editing the given category. Editing will continue until eithersaveCategoryAction()orcancelAction()is executed- Parameters:
category- The category to edit
-
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 ongetCategoryName()andgetCategoryDescription()and persist it. Also clear categoryName and categoryDescription.- Returns:
- Navigation outcome
-
deleteCategoryAction
Delete the given Category in DAO. Also clear categoryName and categoryDescription- Parameters:
category- category to delete from the database- Returns:
- Navigation outcome
-
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
Returns a newly created list of all saved categories.- Returns:
- a newly created list of all saved categories
- Throws:
DAOException- if any.
-
getCategoryName
Getter for the fieldcategoryName.- Returns:
- the name entered for the new or edited category
-
setCategoryName
Setter for the fieldcategoryName.- Parameters:
categoryName- name entered for the new or edited category
-
getCategoryDescription
Getter for the fieldcategoryDescription.- Returns:
- the description entered for the new or edited category
-
setCategoryDescription
Setter for the fieldcategoryDescription.- Parameters:
categoryDescription- description entered for the new or edited category
-
getSelectedCategory
Getter for the fieldselectedCategory.- Returns:
- the currently selected CMS category, or null if none is selected
-
getSelectedCategoryId
getSelectedCategoryId.
- Returns:
- ID of the selected category
-
setSelectedCategoryId
setSelectedCategoryId.
- Parameters:
id- database ID of the category to edit- Throws:
DAOException
-