[OLINGO-129] Merge with current master
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata2/repo Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata2/commit/a6e2fbe5 Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/a6e2fbe5 Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/a6e2fbe5 Branch: refs/heads/Olingo-129_PocJpaDataStore Commit: a6e2fbe500459ee2bd6d2e97a7f913276533a5a1 Parents: c23dbcb Author: mibo <[email protected]> Authored: Tue Oct 14 20:04:38 2014 +0200 Committer: mibo <[email protected]> Committed: Tue Oct 14 20:04:38 2014 +0200 ---------------------------------------------------------------------- .gitignore | 1 + odata2-jpa-processor/jpa-api/.gitignore | 14 +- .../processor/api/ODataJPAResponseBuilder.java | 316 +-- .../processor/api/ODataJPATombstoneContext.java | 180 +- .../api/ODataJPATombstoneEntityListener.java | 120 +- .../jpa/processor/api/OnJPAWriteContent.java | 108 +- .../jpa/processor/api/access/JPAPaging.java | 64 +- .../api/exception/ODataJPAErrorCallback.java | 90 +- odata2-jpa-processor/jpa-core/.gitignore | 14 +- .../core/ODataJPAResponseBuilderDefault.java | 4 +- .../processor/core/access/data/JPAEntity.java | 896 +++---- .../core/access/data/JPAEntityParser.java | 2 + .../jpa/processor/core/access/data/JPAPage.java | 422 +-- .../access/model/JPAEdmMappingModelService.java | 17 +- .../core/access/model/JPAEdmNameBuilder.java | 6 +- .../core/callback/JPATombstoneCallBack.java | 120 +- .../jpa/processor/core/model/JPAEdmFacets.java | 188 +- .../processor/core/ODataEntityParserTest.java | 488 ++-- .../JPAEntityParserForStaticMethodTest.java | 660 ++--- .../core/access/data/JPAEntityTest.java | 492 ++-- .../processor/core/access/data/JPALinkTest.java | 46 +- .../access/data/JPAPageBuilderDeltaTest.java | 714 +++--- .../core/access/data/JPAPageBuilderTest.java | 1120 ++++---- .../processor/core/mock/ODataContextMock.java | 124 +- .../core/mock/ODataJPAServiceFactoryMock.java | 94 +- .../processor/core/mock/ODataServiceMock.java | 212 +- .../core/mock/OnJPAWriteContentMock.java | 116 +- .../jpa/processor/core/mock/PathInfoMock.java | 102 +- .../processor/core/mock/PathSegmentMock.java | 88 +- .../processor/core/mock/data/EdmMockUtilV2.java | 806 +++--- .../processor/core/mock/data/JPATypeMock.java | 536 ++-- .../core/mock/data/ODataEntryMockUtil.java | 328 +-- .../core/mock/model/JPAPluralAttributeMock.java | 188 +- odata2-jpa-processor/jpa-ref/.gitignore | 14 +- .../ref/converter/BlobToByteConverter.java | 140 +- .../ref/factory/JPAEntityManagerFactory.java | 92 +- .../SalesOrderItemTombstoneListener.java | 186 +- .../listeners/SalesOrderTombstoneListener.java | 114 +- .../odata2/jpa/processor/ref/model/Address.java | 188 +- .../jpa/processor/ref/model/Category.java | 160 +- .../jpa/processor/ref/model/Customer.java | 186 +- .../jpa/processor/ref/model/Material.java | 272 +- .../odata2/jpa/processor/ref/model/Note.java | 242 +- .../odata2/jpa/processor/ref/model/NoteKey.java | 166 +- .../jpa/processor/ref/model/SalesOrderItem.java | 270 +- .../processor/ref/model/SalesOrderItemKey.java | 178 +- .../odata2/jpa/processor/ref/model/Store.java | 182 +- .../src/main/resources/META-INF/persistence.xml | 88 +- odata2-jpa-processor/jpa-web/.gitignore | 14 +- .../ref/extension/OnDBWriteContent.java | 110 +- .../jpa/processor/ref/extension/OrderValue.java | 84 +- .../extension/SalesOrderHeaderProcessor.java | 272 +- .../jpa/processor/ref/util/DataGenerator.java | 316 +-- .../src/main/resources/SQL_Cleanup.properties | 42 +- .../resources/SQL_Insert_Category.properties | 42 +- .../main/resources/SQL_Insert_Config.properties | 42 +- .../resources/SQL_Insert_Customer.properties | 44 +- .../resources/SQL_Insert_Material.properties | 58 +- .../SQL_Insert_SalesOrderHeader.properties | 58 +- .../SQL_Insert_SalesOrderItem.properties | 60 +- .../main/resources/SQL_Insert_Store.properties | 58 +- .../src/main/resources/serviceConfig.properties | 36 +- .../webapp/SalesOrderProcessingMappingModel.xml | 105 +- .../jpa-web/src/main/webapp/WEB-INF/web.xml | 54 +- .../jpa-web/src/main/webapp/index.jsp | 664 ++--- odata2-lib/odata-annotation/.gitignore | 16 +- .../src/main/java/META-INF/MANIFEST.MF | 6 +- .../olingo/odata2/api/batch/BatchException.java | 8 +- .../odata2/api/batch/BatchParserResult.java | 29 + .../odata2/api/batch/BatchRequestPart.java | 2 +- .../odata2/api/batch/BatchResponsePart.java | 2 +- .../api/client/batch/BatchSingleResponse.java | 4 +- .../ODataInternalServerErrorException.java | 46 + .../olingo/odata2/core/batch/AcceptParser.java | 143 +- .../odata2/core/batch/BatchRequestParser.java | 614 ----- .../odata2/core/batch/BatchRequestWriter.java | 30 +- .../odata2/core/batch/BatchResponseParser.java | 356 --- .../odata2/core/batch/v2/BatchBodyPart.java | 139 + .../core/batch/v2/BatchChangeSetPart.java | 56 + .../odata2/core/batch/v2/BatchParser.java | 132 + .../odata2/core/batch/v2/BatchParserCommon.java | 259 ++ .../olingo/odata2/core/batch/v2/BatchPart.java | 25 + .../core/batch/v2/BatchQueryOperation.java | 82 + .../batch/v2/BatchRequestTransformator.java | 175 ++ .../batch/v2/BatchResponseTransformator.java | 102 + .../core/batch/v2/BatchTransformator.java | 30 + .../core/batch/v2/BatchTransformatorCommon.java | 276 ++ .../v2/BufferedReaderIncludingLineEndings.java | 275 ++ .../olingo/odata2/core/batch/v2/Header.java | 248 ++ .../provider/EdmEntityContainerImplProv.java | 2 +- .../provider/EdmServiceMetadataImplProv.java | 57 +- .../odata2/core/ep/ProviderFacadeImpl.java | 7 +- .../odata2/core/rest/ODataSubLocator.java | 18 +- .../odata2/core/servlet/ODataServlet.java | 11 + .../src/main/resources/i18n.properties | 38 +- .../src/main/resources/i18n_en.properties | 2 + .../odata2/core/batch/AcceptParserTest.java | 77 +- .../core/batch/BatchParserCommonTest.java | 230 ++ .../core/batch/BatchRequestParserTest.java | 620 ++++- .../odata2/core/batch/BatchRequestTest.java | 32 +- .../core/batch/BatchRequestWriterTest.java | 52 +- .../core/batch/BatchResponseParserTest.java | 34 +- .../odata2/core/batch/BatchResponseTest.java | 13 +- .../core/batch/BatchResponseWriterTest.java | 2 +- .../batch/BatchTransformatorCommonTest.java | 123 + .../BufferedReaderIncludingLineEndingsTest.java | 482 ++++ .../olingo/odata2/core/batch/HeaderTest.java | 179 ++ .../EdmServiceMetadataImplProvTest.java | 25 +- .../src/test/resources/batchLarge.batch | 2422 ++++++++++++++++++ .../src/test/resources/batchWithPost.batch | 1 + .../olingo/odata2/fit/basic/BasicBatchTest.java | 66 +- .../odata2/fit/basic/NullServiceTest.java | 65 + .../odata2/fit/client/ClientBatchTest.java | 2 + .../fit/client/ClientDeltaResponseTest.java | 2 + .../apache/olingo/odata2/fit/ref/BatchTest.java | 4 +- .../src/test/resources/batchWithContentId.batch | 2 + .../resources/batchWithContentIdPart2.batch | 6 +- .../src/test/resources/changeset.batch | 2 + .../testutil/fit/FitStaticServiceFactory.java | 6 +- .../odata2/testutil/helper/StringHelper.java | 19 +- 120 files changed, 13001 insertions(+), 7868 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/.gitignore ---------------------------------------------------------------------- diff --git a/.gitignore b/.gitignore index 19cc1bc..fced0b7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.idea .pmd .project .classpath http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-api/.gitignore ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-api/.gitignore b/odata2-jpa-processor/jpa-api/.gitignore index fe5d89b..a7ffe90 100644 --- a/odata2-jpa-processor/jpa-api/.gitignore +++ b/odata2-jpa-processor/jpa-api/.gitignore @@ -1,8 +1,8 @@ -.project -.classpath -.settings -target -bin -*.bak -classes +.project +.classpath +.settings +target +bin +*.bak +classes .DS_Store \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPAResponseBuilder.java ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPAResponseBuilder.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPAResponseBuilder.java index cc9bffc..d0d1912 100644 --- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPAResponseBuilder.java +++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPAResponseBuilder.java @@ -1,158 +1,158 @@ -/******************************************************************************* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - ******************************************************************************/ -package org.apache.olingo.odata2.jpa.processor.api; - -import java.util.List; - -import org.apache.olingo.odata2.api.exception.ODataNotFoundException; -import org.apache.olingo.odata2.api.processor.ODataResponse; -import org.apache.olingo.odata2.api.uri.info.DeleteUriInfo; -import org.apache.olingo.odata2.api.uri.info.GetEntityLinkUriInfo; -import org.apache.olingo.odata2.api.uri.info.GetEntitySetLinksUriInfo; -import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo; -import org.apache.olingo.odata2.api.uri.info.GetEntityUriInfo; -import org.apache.olingo.odata2.api.uri.info.GetFunctionImportUriInfo; -import org.apache.olingo.odata2.api.uri.info.PostUriInfo; -import org.apache.olingo.odata2.api.uri.info.PutMergePatchUriInfo; -import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; - -/** - * The interface provides methods for building an OData response from a JPA Entity. - * Implement this interface for building an OData response from a JPA Entity. - */ -public interface ODataJPAResponseBuilder { - - /** - * The method builds an OData response for an OData Query Request from a queried list of JPA Entities. - * @param queryUriInfo is an information about the request URI - * @param jpaEntities is an empty or non empty list of queried instances of JPA Entities - * @param contentType of the response - * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse} - * @throws ODataJPARuntimeException - */ - public ODataResponse build(final GetEntitySetUriInfo queryUriInfo, final List<Object> jpaEntities, - final String contentType) throws ODataJPARuntimeException; - - /** - * The method builds an OData response for an OData Read Request from a read JPA Entity - * @param readUriInfo is an information about the request URI - * @param jpaEntity is a null or non null instances of read JPA Entity - * @param contentType of the response - * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse} - * @throws ODataJPARuntimeException - * @throws ODataNotFoundException - */ - public ODataResponse build(final GetEntityUriInfo readUriInfo, final Object jpaEntity, - final String contentType) throws ODataJPARuntimeException, - ODataNotFoundException; - - /** - * The method builds an OData response for an OData Create Request from a created JPA entity. - * @param postUriInfo is an information about the request URI - * @param createdObject is a null or non null instances of JPA Entity - * @param contentType of the response - * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse} - * @throws ODataJPARuntimeException - * @throws ODataNotFoundException - */ - public ODataResponse build(final PostUriInfo postUriInfo, final Object createdObject, - final String contentType) throws ODataJPARuntimeException, - ODataNotFoundException; - - /** - * The method builds an OData response for an OData Update Request from an updated JPA Entity - * @param putUriInfo is an information about the request URI - * @param updatedObject is an updated instance of JPA Entity - * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse} - * @throws ODataJPARuntimeException - * @throws ODataNotFoundException - */ - public ODataResponse build(final PutMergePatchUriInfo putUriInfo, final Object updatedObject) - throws ODataJPARuntimeException, ODataNotFoundException; - - /** - * The method builds an OData response for an OData Delete Request from a deleted JPA Entity - * @param deleteUriInfo is an information about the request URI - * @param deletedObject is an null or non null instance of deleted JPA Entity. Null implies Entity not found. - * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse} - * @throws ODataJPARuntimeException - * @throws ODataNotFoundException - */ - public ODataResponse build(final DeleteUriInfo deleteUriInfo, final Object deletedObject) - throws ODataJPARuntimeException, ODataNotFoundException; - - /** - * The method builds an OData response for an OData function Import Request from a registered processor method's - * return parameter. - * @param functionImportUriInfo is an information about the request URI - * @param result is a method's return parameter - * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse} - * @throws ODataJPARuntimeException - */ - public ODataResponse build(final GetFunctionImportUriInfo functionImportUriInfo, final Object result) - throws ODataJPARuntimeException; - - /** - * The method builds an OData response for an OData function Import Request from a registered processor method's - * return parameter. The return parameter is a collection of objects. - * @param functionImportUriInfo is an information about the request URI - * @param result is a method's return parameter is a collection of objects. - * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse} - * @throws ODataJPARuntimeException - */ - public ODataResponse build(final GetFunctionImportUriInfo functionImportUriInfo, final List<Object> resultList, - final String contentType) - throws ODataJPARuntimeException, ODataNotFoundException; - - /** - * The method builds an OData response for an OData Read Link Request from a read JPA Entity and its related JPA - * Entities. - * @param readLinkUriInfo is an information about the request URI - * @param jpaEntity is a null or non null read JPA Entity and its related JPA Entities. - * @param contentType of the response - * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse} - * @throws ODataNotFoundException - * @throws ODataJPARuntimeException - */ - public ODataResponse build(final GetEntityLinkUriInfo readLinkUriInfo, final Object jpaEntity, - final String contentType) throws ODataNotFoundException, - ODataJPARuntimeException; - - /** - * The method builds an OData response for an OData Query Link Request from a queried JPA Entity and its related JPA - * Entities. - * @param queryLinkUriInfo is an information about the request URI - * @param jpaEntity is an empty or non empty list of queried JPA Entities - * @param contentType of the response - * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse} - * @throws ODataJPARuntimeException - */ - public ODataResponse build(final GetEntitySetLinksUriInfo queryLinkUriInfo, final List<Object> jpaEntity, - final String contentType) throws ODataJPARuntimeException; - - /** - * The method builds an OData response from a count representing total number of JPA Entities - * @param jpaEntityCount is the count value - * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse} - * @throws ODataJPARuntimeException - */ - public ODataResponse build(final long jpaEntityCount) - throws ODataJPARuntimeException; - -} +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + ******************************************************************************/ +package org.apache.olingo.odata2.jpa.processor.api; + +import java.util.List; + +import org.apache.olingo.odata2.api.exception.ODataNotFoundException; +import org.apache.olingo.odata2.api.processor.ODataResponse; +import org.apache.olingo.odata2.api.uri.info.DeleteUriInfo; +import org.apache.olingo.odata2.api.uri.info.GetEntityLinkUriInfo; +import org.apache.olingo.odata2.api.uri.info.GetEntitySetLinksUriInfo; +import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo; +import org.apache.olingo.odata2.api.uri.info.GetEntityUriInfo; +import org.apache.olingo.odata2.api.uri.info.GetFunctionImportUriInfo; +import org.apache.olingo.odata2.api.uri.info.PostUriInfo; +import org.apache.olingo.odata2.api.uri.info.PutMergePatchUriInfo; +import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; + +/** + * The interface provides methods for building an OData response from a JPA Entity. + * Implement this interface for building an OData response from a JPA Entity. + */ +public interface ODataJPAResponseBuilder { + + /** + * The method builds an OData response for an OData Query Request from a queried list of JPA Entities. + * @param queryUriInfo is an information about the request URI + * @param jpaEntities is an empty or non empty list of queried instances of JPA Entities + * @param contentType of the response + * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse} + * @throws ODataJPARuntimeException + */ + public ODataResponse build(final GetEntitySetUriInfo queryUriInfo, final List<Object> jpaEntities, + final String contentType) throws ODataJPARuntimeException; + + /** + * The method builds an OData response for an OData Read Request from a read JPA Entity + * @param readUriInfo is an information about the request URI + * @param jpaEntity is a null or non null instances of read JPA Entity + * @param contentType of the response + * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse} + * @throws ODataJPARuntimeException + * @throws ODataNotFoundException + */ + public ODataResponse build(final GetEntityUriInfo readUriInfo, final Object jpaEntity, + final String contentType) throws ODataJPARuntimeException, + ODataNotFoundException; + + /** + * The method builds an OData response for an OData Create Request from a created JPA entity. + * @param postUriInfo is an information about the request URI + * @param createdObject is a null or non null instances of JPA Entity + * @param contentType of the response + * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse} + * @throws ODataJPARuntimeException + * @throws ODataNotFoundException + */ + public ODataResponse build(final PostUriInfo postUriInfo, final Object createdObject, + final String contentType) throws ODataJPARuntimeException, + ODataNotFoundException; + + /** + * The method builds an OData response for an OData Update Request from an updated JPA Entity + * @param putUriInfo is an information about the request URI + * @param updatedObject is an updated instance of JPA Entity + * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse} + * @throws ODataJPARuntimeException + * @throws ODataNotFoundException + */ + public ODataResponse build(final PutMergePatchUriInfo putUriInfo, final Object updatedObject) + throws ODataJPARuntimeException, ODataNotFoundException; + + /** + * The method builds an OData response for an OData Delete Request from a deleted JPA Entity + * @param deleteUriInfo is an information about the request URI + * @param deletedObject is an null or non null instance of deleted JPA Entity. Null implies Entity not found. + * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse} + * @throws ODataJPARuntimeException + * @throws ODataNotFoundException + */ + public ODataResponse build(final DeleteUriInfo deleteUriInfo, final Object deletedObject) + throws ODataJPARuntimeException, ODataNotFoundException; + + /** + * The method builds an OData response for an OData function Import Request from a registered processor method's + * return parameter. + * @param functionImportUriInfo is an information about the request URI + * @param result is a method's return parameter + * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse} + * @throws ODataJPARuntimeException + */ + public ODataResponse build(final GetFunctionImportUriInfo functionImportUriInfo, final Object result) + throws ODataJPARuntimeException; + + /** + * The method builds an OData response for an OData function Import Request from a registered processor method's + * return parameter. The return parameter is a collection of objects. + * @param functionImportUriInfo is an information about the request URI + * @param result is a method's return parameter is a collection of objects. + * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse} + * @throws ODataJPARuntimeException + */ + public ODataResponse build(final GetFunctionImportUriInfo functionImportUriInfo, final List<Object> resultList, + final String contentType) + throws ODataJPARuntimeException, ODataNotFoundException; + + /** + * The method builds an OData response for an OData Read Link Request from a read JPA Entity and its related JPA + * Entities. + * @param readLinkUriInfo is an information about the request URI + * @param jpaEntity is a null or non null read JPA Entity and its related JPA Entities. + * @param contentType of the response + * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse} + * @throws ODataNotFoundException + * @throws ODataJPARuntimeException + */ + public ODataResponse build(final GetEntityLinkUriInfo readLinkUriInfo, final Object jpaEntity, + final String contentType) throws ODataNotFoundException, + ODataJPARuntimeException; + + /** + * The method builds an OData response for an OData Query Link Request from a queried JPA Entity and its related JPA + * Entities. + * @param queryLinkUriInfo is an information about the request URI + * @param jpaEntity is an empty or non empty list of queried JPA Entities + * @param contentType of the response + * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse} + * @throws ODataJPARuntimeException + */ + public ODataResponse build(final GetEntitySetLinksUriInfo queryLinkUriInfo, final List<Object> jpaEntity, + final String contentType) throws ODataJPARuntimeException; + + /** + * The method builds an OData response from a count representing total number of JPA Entities + * @param jpaEntityCount is the count value + * @return an instance of type {@link org.apache.olingo.odata2.api.processor.ODataResponse} + * @throws ODataJPARuntimeException + */ + public ODataResponse build(final long jpaEntityCount) + throws ODataJPARuntimeException; + +} http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPATombstoneContext.java ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPATombstoneContext.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPATombstoneContext.java index cb946a0..7229d14 100644 --- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPATombstoneContext.java +++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPATombstoneContext.java @@ -1,90 +1,90 @@ -/******************************************************************************* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - ******************************************************************************/ -package org.apache.olingo.odata2.jpa.processor.api; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -/** - * This class provides a thread safe container for accessing Tombstone objects - * - */ -public final class ODataJPATombstoneContext { - - private static final ThreadLocal<String> deltaToken = new ThreadLocal<String>(); - private static final ThreadLocal<Long> deltaTokenUTCTimeStamp = new ThreadLocal<Long>(); - private static final ThreadLocal<HashMap<String, List<Object>>> deltas = - new ThreadLocal<HashMap<String, List<Object>>>(); - - public static String getDeltaToken() { - return deltaToken.get(); - } - - public static void setDeltaToken(final String token) { - deltaToken.set(token); - } - - public static void addToDeltaResult(final Object entity, final String entityName) { - HashMap<String, List<Object>> entityDeltaMap = deltas.get(); - if (entityDeltaMap == null) { - deltas.set(new HashMap<String, List<Object>>()); - } - entityDeltaMap = deltas.get(); - if (entityDeltaMap.get(entityName) == null) { - entityDeltaMap.put(entityName, new ArrayList<Object>()); - } - entityDeltaMap.get(entityName).add(entity); - } - - public static List<Object> getDeltaResult(final String entityName) { - HashMap<String, List<Object>> entityDeltaMap = deltas.get(); - if (entityDeltaMap != null) { - return entityDeltaMap.get(entityName); - } else { - return null; - } - } - - public static void cleanup() { - deltas.remove(); - deltaToken.remove(); - deltaTokenUTCTimeStamp.remove(); - } - - public static Long getDeltaTokenUTCTimeStamp() { - Long timestamp = deltaTokenUTCTimeStamp.get(); - - if (timestamp != null) { - return timestamp; - } else if (deltaToken.get() != null) { - try { - timestamp = new Long(Long.parseLong(deltaToken.get())); - } catch (NumberFormatException e) { - return null; - } - deltaTokenUTCTimeStamp.set(timestamp); - } else { - deltaTokenUTCTimeStamp.set(new Long(0L)); - } - - return deltaTokenUTCTimeStamp.get(); - } - -} +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + ******************************************************************************/ +package org.apache.olingo.odata2.jpa.processor.api; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +/** + * This class provides a thread safe container for accessing Tombstone objects + * + */ +public final class ODataJPATombstoneContext { + + private static final ThreadLocal<String> deltaToken = new ThreadLocal<String>(); + private static final ThreadLocal<Long> deltaTokenUTCTimeStamp = new ThreadLocal<Long>(); + private static final ThreadLocal<HashMap<String, List<Object>>> deltas = + new ThreadLocal<HashMap<String, List<Object>>>(); + + public static String getDeltaToken() { + return deltaToken.get(); + } + + public static void setDeltaToken(final String token) { + deltaToken.set(token); + } + + public static void addToDeltaResult(final Object entity, final String entityName) { + HashMap<String, List<Object>> entityDeltaMap = deltas.get(); + if (entityDeltaMap == null) { + deltas.set(new HashMap<String, List<Object>>()); + } + entityDeltaMap = deltas.get(); + if (entityDeltaMap.get(entityName) == null) { + entityDeltaMap.put(entityName, new ArrayList<Object>()); + } + entityDeltaMap.get(entityName).add(entity); + } + + public static List<Object> getDeltaResult(final String entityName) { + HashMap<String, List<Object>> entityDeltaMap = deltas.get(); + if (entityDeltaMap != null) { + return entityDeltaMap.get(entityName); + } else { + return null; + } + } + + public static void cleanup() { + deltas.remove(); + deltaToken.remove(); + deltaTokenUTCTimeStamp.remove(); + } + + public static Long getDeltaTokenUTCTimeStamp() { + Long timestamp = deltaTokenUTCTimeStamp.get(); + + if (timestamp != null) { + return timestamp; + } else if (deltaToken.get() != null) { + try { + timestamp = new Long(Long.parseLong(deltaToken.get())); + } catch (NumberFormatException e) { + return null; + } + deltaTokenUTCTimeStamp.set(timestamp); + } else { + deltaTokenUTCTimeStamp.set(new Long(0L)); + } + + return deltaTokenUTCTimeStamp.get(); + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPATombstoneEntityListener.java ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPATombstoneEntityListener.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPATombstoneEntityListener.java index ec28842..148fa38 100644 --- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPATombstoneEntityListener.java +++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/ODataJPATombstoneEntityListener.java @@ -1,60 +1,60 @@ -/******************************************************************************* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - ******************************************************************************/ -package org.apache.olingo.odata2.jpa.processor.api; - -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.Query; - -import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo; - -/** - * Extend this class and implement a JPA Entity Listener as specified in JSR 317 Java Persistence 2.0. - * The class provides abstract methods that shall be implemented by JPA application to handle OData Tombstone features. - * The implemented JPA Entity Listener classes will be called back from OData JPA Processor Library. - */ -public abstract class ODataJPATombstoneEntityListener { - - public ODataJPATombstoneEntityListener() {} - - protected final void addToDelta(final Object entity, final String entityName) { - ODataJPATombstoneContext.addToDeltaResult(entity, entityName); - } - - /** - * Implement this method to create a {@link javax.persistence.Query} object. The Query object can be created from - * OData requests. The query instance thus created can be used for handling delta JPA entities. The delta token passed - * from OData request can - * be accessed from {@link com.sap.core.odata.processor.api.jpa.ODataJPATombstoneContext}. - * @param resultsView is a reference to OData request - * @param em is a reference to {@link javax.persistence.EntityManager} - * @return an instance of type {@link javax.persistence.Query} - */ - public abstract Query getQuery(GetEntitySetUriInfo resultsView, EntityManager em); - - /** - * Implement this method to create a delta token. - * @param deltas is list of delta JPA Entities - * @param query is an instance of type {@link javax.persistence.Query} that was used for handling delta entites - * @return a delta token of type String - */ - public abstract String generateDeltaToken(List<Object> deltas, Query query); - -} +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + ******************************************************************************/ +package org.apache.olingo.odata2.jpa.processor.api; + +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.Query; + +import org.apache.olingo.odata2.api.uri.info.GetEntitySetUriInfo; + +/** + * Extend this class and implement a JPA Entity Listener as specified in JSR 317 Java Persistence 2.0. + * The class provides abstract methods that shall be implemented by JPA application to handle OData Tombstone features. + * The implemented JPA Entity Listener classes will be called back from OData JPA Processor Library. + */ +public abstract class ODataJPATombstoneEntityListener { + + public ODataJPATombstoneEntityListener() {} + + protected final void addToDelta(final Object entity, final String entityName) { + ODataJPATombstoneContext.addToDeltaResult(entity, entityName); + } + + /** + * Implement this method to create a {@link javax.persistence.Query} object. The Query object can be created from + * OData requests. The query instance thus created can be used for handling delta JPA entities. The delta token passed + * from OData request can + * be accessed from {@link com.sap.core.odata.processor.api.jpa.ODataJPATombstoneContext}. + * @param resultsView is a reference to OData request + * @param em is a reference to {@link javax.persistence.EntityManager} + * @return an instance of type {@link javax.persistence.Query} + */ + public abstract Query getQuery(GetEntitySetUriInfo resultsView, EntityManager em); + + /** + * Implement this method to create a delta token. + * @param deltas is list of delta JPA Entities + * @param query is an instance of type {@link javax.persistence.Query} that was used for handling delta entites + * @return a delta token of type String + */ + public abstract String generateDeltaToken(List<Object> deltas, Query query); + +} http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/OnJPAWriteContent.java ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/OnJPAWriteContent.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/OnJPAWriteContent.java index 6be7492..37ef6d1 100644 --- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/OnJPAWriteContent.java +++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/OnJPAWriteContent.java @@ -1,54 +1,54 @@ -/******************************************************************************* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - ******************************************************************************/ -package org.apache.olingo.odata2.jpa.processor.api; - -import java.sql.Blob; -import java.sql.Clob; - -import org.apache.olingo.odata2.api.ODataCallback; -import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; - -/** - * <p> The interface is a call back interface that enables OData JPA Processor to get JPA provider specific - * implementation - * of <b>java.sql.Blob</b> and <b>java.sql.Clob</b> instances.</p> - * <p> - * Implement this interface if the JPA Model uses the data types java.sql.Blob and java.sql.Clob for its entity - * properties. </p> - * - * - */ -public interface OnJPAWriteContent extends ODataCallback { - - /** - * Implement this method to instantiate JPA provider specific implementation of java.sql.Blob instance from an array - * of bytes. - * @param binaryData is an array of bytes - * @return an instance of type {@link java.sql.Blob} - */ - public Blob getJPABlob(byte[] binaryData) throws ODataJPARuntimeException; - - /** - * Implement this method to instantiate JPA provider specific implementation of java.sql.Clob instance from an array - * of characters. - * @param characterData is an array of characters - * @return an instance of type {@link java.sql.Clob} - */ - public Clob getJPAClob(char[] characterData) throws ODataJPARuntimeException; -} +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + ******************************************************************************/ +package org.apache.olingo.odata2.jpa.processor.api; + +import java.sql.Blob; +import java.sql.Clob; + +import org.apache.olingo.odata2.api.ODataCallback; +import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; + +/** + * <p> The interface is a call back interface that enables OData JPA Processor to get JPA provider specific + * implementation + * of <b>java.sql.Blob</b> and <b>java.sql.Clob</b> instances.</p> + * <p> + * Implement this interface if the JPA Model uses the data types java.sql.Blob and java.sql.Clob for its entity + * properties. </p> + * + * + */ +public interface OnJPAWriteContent extends ODataCallback { + + /** + * Implement this method to instantiate JPA provider specific implementation of java.sql.Blob instance from an array + * of bytes. + * @param binaryData is an array of bytes + * @return an instance of type {@link java.sql.Blob} + */ + public Blob getJPABlob(byte[] binaryData) throws ODataJPARuntimeException; + + /** + * Implement this method to instantiate JPA provider specific implementation of java.sql.Clob instance from an array + * of characters. + * @param characterData is an array of characters + * @return an instance of type {@link java.sql.Clob} + */ + public Clob getJPAClob(char[] characterData) throws ODataJPARuntimeException; +} http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/access/JPAPaging.java ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/access/JPAPaging.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/access/JPAPaging.java index 2e3881f..3c1821d 100644 --- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/access/JPAPaging.java +++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/access/JPAPaging.java @@ -1,32 +1,32 @@ -/******************************************************************************* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - ******************************************************************************/ -package org.apache.olingo.odata2.jpa.processor.api.access; - -import java.util.List; - -public interface JPAPaging { - public int getPageSize(); - - public List<Object> getPagedEntities(); - - public int getNextPage(); - - public int getStartPage(); - -} +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + ******************************************************************************/ +package org.apache.olingo.odata2.jpa.processor.api.access; + +import java.util.List; + +public interface JPAPaging { + public int getPageSize(); + + public List<Object> getPagedEntities(); + + public int getNextPage(); + + public int getStartPage(); + +} http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/exception/ODataJPAErrorCallback.java ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/exception/ODataJPAErrorCallback.java b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/exception/ODataJPAErrorCallback.java index 4482f61..fa044f1 100644 --- a/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/exception/ODataJPAErrorCallback.java +++ b/odata2-jpa-processor/jpa-api/src/main/java/org/apache/olingo/odata2/jpa/processor/api/exception/ODataJPAErrorCallback.java @@ -1,45 +1,45 @@ -/******************************************************************************* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - ******************************************************************************/ -package org.apache.olingo.odata2.jpa.processor.api.exception; - -import org.apache.olingo.odata2.api.ep.EntityProvider; -import org.apache.olingo.odata2.api.exception.ODataApplicationException; -import org.apache.olingo.odata2.api.processor.ODataErrorCallback; -import org.apache.olingo.odata2.api.processor.ODataErrorContext; -import org.apache.olingo.odata2.api.processor.ODataResponse; - -public class ODataJPAErrorCallback implements ODataErrorCallback { - - @Override - public ODataResponse handleError(final ODataErrorContext context) throws ODataApplicationException { - - final String SEPARATOR = " : "; - - Throwable t = context.getException(); - if (t instanceof ODataJPAException && t.getCause() != null) { - StringBuilder errorBuilder = new StringBuilder(); - errorBuilder.append(t.getCause().getClass().toString()); - errorBuilder.append(SEPARATOR); - errorBuilder.append(t.getCause().getMessage()); - context.setInnerError(errorBuilder.toString()); - } - return EntityProvider.writeErrorDocument(context); - } - -} +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + ******************************************************************************/ +package org.apache.olingo.odata2.jpa.processor.api.exception; + +import org.apache.olingo.odata2.api.ep.EntityProvider; +import org.apache.olingo.odata2.api.exception.ODataApplicationException; +import org.apache.olingo.odata2.api.processor.ODataErrorCallback; +import org.apache.olingo.odata2.api.processor.ODataErrorContext; +import org.apache.olingo.odata2.api.processor.ODataResponse; + +public class ODataJPAErrorCallback implements ODataErrorCallback { + + @Override + public ODataResponse handleError(final ODataErrorContext context) throws ODataApplicationException { + + final String SEPARATOR = " : "; + + Throwable t = context.getException(); + if (t instanceof ODataJPAException && t.getCause() != null) { + StringBuilder errorBuilder = new StringBuilder(); + errorBuilder.append(t.getCause().getClass().toString()); + errorBuilder.append(SEPARATOR); + errorBuilder.append(t.getCause().getMessage()); + context.setInnerError(errorBuilder.toString()); + } + return EntityProvider.writeErrorDocument(context); + } + +} http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-core/.gitignore ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-core/.gitignore b/odata2-jpa-processor/jpa-core/.gitignore index fe5d89b..a7ffe90 100644 --- a/odata2-jpa-processor/jpa-core/.gitignore +++ b/odata2-jpa-processor/jpa-core/.gitignore @@ -1,8 +1,8 @@ -.project -.classpath -.settings -target -bin -*.bak -classes +.project +.classpath +.settings +target +bin +*.bak +classes .DS_Store \ No newline at end of file http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/a6e2fbe5/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAResponseBuilderDefault.java ---------------------------------------------------------------------- diff --git a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAResponseBuilderDefault.java b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAResponseBuilderDefault.java index e5ed19b..fc0653f 100644 --- a/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAResponseBuilderDefault.java +++ b/odata2-jpa-processor/jpa-core/src/main/java/org/apache/olingo/odata2/jpa/processor/core/ODataJPAResponseBuilderDefault.java @@ -563,7 +563,9 @@ public final class ODataJPAResponseBuilderDefault implements ODataJPAResponseBui edmEntityList.subList(0, resultsView.getSkip()).clear(); } if (resultsView.getTop() != null && resultsView.getTop() >= 0 && resultsView.getTop() < edmEntityList.size()) { - edmEntityList.retainAll(edmEntityList.subList(0, resultsView.getTop())); + final List<Map<String, Object>> edmEntitySubList = + new ArrayList<Map<String, Object>>(edmEntityList.subList(0, resultsView.getTop())); + edmEntityList.retainAll(edmEntitySubList); } } }// Inlinecount of None is handled by default - null
