From 59766b23b937cd3b81ee55c8f4ca46c92c882aec Mon Sep 17 00:00:00 2001 From: Michael Bolz Date: Thu, 26 Feb 2015 09:56:01 +0100 Subject: [PATCH] [OLINGO-564] Minor clean up --- .../org/apache/olingo/server/api/uri/UriHelper.java | 2 +- .../olingo/server/tecsvc/data/DataCreator.java | 6 +++--- .../olingo/server/tecsvc/data/DataProvider.java | 11 +++++------ .../tecsvc/processor/TechnicalBatchProcessor.java | 12 ++++++------ 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriHelper.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriHelper.java index a44f0cd3d..a21ae1e81 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriHelper.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriHelper.java @@ -80,7 +80,7 @@ public interface UriHelper { * @param entityLink the link as String * @param rawServiceRoot the root URI of the service * @return a list of key predicates - * @throws DeserializationException in case the link is malformed + * @throws DeserializerException in case the link is malformed */ List getKeyPredicatesFromEntityLink(Edm edm, String entityLink, String rawServiceRoot) throws DeserializerException; diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java index 70eb22002..e56093ba9 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataCreator.java @@ -168,7 +168,7 @@ public class DataCreator { createPrimitive("PropertyInt32", Integer.MAX_VALUE), createPrimitive("PropertyInt64", Long.MAX_VALUE), createPrimitive("PropertySByte", Byte.MAX_VALUE), - createPrimitive("PropertyTimeOfDay", getTime(21, 05, 59)) + createPrimitive("PropertyTimeOfDay", getTime(21, 5, 59)) ) )) .addProperty(new PropertyImpl(null, "PropertyCompNav", ValueType.LINKED_COMPLEX, createCTPrimCompValue(1))) @@ -201,7 +201,7 @@ public class DataCreator { cvAllPrim.getValue().add(createPrimitive("PropertyInt32", Integer.MAX_VALUE)); cvAllPrim.getValue().add(createPrimitive("PropertyInt64", Long.MAX_VALUE)); cvAllPrim.getValue().add(createPrimitive("PropertySByte", Byte.MAX_VALUE)); - cvAllPrim.getValue().add(createPrimitive("PropertyTimeOfDay", getTime(21, 05, 59))); + cvAllPrim.getValue().add(createPrimitive("PropertyTimeOfDay", getTime(21, 5, 59))); return cvAllPrim; } @@ -640,7 +640,7 @@ public class DataCreator { } - private void linkESTwoKeyNav(Map data2) { + private void linkESTwoKeyNav(Map data) { final EntitySet entitySet = data.get("ESTwoKeyNav"); final List esKeyNavTargets = data.get("ESKeyNav").getEntities(); final List esTwoKeyNavTargets = data.get("ESTwoKeyNav").getEntities(); diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java index 472b53084..b0bbd381a 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java @@ -272,11 +272,10 @@ public class DataProvider { // Deep insert (only if not an update) if (isInsert) { handleDeepInsert(rawBaseUri, edmEntitySet, entity, changedEntity); - } else if (isInsert && changedEntity.getNavigationLinks().size() != 0) { - throw new DataProviderException("Deep inserts are not allowed in update operations using PUT or PATCH requests."); } - if (!changedEntity.getNavigationBindings().isEmpty()) { + final boolean navigationBindingsAvailable = !changedEntity.getNavigationBindings().isEmpty(); + if (navigationBindingsAvailable) { applyNavigationBinding(rawBaseUri, edmEntitySet, entity, changedEntity.getNavigationBindings()); } } @@ -320,7 +319,7 @@ public class DataProvider { } } - private void handleDeepInsert(final String rawBaseUri, final EdmEntitySet edmEntitySet, Entity entity, + private void handleDeepInsert(final String rawBaseUri, final EdmEntitySet edmEntitySet, final Entity entity, final Entity changedEntity) throws DataProviderException { final EdmEntityType entityType = edmEntitySet.getEntityType(); @@ -352,10 +351,10 @@ public class DataProvider { } private List createInlineEntities(final String rawBaseUri, final EdmBindingTarget target, - final EdmEntityType type, final EntitySet changedEntitsSet) throws DataProviderException { + final EdmEntityType type, final EntitySet changedEntitySet) throws DataProviderException { List entities = new ArrayList(); - for (final Entity newEntity : changedEntitsSet.getEntities()) { + for (final Entity newEntity : changedEntitySet.getEntities()) { entities.add(createInlineEntity(rawBaseUri, target, type, newEntity)); } diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalBatchProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalBatchProcessor.java index 37884be5a..d2c4286eb 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalBatchProcessor.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalBatchProcessor.java @@ -45,11 +45,11 @@ public class TechnicalBatchProcessor extends TechnicalProcessor implements Batch } @Override - public void processBatch(BatchFacade fascade, ODataRequest request, ODataResponse response) + public void processBatch(BatchFacade facade, ODataRequest request, ODataResponse response) throws BatchSerializerException, BatchDeserializerException { boolean continueOnError = isContinueOnError(request); - final String boundary = fascade.extractBoundaryFromContentType(request.getHeader(HttpHeader.CONTENT_TYPE)); + final String boundary = facade.extractBoundaryFromContentType(request.getHeader(HttpHeader.CONTENT_TYPE)); final BatchOptions options = BatchOptions.with() .rawBaseUri(request.getRawBaseUri()) .rawServiceResolutionUri(request.getRawServiceResolutionUri()).build(); @@ -58,7 +58,7 @@ public class TechnicalBatchProcessor extends TechnicalProcessor implements Batch final List responseParts = new ArrayList(); for (BatchRequestPart part : parts) { - final ODataResponsePart responsePart = fascade.handleBatchRequest(part); + final ODataResponsePart responsePart = facade.handleBatchRequest(part); responseParts.add(responsePart); // Also add failed responses final int statusCode = responsePart.getResponses().get(0).getStatusCode(); @@ -71,7 +71,7 @@ public class TechnicalBatchProcessor extends TechnicalProcessor implements Batch } } - final String responseBoundary = "batch_" + UUID.randomUUID().toString();; + final String responseBoundary = "batch_" + UUID.randomUUID().toString(); final InputStream responseContent = odata.createFixedFormatSerializer().batchResponse(responseParts, responseBoundary); response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED + ";boundary=" + responseBoundary); @@ -93,12 +93,12 @@ public class TechnicalBatchProcessor extends TechnicalProcessor implements Batch } @Override - public ODataResponsePart processChangeSet(BatchFacade fascade, List requests) + public ODataResponsePart processChangeSet(BatchFacade facade, List requests) throws BatchDeserializerException { List responses = new ArrayList(); for (ODataRequest request : requests) { - final ODataResponse oDataResponse = fascade.handleODataRequest(request); + final ODataResponse oDataResponse = facade.handleODataRequest(request); final int statusCode = oDataResponse.getStatusCode(); if (statusCode < 400) {