Interface VoteEnablerAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
This session creates, updates, and deletes VoteEnablers . 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
VoteEnabler , a VoteEnablerForm is requested using
getVoteEnablerFormForCreate() specifying the desired record Types
or none if no record Types are needed. The returned
VoteEnablerForm 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 VoteEnablerForm is submiited to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each VoteEnablerForm corresponds
to an attempted transaction.
For updates, VoteEnablerForms are requested to the
VoteEnabler Id that is to be updated using
getVoteEnablerFormForUpdate() . Similarly, the VoteEnablerForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The VoteEnablerForm can
only be used once for a successful update and cannot be reused.
The delete operations delete VoteEnablers . To unmap a
VoteEnabler from the current Polls , the
VoteEnablerPollsAssignmentSession should be used. These delete operations
attempt to remove the VoteEnabler itself thus removing it from all
known Polls catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id .
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasVoteEnabler(Id voteEnablerId, Id aliasId) Adds anIdto aVoteEnablerfor the purpose of creating compatibility.booleanTests if this user can createVoteEnablers.booleancanCreateVoteEnablerWithRecordTypes(Type[] voteEnablerRecordTypes) Tests if this user can create a singleVoteEnablerusing the desired record types.booleanTests if this user can deleteVoteEnablers.booleanTests if this user can manageIdaliases forVoteEnablersA return of true does not guarantee successful authorization.booleanTests if this user can updateVoteEnablers.createVoteEnabler(VoteEnablerForm voteEnablerForm) Creates a newVoteEnabler.voiddeleteVoteEnabler(Id voteEnablerId) Deletes aVoteEnabler.getPolls()Gets thePollsassociated with this session.Gets thePollsIdassociated with this session.getVoteEnablerFormForCreate(Type[] voteEnablerRecordTypes) Gets the vote enabler form for creating new vote enablers.getVoteEnablerFormForUpdate(Id voteEnablerId) Gets the vote enabler form for updating an existing vote enabler.voidupdateVoteEnabler(VoteEnablerForm voteEnablerForm) Updates an existing vote enabler.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
-
getPollsId
Id getPollsId()Gets thePollsIdassociated with this session.- Returns:
- the
Polls Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getPolls
Gets thePollsassociated with this session.- Returns:
- the polls
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateVoteEnablers
boolean canCreateVoteEnablers()Tests if this user can createVoteEnablers. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aVoteEnablerwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifVoteEnablercreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateVoteEnablerWithRecordTypes
Tests if this user can create a singleVoteEnablerusing the desired record types. WhileVotingRulesManager.getVoteEnablerRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificVoteEnabler. Providing an empty array tests if aVoteEnabler can be created with no records.- Parameters:
voteEnablerRecordTypes- array of vote enabler record types- Returns:
trueifVoteEnablercreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-voteEnablerRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getVoteEnablerFormForCreate
VoteEnablerForm getVoteEnablerFormForCreate(Type[] voteEnablerRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the vote enabler form for creating new vote enablers. A new form should be requested for each create transaction.- Parameters:
voteEnablerRecordTypes- array of vote enabler record types- Returns:
- the vote enabler form
- Throws:
NullArgumentException-voteEnablerRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createVoteEnabler
VoteEnabler createVoteEnabler(VoteEnablerForm voteEnablerForm) throws OperationFailedException, PermissionDeniedException Creates a newVoteEnabler.- Parameters:
voteEnablerForm- the form for thisVoteEnabler- Returns:
- the new
VoteEnabler - Throws:
IllegalStateException-voteEnablerFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-voteEnablerFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-voteEnablerFormdid not originate fromgetVoteEnablerFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateVoteEnablers
boolean canUpdateVoteEnablers()Tests if this user can updateVoteEnablers. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aVoteEnablerwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseifVoteEnablermodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getVoteEnablerFormForUpdate
VoteEnablerForm getVoteEnablerFormForUpdate(Id voteEnablerId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the vote enabler form for updating an existing vote enabler. A new vote enabler form should be requested for each update transaction.- Parameters:
voteEnablerId- theIdof theVoteEnabler- Returns:
- the vote enabler form
- Throws:
NotFoundException-voteEnablerIdis not foundNullArgumentException-voteEnablerIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateVoteEnabler
void updateVoteEnabler(VoteEnablerForm voteEnablerForm) throws OperationFailedException, PermissionDeniedException Updates an existing vote enabler.- Parameters:
voteEnablerForm- the form containing the elements to be updated- Throws:
IllegalStateException-voteEnablerFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-voteEnablerFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-voteEnablerFormdid not originate fromgetVoteEnablerFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteVoteEnablers
boolean canDeleteVoteEnablers()Tests if this user can deleteVoteEnablers. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aVoteEnablerwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifVoteEnablerdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteVoteEnabler
void deleteVoteEnabler(Id voteEnablerId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aVoteEnabler.- Parameters:
voteEnablerId- theIdof theVoteEnablerto remove- Throws:
NotFoundException-voteEnablerIdnot foundNullArgumentException-voteEnablerIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageVoteEnablerAliases
boolean canManageVoteEnablerAliases()Tests if this user can manageIdaliases forVoteEnablersA 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:
falseifVoteEnableraliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasVoteEnabler
void aliasVoteEnabler(Id voteEnablerId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aVoteEnablerfor the purpose of creating compatibility. The primaryIdof theVoteEnableris determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another vote enabler, it is reassigned to the given vote enablerId.- Parameters:
voteEnablerId- theIdof aVoteEnableraliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-voteEnablerIdnot foundNullArgumentException-voteEnablerIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-