Class BaseForeignKeyDomainType
- java.lang.Object
-
- org.openbravo.base.model.domaintype.BaseDomainType
-
- org.openbravo.base.model.domaintype.BaseForeignKeyDomainType
-
- All Implemented Interfaces:
DomainType
,ForeignKeyDomainType
- Direct Known Subclasses:
OneToManyDomainType
,SearchDomainType
,SelectorDomainType
,TableDirDomainType
,TableDomainType
,TreeDomainType
public abstract class BaseForeignKeyDomainType extends BaseDomainType implements ForeignKeyDomainType
The base class for property types which refer to an entity (foreign key).- Author:
- mtaal
-
-
Constructor Summary
Constructors Constructor Description BaseForeignKeyDomainType()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkIsValidValue(Property property, Object value)
Checks if a certain value is valid according to the type of the reference.Column
getForeignKeyColumn(String columnName)
The foreign key column to which a certain column refers.protected Entity
getReferedEntity(Property property)
Returns the entity refered to by this foreign key domain type.protected String
getReferedTableName(String columnName)
Needs to be implemented by subclass.-
Methods inherited from class org.openbravo.base.model.domaintype.BaseDomainType
checkObjectIsValid, getClasses, getModelProvider, getReference, initialize, setModelProvider, setReference
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openbravo.base.model.domaintype.DomainType
checkObjectIsValid, getModelProvider, getReference, initialize, setModelProvider, setReference
-
-
-
-
Method Detail
-
getForeignKeyColumn
public Column getForeignKeyColumn(String columnName)
Description copied from interface:ForeignKeyDomainType
The foreign key column to which a certain column refers. Is only relevant if this reference is a foreign key.- Specified by:
getForeignKeyColumn
in interfaceForeignKeyDomainType
- Parameters:
columnName
- the refering foreign key column- Returns:
- the refered to column based on the table encoded in the table name of the passed column. This method also handles exceptional column names in a specific way.
-
getReferedTableName
protected String getReferedTableName(String columnName)
Needs to be implemented by subclass. If the subclass can not return the tablename then it can return null. The tablename is used to check that valid object is set in properties with this domain type.- Returns:
- the table name of the table name refered to by this domain type.
-
checkIsValidValue
public void checkIsValidValue(Property property, Object value) throws ValidationException
Description copied from interface:DomainType
Checks if a certain value is valid according to the type of the reference.- Specified by:
checkIsValidValue
in interfaceDomainType
- Parameters:
property
- the property which has this valuevalue
- the value- Throws:
ValidationException
-
getReferedEntity
protected Entity getReferedEntity(Property property)
Returns the entity refered to by this foreign key domain type. Note that for TableDir domain types this method always returns null.- Parameters:
property
- property for this domain type, the property is needed because the domain type is shared by different properties.- Returns:
- the entity to which this domain type refers, is null in case of TableDir.
-
-