com.atlassian.core.ofbiz.association
Interface AssociationManager

All Known Implementing Classes:
DefaultAssociationManager

public interface AssociationManager

This was taken from atlassian-ofbiz and placed into its now rightful home of JIRA.

Since:
4.3

Method Summary
 org.ofbiz.core.entity.GenericValue createAssociation(org.ofbiz.core.entity.GenericValue source, org.ofbiz.core.entity.GenericValue sink, String associationType)
          Create an association between two entities, given a particular association type.
 org.ofbiz.core.entity.GenericValue createAssociation(Long sourceNodeId, String sourceNodeEntity, Long sinkNodeId, String sinkNodeEntity, String associationType)
          Create an association between two entities, given a particular association type.
 org.ofbiz.core.entity.GenericValue createAssociation(String userName, Long sinkNodeId, String sinkNodeEntity, String associationType)
          Creates an association between a user and a sink node.
 org.ofbiz.core.entity.GenericValue createAssociation(User user, org.ofbiz.core.entity.GenericValue sink, String associationType)
          Deprecated. Please use UserAssociationStore.createAssociation(String, com.atlassian.crowd.embedded.api.User, org.ofbiz.core.entity.GenericValue). Deprecated since v4.3
 org.ofbiz.core.entity.GenericValue getAssociation(org.ofbiz.core.entity.GenericValue source, org.ofbiz.core.entity.GenericValue sink, String associationType)
           
 org.ofbiz.core.entity.GenericValue getAssociation(User user, org.ofbiz.core.entity.GenericValue sink, String associationType)
           
 List<org.ofbiz.core.entity.GenericValue> getSinkFromSource(org.ofbiz.core.entity.GenericValue source, String sinkName, String associationType, boolean useCache)
          Operates on NodeAssociations - gets MANY sinks from ONE source
 List<org.ofbiz.core.entity.GenericValue> getSinkFromSource(org.ofbiz.core.entity.GenericValue source, String sinkName, String associationType, boolean useCache, boolean useSequence)
           
 List<org.ofbiz.core.entity.GenericValue> getSinkFromUser(User source, String sinkName, String associationType, boolean useCache)
          Operates on UserAssociations - gets MANY sinks from ONE user
 List<org.ofbiz.core.entity.GenericValue> getSinkFromUser(User source, String sinkName, String associationType, boolean useCache, boolean useSequence)
          Operates on UserAssociations - gets MANY sinks from ONE user.
 List<Long> getSinkIdsFromSource(org.ofbiz.core.entity.GenericValue source, String sinkEntity, String associationType)
           
 List<Long> getSinkIdsFromUser(User source, String sinkName, String associationType, boolean useCache)
          Operates on UserAssociations - gets MANY sinks Ids from ONE user
 List<org.ofbiz.core.entity.GenericValue> getSourceFromSink(org.ofbiz.core.entity.GenericValue sink, String sourceName, String associationType, boolean useCache)
          Operates on NodeAssociations - gets MANY sources from ONE sink
 List<org.ofbiz.core.entity.GenericValue> getSourceFromSink(org.ofbiz.core.entity.GenericValue sink, String sourceName, String associationType, boolean useCache, boolean useSequence)
          Operates on NodeAssociations - gets MANY sources from ONE sink
 List<Long> getSourceIdsFromSink(org.ofbiz.core.entity.GenericValue sink, String sourceEntity, String associationType)
           
 List<User> getUserFromSink(org.ofbiz.core.entity.GenericValue sink, String associationType, boolean useCache)
          Operates on UserAssociations - gets MANY users from ONE sink
 List<User> getUserFromSink(org.ofbiz.core.entity.GenericValue sink, String associationType, boolean useCache, boolean useSequence)
          Operates on UserAssociations - gets MANY users from ONE sink
 List<String> getUsernamesFromSink(org.ofbiz.core.entity.GenericValue sink, String associationType, boolean useCache, boolean useSequence)
          Finds and returns a list of associated usernames, never null.
 void removeAssociation(org.ofbiz.core.entity.GenericValue source, org.ofbiz.core.entity.GenericValue sink, String associationType)
           
 void removeAssociation(String username, org.ofbiz.core.entity.GenericValue sink, String associationType)
          Removes association between the user with given username and the generic value
 void removeAssociation(User user, org.ofbiz.core.entity.GenericValue sink, String associationType)
           
 void removeAssociationsFromSink(org.ofbiz.core.entity.GenericValue sink)
          Remove all entity<->entity associations, given the sink.
 void removeAssociationsFromSource(org.ofbiz.core.entity.GenericValue source)
          Remove all entity<->entity associations, given the source.
 void removeUserAssociationsFromSink(org.ofbiz.core.entity.GenericValue sink)
          Remove all user<->entity associations, given the entity
 void removeUserAssociationsFromSink(org.ofbiz.core.entity.GenericValue sink, String associationType)
          Remove all uer associations given an entity and association type
 void removeUserAssociationsFromUser(User user)
          Remove all user<->entity associations, given the user
 void removeUserAssociationsFromUser(User user, String associationType)
          Remove all user<->entity associations, given the user and association type
 void removeUserAssociationsFromUser(User user, String associationType, String entityName)
          Remove all user<->entity associations, given the user and association type
 void swapAssociation(List<org.ofbiz.core.entity.GenericValue> entities, String associationType, org.ofbiz.core.entity.GenericValue fromSink, org.ofbiz.core.entity.GenericValue toSink)
          Swaps all associations for a given list of entities (say move a list of unresolved issue entities to a new fix for version)
 void swapAssociation(String sourceEntityType, String associationType, org.ofbiz.core.entity.GenericValue fromSink, org.ofbiz.core.entity.GenericValue toSink)
          Swap all associations of a particular type from one sink to another.
 

