Package org.openxava.model.meta
Class MetaModel
java.lang.Object
org.openxava.util.meta.MetaElement
org.openxava.model.meta.MetaModel
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
MetaAggregate,MetaEntity
- Author:
- Javier Paniza
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInterfaceName(String name) voidaddMetaCalculatorPostCreate(MetaCalculator metaCalculator) voidaddMetaCalculatorPostLoad(MetaCalculator metaCalculator) voidaddMetaCalculatorPostModify(MetaCalculator metaCalculator) voidaddMetaCalculatorPreRemove(MetaCalculator metaCalculator) voidaddMetaCollection(MetaCollection newMetaCollection) voidaddMetaFinder(MetaFinder metaFinder) voidaddMetaMethod(MetaMethod metaMethod) voidaddMetaProperty(MetaProperty newMetaProperty) voidaddMetaReference(MetaReference newMetaReference) voidaddMetaValidator(MetaValidator metaValidator) voidaddMetaValidatorRemove(MetaValidator metaValidator) voidaddMetaView(MetaView newMetaView) booleancontainsMetaCollection(String collection) booleancontainsMetaProperty(String property) booleancontainsMetaPropertyView(String property) booleancontainsMetaReference(String reference) booleanbooleanstatic booleanexistsForPOJOClass(Class pojoClass) To ask if the pojo class has anMetaModelassociated.extractKeyValues(Map values) A map with the values that are keys in the sent map.extractSearchKeyValues(Map values) voidFill an already existing POJO corresponding to this model, and populate it with the sent values in map format.static MetaModelGets the MetaModel from its name.Includes qualified properties in case of key references, ordered alphabetically.Includes qualified properties in case of key references, ordered as in model.Include qualified properties in case of key references.static CollectionAll models (Entities and Aggregates) with a mapping associated.static CollectionAll models (Entities and Aggregates) where its POJO code and Hiberante mapping is generated.static MetaModelgetForPOJO(Object pojo) Gets the MetaModel for the pojo class specified.static MetaModelgetForPOJOClass(Class pojoClass) Gets the MetaModel for the pojo class specified.String in java format: comma separate interfaces namesKey properties names ordered in declaration order.Key reference names in undetermined order.abstract ModelMappingOrdered as in component definition file.getMetaCalculatorPostCreate(int idx) getMetaCalculatorPostLoad(int idx) getMetaCalculatorPostModify(int idx) getMetaCalculatorPreRemove(int idx) getMetaColectionsWithConditionReferenceTo(String modelName) getMetaCollection(String name) Container component of model.getMetaMember(String name) Key members.getMetaMethod(String name) If this is a aggregate the return the container, else the main entity.Ordered as in component definition.getMetaPropertiesPersistentsFromReference(String referenceName) Ordered as in component definition.Excludes calculator that implementsIHibernateIdGeneratorCalculator.getMetaProperty(String name) Support qualified for properties of references with dot (.).getMetaPropertyView(String name) getMetaReference(String name) getMetaView(String name) Ordered as in component definition.Class that contains the properties defined in this model.Ordered as in component definition.Ordered as in component definition.If entity the name of component, if aggregate the name of component + the name of aggregate.Does not include Transient properties and properties from collectionsDoes not include Transient propertiesDoes not include Transient properties and properties from collectionsDoes not include Transient propertiesSearchKey properties names ordered in declaration order.booleanbooleanbooleanbooleanbooleanbooleanisCalculated(String propertyName) booleanisHiddenKey(String name) booleanbooleanisKeyOrSearchKey(String name) booleanbooleanbooleanbooleanvoidsetAnnotatedEJB3(boolean annotatedEJB3) voidsetContainerModelName(String modelName) voidsetContainerReference(String containerReference) voidsetMetaComponent(MetaComponent metaComponent) Container component of model.voidsetPOJOClassName(String pojoClassName) voidsetPojoGenerated(boolean generated) voidsetPOJOKeyClass(Class pojoKeyClass) voidsetQualifiedName(String qualifiedName) If entity the name of component, if aggregate the name of component + the name of aggregate.voidsetXmlComponent(boolean xmlComponent) static booleanstatic booleanstatic booleanstatic booleanstatic booleanConvert an object of this model in a map of values with its key values.Convert an object of this model in a map of values.Create a POJO corresponding to this model, and populate it with the sent values in map format.toString()The string representation of models represented by this meta model, from a pojo object.The string representation of models represented by this meta model, from a map with its values.Methods inherited from class org.openxava.util.meta.MetaElement
getDescription, getDescription, getDescription, getDescription, getId, getLabel, getLabel, getLabel, getLabel, getLocale, getName, getPlaceholder, getPlaceholder, getPlaceholder, has18nLabel, hasName, setDescription, setLabel, setName, setPlaceholder
-
Constructor Details
-
MetaModel
public MetaModel()
-
-
Method Details
-
getAllPersistent
All models (Entities and Aggregates) with a mapping associated.- Returns:
- of type MetaModel
- Throws:
XavaException
-
getAllPojoGenerated
All models (Entities and Aggregates) where its POJO code and Hiberante mapping is generated.- Returns:
- of type MetaModel
- Throws:
XavaException
-
addMetaFinder
-
addMetaMethod
-
addMetaCalculatorPostCreate
-
addMetaCalculatorPostLoad
-
addMetaCalculatorPostModify
-
addMetaCalculatorPreRemove
-
addMetaValidator
-
addMetaValidatorRemove
-
getQualifiedName
If entity the name of component, if aggregate the name of component + the name of aggregate. -
setQualifiedName
If entity the name of component, if aggregate the name of component + the name of aggregate. -
getMetaFinders
- Returns:
- Collection of MetaFinder. Not null
-
getMetaMethods
- Returns:
- Collection of MetaMethod. Not null
-
addMetaProperty
- Parameters:
newMetaProperty- not null- Throws:
XavaException
-
hasDefaultCalculatorOnCreate
public boolean hasDefaultCalculatorOnCreate() -
addMetaReference
- Parameters:
newMetaReference- not null- Throws:
XavaException
-
addMetaView
- Throws:
XavaException
-
addMetaCollection
- Parameters:
newMetaCollection- not null
-
containsMetaProperty
-
containsMetaPropertyView
-
containsMetaReference
-
containsMetaCollection
-
getPropertiesClass
Class that contains the properties defined in this model.- Returns:
- Not null
- Throws:
XavaException
-
getMetaMember
-
getMetaProperty
Support qualified for properties of references with dot (.). -
getMetaPropertyView
-
getMetaReference
- Parameters:
name- May be qualified, that is myreference.mynestedreference- Throws:
ElementNotFoundExceptionXavaException
-
getMetaMethod
-
getMetaCollection
- Parameters:
name- May be qualified, that is mycollection.mynestedcollection- Throws:
ElementNotFoundExceptionXavaException
-
getMetaView
-
getMetaViews
- Throws:
XavaException
-
getMembersNames
Ordered as in component definition file.- Returns:
- Not null, read only and serializable
-
getMembersNamesNestingAggregates
-
getPropertiesNames
Ordered as in component definition.- Returns:
- Not null, read only and serializable
-
getReferencesNames
- Returns:
- Not null, read only and serializable
-
getColectionsNames
- Returns:
- Not null, read only and serializable
-
getEntityReferencesNames
- Throws:
XavaException
-
getAggregateReferencesNames
- Throws:
XavaException
-
getMetaCollectionsAgregate
- Returns:
- Collection of MetaCollection, not null and read only
- Throws:
XavaException
-
getRequiredPropertiesNames
- Returns:
- Collection of String, not null and read only
- Throws:
XavaException
-
getRequiredMemberNames
- Returns:
- Collection of String, not null and read only
- Throws:
XavaException
-
getSarchKeyPropertiesNames
SearchKey properties names ordered in declaration order.- Throws:
XavaException- Since:
- 7.4.4
-
getKeyPropertiesNames
Key properties names ordered in declaration order.- Returns:
- Collection of String, not null and read only
- Throws:
XavaException
-
getKeyReferencesNames
Key reference names in undetermined order.- Returns:
- Collection of String, not null and read only
- Throws:
XavaException
-
getAllKeyPropertiesNames
Includes qualified properties in case of key references, ordered alphabetically.- Returns:
- Collection of String, not null and read only
- Throws:
XavaException
-
getAllKeyPropertiesNamesOrderedAsInModel
Includes qualified properties in case of key references, ordered as in model.- Returns:
- Collection of String, not null and read only
- Throws:
XavaException- Since:
- 7.2.1
-
getPropertiesNamesWithoutHiddenNorTransient
Ordered as in component definition.Calculated properties are included.
- Returns:
- Collection of String, not null and read only
- Throws:
XavaException
-
getMetaPropertiesKey
- Returns:
- Collection of MetaProperty, not null and read only
- Throws:
XavaException
-
getMetaMembersKey
Key members.- Returns:
- Collection of MetaMember, not null and read only
- Throws:
XavaException
-
getAllMetaPropertiesKey
Include qualified properties in case of key references. <p<- Returns:
- Collection of MetaProperty, not null and read only
- Throws:
XavaException
-
getMetaPropertiesCalculated
- Returns:
- Collection of MetaProperty, not null and read only
- Throws:
XavaException
-
getOnlyReadPropertiesNames
- Returns:
- Collection of String, not null and read only
- Throws:
XavaException
-
getOnlyReadWithFormulaPropertiesNames
- Returns:
- Collection of String, not null and read only
- Throws:
XavaException
-
getCalculatedPropertiesNames
- Returns:
- Collection of String, not null and read only
-
getMetaPropertiesWithDefaultValueCalculator
-
getMetaPropertiesViewWithDefaultCalculator
-
getMetaReferencesWithDefaultValueCalculator
-
getMetaPropertiesPersistents
Ordered as in component definition.- Throws:
XavaException
-
getMetaPropertiesPersistentsFromReference
public Collection getMetaPropertiesPersistentsFromReference(String referenceName) throws XavaException Ordered as in component definition.- Throws:
XavaException
-
getPersistentPropertiesNames
Ordered as in component definition.- Throws:
XavaException
-
getMetaPropertiesWithDefaultValueOnCreate
Excludes calculator that implementsIHibernateIdGeneratorCalculator.- Returns:
- Collection of String, not null and read only
- Throws:
XavaException
-
getMetaProperties
- Returns:
- Collection of MetaProperty, not null and read only
-
getMetaReferences
- Returns:
- Collection of MetaReference, not null and read only
-
getMetaEntityReferences
- Returns:
- Collection of MetaReference, not null and read only
- Throws:
XavaException
-
getMetaReferencesWithMapping
- Returns:
- Collection of MetaReference, not null and read only
- Throws:
XavaException
-
getMetaReferencesToEntity
- Returns:
- Collection of MetaReference, not null and read only
- Throws:
XavaException
-
getMetaReferencesKey
- Returns:
- Collection of MetaReference, not null and read only
- Throws:
XavaException
-
getMetaReferencesKeyAndSearchKey
- Returns:
- Collection of MetaReference, not null and read only
- Throws:
XavaException
-
getMetaAggregateReferences
- Returns:
- Collection of MetaReference, not null and read only
- Throws:
XavaException
-
getMetaCollections
- Returns:
- Collection of MetaCollection, not null and read only
-
getMetaViewByDefault
- Returns:
- Not null. If no view is set, then it will generate a default one
- Throws:
XavaException
-
getMetaViewOnlyKeys
- Throws:
XavaException- Since:
- 7.1.6
-
getMetaComponent
Container component of model.- Returns:
- Not null
-
setMetaComponent
Container component of model.- Parameters:
metaComponent- Not null
-
isCalculated
- Throws:
XavaException
-
toString
-
isPojoGenerated
public boolean isPojoGenerated() -
setPojoGenerated
public void setPojoGenerated(boolean generated) -
getMapping
- Throws:
XavaException
-
containsMetaReferenceWithModel
-
extractKeyValues
A map with the values that are keys in the sent map.- Parameters:
values- Not null- Returns:
- Not null
- Throws:
XavaException
-
extractSearchKeyValues
- Throws:
XavaException
-
extractKeyValuesFlattenEmbeddedIds
- Throws:
XavaException- Since:
- 6.2.2
-
isKeyOrSearchKey
- Throws:
XavaException
-
isKey
- Throws:
XavaException
-
isHiddenKey
- Throws:
XavaException
-
isVersion
- Throws:
XavaException
-
containsValidadors
public boolean containsValidadors() -
getMetaCalculatorsPostCreate
- Returns:
- Not null
-
getMetaCalculatorPostCreate
-
getMetaCalculatorsPostLoad
- Returns:
- Not null
-
getMetaCalculatorPostLoad
-
getMetaCalculatorsPreRemove
- Returns:
- Not null
-
getMetaCalculatorPreRemove
-
getMetaCalculatorsPostModify
- Returns:
- Not null
-
getMetaCalculatorPostModify
-
getMetaValidators
- Returns:
- Not null
-
getMetaValidatorsRemove
-
toPOJO
Create a POJO corresponding to this model, and populate it with the sent values in map format.- Parameters:
values- Values to populate the pojo. Can contains nested maps. Cannot be null- Throws:
XavaException
-
fillPOJO
Fill an already existing POJO corresponding to this model, and populate it with the sent values in map format.- Parameters:
values- Values to populate the pojo. Can contain nested maps. Cannot be null- Throws:
XavaException
-
toMap
Convert an object of this model in a map of values.The model object can be a POJO (of class in
getPOJOClass()) or any object that implements the interface of this model, that is, IInvoice, ICustomer, ISeller, etc. Hence you can use POJOs or EJB2 CMP beans, or whatever object that implements the interface.- Parameters:
modelObject-- Returns:
- if modelObject is null returns an empty map
- Throws:
XavaException
-
toKeyMap
Convert an object of this model in a map of values with its key values.The model object can be a POJO (of class in
getPOJOClass()) or any object that implements the interface of this model, that is, IInvoice, ICustomer, ISeller, etc. Hence you can use POJOs or EJB2 CMP beans, or whatever object that implements the interface.- Parameters:
modelObject-- Returns:
- if modelObject is null returns an empty map
- Throws:
XavaException
-
toString
The string representation of models represented by this meta model, from a map with its values.- Returns:
- null if the sent map is null, empty or all values are null
- Throws:
XavaException
-
toString
The string representation of models represented by this meta model, from a pojo object.- Returns:
- null if the sent object is null
- Throws:
XavaException
-
getViewPropertiesNames
-
getMetaPropertiesView
-
getMetaModelContainer
If this is a aggregate the return the container, else the main entity.- Returns:
- Not null
- Throws:
XavaException
-
setContainerModelName
-
getContainerModelName
-
getMetaCollectionsWithConditionInOthersModels
- Throws:
XavaException
-
getMetaColectionsWithConditionReferenceTo
-
addInterfaceName
-
getInterfacesNames
-
getImplements
String in java format: comma separate interfaces names -
getRecursiveQualifiedPropertiesNames
Does not include Transient properties and properties from collections- Throws:
XavaException
-
getRecursiveQualifiedPropertiesNamesUntilSecondLevel
Does not include Transient properties and properties from collections- Throws:
XavaException- Since:
- 4.9
-
getRecursiveQualifiedPropertiesNamesIncludingCollections
public Collection<String> getRecursiveQualifiedPropertiesNamesIncludingCollections() throws XavaExceptionDoes not include Transient properties- Throws:
XavaException- Since:
- 6.5
-
getRecursiveQualifiedPropertiesNamesUntilSecondLevelIncludingCollections
public Collection<String> getRecursiveQualifiedPropertiesNamesUntilSecondLevelIncludingCollections() throws XavaExceptionDoes not include Transient properties- Throws:
XavaException- Since:
- 6.5
-
get
Gets the MetaModel from its name.Qualified names are supported, that is you can use:
MetaModel.get("Invoice.InvoceDetail");If InvoiceDetail is a aggregate of Invoice component.For obtaining the entity metamodel you can use the name of the component, in this way
MetaModel.get("Invoice");- Throws:
ElementNotFoundException- If the component does not have associated any MetaModelXavaException- Any problem
-
getForPOJO
Gets the MetaModel for the pojo class specified.- Throws:
ElementNotFoundException- If the pojo does not have associated any MetaModelXavaException- Any problem
-
getForPOJOClass
public static MetaModel getForPOJOClass(Class pojoClass) throws ElementNotFoundException, XavaException Gets the MetaModel for the pojo class specified.- Throws:
ElementNotFoundException- If the pojoClass does not have associated any MetaModelXavaException- Any problem
-
existsForPOJOClass
To ask if the pojo class has anMetaModelassociated.- Throws:
Exception
-
getInterfaceName
- Throws:
XavaException
-
isPOJOAvailable
public boolean isPOJOAvailable()- Since:
- 5.6.1
-
getPOJOClassName
- Throws:
XavaException
-
setPOJOClassName
- Throws:
XavaException
-
getPOJOClass
- Throws:
XavaException
-
getPOJOKeyClass
- Throws:
XavaException
-
setPOJOKeyClass
-
isAnnotatedEJB3
public boolean isAnnotatedEJB3() -
setAnnotatedEJB3
public void setAnnotatedEJB3(boolean annotatedEJB3) -
getVersionPropertyName
- Throws:
XavaException
-
hasVersionProperty
- Throws:
XavaException
-
hasDateTimeProperty
public boolean hasDateTimeProperty() -
hasHiddenKey
public boolean hasHiddenKey() -
someModelHasDefaultCalculatorOnCreate
public static boolean someModelHasDefaultCalculatorOnCreate() -
someModelHasPostCreateCalculator
public static boolean someModelHasPostCreateCalculator() -
someModelHasPostModifyCalculator
public static boolean someModelHasPostModifyCalculator() -
someModelHasPreRemoveCalculator
public static boolean someModelHasPreRemoveCalculator() -
someModelHasPostLoadCalculator
public static boolean someModelHasPostLoadCalculator() -
getContainerReference
-
setContainerReference
-
isXmlComponent
public boolean isXmlComponent()- Since:
- 5.6
-
setXmlComponent
public void setXmlComponent(boolean xmlComponent) - Since:
- 5.6
-