public interface BlogAdminSession extends OsidSession
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.
Modifier and Type | Method and Description |
---|---|
void |
aliasBlog(Id blogId,
Id aliasId)
Adds an
Id to a Blog for the purpose of
creating compatibility. |
boolean |
canCreateBlogs()
Tests if this user can create
Blogs. |
boolean |
canCreateBlogWithRecordTypes(Type[] blogRecordTypes)
Tests if this user can create a single
Blog using the
desired record types. |
boolean |
canDeleteBlogs()
Tests if this user can delete
Blogs. |
boolean |
canManageBlogAliases()
Tests if this user can manage
Id aliases for
Blogs. |
boolean |
canUpdateBlogs()
Tests if this user can update
Blogs. |
Blog |
createBlog(BlogForm blogForm)
Creates a new
Blog. |
void |
deleteBlog(Id blogId)
Deletes a
Blog. |
BlogForm |
getBlogFormForCreate(Type[] blogRecordTypes)
Gets the blog form for creating new blogs.
|
BlogForm |
getBlogFormForUpdate(Id blogId)
Gets the blog form for updating an existing blog.
|
void |
updateBlog(BlogForm blogForm)
Updates an existing blog.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
boolean canCreateBlogs()
Blogs.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known creating a Blog
will result
in a PERMISSION_DENIED.
This is intended as a hint to
an application that may not wish to offer create operations to
unauthorized users. false
if Blog
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateBlogWithRecordTypes(Type[] blogRecordTypes)
Blog
using the
desired record types. While
BloggingManager.getBlogRecordTypes()
can be used to examine
which records are supported, this method tests which record(s) are
required for creating a specific Blog.
Providing an
empty array tests if a Blog
can be created with no
records.blogRecordTypes
- array of blog record types true
if Blog
creation using the
specified Types
is supported, false
otherwiseNullArgumentException
- blogRecordTypes
is null
mandatory
- This method must be implemented. BlogForm getBlogFormForCreate(Type[] blogRecordTypes) throws OperationFailedException, PermissionDeniedException
blogRecordTypes
- array of blog record typesNullArgumentException
- blogRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Blog createBlog(BlogForm blogForm) throws OperationFailedException, PermissionDeniedException
Blog.
blogForm
- the forms for this Blog
Blog
IllegalStateException
- blogForm
already
used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- blogForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- blogForm
did not
originate from getBlogFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateBlogs()
Blogs.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known updating a Blog
will result
in a PERMISSION_DENIED.
This is intended as a hint to
an application that may not wish to offer update operations to
unauthorized users. false
if Blog
modification is
not authorized, true
otherwisemandatory
- This method must be implemented. BlogForm getBlogFormForUpdate(Id blogId) throws NotFoundException, OperationFailedException, PermissionDeniedException
blogId
- the Id
of the Blog
NotFoundException
- blogId
is not foundNullArgumentException
- blogId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateBlog(BlogForm blogForm) throws OperationFailedException, PermissionDeniedException
blogForm
- the form containing the elements to be updatedIllegalStateException
- blogForm
already
used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- blogId
or
blogForm
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- blogForm
did not
originate from getBlogFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteBlogs()
Blogs.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting a Blog
will result
in a PERMISSION_DENIED.
This is intended as a hint to
an application that may not wish to offer delete operations to
unauthorized users. false
if Blog
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteBlog(Id blogId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Blog.
blogId
- the Id
of the Blog
to
removeNotFoundException
- blogId
not foundNullArgumentException
- blogId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageBlogAliases()
Id
aliases for
Blogs.
A return of true does not guarantee successful
authorization. A return of false indicates that it is known changing
an alias will result in a PERMISSION_DENIED.
This is
intended as a hint to an application that may opt not to offer alias
operations to an unauthorized user. false
if Blog
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasBlog(Id blogId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Blog
for the purpose of
creating compatibility. The primary Id
of the
Blog
is determined by the provider. The new Id
is an alias to the primary Id.
If the alias is a
pointer to another blog, it is reassigned to the given blog Id.
blogId
- the Id
of a Blog
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is in
use as a primary Id
NotFoundException
- blogId
not foundNullArgumentException
- blogId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.