i3.dragos.gm.core
Class DataChangeSet

java.lang.Object
  extended by i3.dragos.gm.core.DataChangeSet

public class DataChangeSet
extends java.lang.Object

A ChangeSet enumerates GraphEntityClasses and GraphEntities that have been modified by an event or during the course of a transaction.

Please note that this implementation is not thread-safe. This should not be a problem however with the purposes it is used for in the core:

Author:
Thorsten Hermes <thermes@i3.informatik.rwth-aachen.de>

Constructor Summary
DataChangeSet(boolean readOnly)
          Creates an empty DataChangeSet.
DataChangeSet(java.util.Collection<GraphEntityClass> gec, java.util.Collection<GraphEntity> ge, boolean readOnly)
          Creates a DataChangeSet containing the specified GraphEntityClasses and GraphEntities.
DataChangeSet(GraphEntity[] g, boolean readOnly)
          Creates a DataChangeSet containing the specified GraphEntities.
DataChangeSet(GraphEntity g, boolean readOnly)
          Creates a DataChangeSet containing the specified GraphEntity.
DataChangeSet(GraphEntityClass[] g, boolean readOnly)
          Creates a DataChangeSet containing the specified GraphEntityClasses.
DataChangeSet(GraphEntityClass g, boolean readOnly)
          Creates a DataChangeSet containing the specified GraphEntityClass.
 
Method Summary
 DataChangeSet closure()
          Returns a new DataChangeSet that includes all GraphEntityClasses and GraphEntities directly or indirectly affected by this ChangeSet.
 java.util.Set<GraphEntity> getGraphEntities()
          Returns the changed GraphEntities.
 java.util.Set<GraphEntityClass> getGraphEntityClasses()
          Returns the changed GraphEntityClasses.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataChangeSet

public DataChangeSet(boolean readOnly)
Creates an empty DataChangeSet.

Parameters:
readOnly - Whether modifications are forbidden.

DataChangeSet

public DataChangeSet(GraphEntityClass g,
                     boolean readOnly)
Creates a DataChangeSet containing the specified GraphEntityClass.

Parameters:
g - The changed GraphEntityClass.
readOnly - Whether modifications are forbidden.

DataChangeSet

public DataChangeSet(GraphEntity g,
                     boolean readOnly)
Creates a DataChangeSet containing the specified GraphEntity.

Parameters:
g - The changed GraphEntity.
readOnly - Whether modifications are forbidden.

DataChangeSet

public DataChangeSet(java.util.Collection<GraphEntityClass> gec,
                     java.util.Collection<GraphEntity> ge,
                     boolean readOnly)
Creates a DataChangeSet containing the specified GraphEntityClasses and GraphEntities. The Collections will be copied, not used directly!

Parameters:
gec - The changed GraphEntityClasses (may be null).
ge - The changed GraphEntities (may be null).
readOnly - Whether modifications are forbidden.

DataChangeSet

public DataChangeSet(GraphEntityClass[] g,
                     boolean readOnly)
Creates a DataChangeSet containing the specified GraphEntityClasses.

Parameters:
g - The changed GraphEntityClasses.
readOnly - Whether modifications are forbidden.

DataChangeSet

public DataChangeSet(GraphEntity[] g,
                     boolean readOnly)
Creates a DataChangeSet containing the specified GraphEntities.

Parameters:
g - The changed GraphEntities.
readOnly - Whether modifications are forbidden.
Method Detail

getGraphEntityClasses

public java.util.Set<GraphEntityClass> getGraphEntityClasses()
Returns the changed GraphEntityClasses.

Returns:
the changed GraphEntityClasses

getGraphEntities

public java.util.Set<GraphEntity> getGraphEntities()
Returns the changed GraphEntities.

Returns:
the changed GraphEntities

closure

public DataChangeSet closure()
                      throws DragosException
Returns a new DataChangeSet that includes all GraphEntityClasses and GraphEntities directly or indirectly affected by this ChangeSet. The returned DataChangeSet will be in "read & write" mode.

The Closure is calculated as follows:

  1. Add all subclasses of all GraphEntityClasses already in the DataChangeSet.
  2. Add instances of all GraphEntityClasses now found in the GraphEntityClasses-closure to the GraphEntities already contained in the source DataChangeSet.

Resolution of subclasses and instances is performed on the core level, meaning a completely unwrapped GraphPool/Schema.

Returns:
A new DataChangeSet that describes the closure of this DataChangeSet.
Throws:
DragosException - in case of internal errors.


Copyright © 2002-2008 RWTH Aachen, Department of Computer Science 3 (Software Engineering). All Rights Reserved.