Class JPATupleChildConverter
java.lang.Object
com.sap.olingo.jpa.processor.core.converter.JPATupleChildConverter
- All Implemented Interfaces:
JPAResultConverter
Converts the query result based on Tuples from JPA format into Olingo format.
To reduce the memory footprint each converted row is set to null. This is done as currently the query result is stored in an ArrayList and deleting a row, which is not the last row, leads to an array copy, which can consume a lot of time. For the same reason no trimToSize() is called. As an alternative to an ArrayList also a simple linked list could be used, but this comes with the draw back that each entry would consume round about double space in the list.
- Author:
- Oliver Grande
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.olingo.commons.api.edm.EdmEntityTypeprotected static Stringprotected com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityTypeprotected JPAExpandResultprotected com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAServiceDocumentprotected org.apache.olingo.server.api.ServiceMetadataprotected Stringprotected org.apache.olingo.server.api.uri.UriHelper -
Constructor Summary
ConstructorsConstructorDescriptionJPATupleChildConverter(com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAServiceDocument sd, org.apache.olingo.server.api.uri.UriHelper uriHelper, org.apache.olingo.server.api.ServiceMetadata serviceMetadata)JPATupleChildConverter(JPATupleChildConverter converter) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringbuildConcatenatedKey(javax.persistence.Tuple row, List<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath> leftColumns)protected StringbuildPath(String prefix, com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAAssociationAttribute association)protected voidconvertAttribute(Object value, com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath jpaPath, Map<String,org.apache.olingo.commons.api.data.ComplexValue> complexValueBuffer, List<org.apache.olingo.commons.api.data.Property> properties, javax.persistence.Tuple parentRow, String prefix, org.apache.olingo.commons.api.data.Entity odataEntity)protected org.apache.olingo.commons.api.data.EntityconvertRow(com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType rowEntity, javax.persistence.Tuple row, Collection<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath> reqestedSelection)protected voidcreateCollectionProperties(com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAStructuredType jpaStructuredType, javax.persistence.Tuple row, List<org.apache.olingo.commons.api.data.Property> properties)protected voidcreateComplexValue(Map<String,org.apache.olingo.commons.api.data.ComplexValue> complexValueBuffer, List<org.apache.olingo.commons.api.data.Property> properties, com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAAttribute attribute, javax.persistence.Tuple parentRow, String bufferKey, String rootURI)protected Collection<org.apache.olingo.commons.api.data.Link>createExpand(com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAStructuredType jpaStructuredType, javax.persistence.Tuple row, String prefix, String rootURI)protected voidcreateId(com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType rowEntity, javax.persistence.Tuple row, org.apache.olingo.commons.api.data.Entity odataEntity)protected URIcreateId(org.apache.olingo.commons.api.data.Entity entity)protected StringdetermineAlias(String alias, String prefix)protected com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAStructuredTypedetermineCollectionRoot(com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType et, List<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAElement> pathList)protected org.apache.olingo.commons.api.edm.EdmEntityTypeprotected StringdeterminePrefix(String alias)protected StringdetermineSetName(JPAExpandResult jpaQueryResult, com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAServiceDocument sd)getCollectionResult(JPACollectionResult jpaResult, Collection<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath> reqestedSelection)getResult(JPAExpandResult jpaResult, Collection<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath> reqestedSelection)
-
Field Details
-
EMPTY_PREFIX
- See Also:
- Constant Field Values
-
jpaConversionTargetEntity
protected com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType jpaConversionTargetEntity -
jpaQueryResult
-
uriHelper
protected final org.apache.olingo.server.api.uri.UriHelper uriHelper -
setName
-
sd
protected final com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAServiceDocument sd -
serviceMetadata
protected final org.apache.olingo.server.api.ServiceMetadata serviceMetadata -
edmType
protected org.apache.olingo.commons.api.edm.EdmEntityType edmType
-
-
Constructor Details
-
JPATupleChildConverter
public JPATupleChildConverter(com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAServiceDocument sd, org.apache.olingo.server.api.uri.UriHelper uriHelper, org.apache.olingo.server.api.ServiceMetadata serviceMetadata) -
JPATupleChildConverter
-
-
Method Details
-
getCollectionResult
public Map<String,List<Object>> getCollectionResult(JPACollectionResult jpaResult, Collection<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath> reqestedSelection) throws org.apache.olingo.server.api.ODataApplicationException- Throws:
org.apache.olingo.server.api.ODataApplicationException
-
getResult
public Map<String,org.apache.olingo.commons.api.data.EntityCollection> getResult(JPAExpandResult jpaResult, Collection<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath> reqestedSelection) throws org.apache.olingo.server.api.ODataApplicationException- Throws:
org.apache.olingo.server.api.ODataApplicationException
-
convertRow
protected org.apache.olingo.commons.api.data.Entity convertRow(com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType rowEntity, javax.persistence.Tuple row, Collection<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath> reqestedSelection) throws org.apache.olingo.server.api.ODataApplicationException- Throws:
org.apache.olingo.server.api.ODataApplicationException
-
createCollectionProperties
protected void createCollectionProperties(com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAStructuredType jpaStructuredType, javax.persistence.Tuple row, List<org.apache.olingo.commons.api.data.Property> properties) throws ODataJPAQueryException- Throws:
ODataJPAQueryException
-
createId
-
createId
protected void createId(com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType rowEntity, javax.persistence.Tuple row, org.apache.olingo.commons.api.data.Entity odataEntity) throws org.apache.olingo.server.api.ODataApplicationException- Throws:
org.apache.olingo.server.api.ODataApplicationException
-
determineEdmType
protected org.apache.olingo.commons.api.edm.EdmEntityType determineEdmType() -
determineSetName
protected String determineSetName(JPAExpandResult jpaQueryResult, com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAServiceDocument sd) throws ODataJPAQueryException- Throws:
ODataJPAQueryException
-
buildConcatenatedKey
-
buildPath
-
convertAttribute
protected void convertAttribute(Object value, com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAPath jpaPath, Map<String,org.apache.olingo.commons.api.data.ComplexValue> complexValueBuffer, List<org.apache.olingo.commons.api.data.Property> properties, javax.persistence.Tuple parentRow, String prefix, @Nullable org.apache.olingo.commons.api.data.Entity odataEntity) throws com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException, org.apache.olingo.server.api.ODataApplicationException- Throws:
com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelExceptionorg.apache.olingo.server.api.ODataApplicationException
-
createComplexValue
protected void createComplexValue(Map<String,org.apache.olingo.commons.api.data.ComplexValue> complexValueBuffer, List<org.apache.olingo.commons.api.data.Property> properties, com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAAttribute attribute, javax.persistence.Tuple parentRow, String bufferKey, String rootURI) throws com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException, org.apache.olingo.server.api.ODataApplicationException- Throws:
com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelExceptionorg.apache.olingo.server.api.ODataApplicationException
-
createExpand
protected Collection<org.apache.olingo.commons.api.data.Link> createExpand(com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAStructuredType jpaStructuredType, javax.persistence.Tuple row, String prefix, String rootURI) throws org.apache.olingo.server.api.ODataApplicationException- Throws:
org.apache.olingo.server.api.ODataApplicationException
-
determineAlias
-
determineCollectionRoot
protected final com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAStructuredType determineCollectionRoot(com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAEntityType et, List<com.sap.olingo.jpa.metadata.core.edm.mapper.api.JPAElement> pathList) throws com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException- Throws:
com.sap.olingo.jpa.metadata.core.edm.mapper.exception.ODataJPAModelException
-
determinePrefix
-