public interface PostAdminSession extends OsidSession
This session creates, updates, and deletes Posts. 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
Post, a PostForm is requested using
getPostFormForCreate() specifying the desired record Types
or none if no record Types are needed. The returned
PostForm 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 PostForm is submiited to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each PostForm corresponds
to an attempted transaction.
For updates, PostForms are requested to the Post
Id that is to be updated using
getPostFormForUpdate(). Similarly, the PostForm has
metadata about the data that can be updated and it can perform validation
before submitting the update. The PostForm can only be used
once for a successful update and cannot be reused.
The delete operations delete Posts. To unmap a
Post from the current Forum, the
PostForumAssignmentSession should be used. These delete operations
attempt to remove the Post itself thus removing it from all
known Forum catalogs.
This session includes an Id aliasing mechanism to
assign an external Id to an internally assigned Id.
| Modifier and Type | Method and Description |
|---|---|
void |
aliasPost(Id postId,
Id aliasId)
Adds an
Id to a Post for the purpose of
creating compatibility. |
boolean |
canCreatePosts()
Tests if this user can create
Posts. |
boolean |
canCreatePostWithRecordTypes(Type[] postRecordTypes)
Tests if this user can create a single
Post using the
desired record types. |
boolean |
canDeletePosts()
Tests if this user can delete
Posts A return of true
does not guarantee successful authorization. |
boolean |
canManagePostAliases()
Tests if this user can manage
Id aliases for
Posts. |
boolean |
canUpdatePosts()
Tests if this user can update
Posts. |
Post |
createPost(PostForm postForm)
Creates a new
Post. |
void |
deletePost(Id postId)
Deletes a
Post. |
Forum |
getForum()
Gets the
Forum associated with this session. |
Id |
getForumId()
Gets the
Forum Id associated with this
session. |
PostForm |
getPostFormForCreate(Type[] postRecordTypes)
Gets the post form for creating new posts.
|
PostForm |
getPostFormForUpdate(Id postId)
Gets the post form for updating an existing post.
|
void |
updatePost(PostForm postForm)
Updates an existing post.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionscloseId getForumId()
Forum Id associated with this
session. Forum Id associated with this sessionmandatory - This method must be implemented. Forum getForum() throws OperationFailedException, PermissionDeniedException
Forum associated with this session.OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canCreatePosts()
Posts. A return of true
does not guarantee successful authorization. A return of false
indicates that it is known creating a Post 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 Post creation is not
authorized, true otherwisemandatory - This method must be implemented. boolean canCreatePostWithRecordTypes(Type[] postRecordTypes)
Post using the
desired record types. While ForumManager.getPostRecordTypes()
can be used to examine which records are supported, this
method tests which record(s) are required for creating a specific
Post. Providing an empty array tests if a Post
can be created with no records.postRecordTypes - array of post record types true if Post creation using the
specified record Types is supported,
false otherwiseNullArgumentException - postRecordTypes
is null mandatory - This method must be implemented. PostForm getPostFormForCreate(Type[] postRecordTypes) throws OperationFailedException, PermissionDeniedException
postRecordTypes - array of post record typesNullArgumentException - postRecordTypes
is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - unable to get form for requested
record typesmandatory - This method must be implemented. Post createPost(PostForm postForm) throws OperationFailedException, PermissionDeniedException
Post. postForm - the form for this Post Post IllegalStateException - postForm already
used in a create transactionInvalidArgumentException - one or more of the form
elements is invalidNullArgumentException - postForm is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - postForm did not
originate from getPostFormForCreate() mandatory - This method must be implemented. boolean canUpdatePosts()
Posts. A return of true
does not guarantee successful authorization. A return of false
indicates that it is known updating a Post 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 Post modification is
not authorized, true otherwisemandatory - This method must be implemented. PostForm getPostFormForUpdate(Id postId) throws NotFoundException, OperationFailedException, PermissionDeniedException
postId - the Id of the Post NotFoundException - postId is not foundNullArgumentException - postId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. void updatePost(PostForm postForm) throws OperationFailedException, PermissionDeniedException
postForm - the form containing the elements to be updatedIllegalStateException - postForm already
used in an update transactionInvalidArgumentException - the form contains an invalid
valueNullArgumentException - postForm is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - postForm did not
originate from getPostFormForUpdate() mandatory - This method must be implemented. boolean canDeletePosts()
Posts A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting a Post 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 Post deletion is not
authorized, true otherwisemandatory - This method must be implemented. void deletePost(Id postId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Post. postId - the Id of the Post to
removeNotFoundException - postId not foundNullArgumentException - postId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canManagePostAliases()
Id aliases for
Posts. 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 Post aliasing is not
authorized, true otherwisemandatory - This method must be implemented. void aliasPost(Id postId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id to a Post for the purpose of
creating compatibility. The primary Id of the
Post is determined by the provider. The new Id
performs as an alias to the primary Id. If the alias is
a pointer to another post, it is reassigned to the given post
Id. postId - the Id of a Post aliasId - the alias Id AlreadyExistsException - aliasId is
already assignedNotFoundException - postId not foundNullArgumentException - postId or
aliasId is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented.