@Service(value="blogManagement") public class BlogManagementImpl extends BlogManagementBase
PROPERTY_KEY_PERSONAL_TOPIC_USER_ID
Constructor and Description |
---|
BlogManagementImpl() |
Modifier and Type | Method and Description |
---|---|
void |
createDefaultBlog(String topicName)
Create a default topic if there is no such topic yet.
|
String |
generateUniqueBlogAlias(String aliasBase,
String previousAlias)
Tries to find a valid blog alias that is not yet used by another blog
|
<T> T |
getBlogByAlias(String alias,
Converter<Blog,T> converter)
Return the details of a blog.
|
Blog |
getBlogById(Long blogId,
boolean needTags)
Retrieve a blog by its ID.
|
<T> T |
getBlogById(Long blogId,
Converter<Blog,T> converter)
Return the details of a blog.
|
Long |
getBlogId(String alias)
Get the ID of a topic identified by the alias.
|
List<BlogData> |
getLastUsedBlogs(int numberOfMaxResults,
boolean sortByTitle)
Retrieve a collection of the writable blogs the current user has written to.
|
MinimalBlogData |
getMinimalBlogInfo(Long blogId)
Return the minimal set of information on a blog, even if the current user is not allowed to
read it.
|
protected Blog |
handleCreateBlog(CreationBlogTO blogDetails)
Performs the core logic for
BlogManagementBase.createBlog(CreationBlogTO) |
protected void |
handleDeleteBlog(Long blogId,
Long newBlogId)
Performs the core logic for
BlogManagementBase.deleteBlog(Long, Long) |
protected void |
handleDeleteBlogs(Long[] blogIds)
Performs the core logic for
BlogManagementBase.deleteBlogs(Long[]) |
protected Blog |
handleFindBlogByIdentifier(String identifier)
Performs the core logic for
BlogManagementBase.findBlogByIdentifier(String) |
protected Blog |
handleFindBlogByIdentifierWithoutAuthorizationCheck(String alias)
Performs the core logic for
BlogManagementBase.findBlogByIdentifierWithoutAuthorizationCheck(String) |
protected Blog |
handleFindBlogByIdWithoutAuthorizationCheck(Long blogId)
Retrieves a blog by its ID.
|
protected List<Blog> |
handleFindBlogsById(Long[] blogIds)
Performs the core logic for
BlogManagementBase.findBlogsById(Long[]) |
protected long |
handleGetBlogCount()
Performs the core logic for
BlogManagementBase.getBlogCount() |
protected List<BlogData> |
handleGetMostUsedBlogs(int numberOfMaxResults,
boolean sortByTitle)
Performs the core logic for
BlogManagementBase.getMostUsedBlogs(int,boolean ) |
protected Blog |
handleUpdateBlog(Long blogId,
BlogTO blogTO)
Performs the core logic for
BlogManagementBase.updateBlog(Long, BlogTO) |
void |
resetGlobalPermissions()
Removes "all read" and "all write" permissions from all blogs.
|
createBlog, deleteBlog, deleteBlogs, findBlogByIdentifier, findBlogByIdentifierWithoutAuthorizationCheck, findBlogByIdWithoutAuthorizationCheck, findBlogsById, getBlogCount, getMostUsedBlogs, getPrincipal, updateBlog
public void createDefaultBlog(String topicName) throws NonUniqueBlogIdentifierException, BlogIdentifierValidationException
BlogManagement
topicName
- the name of the topic to createNonUniqueBlogIdentifierException
- in case the blog alias of the default blog is not uniqueBlogIdentifierValidationException
- in case the blog alias of the default blog is not valid@Transactional(readOnly=true) public String generateUniqueBlogAlias(String aliasBase, String previousAlias) throws NonUniqueBlogIdentifierException
aliasBase
- the alias value to start with. If this value is not a valid alias, it will be
converted into a valid string.previousAlias
- if this alias is generated it will not be considered as a duplicate. Providing
this value is especially useful when generating an alias for a blog update. Can be
null.NonUniqueBlogIdentifierException
- in case no unique identifier could be generated@Transactional(readOnly=true) public <T> T getBlogByAlias(String alias, Converter<Blog,T> converter) throws BlogAccessException
T
- the type of the resulting objectalias
- the alias of the topicconverter
- the converter to use for creating the result objectBlogAccessException
- in case the current user has no access to the topic@Transactional(readOnly=true) public Blog getBlogById(Long blogId, boolean needTags) throws BlogNotFoundException, BlogAccessException
BlogManagement
BlogManagement.getBlogById(Long, Converter)
should be used instead.blogId
- the ID of the blogneedTags
- If true tags will also be loaded.BlogNotFoundException
- in case the topic does not existBlogAccessException
- in case the current user has no read access to the topic@Transactional(readOnly=true) public <T> T getBlogById(Long blogId, Converter<Blog,T> converter) throws BlogAccessException
T
- the type of the resulting objectblogId
- the ID of the blogconverter
- the converter to use for creating the result objectBlogAccessException
- in case the current user has no access to the topicpublic Long getBlogId(String alias)
BlogManagement
alias
- the alias of the topic@Transactional(readOnly=true) public List<BlogData> getLastUsedBlogs(int numberOfMaxResults, boolean sortByTitle)
numberOfMaxResults
- The maximal number of blogs to returnsortByTitle
- If true, the result will be sorted by title.public MinimalBlogData getMinimalBlogInfo(Long blogId)
BlogManagement
blogId
- the ID of the topicprotected Blog handleCreateBlog(CreationBlogTO blogDetails) throws NonUniqueBlogIdentifierException, BlogIdentifierValidationException, BlogNotFoundException, BlogAccessException
BlogManagementBase.createBlog(CreationBlogTO)
handleCreateBlog
in class BlogManagementBase
BlogNotFoundException
- in case the topic to be added as the parent topic does not existBlogAccessException
- in case the current user is not manager of the topic that should be added as the
parent topicNonUniqueBlogIdentifierException
BlogIdentifierValidationException
protected void handleDeleteBlog(Long blogId, Long newBlogId) throws NoteManagementAuthorizationException, BlogNotFoundException
BlogManagementBase.deleteBlog(Long, Long)
handleDeleteBlog
in class BlogManagementBase
NoteManagementAuthorizationException
BlogNotFoundException
protected void handleDeleteBlogs(Long[] blogIds) throws AuthorizationException
BlogManagementBase.deleteBlogs(Long[])
handleDeleteBlogs
in class BlogManagementBase
AuthorizationException
protected Blog handleFindBlogByIdentifier(String identifier) throws BlogAccessException
BlogManagementBase
BlogManagementBase.findBlogByIdentifier(String)
handleFindBlogByIdentifier
in class BlogManagementBase
BlogAccessException
protected Blog handleFindBlogByIdentifierWithoutAuthorizationCheck(String alias)
BlogManagementBase
BlogManagementBase.findBlogByIdentifierWithoutAuthorizationCheck(String)
handleFindBlogByIdentifierWithoutAuthorizationCheck
in class BlogManagementBase
protected Blog handleFindBlogByIdWithoutAuthorizationCheck(Long blogId)
handleFindBlogByIdWithoutAuthorizationCheck
in class BlogManagementBase
blogId
- the ID of the blogprotected List<Blog> handleFindBlogsById(Long[] blogIds)
BlogManagementBase
BlogManagementBase.findBlogsById(Long[])
handleFindBlogsById
in class BlogManagementBase
protected long handleGetBlogCount()
BlogManagementBase
BlogManagementBase.getBlogCount()
handleGetBlogCount
in class BlogManagementBase
protected List<BlogData> handleGetMostUsedBlogs(int numberOfMaxResults, boolean sortByTitle)
BlogManagementBase.getMostUsedBlogs(int,boolean )
handleGetMostUsedBlogs
in class BlogManagementBase
protected Blog handleUpdateBlog(Long blogId, BlogTO blogTO) throws NonUniqueBlogIdentifierException, BlogIdentifierValidationException, BlogAccessException
BlogManagementBase.updateBlog(Long, BlogTO)
handleUpdateBlog
in class BlogManagementBase
blogId
- ID of the blog to updateblogTO
- transfer object holding the details of the blog to be updatedNonUniqueBlogIdentifierException
- in case the new blog alias is not uniqueBlogIdentifierValidationException
- in case the new blog alias is not validBlogAccessException
- in case the current user has not the required permission to update the blogpublic void resetGlobalPermissions()
Copyright © 2019 Communote team. All rights reserved.