Interface PollsAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
PollsBatchAdminSession
This session creates, updates, and deletes Polls . 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
Polls , a PollsForm is requested using
getPollsFormForCreate() specifying the desired record Types or
none if no record Types are needed. The returned PollsForm
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
PollsForm is submiited to a create operation, it cannot be reused
with another create operation unless the first operation was unsuccessful.
Each PollsForm corresponds to an attempted transaction.
For updates, PollsForms are requested to the Polls
Id that is to be updated using getPollsFormForUpdate() .
Similarly, the PollsForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
PollsForm can only be used once for a successful update and cannot
be reused.
The delete operations delete Polls .
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasPolls(Id pollsId, Id aliasId) Adds anIdto aPollsfor the purpose of creating compatibility.booleanTests if this user can createPolls.booleancanCreatePollsWithRecordTypes(Type[] pollsRecordTypes) Tests if this user can create a singlePollsusing the desired record types.booleanTests if this user can deletePolls.booleanTests if this user can manageIdaliases forPolls.booleanTests if this user can updatePolls.createPolls(PollsForm pollsForm) Creates a newPolls.voiddeletePolls(Id pollsId) Deletes aPolls.getPollsFormForCreate(Type[] pollsRecordTypes) Gets the polls form for creating new polls.getPollsFormForUpdate(Id pollsId) Gets the polls form for updating an existing polls.voidupdatePolls(PollsForm pollsForm) Updates an existing polls.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
-
canCreatePolls
boolean canCreatePolls()Tests if this user can createPolls. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aPollswill 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:
falseifPollscreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreatePollsWithRecordTypes
Tests if this user can create a singlePollsusing the desired record types. WhileVotingManager.getPollsRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificPolls. Providing an empty array tests if aPollscan be created with no records.- Parameters:
pollsRecordTypes- array of polls record types- Returns:
trueifPollscreation using the specifiedTypesis supported,falseotherwise- Throws:
NullArgumentException-pollsRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getPollsFormForCreate
PollsForm getPollsFormForCreate(Type[] pollsRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the polls form for creating new polls.- Parameters:
pollsRecordTypes- array of polls record types- Returns:
- the polls form
- Throws:
NullArgumentException-pollsRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form with requested record types- Compliance:
mandatory- This method must be implemented.
-
createPolls
Creates a newPolls.- Parameters:
pollsForm- the form for thisPolls- Returns:
- the new
Polls - Throws:
IllegalStateException-pollsFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-pollsFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-pollsFormdid not originate fromgetPollsFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdatePolls
boolean canUpdatePolls()Tests if this user can updatePolls. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aPollswill 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:
falseifPollsmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getPollsFormForUpdate
PollsForm getPollsFormForUpdate(Id pollsId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the polls form for updating an existing polls. A new polls form should be requested for each update transaction.- Parameters:
pollsId- theIdof thePolls- Returns:
- the polls form
- Throws:
NotFoundException-pollsIdis not foundNullArgumentException-pollsIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updatePolls
Updates an existing polls.- Parameters:
pollsForm- the form containing the elements to be updated- Throws:
IllegalStateException-pollsFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-pollsIdorpollsFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-pollsFormdid not originate fromgetPollsFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeletePolls
boolean canDeletePolls()Tests if this user can deletePolls. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aPollswill 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:
falseifPollsdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deletePolls
void deletePolls(Id pollsId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aPolls.- Parameters:
pollsId- theIdof thePollsto remove- Throws:
NotFoundException-pollsIdnot foundNullArgumentException-pollsIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManagePollsAliases
boolean canManagePollsAliases()Tests if this user can manageIdaliases forPolls. 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:
falseifPollsaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasPolls
void aliasPolls(Id pollsId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aPollsfor the purpose of creating compatibility. The primaryIdof thePollsis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another polls, it is reassigned to the given pollsId.- Parameters:
pollsId- theIdof aPollsaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-pollsIdnot foundNullArgumentException-pollsIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-