Interface PackageAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
PackageBatchAdminSession
This session creates, updates, and deletes Packages . 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
Package , a PackagetForm is requested using
getPackageFormForCreate() specifying the desired record Types or
none if no record Types are needed. The returned
PackageForm 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 PackageForm is submiited to a create operation, it cannot
be reused with another create operation unless the first operation was
unsuccessful. Each PackageForm corresponds to an attempted
transaction.
For updates, PackageForms are requested to the Package
Id that is to be updated using getPackageFormForUpdate() .
Similarly, the PackageForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
PackageForm can only be used once for a successful update and
cannot be reused.
The delete operations delete Packages . To unmap a
Package from the current Depot , the
PackageDepotAssignmentSession should be used. These delete operations
attempt to remove the Package itself thus removing it from all
known Depot catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddPackageVersion(Id packageId, Id nextPackageId) Sets the given package to be the next version of another package.voidaliasPackage(Id packageId, Id aliasId) Adds anIdto aPackagefor the purpose of creating compatibility.booleanTests if this user can create content forPackages.booleancanCreateInstallationContentWithRecordTypes(Type[] installationContentRecordTypes) Tests if this user can create anInstallationContentusing the desired record types.booleanTests if this user can createPackages.booleancanCreatePackageWithRecordTypes(Type[] packageRecordTypes) Tests if this user can create a singlePackageusing the desired record types.booleanTests if this user can deleteInstallationContents.booleancanDeletePackage(Id packageId) Tests if this user can delete a specifiedPackage.booleanTests if this user can deletePackages.booleanTests if this user can manageIdaliases forPackages.booleanTests if this user can manage package versions.booleanTests if this user can updateInstallationContent.booleancanUpdatePackage(Id packageId) Tests if this user can update a specified package.booleanTests if this user can updatePackages.createInstallationContent(InstallationContentForm installationContentForm) Creates newInstallationContentfor a given package.createPackage(PackageForm packageForm) Creates a newPackage.voiddeleteInstallationContent(Id installationContentId) Deletes content from a package.voiddeletePackage(Id packageId) Deletes thePackageidentified by the givenId.getDepot()Gets theDepotassociated with this session.Gets theDepotIdassociated with this session.getInstallationContentFormForCreate(Id packageId, Type[] installationContentRecordTypes) Gets an installation content form for creating new installation contents.getInstallationContentFormForUpdate(Id installationContentId) Gets the installation content form for updating an existing installation content.getPackageFormForCreate(Type[] packageRecordTypes) Gets the package form for creating new packages.getPackageFormForUpdate(Id packageId) Gets the package form for updating an existing package.voidremovePackageVersion(Id packageId, Id nextPackageId) Removes a package from being the next version of another package.voidupdateInstallationContent(InstallationContentForm installationContentForm) Updates an existing installation content.voidupdatePackage(PackageForm packageForm) Updates an existing package.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
-
getDepotId
Id getDepotId()Gets theDepotIdassociated with this session.- Returns:
- the
Depot Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getDepot
Gets theDepotassociated with this session.- Returns:
- the
Depotassociated with this session - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreatePackages
boolean canCreatePackages()Tests if this user can createPackages. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aPackagewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifPackagecreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreatePackageWithRecordTypes
Tests if this user can create a singlePackageusing the desired record types. WhileInstallationManager.getPackageRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificPackage. Providing an empty array tests if aPackagecan be created with no records.- Parameters:
packageRecordTypes- array of package record types- Returns:
trueifPackagecreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-packageRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getPackageFormForCreate
PackageForm getPackageFormForCreate(Type[] packageRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the package form for creating new packages. A new form should be requested for each create transaction.- Parameters:
packageRecordTypes- array of package record types- Returns:
- the package form
- Throws:
NullArgumentException-packageRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createPackage
Package createPackage(PackageForm packageForm) throws OperationFailedException, PermissionDeniedException Creates a newPackage.- Parameters:
packageForm- the form for thisPackage- Returns:
- the new
Package - Throws:
IllegalStateException-packageFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-packageFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-packageFormdid not originate fromgetPackageFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdatePackages
boolean canUpdatePackages()Tests if this user can updatePackages. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aPackagewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseif package modification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canUpdatePackage
Tests if this user can update a specified package. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating the package will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer an update operation to an unauthorized user for this function.- Parameters:
packageId- theIdof thePackage- Returns:
falseif package modification is not authorized,trueotherwise- Throws:
NullArgumentException-packageIdisnull- Compliance:
mandatory- This method must be implemented.- Notes:
If- the {@code packageId} is not found, then it is acceptable to return false to indicate the lack of an update available.
-
getPackageFormForUpdate
PackageForm getPackageFormForUpdate(Id packageId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the package form for updating an existing package. A new package form should be requested for each update transaction.- Parameters:
packageId- theIdof thePackage- Returns:
- the package form
- Throws:
NotFoundException-packageIdis not foundNullArgumentException-packageIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updatePackage
void updatePackage(PackageForm packageForm) throws OperationFailedException, PermissionDeniedException Updates an existing package.- Parameters:
packageForm- the form containing the elements to be updated- Throws:
InvalidArgumentException- the form contains an invalid valueNullArgumentException-packageFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-packageFormdid not originate fromgetPackageFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeletePackages
boolean canDeletePackages()Tests if this user can deletePackages. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aPackagewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifPackagedeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canDeletePackage
Tests if this user can delete a specifiedPackage. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting thePackagewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer a delete operation to an unauthorized user for this function.- Parameters:
packageId- theIdof thePackage- Returns:
falseifPackagedeletion is not authorized,trueotherwise- Throws:
NullArgumentException-packageIdisnull- Compliance:
mandatory- This method must be implemented.- Notes:
If- the {@code packageId} is not found, then it is acceptable to return false to indicate the lack of a delete available.
-
deletePackage
void deletePackage(Id packageId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes thePackageidentified by the givenId.- Parameters:
packageId- theIdof thePackageto delete- Throws:
NotFoundException- aPackagewas not found identified by the givenIdNullArgumentException-packageIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManagePackageAliases
boolean canManagePackageAliases()Tests if this user can manageIdaliases forPackages. 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:
falseifPackagealiasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasPackage
void aliasPackage(Id packageId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aPackagefor the purpose of creating compatibility. The primaryIdof thePackageis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another package it is reassigned to the given packageId.- Parameters:
packageId- theIdof aPackagealiasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-packageIdnot foundNullArgumentException-packageIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateInstallationContent
boolean canCreateInstallationContent()Tests if this user can create content forPackages. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating anInstallationContentwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifinstallationcontent creation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateInstallationContentWithRecordTypes
Tests if this user can create anInstallationContentusing the desired record types. WhileInstallationManager.getInstallationContentRecordTypes()can be used to test which records are supported, this method tests which records are required for creating a specificInstallationContent. Providing an empty array tests if anInstallationContentcan be created with no records.- Parameters:
installationContentRecordTypes- array of installation content record types- Returns:
trueifInstallationContentcreation using the specifiedTypesis supported,falseotherwise- Throws:
NullArgumentException-installationContentRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getInstallationContentFormForCreate
InstallationContentForm getInstallationContentFormForCreate(Id packageId, Type[] installationContentRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets an installation content form for creating new installation contents.- Parameters:
packageId- theIdof aPackageinstallationContentRecordTypes- array of installation content record types- Returns:
- the installation content form
- Throws:
NotFoundException-packageIdis not foundNullArgumentException-packageIdorinstallationContentRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createInstallationContent
InstallationContent createInstallationContent(InstallationContentForm installationContentForm) throws OperationFailedException, PermissionDeniedException Creates newInstallationContentfor a given package.- Parameters:
installationContentForm- the form for thisInstallationContent- Returns:
- the new
InstallationContent - Throws:
IllegalStateException-installationContentFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-installationContentFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-installationContentFormdid not originate fromgetInstallationContentFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateInstallationContents
boolean canUpdateInstallationContents()Tests if this user can updateInstallationContent. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating anInstallationContentwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseifInstallationContentmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getInstallationContentFormForUpdate
InstallationContentForm getInstallationContentFormForUpdate(Id installationContentId) throws NotFoundException, OperationFailedException Gets the installation content form for updating an existing installation content. A new installation content form should be requested for each update transaction.- Parameters:
installationContentId- theIdof theInstallationContent- Returns:
- the v content form
- Throws:
NotFoundException-installationContentIdis not foundNullArgumentException-installationContentIdisnullOperationFailedException- unable to complete request- Compliance:
mandatory- This method must be implemented.
-
updateInstallationContent
void updateInstallationContent(InstallationContentForm installationContentForm) throws OperationFailedException, PermissionDeniedException Updates an existing installation content.- Parameters:
installationContentForm- the form containing the elements to be updated- Throws:
IllegalStateException-installationContentFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-installationFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-installationContentFormdid not originate fromgetInstallationContentFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteInstallationContents
boolean canDeleteInstallationContents()Tests if this user can deleteInstallationContents. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anInstallationContentwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifInstallationContentdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteInstallationContent
void deleteInstallationContent(Id installationContentId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes content from a package.- Parameters:
installationContentId- theIdof theInstallationContent- Throws:
NotFoundException-installationContentIdis not foundNullArgumentException-installationContentIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManagePackageVersions
boolean canManagePackageVersions()Tests if this user can manage package versions. A return of true does not guarantee successful authorization. A return of false indicates that it is known version methods will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseif package versioning is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
addPackageVersion
void addPackageVersion(Id packageId, Id nextPackageId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Sets the given package to be the next version of another package.- Parameters:
packageId- theIdof aPackagenextPackageId- theIdof the net package version- Throws:
AlreadyExistsException-nextPackageIdorpackageIdalready part of a version chainNotFoundException-packageIdornextPackageIdnot foundNullArgumentException-packageIdornextPackageIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
removePackageVersion
void removePackageVersion(Id packageId, Id nextPackageId) throws NotFoundException, OperationFailedException, PermissionDeniedException Removes a package from being the next version of another package.- Parameters:
packageId- theIdof aPackagenextPackageId- theIdof the net package version- Throws:
NotFoundException-nextPackageIddoes not followpackageIdNullArgumentException-packageIdordependencyIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-