Class AbstractAssociationGenerator
- java.lang.Object
-
- de.hybris.platform.odata2services.odata.schema.association.AbstractAssociationGenerator
-
- All Implemented Interfaces:
AssociationGenerator,SchemaElementGenerator<org.apache.olingo.odata2.api.edm.provider.Association,IntegrationObjectItemAttributeModel>
- Direct Known Subclasses:
CollectionAssociationGenerator,OneToOneAssociationGenerator
public abstract class AbstractAssociationGenerator extends java.lang.Object implements AssociationGenerator
-
-
Constructor Summary
Constructors Constructor Description AbstractAssociationGenerator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected TypeAttributeDescriptorasDescriptor(IntegrationObjectItemAttributeModel attributeDefinitionModel)Deprecated, for removal: This API element is subject to removal in a future version.no alternative method.protected voidcheckIsApplicablePrecondition(IntegrationObjectItemAttributeModel attributeDefinitionModel)Deprecated, for removal: This API element is subject to removal in a future version.no alternative method.protected static booleanfalseIfNull(java.lang.Object attribute)org.apache.olingo.odata2.api.edm.provider.Associationgenerate(TypeAttributeDescriptor attrDescriptor)Generates an association for the referenced TypeAttributeDescriptorjava.lang.StringgetAssociationName(IntegrationObjectItemAttributeModel attributeDefinitionModel)Derives the association name from the given attribute definition modeljava.lang.StringgetAssociationName(TypeAttributeDescriptor descriptor)Generates association name based on the the provided attribute descriptor.protected org.apache.olingo.odata2.api.edm.EdmMultiplicitygetSourceCardinality(TypeAttributeDescriptor descriptor)Determines cardinality of the source type presented in the specified attribute descriptor.java.lang.StringgetSourceRole(IntegrationObjectItemAttributeModel attributeDefinitionModel)Derives the source role from the given attribute definition modeljava.lang.StringgetSourceRole(TypeAttributeDescriptor descriptor)Generates an association source role.protected org.apache.olingo.odata2.api.edm.EdmMultiplicitygetTargetCardinality(TypeAttributeDescriptor descriptor)Determines cardinality of the target type presented in the specified attribute descriptor.java.lang.StringgetTargetRole(IntegrationObjectItemAttributeModel attributeDefinitionModel)Derives the target role from the given attribute definition modeljava.lang.StringgetTargetRole(TypeAttributeDescriptor descriptor)Generates an association target role.protected java.lang.StringgetTargetType(IntegrationObjectItemAttributeModel attributeModel)Deprecated, for removal: This API element is subject to removal in a future version.convert the IntegrationObjectItemAttributeModel to a TypeAttributeDescriptor and use thegetTargetType(TypeAttributeDescriptor)method.protected java.lang.StringgetTargetType(TypeAttributeDescriptor descriptor)Generates an association target type.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.hybris.platform.odata2services.odata.schema.association.AssociationGenerator
generate, isApplicable, isApplicable
-
-
-
-
Method Detail
-
generate
public org.apache.olingo.odata2.api.edm.provider.Association generate(TypeAttributeDescriptor attrDescriptor)
Description copied from interface:AssociationGeneratorGenerates an association for the referenced TypeAttributeDescriptor- Specified by:
generatein interfaceAssociationGenerator- Parameters:
attrDescriptor- the integration object attribute descriptor- Returns:
- the association
-
getSourceRole
public java.lang.String getSourceRole(IntegrationObjectItemAttributeModel attributeDefinitionModel)
Description copied from interface:AssociationGeneratorDerives the source role from the given attribute definition model- Specified by:
getSourceRolein interfaceAssociationGenerator- Parameters:
attributeDefinitionModel- the integration object attribute definition model- Returns:
- the source role
-
getTargetRole
public java.lang.String getTargetRole(IntegrationObjectItemAttributeModel attributeDefinitionModel)
Description copied from interface:AssociationGeneratorDerives the target role from the given attribute definition model- Specified by:
getTargetRolein interfaceAssociationGenerator- Parameters:
attributeDefinitionModel- the integration object attribute definition model- Returns:
- the target role
-
getAssociationName
public java.lang.String getAssociationName(IntegrationObjectItemAttributeModel attributeDefinitionModel)
Description copied from interface:AssociationGeneratorDerives the association name from the given attribute definition model- Specified by:
getAssociationNamein interfaceAssociationGenerator- Parameters:
attributeDefinitionModel- the integration object attribute definition model- Returns:
- the association name
-
checkIsApplicablePrecondition
@Deprecated(since="1905.08-CEP", forRemoval=true) protected void checkIsApplicablePrecondition(IntegrationObjectItemAttributeModel attributeDefinitionModel)Deprecated, for removal: This API element is subject to removal in a future version.no alternative method. The DefaultTypeAttributeDescriptor.create validates the appropriate precondition. A IntegrationObjectItemAttributeModel cannot possibly exist with a null attribute descriptor.Runs safety checks on the specified attribute definition model, to make sure it can be analyzed by theAssociationGenerator.isApplicable(IntegrationObjectItemAttributeModel)method. Specifically it checks the the model is notnulland contains anAttributeDescriptorModel.- Parameters:
attributeDefinitionModel- a model to analyze
-
getAssociationName
public java.lang.String getAssociationName(TypeAttributeDescriptor descriptor)
Generates association name based on the the provided attribute descriptor.- Specified by:
getAssociationNamein interfaceAssociationGenerator- Parameters:
descriptor- a descriptor to generate the association name for.- Returns:
- name of the descriptor in
"FK_<item_type>_<attribute_type>"format, whereitem_typeis the type containing the attribute descriptor andattribute_typeis the type of the attribute values or, in other words, type referenced by the attribute.
-
asDescriptor
@Deprecated(since="1905.08-CEP", forRemoval=true) protected TypeAttributeDescriptor asDescriptor(IntegrationObjectItemAttributeModel attributeDefinitionModel)Deprecated, for removal: This API element is subject to removal in a future version.no alternative method.Converts attribute model to an attribute descriptor.- Parameters:
attributeDefinitionModel- a model to convert.- Returns:
- attribute descriptor for the specified attribute model.
-
getSourceRole
public java.lang.String getSourceRole(TypeAttributeDescriptor descriptor)
Generates an association source role.- Specified by:
getSourceRolein interfaceAssociationGenerator- Parameters:
descriptor- an attribute descriptor to generate the source role for.- Returns:
- type code of the
TypeDescriptorcontaining the attribute descriptor. - See Also:
TypeAttributeDescriptor.getTypeDescriptor(),TypeDescriptor.getItemCode()
-
getTargetRole
public java.lang.String getTargetRole(TypeAttributeDescriptor descriptor)
Generates an association target role.- Specified by:
getTargetRolein interfaceAssociationGenerator- Parameters:
descriptor- an attribute descriptor to generate the target role from.- Returns:
- type code of the
TypeDescriptorreferenced by the attribute descriptor (type of the attribute values) or the attribute name if the source type is the same as the target type in the association. - See Also:
TypeAttributeDescriptor.getAttributeType(),TypeDescriptor.getItemCode(),TypeAttributeDescriptor.getAttributeName()
-
getTargetType
protected java.lang.String getTargetType(TypeAttributeDescriptor descriptor)
Generates an association target type.- Parameters:
descriptor- an attribute descriptor to generate the target type from.- Returns:
- type code of the
TypeDescriptorreferenced by the attribute descriptor (type of the attribute values). - See Also:
TypeAttributeDescriptor.getAttributeType(),TypeDescriptor.getItemCode()
-
getTargetType
@Deprecated(since="1905.08-CEP", forRemoval=true) protected java.lang.String getTargetType(IntegrationObjectItemAttributeModel attributeModel)Deprecated, for removal: This API element is subject to removal in a future version.convert the IntegrationObjectItemAttributeModel to a TypeAttributeDescriptor and use thegetTargetType(TypeAttributeDescriptor)method.Generates an association target type.- Parameters:
attributeModel- an attribute descriptor to generate the target type from.- Returns:
- type code of the
TypeDescriptorreferenced by the attribute descriptor (type of the attribute values). - See Also:
TypeAttributeDescriptor.getAttributeType(),TypeDescriptor.getItemCode()
-
getSourceCardinality
protected org.apache.olingo.odata2.api.edm.EdmMultiplicity getSourceCardinality(TypeAttributeDescriptor descriptor)
Determines cardinality of the source type presented in the specified attribute descriptor. Normally the source type is the item type containing the attribute.- Parameters:
descriptor- descriptor to derive the cardinality from- Returns:
- multiplicity
-
getTargetCardinality
protected org.apache.olingo.odata2.api.edm.EdmMultiplicity getTargetCardinality(TypeAttributeDescriptor descriptor)
Determines cardinality of the target type presented in the specified attribute descriptor. Normally the target type is the item type returned by the attribute.- Parameters:
descriptor- descriptor to derive the cardinality from- Returns:
- multiplicity
-
falseIfNull
protected static boolean falseIfNull(java.lang.Object attribute)
-
-