Package com.atlassian.applinks.spi.link
Interface MutatingApplicationLinkService
- All Superinterfaces:
ApplicationLinkService
This interface adds methods for adding, updating and deleting
ApplicationLinks.- Since:
- 3.0
-
Method Summary
Modifier and TypeMethodDescriptionaddApplicationLink(ApplicationId id, ApplicationType type, ApplicationLinkDetails details) Register an outgoingApplicationLinkvoidchangeApplicationId(ApplicationId oldId, ApplicationId newId) Changes the value of an application link's ID.voidconfigureAuthenticationForApplicationLink(ApplicationLink applicationLink, AuthenticationScenario authenticationScenario, String username, String password) Configures authentication on an application linkcreateApplicationLink(ApplicationType type, ApplicationLinkDetails linkDetails) Creates an application link from this application to a remote application.voidcreateReciprocalLink(URI remoteRpcUrl, URI customLocalRpcUrl, String username, String password) Deprecated.will be removed in a future version, should only be used by test codeReturns the URI of the application link resource exposed to a remote application.voidDeletes an outgoingApplicationLinkvoidDelete the outgoing and incomingApplicationLinks to and from a linked application.booleanisAdminUserInRemoteApplication(URI url, String username, String password) Determines whether a set of credentials belong to an administrator of a remote application.booleanisNameInUse(String name, ApplicationId id) Checks whether an application link already exists with this namevoidMake the specifiedApplicationLinkthe primary link of itsApplicationType.voidsetSystem(ApplicationId id, boolean isSystem) Make theApplicationLinkspecified byApplicationIda system link.Methods inherited from interface com.atlassian.applinks.api.ApplicationLinkService
getApplicationLinks, getApplicationLinks, getPrimaryApplicationLink
-
Method Details
-
addApplicationLink
MutableApplicationLink addApplicationLink(ApplicationId id, ApplicationType type, ApplicationLinkDetails details) Register an outgoingApplicationLink- Parameters:
id- theApplicationIdof the application to create a link totype- theApplicationTypeof the link (use theTypeAccessorto access registeredApplicationTypes)details- anApplicationLinkDetailsobject initialised with theApplicationLink's details. Note that another name may be used if an application link with this name already exists.- Returns:
- the created
ApplicationLink
-
deleteReciprocatedApplicationLink
void deleteReciprocatedApplicationLink(ApplicationLink link) throws ReciprocalActionException, CredentialsRequiredException Delete the outgoing and incomingApplicationLinks to and from a linked application. If the (incoming) link deletion in the remote application fails, the local (outgoing) link will not be deleted. UsedeleteApplicationLink(ApplicationLink)to delete just the outgoingApplicationLinkif such behaviour is desired.- Parameters:
link- theApplicationLinkto delete- Throws:
ReciprocalActionException- if there was an issue deleting the link from the remote applicationCredentialsRequiredException- if a request to delete the remote application link could not be created as the current user has not provided credentials for the remote application. SeeApplicationLinkRequestFactory.createRequest(com.atlassian.sal.api.net.Request.MethodType, java.lang.String)for more details.
-
deleteApplicationLink
Deletes an outgoingApplicationLink- Parameters:
link- theApplicationLinkto delete
-
getApplicationLink
- Specified by:
getApplicationLinkin interfaceApplicationLinkService- Parameters:
id- theApplicationIdof a storedApplicationLink- Returns:
- a mutable
MutableApplicationLinkobject, specified by the id, ornullif it does not exist - Throws:
TypeNotInstalledException- if the specifiedApplicationLink'sApplicationTypeis not currently installed.
-
makePrimary
Make the specifiedApplicationLinkthe primary link of itsApplicationType. Note that exactly one primary link of each type is allowed, so this method will remove the primary flag from the current primary link of the link's type.- Parameters:
id- theApplicationIdof a storedApplicationLink- Throws:
TypeNotInstalledException- if the specifiedApplicationLink'sApplicationTypeis not currently installed.
-
setSystem
Make theApplicationLinkspecified byApplicationIda system link. A system link is invisible to non-sysadmin users which is controlled in the UI.- Parameters:
id- theApplicationIdof a storedApplicationLink- Throws:
TypeNotInstalledException- if the specifiedApplicationLink'sApplicationTypeis not currently installed.
-
changeApplicationId
Changes the value of an application link's ID. This operation does NOT emit an event.- Throws:
IllegalArgumentException- ifoldIddoes not exist.TypeNotInstalledException
-
createApplicationLink
ApplicationLink createApplicationLink(ApplicationType type, ApplicationLinkDetails linkDetails) throws ManifestNotFoundException Creates an application link from this application to a remote application. Similar to addApplicationLink but doesn't retrieves or automatically generates theApplicationIdfor you (depending on theApplicationType'sManifestRetrieverimplementation.- Parameters:
type- The type of the remote applicationlinkDetails- The details of the link to create- Returns:
- The newly created application link
- Throws:
ManifestNotFoundException- if the remote application did not provide a manifest for any reason (e.g. remote server was down, remote server does not support UAL, REST end-point is disabled in the remote server etc.)- Since:
- 3.4
-
createReciprocalLink
@Deprecated void createReciprocalLink(URI remoteRpcUrl, URI customLocalRpcUrl, String username, String password) throws ReciprocalActionException Deprecated.will be removed in a future version, should only be used by test codeCreates a reciprocal application link from a remote application to this application.- Parameters:
remoteRpcUrl- The base URI of the remote application, for RPC purposescustomLocalRpcUrl- The base URI of the local application, for display purposes, ornullto use the configured base URLusername- The username of an administrator of the remote systempassword- The password of the administrator on the remote system- Throws:
NotAdministratorException- if the supplied credentials are not those of an administrator on the remote systemLinkCreationResponseException- if the link creation response from the remote system was invalidAuthenticationResponseException- if the authentication response from the remote system was invalidRemoteErrorListException- if the remote system reported one or more errorsReciprocalActionException- Since:
- 3.4
-
isAdminUserInRemoteApplication
boolean isAdminUserInRemoteApplication(URI url, String username, String password) throws com.atlassian.sal.api.net.ResponseException Determines whether a set of credentials belong to an administrator of a remote application.- Parameters:
url- The base URI of the remote applicationusername- A username to checkpassword- A password to check- Returns:
trueif the supplied credentials belong to administator of the remote application.falseotherwise.- Throws:
com.atlassian.sal.api.net.ResponseException- if the response from the remote application was invalid- Since:
- 3.4
-
configureAuthenticationForApplicationLink
void configureAuthenticationForApplicationLink(ApplicationLink applicationLink, AuthenticationScenario authenticationScenario, String username, String password) throws AuthenticationConfigurationException Configures authentication on an application link- Parameters:
applicationLink- The application link to configureauthenticationScenario- holder for details that are used to determine the most appropriateAuthenticationProvider, which will be configured by this method (e.g. ifAuthenticationScenario.isCommonUserBase()andAuthenticationScenario.isTrusted()are both true, 2LOi will be configured).username- The username of an administrator on the remote applicationpassword- The password of the administrator on the remote application- Throws:
AuthenticationConfigurationException- if authentication could not be configured- Since:
- 3.4
-
createSelfLinkFor
Returns the URI of the application link resource exposed to a remote application.- Parameters:
id- The ID of the remote application- Returns:
- the URI
-
isNameInUse
Checks whether an application link already exists with this name- Parameters:
name- Name of the application linkid- Applink to be excluded from the result. If null, it means no link will be excluded.- Returns:
- true if an Applink already exist with this name and another 'id'.
-