public interface BusinessAdminSession extends OsidSession
This session creates, updates, and deletes Businesses.
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
Business,
a BusinessForm
is requested using
getBusinessFormForCreate()
specifying the desired record
Types
or none if no record Types
are needed. The
returned BusinessForm
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 BusinessForm
is submiited
to a create operation, it cannot be reused with another create operation
unless the first operation was unsuccessful. Each BusinessForm
corresponds to an attempted transaction.
For updates, BusinessForms
are requested to the
Business
Id
that is to be updated using
getBusinessFormForUpdate().
Similarly, the BusinessForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The BusinessForm
can only be used once for a successful update and cannot be reused.
The delete operations delete Businesses.
This session includes an Id
aliasing mechanism to
assign an external Id
to an internally assigned Id.
Modifier and Type | Method and Description |
---|---|
void |
aiiasBusiness(Id businessId,
Id aliasId)
Adds an
Id to a Business for the purpose
of creating compatibility. |
boolean |
canCreateBusinesses()
Tests if this user can create
Businesses. |
boolean |
canCreateBusinessWithRecordTypes(Type[] businessRecordTypes)
Tests if this user can create a single
Business using
the desired record types. |
boolean |
canDeleteBusinesses()
Tests if this user can delete
Businesses. |
boolean |
canManageBusinessAliases()
Tests if this user can manage
Id aliases for
Businesses. |
boolean |
canUpdateBusinesses()
Tests if this user can update
Businesses. |
Business |
createBusiness(BusinessForm businessForm)
Creates a new
Business. |
void |
deleteBusiness(Id businessId)
Deletes a
Business. |
BusinessForm |
getBusinessFormForCreate(Type[] businessRecordTypes)
Gets the business form for creating new businesses.
|
BusinessForm |
getBusinessFormForUpdate(Id businessId)
Gets the business form for updating an existing business.
|
void |
updateBusiness(BusinessForm businessForm)
Updates an existing business.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
boolean canCreateBusinesses()
Businesses.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known creating a Business.
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 Business
creation is
not authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateBusinessWithRecordTypes(Type[] businessRecordTypes)
Business
using
the desired record types. While
FinancialsManager.getBusinessRecordTypes()
can be used to
examine which records are supported, this method tests which record(s)
are required for creating a specific Business.
Providing an empty array tests if a Business
can be
created with no records.businessRecordTypes
- array of business record types true
if Business
creation using
the specified record Types
is supported,
false
otherwiseNullArgumentException
- businessRecordTypes
is null
mandatory
- This method must be implemented. BusinessForm getBusinessFormForCreate(Type[] businessRecordTypes) throws OperationFailedException, PermissionDeniedException
businessRecordTypes
- array of business record typesNullArgumentException
- businessRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Business createBusiness(BusinessForm businessForm) throws OperationFailedException, PermissionDeniedException
Business.
businessForm
- the form for this Business
Business
IllegalStateException
- businessForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- businessForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- businessForm
did
not originate from getBusinessFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateBusinesses()
Businesses.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known updating a Business
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 Business
modification
is not authorized, true
otherwisemandatory
- This method must be implemented. BusinessForm getBusinessFormForUpdate(Id businessId) throws NotFoundException, OperationFailedException, PermissionDeniedException
businessId
- the Id
of the Business
NotFoundException
- businessId
is not
foundNullArgumentException
- businessId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateBusiness(BusinessForm businessForm) throws OperationFailedException, PermissionDeniedException
businessForm
- the form containing the elements to be updatedIllegalStateException
- businessForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- businessForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- businessForm
did
not originate from getBusinessFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteBusinesses()
Businesses.
A return of
true does not guarantee successful authorization. A return of false
indicates that it is known deleting a Business
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 Business
deletion is
not authorized, true
otherwisemandatory
- This method must be implemented. void deleteBusiness(Id businessId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Business.
businessId
- the Id
of the Business
to removeNotFoundException
- businessId
not foundNullArgumentException
- businessId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageBusinessAliases()
Id
aliases for
Businesses.
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 Business
aliasing is
not authorized, true
otherwisemandatory
- This method must be implemented. void aiiasBusiness(Id businessId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Business
for the purpose
of creating compatibility. The primary Id
of the
Business
is determined by the provider. The new Id
performs as an alias to the primary Id
. If the
alias is a pointer to another business, it is reassigned to the given
business Id.
businessId
- the Id
of a Business
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- aliasId
is in use as
a primary Id
NullArgumentException
- businessId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.