pl.edu.agh.cast.model.base
Class Relation

java.lang.Object
  extended by pl.edu.agh.cast.model.mapper.AbstractMappable
      extended by pl.edu.agh.cast.model.base.Relation
All Implemented Interfaces:
Serializable, Cloneable, IRelation, Mappable
Direct Known Subclasses:
TimedRelation

@Mapping
public class Relation
extends AbstractMappable
implements IRelation

The default implementation of the IRelation interface. It is mapped to the base model.

Author:
AGH CAST Team
See Also:
IRelation, Mapping, Serialized Form

Field Summary
protected  List<IDataSet> dataSets
          The data sets which this relation belongs to.
protected  IEntity source
          The source of the relation.
protected  IEntity target
          The target of the relation.
 
Fields inherited from class pl.edu.agh.cast.model.mapper.AbstractMappable
id
 
Constructor Summary
Relation()
          The default constructor.
Relation(IEntity newSource, IEntity newTarget)
          The parameterized constructor.
 
Method Summary
 void addDataSet(IDataSet newSet)
          Add given data set to this relation.
 Relation clone()
          This method makes a shallow copy of the object.
 boolean equals(Object other)
          To Timed relations are equal if their source and target nodes have the same id.
 List<IDataSet> getDataSets()
          The data sets which this relation belongs to.
 IEntity getSource()
          The source of the relation (getter).
 IEntity getTarget()
          The target of the relation (getter).
 int hashCode()
          
 void setDataSets(List<IDataSet> set)
          The data sets which this relation belongs to.
 void setSource(IEntity newSource)
          The source of the relation (setter).
 void setTarget(IEntity newTarget)
          The target of the relation (setter).
 String toString()
          
protected  void updateId()
           
 
Methods inherited from class pl.edu.agh.cast.model.mapper.AbstractMappable
getAttribute, getAttributeNames, getAttributeType, getId, getMid, getType, setAttribute, setId, setMid
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface pl.edu.agh.cast.model.base.IRelation
getId, setId
 
Methods inherited from interface pl.edu.agh.cast.model.mapper.Mappable
getAttribute, getAttributeNames, getAttributeType, getMid, getType, setAttribute, setMid
 

Field Detail

source

protected IEntity source
The source of the relation.


target

protected IEntity target
The target of the relation.


dataSets

protected List<IDataSet> dataSets
The data sets which this relation belongs to.

Constructor Detail

Relation

public Relation()
The default constructor.


Relation

public Relation(IEntity newSource,
                IEntity newTarget)
The parameterized constructor.

Parameters:
newSource - The source of the relation
newTarget - The target of the relation
Method Detail

updateId

protected void updateId()

addDataSet

public void addDataSet(IDataSet newSet)
Add given data set to this relation.

Specified by:
addDataSet in interface IRelation
Parameters:
newSet - The data set to add
See Also:
IRelation.addDataSet(pl.edu.agh.cast.model.base.IDataSet)

getDataSets

@MapLink(name="dataSetRelations")
public List<IDataSet> getDataSets()
The data sets which this relation belongs to. (getter)

Specified by:
getDataSets in interface IRelation
Returns:
Set of data sets
See Also:
IRelation.getDataSets()

getSource

@MapLink(direction=DST,
         name="relationSource")
public IEntity getSource()
The source of the relation (getter).

Specified by:
getSource in interface IRelation
Returns:
The source
See Also:
IRelation.getSource()

getTarget

@MapLink(name="relationTarget")
public IEntity getTarget()
The target of the relation (getter).

Specified by:
getTarget in interface IRelation
Returns:
The target
See Also:
IRelation.getTarget()

setDataSets

public void setDataSets(List<IDataSet> set)
The data sets which this relation belongs to. (getter)

Specified by:
setDataSets in interface IRelation
Parameters:
set - The set of data sets to set
See Also:
IRelation.setDataSets(java.util.List)

setSource

public void setSource(IEntity newSource)
The source of the relation (setter).

Specified by:
setSource in interface IRelation
Parameters:
newSource - The source to set
See Also:
IRelation.setSource(pl.edu.agh.cast.model.base.IEntity)

setTarget

public void setTarget(IEntity newTarget)
The target of the relation (setter).

Specified by:
setTarget in interface IRelation
Parameters:
newTarget - The target
See Also:
IRelation.setTarget(pl.edu.agh.cast.model.base.IEntity)

toString

public String toString()

Overrides:
toString in class AbstractMappable
See Also:
AbstractMappable.toString()

equals

public boolean equals(Object other)
To Timed relations are equal if their source and target nodes have the same id.

Overrides:
equals in class Object
Parameters:
other - The object to compare.
Returns:
true if the objects are equal.

hashCode

public int hashCode()

Overrides:
hashCode in class Object
See Also:
Object.hashCode()

clone

public Relation clone()
This method makes a shallow copy of the object. Subclasses may override, to break the referential integrity.

Specified by:
clone in interface Mappable
Overrides:
clone in class AbstractMappable
Returns:
copy of the mappable
See Also:
AbstractMappable.clone()


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.