Method Detail

createAssociation

org.ofbiz.core.entity.GenericValue createAssociation(User user,
                                                     org.ofbiz.core.entity.GenericValue sink,
                                                     String associationType)
                                                     throws org.ofbiz.core.entity.GenericEntityException
Deprecated. Please use UserAssociationStore.createAssociation(String, com.atlassian.crowd.embedded.api.User, org.ofbiz.core.entity.GenericValue). Deprecated since v4.3

Creates an association between a user and a sink node.

Parameters:
user - the user to associate with the sink node.
sink - the sink node entity
associationType - the association type
Returns:
the created association
Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB Exception.

createAssociation

org.ofbiz.core.entity.GenericValue createAssociation(String userName,
                                                     Long sinkNodeId,
                                                     String sinkNodeEntity,
                                                     String associationType)
                                                     throws org.ofbiz.core.entity.GenericEntityException
Creates an association between a user and a sink node.

Parameters:
userName - the user name to associate with the sink node.
sinkNodeId - the id of the sink node entity
sinkNodeEntity - the entity name of the sink node
associationType - the association type
Returns:
the created association
Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB Exception.

createAssociation

org.ofbiz.core.entity.GenericValue createAssociation(org.ofbiz.core.entity.GenericValue source,
                                                     org.ofbiz.core.entity.GenericValue sink,
                                                     String associationType)
                                                     throws org.ofbiz.core.entity.GenericEntityException
Create an association between two entities, given a particular association type.

If the association already exists - it will not be created.

Parameters:
source - the source
sink - the sink
associationType - the Association Type
Returns:
The new association, or the existing association if it already existed.
Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB Exception.

createAssociation

org.ofbiz.core.entity.GenericValue createAssociation(Long sourceNodeId,
                                                     String sourceNodeEntity,
                                                     Long sinkNodeId,
                                                     String sinkNodeEntity,
                                                     String associationType)
                                                     throws org.ofbiz.core.entity.GenericEntityException
Create an association between two entities, given a particular association type.

If the association already exists - it will not be created.

NOTE: this is a convenience method that should only be used when you are certain of the related entity id's. This method does not verify the integrity of the links it creates.

Returns:
The new association, or the existing association if it already existed.
Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB Exception.

removeAssociation

void removeAssociation(org.ofbiz.core.entity.GenericValue source,
                       org.ofbiz.core.entity.GenericValue sink,
                       String associationType)
                       throws org.ofbiz.core.entity.GenericEntityException
Throws:
org.ofbiz.core.entity.GenericEntityException

removeAssociation

void removeAssociation(User user,
                       org.ofbiz.core.entity.GenericValue sink,
                       String associationType)
                       throws org.ofbiz.core.entity.GenericEntityException
Throws:
org.ofbiz.core.entity.GenericEntityException

removeAssociation

void removeAssociation(String username,
                       org.ofbiz.core.entity.GenericValue sink,
                       String associationType)
                       throws org.ofbiz.core.entity.GenericEntityException
Removes association between the user with given username and the generic value

Parameters:
username - username
sink - generic value, e.g. issue
associationType - association type
Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB Exception.

removeAssociationsFromSource

void removeAssociationsFromSource(org.ofbiz.core.entity.GenericValue source)
                                  throws org.ofbiz.core.entity.GenericEntityException
Remove all entity<->entity associations, given the source.

