org.faktorips.runtime.modeltype.internal
Class ModelTypeAssociation

java.lang.Object
  extended by org.faktorips.runtime.modeltype.internal.AbstractModelElement
      extended by org.faktorips.runtime.modeltype.internal.ModelTypeAssociation
All Implemented Interfaces:
IModelElement, IModelTypeAssociation

public class ModelTypeAssociation
extends AbstractModelElement
implements IModelTypeAssociation

Author:
Daniel Hohenberger

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.faktorips.runtime.modeltype.IModelTypeAssociation
IModelTypeAssociation.AssociationType
 
Field Summary
 
Fields inherited from interface org.faktorips.runtime.modeltype.IModelTypeAssociation
PROPERTY_ASSOCIATION_TYPE, PROPERTY_DERIVED_UNION, PROPERTY_INVERSE_ASSOCIATION, PROPERTY_MATCHING_ASSOCIATION_NAME, PROPERTY_MATCHING_ASSOCIATION_SOURCE, PROPERTY_MAX_CARDINALITY, PROPERTY_MIN_CARDINALITY, PROPERTY_NAME_PLURAL, PROPERTY_PRODUCT_RELEVANT, PROPERTY_SUBSET_OF_A_DERIVED_UNION, PROPERTY_TARGET, PROPERTY_TARGET_ROLE_PLURAL_REQUIRED, XML_TAG, XML_WRAPPER_TAG
 
Fields inherited from interface org.faktorips.runtime.modeltype.IModelElement
DESCRIPTIONS_PROPERTY_LOCALE, DESCRIPTIONS_XML_TAG, DESCRIPTIONS_XML_WRAPPER_TAG, EXTENSION_PROPERTIES_PROPERTY_ID, EXTENSION_PROPERTIES_PROPERTY_NULL, EXTENSION_PROPERTIES_XML_TAG, EXTENSION_PROPERTIES_XML_WRAPPER_TAG, LABELS_PROPERTY_LOCALE, LABELS_PROPERTY_PLURAL_VALUE, LABELS_PROPERTY_VALUE, LABELS_XML_TAG, LABELS_XML_WRAPPER_TAG, PROPERTY_NAME
 
Constructor Summary
ModelTypeAssociation(ModelType modelType)
           
 
Method Summary
 IModelTypeAssociation.AssociationType getAssociationType()
          Returns the type of this association.
 String getInverseAssociation()
          Returns the name of the inverse association if it is defined.
 String getLabelForPlural(Locale locale)
          Returns the plural label for the given locale.
 String getMatchingAssociationName()
          Returns the name of the matching product respectively policy component type association or null if no matching association is defined for this associations.
 String getMatchingAssociationSource()
          Returns the qualified target name of the matching product respectively policy component type association or null if no matching association is defined for component associations.
 int getMaxCardinality()
          Returns the maximum cardinality for this association.
 int getMinCardinality()
          Returns the minimum cardinality for this association.
 IModelType getModelType()
          Returns the model type this association belongs to.
 String getNamePlural()
          Returns the plural form of this model type's name or null if no plural for for the name is set.
 IModelType getTarget()
          Returns the target model type object of this association.
 List<IModelObject> getTargetObjects(IModelObject source)
          Returns a list of the target(s) of the given model object's association identified by this model type association.
 String getUsedName()
          Returns the singular or plural form of this model type's name as used in code generation depending on cardinality.
 void initFromXml(XMLStreamReader parser)
          Initializes the model element's state with the data stored in the xml element at the parser's current position.
protected  void initLabelFromXml(XMLStreamReader parser)
           
 boolean isDerivedUnion()
          Returns if this association is a derived union.
 boolean isProductRelevant()
          Returns if this association is product relevant.
 boolean isSubsetOfADerivedUnion()
          Returns if this association is a subset of a derived union.
 String toString()
           
 
Methods inherited from class org.faktorips.runtime.modeltype.internal.AbstractModelElement
getDescription, getExtensionPropertyIds, getExtensionPropertyValue, getLabel, getName, getRepository, initDescriptionsFromXml, initExtPropertiesFromXml, initLabelsFromXml, setExtensionPropertyValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.faktorips.runtime.modeltype.IModelElement
getDescription, getExtensionPropertyIds, getExtensionPropertyValue, getLabel, getName, getRepository, initExtPropertiesFromXml
 

Constructor Detail

ModelTypeAssociation

public ModelTypeAssociation(ModelType modelType)
Method Detail

getLabelForPlural

public String getLabelForPlural(Locale locale)
Description copied from interface: IModelTypeAssociation
Returns the plural label for the given locale.

Returns the association's plural name if no plural label for the given locale exists.

Specified by:
getLabelForPlural in interface IModelTypeAssociation

getModelType

public IModelType getModelType()
Description copied from interface: IModelTypeAssociation
Returns the model type this association belongs to.

