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
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionEnd the editing mode if active without persisting anything.deleteCategoryAction
(CMSCategory category) Delete the given Category in DAO.void
edit
(CMSCategory category) Start editing the given category.void
endEditing.Returns a newly created list of all saved categoriesGetter for the fieldcategoryDescription
.Getter for the fieldcategoryName
.Getter for the fieldselectedCategory
.getSelectedCategoryId.boolean
Check is we are currently editing an existing category, i.e.boolean
isValid()
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.void
setCategoryDescription
(String categoryDescription) Setter for the fieldcategoryDescription
.void
setCategoryName
(String categoryName) Setter for the fieldcategoryName
.void
setSelectedCategoryId.
-
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, ifisValid()
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
- aCMSCategory
object.- 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 field
categoryName
.- Returns:
- the categoryName
-
setCategoryName
Setter for the field
categoryName
.- Parameters:
categoryName
- the categoryName to set
-
getCategoryDescription
Getter for the field
categoryDescription
.- Returns:
- the categoryDescription
-
setCategoryDescription
Setter for the field
categoryDescription
.- Parameters:
categoryDescription
- the categoryDescription to set
-
getSelectedCategory
Getter for the field
selectedCategory
.- Returns:
- the selectedCategory
-
getSelectedCategoryId
getSelectedCategoryId.
- Returns:
- ID of the selected category
-
setSelectedCategoryId
setSelectedCategoryId.
- Parameters:
id
- aLong
object- Throws:
DAOException
-