java.lang.Object
de.hybris.platform.odata2services.odata.schema.KeyGenerator
All Implemented Interfaces:
SchemaElementGenerator<Optional<org.apache.olingo.odata2.api.edm.provider.Key>,List<org.apache.olingo.odata2.api.edm.provider.Property>>
Direct Known Subclasses:
IntegrationKeyGenerator, LocalizedKeyGenerator, UniquePropertiesKeyGenerator

public abstract class KeyGenerator extends Object implements SchemaElementGenerator<Optional<org.apache.olingo.odata2.api.edm.provider.Key>,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 implementing isKey(SimpleProperty) method.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.apache.olingo.odata2.api.edm.provider.Key
    createKey(List<org.apache.olingo.odata2.api.edm.provider.PropertyRef> keyProperties)
    Creates a entity type key
    Optional<org.apache.olingo.odata2.api.edm.provider.Key>
    generate(List<org.apache.olingo.odata2.api.edm.provider.Property> entityProperties)
    Generates a key object from a set of entity attributes received as a parameter
    protected static List<org.apache.olingo.odata2.api.edm.provider.SimpleProperty>
    getSimpleProperties(List<org.apache.olingo.odata2.api.edm.provider.Property> entityProperties)
     
    protected abstract boolean
    isKey(org.apache.olingo.odata2.api.edm.provider.SimpleProperty simpleProperty)
    Determines whether the specified property is a key property.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • KeyGenerator

      public KeyGenerator()
  • Method Details

    • generate

      public Optional<org.apache.olingo.odata2.api.edm.provider.Key> generate(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:
      generate in interface SchemaElementGenerator<Optional<org.apache.olingo.odata2.api.edm.provider.Key>,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; false otherwise.
      See Also:
    • createKey

      protected org.apache.olingo.odata2.api.edm.provider.Key createKey(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:
    • getSimpleProperties

      protected static List<org.apache.olingo.odata2.api.edm.provider.SimpleProperty> getSimpleProperties(List<org.apache.olingo.odata2.api.edm.provider.Property> entityProperties)