public interface EntryAdminSession extends OsidSession
This session creates, updates, and deletes Entries.
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
Entry,
an EntryForm
is requested using
getEntryFormForCreate()
specifying the desired customer,
item, period, and record Types
or none if no record
Types
are needed. The returned EntryForm
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
EntryForm
is submiited to a create operation, it cannot be reused
with another create operation unless the first operation was unsuccessful.
Each EntryForm
corresponds to an attempted transaction.
For updates, EntryForms
are requested to the
Entry
Id
that is to be updated using
getEntryFormForUpdate().
Similarly, the EntryForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The EntryForm
can
only be used once for a successful update and cannot be reused.
The delete operations delete EntryForms.
To unmap an
Entry
from the current Business,
the
EntryBusinessAssignmentSession
should be used. These delete
operations attempt to remove the EntryForm
itself thus
removing it from all known Business
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 |
aliasEntry(Id entryId,
Id aliasId)
Adds an
Id to an Entry for the purpose
of creating compatibility. |
boolean |
canCreateEntries()
Tests if this user can create
Entries. |
boolean |
canCreateEntryWithRecordTypes(Type[] entryRecordTypes)
Tests if this user can create a single
Entry using the
desired record types. |
boolean |
canDeleteEntries()
Tests if this user can delete
Entries. |
boolean |
canManageEntryAliases()
Tests if this user can manage
Id aliases for
Entries. |
boolean |
canUpdateEntries()
Tests if this user can update
Entries. |
Entry |
createEntry(EntryForm entryForm)
Creates a new
Entry. |
void |
deleteEntry(Id entryId)
Deletes an
Entry. |
Business |
getBusiness()
Gets the
Business associated with this session. |
Id |
getBusinessId()
Gets the
Business Id associated with
this session. |
EntryForm |
getEntryFormForCreate(Id customerId,
Id itemId,
Id periodId,
Type[] entryRecordTypes)
Gets the entry form for creating new entries.
|
EntryForm |
getEntryFormForUpdate(Id entryId)
Gets the entry form for updating an existing entry.
|
void |
updateEntry(EntryForm entryForm)
Updates an existing entry.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getBusinessId()
Business
Id
associated with
this session. Business Id
associated with this sessionmandatory
- This method must be implemented. Business getBusiness() throws OperationFailedException, PermissionDeniedException
Business
associated with this session.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateEntries()
Entries.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known creating an Entry
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may opt not to offer create operations to
an unauthorized user. false
if Entry
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateEntryWithRecordTypes(Type[] entryRecordTypes)
Entry
using the
desired record types. While
BillingManager.getEntryRecordTypes()
can be used to examine
which records are supported, this method tests which record(s) are
required for creating a specific Entry.
Providing an
empty array tests if an Entry
can be created with no
records.entryRecordTypes
- array of entry record types true
if Entry
creation using the
specified record Types
is supported,
false
otherwiseNullArgumentException
- entryRecordTypes
is null
mandatory
- This method must be implemented. EntryForm getEntryFormForCreate(Id customerId, Id itemId, Id periodId, Type[] entryRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
customerId
- a customer Id
itemId
- an item Id
periodId
- a period Id
entryRecordTypes
- array of entry record typesNotFoundException
- itemId
or
periodId
is not foundNullArgumentException
- itemId, periodId
, or entryRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Entry createEntry(EntryForm entryForm) throws OperationFailedException, PermissionDeniedException
Entry.
entryForm
- the form for this Entry
Entry
IllegalStateException
- entryForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- entryForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- entryForm
did not
originate from getEntryFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateEntries()
Entries.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known updating an Entry
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may opt not to offer update operations to
an unauthorized user. false
if Entry
modification is
not authorized, true
otherwisemandatory
- This method must be implemented. EntryForm getEntryFormForUpdate(Id entryId) throws NotFoundException, OperationFailedException, PermissionDeniedException
entryId
- the Id
of the Entry
NotFoundException
- entryId
is not foundNullArgumentException
- entryId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateEntry(EntryForm entryForm) throws OperationFailedException, PermissionDeniedException
entryForm
- the form containing the elements to be updatedIllegalStateException
- entryForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- entryForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- entryForm
did not
originate from getEntryFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteEntries()
Entries.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting an Entry
will
result in a PERMISSION_DENIED.
This is intended as a
hint to an application that may opt not to offer delete operations to
an unauthorized user. false
if Entry
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteEntry(Id entryId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Entry.
entryId
- the Id
of the Entry
to
removeNotFoundException
- entryId
not foundNullArgumentException
- entryId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageEntryAliases()
Id
aliases for
Entries.
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 Entry
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasEntry(Id entryId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to an Entry
for the purpose
of creating compatibility. The primary Id
of the
Entry
is deentryined by the provider. The new Id
performs as an alias to the primary Id
. If the
alias is a pointer to another entry, it is reassigned to the given
entry Id.
entryId
- the Id
of an Entry
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is in
use as a primary Id
NotFoundException
- entryId
not foundNullArgumentException
- entryId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.