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

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

@Mapping
public class Model
extends AbstractMappable
implements IModel

Default implementation of the IModel interface. It is mapped to the base model.

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

Field Summary
 
Fields inherited from class pl.edu.agh.cast.model.mapper.AbstractMappable
id
 
Constructor Summary
Model()
          The default constructor.
Model(String newName)
          Parametrized constructor.
 
Method Summary
 boolean addDataSet(IDataSet dataSet)
          Add data set to the model.
 boolean equals(Object other)
          
 List<IDataSet> getDataSets()
          The data sets getter.
 Collection<IEntity> getEntities()
          Return all entities which are present in this model.
static Collection<IEntity> getEntities(Collection<IDataSet> dataSets)
          Create collection of entities which are present in given data sets.
 String getName()
          Model name getter.
 List<IRelation> getRelations()
          Return all relations which belong to this model.
 int hashCode()
          
 void setDataSets(List<IDataSet> dataSets)
          The data sets setter.
 void setName(String newName)
          The name setter.
 
Methods inherited from class pl.edu.agh.cast.model.mapper.AbstractMappable
clone, 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.mapper.Mappable
clone, getAttribute, getAttributeNames, getAttributeType, getId, getMid, getType, setAttribute, setId, setMid
 

Constructor Detail

Model

public Model()
The default constructor.


Model

public Model(String newName)
Parametrized constructor.

Parameters:
newName - The name of the model
Method Detail

hashCode

public int hashCode()

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

getDataSets

@MapLink(name="modelDataSet",
         direction=DST)
public List<IDataSet> getDataSets()
The data sets getter.

Specified by:
getDataSets in interface IModel
Returns:
the data sets which belong to this model

setDataSets

public void setDataSets(List<IDataSet> dataSets)
The data sets setter.

Specified by:
setDataSets in interface IModel
Parameters:
dataSets - The data sets to set.

getName

@MapAttribute(typeName="modelName")
public String getName()
Model name getter.

Specified by:
getName in interface IModel
Returns:
the name of the model.
See Also:
IModel.getName()

setName

public void setName(String newName)
The name setter.

Specified by:
setName in interface IModel
Parameters:
newName - the name to set

equals

public boolean equals(Object other)

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

addDataSet

public boolean addDataSet(IDataSet dataSet)
Add data set to the model.

Specified by:
addDataSet in interface IModel
Parameters:
dataSet - The data set to add
Returns:
True if the data set was added (the model doesn't contain data set with the same id).

getRelations

public List<IRelation> getRelations()
Return all relations which belong to this model.

Specified by:
getRelations in interface IModel
Returns:
The collection of all relations
See Also:
IModel.getRelations()

getEntities

public Collection<IEntity> getEntities()
Return all entities which are present in this model.

Specified by:
getEntities in interface IModel
Returns:
Collection of entities
See Also:
IModel.getEntities()

getEntities

public static Collection<IEntity> getEntities(Collection<IDataSet> dataSets)
Create collection of entities which are present in given data sets. Each entity is unique within the collection.

Parameters:
dataSets - The data sets in which the entities are looked for.
Returns:
The collection of entities.


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