[OLINGO-557] Deactivate Function Imports for TecSvc

This commit is contained in:
Michael Bolz 2015-02-06 09:24:41 +01:00
parent 1b9d92e77f
commit 6e90b617ab
1 changed files with 22 additions and 0 deletions

View File

@ -84,6 +84,11 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
@Override
public void readPrimitive(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
final ContentType contentType) throws ODataApplicationException, SerializerException {
if(isFunctionImport(uriInfo)) {
throw new ODataApplicationException("Function imports are not supported yet in technical scenario.",
HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
}
readProperty(response, uriInfo, contentType, RepresentationType.PRIMITIVE);
}
@ -113,6 +118,10 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
@Override
public void readPrimitiveCollection(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
final ContentType contentType) throws ODataApplicationException, SerializerException {
if(isFunctionImport(uriInfo)) {
throw new ODataApplicationException("Function imports are not supported yet in technical scenario.",
HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
}
readProperty(response, uriInfo, contentType, RepresentationType.COLLECTION_PRIMITIVE);
}
@ -143,6 +152,10 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
@Override
public void readComplex(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
final ContentType contentType) throws ODataApplicationException, SerializerException {
if(isFunctionImport(uriInfo)) {
throw new ODataApplicationException("Function imports are not supported yet in technical scenario.",
HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
}
readProperty(response, uriInfo, contentType, RepresentationType.COMPLEX);
}
@ -171,6 +184,10 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
@Override
public void readComplexCollection(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
final ContentType contentType) throws ODataApplicationException, SerializerException {
if(isFunctionImport(uriInfo)) {
throw new ODataApplicationException("Function imports are not supported yet in technical scenario.",
HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
}
readProperty(response, uriInfo, contentType, RepresentationType.COLLECTION_COMPLEX);
}
@ -197,6 +214,11 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
deleteProperty(response, uriInfo);
}
private boolean isFunctionImport(final UriInfo uriInfo) {
final List<UriResource> resourceParts = uriInfo.asUriInfoResource().getUriResourceParts();
return !resourceParts.isEmpty() && resourceParts.get(0).getKind() == UriResourceKind.function;
}
private void readProperty(final ODataResponse response, final UriInfo uriInfo, final ContentType contentType,
final RepresentationType representationType) throws ODataApplicationException, SerializerException {
final UriInfoResource resource = uriInfo.asUriInfoResource();