Class JPAConversionHelper

java.lang.Object
com.sap.olingo.jpa.processor.core.modify.JPAConversionHelper

public class JPAConversionHelper extends Object
Helper method for modifying requests.

Mainly created to increase testability

Author:
Oliver Grande
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    buildGetterMap​(Object instance)
    Creates a map of attribute name and the return value of there getter method.
    org.apache.olingo.commons.api.data.Entity
    convertInputStream​(org.apache.olingo.server.api.OData odata, org.apache.olingo.server.api.ODataRequest request, org.apache.olingo.commons.api.format.ContentType requestFormat, List<org.apache.olingo.server.api.uri.UriResource> uriResourceParts)
    Converts the payload of a request into the corresponding odata entity
    convertKeyToLocal​(org.apache.olingo.server.api.OData odata, org.apache.olingo.server.api.ODataRequest request, org.apache.olingo.commons.api.edm.EdmEntitySet edmEntitySet, com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType et, Object newPOJO)
     
    static Object
    convertParameter​(org.apache.olingo.commons.api.data.Parameter param, com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAServiceDocument sd)
     
    convertProperties​(org.apache.olingo.server.api.OData odata, com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAStructuredType st, List<org.apache.olingo.commons.api.data.Property> odataProperties)
    Creates nested map of attributes and there (new) values.
    convertUriKeys​(org.apache.olingo.server.api.OData odata, com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAStructuredType st, List<org.apache.olingo.server.api.uri.UriParameter> keyPredicates)
     
    determineGetter​(Object instance)
    Like buildGetterMap(java.lang.Object), but without buffer
    <S,​ T> Object
    processAttributeConverter​(Object value, com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAAttribute attribute)
     

    Methods inherited from class java.lang.Object

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

    • JPAConversionHelper

      public JPAConversionHelper()
  • Method Details

    • convertParameter

      public static Object convertParameter(org.apache.olingo.commons.api.data.Parameter param, com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAServiceDocument sd) throws com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException
      Throws:
      com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException
    • buildGetterMap

      public Map<String,​Object> buildGetterMap(Object instance) throws ODataJPAProcessorException
      Creates a map of attribute name and the return value of there getter method.

      It is assumed that the method name is composed from get and the name of the attribute and that the attribute name starts with a lower case letter.

      Parameters:
      instance -
      Returns:
      Throws:
      ODataJPAProcessorException
    • convertInputStream

      public org.apache.olingo.commons.api.data.Entity convertInputStream(org.apache.olingo.server.api.OData odata, org.apache.olingo.server.api.ODataRequest request, org.apache.olingo.commons.api.format.ContentType requestFormat, List<org.apache.olingo.server.api.uri.UriResource> uriResourceParts) throws ODataJPAProcessorException
      Converts the payload of a request into the corresponding odata entity
      Parameters:
      odata -
      request -
      requestFormat -
      uriResourceParts -
      Returns:
      Throws:
      ODataJPAProcessorException
    • convertKeyToLocal

      public String convertKeyToLocal(org.apache.olingo.server.api.OData odata, org.apache.olingo.server.api.ODataRequest request, org.apache.olingo.commons.api.edm.EdmEntitySet edmEntitySet, com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType et, Object newPOJO) throws org.apache.olingo.server.api.serializer.SerializerException, ODataJPAProcessorException
      Parameters:
      odata -
      request -
      edmEntitySet -
      et -
      newPOJO -
      Returns:
      Throws:
      org.apache.olingo.server.api.serializer.SerializerException
      ODataJPAProcessorException
    • convertProperties

      public Map<String,​Object> convertProperties(org.apache.olingo.server.api.OData odata, com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAStructuredType st, List<org.apache.olingo.commons.api.data.Property> odataProperties) throws ODataJPAProcessException
      Creates nested map of attributes and there (new) values. Primitive values are instances of e.g. Integer. Embedded Types are returned as maps.
      Parameters:
      odata -
      st -
      odataProperties -
      Returns:
      Throws:
      ODataJPAProcessException
    • convertUriKeys

      public Map<String,​Object> convertUriKeys(org.apache.olingo.server.api.OData odata, com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAStructuredType st, List<org.apache.olingo.server.api.uri.UriParameter> keyPredicates) throws ODataJPAFilterException, ODataJPAProcessorException
      Parameters:
      keyPredicates -
      Returns:
      Throws:
      ODataJPAFilterException
      ODataJPAProcessorException
    • determineGetter

      public Map<String,​Object> determineGetter(Object instance) throws ODataJPAProcessorException
      Like buildGetterMap(java.lang.Object), but without buffer
      Parameters:
      instance -
      Returns:
      Throws:
      ODataJPAProcessorException
    • processAttributeConverter

      public <S,​ T> Object processAttributeConverter(Object value, com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAAttribute attribute)