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 voidaddPropertyMapping(PropertyMapping propertyMapping)voidaddReferenceMapping(ReferenceMapping referenceMapping)java.lang.StringchangePropertiesByCMPAttributes(java.lang.String source)java.lang.StringchangePropertiesByColumns(java.lang.String source)Change the properties inside ${ } by the database qualified(schema + table) columns.java.lang.StringchangePropertiesByNotQualifiedColumns(java.lang.String source)Change the properties inside ${ } by the database columns without table and schema as prefix.voidfillWithDefaultValues()java.util.CollectiongetCmpFields()java.lang.StringgetColumn(java.lang.String modelProperty)Support the use of references with dots, this is: myreference.myproperty.java.util.CollectiongetColumns()In the order that they was added.IConvertergetConverter(java.lang.String modelProperty)java.lang.StringgetKeyColumnsAsString()MetaComponentgetMetaComponent()abstract MetaModelgetMetaModel()abstract java.lang.StringgetModelName()java.util.CollectiongetModelProperties()In the order that they was added.IMultipleConvertergetMultipleConverter(java.lang.String modelProperty)java.util.CollectiongetOverlappingPropertiesOfReference(java.lang.String reference)java.lang.StringgetOverlappingPropertyForReference(java.lang.String reference, java.lang.String propertyOfReference)PropertyMappinggetPropertyMapping(java.lang.String name)java.util.CollectiongetPropertyMappingsNotInModel()java.lang.StringgetQualifiedColumn(java.lang.String modelProperty)ReferenceMappinggetReferenceMapping(java.lang.String name)java.util.CollectiongetReferenceMappingsWithConverter()java.lang.StringgetSchema()java.lang.StringgetTable()java.lang.StringgetTableToQualifyColumn()java.lang.ClassgetType(java.lang.String propertyName)Util specially to find out the type of properties that are not in model, only in mapping.java.lang.StringgetUnqualifiedTable()booleanhasConverter(java.lang.String propertyName)If the property exists and has converter.booleanhasPropertyMapping(java.lang.String memberName)booleanhasReferenceConverters()booleanhasReferenceMapping(MetaReference metaReference)booleanisReferenceOverlappingWithSomeProperty(java.lang.String reference)booleanisReferenceOverlappingWithSomeProperty(java.lang.String reference, java.lang.String propertiesOfReference)booleanisReferencePropertyOverlappingWithSomeProperty(java.lang.String qualifiedProperty)java.lang.StringmonthSQLFunction(java.lang.String column)Wraps the column name with the SQL function for extracting the month from a date.voidsetMetaComponent(MetaComponent componente)voidsetTable(java.lang.String tabla)java.lang.StringtranslateSQLFunction(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.StringyearSQLFunction(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 XavaExceptionUtil 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:
XavaExceptionElementNotFoundException
-
getPropertyMapping
public PropertyMapping getPropertyMapping(java.lang.String name) throws XavaException, ElementNotFoundException
- Returns:
- Not null
- Throws:
XavaExceptionElementNotFoundException
-
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, XavaExceptionSupport 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 XavaExceptionChange 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 XavaExceptionChange 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()
-
-