Class KeyGenerator
- java.lang.Object
-
- de.hybris.platform.odata2services.odata.schema.KeyGenerator
-
- All Implemented Interfaces:
SchemaElementGenerator<java.util.Optional<org.apache.olingo.odata2.api.edm.provider.Key>,java.util.List<org.apache.olingo.odata2.api.edm.provider.Property>>
- Direct Known Subclasses:
IntegrationKeyGenerator,LocalizedKeyGenerator,UniquePropertiesKeyGenerator
public abstract class KeyGenerator extends java.lang.Object implements SchemaElementGenerator<java.util.Optional<org.apache.olingo.odata2.api.edm.provider.Key>,java.util.List<org.apache.olingo.odata2.api.edm.provider.Property>>
Any generator responsible for entity type key generation. This class provides a template for key generation. This template uses only simple properties for the key; navigation properties are not even considered as candidates for the inclusion in the key. The implementations can just choose which properties make a key and which don't by implementingisKey(SimpleProperty)method.
-
-
Constructor Summary
Constructors Constructor Description KeyGenerator()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected org.apache.olingo.odata2.api.edm.provider.KeycreateKey(java.util.List<org.apache.olingo.odata2.api.edm.provider.PropertyRef> keyProperties)Creates a entity type keyjava.util.Optional<org.apache.olingo.odata2.api.edm.provider.Key>generate(java.util.List<org.apache.olingo.odata2.api.edm.provider.Property> entityProperties)Generates a key object from a set of entity attributes received as a parameterprotected static java.util.List<org.apache.olingo.odata2.api.edm.provider.SimpleProperty>getSimpleProperties(java.util.List<org.apache.olingo.odata2.api.edm.provider.Property> entityProperties)protected abstract booleanisKey(org.apache.olingo.odata2.api.edm.provider.SimpleProperty simpleProperty)Determines whether the specified property is a key property.
-
-
-
Method Detail
-
generate
public java.util.Optional<org.apache.olingo.odata2.api.edm.provider.Key> generate(java.util.List<org.apache.olingo.odata2.api.edm.provider.Property> entityProperties)
Generates a key object from a set of entity attributes received as a parameter- Specified by:
generatein interfaceSchemaElementGenerator<java.util.Optional<org.apache.olingo.odata2.api.edm.provider.Key>,java.util.List<org.apache.olingo.odata2.api.edm.provider.Property>>- Parameters:
entityProperties- used to generate the key- Returns:
- Key generated containing the property refs of the valid entity attributes received as a parameter
-
isKey
protected abstract boolean isKey(org.apache.olingo.odata2.api.edm.provider.SimpleProperty simpleProperty)
Determines whether the specified property is a key property. Any property that is determined to be a key property will be included into the generated entity type key.- Parameters:
simpleProperty- a property to be checked.- Returns:
true, if the property is a key property;falseotherwise.- See Also:
createKey(List)
-
createKey
protected org.apache.olingo.odata2.api.edm.provider.Key createKey(java.util.List<org.apache.olingo.odata2.api.edm.provider.PropertyRef> keyProperties)
Creates a entity type key- Parameters:
keyProperties- references to the properties selected to be the key properties- Returns:
- a key containing all the specified property references.
- See Also:
isKey(SimpleProperty)
-
getSimpleProperties
protected static java.util.List<org.apache.olingo.odata2.api.edm.provider.SimpleProperty> getSimpleProperties(java.util.List<org.apache.olingo.odata2.api.edm.provider.Property> entityProperties)
-
-