Interface OrganizationAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
OrganizationBatchAdminSession
This session creates, updates, and deletes Organizations . 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 an
Organization , an OrganizationForm is requested using
getOrganizationFormForCreate() specifying the desired record
Types or none if no record Types are needed. The returned
OrganizationForm 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 OrganizationForm is submitted to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each OrganizationForm
corresponds to an attempted transaction.
For updates, OrganizationForms are requested to the
Organization Id that is to be updated using
getOrganizationFormForUpdate() . Similarly, the OrganizationForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The OrganizationForm can
only be used once for a successful update and cannot be reused.
The delete operations delete Organizations . To unmap an
Organization from the current Realm , the
OrganizationRealmAssignmentSession should be used. These delete
operations attempt to remove the Organization itself thus removing
it from all known Realm catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasOrganization(Id organizationId, Id aliasId) Adds anIdto anOrganizationfor the purpose of creating compatibility.booleanTests if this user can create organizations.booleancanCreateOrganizationWithRecordTypes(Type[] organizationRecordTypes) Tests if this user can create a singleOrganizationusing the desired record types.booleanTests if this user can delete organizations.booleanTests if this user can manageIdaliases forOrganizations.booleanTests if this user can update organizations.createOrganization(OrganizationForm organizationForm) Creates a newOrganization.voiddeleteOrganization(Id organizationId) Deletes anOrganization.getOrganizationFormForCreate(Type[] organizationRecordTypes) Gets the organization form for creating new organizations.getOrganizationFormForUpdate(Id organizationId) Gets the organization form for updating an existing organization.getRealm()Gets theRealmassociated with this session.Gets theRealmIdassociated with this session.voidupdateOrganization(OrganizationForm organizationForm) Updates an existing organization.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
-
getRealmId
Id getRealmId()Gets theRealmIdassociated with this session.- Returns:
- the
Realm Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getRealm
Gets theRealmassociated with this session.- Returns:
- the realm
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateOrganizations
boolean canCreateOrganizations()Tests if this user can create organizations. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating anOrganizationwill 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:
falseifOrganizationcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateOrganizationWithRecordTypes
Tests if this user can create a singleOrganizationusing the desired record types. WhilePersonnelManager.getOrganizationRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificOrganization. Providing an empty array tests if anOrganizationcan be created with no records.- Parameters:
organizationRecordTypes- array of organization record types- Returns:
trueifOrganizationcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-organizationRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getOrganizationFormForCreate
OrganizationForm getOrganizationFormForCreate(Type[] organizationRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the organization form for creating new organizations. A new form should be requested for each create transaction.- Parameters:
organizationRecordTypes- array of organization record types to be included in the create operation or an empty list if none- Returns:
- the organization form
- Throws:
NullArgumentException-organizationRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- cannot get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createOrganization
Organization createOrganization(OrganizationForm organizationForm) throws OperationFailedException, PermissionDeniedException Creates a newOrganization.- Parameters:
organizationForm- the form for thisOrganization- Returns:
- the new
Organization - Throws:
IllegalStateException-organizationFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-organizationFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-organizationFormdid not originate fromgetOrganizationFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateOrganizations
boolean canUpdateOrganizations()Tests if this user can update organizations. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating anOrganizationwill 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:
falseifOrganizationmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getOrganizationFormForUpdate
OrganizationForm getOrganizationFormForUpdate(Id organizationId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the organization form for updating an existing organization. A new organization form should be requested for each update transaction.- Parameters:
organizationId- theIdof theOrganization- Returns:
- the organization form
- Throws:
NotFoundException-organizationIdis not foundNullArgumentException-organizationIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateOrganization
void updateOrganization(OrganizationForm organizationForm) throws OperationFailedException, PermissionDeniedException Updates an existing organization.- Parameters:
organizationForm- the form containing the elements to be updated- Throws:
IllegalStateException-organizationFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-organizationFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-organizationFormdid not originate fromgetOrganizationFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteOrganizations
boolean canDeleteOrganizations()Tests if this user can delete organizations. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anOrganizationwill 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:
falseifOrganizationdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteOrganization
void deleteOrganization(Id organizationId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes anOrganization.- Parameters:
organizationId- theIdof theOrganizationto remove- Throws:
NotFoundException-organizationIdnot foundNullArgumentException-organizationIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageOrganizationAliases
boolean canManageOrganizationAliases()Tests if this user can manageIdaliases forOrganizations. 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:
falseifOrganizationaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasOrganization
void aliasOrganization(Id organizationId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto anOrganizationfor the purpose of creating compatibility. The primaryIdof theOrganizationis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another organization, it is reassigned to the given organizationId.- Parameters:
organizationId- theIdof anOrganizationaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-organizationIdnot foundNullArgumentException-organizationIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-