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 getAssociation(org.ofbiz.core.entity.GenericValue source, 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<Long> getSinkIdsFromSource(org.ofbiz.core.entity.GenericValue source, String sinkEntity, String associationType)
           
 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)
           
 void removeAssociation(org.ofbiz.core.entity.GenericValue source, org.ofbiz.core.entity.GenericValue sink, String associationType)
          Removes association between two entities, given a particular association type.
 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 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(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
Removes association between two entities, given a particular association type.

Parameters:
source - the source entity
sink - generic value, e.g. issue
associationType - association type
Throws:
org.ofbiz.core.entity.GenericEntityException

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.

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.

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

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-2013 Atlassian. All Rights Reserved.