com.atlassian.applinks.api
Interface EntityLinkService


public interface EntityLinkService

Provides methods for retrieving entities from linked applications that are associated with local entities (e.g. JIRA projects, Confluence spaces, etc.).


The Object typed first parameters of this interface's methods are Strings and/or domain objects that represent project entities from the API of each Atlassian host application. This is specific to each application that the Unified Application Links plugin is deployed to.


For example, in FishEye/Crucible:

   RepositoryHandle repHandle = repositoryManager.getRepository("my-source");
   Iterable<EntityLink> entityLinkService.getEntityLinks(java.lang.Object, java.lang.Class)(repHandle);
 
Is equivalent to:
   RepsoitoryData repData = repositoryService.getRepository("my-source");
   Iterable<EntityLink> entityLinkService.getEntityLinks(java.lang.Object, java.lang.Class)(repData);
 
Both will return an Iterable of EntityLinks that are linked from the "my-source" FishEye repository.



Whereas:

   Project project = projectManager.getProjectByKey("CR-MYSRC");
   Iterable<EntityLink> entityLinkService.getEntityLinks(java.lang.Object, java.lang.Class)(project);
 
will return an Iterable of EntityLinks that are linked from the CR-MYSRC FishEye/Crucible project.



In JIRA and Confluence, where there is only one type of entity which can be linked, you can instead simply provide a String identifier for the entity, for example:

   Iterable<EntityLink> entityLinkService.getEntityLinks(java.lang.Object, java.lang.Class)("JRA");
 
will return an Iterable of EntityLinks that are linked from the JRA JIRA project.

Since:
3.0.

Method Summary
 java.lang.Iterable<EntityLink> getEntityLinks(java.lang.Object entity)
           
 java.lang.Iterable<EntityLink> getEntityLinks(java.lang.Object entity, java.lang.Class<? extends EntityType> type)
           
 EntityLink getPrimaryEntityLink(java.lang.Object entity, java.lang.Class<? extends EntityType> type)
          There are exactly zero or one primary EntityLinks of each type configured for each local entity.
 

Method Detail

getEntityLinks

java.lang.Iterable<EntityLink> getEntityLinks(java.lang.Object entity,
                                              java.lang.Class<? extends EntityType> type)
Parameters:
entity - an application specific entity domain object, see class javadoc for more details
type - the type of EntityLinks to retrieve (e.g. fisheye-repository)
Returns:
an Iterable containing EntityLinks associated with the specified entity, of the specified type

getEntityLinks

java.lang.Iterable<EntityLink> getEntityLinks(java.lang.Object entity)
Parameters:
entity - an application specific entity domain object, see class javadoc for more details
Returns:
an Iterable containing EntityLinks associated with the specified entity

getPrimaryEntityLink

EntityLink getPrimaryEntityLink(java.lang.Object entity,
                                java.lang.Class<? extends EntityType> type)
There are exactly zero or one primary EntityLinks of each type configured for each local entity. If any links of the specified type exist, exactly one of them will be primary.

Parameters:
entity - an application specific entity domain object, see class javadoc for more details
type - the type of primary EntityLink to retrieve (e.g. fisheye-repository)
Returns:
the primary entity link of the specified type, or null if no remote entities of the specified type have been linked


Copyright © 2011 Atlassian. All Rights Reserved.