Parameters:
source - the Source
Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB Exception.

removeAssociationsFromSink

void removeAssociationsFromSink(org.ofbiz.core.entity.GenericValue sink)
                                throws org.ofbiz.core.entity.GenericEntityException
Remove all entity<->entity associations, given the sink.

Parameters:
sink - the sink
Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB Exception.

removeUserAssociationsFromSink

void removeUserAssociationsFromSink(org.ofbiz.core.entity.GenericValue sink)
                                    throws org.ofbiz.core.entity.GenericEntityException
Remove all user<->entity associations, given the entity

Parameters:
sink - the sink
Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB Exception.

removeUserAssociationsFromSink

void removeUserAssociationsFromSink(org.ofbiz.core.entity.GenericValue sink,
                                    String associationType)
                                    throws org.ofbiz.core.entity.GenericEntityException
Remove all uer associations given an entity and association type

Parameters:
sink - The entity disassociate with all users
associationType - the association type to remove
Throws:
org.ofbiz.core.entity.GenericEntityException - throws if problem with ofbiz

removeUserAssociationsFromUser

void removeUserAssociationsFromUser(User user)
                                    throws org.ofbiz.core.entity.GenericEntityException
Remove all user<->entity associations, given the user

Parameters:
user - the User
Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB Exception.

removeUserAssociationsFromUser

void removeUserAssociationsFromUser(User user,
                                    String associationType)
                                    throws org.ofbiz.core.entity.GenericEntityException
Remove all user<->entity associations, given the user and association type

Parameters:
user - The user to remove all associations with
associationType - the type of associations to remove
Throws:
org.ofbiz.core.entity.GenericEntityException - if database exception occurs

removeUserAssociationsFromUser

void removeUserAssociationsFromUser(User user,
                                    String associationType,
                                    String entityName)
                                    throws org.ofbiz.core.entity.GenericEntityException
Remove all user<->entity associations, given the user and association type

Parameters:
user - The user to remove all associations with
entityName - The type of entity to remove
associationType - the type of associations to remove
Throws:
org.ofbiz.core.entity.GenericEntityException - if database exception occurs

swapAssociation

void swapAssociation(String sourceEntityType,
                     String associationType,
                     org.ofbiz.core.entity.GenericValue fromSink,
                     org.ofbiz.core.entity.GenericValue toSink)
                     throws org.ofbiz.core.entity.GenericEntityException
Swap all associations of a particular type from one sink to another.

Used in ComponentDelete and VersionDelete.

Parameters:
sourceEntityType - the Source Entity Type
associationType - the Association Type
fromSink - the From sink
toSink - the To sink
Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB Exception.

swapAssociation

void swapAssociation(List<org.ofbiz.core.entity.GenericValue> entities,
                     String associationType,
                     org.ofbiz.core.entity.GenericValue fromSink,
                     org.ofbiz.core.entity.GenericValue toSink)
                     throws org.ofbiz.core.entity.GenericEntityException
Swaps all associations for a given list of entities (say move a list of unresolved issue entities to a new fix for version)

Parameters:
entities - the entities
associationType - the Association Type
fromSink - the From sink
toSink - the To sink
Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB Exception.

getSinkFromSource

List<org.ofbiz.core.entity.GenericValue> getSinkFromSource(org.ofbiz.core.entity.GenericValue source,
                                                           String sinkName,
                                                           String associationType,
                                                           boolean useCache)
                                                           throws org.ofbiz.core.entity.GenericEntityException
Operates on NodeAssociations - gets MANY sinks from ONE source

Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB Exception.

getSinkFromSource

List<org.ofbiz.core.entity.GenericValue> getSinkFromSource(org.ofbiz.core.entity.GenericValue source,
                                                           String sinkName,
                                                           String associationType,
                                                           boolean useCache,
                                                           boolean useSequence)
                                                           throws org.ofbiz.core.entity.GenericEntityException
Throws:
org.ofbiz.core.entity.GenericEntityException

getSourceFromSink

List<org.ofbiz.core.entity.GenericValue> getSourceFromSink(org.ofbiz.core.entity.GenericValue sink,
                                                           String sourceName,
                                                           String associationType,
                                                           boolean useCache)
                                                           throws org.ofbiz.core.entity.GenericEntityException
Operates on NodeAssociations - gets MANY sources from ONE sink

Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB Exception.

getSourceFromSink

List<org.ofbiz.core.entity.GenericValue> getSourceFromSink(org.ofbiz.core.entity.GenericValue sink,
                                                           String sourceName,
                                                           String associationType,
                                                           boolean useCache,
                                                           boolean useSequence)
                                                           throws org.ofbiz.core.entity.GenericEntityException
