public class

DefaultApplicationLink

extends Object
implements InternalApplicationLink
java.lang.Object
   ↳ com.atlassian.applinks.core.link.DefaultApplicationLink

Summary

Public Constructors
DefaultApplicationLink(ApplicationId serverId, ApplicationType type, ApplicationLinkProperties applicationLinkProperties, ApplicationLinkRequestFactoryFactory requestFactoryFactory, EventPublisher eventPublisher)
Public Methods
ApplicationLinkRequestFactory createAuthenticatedRequestFactory()
The ApplicationLinkRequestFactory returned by this method will choose a single AuthenticationProvider for automatically authenticating created Request objects.
ApplicationLinkRequestFactory createAuthenticatedRequestFactory(Class<? extends AuthenticationProvider> providerClass)
This method returns a ApplicationLinkRequestFactory initialised by the specified AuthenticationProvider.
boolean equals(Object o)
URI getDisplayUrl()
ApplicationId getId()
This ApplicationId is subject to change if an administrator:
  • upgrades the remote application to use Unified Application Links (and this link was created prior to the upgrade); or
  • the remote application does not have Unified Application Links deployed, and its RPC URL changes.
String getName()
Object getProperty(String key)
Gets a setting value.
URI getRpcUrl()
ApplicationType getType()
See the com.atlassian.applinks.api.application package for a list of ApplicationTypes bundled with the Unified Application Links plugin.
int hashCode()
boolean isPrimary()
Object putProperty(String key, Object value)
Puts a setting value.
Object removeProperty(String key)
Removes a setting value
void setPrimaryFlag(boolean isPrimary)
Sets the primary flag of the ApplicationLink to true.
String toString()
void update(ApplicationLinkDetails details)
Update the ApplicationLink's details
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.applinks.api.ApplicationLink
From interface com.atlassian.applinks.api.PropertySet
From interface com.atlassian.applinks.core.link.InternalApplicationLink
From interface com.atlassian.applinks.spi.link.MutableApplicationLink

Public Constructors

public DefaultApplicationLink (ApplicationId serverId, ApplicationType type, ApplicationLinkProperties applicationLinkProperties, ApplicationLinkRequestFactoryFactory requestFactoryFactory, EventPublisher eventPublisher)

Public Methods

public ApplicationLinkRequestFactory createAuthenticatedRequestFactory ()

The ApplicationLinkRequestFactory returned by this method will choose a single AuthenticationProvider for automatically authenticating created Request objects. The selection algorithm is as follows:

  • If one or more ImpersonatingAuthenticationProviders are configured (for example, OAuth or Trusted Applications), one will be used. Trusted Applications will be returned in preference to OAuth if both are configured;
  • else if one or more NonImpersonatingAuthenticationProviders are configured (for example, Basic Auth), one will be used
  • else the request will be unauthenticated, and processed in the remote application anonymously.
Additional AuthenticationProviders can be implemented via the extension APIs in the applinks-spi module. If your feature only supports a single authentication method, you should use createAuthenticatedRequestFactory(Class)}.
Returns

public ApplicationLinkRequestFactory createAuthenticatedRequestFactory (Class<? extends AuthenticationProvider> providerClass)

This method returns a ApplicationLinkRequestFactory initialised by the specified AuthenticationProvider. You should use this method only if your feature requires a specific AuthenticationProvider implementation. Note that this method will return null if an administrator of the local application has not configured the specified AuthenticationProvider for this ApplicationLink.

Parameters
providerClass the AuthenticationProvider type to use for the RequestFactory
Returns

public boolean equals (Object o)

public URI getDisplayUrl ()

public ApplicationId getId ()

This ApplicationId is subject to change if an administrator:

  • upgrades the remote application to use Unified Application Links (and this link was created prior to the upgrade); or
  • the remote application does not have Unified Application Links deployed, and its RPC URL changes.
If you are storing the ApplicationId for any reason, your plugin should listen for the ApplicationLinksIDChangedEvent.
Returns
  • the globally unique ID of the server at the other end of this link.

public String getName ()

public Object getProperty (String key)

Gets a setting value.

Parameters
key The setting key. Cannot be null
Returns
  • The setting value. May be null

public URI getRpcUrl ()

public ApplicationType getType ()

See the com.atlassian.applinks.api.application package for a list of ApplicationTypes bundled with the Unified Application Links plugin. Additional types can be added via the extension APIs in the applinks-spi module.

Returns

public int hashCode ()

public boolean isPrimary ()

public Object putProperty (String key, Object value)

Puts a setting value. Note that the namespace for this key is shared between all applinks consumers. If you don't want a different plugin to override a property you have set, ensure that you use a unique key. A good way to do this is to prefix the key with your plugin key, which is guaranteed to be globally unique.

Parameters
key Setting key. Cannot be null
value Setting value. Must be one of String, List, Properties or null. a null value is equivalent to removeProperty(String)
Returns
  • The setting value that was over ridden. Null if none existed.

public Object removeProperty (String key)

Removes a setting value

Parameters
key The setting key
Returns
  • The setting value that was removed. Null if nothing was removed.

public void setPrimaryFlag (boolean isPrimary)

Sets the primary flag of the ApplicationLink to true. NOTE: it does not mutate other stored ApplicationLinks. Setting multiple ApplicationLinks as 'primary' will leave the application in an inconsistent state.

Parameters
isPrimary the new value of the primary flag.

public String toString ()

public void update (ApplicationLinkDetails details)

Update the ApplicationLink's details

Parameters
details the details of the ApplicationLink. Note that all field values will be set to the values of the provided ApplicationLinkDetails object, including null values. Note that this method has no protection against setting two application links to the same name, which must be avoided.