com.atlassian.jira.applinks
Class JiraAppLinksHostApplication

java.lang.Object
  extended by com.atlassian.applinks.host.spi.AbstractInternalHostApplication
      extended by com.atlassian.jira.applinks.JiraAppLinksHostApplication
All Implemented Interfaces:
com.atlassian.applinks.host.spi.HostApplication, com.atlassian.applinks.host.spi.InternalHostApplication, Startable

public class JiraAppLinksHostApplication
extends com.atlassian.applinks.host.spi.AbstractInternalHostApplication
implements Startable

Since:
v4.3

Field Summary
static long TIMEOUT
           
 
Fields inherited from class com.atlassian.applinks.host.spi.AbstractInternalHostApplication
pluginAccessor
 
Constructor Summary
JiraAppLinksHostApplication(com.atlassian.plugin.PluginAccessor pluginAccessor, ApplicationProperties applicationProperties, JiraLicenseService jiraLicenseService, VelocityRequestContextFactory velocityRequestContextFactory, ProjectManager projectManager, JiraAuthenticationContext jiraAuthenticationContext, com.atlassian.applinks.host.OsgiServiceProxyFactory osgiServiceProxyFactory, PermissionManager permissionManager)
          Creates a new JiraAppLinksHostApplication instance.
 
Method Summary
 boolean canManageEntityLinksFor(com.atlassian.applinks.host.spi.EntityReference entityReference)
           
 void clearSkipPermissionCheck()
           
 boolean doesEntityExist(String key, Class<? extends com.atlassian.applinks.api.EntityType> type)
           
 boolean doesEntityExistNoPermissionCheck(String key, Class<? extends com.atlassian.applinks.api.EntityType> type)
           
 URI getBaseUrl()
          Returns the base URL that is configured for this JIRA instance.
 URI getDocumentationBaseUrl()
           
 com.atlassian.applinks.api.ApplicationId getId()
           
 Iterable<com.atlassian.applinks.host.spi.EntityReference> getLocalEntities()
           
 String getName()
           
 com.atlassian.applinks.api.ApplicationType getType()
           
 boolean hasPublicSignup()
           
 void setSkipPermissionCheck(boolean skip)
           
 void start()
          The OsgiServiceProxyFactory creates a proxy to the TypeAccessor which is a component of the applinks-plugin.
 com.atlassian.applinks.host.spi.EntityReference toEntityReference(Object domainObject)
           
 com.atlassian.applinks.host.spi.EntityReference toEntityReference(String key, Class<? extends com.atlassian.applinks.api.EntityType> type)
           
 
Methods inherited from class com.atlassian.applinks.host.spi.AbstractInternalHostApplication
getSupportedInboundAuthenticationTypes, getSupportedOutboundAuthenticationTypes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TIMEOUT

public static final long TIMEOUT
See Also:
Constant Field Values
Constructor Detail

JiraAppLinksHostApplication

public JiraAppLinksHostApplication(com.atlassian.plugin.PluginAccessor pluginAccessor,
                                   ApplicationProperties applicationProperties,
                                   JiraLicenseService jiraLicenseService,
                                   VelocityRequestContextFactory velocityRequestContextFactory,
                                   ProjectManager projectManager,
                                   JiraAuthenticationContext jiraAuthenticationContext,
                                   com.atlassian.applinks.host.OsgiServiceProxyFactory osgiServiceProxyFactory,
                                   PermissionManager permissionManager)
Creates a new JiraAppLinksHostApplication instance.

Method Detail

getDocumentationBaseUrl

public URI getDocumentationBaseUrl()
Specified by:
getDocumentationBaseUrl in interface com.atlassian.applinks.host.spi.InternalHostApplication
Returns:
an absolute URI used as the base for constructing links to help pages. e.g. http://docs.atlassian.com/fisheye/docs-023 or http://confluence.atlassian.com/display/APPLINKS. The returned URI should not have a trailing slash.

getName

public String getName()
Specified by:
getName in interface com.atlassian.applinks.host.spi.InternalHostApplication
Returns:
the name of this application instance, e.g. "My JIRA Server". If this application type doesn't support customising the name of the instance, implementations should delegate to com.atlassian.applinks.host.util.InstanceNameGenerator to generate a name from the application's base URL.

getType

public com.atlassian.applinks.api.ApplicationType getType()
Specified by:
getType in interface com.atlassian.applinks.host.spi.InternalHostApplication
Returns:
the ApplicationType for this application instance. Implementations should delegate to the TypeAccessor to resolve an instance of the desired type.

getLocalEntities

