You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2014/07/03 09:16:46 UTC
[49/55] [abbrv] [partial] [OLINGO-328] code cleanup and checkstyle
issues
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2ab4b2fd/fit/src/main/java/org/apache/olingo/fit/V3KeyAsSegment.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V3KeyAsSegment.java b/fit/src/main/java/org/apache/olingo/fit/V3KeyAsSegment.java
index 35db43e..fb6a446 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V3KeyAsSegment.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V3KeyAsSegment.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@@ -21,6 +21,7 @@ package org.apache.olingo.fit;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
+
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
@@ -36,6 +37,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.fit.methods.MERGE;
@@ -50,13 +52,13 @@ public class V3KeyAsSegment {
private final V3Services services;
public V3KeyAsSegment() throws Exception {
- this.services = new V3Services();
+ services = new V3Services();
}
private Response replaceServiceName(final Response response) {
try {
final String content = IOUtils.toString((InputStream) response.getEntity(), Constants.ENCODING).
- replaceAll("Static\\.svc", "KeyAsSegment.svc");
+ replaceAll("Static\\.svc", "KeyAsSegment.svc");
final Response.ResponseBuilder builder = Response.status(response.getStatus());
for (String headerName : response.getHeaders().keySet()) {
@@ -82,91 +84,91 @@ public class V3KeyAsSegment {
@GET
@Path("/{entitySetName}/{entityId}")
public Response getEntity(
- @Context UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format,
- @QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) String expand,
- @QueryParam("$select") @DefaultValue(StringUtils.EMPTY) String select) {
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ @QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
+ @QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
return replaceServiceName(services.getEntityInternal(uriInfo.getRequestUri().toASCIIString(),
- accept, entitySetName, entityId, format, expand, select, true));
+ accept, entitySetName, entityId, format, expand, select, true));
}
@DELETE
@Path("/{entitySetName}/{entityId}")
public Response removeEntity(
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId) {
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId) {
return replaceServiceName(services.removeEntity(entitySetName, entityId));
}
@MERGE
@Path("/{entitySetName}/{entityId}")
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
- @Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
public Response mergeEntity(
- @Context UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) String prefer,
- @HeaderParam("If-Match") @DefaultValue(StringUtils.EMPTY) String ifMatch,
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId,
- final String changes) {
-
- return replaceServiceName(
- services.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, entitySetName, entityId, changes));
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ @HeaderParam("If-Match") @DefaultValue(StringUtils.EMPTY) final String ifMatch,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ final String changes) {
+
+ return replaceServiceName(services.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, entitySetName,
+ entityId, changes));
}
@PATCH
@Path("/{entitySetName}/{entityId}")
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
- @Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
public Response patchEntity(
- @Context UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) String prefer,
- @HeaderParam("If-Match") @DefaultValue(StringUtils.EMPTY) String ifMatch,
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId,
- final String changes) {
-
- return replaceServiceName(
- services.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, entitySetName, entityId, changes));
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ @HeaderParam("If-Match") @DefaultValue(StringUtils.EMPTY) final String ifMatch,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ final String changes) {
+
+ return replaceServiceName(services.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, entitySetName,
+ entityId, changes));
}
@PUT
@Path("/{entitySetName}/{entityId}")
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
- @Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
public Response putNewEntity(
- @Context UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) String prefer,
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId,
- final String entity) {
-
- return replaceServiceName(
- services.replaceEntity(uriInfo, accept, contentType, prefer, entitySetName, entityId, entity));
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ final String entity) {
+
+ return replaceServiceName(services.replaceEntity(uriInfo, accept, contentType, prefer, entitySetName, entityId,
+ entity));
}
@POST
@Path("/{entitySetName}")
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
- @Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM})
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM })
public Response postNewEntity(
- @Context UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) String prefer,
- @PathParam("entitySetName") String entitySetName,
- final String entity) {
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ @PathParam("entitySetName") final String entitySetName,
+ final String entity) {
return replaceServiceName(services.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entity));
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2ab4b2fd/fit/src/main/java/org/apache/olingo/fit/V3OpenType.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V3OpenType.java b/fit/src/main/java/org/apache/olingo/fit/V3OpenType.java
index 23d644b..55abc3b 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V3OpenType.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V3OpenType.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@@ -23,6 +23,7 @@ import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
@@ -37,6 +38,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
@@ -55,14 +57,14 @@ public class V3OpenType extends V3Services {
public V3OpenType() throws Exception {
super(new Metadata(FSManager.instance(ODataServiceVersion.V30).
- readRes("openType" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V30, ConstantKey.METADATA)),
+ readRes("openType" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V30, ConstantKey.METADATA)),
Accept.XML), ODataServiceVersion.V30));
}
private Response replaceServiceName(final Response response) {
try {
final String content = IOUtils.toString((InputStream) response.getEntity(), Constants.ENCODING).
- replaceAll("Static\\.svc", "OpenType.svc");
+ replaceAll("Static\\.svc", "OpenType.svc");
final Response.ResponseBuilder builder = Response.status(response.getStatus());
for (String headerName : response.getHeaders().keySet()) {
@@ -87,7 +89,7 @@ public class V3OpenType extends V3Services {
/**
* Provide sample large metadata.
- *
+ *
* @return metadata.
*/
@GET
@@ -96,39 +98,39 @@ public class V3OpenType extends V3Services {
@Override
public Response getMetadata() {
return super.getMetadata("openType" + StringUtils.capitalize(
- Constants.get(ODataServiceVersion.V30, ConstantKey.METADATA)));
+ Constants.get(ODataServiceVersion.V30, ConstantKey.METADATA)));
}
@GET
@Path("/{entitySetName}({entityId})")
@Override
public Response getEntity(
- @Context UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format,
- @QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) String expand,
- @QueryParam("$select") @DefaultValue(StringUtils.EMPTY) String select) {
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ @QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
+ @QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
final Matcher matcher = GUID.matcher(entityId);
return replaceServiceName(super.getEntityInternal(
- uriInfo.getRequestUri().toASCIIString(), accept, entitySetName,
- matcher.matches() ? matcher.group(1) : entityId, format, expand, select, false));
+ uriInfo.getRequestUri().toASCIIString(), accept, entitySetName,
+ matcher.matches() ? matcher.group(1) : entityId, format, expand, select, false));
}
@POST
@Path("/{entitySetName}")
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
- @Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM})
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM })
@Override
public Response postNewEntity(
- @Context UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) String prefer,
- @PathParam("entitySetName") final String entitySetName,
- final String entity) {
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ @PathParam("entitySetName") final String entitySetName,
+ final String entity) {
return replaceServiceName(super.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entity));
}
@@ -137,11 +139,11 @@ public class V3OpenType extends V3Services {
@Path("/{entitySetName}({entityId})")
@Override
public Response removeEntity(
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId) {
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId) {
final Matcher matcher = GUID.matcher(entityId);
return replaceServiceName(super.removeEntity(entitySetName,
- matcher.matches() ? matcher.group(1) : entityId));
+ matcher.matches() ? matcher.group(1) : entityId));
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2ab4b2fd/fit/src/main/java/org/apache/olingo/fit/V3PrimitiveKeys.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V3PrimitiveKeys.java b/fit/src/main/java/org/apache/olingo/fit/V3PrimitiveKeys.java
index d235bc0..2368b13 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V3PrimitiveKeys.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V3PrimitiveKeys.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@@ -23,6 +23,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+
import org.apache.olingo.fit.utils.Accept;
import org.apache.olingo.fit.utils.FSManager;
import org.springframework.stereotype.Service;
@@ -37,7 +38,7 @@ public class V3PrimitiveKeys extends V3Services {
/**
* Provide sample large metadata.
- *
+ *
* @return metadata.
*/
@GET
@@ -47,7 +48,7 @@ public class V3PrimitiveKeys extends V3Services {
public Response getMetadata() {
try {
return xml.createResponse(
- null, FSManager.instance(version).readRes("primitiveKeysMetadata", Accept.XML), null, Accept.XML);
+ null, FSManager.instance(version).readRes("primitiveKeysMetadata", Accept.XML), null, Accept.XML);
} catch (Exception e) {
return xml.createFaultResponse(Accept.XML.toString(version), e);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2ab4b2fd/fit/src/main/java/org/apache/olingo/fit/V3Services.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V3Services.java b/fit/src/main/java/org/apache/olingo/fit/V3Services.java
index a036fd2..be2a297 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V3Services.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V3Services.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@@ -26,6 +26,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
+
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMultipart;
import javax.ws.rs.BadRequestException;
@@ -36,7 +37,6 @@ import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
-import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
@@ -45,6 +45,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.cxf.interceptor.InInterceptors;
@@ -61,6 +62,7 @@ import org.apache.olingo.fit.utils.ConstantKey;
import org.apache.olingo.fit.utils.Constants;
import org.apache.olingo.fit.utils.FSManager;
import org.apache.olingo.fit.utils.LinkInfo;
+import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
import org.springframework.stereotype.Service;
@Service
@@ -79,8 +81,8 @@ public class V3Services extends AbstractServices {
@GET
@Path("/InStreamErrorGetCustomer")
public Response instreamErrorGetCustomer(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format) {
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
final Accept acceptType;
if (StringUtils.isNotBlank(format)) {
@@ -93,9 +95,9 @@ public class V3Services extends AbstractServices {
final InputStream error = FSManager.instance(version).readFile("InStreamErrorGetCustomer", acceptType);
return Response.ok(error).
- header(Constants.get(version, ConstantKey.ODATA_SERVICE_VERSION), version + ";").
- header("Content-Type", acceptType.toString(version)).
- build();
+ header(Constants.get(version, ConstantKey.ODATA_SERVICE_VERSION), version + ";").
+ header("Content-Type", acceptType.toString(version)).
+ build();
} catch (Exception e) {
if (acceptType == Accept.XML || acceptType == Accept.TEXT) {
throw new UnsupportedMediaTypeException("Unsupported media type");
@@ -107,7 +109,7 @@ public class V3Services extends AbstractServices {
/**
* Provide sample large metadata.
- *
+ *
* @return metadata.
*/
@GET
@@ -126,8 +128,8 @@ public class V3Services extends AbstractServices {
@Override
public InputStream exploreMultipart(
- final List<Attachment> attachments, final String boundary, final boolean contineOnError)
- throws IOException {
+ final List<Attachment> attachments, final String boundary, final boolean contineOnError)
+ throws IOException {
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
Response res = null;
@@ -213,15 +215,15 @@ public class V3Services extends AbstractServices {
@GET
@Path("/Car/{type:.*}")
public Response filterCar(
- @Context UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @QueryParam("$top") @DefaultValue(StringUtils.EMPTY) String top,
- @QueryParam("$skip") @DefaultValue(StringUtils.EMPTY) String skip,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format,
- @QueryParam("$inlinecount") @DefaultValue(StringUtils.EMPTY) String count,
- @QueryParam("$filter") @DefaultValue(StringUtils.EMPTY) String filter,
- @QueryParam("$orderby") @DefaultValue(StringUtils.EMPTY) String orderby,
- @QueryParam("$skiptoken") @DefaultValue(StringUtils.EMPTY) String skiptoken) {
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @QueryParam("$top") @DefaultValue(StringUtils.EMPTY) final String top,
+ @QueryParam("$skip") @DefaultValue(StringUtils.EMPTY) final String skip,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ @QueryParam("$inlinecount") @DefaultValue(StringUtils.EMPTY) final String count,
+ @QueryParam("$filter") @DefaultValue(StringUtils.EMPTY) final String filter,
+ @QueryParam("$orderby") @DefaultValue(StringUtils.EMPTY) final String orderby,
+ @QueryParam("$skiptoken") @DefaultValue(StringUtils.EMPTY) final String skiptoken) {
return super.getEntitySet(uriInfo, accept, "Car", top, skip, format, count, filter, orderby, skiptoken);
}
@@ -229,27 +231,27 @@ public class V3Services extends AbstractServices {
@GET
@Path("/Login({entityId})")
public Response getLogin(
- @Context UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @PathParam("entityId") String entityId,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format,
- @QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) String expand,
- @QueryParam("$select") @DefaultValue(StringUtils.EMPTY) String select) {
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @PathParam("entityId") final String entityId,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ @QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
+ @QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
return super.getEntityInternal(uriInfo.getRequestUri().toASCIIString(), accept,
- "Login", StringUtils.remove(entityId, "'"), format, expand, select, false);
+ "Login", StringUtils.remove(entityId, "'"), format, expand, select, false);
}
@POST
@Path("/Login")
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
- @Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM})
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM })
public Response postLogin(
- @Context UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) String prefer,
- final String entity) {
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ final String entity) {
if ("{\"odata.type\":\"Microsoft.Test.OData.Services.AstoriaDefaultService.Login\"}".equals(entity)) {
return xml.createFaultResponse(accept, new BadRequestException());
@@ -261,14 +263,14 @@ public class V3Services extends AbstractServices {
@DELETE
@Path("/Login({entityId})")
public Response removeLogin(
- @PathParam("entityId") String entityId) {
+ @PathParam("entityId") final String entityId) {
return super.removeEntity("Login", StringUtils.remove(entityId, "'"));
}
/**
* Retrieve links sample.
- *
+ *
* @param accept Accept header.
* @param entitySetName Entity set name.
* @param entityId entity id.
@@ -279,11 +281,11 @@ public class V3Services extends AbstractServices {
@GET
@Path("/{entitySetName}({entityId})/$links/{linkName}")
public Response getLinks(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId,
- @PathParam("linkName") String linkName,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format) {
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ @PathParam("linkName") final String linkName,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
try {
final Accept acceptType;
if (StringUtils.isNotBlank(format)) {
@@ -299,9 +301,9 @@ public class V3Services extends AbstractServices {
final LinkInfo links = xml.readLinks(entitySetName, entityId, linkName, acceptType);
return xml.createResponse(
- links.getLinks(),
- links.getEtag(),
- acceptType);
+ links.getLinks(),
+ links.getEtag(),
+ acceptType);
} catch (Exception e) {
return xml.createFaultResponse(accept, e);
}
@@ -310,13 +312,13 @@ public class V3Services extends AbstractServices {
@POST
@Path("/{entitySetName}({entityId})/$links/{linkName}")
public Response postLink(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId,
- @PathParam("linkName") String linkName,
- String link,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format) {
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ @PathParam("linkName") final String linkName,
+ final String link,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
try {
final Accept acceptType;
if (StringUtils.isNotBlank(format)) {
@@ -346,11 +348,11 @@ public class V3Services extends AbstractServices {
}
utils.putLinksInMemory(
- Commons.getEntityBasePath(entitySetName, entityId),
- entitySetName,
- entityId,
- linkName,
- links);
+ Commons.getEntityBasePath(entitySetName, entityId),
+ entitySetName,
+ entityId,
+ linkName,
+ links);
return xml.createResponse(null, null, null, Response.Status.NO_CONTENT);
} catch (Exception e) {
@@ -361,39 +363,39 @@ public class V3Services extends AbstractServices {
@MERGE
@Path("/{entitySetName}({entityId})/$links/{linkName}")
public Response mergeLink(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId,
- @PathParam("linkName") String linkName,
- String link,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format) {
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ @PathParam("linkName") final String linkName,
+ final String link,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
return putLink(accept, contentType, entitySetName, entityId, linkName, link, format);
}
@PATCH
@Path("/{entitySetName}({entityId})/$links/{linkName}")
public Response patchLink(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId,
- @PathParam("linkName") String linkName,
- String link,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format) {
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ @PathParam("linkName") final String linkName,
+ final String link,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
return putLink(accept, contentType, entitySetName, entityId, linkName, link, format);
}
@PUT
@Path("/{entitySetName}({entityId})/$links/{linkName}")
public Response putLink(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId,
- @PathParam("linkName") String linkName,
- String link,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format) {
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ @PathParam("linkName") final String linkName,
+ final String link,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
try {
final Accept acceptType;
if (StringUtils.isNotBlank(format)) {
@@ -423,10 +425,10 @@ public class V3Services extends AbstractServices {
}
utils.putLinksInMemory(
- Commons.getEntityBasePath(entitySetName, entityId),
- entitySetName,
- linkName,
- links);
+ Commons.getEntityBasePath(entitySetName, entityId),
+ entitySetName,
+ linkName,
+ links);
return xml.createResponse(null, null, null, Response.Status.NO_CONTENT);
} catch (Exception e) {
@@ -437,13 +439,13 @@ public class V3Services extends AbstractServices {
@DELETE
@Path("/{entitySetName}({entityId})/$links/{linkName}({linkId})")
public Response deleteLink(
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId,
- @PathParam("linkName") String linkName,
- @PathParam("linkId") String linkId,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format) {
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ @PathParam("linkName") final String linkName,
+ @PathParam("linkId") final String linkId,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format) {
try {
final Accept acceptType;
if (StringUtils.isNotBlank(format)) {
@@ -459,19 +461,19 @@ public class V3Services extends AbstractServices {
final AbstractUtilities utils = getUtilities(acceptType);
final Map.Entry<String, List<String>> currents = json.extractLinkURIs(utils.readLinks(
- entitySetName, entityId, linkName, Accept.JSON_FULLMETA).getLinks());
+ entitySetName, entityId, linkName, Accept.JSON_FULLMETA).getLinks());
final Map.Entry<String, List<String>> toBeRemoved = json.extractLinkURIs(utils.readLinks(
- entitySetName, entityId, linkName + "(" + linkId + ")", Accept.JSON_FULLMETA).getLinks());
+ entitySetName, entityId, linkName + "(" + linkId + ")", Accept.JSON_FULLMETA).getLinks());
final List<String> remains = currents.getValue();
remains.removeAll(toBeRemoved.getValue());
utils.putLinksInMemory(
- Commons.getEntityBasePath(entitySetName, entityId),
- entitySetName,
- linkName,
- remains);
+ Commons.getEntityBasePath(entitySetName, entityId),
+ entitySetName,
+ linkName,
+ remains);
return xml.createResponse(null, null, null, Response.Status.NO_CONTENT);
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2ab4b2fd/fit/src/main/java/org/apache/olingo/fit/V4Demo.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4Demo.java b/fit/src/main/java/org/apache/olingo/fit/V4Demo.java
index c308a08..1c6f501 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4Demo.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4Demo.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@@ -21,6 +21,7 @@ package org.apache.olingo.fit;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
+
import javax.ws.rs.Consumes;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
@@ -35,6 +36,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
@@ -52,14 +54,14 @@ public class V4Demo extends V4Services {
public V4Demo() throws Exception {
super(new Metadata(FSManager.instance(ODataServiceVersion.V40).
- readRes("demo" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)),
+ readRes("demo" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)),
Accept.XML), ODataServiceVersion.V40));
}
private Response replaceServiceName(final Response response) {
try {
final String content = IOUtils.toString((InputStream) response.getEntity(), Constants.ENCODING).
- replaceAll("Static\\.svc", "Demo.svc");
+ replaceAll("Static\\.svc", "Demo.svc");
final Response.ResponseBuilder builder = Response.status(response.getStatus());
for (String headerName : response.getHeaders().keySet()) {
@@ -88,84 +90,84 @@ public class V4Demo extends V4Services {
@Override
public Response getMetadata() {
return super.getMetadata(
- "demo" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)));
+ "demo" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)));
}
@GET
@Path("/{entitySetName}({entityId})")
@Override
public Response getEntity(
- @Context UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format,
- @QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) String expand,
- @QueryParam("$select") @DefaultValue(StringUtils.EMPTY) String select) {
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ @QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
+ @QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
return replaceServiceName(super.getEntityInternal(uriInfo.getRequestUri().toASCIIString(),
- accept, entitySetName, entityId, format, expand, select, false));
+ accept, entitySetName, entityId, format, expand, select, false));
}
@GET
@Path("/{entitySetName}({entityId})/$value")
@Override
public Response getMediaEntity(
- @Context UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId) {
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId) {
return super.getMediaEntity(uriInfo, accept, entitySetName, entityId);
}
@POST
@Path("/{entitySetName}")
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
- @Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM})
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM })
@Override
public Response postNewEntity(
- @Context UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) String prefer,
- @PathParam("entitySetName") String entitySetName,
- final String entity) {
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ @PathParam("entitySetName") final String entitySetName,
+ final String entity) {
return replaceServiceName(super.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entity));
}
@PATCH
@Path("/{entitySetName}({entityId})")
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
- @Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
@Override
public Response patchEntity(
- @Context UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) String prefer,
- @HeaderParam("If-Match") @DefaultValue(StringUtils.EMPTY) String ifMatch,
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId,
- final String changes) {
-
- return replaceServiceName(
- super.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, entitySetName, entityId, changes));
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ @HeaderParam("If-Match") @DefaultValue(StringUtils.EMPTY) final String ifMatch,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ final String changes) {
+
+ return replaceServiceName(super.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, entitySetName, entityId,
+ changes));
}
@PUT
- @Produces({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
- @Consumes({MediaType.WILDCARD, MediaType.APPLICATION_OCTET_STREAM})
+ @Produces({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.WILDCARD, MediaType.APPLICATION_OCTET_STREAM })
@Path("/{entitySetName}({entityId})/$value")
@Override
public Response replaceMediaEntity(
- @Context UriInfo uriInfo,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) String prefer,
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format,
- String value) {
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ final String value) {
return super.replaceMediaEntity(uriInfo, prefer, entitySetName, entityId, format, value);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2ab4b2fd/fit/src/main/java/org/apache/olingo/fit/V4KeyAsSegment.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4KeyAsSegment.java b/fit/src/main/java/org/apache/olingo/fit/V4KeyAsSegment.java
index f8879c0..1474c1f 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4KeyAsSegment.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4KeyAsSegment.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@@ -21,6 +21,7 @@ package org.apache.olingo.fit;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
+
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
@@ -34,6 +35,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.fit.methods.PATCH;
@@ -54,7 +56,7 @@ public class V4KeyAsSegment extends V4Services {
private Response replaceServiceName(final Response response) {
try {
final String content = IOUtils.toString((InputStream) response.getEntity(), Constants.ENCODING).
- replaceAll("Static\\.svc", "KeyAsSegment.svc");
+ replaceAll("Static\\.svc", "KeyAsSegment.svc");
final Response.ResponseBuilder builder = Response.status(response.getStatus());
for (String headerName : response.getHeaders().keySet()) {
@@ -80,67 +82,67 @@ public class V4KeyAsSegment extends V4Services {
@Override
public Response getEntitySet(final String accept, final String name, final String type) {
return replaceServiceName(super.getEntityInternal(uriInfo.getRequestUri().toASCIIString(),
- accept, name, type, null, null, null, true));
+ accept, name, type, null, null, null, true));
}
@DELETE
@Path("/{entitySetName}/{entityId}")
@Override
public Response removeEntity(
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId) {
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId) {
return replaceServiceName(super.removeEntity(entitySetName, entityId));
}
@PATCH
@Path("/{entitySetName}/{entityId}")
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
- @Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
@Override
public Response patchEntity(
- @Context UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) String prefer,
- @HeaderParam("If-Match") @DefaultValue(StringUtils.EMPTY) String ifMatch,
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId,
- final String changes) {
-
- return replaceServiceName(
- super.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, entitySetName, entityId, changes));
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ @HeaderParam("If-Match") @DefaultValue(StringUtils.EMPTY) final String ifMatch,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ final String changes) {
+
+ return replaceServiceName(super.patchEntity(uriInfo, accept, contentType, prefer, ifMatch, entitySetName, entityId,
+ changes));
}
@PUT
@Path("/{entitySetName}/{entityId}")
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
- @Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
public Response putNewEntity(
- @Context UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) String prefer,
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId,
- final String entity) {
-
- return replaceServiceName(
- super.replaceEntity(uriInfo, accept, contentType, prefer, entitySetName, entityId, entity));
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ final String entity) {
+
+ return replaceServiceName(super
+ .replaceEntity(uriInfo, accept, contentType, prefer, entitySetName, entityId, entity));
}
@POST
@Path("/{entitySetName}")
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
- @Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM})
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM })
@Override
public Response postNewEntity(
- @Context UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) String prefer,
- @PathParam("entitySetName") String entitySetName,
- final String entity) {
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ @PathParam("entitySetName") final String entitySetName,
+ final String entity) {
return replaceServiceName(super.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entity));
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2ab4b2fd/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java b/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java
index 7a4a9c9..1fc5eab 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java
@@ -1,29 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit;
-import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
+
import org.apache.cxf.interceptor.InInterceptors;
import org.apache.olingo.fit.utils.ConstantKey;
import org.apache.olingo.fit.utils.Constants;
+import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
import org.springframework.stereotype.Service;
@Service
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2ab4b2fd/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java b/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
index e8838a6..7daddf8 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
@@ -1,35 +1,36 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.fit;
-import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
+
import org.apache.cxf.interceptor.InInterceptors;
import org.apache.olingo.fit.utils.ConstantKey;
import org.apache.olingo.fit.utils.Constants;
import org.apache.olingo.fit.utils.ResolvingReferencesInterceptor;
+import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
import org.springframework.stereotype.Service;
@Service
@Path("/V40/NorthWindExt.svc")
-@InInterceptors(classes = {XHTTPMethodInterceptor.class, ResolvingReferencesInterceptor.class})
+@InInterceptors(classes = { XHTTPMethodInterceptor.class, ResolvingReferencesInterceptor.class })
public class V4NorthWindExt extends V4Services {
public V4NorthWindExt() throws Exception {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2ab4b2fd/fit/src/main/java/org/apache/olingo/fit/V4OpenType.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4OpenType.java b/fit/src/main/java/org/apache/olingo/fit/V4OpenType.java
index b76293a..aac908a 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4OpenType.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4OpenType.java
@@ -1,18 +1,18 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
+ * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
+ * 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
- *
+ * 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
+ * KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@@ -21,6 +21,7 @@ package org.apache.olingo.fit;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
+
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
@@ -35,6 +36,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
@@ -51,14 +53,14 @@ public class V4OpenType extends V4Services {
public V4OpenType() throws Exception {
super(new Metadata(FSManager.instance(ODataServiceVersion.V40).
- readRes("openType" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)),
+ readRes("openType" + StringUtils.capitalize(Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)),
Accept.XML), ODataServiceVersion.V40));
}
private Response replaceServiceName(final Response response) {
try {
final String content = IOUtils.toString((InputStream) response.getEntity(), Constants.ENCODING).
- replaceAll("Static\\.svc", "OpenType.svc");
+ replaceAll("Static\\.svc", "OpenType.svc");
final Response.ResponseBuilder builder = Response.status(response.getStatus());
for (String headerName : response.getHeaders().keySet()) {
@@ -83,7 +85,7 @@ public class V4OpenType extends V4Services {
/**
* Provide sample large metadata.
- *
+ *
* @return metadata.
*/
@GET
@@ -92,37 +94,37 @@ public class V4OpenType extends V4Services {
@Override
public Response getMetadata() {
return super.getMetadata("openType" + StringUtils.capitalize(
- Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)));
+ Constants.get(ODataServiceVersion.V40, ConstantKey.METADATA)));
}
@GET
@Path("/{entitySetName}({entityId})")
@Override
public Response getEntity(
- @Context UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId,
- @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format,
- @QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) String expand,
- @QueryParam("$select") @DefaultValue(StringUtils.EMPTY) String select) {
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId,
+ @QueryParam("$format") @DefaultValue(StringUtils.EMPTY) final String format,
+ @QueryParam("$expand") @DefaultValue(StringUtils.EMPTY) final String expand,
+ @QueryParam("$select") @DefaultValue(StringUtils.EMPTY) final String select) {
return replaceServiceName(super.getEntityInternal(
- uriInfo.getRequestUri().toASCIIString(), accept, entitySetName, entityId, format, expand, select, false));
+ uriInfo.getRequestUri().toASCIIString(), accept, entitySetName, entityId, format, expand, select, false));
}
@POST
@Path("/{entitySetName}")
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
- @Consumes({MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM})
+ @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON })
+ @Consumes({ MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_OCTET_STREAM })
@Override
public Response postNewEntity(
- @Context UriInfo uriInfo,
- @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
- @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) String contentType,
- @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) String prefer,
- @PathParam("entitySetName") final String entitySetName,
- final String entity) {
+ @Context final UriInfo uriInfo,
+ @HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) final String accept,
+ @HeaderParam("Content-Type") @DefaultValue(StringUtils.EMPTY) final String contentType,
+ @HeaderParam("Prefer") @DefaultValue(StringUtils.EMPTY) final String prefer,
+ @PathParam("entitySetName") final String entitySetName,
+ final String entity) {
return replaceServiceName(super.postNewEntity(uriInfo, accept, contentType, prefer, entitySetName, entity));
}
@@ -131,8 +133,8 @@ public class V4OpenType extends V4Services {
@Path("/{entitySetName}({entityId})")
@Override
public Response removeEntity(
- @PathParam("entitySetName") String entitySetName,
- @PathParam("entityId") String entityId) {
+ @PathParam("entitySetName") final String entitySetName,
+ @PathParam("entityId") final String entityId) {
return replaceServiceName(super.removeEntity(entitySetName, entityId));
}