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