public Iterable<com.atlassian.applinks.host.spi.EntityReference> getLocalEntities()
Specified by:
getLocalEntities in interface com.atlassian.applinks.host.spi.InternalHostApplication
Returns:
an Iterable containing an EntityReference for every entity in the local instance visible to the currently logged in user. Note, the implementation must perform a permission check and return only entities visible the context user (who may be anonymous). User requires to have either the BROWSE project, JIRA Administrator or PROJECT ADMIN permission.

doesEntityExist

public boolean doesEntityExist(String key,
                               Class<? extends com.atlassian.applinks.api.EntityType> type)
Specified by:
doesEntityExist in interface com.atlassian.applinks.host.spi.InternalHostApplication
Parameters:
key - the key of an entity local to this application (e.g. JRA, CONF)
type - the class of the EntityType of the entity (e.g. JiraProjectEntityType)
Returns:
true, if the specified entity exists, false otherwise. Note, the implementation must perform a permission check and return true if, and only if, the specified entity exists and is visible to the context user (who may be anonymous). User requires to have either the BROWSE project, JIRA Administrator or PROJECT ADMIN permission.

doesEntityExistNoPermissionCheck

public boolean doesEntityExistNoPermissionCheck(String key,
                                                Class<? extends com.atlassian.applinks.api.EntityType> type)
Specified by:
doesEntityExistNoPermissionCheck in interface com.atlassian.applinks.host.spi.InternalHostApplication
Parameters:
key - the key of an entity local to this application (e.g. JRA, CONF)
type - the class of the EntityType of the entity (e.g. JiraProjectEntityType)
Returns:
true, if the specified entity exists, false otherwise. For a variant on this method with permission checking, use doesEntityExist(String, Class).
Since:
3.6

toEntityReference

public com.atlassian.applinks.host.spi.EntityReference toEntityReference(Object domainObject)
Specified by:
toEntityReference in interface com.atlassian.applinks.host.spi.InternalHostApplication
Parameters:
domainObject - an entity domain object from the application's API (e.g. com.atlassian.jira.project.Project, com.atlassian.confluence.spaces.Space). Implementations are free to choose which objects supported by this class, but the complete list should be maintained on the EntityLinkService javadoc.
Returns:
an EntityReference initialised with the key and type of the supplied domain object. This method need not perform any permission checking. Implementations should delegate to the TypeAccessor to resolve an instance of the desired EntityType.

toEntityReference

public com.atlassian.applinks.host.spi.EntityReference toEntityReference(String key,
                                                                         Class<? extends com.atlassian.applinks.api.EntityType> type)
Specified by:
toEntityReference in interface com.atlassian.applinks.host.spi.InternalHostApplication
Parameters:
key - the key of a local entity (e.g. "JRA", "FECRUDEV", "CR-BAM")
type - the class of the EntityType of the entity (e.g. JiraProjectEntityType)
Returns:
an EntityReference initialised with the key and type of the supplied domain object. This method need not perform any permission checking. Implementations should delegate to the TypeAccessor to resolve an instance of the specified EntityType.
Throws:
IllegalArgumentException - if the specified type is not assignable to JiraProjectEntityType or if no project with the specified key can be found

canManageEntityLinksFor

public boolean canManageEntityLinksFor(com.atlassian.applinks.host.spi.EntityReference entityReference)
Specified by:
canManageEntityLinksFor in interface com.atlassian.applinks.host.spi.InternalHostApplication
Parameters:
entityReference - an EntityReference representing an entity contained in the local application instance.
Returns:
true if the current user has permission to link or unlink the specified EntityReference to other entities, false otherwise. User requires to have either the JIRA Administrator or PROJECT ADMIN permission.

setSkipPermissionCheck

public void setSkipPermissionCheck(boolean skip)

clearSkipPermissionCheck

public void clearSkipPermissionCheck()

hasPublicSignup

public boolean hasPublicSignup()
Specified by:
hasPublicSignup in interface com.atlassian.applinks.host.spi.InternalHostApplication
Returns:
true if the host application allows public signup, false otherwise.

getId

public com.atlassian.applinks.api.ApplicationId getId()
Specified by:
getId in interface com.atlassian.applinks.host.spi.HostApplication

getBaseUrl

public URI getBaseUrl()
Returns the base URL that is configured for this JIRA instance.

Specified by:
getBaseUrl in interface com.atlassian.applinks.host.spi.HostApplication
Returns:
a String containing the base URL that is configured for this JIRA instance

start

public void start()
           throws Exception
The OsgiServiceProxyFactory creates a proxy to the TypeAccessor which is a component of the applinks-plugin. The TypeAccessor is not available when the host application starts, but when the plugins framework has finished starting.

Specified by:
start in interface Startable
Throws:
Exception - Allows implementations to throw an Exception.


Copyright © 2002-2014 Atlassian. All Rights Reserved.