public interface BranchAdminSession extends OsidSession
This session creates, updates, and deletes Branches.
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
Branch,
a BranchForm
is requested using
getBranchFormForCreate()
specifying the desired record
Types
or none if no record Types
are needed. The
returned BranchForm
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 BranchForm
is submiited to
a create operation, it cannot be reused with another create operation
unless the first operation was unsuccessful. Each BranchForm
corresponds to an attempted transaction.
For updates, BranchForms
are requested to the
Branch
Id
that is to be updated using
getBranchFormForUpdate().
Similarly, the BranchForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The BranchForm
can
only be used once for a successful update and cannot be reused.
The delete operations delete Branches.
This session includes an Id
aliasing mechanism to
assign an external Id
to an internally assigned Id.
Modifier and Type | Method and Description |
---|---|
void |
aliasBranch(Id branchId,
Id aliasId)
Adds an
Id to a Branch for the purpose
of creating compatibility. |
boolean |
canCreateBranch(Id journalEntryId)
Tests if this user can branch a specified
JournalEntry. |
boolean |
canCreateBranches()
Tests if this user can branch a version chain.
|
boolean |
canCreateBranchWithRecordTypes(Type[] branchRecordTypes)
Tests if this user can create a single
Branch using the
desired record types. |
boolean |
canDeleteBranches()
Tests if this user can delete branches.
|
boolean |
canManageBranchAliases()
Tests if this user can manage
Id aliases for branches. |
boolean |
canMergeBranches()
Tests if this user can merge branches.
|
boolean |
canSupersedeBranches()
Tests if this user can supersede branches.
|
boolean |
canUpdateBranches()
Tests if this user can update branches.
|
Branch |
createBranch(BranchForm branchForm)
Creates a branch.
|
void |
deleteBranch(Id branchId)
Deletes a branch and all associated versions.
|
BranchForm |
getBranchFormForCreate(Id journalEntryId,
Type[] branchRecordTypes)
Gets the branch form for creating new entries.
|
BranchForm |
getBranchFormForUpdate(Id branchId)
Gets the branch form for updating an existing branch.
|
Journal |
getJournal()
Gets the
Journal associated with this session. |
Id |
getJournalId()
Gets the
Journal Id associated with this
session. |
JournalEntry |
mergeBranches(Id srcBranchId,
Id dstBranchId)
Merges the source branch into the destination branch.
|
JournalEntry |
supersedeBranch(Id srcBranchId,
Id dstBranchId)
Joins the source branch to the destination branch by creating a new
journal entry.
|
void |
updateBranch(BranchForm branchForm)
Updates an existing branch.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getJournalId()
Journal
Id
associated with this
session. Journal Id
associated with this sessionmandatory
- This method must be implemented. Journal getJournal() throws OperationFailedException, PermissionDeniedException
Journal
associated with this session.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateBranches()
PERMISSION_DENIED.
This is intended as a hint to an application that may not wish
to offer create operations to unauthorized users. false
if journal branching is not authorized,
true
otherwisemandatory
- This method must be implemented. boolean canCreateBranch(Id journalEntryId)
JournalEntry.
A return of true does not guarantee successful authorization. A return
of false indicates that it is known branching the JournalEntry
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.journalEntryId
- the Id
of the
JournalEntry
false
if branching is not authorized,
true
otherwiseNullArgumentException
- journalEntryId
is null
mandatory
- This method must be implemented. If
- the journalEntryId
is not found, then it is
acceptable to return false to indicate the lack of branching
available. boolean canCreateBranchWithRecordTypes(Type[] branchRecordTypes)
Branch
using the
desired record types. While
JournalingManager.getBranchRecordTypes()
can be used to
examine which records are supported, this method tests which record(s)
are required for creating a specific Branch.
Providing
an empty array tests if a Branch
can be created with no
records.branchRecordTypes
- array of branch record types true
if Branch
creation using
the specified record Types
is supported,
false
otherwiseNullArgumentException
- branchyRecordTypes
is null
mandatory
- This method must be implemented. BranchForm getBranchFormForCreate(Id journalEntryId, Type[] branchRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
journalEntryId
- the Id
of the
JournalEntry
branchRecordTypes
- array of branch record typesNotFoundException
- journalEntryId
is
not foundNullArgumentException
- journalEntryId
or branchRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Branch createBranch(BranchForm branchForm) throws OperationFailedException, PermissionDeniedException
branchForm
- the branch formIllegalStateException
- branchForm
already used in a create transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- branchForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- branchForm
did
not originate from getBranchFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateBranches()
Branch
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 Branch
modification is
not authorized, true
otherwisemandatory
- This method must be implemented. BranchForm getBranchFormForUpdate(Id branchId) throws NotFoundException, OperationFailedException, PermissionDeniedException
branchId
- the Id
of the Branch
NotFoundException
- branchId
is not
foundNullArgumentException
- branchId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateBranch(BranchForm branchForm) throws OperationFailedException, PermissionDeniedException
branchForm
- the form containing the elements to be updatedIllegalStateException
- branchForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- branchForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- branchForm
did
not originate from getBranchFormForUpdate()
mandatory
- This method must be implemented. boolean canMergeBranches()
Branches
will result in a
PERMISSION_DENIED.
This is intended as a hint to an
application that may not wish to offer merging operations to
unauthorized users. false
if Branch
merging is not
authorized, true
otherwisemandatory
- This method must be implemented. JournalEntry mergeBranches(Id srcBranchId, Id dstBranchId) throws NotFoundException, OperationFailedException, PermissionDeniedException
srcBranchId
- the Id
of the Branch
to merge fromdstBranchId
- the Id
of the Branch
to merge intoNotFoundException
- branchId
not foundNullArgumentException
- branchId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canSupersedeBranches()
Branches
will result in a
PERMISSION_DENIED.
This is intended as a hint to an
application that may not wish to offer superseding operations to
unauthorized users. false
if Branch
superseding is
not authorized, true
otherwisemandatory
- This method must be implemented. JournalEntry supersedeBranch(Id srcBranchId, Id dstBranchId) throws NotFoundException, OperationFailedException, PermissionDeniedException
srcBranchId
- the Id
of the superseding
Branch
dstBranchId
- the Id
of the Branch
to overrideNotFoundException
- branchId
not foundNullArgumentException
- branchId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canDeleteBranches()
Branch
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 Branch
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteBranch(Id branchId) throws NotFoundException, OperationFailedException, PermissionDeniedException
branchId
- the Id
of the Branch
to
removeNotFoundException
- branchId
not foundNullArgumentException
- branchId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageBranchAliases()
Id
aliases for branches.
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 Branch
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasBranch(Id branchId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Branch
for the purpose
of creating compatibility. The primary Id
of the
Branch
is determined by the provider. The new Id
performs as an alias to the primary Id.
If the
alias is a pointer to another branch it is reassigned to the given
branch Id.
branchId
- the Id
of a Branch
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- branchId
not foundNullArgumentException
- branchId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.