net.sf.webmancer.db
Class AbstractAttribute

java.lang.Object
  extended by net.sf.webmancer.db.AbstractAttribute
All Implemented Interfaces:
IAttribute, IBackEndAttributeInformation, IFrontEndAttributeInformation
Direct Known Subclasses:
DecimalAttribute, StringAttribute

public abstract class AbstractAttribute
extends java.lang.Object
implements IAttribute

Author:
Michal Burda

Constructor Summary
AbstractAttribute()
           
 
Method Summary
abstract  java.lang.Object convertDbToInternal(java.lang.Object dbValue)
           
abstract  java.lang.String convertInternalToInput(java.lang.Object internal)
           
abstract  java.lang.String convertInternalToOutput(java.lang.Object internal)
           
 java.lang.String getDescription()
          Gets the description of the attribute.
 java.lang.String getId()
          Gets the identification string of the attribute (must be unique in DataSet).
 java.lang.String getInitialValue()
          Gets the value that is used as initial if a new record is edited by a user.
 int getMaximumInputLength()
          Returns -1, which means unlimited length of user input.
 java.lang.String getName()
          Gets the human readable name of the attribute.
 IDataSet getParentDataSet()
          Gets IDataSet the attribute belongs to.
 boolean isDerived()
          Returns true if the attribute's value is derived (computed) from some others' attributes' values.
 boolean isInDatabase()
          Returns true if the attribute is directly stored in the persistent storage.
 boolean isMandatory()
          Determines whether the attribute is mandatory, i.e. it must always have a value assigned to it.
 boolean isPrimaryKey()
          Returns true if the attribute is a primary key of parent dataset.
 java.lang.String preProcessConditionInput(java.lang.String input)
           
 java.lang.String preProcessInput(java.lang.String input)
           
 void setDerived(boolean derived)
          Sets the derived.
 void setDescription(java.lang.String description)
          Sets the description.
 void setId(java.lang.String id)
          Sets the id.
 void setInDatabase(boolean inDatabase)
          Sets the inDatabase.
 void setInitialValue(java.lang.String initialValue)
          Sets the initialValue.
 void setMandatory(boolean mandatory)
          Sets the mandatory.
 void setName(java.lang.String name)
          Sets the name.
 void setParentDataSet(IDataSet parent)
          Sets the parent.
 void setPrimary(boolean primary)
          Sets the primary.
 java.util.Collection<java.lang.String> validateInput(java.lang.String input)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAttribute

public AbstractAttribute()
Method Detail

getDescription

public java.lang.String getDescription()
Description copied from interface: IFrontEndAttributeInformation
Gets the description of the attribute. It contains some help text for users.

Specified by:
getDescription in interface IFrontEndAttributeInformation
Returns:
The description of the attribute.
See Also:
IFrontEndAttributeInformation.getDescription()

getInitialValue

public java.lang.String getInitialValue()
Description copied from interface: IFrontEndAttributeInformation
Gets the value that is used as initial if a new record is edited by a user.

Specified by:
getInitialValue in interface IFrontEndAttributeInformation
Returns:
the value used to initialize empty entries if a new record is edited by a user.
See Also:
IFrontEndAttributeInformation.getInitialValue()

getName

public java.lang.String getName()
Description copied from interface: IFrontEndAttributeInformation
Gets the human readable name of the attribute. This name appears in various widgets to describe attribute value (e.g. as header in DataTable, input-line label in input forms etc.).

Specified by:
getName in interface IFrontEndAttributeInformation
Returns:
The human readable name of the attribute.
See Also:
IFrontEndAttributeInformation.getName()

isMandatory

public boolean isMandatory()
Description copied from interface: IFrontEndAttributeInformation
Determines whether the attribute is mandatory, i.e. it must always have a value assigned to it.

Specified by:
isMandatory in interface IFrontEndAttributeInformation
Returns:
true if the attribute is mandatory.
See Also:
IFrontEndAttributeInformation.isMandatory()

getId

public java.lang.String getId()
Gets the identification string of the attribute (must be unique in DataSet).

Returns:
The identification string of the attribute
See Also:
ICommonAttributeInformation.getId()

getParentDataSet

public IDataSet getParentDataSet()
Gets IDataSet the attribute belongs to.

