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

java.lang.Object
  extended by pl.edu.agh.cast.model.mapper.AbstractMappable
      extended by pl.edu.agh.cast.model.base.Entity
All Implemented Interfaces:
Serializable, Cloneable, IEntity, Mappable

@Mapping
public class Entity
extends AbstractMappable
implements IEntity

Default IEntity implementation. It is mapped to the base model.

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

Field Summary
protected  boolean isMain
          This flag indicates if the node somehow stands out (e.g.
protected  List<IRelation> sourceRelations
          Source relations are relations which have this entity as their source.
protected  List<IRelation> targetRelations
          Target relations are relations which have this entity as their target.
 
Fields inherited from class pl.edu.agh.cast.model.mapper.AbstractMappable
id
 
Constructor Summary
Entity()
          Default constructor needed by the mapping mechanism.
Entity(String value)
          Parametrized constructor.
 
Method Summary
 void addRelation(IRelation relation)
          Add new relation to relations of this entity.
 Entity clone()
          The clone of the entity.
 boolean equals(Object other)
          
 boolean getIsMain()
          Main entity setter.
 List<IRelation> getSourceRelations()
          Source relations (getter).
 List<IRelation> getTargetRelations()
          Target relations (getter).
 int hashCode()
          
 boolean isConnected(IEntity entity)
          Returns true if the entity is directly connected with given entity.
 void removeRelation(IRelation relation)
          Remove relation from this entity.
 void setIsMain(boolean main)
          Set true if the number is main.
 void setIsMain(Boolean main)
           
 void setSourceRelations(List<IRelation> srcCalls)
          Source relations (setter).
 void setTargetRelations(List<IRelation> dstCalls)
          Target relations (setter).
 
Methods inherited from class pl.edu.agh.cast.model.mapper.AbstractMappable
getAttribute, getAttributeNames, getAttributeType, getId, getMid, getType, setAttribute, setId, setMid, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface pl.edu.agh.cast.model.base.IEntity
getId, setId
 
Methods inherited from interface pl.edu.agh.cast.model.mapper.Mappable
getAttribute, getAttributeNames, getAttributeType, getMid, getType, setAttribute, setMid
 

Field Detail

sourceRelations

protected List<IRelation> sourceRelations
Source relations are relations which have this entity as their source.


targetRelations

protected List<IRelation> targetRelations
Target relations are relations which have this entity as their target.


isMain

protected boolean isMain
This flag indicates if the node somehow stands out (e.g. the data set was produced "for it").

Constructor Detail

Entity

public Entity()
Default constructor needed by the mapping mechanism.


Entity

public Entity(String value)
Parametrized constructor. The value is the id of the entity.

Parameters:
value - The id of the entity.
Method Detail

addRelation

public void addRelation(IRelation relation)
Add new relation to relations of this entity. The source or target of the relation must be set with object which == this.

Specified by:
addRelation in interface IEntity
Parameters:
relation - The relation to add
See Also:
IEntity.addRelation(pl.edu.agh.cast.model.base.IRelation)

removeRelation

public void removeRelation(IRelation relation)
Remove relation from this entity.

Specified by:
removeRelation in interface IEntity
Parameters:
relation - The relation to remove.
See Also:
IEntity.removeRelation(pl.edu.agh.cast.model.base.IRelation)

getSourceRelations

@MapLink(name="relationSource")
public List<IRelation> getSourceRelations()
Source relations (getter).

Specified by:
getSourceRelations in interface IEntity
Returns:
Source relations
See Also:
IEntity.getSourceRelations()

setSourceRelations

public void setSourceRelations(List<IRelation> srcCalls)
Source relations (setter).

Specified by:
setSourceRelations in interface IEntity
Parameters:
srcCalls - Relations to set
See Also:
IEntity.setSourceRelations(java.util.List)

getTargetRelations

@MapLink(name="relationTarget",
         direction=DST)
public List<IRelation> getTargetRelations()
Target relations (getter).

Specified by:
getTargetRelations in interface IEntity
Returns:
Target relations
See Also:
IEntity.getTargetRelations()

setTargetRelations

public void setTargetRelations(List<IRelation> dstCalls)
Target relations (setter).

Specified by:
setTargetRelations in interface IEntity
Parameters:
dstCalls - The relations to set
See Also:
IEntity.setTargetRelations(java.util.List)

getIsMain

@MapAttribute(typeName="IsMain")
public boolean getIsMain()
Main entity setter.

Returns:
True if the entity is main.

setIsMain

public void setIsMain(boolean main)
Set true if the number is main.

Parameters:
main - The "main" flag
See Also:
getIsMain().

setIsMain

public void setIsMain(Boolean main)

isConnected

public boolean isConnected(IEntity entity)
Returns true if the entity is directly connected with given entity.

Specified by:
isConnected in interface IEntity
Parameters:
entity - The entity checked for connection.
Returns:
True if these entities are connected
See Also:
IEntity.isConnected(pl.edu.agh.cast.model.base.IEntity)

hashCode

public int hashCode()

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

equals

public boolean equals(Object other)

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

clone

public Entity clone()
The clone of the entity. The clone breaks the referential integrity of the original object, i.e. it clears its relations. Rationale: the cloning is invoked when new version of the entity is to be instantiated. Since the new version may have different relations (especially a subset) it has to be initialized with empty relations set.

Specified by:
clone in interface Mappable
Overrides:
clone in class AbstractMappable
Returns:
copy of the entity
Throws:
CloneNotSupportedException


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