Interface BlogAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
BlogBatchAdminSession
This session creates, updates, and deletes Blogs . The data for
create and update is provided by the consumer via the form object.
OsidForms are requested for each create or update and may not be reused.
Create and update operations differ in their usage. To create a
Blog , a BlogForm is requested using
getBlogFormForCreate() specifying the desired record Types or
none if no record Types are needed. The returned BlogForm
will indicate that it is to be used with a create operation and can be
used to examine metdata or validate data prior to creation. Once the
BlogForm is submiited to a create operation, it cannot be reused
with another create operation unless the first operation was unsuccessful.
Each BlogForm corresponds to an attempted transaction.
For updates, BlogForms are requested to the Blog
Id that is to be updated using getBlogFormForUpdate() .
Similarly, the BlogForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
BlogForm can only be used once for a successful update and cannot
be reused.
The delete operations delete Blogs . This session includes an
Id aliasing mechanism to assign an external Id to an
internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds anIdto aBlogfor the purpose of creating compatibility.booleanTests if this user can createBlogs.booleancanCreateBlogWithRecordTypes(Type[] blogRecordTypes) Tests if this user can create a singleBlogusing the desired record types.booleanTests if this user can deleteBlogs.booleanTests if this user can manageIdaliases forBlogs.booleanTests if this user can updateBlogs.createBlog(BlogForm blogForm) Creates a newBlog.voiddeleteBlog(Id blogId) Deletes aBlog.getBlogFormForCreate(Type[] blogRecordTypes) Gets the blog form for creating new blogs.getBlogFormForUpdate(Id blogId) Gets the blog form for updating an existing blog.voidupdateBlog(BlogForm blogForm) Updates an existing blog.Methods inherited from interface OsidSession
closeMethods inherited from interface OsidSession
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionsModifier and TypeMethodDescriptionGets the agent authenticated to this session.Gets theIdof the agent authenticated to this session.Gets the rate of the service clock.getDate()Gets the service date which may be the current date or the effective date in which this session exists.Gets the effective agent in use by this session.Gets theIdof the effective agent in use by this session.Gets theDisplayTextformatTypepreference in effect for this session.Gets the locale indicating the localization preferences in effect for this session.booleanTests if an agent is authenticated to this session.Starts a new transaction for this sesson.booleanTests for the availability of transactions.
-
Method Details
-
canCreateBlogs
boolean canCreateBlogs()Tests if this user can createBlogs. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aBlogwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.- Returns:
falseifBlogcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateBlogWithRecordTypes
Tests if this user can create a singleBlogusing the desired record types. WhileBloggingManager.getBlogRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificBlog. Providing an empty array tests if aBlogcan be created with no records.- Parameters:
blogRecordTypes- array of blog record types- Returns:
trueifBlogcreation using the specifiedTypesis supported,falseotherwise- Throws:
NullArgumentException-blogRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getBlogFormForCreate
BlogForm getBlogFormForCreate(Type[] blogRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the blog form for creating new blogs.- Parameters:
blogRecordTypes- array of blog record types- Returns:
- the blog form
- Throws:
NullArgumentException-blogRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createBlog
Creates a newBlog.- Parameters:
blogForm- the forms for thisBlog- Returns:
- the new
Blog - Throws:
IllegalStateException-blogFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-blogFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-blogFormdid not originate fromgetBlogFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateBlogs
boolean canUpdateBlogs()Tests if this user can updateBlogs. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aBlogwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.- Returns:
falseifBlogmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getBlogFormForUpdate
BlogForm getBlogFormForUpdate(Id blogId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the blog form for updating an existing blog. A new blog form should be requested for each update transaction.- Parameters:
blogId- theIdof theBlog- Returns:
- the blog form
- Throws:
NotFoundException-blogIdis not foundNullArgumentException-blogIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateBlog
Updates an existing blog.- Parameters:
blogForm- the form containing the elements to be updated- Throws:
IllegalStateException-blogFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-blogIdorblogFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-blogFormdid not originate fromgetBlogFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteBlogs
boolean canDeleteBlogs()Tests if this user can deleteBlogs. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aBlogwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.- Returns:
falseifBlogdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteBlog
void deleteBlog(Id blogId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aBlog.- Parameters:
blogId- theIdof theBlogto remove- Throws:
NotFoundException-blogIdnot foundNullArgumentException-blogIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageBlogAliases
boolean canManageBlogAliases()Tests if this user can manageIdaliases forBlogs. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.- Returns:
falseifBlogaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasBlog
void aliasBlog(Id blogId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aBlogfor the purpose of creating compatibility. The primaryIdof theBlogis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another blog, it is reassigned to the given blogId.- Parameters:
blogId- theIdof aBlogaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-blogIdnot foundNullArgumentException-blogIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-