Interface DemographicAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
This session creates and removes demographics. The data for create and
update is provided via the DemographicForm .
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasDemographic(Id demographicId, Id aliasId) Adds anIdto aDemographicfor the purpose of creating compatibility.booleanTests if this user can create demographics.booleancanCreateDemographicWithRecordTypes(Type[] demographicRecordTypes) Tests if this user can create a singleDemographicusing the desired record types.booleanTests if this user can delete demographics.booleanTests if this user can manageIdaliases for demographics.booleanTests if this user can update demographics.createDemographic(DemographicForm demographicForm) Creates a newDemographic.voiddeleteDemographic(Id demographicId) Deletes aDemographic.getBin()Gets theBinassociated with this session.getBinId()Gets theBinIdassociated with this session.getDemographicFormForCreate(Type[] demographicRecordTypes) Gets the demographic form for creating new demographics.getDemographicFormForUpdate(Id demographicId) Gets the demographic form for updating an existing demographic.voidupdateDemographic(DemographicForm demographicForm) Updates an existing demographic.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
-
getBinId
Id getBinId()Gets theBinIdassociated with this session.- Returns:
- the
Bin Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getBin
Gets theBinassociated with this session.- Returns:
- the bin
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateDemographic
boolean canCreateDemographic()Tests if this user can create demographics. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aDemographicwill 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:
falseifDemographiccreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateDemographicWithRecordTypes
Tests if this user can create a singleDemographicusing the desired record types. WhileResourceDemographicManager.getDemographicRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificDemographic. Providing an empty array tests if aDemographiccan be created with no records.- Parameters:
demographicRecordTypes- array of demographic record types- Returns:
trueifDemographiccreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-demographicRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getDemographicFormForCreate
DemographicForm getDemographicFormForCreate(Type[] demographicRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the demographic form for creating new demographics. A new form should be requested for each create transaction.- Parameters:
demographicRecordTypes- array of demographic record types- Returns:
- the demographic form
- Throws:
NullArgumentException-demographicRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createDemographic
Demographic createDemographic(DemographicForm demographicForm) throws OperationFailedException, PermissionDeniedException Creates a newDemographic.- Parameters:
demographicForm- the form for thisDemographic- Returns:
- the new
Demographic - Throws:
IllegalStateException-demographicFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-demographicFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-demographicFormdid not originate fromgetDemographicFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateDemographics
boolean canUpdateDemographics()Tests if this user can update demographics. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aDemographicwill 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:
falseifDemographicmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getDemographicFormForUpdate
DemographicForm getDemographicFormForUpdate(Id demographicId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the demographic form for updating an existing demographic. A new demographic form should be requested for each update transaction.- Parameters:
demographicId- theIdof theDemographic- Returns:
- the demographic form
- Throws:
NotFoundException-demographicIdis not foundNullArgumentException-demographicIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateDemographic
void updateDemographic(DemographicForm demographicForm) throws OperationFailedException, PermissionDeniedException Updates an existing demographic.- Parameters:
demographicForm- the form containing the elements to be updated- Throws:
IllegalStateException-demographicFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-demographicIdordemographicFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-demographicFormdid not originate fromgetDemographicFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteDemographics
boolean canDeleteDemographics()Tests if this user can delete demographics. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aDemographicwill 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:
falseifDemographicdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteDemographic
void deleteDemographic(Id demographicId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aDemographic.- Parameters:
demographicId- theIdof theDemographicto remove- Throws:
NotFoundException-demographicIdnot foundNullArgumentException-demographicIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageDemographicAliases
boolean canManageDemographicAliases()Tests if this user can manageIdaliases for demographics. 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:
falseifDemographicaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasDemographic
void aliasDemographic(Id demographicId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aDemographicfor the purpose of creating compatibility. The primaryIdof theDemographicis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another demographic. it is reassigned to the given demographicId.- Parameters:
demographicId- theIdof aDemographicaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-demographicIdnot foundNullArgumentException-demographicIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-