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 2015/02/17 10:53:26 UTC
[12/35] olingo-odata4 git commit: [OLINGO-575] Removed V4 server code
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
deleted file mode 100644
index f86a64c..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * 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.server.tecsvc.processor;
-
-import java.util.List;
-import java.util.Locale;
-
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.commons.api.data.ContextURL.Suffix;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntitySet;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.http.HttpContentType;
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.processor.ActionEntityCollectionProcessor;
-import org.apache.olingo.server.api.processor.ActionEntityProcessor;
-import org.apache.olingo.server.api.processor.CountEntityCollectionProcessor;
-import org.apache.olingo.server.api.processor.EntityCollectionProcessor;
-import org.apache.olingo.server.api.processor.EntityProcessor;
-import org.apache.olingo.server.api.processor.MediaEntityProcessor;
-import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions;
-import org.apache.olingo.server.api.serializer.ODataSerializer;
-import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-import org.apache.olingo.server.api.uri.UriResource;
-import org.apache.olingo.server.api.uri.UriResourceEntitySet;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-import org.apache.olingo.server.tecsvc.data.DataProvider;
-
-/**
- * Technical Processor for entity-related functionality.
- */
-public class TechnicalEntityProcessor extends TechnicalProcessor
- implements EntityCollectionProcessor, ActionEntityCollectionProcessor, CountEntityCollectionProcessor,
- EntityProcessor, ActionEntityProcessor, MediaEntityProcessor {
-
- public TechnicalEntityProcessor(final DataProvider dataProvider) {
- super(dataProvider);
- }
-
- @Override
- public void readEntityCollection(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType requestedContentType) throws ODataApplicationException, SerializerException {
- validateOptions(uriInfo.asUriInfoResource());
- blockNavigation(uriInfo);
-
- final EdmEntitySet edmEntitySet = getEdmEntitySet(uriInfo.asUriInfoResource());
- final EntitySet entitySet = readEntitySetInternal(edmEntitySet,
- uriInfo.getCountOption() != null && uriInfo.getCountOption().getValue());
- if (entitySet == null) {
- throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
- } else {
- final ODataFormat format = ODataFormat.fromContentType(requestedContentType);
- ODataSerializer serializer = odata.createSerializer(format);
- final ExpandOption expand = uriInfo.getExpandOption();
- final SelectOption select = uriInfo.getSelectOption();
- response.setContent(serializer.entityCollection(edmEntitySet.getEntityType(), entitySet,
- EntityCollectionSerializerOptions.with()
- .contextURL(format == ODataFormat.JSON_NO_METADATA ? null :
- getContextUrl(edmEntitySet, false, expand, select))
- .count(uriInfo.getCountOption())
- .expand(expand).select(select)
- .build()));
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, requestedContentType.toContentTypeString());
- }
- }
-
- @Override
- public void processActionEntityCollection(final ODataRequest request, final ODataResponse response,
- final UriInfo uriInfo,
- final ContentType requestFormat, final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Process entity collection is not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void countEntityCollection(final ODataRequest request, ODataResponse response, final UriInfo uriInfo)
- throws ODataApplicationException, SerializerException {
- validateOptions(uriInfo.asUriInfoResource());
- blockNavigation(uriInfo);
-
- final List<UriResource> resourceParts = uriInfo.asUriInfoResource().getUriResourceParts();
- final EntitySet entitySet =
- readEntitySetInternal(((UriResourceEntitySet) resourceParts.get(resourceParts.size() - 2)).getEntitySet(),
- true);
- if (entitySet == null) {
- throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
- } else {
- response.setContent(odata.createFixedFormatSerializer().count(entitySet.getCount()));
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, HttpContentType.TEXT_PLAIN);
- }
- }
-
- @Override
- public void readEntity(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType requestedContentType) throws ODataApplicationException, SerializerException {
- validateOptions(uriInfo.asUriInfoResource());
- blockNavigation(uriInfo);
-
- final EdmEntitySet edmEntitySet = getEdmEntitySet(uriInfo.asUriInfoResource());
- final UriResourceEntitySet resourceEntitySet = (UriResourceEntitySet) uriInfo.getUriResourceParts().get(0);
- final Entity entity = dataProvider.read(edmEntitySet, resourceEntitySet.getKeyPredicates());
-
- if (entity == null) {
- throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
- } else {
- final ODataFormat format = ODataFormat.fromContentType(requestedContentType);
- ODataSerializer serializer = odata.createSerializer(format);
- final ExpandOption expand = uriInfo.getExpandOption();
- final SelectOption select = uriInfo.getSelectOption();
- response.setContent(serializer.entity(edmEntitySet.getEntityType(), entity,
- EntitySerializerOptions.with()
- .contextURL(format == ODataFormat.JSON_NO_METADATA ? null :
- getContextUrl(edmEntitySet, true, expand, select))
- .expand(expand).select(select)
- .build()));
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, requestedContentType.toContentTypeString());
- }
- }
-
- @Override
- public void readMediaEntity(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType responseFormat) throws ODataApplicationException, SerializerException {
- blockNavigation(uriInfo);
- final UriResourceEntitySet resourceEntitySet = (UriResourceEntitySet) uriInfo.getUriResourceParts().get(0);
- final Entity entity = dataProvider.read(resourceEntitySet.getEntitySet(), resourceEntitySet.getKeyPredicates());
- if (entity == null) {
- throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
- } else {
- response.setContent(odata.createFixedFormatSerializer().binary(dataProvider.readMedia(entity)));
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, entity.getMediaContentType());
- }
- }
-
- @Override
- public void createMediaEntity(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType requestFormat, final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
-
- blockNavigation(uriInfo);
- final UriResourceEntitySet resourceEntitySet = (UriResourceEntitySet) uriInfo.getUriResourceParts().get(0);
- final EdmEntitySet edmEntitySet = resourceEntitySet.getEntitySet();
- Entity entity = null;
- if (edmEntitySet.getEntityType().hasStream()) {
- if (requestFormat == null) {
- throw new ODataApplicationException("The content type has not been set in the request.",
- HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT);
- }
- entity = dataProvider.create(edmEntitySet);
- dataProvider.setMedia(entity, odata.createFixedFormatDeserializer().binary(request.getBody()),
- requestFormat.toContentTypeString());
- } else {
- throw new ODataApplicationException("Requested Entity is not a media resource.",
- HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT);
- }
-
- final ODataFormat format = ODataFormat.fromContentType(responseFormat);
- ODataSerializer serializer = odata.createSerializer(format);
- response.setContent(serializer.entity(edmEntitySet.getEntityType(), entity,
- EntitySerializerOptions.with()
- .contextURL(format == ODataFormat.JSON_NO_METADATA ? null :
- getContextUrl(edmEntitySet, true, null, null))
- .build()));
- response.setStatusCode(HttpStatusCode.CREATED.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
- response.setHeader(HttpHeader.LOCATION,
- request.getRawBaseUri() + '/' + odata.createUriHelper().buildCanonicalURL(edmEntitySet, entity));
- }
-
- @Override
- public void createEntity(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType requestFormat, final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
-
- throw new ODataApplicationException("Entity creation is not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void updateEntity(final ODataRequest request, final ODataResponse response,
- final UriInfo uriInfo, final ContentType requestFormat,
- final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Entity update is not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void updateMediaEntity(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType requestFormat, final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- blockNavigation(uriInfo);
- final UriResourceEntitySet resourceEntitySet = (UriResourceEntitySet) uriInfo.getUriResourceParts().get(0);
- final EdmEntitySet edmEntitySet = resourceEntitySet.getEntitySet();
- final Entity entity = dataProvider.read(edmEntitySet, resourceEntitySet.getKeyPredicates());
- if (entity == null) {
- throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
- }
- if (requestFormat == null) {
- throw new ODataApplicationException("The content type has not been set in the request.",
- HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT);
- }
- dataProvider.setMedia(entity, odata.createFixedFormatDeserializer().binary(request.getBody()),
- requestFormat.toContentTypeString());
-
- final ODataFormat format = ODataFormat.fromContentType(responseFormat);
- ODataSerializer serializer = odata.createSerializer(format);
- response.setContent(serializer.entity(edmEntitySet.getEntityType(), entity,
- EntitySerializerOptions.with()
- .contextURL(format == ODataFormat.JSON_NO_METADATA ? null :
- getContextUrl(edmEntitySet, true, null, null))
- .build()));
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
- }
-
- @Override
- public void deleteEntity(final ODataRequest request, ODataResponse response, final UriInfo uriInfo)
- throws ODataApplicationException {
- blockNavigation(uriInfo);
- final UriResourceEntitySet resourceEntitySet = (UriResourceEntitySet) uriInfo.getUriResourceParts().get(0);
- final Entity entity = dataProvider.read(resourceEntitySet.getEntitySet(), resourceEntitySet.getKeyPredicates());
- if (entity == null) {
- throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
- } else {
- dataProvider.delete(resourceEntitySet.getEntitySet(), entity);
- response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
- }
- }
-
- @Override
- public void processActionEntity(final ODataRequest request, final ODataResponse response,
- final UriInfo uriInfo, final ContentType requestFormat,
- final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Process entity is not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- private void blockNavigation(final UriInfo uriInfo) throws ODataApplicationException {
- final List<UriResource> parts = uriInfo.asUriInfoResource().getUriResourceParts();
- if (parts.size() > 2
- || parts.size() == 2
- && parts.get(1).getKind() != UriResourceKind.count
- && parts.get(1).getKind() != UriResourceKind.value) {
- throw new ODataApplicationException("Invalid resource type.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
- }
-
- private EntitySet readEntitySetInternal(final EdmEntitySet edmEntitySet, final boolean withCount)
- throws DataProvider.DataProviderException {
- EntitySet entitySet = dataProvider.readAll(edmEntitySet);
- // TODO: set count (correctly) and next link
- if (withCount && entitySet.getCount() == null) {
- entitySet.setCount(entitySet.getEntities().size());
- }
- return entitySet;
- }
-
- private ContextURL getContextUrl(final EdmEntitySet entitySet, final boolean isSingleEntity,
- final ExpandOption expand, final SelectOption select) throws SerializerException {
- return ContextURL.with().entitySet(entitySet)
- .selectList(odata.createUriHelper()
- .buildContextURLSelectList(entitySet.getEntityType(), expand, select))
- .suffix(isSingleEntity ? Suffix.ENTITY : null)
- .build();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java
deleted file mode 100644
index 75e3dcc..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- * 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.server.tecsvc.processor;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Locale;
-
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmStructuredType;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.processor.ActionComplexCollectionProcessor;
-import org.apache.olingo.server.api.processor.ActionComplexProcessor;
-import org.apache.olingo.server.api.processor.ActionPrimitiveCollectionProcessor;
-import org.apache.olingo.server.api.processor.ActionPrimitiveProcessor;
-import org.apache.olingo.server.api.processor.ComplexCollectionProcessor;
-import org.apache.olingo.server.api.processor.ComplexProcessor;
-import org.apache.olingo.server.api.processor.PrimitiveCollectionProcessor;
-import org.apache.olingo.server.api.processor.PrimitiveProcessor;
-import org.apache.olingo.server.api.processor.PrimitiveValueProcessor;
-import org.apache.olingo.server.api.serializer.ComplexSerializerOptions;
-import org.apache.olingo.server.api.serializer.FixedFormatSerializer;
-import org.apache.olingo.server.api.serializer.ODataSerializer;
-import org.apache.olingo.server.api.serializer.PrimitiveSerializerOptions;
-import org.apache.olingo.server.api.serializer.PrimitiveValueSerializerOptions;
-import org.apache.olingo.server.api.serializer.RepresentationType;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriHelper;
-import org.apache.olingo.server.api.uri.UriInfo;
-import org.apache.olingo.server.api.uri.UriInfoResource;
-import org.apache.olingo.server.api.uri.UriResource;
-import org.apache.olingo.server.api.uri.UriResourceEntitySet;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-import org.apache.olingo.server.api.uri.UriResourceProperty;
-import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-import org.apache.olingo.server.tecsvc.data.DataProvider;
-
-/**
- * Technical Processor which provides functionality related to primitive and complex types and collections thereof.
- */
-public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
- implements PrimitiveProcessor, PrimitiveValueProcessor, ActionPrimitiveProcessor,
- PrimitiveCollectionProcessor, ActionPrimitiveCollectionProcessor,
- ComplexProcessor, ActionComplexProcessor,
- ComplexCollectionProcessor, ActionComplexCollectionProcessor {
-
- public TechnicalPrimitiveComplexProcessor(final DataProvider dataProvider) {
- super(dataProvider);
- }
-
- @Override
- public void readPrimitive(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType contentType) throws ODataApplicationException, SerializerException {
- readProperty(response, uriInfo, contentType, RepresentationType.PRIMITIVE);
- }
-
- @Override
- public void updatePrimitive(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType requestFormat, final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void deletePrimitive(final ODataRequest request, ODataResponse response, final UriInfo uriInfo)
- throws ODataApplicationException {
- deleteProperty(response, uriInfo);
- }
-
- @Override
- public void processActionPrimitive(final ODataRequest request, final ODataResponse response,
- final UriInfo uriInfo,
- final ContentType requestFormat, final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void readPrimitiveCollection(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType contentType) throws ODataApplicationException, SerializerException {
- readProperty(response, uriInfo, contentType, RepresentationType.COLLECTION_PRIMITIVE);
- }
-
- @Override
- public void updatePrimitiveCollection(final ODataRequest request, final ODataResponse response,
- final UriInfo uriInfo, final ContentType requestFormat, final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void deletePrimitiveCollection(final ODataRequest request, ODataResponse response, final UriInfo uriInfo)
- throws ODataApplicationException {
- deleteProperty(response, uriInfo);
- }
-
- @Override
- public void processActionPrimitiveCollection(final ODataRequest request, final ODataResponse response,
- final UriInfo uriInfo,
- final ContentType requestFormat, final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException,
- SerializerException {
- throw new ODataApplicationException("Not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void readComplex(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType contentType) throws ODataApplicationException, SerializerException {
- readProperty(response, uriInfo, contentType, RepresentationType.COMPLEX);
- }
-
- @Override
- public void updateComplex(final ODataRequest request, final ODataResponse response, final UriInfo uriInfo,
- final ContentType requestFormat, final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void processActionComplex(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType
- requestFormat, ContentType responseFormat) throws ODataApplicationException, DeserializerException,
- SerializerException {
- throw new ODataApplicationException("Not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void deleteComplex(final ODataRequest request, final ODataResponse response, final UriInfo uriInfo)
- throws ODataApplicationException {
- deleteProperty(response, uriInfo);
- }
-
- @Override
- public void readComplexCollection(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType contentType) throws ODataApplicationException, SerializerException {
- readProperty(response, uriInfo, contentType, RepresentationType.COLLECTION_COMPLEX);
- }
-
- @Override
- public void updateComplexCollection(final ODataRequest request, final ODataResponse response, final UriInfo uriInfo,
- final ContentType requestFormat, final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void processActionComplexCollection(ODataRequest request, ODataResponse response,
- UriInfo uriInfo, ContentType requestFormat,
- ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void deleteComplexCollection(final ODataRequest request, ODataResponse response, final UriInfo uriInfo)
- throws ODataApplicationException {
- deleteProperty(response, uriInfo);
- }
-
- private void readProperty(final ODataResponse response, final UriInfo uriInfo, final ContentType contentType,
- final RepresentationType representationType) throws ODataApplicationException, SerializerException {
- final UriInfoResource resource = uriInfo.asUriInfoResource();
- validateOptions(resource);
- validatePath(resource);
-
- final List<UriResource> resourceParts = resource.getUriResourceParts();
- final UriResourceEntitySet resourceEntitySet = (UriResourceEntitySet) resourceParts.get(0);
- final List<String> path = getPropertyPath(resourceParts);
-
- final Property property = getPropertyData(resourceEntitySet, path);
-
- if (property == null) {
- throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
- } else {
- if (property.getValue() == null) {
- response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
- } else {
- final EdmEntitySet edmEntitySet = getEdmEntitySet(resource);
- final EdmProperty edmProperty = ((UriResourceProperty) resourceParts.get(path.size())).getProperty();
-
- final ODataFormat format = ODataFormat.fromContentType(contentType);
- ODataSerializer serializer = odata.createSerializer(format);
- final ExpandOption expand = uriInfo.getExpandOption();
- final SelectOption select = uriInfo.getSelectOption();
- final UriHelper helper = odata.createUriHelper();
- final ContextURL contextURL = format == ODataFormat.JSON_NO_METADATA ? null :
- ContextURL.with().entitySet(edmEntitySet)
- .keyPath(helper.buildContextURLKeyPredicate(
- ((UriResourceEntitySet) resourceParts.get(0)).getKeyPredicates()))
- .navOrPropertyPath(buildPropertyPath(path))
- .selectList(edmProperty.isPrimitive() ? null :
- helper.buildContextURLSelectList((EdmStructuredType) edmProperty.getType(), expand, select))
- .build();
- switch (representationType) {
- case PRIMITIVE:
- response.setContent(serializer.primitive((EdmPrimitiveType) edmProperty.getType(), property,
- PrimitiveSerializerOptions.with().contextURL(contextURL).facetsFrom(edmProperty).build()));
- break;
- case COMPLEX:
- response.setContent(serializer.complex((EdmComplexType) edmProperty.getType(), property,
- ComplexSerializerOptions.with().contextURL(contextURL)
- .expand(expand).select(select)
- .build()));
- break;
- case COLLECTION_PRIMITIVE:
- response.setContent(serializer.primitiveCollection((EdmPrimitiveType) edmProperty.getType(), property,
- PrimitiveSerializerOptions.with().contextURL(contextURL).facetsFrom(edmProperty).build()));
- break;
- case COLLECTION_COMPLEX:
- response.setContent(serializer.complexCollection((EdmComplexType) edmProperty.getType(), property,
- ComplexSerializerOptions.with().contextURL(contextURL)
- .expand(expand).select(select)
- .build()));
- break;
- default:
- break;
- }
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, contentType.toContentTypeString());
- }
- }
- }
-
- private void deleteProperty(final ODataResponse response, final UriInfo uriInfo) throws ODataApplicationException {
- final UriInfoResource resource = uriInfo.asUriInfoResource();
- validatePath(resource);
-
- final List<UriResource> resourceParts = resource.getUriResourceParts();
- final UriResourceEntitySet resourceEntitySet = (UriResourceEntitySet) resourceParts.get(0);
- final List<String> path = getPropertyPath(resourceParts);
-
- final EdmProperty edmProperty = ((UriResourceProperty) resourceParts.get(path.size())).getProperty();
- final Property property = getPropertyData(resourceEntitySet, path);
-
- if (edmProperty.isNullable() == null || edmProperty.isNullable()) {
- property.setValue(property.getValueType(), edmProperty.isCollection() ? Collections.emptyList() : null);
- response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
- } else {
- throw new ODataApplicationException("Not nullable.", HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT);
- }
- }
-
- private Property getPropertyData(final UriResourceEntitySet resourceEntitySet, final List<String> path)
- throws ODataApplicationException {
- final Entity entity = dataProvider.read(resourceEntitySet.getEntitySet(), resourceEntitySet.getKeyPredicates());
- if (entity == null) {
- throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
- } else {
- Property property = entity.getProperty(path.get(0));
- for (final String name : path.subList(1, path.size())) {
- if (property != null && (property.isLinkedComplex() || property.isComplex())) {
- final List<Property> complex = property.isLinkedComplex() ?
- property.asLinkedComplex().getValue() : property.asComplex();
- property = null;
- for (final Property innerProperty : complex) {
- if (innerProperty.getName().equals(name)) {
- property = innerProperty;
- break;
- }
- }
- }
- }
- return property;
- }
- }
-
- private List<String> getPropertyPath(final List<UriResource> path) {
- List<String> result = new LinkedList<String>();
- int index = 1;
- while (index < path.size() && path.get(index) instanceof UriResourceProperty) {
- result.add(((UriResourceProperty) path.get(index)).getProperty().getName());
- index++;
- }
- return result;
- }
-
- private String buildPropertyPath(final List<String> path) {
- StringBuilder result = new StringBuilder();
- for (final String segment : path) {
- result.append(result.length() == 0 ? "" : '/').append(segment);
- }
- return result.toString();
- }
-
- @Override
- public void readPrimitiveValue(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType contentType) throws ODataApplicationException, SerializerException {
- final UriInfoResource resource = uriInfo.asUriInfoResource();
- validateOptions(resource);
- validatePath(resource);
-
- final List<UriResource> resourceParts = resource.getUriResourceParts();
- final UriResourceEntitySet resourceEntitySet = (UriResourceEntitySet) resourceParts.get(0);
- final List<String> path = getPropertyPath(resourceParts);
-
- final Property property = getPropertyData(resourceEntitySet, path);
-
- if (property == null || property.getValue() == null) {
- response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
- } else {
- final EdmProperty edmProperty = ((UriResourceProperty) resourceParts.get(path.size())).getProperty();
- final EdmPrimitiveType type = (EdmPrimitiveType) edmProperty.getType();
- final FixedFormatSerializer serializer = odata.createFixedFormatSerializer();
- response.setContent(type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Binary) ?
- serializer.binary((byte[]) property.getValue()) :
- serializer.primitiveValue(type, property.getValue(),
- PrimitiveValueSerializerOptions.with().facetsFrom(edmProperty).build()));
- response.setHeader(HttpHeader.CONTENT_TYPE, contentType.toContentTypeString());
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- }
- }
-
- private void validatePath(final UriInfoResource uriInfo) throws ODataApplicationException {
- final List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
- for (final UriResource segment : resourcePaths.subList(1, resourcePaths.size())) {
- final UriResourceKind kind = segment.getKind();
- if (kind != UriResourceKind.primitiveProperty
- && kind != UriResourceKind.complexProperty
- && kind != UriResourceKind.count
- && kind != UriResourceKind.value) {
- throw new ODataApplicationException("Invalid resource type.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java
deleted file mode 100644
index 4fa3d36..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.server.tecsvc.processor;
-
-
-import java.util.List;
-import java.util.Locale;
-
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.processor.Processor;
-import org.apache.olingo.server.api.uri.UriInfoResource;
-import org.apache.olingo.server.api.uri.UriResource;
-import org.apache.olingo.server.api.uri.UriResourceEntitySet;
-import org.apache.olingo.server.tecsvc.data.DataProvider;
-
-/**
- * Technical Processor base.
- */
-public abstract class TechnicalProcessor implements Processor {
-
- protected OData odata;
- protected DataProvider dataProvider;
-
- protected TechnicalProcessor(final DataProvider dataProvider) {
- this.dataProvider = dataProvider;
- }
-
- @Override
- public void init(final OData odata, final ServiceMetadata serviceMetadata) {
- this.odata = odata;
- }
-
- protected EdmEntitySet getEdmEntitySet(final UriInfoResource uriInfo) throws ODataApplicationException {
- final List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
- // first must be entity set
- if (!(resourcePaths.get(0) instanceof UriResourceEntitySet)) {
- throw new ODataApplicationException("Invalid resource type.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- final UriResourceEntitySet uriResource = (UriResourceEntitySet) resourcePaths.get(0);
- if (uriResource.getTypeFilterOnCollection() != null || uriResource.getTypeFilterOnEntry() != null) {
- throw new ODataApplicationException("Type filters are not supported.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
- return uriResource.getEntitySet();
- }
-
- protected void validateOptions(final UriInfoResource uriInfo) throws ODataApplicationException {
- if (uriInfo.getCountOption() != null
- || !uriInfo.getCustomQueryOptions().isEmpty()
- || uriInfo.getFilterOption() != null
- || uriInfo.getIdOption() != null
- || uriInfo.getOrderByOption() != null
- || uriInfo.getSearchOption() != null
- || uriInfo.getSkipOption() != null
- || uriInfo.getSkipTokenOption() != null
- || uriInfo.getTopOption() != null) {
- throw new ODataApplicationException("Not all of the specified options are supported.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java
deleted file mode 100644
index 6158898..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * 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.server.tecsvc.provider;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.edm.provider.Action;
-import org.apache.olingo.server.api.edm.provider.Parameter;
-import org.apache.olingo.server.api.edm.provider.ReturnType;
-
-public class ActionProvider {
-
- // Bound Actions
- public static final FullQualifiedName nameBAESAllPrimRTETAllPrim =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BAESAllPrimRTETAllPrim");
-
- public static final FullQualifiedName nameBAESTwoKeyNavRTESTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BAESTwoKeyNavRTESTwoKeyNav");
-
- public static final FullQualifiedName nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BAETBaseTwoKeyNavRTETBaseTwoKeyNav");
-
- public static final FullQualifiedName nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav");
-
- public static final FullQualifiedName nameBAETTwoKeyNavRTETTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BAETTwoKeyNavRTETTwoKeyNav");
-
- // Unbound Actions
- public static final FullQualifiedName nameUARTString = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "UARTString");
- public static final FullQualifiedName nameUARTCollStringTwoParam = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "UARTCollStringTwoParam");
- public static final FullQualifiedName nameUARTCollCTTwoPrimParam = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "UARTCollCTTwoPrimParam");
- public static final FullQualifiedName nameUARTCTTwoPrimParam = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "UARTCTTwoPrimParam");
- public static final FullQualifiedName nameUARTETTwoKeyTwoPrimParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UARTETTwoKeyTwoPrimParam");
- public static final FullQualifiedName nameUARTCollETKeyNavParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UARTCollETKeyNavParam");
- public static final FullQualifiedName nameUARTETAllPrimParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UARTETAllPrimParam");
- public static final FullQualifiedName nameUARTCollETAllPrimParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UARTCollETAllPrimParam");
-
-
- public List<Action> getActions(final FullQualifiedName actionName) throws ODataException {
- if (actionName.equals(nameUARTString)) {
- return Arrays.asList(
- new Action().setName(nameUARTString.getName())
- .setReturnType(new ReturnType().setType(PropertyProvider.nameString))
- );
- } else if (actionName.equals(nameUARTCollStringTwoParam)) {
- return Arrays.asList(
- new Action().setName(nameUARTCollStringTwoParam.getName())
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
- .setReturnType(new ReturnType().setType(PropertyProvider.nameString).setCollection(true))
- );
-
- } else if (actionName.equals(nameUARTCTTwoPrimParam)) {
- return Arrays.asList(
- new Action().setName(nameUARTCTTwoPrimParam.getName())
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
- .setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim))
- );
-
- } else if (actionName.equals(nameUARTCollCTTwoPrimParam)) {
- return Arrays.asList(
- new Action().setName(nameUARTCollCTTwoPrimParam.getName())
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
- .setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true))
- );
-
- } else if (actionName.equals(nameUARTETTwoKeyTwoPrimParam)) {
- return Arrays.asList(
- new Action().setName(nameUARTETTwoKeyTwoPrimParam.getName())
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyTwoPrim))
- );
-
- } else if (actionName.equals(nameUARTCollETKeyNavParam)) {
- return Arrays.asList(
- new Action().setName(nameUARTCollETKeyNavParam.getName())
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setCollection(true))
- );
-
- } else if (actionName.equals(nameUARTETAllPrimParam)) {
- return Arrays.asList(
- new Action().setName(nameUARTETAllPrimParam.getName())
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterDate").setType(PropertyProvider.nameDate)))
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETAllPrim))
- );
-
- } else if (actionName.equals(nameUARTCollETAllPrimParam)) {
- return Arrays.asList(
- new Action().setName(nameUARTCollETAllPrimParam.getName())
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterTimeOfDay").setType(PropertyProvider.nameInt16)))
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETAllPrim).setCollection(true))
- );
-
- } else if (actionName.equals(nameBAETTwoKeyNavRTETTwoKeyNav)) {
- return Arrays.asList(
- new Action().setName("BAETTwoKeyNavRTETTwoKeyNav")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setNullable(false)))
- .setBound(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav))
- ,
- new Action().setName("BAETTwoKeyNavRTETTwoKeyNav")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterETKeyNav").setType(EntityTypeProvider.nameETKeyNav)
- .setNullable(false)))
- .setBound(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav))
- );
-
- } else if (actionName.equals(nameBAESAllPrimRTETAllPrim)) {
- return Arrays.asList(
- new Action().setName("BAESAllPrimRTETAllPrim")
- .setParameters(
- Arrays.asList(
- new Parameter().setName("ParameterESAllPrim").setType(EntityTypeProvider.nameETAllPrim)
- .setCollection(true).setNullable(false)))
- .setBound(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETAllPrim))
- );
-
- } else if (actionName.equals(nameBAESTwoKeyNavRTESTwoKeyNav)) {
- return Arrays.asList(
- new Action().setName("BAESTwoKeyNavRTESTwoKeyNav")
- .setParameters(
- Arrays.asList(
- new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true).setNullable(false)))
- .setBound(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true))
- );
-
- } else if (actionName.equals(nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav)) {
- return Arrays.asList(
- new Action().setName("BAETBaseTwoKeyNavRTETBaseTwoKeyNav")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETBaseTwoKeyNav)
- .setNullable(false)))
- .setBound(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav))
- );
-
- } else if (actionName.equals(nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav)) {
- return Arrays.asList(
- new Action().setName("BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav")
- .setParameters(
- Arrays.asList(
- new Parameter().setName("ParameterETTwoBaseTwoKeyNav").setType(
- EntityTypeProvider.nameETTwoBaseTwoKeyNav).setNullable(false)))
- .setBound(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav))
- );
- }
-
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java
deleted file mode 100644
index bf30b32..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * 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.server.tecsvc.provider;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.edm.provider.ComplexType;
-import org.apache.olingo.server.api.edm.provider.NavigationProperty;
-import org.apache.olingo.server.api.edm.provider.Property;
-
-import java.util.Arrays;
-
-public class ComplexTypeProvider {
-
- public static final FullQualifiedName nameCTAllPrim = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTAllPrim");
- public static final FullQualifiedName nameCTBase = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTBase");
- public static final FullQualifiedName nameCTBasePrimCompNav = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "CTBasePrimCompNav");
- public static final FullQualifiedName nameCTCollAllPrim = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "CTCollAllPrim");
- public static final FullQualifiedName nameCTCompCollComp = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "CTCompCollComp");
- public static final FullQualifiedName nameCTCompComp = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTCompComp");
- public static final FullQualifiedName nameCTCompNav = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTCompNav");
-
- public static final FullQualifiedName nameCTMixPrimCollComp = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "CTMixPrimCollComp");
- public static final FullQualifiedName nameCTNavFiveProp = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "CTNavFiveProp");
- public static final FullQualifiedName nameCTPrim = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTPrim");
- public static final FullQualifiedName nameCTPrimComp = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTPrimComp");
- public static final FullQualifiedName nameCTTwoBase = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTTwoBase");
- public static final FullQualifiedName nameCTTwoBasePrimCompNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "CTTwoBasePrimCompNav");
- public static final FullQualifiedName nameCTTwoPrim = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTTwoPrim");
- public static final FullQualifiedName nameCTMixEnumDef = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "CTMixEnumDef");
-
- public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException {
-
- if (complexTypeName.equals(nameCTPrim)) {
- return new ComplexType()
- .setName("CTPrim")
- .setProperties(Arrays.asList(PropertyProvider.propertyInt16));
-
- } else if (complexTypeName.equals(nameCTAllPrim)) {
- return new ComplexType()
- .setName("CTAllPrim")
- .setProperties(
- Arrays.asList(PropertyProvider.propertyString, PropertyProvider.propertyBinary,
- PropertyProvider.propertyBoolean, PropertyProvider.propertyByte, PropertyProvider.propertyDate,
- PropertyProvider.propertyDateTimeOffset, PropertyProvider.propertyDecimal,
- PropertyProvider.propertySingle, PropertyProvider.propertyDouble, PropertyProvider.propertyDuration,
- PropertyProvider.propertyGuid, PropertyProvider.propertyInt16, PropertyProvider.propertyInt32,
- PropertyProvider.propertyInt64, PropertyProvider.propertySByte, PropertyProvider.propertyTimeOfDay
- /* TODO add propertyStream */));
-
- } else if (complexTypeName.equals(nameCTCollAllPrim)) {
- return new ComplexType()
- .setName("CTCollAllPrim")
- .setProperties(
- Arrays.asList(
- PropertyProvider.collPropertyString, PropertyProvider.collPropertyBoolean,
- PropertyProvider.collPropertyByte, PropertyProvider.collPropertySByte,
- PropertyProvider.collPropertyInt16, PropertyProvider.collPropertyInt32,
- PropertyProvider.collPropertyInt64, PropertyProvider.collPropertySingle,
- PropertyProvider.collPropertyDouble, PropertyProvider.collPropertyDecimal,
- PropertyProvider.collPropertyBinary, PropertyProvider.collPropertyDate,
- PropertyProvider.collPropertyDateTimeOffset, PropertyProvider.collPropertyDuration,
- PropertyProvider.collPropertyGuid, PropertyProvider.collPropertyTimeOfDay
- /* TODO add collectionPropertyStream */));
-
- } else if (complexTypeName.equals(nameCTTwoPrim)) {
- return new ComplexType()
- .setName("CTTwoPrim")
- .setProperties(Arrays.asList(PropertyProvider.propertyInt16_NotNullable,
- PropertyProvider.propertyString_NotNullable));
-
- } else if (complexTypeName.equals(nameCTCompNav)) {
- return new ComplexType()
- .setName("CTCompNav")
- .setProperties(Arrays.asList(PropertyProvider.propertyString,
- PropertyProvider.propertyComp_CTNavFiveProp));
-
- } else if (complexTypeName.equals(nameCTMixPrimCollComp)) {
- return new ComplexType()
- .setName("CTMixPrimCollComp")
- .setProperties(
- Arrays.asList(PropertyProvider.propertyInt16, PropertyProvider.collPropertyString,
- PropertyProvider.propertyComp_CTTwoPrim, PropertyProvider.collPropertyComp_CTTwoPrim));
-
- } else if (complexTypeName.equals(nameCTBase)) {
- return new ComplexType()
- .setName("CTBase")
- .setBaseType(nameCTTwoPrim)
- .setProperties(Arrays.asList(
- new Property()
- .setName("AdditionalPropString")
- .setType(new FullQualifiedName("Edm", "String"))));
-
- } else if (complexTypeName.equals(nameCTTwoBase)) {
- return new ComplexType()
- .setName("CTTwoBase")
- .setBaseType(nameCTBase);
-
- } else if (complexTypeName.equals(nameCTCompComp)) {
- return new ComplexType()
- .setName("CTCompComp")
- .setProperties(Arrays.asList(PropertyProvider.propertyComp_CTTwoPrim));
-
- } else if (complexTypeName.equals(nameCTCompCollComp)) {
- return new ComplexType()
- .setName("CTCompCollComp")
- .setProperties(Arrays.asList(PropertyProvider.collPropertyComp_CTTwoPrim));
-
- } else if (complexTypeName.equals(nameCTPrimComp)) {
- return new ComplexType()
- .setName("CTPrimComp")
- .setProperties(Arrays.asList(PropertyProvider.propertyInt16, PropertyProvider.propertyComp_CTAllPrim));
-
- } else if (complexTypeName.equals(nameCTNavFiveProp)) {
- return new ComplexType()
- .setName("CTNavFiveProp")
- .setProperties(Arrays.asList(PropertyProvider.propertyInt16))
- .setNavigationProperties((Arrays.asList(
- PropertyProvider.collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav,
- PropertyProvider.collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
- new NavigationProperty()
- .setName("NavPropertyETMediaOne")
- .setType(EntityTypeProvider.nameETMedia),
- new NavigationProperty()
- .setName("NavPropertyETMediaMany")
- .setType(EntityTypeProvider.nameETMedia).setCollection(true)
- )));
-
- } else if (complexTypeName.equals(nameCTBasePrimCompNav)) {
- return new ComplexType()
- .setName("CTBasePrimCompNav")
- .setBaseType(nameCTPrimComp)
- .setNavigationProperties(Arrays.asList(
- PropertyProvider.collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
- PropertyProvider.collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav,
- PropertyProvider.navPropertyETKeyNavOne_ETKeyNav,
- PropertyProvider.collectionNavPropertyETKeyNavMany_ETKeyNav));
-
- } else if (complexTypeName.equals(nameCTTwoBasePrimCompNav)) {
- return new ComplexType()
- .setName("CTTwoBasePrimCompNav")
- .setBaseType(nameCTBasePrimCompNav);
-
- } else if (complexTypeName.equals(nameCTMixEnumDef)) {
- return new ComplexType()
- .setName(nameCTMixEnumDef.getName())
- .setProperties(Arrays.asList(
- PropertyProvider.propertyEnumString_ENString,
- PropertyProvider.collPropertyEnumString_ENString,
- PropertyProvider.propertyTypeDefinition_TDString,
- PropertyProvider.collPropertyTypeDefinition_TDString));
- }
-
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f7a7b484/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java
deleted file mode 100644
index 7cf15fa..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * 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.server.tecsvc.provider;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.Target;
-import org.apache.olingo.server.api.edm.provider.ActionImport;
-import org.apache.olingo.server.api.edm.provider.EntityContainer;
-import org.apache.olingo.server.api.edm.provider.EntityContainerInfo;
-import org.apache.olingo.server.api.edm.provider.EntitySet;
-import org.apache.olingo.server.api.edm.provider.FunctionImport;
-import org.apache.olingo.server.api.edm.provider.NavigationPropertyBinding;
-import org.apache.olingo.server.api.edm.provider.Singleton;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-public class ContainerProvider {
-
- public static final FullQualifiedName nameContainer = new FullQualifiedName(SchemaProvider.NAMESPACE, "Container");
- public static final String AIRT_STRING = "AIRTString";
- public static final String AIRT_COLL_STRING_TWO_PARAM = "AIRTCollStringTwoParam";
- public static final String AIRTCT_TWO_PRIM_PARAM = "AIRTCTTwoPrimParam";
- public static final String AIRT_COLL_CT_TWO_PRIM_PARAM = "AIRTCollCTTwoPrimParam";
- public static final String AIRTET_TWO_KEY_TWO_PRIM_PARAM = "AIRTETTwoKeyTwoPrimParam";
- public static final String AIRT_COLL_ET_KEY_NAV_PARAM = "AIRTCollETKeyNavParam";
- public static final String AIRTES_ALL_PRIM_PARAM = "AIRTESAllPrimParam";
- public static final String AIRT_COLL_ES_ALL_PRIM_PARAM = "AIRTCollESAllPrimParam";
-
- EntityContainerInfo entityContainerInfoTest1 =
- new EntityContainerInfo().setContainerName(nameContainer);
-
- private EdmTechProvider prov;
-
- public ContainerProvider(final EdmTechProvider edmTechProvider) {
- prov = edmTechProvider;
- }
-
- public EntityContainerInfo getEntityContainerInfo(final FullQualifiedName entityContainerName) throws ODataException {
- if (entityContainerName == null) {
- return entityContainerInfoTest1;
- } else if (entityContainerName.equals(nameContainer)) {
- return entityContainerInfoTest1;
- }
-
- return null;
- }
-
- public EntityContainer getEntityContainer() throws ODataException {
- EntityContainer container = new EntityContainer();
- container.setName(ContainerProvider.nameContainer.getName());
-
- // EntitySets
- List<EntitySet> entitySets = new ArrayList<EntitySet>();
- container.setEntitySets(entitySets);
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESAllPrim"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESCollAllPrim"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESTwoPrim"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESMixPrimCollComp"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESBase"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESTwoBase"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESTwoKeyTwoPrim"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESBaseTwoKeyTwoPrim"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESTwoBaseTwoKeyTwoPrim"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESAllKey"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESCompAllPrim"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESCompCollAllPrim"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESCompComp"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESCompCollComp"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESMedia"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESKeyTwoKeyComp"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESInvisible"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESServerSidePaging"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESAllNullable"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESKeyNav"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESTwoKeyNav"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESBaseTwoKeyNav"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESCompMixPrimCollComp"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESFourKeyAlias"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESMixEnumDefCollComp"));
-
- // Singletons
- List<Singleton> singletons = new ArrayList<Singleton>();
- container.setSingletons(singletons);
- singletons.add(prov.getSingleton(ContainerProvider.nameContainer, "SI"));
- singletons.add(prov.getSingleton(ContainerProvider.nameContainer, "SINav"));
- singletons.add(prov.getSingleton(ContainerProvider.nameContainer, "SIMedia"));
-
- // ActionImports
- List<ActionImport> actionImports = new ArrayList<ActionImport>();
- container.setActionImports(actionImports);
- actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, AIRT_STRING));
- actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, AIRT_COLL_STRING_TWO_PARAM));
- actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, AIRTCT_TWO_PRIM_PARAM));
- actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, AIRT_COLL_CT_TWO_PRIM_PARAM));
- actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, AIRTET_TWO_KEY_TWO_PRIM_PARAM));
- actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, AIRT_COLL_ET_KEY_NAV_PARAM));
- actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, AIRTES_ALL_PRIM_PARAM));
- actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, AIRT_COLL_ES_ALL_PRIM_PARAM));
-
- // FunctionImports
- List<FunctionImport> functionImports = new ArrayList<FunctionImport>();
- container.setFunctionImports(functionImports);
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FINRTInt16"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FINInvisibleRTInt16"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FINInvisible2RTInt16"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTETKeyNav"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTETTwoKeyNavParam"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTStringTwoParam"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollStringTwoParam"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCTAllPrimTwoParam"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTESMixPrimCollCompTwoParam"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FINRTESMixPrimCollCompTwoParam"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollCTTwoPrim"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTETMedia"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCTTwoPrimParam"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCTTwoPrim"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollString"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTString"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTESTwoKeyNavParam"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollCTTwoPrimParam"));
-
- return container;
- }
-
- public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String name) throws ODataException {
- if (entityContainer == nameContainer) {
- if (name.equals("ESAllPrim")) {
- return new EntitySet()
- .setName("ESAllPrim")
- .setType(EntityTypeProvider.nameETAllPrim);
-
- } else if (name.equals("ESCollAllPrim")) {
- return new EntitySet()
- .setName("ESCollAllPrim")
- .setType(EntityTypeProvider.nameETCollAllPrim);
-
- } else if (name.equals("ESTwoPrim")) {
- return new EntitySet()
- .setName("ESTwoPrim")
- .setType(EntityTypeProvider.nameETTwoPrim);
-
- } else if (name.equals("ESMixPrimCollComp")) {
- return new EntitySet()
- .setName("ESMixPrimCollComp")
- .setType(EntityTypeProvider.nameETMixPrimCollComp);
-
- } else if (name.equals("ESBase")) {
- return new EntitySet()
- .setName("ESBase")
- .setType(EntityTypeProvider.nameETBase);
-
- } else if (name.equals("ESTwoBase")) {
- return new EntitySet()
- .setName("ESTwoBase")
- .setType(EntityTypeProvider.nameETTwoBase);
-
- } else if (name.equals("ESTwoKeyTwoPrim")) {
- return new EntitySet()
- .setName("ESTwoKeyTwoPrim")
- .setType(EntityTypeProvider.nameETTwoKeyTwoPrim);
-
- } else if (name.equals("ESBaseTwoKeyTwoPrim")) {
- return new EntitySet()
- .setName("ESBaseTwoKeyTwoPrim")
- .setType(EntityTypeProvider.nameETBaseTwoKeyTwoPrim);
-
- } else if (name.equals("ESTwoBaseTwoKeyTwoPrim")) {
- return new EntitySet()
- .setName("ESTwoBaseTwoKeyTwoPrim")
- .setType(EntityTypeProvider.nameETTwoBaseTwoKeyTwoPrim);
-
- } else if (name.equals("ESAllKey")) {
- return new EntitySet()
- .setName("ESAllKey")
- .setType(EntityTypeProvider.nameETAllKey);
-
- } else if (name.equals("ESCompAllPrim")) {
- return new EntitySet()
- .setName("ESCompAllPrim")
- .setType(EntityTypeProvider.nameETCompAllPrim);
-
- } else if (name.equals("ESCompCollAllPrim")) {
- return new EntitySet()
- .setName("ESCompCollAllPrim")
- .setType(EntityTypeProvider.nameETCompCollAllPrim);
-
- } else if (name.equals("ESCompComp")) {
- return new EntitySet()
- .setName("ESCompComp")
- .setType(EntityTypeProvider.nameETCompComp);
-
- } else if (name.equals("ESCompCollComp")) {
- return new EntitySet()
- .setName("ESCompCollComp")
- .setType(EntityTypeProvider.nameETCompCollComp);
-
- } else if (name.equals("ESMedia")) {
- return new EntitySet()
- .setName("ESMedia")
- .setType(EntityTypeProvider.nameETMedia)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("ESKeyTwoKeyComp")) {
- return new EntitySet()
- .setName("ESKeyTwoKeyComp")
- .setType(EntityTypeProvider.nameETKeyTwoKeyComp);
-
- } else if (name.equals("ESInvisible")) {
- return new EntitySet()
- .setName("ESInvisible")
- .setType(EntityTypeProvider.nameETAllPrim);
-
- } else if (name.equals("ESServerSidePaging")) {
- return new EntitySet()
- .setName("ESServerSidePaging")
- .setType(EntityTypeProvider.nameETServerSidePaging);
-
- } else if (name.equals("ESAllNullable")) {
- return new EntitySet()
- .setName("ESAllNullable")
- .setType(EntityTypeProvider.nameETAllNullable);
-
- } else if (name.equals("ESKeyNav")) {
- return new EntitySet()
- .setName("ESKeyNav")
- .setType(EntityTypeProvider.nameETKeyNav);
-
- } else if (name.equals("ESTwoKeyNav")) {
- return new EntitySet()
- .setName("ESTwoKeyNav")
- .setType(EntityTypeProvider.nameETTwoKeyNav);
-
- } else if (name.equals("ESBaseTwoKeyNav")) {
- return new EntitySet()
- .setName("ESBaseTwoKeyNav")
- .setType(EntityTypeProvider.nameETBaseTwoKeyNav);
-
- } else if (name.equals("ESCompMixPrimCollComp")) {
- return new EntitySet()
- .setName("ESCompMixPrimCollComp")
- .setType(EntityTypeProvider.nameETCompMixPrimCollComp);
-
- } else if (name.equals("ESFourKeyAlias")) {
- return new EntitySet()
- .setName("ESFourKeyAlias")
- .setType(EntityTypeProvider.nameETFourKeyAlias);
-
- } else if (name.equals("ESMixEnumDefCollComp")) {
- return new EntitySet().setName("ESMixEnumDefCollComp").setType(
- EntityTypeProvider.nameETMixEnumDefCollComp);
- }
- }
-
- return null;
- }
-
- public ActionImport getActionImport(final FullQualifiedName entityContainer, final String name)
- throws ODataException {
- if (entityContainer.equals(nameContainer)) {
- if (name.equals(AIRT_STRING)) {
- return new ActionImport()
- .setName(AIRT_STRING)
- .setAction(ActionProvider.nameUARTString);
-
- } else if (name.equals(AIRT_COLL_STRING_TWO_PARAM)) {
- return new ActionImport()
- .setName(AIRT_COLL_STRING_TWO_PARAM)
- .setAction(ActionProvider.nameUARTCollStringTwoParam);
-
- } else if (name.equals(AIRTCT_TWO_PRIM_PARAM)) {
- return new ActionImport()
- .setName(AIRTCT_TWO_PRIM_PARAM)
- .setAction(ActionProvider.nameUARTCTTwoPrimParam);
-
- } else if (name.equals(AIRT_COLL_CT_TWO_PRIM_PARAM)) {
- return new ActionImport()
- .setName(AIRT_COLL_CT_TWO_PRIM_PARAM)
- .setAction(ActionProvider.nameUARTCollCTTwoPrimParam);
-
- } else if (name.equals(AIRTET_TWO_KEY_TWO_PRIM_PARAM)) {
- return new ActionImport()
- .setName(AIRTET_TWO_KEY_TWO_PRIM_PARAM)
- .setAction(ActionProvider.nameUARTETTwoKeyTwoPrimParam);
-
- } else if (name.equals(AIRT_COLL_ET_KEY_NAV_PARAM)) {
- return new ActionImport()
- .setName(AIRT_COLL_ET_KEY_NAV_PARAM)
- .setAction(ActionProvider.nameUARTCollETKeyNavParam);
-
- } else if (name.equals(AIRTES_ALL_PRIM_PARAM)) {
- return new ActionImport()
- .setName(AIRTES_ALL_PRIM_PARAM)
- .setAction(ActionProvider.nameUARTETAllPrimParam);
-
- } else if (name.equals(AIRT_COLL_ES_ALL_PRIM_PARAM)) {
- return new ActionImport()
- .setName(AIRT_COLL_ES_ALL_PRIM_PARAM)
- .setAction(ActionProvider.nameUARTCollETAllPrimParam);
- }
- }
-
- return null;
- }
-
- public FunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String name)
- throws ODataException {
-
- if (entityContainer.equals(nameContainer)) {
- if (name.equals("FINRTInt16")) {
- return new FunctionImport()
- .setName("FINRTInt16")
- .setFunction(FunctionProvider.nameUFNRTInt16)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FINInvisibleRTInt16")) {
- return new FunctionImport()
- .setName("FINInvisibleRTInt16")
- .setFunction(FunctionProvider.nameUFNRTInt16);
-
- } else if (name.equals("FINInvisible2RTInt16")) {
- return new FunctionImport()
- .setName("FINInvisible2RTInt16")
- .setFunction(FunctionProvider.nameUFNRTInt16);
-
- } else if (name.equals("FICRTETKeyNav")) {
- return new FunctionImport()
- .setName("FICRTETKeyNav")
- .setFunction(FunctionProvider.nameUFCRTETKeyNav);
-
- } else if (name.equals("FICRTETTwoKeyNavParam")) {
- return new FunctionImport()
- .setName("FICRTETTwoKeyNavParam")
- .setFunction(FunctionProvider.nameUFCRTETTwoKeyNavParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTStringTwoParam")) {
- return new FunctionImport()
- .setName("FICRTStringTwoParam")
- .setFunction(FunctionProvider.nameUFCRTStringTwoParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTCollStringTwoParam")) {
- return new FunctionImport()
- .setName("FICRTCollStringTwoParam")
- .setFunction(FunctionProvider.nameUFCRTCollStringTwoParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTCTAllPrimTwoParam")) {
- return new FunctionImport()
- .setName("FICRTCTAllPrimTwoParam")
- .setFunction(FunctionProvider.nameUFCRTCTAllPrimTwoParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTESMixPrimCollCompTwoParam")) {
- return new FunctionImport()
- .setName("FICRTESMixPrimCollCompTwoParam")
- .setFunction(FunctionProvider.nameUFCRTESMixPrimCollCompTwoParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FINRTESMixPrimCollCompTwoParam")) {
- return new FunctionImport()
- .setName("FINRTESMixPrimCollCompTwoParam")
- .setFunction(FunctionProvider.nameUFNRTESMixPrimCollCompTwoParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTCollCTTwoPrim")) {
- return new FunctionImport()
- .setName("FICRTCollCTTwoPrim")
- .setFunction(FunctionProvider.nameUFCRTCollCTTwoPrim)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTETMedia")) {
- return new FunctionImport()
- .setName("FICRTETMedia")
- .setFunction(FunctionProvider.nameUFCRTETMedia)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTCTTwoPrimParam")) {
- return new FunctionImport()
- .setName("FICRTCTTwoPrimParam")
- .setFunction(FunctionProvider.nameUFCRTCTTwoPrimParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTCTTwoPrim")) {
- return new FunctionImport()
- .setName("FICRTCTTwoPrim")
- .setFunction(FunctionProvider.nameUFCRTCTTwoPrim)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTCollString")) {
- return new FunctionImport()
- .setName("FICRTCollString")
- .setFunction(FunctionProvider.nameUFCRTCollString)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTString")) {
- return new FunctionImport()
- .setName("FICRTString")
- .setFunction(FunctionProvider.nameUFCRTString)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTESTwoKeyNavParam")) {
- return new FunctionImport()
- .setName("FICRTESTwoKeyNavParam")
- .setFunction(FunctionProvider.nameUFCRTESTwoKeyNavParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTCollCTTwoPrimParam")) {
- return new FunctionImport()
- .setName("FICRTCollCTTwoPrimParam")
- .setFunction(FunctionProvider.nameUFCRTCollCTTwoPrimParam)
- .setIncludeInServiceDocument(true);
-
- }
- }
-
- return null;
- }
-
- public Singleton getSingleton(final FullQualifiedName entityContainer, final String name) throws ODataException {
- if (entityContainer.equals(nameContainer)) {
-
- if (name.equals("SI")) {
- return new Singleton()
- .setName("SI")
- .setType(EntityTypeProvider.nameETTwoPrim);
-
- } else if (name.equals("SINav")) {
- return new Singleton()
- .setName("SINav")
- .setType(EntityTypeProvider.nameETTwoKeyNav)
- .setNavigationPropertyBindings(Arrays.asList(
- new NavigationPropertyBinding()
- .setPath("NavPropertyETTwoKeyNavMany")
- .setTarget(new Target().setTargetName("ESTwoKeyNav"))));
-
- } else if (name.equals("SIMedia")) {
- return new Singleton()
- .setName("SIMedia")
- .setType(EntityTypeProvider.nameETMedia);
- }
- }
- return null;
- }
-}