Package org.ametys.plugins.blog
Class BlogCacheManager.PostDateCache
java.lang.Object
org.ametys.plugins.blog.BlogCacheManager.PostDateCache
- Enclosing class:
- BlogCacheManager
Post cache by date.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a post to the cache.void
addPost
(BlogCacheManager.Post post, int year, int month) Add a post to the cache.void
clear()
Clear the cache.getMonths
(int year) Get the months with posts for a specified year.protected Map<String,
BlogCacheManager.Post> getOrCreatePostMap
(int year, int month) Get or create the post set for the specified year and month.getPostByName
(int year, int month, String name) Get the posts for a year-month couple.getPosts
(int year) Get the posts for a year couple.getPosts
(int year, int month) Get the posts for a year-month couple.getYears()
Get the years with posts.boolean
hasMonth
(int year, int month) Determines if the page month exists in given yearboolean
Test if the post with the given ID exists for this year and month.boolean
hasPostByName
(int year, int month, String name) Get the posts for a year-month couple.boolean
hasYear
(int year) Determines if the year page existsvoid
removePost
(String contentId, int year, int month) Remove a post from the cache.
-
Constructor Details
-
PostDateCache
public PostDateCache()Construct a PostDateCache instance.
-
-
Method Details
-
hasYear
Determines if the year page exists- Parameters:
year
- the year- Returns:
- true if there are posts for this year
-
getYears
Get the years with posts.- Returns:
- the years with posts as a Set of Integer.
-
hasMonth
Determines if the page month exists in given year- Parameters:
year
- The yearmonth
- The month- Returns:
- true if there are posts for this year/month couple
-
getMonths
Get the months with posts for a specified year.- Parameters:
year
- the year.- Returns:
- the months with posts in the specified year as a Set of Integer.
-
getPosts
Get the posts for a year couple.- Parameters:
year
- the year.- Returns:
- the posts in the specified year.
-
getPosts
Get the posts for a year-month couple.- Parameters:
year
- the year.month
- the month.- Returns:
- the posts in the specified year and month.
-
addPost
Add a post to the cache.- Parameters:
content
- The contentyear
- the yearmonth
- the month
-
addPost
Add a post to the cache.- Parameters:
post
- the postyear
- the year of the postmonth
- the month of the post
-
removePost
Remove a post from the cache.- Parameters:
contentId
- The content idyear
- the yearmonth
- the month
-
hasPost
Test if the post with the given ID exists for this year and month.- Parameters:
year
- the year.month
- the month.id
- the id of post- Returns:
- the posts in the specified year and month.
-
getPostByName
Get the posts for a year-month couple.- Parameters:
year
- the year.month
- the month.name
- the name of post- Returns:
- the posts in the specified year and month.
-
hasPostByName
Get the posts for a year-month couple.- Parameters:
year
- the year.month
- the month.name
- the name of post- Returns:
- the posts in the specified year and month.
-
clear
Clear the cache. -
getOrCreatePostMap
Get or create the post set for the specified year and month.- Parameters:
year
- the year.month
- the month.- Returns:
- the post set.
-