Operates on NodeAssociations - gets MANY sources from ONE sink

Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB Exception.

getSinkFromUser

List<org.ofbiz.core.entity.GenericValue> getSinkFromUser(User source,
                                                         String sinkName,
                                                         String associationType,
                                                         boolean useCache)
                                                         throws org.ofbiz.core.entity.GenericEntityException
Operates on UserAssociations - gets MANY sinks from ONE user

Parameters:
source - The associated user
sinkName - The type of entity
associationType - The association type
useCache - Do we use the cache
Returns:
a List of sinks (GenericValue)
Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB Exception.

getSinkIdsFromUser

List<Long> getSinkIdsFromUser(User source,
                              String sinkName,
                              String associationType,
                              boolean useCache)
                              throws org.ofbiz.core.entity.GenericEntityException
Operates on UserAssociations - gets MANY sinks Ids from ONE user

Parameters:
source - The associated user
sinkName - The type of entity
associationType - The association type
useCache - Do we use the cache
Returns:
a List of ids (Long)
Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB Exception.

getSinkFromUser

List<org.ofbiz.core.entity.GenericValue> getSinkFromUser(User source,
                                                         String sinkName,
                                                         String associationType,
                                                         boolean useCache,
                                                         boolean useSequence)
                                                         throws org.ofbiz.core.entity.GenericEntityException
Operates on UserAssociations - gets MANY sinks from ONE user.

Parameters:
source - the source User
sinkName - The type of entity
associationType - the association type
useCache - use cache flag
useSequence - use sequence number flag
Returns:
a list of sinks
Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB Exception.

getUserFromSink

List<User> getUserFromSink(org.ofbiz.core.entity.GenericValue sink,
                           String associationType,
                           boolean useCache)
                           throws org.ofbiz.core.entity.GenericEntityException,
                                  EntityNotFoundException
Operates on UserAssociations - gets MANY users from ONE sink

Parameters:
sink - the Sink generic value
associationType - association type
useCache - use cache flag
Returns:
a list of associated users, never null
Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB Exception.
EntityNotFoundException

getUserFromSink

List<User> getUserFromSink(org.ofbiz.core.entity.GenericValue sink,
                           String associationType,
                           boolean useCache,
                           boolean useSequence)
                           throws org.ofbiz.core.entity.GenericEntityException,
                                  EntityNotFoundException
Operates on UserAssociations - gets MANY users from ONE sink

Parameters:
sink - the Sink generic value
associationType - association type
useCache - use cache flag
useSequence - use sequence number flag
Returns:
a list of associated users, never null
Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB Exception.
EntityNotFoundException

getUsernamesFromSink

List<String> getUsernamesFromSink(org.ofbiz.core.entity.GenericValue sink,
                                  String associationType,
                                  boolean useCache,
                                  boolean useSequence)
                                  throws org.ofbiz.core.entity.GenericEntityException
Finds and returns a list of associated usernames, never null.

Parameters:
sink - the Sink generic value
associationType - association type
useCache - use cache flag
useSequence - use sequence number flag
Returns:
a list of associated usernames, never null
Throws:
org.ofbiz.core.entity.GenericEntityException - If there is a DB Exception.

getAssociation

org.ofbiz.core.entity.GenericValue getAssociation(org.ofbiz.core.entity.GenericValue source,
                                                  org.ofbiz.core.entity.GenericValue sink,
                                                  String associationType)
                                                  throws org.ofbiz.core.entity.GenericEntityException
Throws:
org.ofbiz.core.entity.GenericEntityException

getAssociation

org.ofbiz.core.entity.GenericValue getAssociation(User user,
                                                  org.ofbiz.core.entity.GenericValue sink,
                                                  String associationType)
                                                  throws org.ofbiz.core.entity.GenericEntityException
Throws:
org.ofbiz.core.entity.GenericEntityException

getSinkIdsFromSource

List<Long> getSinkIdsFromSource(org.ofbiz.core.entity.GenericValue source,
                                String sinkEntity,
                                String associationType)
                                throws org.ofbiz.core.entity.GenericEntityException
Throws:
org.ofbiz.core.entity.GenericEntityException

getSourceIdsFromSink

List<Long> getSourceIdsFromSink(org.ofbiz.core.entity.GenericValue sink,
                                String sourceEntity,
                                String associationType)
                                throws org.ofbiz.core.entity.GenericEntityException
Throws:
org.ofbiz.core.entity.GenericEntityException


Copyright © 2002-2011 Atlassian. All Rights Reserved.