org.fopps.model
Class Relation

java.lang.Object
  |
  +--org.fopps.model.AbstractItem
        |
        +--org.fopps.model.Relation
Direct Known Subclasses:
Constraint, ProjectRelation

public class Relation
extends AbstractItem

Class Relation is the base class for all relation between model elements. Relation contains methods for

Subclasses may contain additional attributes depending on theitr semantics.

See Also:
isValid(), accept(AbstractItem)

Field Summary
protected  AbstractItem from
           
protected  AbstractItem to
           
 
Fields inherited from class org.fopps.model.AbstractItem
ADDED_EVENT, CHANGE_EVENT, name, REMOVED_EVENT
 
Constructor Summary
Relation(AbstractItem pFrom, AbstractItem pTo)
          Creates a new relation between two projects.
 
Method Summary
 boolean accept(AbstractItem pItem)
          Checks, if the given objects are accepted by the relation.
 void disconnect()
          Drops connection and saves undo information
 AbstractItem getFrom()
          Getter of association From
 AbstractItem getTo()
          Getter of association To
 boolean isGhost()
           
 boolean isValid()
          Checks if relation is valid.
 boolean loopAllowed()
          Returns the current state of loop detection.
protected  void saveUndoOnDisconnect()
          Called while disconnecting.
 void setAllowLoop(boolean pAllowLoops)
          Toggle loop detection.
 void setFrom(AbstractItem pFrom)
          Setter of association From
 void setGhost(boolean ghost)
          Marks the relation as ghost relation.
 void setTo(AbstractItem pTo)
          Setter of association To
 java.lang.String toString()
           
 
Methods inherited from class org.fopps.model.AbstractItem
addIncoming, addListener, addOutgoing, commitGhostRelations, containsType, copyAttributes, delete, filterElements, fireItemAdded, fireItemChanged, fireItemRemoved, getConstraints, getDescription, getIncoming, getIncomingConstraints, getListeners, getName, getOutgoing, getOutgoingConstraints, getRelationTo, hasConstraints, isBlockEvents, isConnectedWith, notifyListeners, removeAllConstraints, removeAllIncoming, removeAllListener, removeAllOutgoing, removeAllRelations, removeGhostRelations, removeIncoming, removeListener, removeOutgoing, removeRelationTo, setBlockEvents, setDescription, setIncoming, setName, setOutgoing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

from

protected AbstractItem from

to

protected AbstractItem to
Constructor Detail

Relation

public Relation(AbstractItem pFrom,
                AbstractItem pTo)
         throws InvalidRelationException
Creates a new relation between two projects. The two projects must not be the same instances.

Parameters:
pTo - Destination item
pFrom - Source item
Throws:
InvalidRelationException, - if source = destination or given peer objects are not accepted
InvalidRelationException
See Also:
accept(AbstractItem)
Method Detail

accept

public boolean accept(AbstractItem pItem)
Checks, if the given objects are accepted by the relation. Subclasses may override this method to ensure consistency. The default returns always true.


isGhost

public boolean isGhost()

setGhost

public void setGhost(boolean ghost)
Marks the relation as ghost relation. Is 'ghost' is true, the relation will be treated as 'uncommitted' in order to proof creation/deletion of relations.

Parameters:
ghost - If true, the relation changes to a ghost relation

loopAllowed

public boolean loopAllowed()
Returns the current state of loop detection. Default is false.

Returns:
true, if loop detection is active

setAllowLoop

public void setAllowLoop(boolean pAllowLoops)
                  throws InvalidRelationException
Toggle loop detection. If allowLoops is set to false connections are not checked for circular relations.

The default is false.

Parameters:
pAllowLoops - New state of loop detection
Throws:
InvalidRelationException - if

isValid

public boolean isValid()
Checks if relation is valid. This is true, if both sides are not null and have the correct type

See Also:
accept(AbstractItem)

setTo

public void setTo(AbstractItem pTo)
           throws InvalidRelationException
Setter of association To

InvalidRelationException

getTo

public AbstractItem getTo()
Getter of association To


getFrom

public AbstractItem getFrom()
Getter of association From


setFrom

public void setFrom(AbstractItem pFrom)
             throws InvalidRelationException
Setter of association From

InvalidRelationException

disconnect

public void disconnect()
Drops connection and saves undo information


saveUndoOnDisconnect

protected void saveUndoOnDisconnect()
Called while disconnecting. Subclasses should override this method to save undo information of additional fields


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Fopps 0.19 - Copyright © 2002 Oliver Wieland. All Rights Reserved.