Interface BranchAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
BranchBatchAdminSession
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.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasBranch(Id branchId, Id aliasId) Adds anIdto aBranchfor the purpose of creating compatibility.booleancanCreateBranch(Id journalEntryId) Tests if this user can branch a specifiedJournalEntry.booleanTests if this user can create branches.booleancanCreateBranchWithRecordTypes(Type[] branchRecordTypes) Tests if this user can create a singleBranchusing the desired record types.booleanTests if this user can delete branches.booleanTests if this user can manageIdaliases for branches.booleanTests if this user can merge branches.booleanTests if this user can supersede branches.booleanTests if this user can update branches.createBranch(BranchForm branchForm) Creates a branch.voiddeleteBranch(Id branchId) Deletes a branch and all associated versions.getBranchFormForCreate(Id journalEntryId, Type[] branchRecordTypes) Gets the branch form for creating new entries.getBranchFormForUpdate(Id branchId) Gets the branch form for updating an existing branch.Gets theJournalassociated with this session.Gets theJournalIdassociated with this session.mergeBranches(Id srcBranchId, Id dstBranchId) Merges the source branch into the destination branch.supersedeBranch(Id srcBranchId, Id dstBranchId) Joins the source branch to the destination branch by creating a new journal entry.voidupdateBranch(BranchForm branchForm) Updates an existing branch.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
-
getJournalId
Id getJournalId()Gets theJournalIdassociated with this session.- Returns:
- the
Journal Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getJournal
Gets theJournalassociated with this session.- Returns:
- the journal
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateBranches
boolean canCreateBranches()Tests if this user can create branches. A return of true does not guarantee successful authorization. A return of false indicates that it is known branching will 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:
falseif creating branches is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateBranch
Tests if this user can branch a specifiedJournalEntry. A return of true does not guarantee successful authorization. A return of false indicates that it is known branching theJournalEntrywill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.- Parameters:
journalEntryId- theIdof theJournalEntry- Returns:
falseif branching is not authorized,trueotherwise- Throws:
NullArgumentException-journalEntryIdisnull- Compliance:
mandatory- This method must be implemented.- Notes:
If- the {@code journalEntryId} is not found, then it is acceptable to return false to indicate the lack of branching available.
-
canCreateBranchWithRecordTypes
Tests if this user can create a singleBranchusing the desired record types. WhileJournalingManager.getBranchRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificBranch. Providing an empty array tests if aBranchcan be created with no records.- Parameters:
branchRecordTypes- array of branch record types- Returns:
trueifBranchcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-branchyRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getBranchFormForCreate
BranchForm getBranchFormForCreate(Id journalEntryId, Type[] branchRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the branch form for creating new entries. A new form should be requested for each create transaction.- Parameters:
journalEntryId- theIdof theJournalEntrybranchRecordTypes- array of branch record types- Returns:
- the branch form
- Throws:
NotFoundException-journalEntryIdis not foundNullArgumentException-journalEntryIdorbranchRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createBranch
Branch createBranch(BranchForm branchForm) throws OperationFailedException, PermissionDeniedException Creates a branch.- Parameters:
branchForm- the branch form- Returns:
- a the new branch
- Throws:
IllegalStateException-branchFormalready used in a create transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-branchFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-branchFormdid not originate fromgetBranchFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateBranches
boolean canUpdateBranches()Tests if this user can update branches. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aBranchwill 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:
falseifBranchmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getBranchFormForUpdate
BranchForm getBranchFormForUpdate(Id branchId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the branch form for updating an existing branch. A new journal entry form should be requested for each update transaction.- Parameters:
branchId- theIdof theBranch- Returns:
- the branch form
- Throws:
NotFoundException-branchIdis not foundNullArgumentException-branchIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateBranch
Updates an existing branch.- Parameters:
branchForm- the form containing the elements to be updated- Throws:
IllegalStateException-branchFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-branchFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-branchFormdid not originate fromgetBranchFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canMergeBranches
boolean canMergeBranches()Tests if this user can merge branches. A return of true does not guarantee successful authorization. A return of false indicates that it is known mergingBrancheswill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer merging operations to unauthorized users.- Returns:
falseifBranchmerging is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
mergeBranches
JournalEntry mergeBranches(Id srcBranchId, Id dstBranchId) throws NotFoundException, OperationFailedException, PermissionDeniedException Merges the source branch into the destination branch. A new journal entry is created to join the two branches.- Parameters:
srcBranchId- theIdof theBranchto merge fromdstBranchId- theIdof theBranchto merge into- Returns:
- a the new journal entry
- Throws:
NotFoundException-branchIdnot foundNullArgumentException-branchIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canSupersedeBranches
boolean canSupersedeBranches()Tests if this user can supersede branches. A return of true does not guarantee successful authorization. A return of false indicates that it is known mergingBrancheswill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer superseding operations to unauthorized users.- Returns:
falseifBranchsuperseding is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
supersedeBranch
JournalEntry supersedeBranch(Id srcBranchId, Id dstBranchId) throws NotFoundException, OperationFailedException, PermissionDeniedException Joins the source branch to the destination branch by creating a new journal entry. The most recent version of the source branch supsrsedes the most recent versiuon of the desitination branch.- Parameters:
srcBranchId- theIdof the supersedingBranchdstBranchId- theIdof theBranchto override- Returns:
- a the new journal entry
- Throws:
NotFoundException-branchIdnot foundNullArgumentException-branchIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canDeleteBranches
boolean canDeleteBranches()Tests if this user can delete branches. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aBranchwill 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:
falseifBranchdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteBranch
void deleteBranch(Id branchId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes a branch and all associated versions.- Parameters:
branchId- theIdof theBranchto remove- Throws:
NotFoundException-branchIdnot foundNullArgumentException-branchIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageBranchAliases
boolean canManageBranchAliases()Tests if this user can manageIdaliases 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 aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.- Returns:
falseifBranchaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasBranch
void aliasBranch(Id branchId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aBranchfor the purpose of creating compatibility. The primaryIdof theBranchis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another branch it is reassigned to the given branchId.- Parameters:
branchId- theIdof aBranchaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-branchIdnot foundNullArgumentException-branchIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-