pl.edu.agh.cast.data.model
Class DataSetDescriptor

java.lang.Object
  extended by pl.edu.agh.cast.data.model.DataSetDescriptor
All Implemented Interfaces:
Serializable, IValidatable, Identifiable
Direct Known Subclasses:
DomainDataSetDescriptor, PresentationDataSetDescriptor, VisualDataSetDescriptor

public class DataSetDescriptor
extends Object
implements Identifiable, IValidatable

Descriptor of a data set (see IDataSet).

The descriptor holds the basic data concerning the described data set, such as:

Author:
AGH CAST Team
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface pl.edu.agh.cast.data.model.Identifiable
Identifiable.Properties
 
Constructor Summary
DataSetDescriptor()
          Default constructor.
DataSetDescriptor(Type type)
          Initializes descriptor with type.
DataSetDescriptor(Type type, String name)
          Constructor for descriptors of new data sets.
DataSetDescriptor(Type type, UUID id, String name, Date creationDate)
          Constructor.
 
Method Summary
protected  boolean checkIfValid()
          Checks if the attributes of this description are valid.
 boolean equals(Object that)
          
 Date getCreationDate()
           
 UUID getId()
          Returns the ID of the data set.
 String getName()
           
 Type getType()
          Returns the type of the data set.
 int hashCode()
          
 boolean isValid()
          Checks if this description is valid.
 void setCreationDate(Date creationDate)
           
 void setId(UUID id)
          Sets the ID of the data set.
 void setName(String name)
           
 void setType(Type type)
          Sets the type of the data set.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataSetDescriptor

public DataSetDescriptor()
Default constructor.

Usage of this constructor is discouraged, since it does not provide any integrity control. If, however, this constructor is used, the isValid() method should be called in order to check the integrity.


DataSetDescriptor

public DataSetDescriptor(Type type)
Initializes descriptor with type. The ID has to be set manually - until then the data set descriptor is invalid.

Parameters:
type - the data set type

DataSetDescriptor

public DataSetDescriptor(Type type,
                         String name)
Constructor for descriptors of new data sets.

The new descriptor has a random ID and current creation date.

Parameters:
type - the data set type
name - the data set name

DataSetDescriptor

public DataSetDescriptor(Type type,
                         UUID id,
                         String name,
                         Date creationDate)
Constructor.

Parameters:
type - the data set type
id - the data set ID
name - the data set name
creationDate - the data set creation date
Method Detail

isValid

public final boolean isValid()
Checks if this description is valid.

Data set description is valid when the ID and type (subtype of IDataSet.TYPE) are configured.

Specified by:
isValid in interface IValidatable
Returns:
true if this description is valid, false otherwise

checkIfValid

protected boolean checkIfValid()
Checks if the attributes of this description are valid.

This method is called by the isValid() method. By default it always returns true, however it can be overridden in order to define new validation rules. In such case the implementation from base class should be called inside the overridden method in order to preserve data consistency.

Returns:
true if attributes of this descriptor are valid, false otherwise

getId

public final UUID getId()
Returns the ID of the data set.

Specified by:
getId in interface Identifiable
Returns:
the ID of the data set

setId

public final void setId(UUID id)
Sets the ID of the data set. The ID cannot be changed.

Parameters:
id - the data set ID
Throws:
ModelException - if the ID is already set and it is not equal to given one
IllegalArgumentException - if the given ID is null

getType

public final Type getType()
Returns the type of the data set.

Specified by:
getType in interface Identifiable
Returns:
the type of the data set

setType

public final void setType(Type type)
Sets the type of the data set. This method may be called only once, if the type is not set yet.

Parameters:
type - the data set type
Throws:
ModelException - if the type is already set
IllegalArgumentException - if the given type is null or is not a type of data set

getName

public final String getName()

setName

public final void setName(String name)

getCreationDate

public Date getCreationDate()

setCreationDate

public void setCreationDate(Date creationDate)

equals

public final boolean equals(Object that)

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

hashCode

public final int hashCode()

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


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