public interface OrganizationAdminSession extends OsidSession
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.
Modifier and Type | Method and Description |
---|---|
void |
aliasOrganization(Id organizationId,
Id aliasId)
Adds an
Id to an Organization for the
purpose of creating compatibility. |
boolean |
canCreateOrganizations()
Tests if this user can create organizations.
|
boolean |
canCreateOrganizationWithRecordTypes(Type[] organizationRecordTypes)
Tests if this user can create a single
Organization
using the desired record types. |
boolean |
canDeleteOrganizations()
Tests if this user can delete organizations.
|
boolean |
canManageOrganizationAliases()
Tests if this user can manage
Id aliases for
Organizations. |
boolean |
canUpdateOrganizations()
Tests if this user can update organizations.
|
Organization |
createOrganization(OrganizationForm organizationForm)
Creates a new
Organization. |
void |
deleteOrganization(Id organizationId)
Deletes an
Organization. |
OrganizationForm |
getOrganizationFormForCreate(Type[] organizationRecordTypes)
Gets the organization form for creating new organizations.
|
OrganizationForm |
getOrganizationFormForUpdate(Id organizationId)
Gets the organization form for updating an existing organization.
|
Realm |
getRealm()
Gets the
Realm associated with this session. |
Id |
getRealmId()
Gets the
Realm Id associated with this
session. |
void |
updateOrganization(OrganizationForm organizationForm)
Updates an existing organization.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getRealmId()
Realm
Id
associated with this
session. Realm Id
associated with this sessionmandatory
- This method must be implemented. Realm getRealm() throws OperationFailedException, PermissionDeniedException
Realm
associated with this session.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateOrganizations()
Organization
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 Organization
creation
is not authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateOrganizationWithRecordTypes(Type[] organizationRecordTypes)
Organization
using the desired record types. While
PersonnelManager.getOrganizationRecordTypes()
can be used to
examine which records are supported, this method tests which record(s)
are required for creating a specific Organization.
Providing an empty array tests if an Organization
can
be created with no records.organizationRecordTypes
- array of organization record types true
if Organization
creation
using the specified record Types
is supported,
false
otherwiseNullArgumentException
- organizationRecordTypes
is null
mandatory
- This method must be implemented. OrganizationForm getOrganizationFormForCreate(Type[] organizationRecordTypes) throws OperationFailedException, PermissionDeniedException
organizationRecordTypes
- array of organization record types to
be included in the create operation or an empty list if noneNullArgumentException
- organizationRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- cannot get form for requested
record typesmandatory
- This method must be implemented. Organization createOrganization(OrganizationForm organizationForm) throws OperationFailedException, PermissionDeniedException
Organization.
organizationForm
- the form for this Organization
Organization
IllegalStateException
- organizationForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- organizationForm
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- organizationForm
did not originate from getOrganizationFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateOrganizations()
Organization
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 Organization
modification is not authorized, true
otherwisemandatory
- This method must be implemented. OrganizationForm getOrganizationFormForUpdate(Id organizationId) throws NotFoundException, OperationFailedException, PermissionDeniedException
organizationId
- the Id
of the
Organization
NotFoundException
- organizationId
is
not foundNullArgumentException
- organizationId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateOrganization(OrganizationForm organizationForm) throws OperationFailedException, PermissionDeniedException
organizationForm
- the form containing the elements to be
updatedIllegalStateException
- organizationForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- organizationForm
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- organizationForm
did not originate from getOrganizationFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteOrganizations()
Organization
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 Organization
deletion
is not authorized, true
otherwisemandatory
- This method must be implemented. void deleteOrganization(Id organizationId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Organization.
organizationId
- the Id
of the
Organization
to removeNotFoundException
- organizationId
not
foundNullArgumentException
- organizationId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageOrganizationAliases()
Id
aliases for
Organizations.
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 Organization
aliasing
is not authorized, true
otherwisemandatory
- This method must be implemented. void aliasOrganization(Id organizationId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to an Organization
for the
purpose of creating compatibility. The primary Id
of
the Organization
is determined by the provider. The new
Id
is an alias to the primary Id.
If the
alias is a pointer to another organization, it is reassigned to the
given organization Id.
organizationId
- the Id
of an Organization
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is in
use as a primary Id
NotFoundException
- organizationId
not
foundNullArgumentException
- organizationId
or aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.