Returns:
The IDataSet the attribute belongs to.
See Also:
ICommonAttributeInformation.getParentDataSet()

isPrimaryKey

public boolean isPrimaryKey()
Returns true if the attribute is a primary key of parent dataset.

Returns:
true if the attribute is a primary key of parent dataset.
See Also:
ICommonAttributeInformation.isPrimaryKey()

isDerived

public boolean isDerived()
Description copied from interface: IBackEndAttributeInformation
Returns true if the attribute's value is derived (computed) from some others' attributes' values. If false, the attribute's value is not computed, i.e. it is always specified by the user.

Specified by:
isDerived in interface IBackEndAttributeInformation
Returns:
true if the attribute's value is derived from values of other attributes, false otherwise.
See Also:
IBackEndAttributeInformation.isDerived()

isInDatabase

public boolean isInDatabase()
Description copied from interface: IBackEndAttributeInformation
Returns true if the attribute is directly stored in the persistent storage. If false, the attribute represents information that has not to be directly stored in the database, e.g. if this attribute's value is used in computation of some other's attribute value.

Specified by:
isInDatabase in interface IBackEndAttributeInformation
Returns:
true if the attribute is directly stored in the database, false otherwise.
See Also:
IBackEndAttributeInformation.isInDatabase()

setDerived

public void setDerived(boolean derived)
Sets the derived.

Parameters:
derived - the derived to set

setDescription

public void setDescription(java.lang.String description)
Sets the description.

Parameters:
description - the description to set

setId

public void setId(java.lang.String id)
Sets the id.

Parameters:
id - the id to set

setInDatabase

public void setInDatabase(boolean inDatabase)
Sets the inDatabase.

Parameters:
inDatabase - the inDatabase to set

setInitialValue

public void setInitialValue(java.lang.String initialValue)
Sets the initialValue.

Parameters:
initialValue - the initialValue to set

setMandatory

public void setMandatory(boolean mandatory)
Sets the mandatory.

Parameters:
mandatory - the mandatory to set

setName

public void setName(java.lang.String name)
Sets the name.

Parameters:
name - the name to set

setParentDataSet

public void setParentDataSet(IDataSet parent)
Sets the parent.

Parameters:
parent - the parent to set

setPrimary

public void setPrimary(boolean primary)
Sets the primary.

Parameters:
primary - the primary to set

preProcessConditionInput

public java.lang.String preProcessConditionInput(java.lang.String input)
Specified by:
preProcessConditionInput in interface IFrontEndAttributeInformation
Returns:
See Also:
IFrontEndAttributeInformation.preProcessConditionInput(java.lang.String)

preProcessInput

public java.lang.String preProcessInput(java.lang.String input)
Specified by:
preProcessInput in interface IFrontEndAttributeInformation
Returns:
See Also:
IFrontEndAttributeInformation.preProcessInput(java.lang.String)

validateInput

public java.util.Collection<java.lang.String> validateInput(java.lang.String input)
Specified by:
validateInput in interface IFrontEndAttributeInformation
Returns:
See Also:
IFrontEndAttributeInformation.validateInput(java.lang.String)

getMaximumInputLength

public int getMaximumInputLength()
Returns -1, which means unlimited length of user input.

Specified by:
getMaximumInputLength in interface IFrontEndAttributeInformation
Returns:
the maximum allowed length of user input string or negative value for unlimited lenght.
See Also:
IFrontEndAttributeInformation.getMaximumInputLength()

convertInternalToInput

public abstract java.lang.String convertInternalToInput(java.lang.Object internal)
Specified by:
convertInternalToInput in interface IFrontEndAttributeInformation
Returns:
See Also:
IFrontEndAttributeInformation.convertInternalToInput(java.lang.Object)

convertInternalToOutput

public abstract java.lang.String convertInternalToOutput(java.lang.Object internal)
Specified by:
convertInternalToOutput in interface IFrontEndAttributeInformation
Returns:
See Also:
IFrontEndAttributeInformation.convertInternalToOutput(java.lang.Object)

convertDbToInternal

public abstract java.lang.Object convertDbToInternal(java.lang.Object dbValue)
Specified by:
convertDbToInternal in interface IBackEndAttributeInformation
Returns:
See Also:
IBackEndAttributeInformation.convertDbToInternal(java.lang.Object)


Copyright © 2006-2007. All Rights Reserved.