Package org.openxava.mapping
Class ModelMapping
- java.lang.Object
-
- org.openxava.mapping.ModelMapping
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
AggregateMapping
,EntityMapping
public abstract class ModelMapping extends java.lang.Object implements java.io.Serializable
- Author:
- Javier Paniza
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ModelMapping()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addPropertyMapping(PropertyMapping propertyMapping)
void
addReferenceMapping(ReferenceMapping referenceMapping)
java.lang.String
changePropertiesByCMPAttributes(java.lang.String source)
java.lang.String
changePropertiesByColumns(java.lang.String source)
Change the properties inside ${ } by the database qualified(schema + table) columns.java.lang.String
changePropertiesByNotQualifiedColumns(java.lang.String source)
Change the properties inside ${ } by the database columns without table and schema as prefix.void
fillWithDefaultValues()
java.util.Collection
getCmpFields()
java.lang.String
getColumn(java.lang.String modelProperty)
Support the use of references with dots, this is: myreference.myproperty.java.util.Collection
getColumns()
In the order that they was added.IConverter
getConverter(java.lang.String modelProperty)
java.lang.String
getKeyColumnsAsString()
MetaComponent
getMetaComponent()
abstract MetaModel
getMetaModel()
abstract java.lang.String
getModelName()
java.util.Collection
getModelProperties()
In the order that they was added.IMultipleConverter
getMultipleConverter(java.lang.String modelProperty)
java.util.Collection
getOverlappingPropertiesOfReference(java.lang.String reference)
java.lang.String
getOverlappingPropertyForReference(java.lang.String reference, java.lang.String propertyOfReference)
PropertyMapping
getPropertyMapping(java.lang.String name)
java.util.Collection
getPropertyMappingsNotInModel()
java.lang.String
getQualifiedColumn(java.lang.String modelProperty)
ReferenceMapping
getReferenceMapping(java.lang.String name)
java.util.Collection
getReferenceMappingsWithConverter()
java.lang.String
getSchema()
java.lang.String
getTable()
java.lang.String
getTableToQualifyColumn()
java.lang.Class
getType(java.lang.String propertyName)
Util specially to find out the type of properties that are not in model, only in mapping.java.lang.String
getUnqualifiedTable()
boolean
hasConverter(java.lang.String propertyName)
If the property exists and has converter.boolean
hasPropertyMapping(java.lang.String memberName)
boolean
hasReferenceConverters()
boolean
hasReferenceMapping(MetaReference metaReference)
boolean
isReferenceOverlappingWithSomeProperty(java.lang.String reference)
boolean
isReferenceOverlappingWithSomeProperty(java.lang.String reference, java.lang.String propertiesOfReference)
boolean
isReferencePropertyOverlappingWithSomeProperty(java.lang.String qualifiedProperty)
java.lang.String
monthSQLFunction(java.lang.String column)
Wraps the column name with the SQL function for extracting the month from a date.void
setMetaComponent(MetaComponent componente)
void
setTable(java.lang.String tabla)
java.lang.String
translateSQLFunction(java.lang.String column)
To ignore accents: just to search 'cami�n' or 'camion' Good performance using 'translate' but is very slow when it use 'replace...'java.lang.String
yearSQLFunction(java.lang.String column)
Wraps the column name with the SQL function for extracting the year from a date.
-
-
-
Method Detail
-
getModelName
public abstract java.lang.String getModelName() throws XavaException
- Throws:
XavaException
-
getMetaModel
public abstract MetaModel getMetaModel() throws XavaException
- Throws:
XavaException
-
fillWithDefaultValues
public void fillWithDefaultValues()
- Since:
- 5.6
-
getType
public java.lang.Class getType(java.lang.String propertyName) throws XavaException
Util specially to find out the type of properties that are not in model, only in mapping.- Throws:
XavaException
-
getTable
public java.lang.String getTable()
-
setTable
public void setTable(java.lang.String tabla)
-
getSchema
public java.lang.String getSchema()
-
getUnqualifiedTable
public java.lang.String getUnqualifiedTable()
-
getTableToQualifyColumn
public java.lang.String getTableToQualifyColumn()
-
addPropertyMapping
public void addPropertyMapping(PropertyMapping propertyMapping) throws XavaException
- Throws:
XavaException
-
addReferenceMapping
public void addReferenceMapping(ReferenceMapping referenceMapping) throws XavaException
- Throws:
XavaException
-
getReferenceMapping
public ReferenceMapping getReferenceMapping(java.lang.String name) throws XavaException, ElementNotFoundException
- Returns:
- Not null
- Throws:
XavaException
ElementNotFoundException
-
getPropertyMapping
public PropertyMapping getPropertyMapping(java.lang.String name) throws XavaException, ElementNotFoundException
- Returns:
- Not null
- Throws:
XavaException
ElementNotFoundException
-
getModelProperties
public java.util.Collection getModelProperties()
In the order that they was added.- Returns:
- Collection of String.
-
getColumns
public java.util.Collection getColumns()
In the order that they was added.- Returns:
- Collection of String.
-
getKeyColumnsAsString
public java.lang.String getKeyColumnsAsString() throws XavaException
- Throws:
XavaException
-
yearSQLFunction
public java.lang.String yearSQLFunction(java.lang.String column)
Wraps the column name with the SQL function for extracting the year from a date.
-
monthSQLFunction
public java.lang.String monthSQLFunction(java.lang.String column)
Wraps the column name with the SQL function for extracting the month from a date.
-
translateSQLFunction
public java.lang.String translateSQLFunction(java.lang.String column)
To ignore accents: just to search 'cami�n' or 'camion' Good performance using 'translate' but is very slow when it use 'replace...'- Since:
- v4m6
-
getQualifiedColumn
public java.lang.String getQualifiedColumn(java.lang.String modelProperty) throws XavaException
- Throws:
XavaException
-
getColumn
public java.lang.String getColumn(java.lang.String modelProperty) throws ElementNotFoundException, XavaException
Support the use of references with dots, this is: myreference.myproperty.
-
getConverter
public IConverter getConverter(java.lang.String modelProperty) throws ElementNotFoundException, XavaException
- Returns:
- nulo If property exists but it does not have converter.
- Throws:
ElementNotFoundException
- If property does not exist.XavaException
- Any problem
-
getMultipleConverter
public IMultipleConverter getMultipleConverter(java.lang.String modelProperty) throws ElementNotFoundException, XavaException
- Returns:
- nulo If property exists but it does not have converter.
- Throws:
ElementNotFoundException
- If property does not exist.XavaException
- Any problem
-
hasConverter
public boolean hasConverter(java.lang.String propertyName)
If the property exists and has converter.
-
getMetaComponent
public MetaComponent getMetaComponent()
-
setMetaComponent
public void setMetaComponent(MetaComponent componente) throws XavaException
- Throws:
XavaException
-
changePropertiesByColumns
public java.lang.String changePropertiesByColumns(java.lang.String source) throws XavaException
Change the properties inside ${ } by the database qualified(schema + table) columns. Also if the property inside ${ } is a model name it changes by the table nameFor example, it would change:
select ${number}, ${name} from ${Tercero}
byselect G4GENBD.GENTGER.TGRCOD, G4GENBD.GENTGER.TGRDEN from G4GENBD.GENTGER
- Throws:
XavaException
-
changePropertiesByNotQualifiedColumns
public java.lang.String changePropertiesByNotQualifiedColumns(java.lang.String source) throws XavaException
Change the properties inside ${ } by the database columns without table and schema as prefix. Also if the property inside ${ } is a model name it changes by the table name.For example, it would change:
select ${number}, ${name} from ${Tercero}
byselect TGRCOD, TGRDEN from G4GENBD.GENTGER
- Throws:
XavaException
-
changePropertiesByCMPAttributes
public java.lang.String changePropertiesByCMPAttributes(java.lang.String source) throws XavaException
- Throws:
XavaException
-
hasPropertyMapping
public boolean hasPropertyMapping(java.lang.String memberName)
-
hasReferenceMapping
public boolean hasReferenceMapping(MetaReference metaReference)
-
isReferenceOverlappingWithSomeProperty
public boolean isReferenceOverlappingWithSomeProperty(java.lang.String reference, java.lang.String propertiesOfReference) throws XavaException
- Throws:
XavaException
-
isReferenceOverlappingWithSomeProperty
public boolean isReferenceOverlappingWithSomeProperty(java.lang.String reference) throws XavaException
- Throws:
XavaException
-
isReferencePropertyOverlappingWithSomeProperty
public boolean isReferencePropertyOverlappingWithSomeProperty(java.lang.String qualifiedProperty) throws XavaException
- Throws:
XavaException
-
getOverlappingPropertyForReference
public java.lang.String getOverlappingPropertyForReference(java.lang.String reference, java.lang.String propertyOfReference) throws XavaException
- Throws:
XavaException
- If it does not have a overlapped property, or any other problem.
-
getOverlappingPropertiesOfReference
public java.util.Collection getOverlappingPropertiesOfReference(java.lang.String reference) throws XavaException
- Returns:
- Of String and not null.
- Throws:
XavaException
-
getPropertyMappingsNotInModel
public java.util.Collection getPropertyMappingsNotInModel() throws XavaException
- Throws:
XavaException
-
getCmpFields
public java.util.Collection getCmpFields() throws XavaException
- Throws:
XavaException
-
hasReferenceConverters
public boolean hasReferenceConverters()
-
getReferenceMappingsWithConverter
public java.util.Collection getReferenceMappingsWithConverter()
-
-