Specified by:
getModelType in interface IModelTypeAssociation

getAssociationType

public IModelTypeAssociation.AssociationType getAssociationType()
Description copied from interface: IModelTypeAssociation
Returns the type of this association.

Specified by:
getAssociationType in interface IModelTypeAssociation

getMaxCardinality

public int getMaxCardinality()
Description copied from interface: IModelTypeAssociation
Returns the maximum cardinality for this association. Integer.MAX_VALUE if no maximum is set.

Specified by:
getMaxCardinality in interface IModelTypeAssociation

getMinCardinality

public int getMinCardinality()
Description copied from interface: IModelTypeAssociation
Returns the minimum cardinality for this association. 0 if no minimum is set.

Specified by:
getMinCardinality in interface IModelTypeAssociation

getNamePlural

public String getNamePlural()
Description copied from interface: IModelTypeAssociation
Returns the plural form of this model type's name or null if no plural for for the name is set.

Specified by:
getNamePlural in interface IModelTypeAssociation

getTarget

public IModelType getTarget()
                     throws ClassNotFoundException
Description copied from interface: IModelTypeAssociation
Returns the target model type object of this association.

Specified by:
getTarget in interface IModelTypeAssociation
Throws:
ClassNotFoundException - if the target class could not be loaded.

getTargetObjects

public List<IModelObject> getTargetObjects(IModelObject source)
Description copied from interface: IModelTypeAssociation
Returns a list of the target(s) of the given model object's association identified by this model type association.

Specified by:
getTargetObjects in interface IModelTypeAssociation
Parameters:
source - a model object corresponding to the IModelType this association belongs to
Returns:
a list of the target(s) of the given model object's association identified by this model type association

isProductRelevant

public boolean isProductRelevant()
Description copied from interface: IModelTypeAssociation
Returns if this association is product relevant.

Specified by:
isProductRelevant in interface IModelTypeAssociation

initFromXml

public void initFromXml(XMLStreamReader parser)
                 throws XMLStreamException
Description copied from interface: IModelElement
Initializes the model element's state with the data stored in the xml element at the parser's current position.

Specified by:
initFromXml in interface IModelElement
Overrides:
initFromXml in class AbstractModelElement
Throws:
XMLStreamException

initLabelFromXml

protected void initLabelFromXml(XMLStreamReader parser)
Overrides:
initLabelFromXml in class AbstractModelElement

toString

public String toString()
Overrides:
toString in class Object

getUsedName

public String getUsedName()
Description copied from interface: IModelTypeAssociation
Returns the singular or plural form of this model type's name as used in code generation depending on cardinality.

Specified by:
getUsedName in interface IModelTypeAssociation

isDerivedUnion

public boolean isDerivedUnion()
Description copied from interface: IModelTypeAssociation
Returns if this association is a derived union.

Specified by:
isDerivedUnion in interface IModelTypeAssociation

isSubsetOfADerivedUnion

public boolean isSubsetOfADerivedUnion()
Description copied from interface: IModelTypeAssociation
Returns if this association is a subset of a derived union.

Specified by:
isSubsetOfADerivedUnion in interface IModelTypeAssociation

getInverseAssociation

public String getInverseAssociation()
Description copied from interface: IModelTypeAssociation
Returns the name of the inverse association if it is defined.

Specified by:
getInverseAssociation in interface IModelTypeAssociation
Returns:
The name of the inverse association or null for product component associations

getMatchingAssociationName

public String getMatchingAssociationName()
Description copied from interface: IModelTypeAssociation
Returns the name of the matching product respectively policy component type association or null if no matching association is defined for this associations.

Example: Taking two policy component types called 'Policy' and 'Coverage' with a composition association between them. Policy is constrained by the product component type 'Product' and coverage by 'CoverageType'. There is also an association from 'Product' to 'CoverageType'. The product association configures the policy association. If this is a model type association for the policy association this method returns the name of the matching product association and vice versa.

Specified by:
getMatchingAssociationName in interface IModelTypeAssociation
Returns:
The name of the matchingAssoctiation

getMatchingAssociationSource

public String getMatchingAssociationSource()
Description copied from interface: IModelTypeAssociation
Returns the qualified target name of the matching product respectively policy component type association or null if no matching association is defined for component associations.

Example: Taking two policy component types called 'Policy' and 'Coverage' with a composition association between them. Policy is constrained by the product component type 'Product' and coverage by 'CoverageType'. There is also an association from 'Product' to 'CoverageType'. The product association configures the policy association. If this is a model type association for the policy association this method returns the source of the matching product association and vice versa. The source is the type which defines the matching association.

Specified by:
getMatchingAssociationSource in interface IModelTypeAssociation
Returns:
The qualified name of the matchingAssoctiation


Copyright © 2015. All rights reserved.