public class ProductAssociation extends Association
IModelTypeAssociation.AssociationType| Constructor and Description |
|---|
ProductAssociation(Type type,
Method getterMethod,
Method addMethod,
Method addMethodWithCardinality,
Method removeMethod,
boolean changingOverTime,
Method getLinksMethod) |
| Modifier and Type | Method and Description |
|---|---|
<S extends IProductComponent> |
addTargetObject(S source,
Calendar effectiveDate,
IProductComponent target,
CardinalityRange cardinality)
Adds the target object with the given cardinality to this association in the source object.
|
<S extends IProductComponent> |
addTargetObjects(S source,
Calendar effectiveDate,
Collection<IProductComponent> targets)
Adds the target objects to this association in the source object.
|
<S extends IProductComponent> |
addTargetObjects(S source,
Calendar effectiveDate,
IProductComponent... targets)
Adds the target objects to this association in the source object.
|
ProductAssociation |
createOverwritingAssociationFor(Type subType) |
<T extends IProductComponent> |
getLinks(IProductComponent prodCmpt,
Calendar effectiveDate)
Retrieves all
links for this association from a product
component. |
PolicyCmptType |
getMatchingAssociationSourceType()
Returns the
PolicyCmptType identified by Association.getMatchingAssociationSource() |
ProductCmptType |
getModelType()
Deprecated.
Use
getType() |
ProductAssociation |
getSuperAssociation()
Returns the association that is overridden by this association if this association overrides
another one.
|
ProductCmptType |
getTarget()
Returns the target type of this association.
|
List<IProductComponent> |
getTargetObjects(IProductComponent productComponentSource,
Calendar effectiveDate)
Returns a list of the target(s) of the given product component's association identified by
this model type association.
|
ProductCmptType |
getType()
Returns the
ProductCmptType this association belongs to. |
boolean |
isChangingOverTime()
Checks whether this association is changing over time (resides in the generation) or not
(resides in the product component).
|
<S extends IProductComponent> |
removeTargetObjects(S source,
Calendar effectiveDate,
IProductComponent... targetsToRemove)
Removes the target object from this association in the source object.
|
<S extends IProductComponent> |
removeTargetObjects(S source,
Calendar effectiveDate,
List<IProductComponent> targetsToRemove)
Removes the target object from this association in the source object.
|
getAssociationKind, getAssociationType, getGetterMethod, getInverseAssociation, getLabelForPlural, getMatchingAssociation, getMatchingAssociationName, getMatchingAssociationSource, getMaxCardinality, getMinCardinality, getNamePlural, getUsedName, isDerivedUnion, isMatchingAssociationPresent, isOverriding, isProductRelevant, isSubsetOfADerivedUnion, isToOneAssociation, toStringgetMessageHelper, getMessageKey, getTypeNamecreateMessageHelper, getDescription, getDocumentation, getExtensionPropertyIds, getExtensionPropertyValue, getLabel, getName, getRelevantProductObject, invokeField, invokeMethodclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetDescription, getExtensionPropertyIds, getExtensionPropertyValue, getLabel, getNamepublic ProductAssociation createOverwritingAssociationFor(Type subType)
createOverwritingAssociationFor in class Associationpublic ProductCmptType getType()
ProductCmptType this association belongs to.@Deprecated public ProductCmptType getModelType()
getType()getModelType in interface IModelTypeAssociationgetModelType in class TypePartpublic ProductCmptType getTarget()
getTarget in interface IModelTypeAssociationgetTarget in class Associationpublic List<IProductComponent> getTargetObjects(IProductComponent productComponentSource, Calendar effectiveDate)
null the latest generation is used. If the association is not changing over time
the date will be ignored.productComponentSource - a product object corresponding to the ProductCmptType
this association belongs toeffectiveDate - The date that should be used to get the
IProductComponentGeneration if this association is changing over time. May
be null to get the latest generation.IllegalArgumentException - if the model object does not have an association fitting
this model type association or that association is not accessible for any reasonpublic <S extends IProductComponent> S addTargetObjects(S source, Calendar effectiveDate, Collection<IProductComponent> targets)
The return value is the updated source object. It could be used to directly create a tree of objects. For example with a model like:
SalesProduct <>---- Product <>---- CoverageType
You could write such code:
products.addTargetObjects(salesProduct,
coveragetypes.addTargetObjects(product,
coverageType1, coverageType2));
source - the object to add a target object toeffectiveDate - The date that should be used to get the
IProductComponentGeneration if this association is changing over time. May
be null to get the latest generation.targets - the objects to add to sourceIllegalArgumentException - if there is no method annotated with
@IpsAssociationAdder. This is the case if the
association is a derived union.IllegalArgumentException - if there are multiple target objects provided for a ..1 ("to
one") associationpublic <S extends IProductComponent> S addTargetObjects(S source, Calendar effectiveDate, IProductComponent... targets)
The return value is the updated source object. It could be used to directly create a tree of objects. For example with a model like:
SalesProduct <>---- Product <>---- CoverageType
You could write such code:
products.addTargetObjects(salesProduct,
coveragetypes.addTargetObjects(product,
coverageType1, coverageType2));
source - the object to add a target object toeffectiveDate - the date that should be used to get the
IProductComponentGeneration if this association is changing over time. May
be null to get the latest generation.targets - the objects to add to sourceIllegalArgumentException - if there is no method annotated with
@IpsAssociationAdder. This is the case if the
association is a derived union.IllegalArgumentException - if there are multiple target objects provided for a ..1 ("to
one") associationpublic <S extends IProductComponent> S addTargetObject(S source, Calendar effectiveDate, IProductComponent target, CardinalityRange cardinality)
The return value is the updated source object. It could be used to directly create a tree of objects. For example with a model like:
SalesProduct <>---- Product <>---- CoverageType
You could write such code:
products.addTargetObject(salesProduct,
coveragetypes.addTargetObject(product,
coverageType));
source - the object to add a target object toeffectiveDate - the date that should be used to get the
IProductComponentGeneration if this association is changing over time. May
be null to get the latest generation.target - the object to add to sourcecardinality - the cardinality range that will be set for the targetIllegalArgumentException - if there is no method annotated with
@IpsAssociationAdder. This is the case if the
association is a derived union.IllegalArgumentException - if there are multiple target objects provided for a ..1 ("to
one") associationpublic <S extends IProductComponent> S removeTargetObjects(S source, Calendar effectiveDate, List<IProductComponent> targetsToRemove)
null if
this is a ..1 ("to one") association.
The return value is the updated source object. It could be used to directly remove objects in a tree of objects. For example with a model like:
SalesProduct <>---- Product <>---- CoverageType
You could write such code:
products.removeTargetObjects(SalesProduct,
coverageTypes.removeTargetObjects(product,
coverageType1, coverageType2));
source - the object to remove a target object fromeffectiveDate - the date that should be used to get the
IProductComponentGeneration if this association is changing over time. May
be null to get the latest generation.targetsToRemove - the objects to remove from this association in sourceIllegalArgumentException - if there is no method annotated with
@IpsAssociationRemover (or
@IpsAssociationAdder for a ..1 association). This is
the case if the association is a derived union.IllegalArgumentException - if there are multiple or no target objects provided for a
..1 ("to one") associationpublic <S extends IProductComponent> S removeTargetObjects(S source, Calendar effectiveDate, IProductComponent... targetsToRemove)
null if
this is a ..1 ("to one") association.
The return value is the updated source object. It could be used to directly remove objects in a tree of objects. For example with a model like:
SalesProduct <>---- Product <>---- CoverageType
You could write such code:
products.removeTargetObjects(SalesProduct,
coverageTypes.removeTargetObjects(product,
coverageType1, coverageType2));
source - the object to remove a target object fromeffectiveDate - the date that should be used to get the
IProductComponentGeneration if this association is changing over time. May
be null to get the latest generation.targetsToRemove - the objects to remove from this association in sourceIllegalArgumentException - if there is no method annotated with
@IpsAssociationRemover (or
@IpsAssociationAdder for a ..1 association). This is
the case if the association is a derived union.IllegalArgumentException - if there are multiple or no target objects provided for a
..1 ("to one") associationpublic PolicyCmptType getMatchingAssociationSourceType()
PolicyCmptType identified by Association.getMatchingAssociationSource()getMatchingAssociationSourceType in interface IModelTypeAssociationgetMatchingAssociationSourceType in class AssociationAssociation.getMatchingAssociationSource()public boolean isChangingOverTime()
true if this association is changing over time, else falsepublic <T extends IProductComponent> Collection<IProductComponentLink<T>> getLinks(IProductComponent prodCmpt, Calendar effectiveDate)
links for this association from a product
component.prodCmpt - the source product component to retrieve the links fromeffectiveDate - the effective-date of the adjustment (a.k.a. product component
generation). Ignored if this is a static association
(isChangingOverTime()==false).IllegalArgumentException - if there is no method annotated with
@IpsAssociationLinks. This is the case if the
association is a derived union.public ProductAssociation getSuperAssociation()
Associationnull.getSuperAssociation in class AssociationAssociation.isOverriding()Copyright © 2021. All rights reserved.