pl.edu.agh.cast.data.model.general
Interface IEntity

All Superinterfaces:
Identifiable, IDisposable, IDomainElement, IElement, IGeneralElement, IPropertyContainer, IReplicable, IValidatable, Observer, Serializable
All Known Implementing Classes:
Entity

public interface IEntity
extends IGeneralElement

An interface of an entity. Entities may be in relations with each other.

If an entity is in a directed relation it treats it as an outbound (if the entity is the relation source) or inbound (if it is the relation target). If the relation is bi-directional it's perceived as bouth: inbound and outbound.

Entities and relations are elements of general data set.

Both incoming and outgoing relations are properties of type PropertyType.REFERENCE_LIST.

Author:
AGH CAST Team
See Also:
IManyToManyRelation, GeneralDataSet, PropertyType

Nested Class Summary
static class IEntity.Properties
          Enumeration of property name constants.
 
Field Summary
static Type TYPE
          The type of single timed-relation elements.
 
Method Summary
 void addIncomingRelation(IManyToManyRelation relation)
          Adds a new incoming relation to the entity, if not present.
 void addOutgoingRelation(IManyToManyRelation relation)
          Adds a new outgoing relation to the entity, if not present.
 List<? extends IManyToManyRelation> getIncomingRelations()
          Returns the list of incoming relations associated with the entity.
 String getName()
          Returns the entity name.
 List<? extends IManyToManyRelation> getOutgoingRelations()
          Returns the list of outgoing relations associated with the entity.
 boolean removeIncomingRelation(IManyToManyRelation relation)
          Removes the specified incoming relation from the entity.
 boolean removeOutgoingRelation(IManyToManyRelation relation)
          Removes the specified outgoing relation from the entity.
 void setIncomingRelations(List<? extends IManyToManyRelation> relations)
          Sets the list of incoming relations associated with the entity.
 void setName(String name)
          Sets the entity name.
 void setOutgoingRelations(List<? extends IManyToManyRelation> relations)
          Sets the list of outgoing relations associated with the entity.
 
Methods inherited from interface pl.edu.agh.cast.data.model.IElement
getDataSet
 
Methods inherited from interface pl.edu.agh.cast.data.model.Identifiable
getId, getType
 
Methods inherited from interface pl.edu.agh.cast.data.model.property.IPropertyContainer
addProperty, getCustomProperties, getMetaPropertyManager, getPermanentProperties, getProperties, getProperty, getTransientProperties, matches, removeProperty, setProperty
 
Methods inherited from interface java.util.Observer
update
 
Methods inherited from interface pl.edu.agh.cast.common.IValidatable
isValid
 
Methods inherited from interface pl.edu.agh.cast.common.IDisposable
dispose
 
Methods inherited from interface pl.edu.agh.cast.common.IReplicable
replicate, replicateTo
 

Field Detail

TYPE

static final Type TYPE
The type of single timed-relation elements.

Method Detail

getName

@PropertyGetter(name="ENTITY_NAME",
                type=TEXT,
                matchable=true)
String getName()
Returns the entity name. Name does not have to be unique and can be displayed to user.

Returns:
entity name

setName

@PropertySetter(name="ENTITY_NAME")
void setName(String name)
Sets the entity name.

Parameters:
name - entity name

getIncomingRelations

@PropertyGetter(name="INCOMING_RELATIONS",
                type=REFERENCE_LIST,
                matchable=false)
List<? extends IManyToManyRelation> getIncomingRelations()
Returns the list of incoming relations associated with the entity.

Returns:
unmodifiable list of incoming relations; if no incoming relation is associated with an entity an empty but non-null object is returned

setIncomingRelations

@PropertySetter(name="INCOMING_RELATIONS")
void setIncomingRelations(List<? extends IManyToManyRelation> relations)
Sets the list of incoming relations associated with the entity.

Parameters:
relations - list of incoming relations to set

addIncomingRelation

void addIncomingRelation(IManyToManyRelation relation)
Adds a new incoming relation to the entity, if not present. This method should be called during construction of the new relation.

Parameters:
relation - incoming relation to be added
Throws:
IllegalArgumentException - when relation is null

removeIncomingRelation

boolean removeIncomingRelation(IManyToManyRelation relation)
Removes the specified incoming relation from the entity.

Parameters:
relation - incoming relation to be removed, if present
Returns:
true if the relation was present and successfully removed
Throws:
IllegalArgumentException - when relation is null

getOutgoingRelations

@PropertyGetter(name="OUTGOING_RELATIONS",
                type=REFERENCE_LIST,
                matchable=false)
List<? extends IManyToManyRelation> getOutgoingRelations()
Returns the list of outgoing relations associated with the entity.

Returns:
unmodifiable list of outgoing relations; if no outgoing relation is associated with an entity an empty but non-null object is returned

setOutgoingRelations

@PropertySetter(name="OUTGOING_RELATIONS")
void setOutgoingRelations(List<? extends IManyToManyRelation> relations)
Sets the list of outgoing relations associated with the entity.

Parameters:
relations - list of outgoing relations to set

addOutgoingRelation

void addOutgoingRelation(IManyToManyRelation relation)
Adds a new outgoing relation to the entity, if not present. This method should be called during construction of the new relation.

Parameters:
relation - outgoing relation to be added
Throws:
IllegalArgumentException - when relation is null

removeOutgoingRelation

boolean removeOutgoingRelation(IManyToManyRelation relation)
Removes the specified outgoing relation from the entity.

Parameters:
relation - outgoing relation to be removed, if present
Returns:
true if the relation was present and successfully removed
Throws:
IllegalArgumentException - when relation is null


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