com.sfm.ap210.jsdai.utils
Class GraphCopy

java.lang.Object
  extended by com.sfm.ap210.jsdai.utils.GraphCopy

public class GraphCopy
extends java.lang.Object

This utility class supports the copying of a set of entities from a given SdaiModel to a new SdaiModel while selectively preserving entity connectivity information. Additionally, it provides bi-directional mapping information between the original source entities and the newly created target entities of the copy operation.


Constructor Summary
GraphCopy(jsdai.lang.SdaiModel src, jsdai.lang.SdaiModel dst)
          Create a new GraphCopy operation that will copy entities from the src model to the dst model
 
Method Summary
 void exclude(java.lang.Class<?> klass)
          Exclude all source model entities of the given type (including subtypes) from the copy operation
 void exclude(jsdai.dictionary.EEntity_definition type)
          Exclude all source model entities of the given type (including subtypes) from the copy operation
 void exclude(jsdai.lang.EEntity ent)
          Exclude the given source model entity from the copy operation
 void exclude(java.lang.Iterable<jsdai.lang.EEntity> ents)
          Exclude the given source model entities from the copy operation
 void execute()
          Executes the copy operation and creates source/target mapping data
 jsdai.lang.EEntity findSource(jsdai.lang.EEntity target)
          Get the corresponding entity from the source model for the given entity from the destination model
 jsdai.lang.EEntity findTarget(jsdai.lang.EEntity source)
          Get the newly created entity in the destination model corresponding to the given entity from the source model
 java.util.Set<jsdai.lang.EEntity> getSourceEntities()
          Get a listing of all entities copied from the source model
 java.util.Set<jsdai.lang.EEntity> getTargetEntities()
          Get a listing of all entities created in the destination model by the copy operation
 boolean hasSource(jsdai.lang.EEntity target)
          Returns true if there is a corresponding entity in the source model
 boolean hasTarget(jsdai.lang.EEntity source)
          Returns true if there is a source to target mapping for the given entity
 void include(java.lang.Class<?> klass)
          Include all source model entities of the given class (including subtypes) in the copy operation
 void include(jsdai.dictionary.EEntity_definition type)
          Include all source model entities of the given entity type (including subtypes) in the copy operation
 void include(jsdai.lang.EEntity ent)
          Include the given source model entity in the copy operation
 void include(java.lang.Iterable<jsdai.lang.EEntity> ents)
          Include the given source model entities in the copy operation
 boolean isExcluded(jsdai.lang.EEntity ent)
          Returns true if the given source model entity is explicitly excluded from the copy operation
 boolean isIncluded(jsdai.lang.EEntity ent)
          Returns true if the given source model entity is included in the copy operation, i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphCopy

public GraphCopy(jsdai.lang.SdaiModel src,
                 jsdai.lang.SdaiModel dst)
Create a new GraphCopy operation that will copy entities from the src model to the dst model

Parameters:
src - the source model
dst - the destination model
Method Detail

exclude

public void exclude(jsdai.lang.EEntity ent)
Exclude the given source model entity from the copy operation

Parameters:
ent - the entity to exclude

exclude

public void exclude(java.lang.Iterable<jsdai.lang.EEntity> ents)
Exclude the given source model entities from the copy operation

Parameters:
ents - the entities to exclude

include

public void include(jsdai.lang.EEntity ent)
Include the given source model entity in the copy operation

Parameters:
ent - the entity to include

include

public void include(java.lang.Iterable<jsdai.lang.EEntity> ents)
Include the given source model entities in the copy operation

Parameters:
ents - the entities to include

include

public void include(java.lang.Class<?> klass)
             throws jsdai.lang.SdaiException
Include all source model entities of the given class (including subtypes) in the copy operation

Parameters:
klass - the class object
Throws:
jsdai.lang.SdaiException

include

public void include(jsdai.dictionary.EEntity_definition type)
             throws jsdai.lang.SdaiException
Include all source model entities of the given entity type (including subtypes) in the copy operation

Parameters:
type - the type to include
Throws:
jsdai.lang.SdaiException

exclude

public void exclude(jsdai.dictionary.EEntity_definition type)
             throws jsdai.lang.SdaiException
Exclude all source model entities of the given type (including subtypes) from the copy operation

Parameters:
type - the type to exclude
Throws:
jsdai.lang.SdaiException

exclude

public void exclude(java.lang.Class<?> klass)
             throws jsdai.lang.SdaiException
Exclude all source model entities of the given type (including subtypes) from the copy operation

Parameters:
klass - the type to exclude
Throws:
jsdai.lang.SdaiException

findTarget

public jsdai.lang.EEntity findTarget(jsdai.lang.EEntity source)
Get the newly created entity in the destination model corresponding to the given entity from the source model

Parameters:
source - the source model entity
Returns:
the corresponding destination model entity

hasTarget

public boolean hasTarget(jsdai.lang.EEntity source)
Returns true if there is a source to target mapping for the given entity

Parameters:
source - the source model entity
Returns:
true if there is a target mapping for the given entity, false otherwise

findSource

public jsdai.lang.EEntity findSource(jsdai.lang.EEntity target)
Get the corresponding entity from the source model for the given entity from the destination model

Parameters:
target - the destination model entity
Returns:
the corresponding entity from the source model, null if no such entity exists

hasSource

public boolean hasSource(jsdai.lang.EEntity target)
Returns true if there is a corresponding entity in the source model

Parameters:
target - the destination model eneitty
Returns:
true if there is a source mapping for the given entity, false otherwise

isExcluded

public boolean isExcluded(jsdai.lang.EEntity ent)
Returns true if the given source model entity is explicitly excluded from the copy operation

Parameters:
ent - the source model entity
Returns:

isIncluded

public boolean isIncluded(jsdai.lang.EEntity ent)
Returns true if the given source model entity is included in the copy operation, i.e. a corresponding entity will be created in the destination model

Parameters:
ent - the source model entity
Returns:

getSourceEntities

public java.util.Set<jsdai.lang.EEntity> getSourceEntities()
Get a listing of all entities copied from the source model

Returns:

getTargetEntities

public java.util.Set<jsdai.lang.EEntity> getTargetEntities()
Get a listing of all entities created in the destination model by the copy operation

Returns:

execute

public void execute()
             throws jsdai.lang.SdaiException
Executes the copy operation and creates source/target mapping data

Throws:
jsdai.lang.SdaiException