[OLINGO-575] Star deleting unnecessary abstract edm classes
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/3a6293b6 Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/3a6293b6 Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/3a6293b6 Branch: refs/heads/master Commit: 3a6293b6a594a43980262e67951a30ad1d3cee56 Parents: 0092176 Author: Christian Amend <[email protected]> Authored: Wed Mar 25 14:48:26 2015 +0100 Committer: Christian Amend <[email protected]> Committed: Wed Mar 25 14:48:26 2015 +0100 ---------------------------------------------------------------------- .../proxy/commons/InvokerInvocationHandler.java | 2 +- .../commons/OperationInvocationHandler.java | 2 +- ...turedComposableInvokerInvocationHandler.java | 3 +- .../olingo/ext/proxy/utils/CoreUtils.java | 2 +- .../olingo/ext/pojogen/AbstractUtility.java | 3 +- .../java/org/apache/olingo/fit/V4Services.java | 2 +- .../core/serialization/ODataBinderImpl.java | 2 +- .../commons/api/edm/EdmEntitySetInfo.java | 46 ---- .../commons/api/edm/EdmFunctionImportInfo.java | 40 --- .../commons/api/edm/EdmSingletonInfo.java | 45 ---- .../core/edm/AbstractEdmBindingTarget.java | 109 --------- .../core/edm/AbstractEdmComplexType.java | 67 ----- .../core/edm/AbstractEdmEntityContainer.java | 192 --------------- .../commons/core/edm/AbstractEdmEntityType.java | 129 ---------- .../commons/core/edm/AbstractEdmEnumType.java | 222 ----------------- .../core/edm/AbstractEdmKeyPropertyRef.java | 77 ------ .../commons/core/edm/AbstractEdmMember.java | 58 ----- .../core/edm/AbstractEdmNavigationProperty.java | 88 ------- .../commons/core/edm/AbstractEdmOperation.java | 117 --------- .../core/edm/AbstractEdmOperationImport.java | 83 ------- .../commons/core/edm/AbstractEdmParameter.java | 49 ---- .../commons/core/edm/AbstractEdmProperty.java | 68 ------ .../edm/AbstractEdmReferentialConstraint.java | 43 ---- .../commons/core/edm/AbstractEdmReturnType.java | 49 ---- .../commons/core/edm/AbstractEdmSchema.java | 197 --------------- .../core/edm/AbstractEdmStructuredType.java | 152 ------------ .../core/edm/AbstractEdmTypeDefinition.java | 127 ---------- .../core/edm/EdmActionImportInfoImpl.java | 45 ---- .../commons/core/edm/EdmAnnotationHelper.java | 25 -- .../olingo/commons/core/edm/EdmElementImpl.java | 29 --- .../commons/core/edm/EdmEntitySetInfoImpl.java | 52 ---- .../core/edm/EdmFunctionImportInfoImpl.java | 45 ---- .../olingo/commons/core/edm/EdmNamedImpl.java | 39 --- .../edm/EdmNavigationPropertyBindingImpl.java | 43 ---- .../core/edm/EdmOperationImportInfoImpl.java | 36 --- .../commons/core/edm/EdmSingletonInfoImpl.java | 52 ---- .../core/edm/EdmStructuredTypeHelper.java | 35 --- .../olingo/commons/core/edm/EdmTypeImpl.java | 52 ---- .../olingo/commons/core/edm/EdmTypeInfo.java | 244 ------------------- .../core/edm/annotation/EdmCastImpl.java | 2 +- .../core/edm/annotation/EdmIsOfImpl.java | 2 +- .../core/edm/annotation/EdmRecordImpl.java | 2 +- .../core/edm/provider/EdmAnnotationHelper.java | 24 ++ .../edm/provider/EdmAnnotationHelperImpl.java | 1 - .../core/edm/provider/EdmAnnotationImpl.java | 1 - .../core/edm/provider/EdmBindingTargetImpl.java | 84 ++++++- .../core/edm/provider/EdmComplexTypeImpl.java | 48 +++- .../core/edm/provider/EdmElementImpl.java | 29 +++ .../edm/provider/EdmEntityContainerImpl.java | 149 ++++++++++- .../core/edm/provider/EdmEntityTypeImpl.java | 101 +++++++- .../core/edm/provider/EdmEnumTypeImpl.java | 179 +++++++++++++- .../edm/provider/EdmKeyPropertyRefImpl.java | 46 +++- .../core/edm/provider/EdmMemberImpl.java | 31 ++- .../commons/core/edm/provider/EdmNamedImpl.java | 39 +++ .../EdmNavigationPropertyBindingImpl.java | 43 ++++ .../edm/provider/EdmNavigationPropertyImpl.java | 66 +++-- .../core/edm/provider/EdmOperationImpl.java | 78 +++++- .../edm/provider/EdmOperationImportImpl.java | 57 ++++- .../core/edm/provider/EdmParameterImpl.java | 24 +- .../core/edm/provider/EdmPropertyImpl.java | 37 ++- .../provider/EdmReferentialConstraintImpl.java | 19 +- .../core/edm/provider/EdmReturnTypeImpl.java | 25 +- .../core/edm/provider/EdmSchemaImpl.java | 139 ++++++++++- .../edm/provider/EdmStructuredTypeHelper.java | 35 +++ .../provider/EdmStructuredTypeHelperImpl.java | 1 - .../edm/provider/EdmStructuredTypeImpl.java | 152 ++++++++++++ .../commons/core/edm/provider/EdmTermImpl.java | 3 - .../edm/provider/EdmTypeDefinitionImpl.java | 97 +++++++- .../commons/core/edm/provider/EdmTypeImpl.java | 52 ++++ .../commons/core/edm/provider/EdmTypeInfo.java | 244 +++++++++++++++++++ .../core/serialization/AtomDeserializer.java | 2 +- .../core/serialization/AtomSerializer.java | 2 +- .../core/serialization/JsonDeserializer.java | 2 +- .../serialization/JsonEntityDeserializer.java | 2 +- .../serialization/JsonEntitySerializer.java | 2 +- .../serialization/JsonGeoValueDeserializer.java | 2 +- .../serialization/JsonPropertyDeserializer.java | 2 +- .../serialization/JsonPropertySerializer.java | 2 +- .../core/serialization/JsonSerializer.java | 2 +- .../core/edm/provider/EdmNamedImplTest.java | 2 +- .../core/edm/provider/EdmTypeImplTest.java | 2 +- 81 files changed, 1698 insertions(+), 2805 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/InvokerInvocationHandler.java ---------------------------------------------------------------------- diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/InvokerInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/InvokerInvocationHandler.java index 44a2d30..5d2dcdd 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/InvokerInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/InvokerInvocationHandler.java @@ -44,7 +44,7 @@ import org.apache.olingo.commons.api.edm.EdmOperation; import org.apache.olingo.commons.api.edm.EdmReturnType; import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; import org.apache.olingo.commons.api.http.HttpMethod; -import org.apache.olingo.commons.core.edm.EdmTypeInfo; +import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo; import org.apache.olingo.ext.proxy.AbstractService; import org.apache.olingo.ext.proxy.api.ComplexCollection; import org.apache.olingo.ext.proxy.api.EntityCollection; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java ---------------------------------------------------------------------- diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java index 73daaf3..90873b4 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/OperationInvocationHandler.java @@ -39,7 +39,7 @@ import org.apache.olingo.commons.api.edm.EdmEntityType; import org.apache.olingo.commons.api.edm.EdmFunction; import org.apache.olingo.commons.api.edm.EdmOperation; import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.core.edm.EdmTypeInfo; +import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo; import org.apache.olingo.ext.proxy.api.OperationType; import org.apache.olingo.ext.proxy.api.annotations.Operation; import org.apache.olingo.ext.proxy.api.annotations.Parameter; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/StructuredComposableInvokerInvocationHandler.java ---------------------------------------------------------------------- diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/StructuredComposableInvokerInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/StructuredComposableInvokerInvocationHandler.java index 64e00c9..9adbd05 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/StructuredComposableInvokerInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/StructuredComposableInvokerInvocationHandler.java @@ -22,10 +22,11 @@ import java.lang.reflect.Method; import java.lang.reflect.Type; import java.net.URI; import java.util.Map; + import org.apache.commons.lang3.ArrayUtils; import org.apache.olingo.commons.api.domain.ODataValue; import org.apache.olingo.commons.api.edm.EdmOperation; -import org.apache.olingo.commons.core.edm.EdmTypeInfo; +import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo; import org.apache.olingo.ext.proxy.AbstractService; import org.apache.olingo.ext.proxy.api.Operations; import org.apache.olingo.ext.proxy.api.annotations.Operation; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java ---------------------------------------------------------------------- diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java index 65af8d6..682fc38 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/utils/CoreUtils.java @@ -56,8 +56,8 @@ import org.apache.olingo.commons.api.edm.EdmTerm; import org.apache.olingo.commons.api.edm.EdmType; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.core.domain.ODataAnnotationImpl; -import org.apache.olingo.commons.core.edm.EdmTypeInfo; import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory; +import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo; import org.apache.olingo.ext.proxy.AbstractService; import org.apache.olingo.ext.proxy.api.AbstractTerm; import org.apache.olingo.ext.proxy.api.ComplexCollection; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java ---------------------------------------------------------------------- diff --git a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java index 16e4402..2e0ef80 100644 --- a/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java +++ b/ext/pojogen-maven-plugin/src/main/java/org/apache/olingo/ext/pojogen/AbstractUtility.java @@ -35,8 +35,8 @@ import org.apache.olingo.commons.api.edm.EdmSingleton; import org.apache.olingo.commons.api.edm.EdmStructuredType; import org.apache.olingo.commons.api.edm.EdmType; import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.core.edm.EdmTypeInfo; import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory; +import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo; import java.io.InputStream; import java.util.ArrayList; @@ -47,6 +47,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; + import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; public abstract class AbstractUtility { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/fit/src/main/java/org/apache/olingo/fit/V4Services.java ---------------------------------------------------------------------- diff --git a/fit/src/main/java/org/apache/olingo/fit/V4Services.java b/fit/src/main/java/org/apache/olingo/fit/V4Services.java index 0b4f6bd..fe9465e 100644 --- a/fit/src/main/java/org/apache/olingo/fit/V4Services.java +++ b/fit/src/main/java/org/apache/olingo/fit/V4Services.java @@ -38,7 +38,7 @@ import org.apache.olingo.commons.core.data.EntityImpl; import org.apache.olingo.commons.core.data.EntitySetImpl; import org.apache.olingo.commons.core.data.LinkImpl; import org.apache.olingo.commons.core.data.PropertyImpl; -import org.apache.olingo.commons.core.edm.EdmTypeInfo; +import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo; import org.apache.olingo.fit.metadata.Metadata; import org.apache.olingo.fit.methods.PATCH; import org.apache.olingo.fit.rest.ResolvingReferencesInterceptor; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java index 46acddb..e74e3fa 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/serialization/ODataBinderImpl.java @@ -97,8 +97,8 @@ import org.apache.olingo.commons.core.domain.ODataAnnotationImpl; import org.apache.olingo.commons.core.domain.ODataDeletedEntityImpl; import org.apache.olingo.commons.core.domain.ODataDeltaLinkImpl; import org.apache.olingo.commons.core.domain.ODataPropertyImpl; -import org.apache.olingo.commons.core.edm.EdmTypeInfo; import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory; +import org.apache.olingo.commons.core.edm.provider.EdmTypeInfo; import org.apache.olingo.commons.core.serialization.ContextURLParser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntitySetInfo.java ---------------------------------------------------------------------- diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntitySetInfo.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntitySetInfo.java deleted file mode 100644 index 09c428a..0000000 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntitySetInfo.java +++ /dev/null @@ -1,46 +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.commons.api.edm; - -import java.net.URI; - -/** - * Objects of this class contain information about one entity set inside the EntityDataModel. - */ -public interface EdmEntitySetInfo { - - /** - * @return the entity container name which contains this entity set. - */ - String getEntityContainerName(); - - /** - * @return the entity set name - */ - String getEntitySetName(); - - /** - * We use a {@link URI} object here to ensure the right encoding. If a string representation is needed the - * toASCIIString() method can be used. - * - * @return the uri to this entity set e.g. "Employees" - */ - URI getEntitySetUri(); - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmFunctionImportInfo.java ---------------------------------------------------------------------- diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmFunctionImportInfo.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmFunctionImportInfo.java deleted file mode 100644 index 64491ec..0000000 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmFunctionImportInfo.java +++ /dev/null @@ -1,40 +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.commons.api.edm; - -import java.net.URI; - -/** - * Objects of this class contain information about one function import inside the EntityDataModel. - */ -public interface EdmFunctionImportInfo extends EdmOperationImportInfo { - - /** - * @return the function import name - */ - String getFunctionImportName(); - - /** - * We use a {@link URI} object here to ensure the right encoding. If a string representation is needed the - * toASCIIString() method can be used. - * - * @return the uri to this function import - */ - URI getFunctionImportUri(); -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmSingletonInfo.java ---------------------------------------------------------------------- diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmSingletonInfo.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmSingletonInfo.java deleted file mode 100644 index 2cb3ee3..0000000 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmSingletonInfo.java +++ /dev/null @@ -1,45 +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.commons.api.edm; - -import java.net.URI; - -/** - * Objects of this class contain information about one singleton inside the EntityDataModel. - */ -public interface EdmSingletonInfo { - - /** - * @return the entity container name which contains this singleton. - */ - String getEntityContainerName(); - - /** - * @return the singleton name - */ - String getSingletonName(); - - /** - * We use a {@link URI} object here to ensure the right encoding. If a string representation is needed the - * toASCIIString() method can be used. - * - * @return the uri to this singleton e.g. "EmployeeOfTheMonth" - */ - URI getEntitySetUri(); -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmBindingTarget.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmBindingTarget.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmBindingTarget.java deleted file mode 100644 index d3d9bf6..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmBindingTarget.java +++ /dev/null @@ -1,109 +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.commons.core.edm; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmBindingTarget; -import org.apache.olingo.commons.api.edm.EdmEntityContainer; -import org.apache.olingo.commons.api.edm.EdmEntityType; -import org.apache.olingo.commons.api.edm.EdmException; -import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.Target; - -import java.util.Iterator; - -public abstract class AbstractEdmBindingTarget extends EdmNamedImpl implements EdmBindingTarget { - - protected final EdmEntityContainer container; - - private final FullQualifiedName type; - - public AbstractEdmBindingTarget(final Edm edm, final EdmEntityContainer container, - final String name, final FullQualifiedName type) { - - super(edm, name); - this.container = container; - this.type = type; - } - - @Override - public EdmEntityContainer getEntityContainer() { - return container; - } - - @Override - public EdmEntityType getEntityType() { - final EdmEntityType entityType = edm.getEntityType(type); - if (entityType == null) { - throw new EdmException("Can´t find entity type: " + type + " for entity set or singleton: " + getName()); - } - return entityType; - } - - @Override - public FullQualifiedName getAnnotationsTargetFQN() { - return container.getFullQualifiedName(); - } - - @Override - public String getAnnotationsTargetPath() { - return getName(); - } - - @Override - public EdmBindingTarget getRelatedBindingTarget(final String path) { - if(path == null){ - return null; - } - EdmBindingTarget bindingTarget = null; - boolean found = false; - for (final Iterator<EdmNavigationPropertyBinding> itor = getNavigationPropertyBindings().iterator(); itor.hasNext() - && !found;) { - - final EdmNavigationPropertyBinding binding = itor.next(); - if (path.startsWith(binding.getPath())) { - final Target edmTarget = new Target.Builder(binding.getTarget(), container).build(); - - final EdmEntityContainer entityContainer = edm.getEntityContainer(edmTarget.getEntityContainer()); - if (entityContainer == null) { - throw new EdmException("Cannot find entity container with name: " + edmTarget.getEntityContainer()); - } - try { - bindingTarget = entityContainer.getEntitySet(edmTarget.getTargetName()); - - if (bindingTarget == null) { - throw new EdmException("Cannot find EntitySet " + edmTarget.getTargetName()); - } - } catch (EdmException e) { - // try with singletons ... - bindingTarget = entityContainer.getSingleton(edmTarget.getTargetName()); - - if (bindingTarget == null) { - throw new EdmException("Cannot find Singleton " + edmTarget.getTargetName()); - } - } finally { - found = bindingTarget != null; - } - } - } - - return bindingTarget; - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmComplexType.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmComplexType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmComplexType.java deleted file mode 100644 index 642bbc1..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmComplexType.java +++ /dev/null @@ -1,67 +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.commons.core.edm; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmComplexType; -import org.apache.olingo.commons.api.edm.EdmException; -import org.apache.olingo.commons.api.edm.EdmStructuredType; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; - -public abstract class AbstractEdmComplexType extends AbstractEdmStructuredType implements EdmComplexType { - - public AbstractEdmComplexType( - final Edm edm, - final FullQualifiedName typeName, - final FullQualifiedName baseTypeName) { - super(edm, typeName, EdmTypeKind.COMPLEX, baseTypeName); - } - - @Override - protected EdmStructuredType buildBaseType(final FullQualifiedName baseTypeName) { - EdmComplexType baseType = null; - if (baseTypeName != null) { - baseType = edm.getComplexType(baseTypeName); - if (baseType == null) { - throw new EdmException("Can't find base type with name: " + baseTypeName + " for complex type: " - + getName()); - } - } - return baseType; - } - - @Override - public EdmComplexType getBaseType() { - checkBaseType(); - return (EdmComplexType) baseType; - } - - @Override - protected void checkBaseType() { - if (baseTypeName != null && baseType == null) { - baseType = buildBaseType(baseTypeName); - } - } - - @Override - public TargetType getAnnotationsTargetType() { - return TargetType.ComplexType; - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java deleted file mode 100644 index c1dd630..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityContainer.java +++ /dev/null @@ -1,192 +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.commons.core.edm; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmActionImport; -import org.apache.olingo.commons.api.edm.EdmEntityContainer; -import org.apache.olingo.commons.api.edm.EdmEntitySet; -import org.apache.olingo.commons.api.edm.EdmFunctionImport; -import org.apache.olingo.commons.api.edm.EdmSingleton; -import org.apache.olingo.commons.api.edm.FullQualifiedName; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public abstract class AbstractEdmEntityContainer extends EdmNamedImpl implements EdmEntityContainer { - - protected final FullQualifiedName entityContainerName; - - protected final Map<String, EdmSingleton> singletons = new HashMap<String, EdmSingleton>(); - - private boolean allSingletonsLoaded = false; - - protected final Map<String, EdmEntitySet> entitySets = new HashMap<String, EdmEntitySet>(); - - private boolean allEntitySetsLoaded = false; - - protected final Map<String, EdmActionImport> actionImports = new HashMap<String, EdmActionImport>(); - - private final FullQualifiedName parentContainerName; - - private boolean allActionImportsLoaded = false; - - protected final Map<String, EdmFunctionImport> functionImports = new HashMap<String, EdmFunctionImport>(); - - private boolean allFunctionImportsLoaded = false; - - public AbstractEdmEntityContainer(final Edm edm, final FullQualifiedName entityContainerName, - final FullQualifiedName parentContainerName) { - super(edm, entityContainerName.getName()); - this.entityContainerName = entityContainerName; - this.parentContainerName = parentContainerName; - } - - @Override - public String getNamespace() { - return entityContainerName.getNamespace(); - } - - @Override - public FullQualifiedName getFullQualifiedName() { - return new FullQualifiedName(getNamespace(), getName()); - } - - protected abstract EdmSingleton createSingleton(String singletonName); - - @Override - public EdmSingleton getSingleton(final String singletonName) { - EdmSingleton singleton = singletons.get(singletonName); - if (singleton == null) { - singleton = createSingleton(singletonName); - if (singleton != null) { - singletons.put(singletonName, singleton); - } - } - return singleton; - } - - protected abstract EdmEntitySet createEntitySet(String entitySetName); - - @Override - public EdmEntitySet getEntitySet(final String entitySetName) { - EdmEntitySet entitySet = entitySets.get(entitySetName); - if (entitySet == null) { - entitySet = createEntitySet(entitySetName); - if (entitySet != null) { - entitySets.put(entitySetName, entitySet); - } - } - return entitySet; - } - - protected abstract EdmActionImport createActionImport(String actionImportName); - - @Override - public EdmActionImport getActionImport(final String actionImportName) { - EdmActionImport actionImport = actionImports.get(actionImportName); - if (actionImport == null) { - actionImport = createActionImport(actionImportName); - if (actionImport != null) { - actionImports.put(actionImportName, actionImport); - } - } - return actionImport; - } - - protected abstract EdmFunctionImport createFunctionImport(String functionImportName); - - @Override - public EdmFunctionImport getFunctionImport(final String functionImportName) { - EdmFunctionImport functionImport = functionImports.get(functionImportName); - if (functionImport == null) { - functionImport = createFunctionImport(functionImportName); - if (functionImport != null) { - functionImports.put(functionImportName, functionImport); - } - } - return functionImport; - } - - @Override - public List<EdmEntitySet> getEntitySets() { - if (!allEntitySetsLoaded) { - loadAllEntitySets(); - allEntitySetsLoaded = true; - } - return new ArrayList<EdmEntitySet>(entitySets.values()); - } - - protected abstract void loadAllEntitySets(); - - @Override - public List<EdmFunctionImport> getFunctionImports() { - if (!allFunctionImportsLoaded) { - loadAllFunctionImports(); - allFunctionImportsLoaded = true; - } - return new ArrayList<EdmFunctionImport>(functionImports.values()); - } - - protected abstract void loadAllFunctionImports(); - - @Override - public List<EdmSingleton> getSingletons() { - if (!allSingletonsLoaded) { - loadAllSingletons(); - allSingletonsLoaded = true; - } - return new ArrayList<EdmSingleton>(singletons.values()); - } - - protected abstract void loadAllSingletons(); - - @Override - public List<EdmActionImport> getActionImports() { - if (!allActionImportsLoaded) { - loadAllActionImports(); - allActionImportsLoaded = true; - } - return new ArrayList<EdmActionImport>(actionImports.values()); - } - - protected abstract void loadAllActionImports(); - - @Override - public FullQualifiedName getParentContainerName() { - return parentContainerName; - } - - @Override - public TargetType getAnnotationsTargetType() { - return TargetType.EntityContainer; - } - - @Override - public String getAnnotationsTargetPath() { - return null; - } - - @Override - public FullQualifiedName getAnnotationsTargetFQN() { - return getFullQualifiedName(); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityType.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityType.java deleted file mode 100644 index 6263047..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEntityType.java +++ /dev/null @@ -1,129 +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.commons.core.edm; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmEntityType; -import org.apache.olingo.commons.api.edm.EdmException; -import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef; -import org.apache.olingo.commons.api.edm.EdmStructuredType; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -public abstract class AbstractEdmEntityType extends AbstractEdmStructuredType implements EdmEntityType { - - private final boolean hasStream; - - protected EdmEntityType entityBaseType; - - private final List<String> keyPredicateNames = new ArrayList<String>(); - - private final Map<String, EdmKeyPropertyRef> keyPropertyRefs = new LinkedHashMap<String, EdmKeyPropertyRef>(); - - private List<EdmKeyPropertyRef> keyPropertyRefsList; - - protected AbstractEdmEntityType(final Edm edm, final FullQualifiedName typeName, - final FullQualifiedName baseTypeName, - final boolean hashStream) { - - super(edm, typeName, EdmTypeKind.ENTITY, baseTypeName); - hasStream = hashStream; - } - - protected void setEdmKeyPropertyRef(final List<EdmKeyPropertyRef> edmKey) { - for (EdmKeyPropertyRef ref : edmKey) { - if (ref.getAlias() == null) { - keyPredicateNames.add(ref.getName()); - keyPropertyRefs.put(ref.getName(), ref); - } else { - keyPredicateNames.add(ref.getAlias()); - keyPropertyRefs.put(ref.getAlias(), ref); - } - } - } - - @Override - protected EdmStructuredType buildBaseType(final FullQualifiedName baseTypeName) { - EdmEntityType baseType = null; - if (baseTypeName != null) { - baseType = edm.getEntityType(baseTypeName); - if (baseType == null) { - throw new EdmException("Cannot find base type with name: " + baseTypeName + " for entity type: " + getName()); - } - } - return baseType; - } - - @Override - public EdmEntityType getBaseType() { - checkBaseType(); - return entityBaseType; - } - - @Override - public List<String> getKeyPredicateNames() { - checkBaseType(); - if (keyPredicateNames.isEmpty() && baseType != null) { - return entityBaseType.getKeyPredicateNames(); - } - return keyPredicateNames; - } - - @Override - public List<EdmKeyPropertyRef> getKeyPropertyRefs() { - checkBaseType(); - if (keyPropertyRefsList == null) { - keyPropertyRefsList = new ArrayList<EdmKeyPropertyRef>(keyPropertyRefs.values()); - } - if (keyPropertyRefsList.isEmpty() && entityBaseType != null) { - return entityBaseType.getKeyPropertyRefs(); - } - return keyPropertyRefsList; - } - - @Override - public EdmKeyPropertyRef getKeyPropertyRef(final String keyPredicateName) { - checkBaseType(); - final EdmKeyPropertyRef edmKeyPropertyRef = keyPropertyRefs.get(keyPredicateName); - if (edmKeyPropertyRef == null && entityBaseType != null) { - return entityBaseType.getKeyPropertyRef(keyPredicateName); - } - return edmKeyPropertyRef; - } - - @Override - public boolean hasStream() { - return hasStream; - } - - @Override - protected void checkBaseType() { - // Current Client implementation doesn`t need this so I implemented an empty body here. - } - - @Override - public TargetType getAnnotationsTargetType() { - return TargetType.EntityType; - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEnumType.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEnumType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEnumType.java deleted file mode 100644 index 549980f..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmEnumType.java +++ /dev/null @@ -1,222 +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.commons.core.edm; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmEnumType; -import org.apache.olingo.commons.api.edm.EdmMember; -import org.apache.olingo.commons.api.edm.EdmPrimitiveType; -import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; -import org.apache.olingo.commons.core.edm.primitivetype.EdmInt64; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -public abstract class AbstractEdmEnumType extends EdmTypeImpl implements EdmEnumType { - - private final boolean isFlags; - - private final String uriPrefix; - - private final String uriSuffix; - - private List<String> memberNames; - - private Map<String, EdmMember> members; - - public AbstractEdmEnumType(final Edm edm, final FullQualifiedName fqn, final boolean isFlags) { - super(edm, fqn, EdmTypeKind.ENUM); - - this.isFlags = isFlags; - uriPrefix = fqn.getFullQualifiedNameAsString() + '\''; - uriSuffix = "'"; - } - - protected abstract Collection<EdmMember> getMembers(); - - @Override - public EdmMember getMember(final String name) { - if (members == null) { - members = new LinkedHashMap<String, EdmMember>(); - for (final EdmMember member : getMembers()) { - members.put(member.getName(), member); - } - } - return members.get(name); - } - - @Override - public List<String> getMemberNames() { - if (memberNames == null) { - memberNames = new ArrayList<String>(); - for (final EdmMember member : getMembers()) { - memberNames.add(member.getName()); - } - } - return memberNames; - } - - @Override - public abstract EdmPrimitiveType getUnderlyingType(); - - @Override - public boolean isCompatible(final EdmPrimitiveType primitiveType) { - return equals(primitiveType); - } - - @Override - public Class<?> getDefaultType() { - return getUnderlyingType().getDefaultType(); - } - - @Override - public boolean validate(final String value, final Boolean isNullable, final Integer maxLength, - final Integer precision, final Integer scale, final Boolean isUnicode) { - - try { - valueOfString(value, isNullable, maxLength, precision, scale, isUnicode, getDefaultType()); - return true; - } catch (final EdmPrimitiveTypeException e) { - return false; - } - } - - private Long parseEnumValue(final String value) throws EdmPrimitiveTypeException { - Long result = null; - for (final String memberValue : value.split(",", isFlags ? -1 : 1)) { - Long memberValueLong = null; - for (final EdmMember member : getMembers()) { - if (member.getName().equals(memberValue) || member.getValue().equals(memberValue)) { - memberValueLong = Long.decode(member.getValue()); - } - } - if (memberValueLong == null) { - throw new EdmPrimitiveTypeException("The literal '" + value + "' has illegal content."); - } - result = result == null ? memberValueLong : result | memberValueLong; - } - return result; - } - - @Override - public <T> T valueOfString(final String value, final Boolean isNullable, final Integer maxLength, - final Integer precision, final Integer scale, final Boolean isUnicode, final Class<T> returnType) - throws EdmPrimitiveTypeException { - - if (value == null) { - if (isNullable != null && !isNullable) { - throw new EdmPrimitiveTypeException("The literal 'null' is not allowed."); - } - return null; - } - - try { - return EdmInt64.convertNumber(parseEnumValue(value), returnType); - } catch (final IllegalArgumentException e) { - throw new EdmPrimitiveTypeException("The literal '" + value - + "' cannot be converted to value type " + returnType + ".", e); - } catch (final ClassCastException e) { - throw new EdmPrimitiveTypeException("The value type " + returnType + " is not supported.", e); - } - } - - protected String constructEnumValue(final long value) throws EdmPrimitiveTypeException { - long remaining = value; - StringBuilder result = new StringBuilder(); - - for (final EdmMember member : getMembers()) { - final long memberValue = Long.parseLong(member.getValue()); - if ((memberValue & remaining) == memberValue) { - if (result.length() > 0) { - result.append(','); - } - result.append(member.getName()); - remaining ^= memberValue; - } - } - - if (remaining != 0) { - throw new EdmPrimitiveTypeException("The value '" + value + "' is not valid."); - } - return result.toString(); - } - - @Override - public String valueToString(final Object value, final Boolean isNullable, final Integer maxLength, - final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException { - - if (value == null) { - if (isNullable != null && !isNullable) { - throw new EdmPrimitiveTypeException("The value NULL is not allowed."); - } - return null; - } - if (value instanceof Byte || value instanceof Short || value instanceof Integer || value instanceof Long) { - return constructEnumValue(((Number) value).longValue()); - } else { - throw new EdmPrimitiveTypeException("The value type " + value.getClass() + " is not supported."); - } - } - - @Override - public String toUriLiteral(final String literal) { - return literal == null ? null - : uriPrefix.isEmpty() && uriSuffix.isEmpty() ? literal : uriPrefix + literal + uriSuffix; - } - - @Override - public String fromUriLiteral(final String literal) throws EdmPrimitiveTypeException { - if (literal == null) { - return null; - } else if (uriPrefix.isEmpty() && uriSuffix.isEmpty()) { - return literal; - } else if (literal.length() >= uriPrefix.length() + uriSuffix.length() - && literal.startsWith(uriPrefix) && literal.endsWith(uriSuffix)) { - return literal.substring(uriPrefix.length(), literal.length() - uriSuffix.length()); - } else { - throw new EdmPrimitiveTypeException("The literal '" + literal + "' has illegal content."); - } - } - - @Override - public boolean isFlags() { - return isFlags; - } - - @Override - public TargetType getAnnotationsTargetType() { - return TargetType.EnumType; - } - - @Override - public String getAnnotationsTargetPath() { - return null; - } - - @Override - public FullQualifiedName getAnnotationsTargetFQN() { - return getFullQualifiedName(); - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmKeyPropertyRef.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmKeyPropertyRef.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmKeyPropertyRef.java deleted file mode 100644 index 05af9cb..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmKeyPropertyRef.java +++ /dev/null @@ -1,77 +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.commons.core.edm; - -import org.apache.olingo.commons.api.edm.EdmEntityType; -import org.apache.olingo.commons.api.edm.EdmException; -import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef; -import org.apache.olingo.commons.api.edm.EdmProperty; -import org.apache.olingo.commons.api.edm.EdmStructuredType; - -public abstract class AbstractEdmKeyPropertyRef implements EdmKeyPropertyRef { - - private final EdmEntityType edmEntityType; - - private EdmProperty property; - - public AbstractEdmKeyPropertyRef(final EdmEntityType edmEntityType) { - this.edmEntityType = edmEntityType; - } - - @Override - public abstract String getName(); - - @Override - public abstract String getAlias(); - - @Override - public EdmProperty getProperty() { - if (property == null) { - if (getAlias() == null) { - property = edmEntityType.getStructuralProperty(getName()); - if (property == null) { - throw new EdmException("Invalid key property ref specified. Can´t find property with name: " - + getName()); - } - } else { - if (getName() == null || getName().isEmpty()) { - throw new EdmException("Alias but no path specified for propertyRef"); - } - final String[] splitPath = getName().split("/"); - EdmStructuredType structType = edmEntityType; - for (int i = 0; i < splitPath.length - 1; i++) { - final EdmProperty _property = structType.getStructuralProperty(splitPath[i]); - if (_property == null) { - throw new EdmException("Invalid property ref specified. Can´t find property with name: " + splitPath[i] - + " at type: " + structType.getNamespace() + "." + structType.getName()); - } - structType = (EdmStructuredType) _property.getType(); - } - property = structType.getStructuralProperty(splitPath[splitPath.length - 1]); - if (property == null) { - throw new EdmException("Invalid property ref specified. Can´t find property with name: " - + splitPath[splitPath.length - 1] + " at type: " + structType.getNamespace() + "." - + structType.getName()); - } - } - } - - return property; - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmMember.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmMember.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmMember.java deleted file mode 100644 index 913f26d..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmMember.java +++ /dev/null @@ -1,58 +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.commons.core.edm; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmMember; -import org.apache.olingo.commons.api.edm.FullQualifiedName; - -public abstract class AbstractEdmMember extends EdmNamedImpl implements EdmMember { - - private final String value; - - private final FullQualifiedName enumFQN; - - public AbstractEdmMember(final Edm edm, final FullQualifiedName enumFQN, final String name, final String value) { - super(edm, name); - - this.enumFQN = enumFQN; - this.value = value; - } - - @Override - public TargetType getAnnotationsTargetType() { - return TargetType.Member; - } - - @Override - public FullQualifiedName getAnnotationsTargetFQN() { - return enumFQN; - } - - @Override - public String getAnnotationsTargetPath() { - return getName(); - } - - @Override - public String getValue() { - return value; - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java deleted file mode 100644 index 1382389..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmNavigationProperty.java +++ /dev/null @@ -1,88 +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.commons.core.edm; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmEntityType; -import org.apache.olingo.commons.api.edm.EdmException; -import org.apache.olingo.commons.api.edm.EdmNavigationProperty; -import org.apache.olingo.commons.api.edm.EdmStructuredType; -import org.apache.olingo.commons.api.edm.FullQualifiedName; - -public abstract class AbstractEdmNavigationProperty extends EdmElementImpl implements EdmNavigationProperty { - - private EdmEntityType typeImpl; - - private EdmNavigationProperty partnerNavigationProperty; - - public AbstractEdmNavigationProperty(final Edm edm, final String name) { - super(edm, name); - } - - protected abstract FullQualifiedName getTypeFQN(); - - @Override - public EdmEntityType getType() { - if (typeImpl == null) { - typeImpl = edm.getEntityType(getTypeFQN()); - if (typeImpl == null) { - throw new EdmException("Cannot find type with name: " + getTypeFQN()); - } - } - return typeImpl; - } - - protected abstract String internatGetPartner(); - - @Override - public EdmNavigationProperty getPartner() { - if (partnerNavigationProperty == null) { - String partner = internatGetPartner(); - if (partner != null) { - EdmStructuredType type = getType(); - EdmNavigationProperty property = null; - final String[] split = partner.split("/"); - for (String element : split) { - property = type.getNavigationProperty(element); - if (property == null) { - throw new EdmException("Cannot find navigation property with name: " + element - + " at type " + type.getName()); - } - type = property.getType(); - } - partnerNavigationProperty = property; - } - } - return partnerNavigationProperty; - } - - @Override - public abstract String getReferencingPropertyName(String referencedPropertyName); - - @Override - public TargetType getAnnotationsTargetType() { - return TargetType.NavigationProperty; - } - - @Override - public String getAnnotationsTargetPath() { - return getName(); - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperation.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperation.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperation.java deleted file mode 100644 index dd7ae81..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperation.java +++ /dev/null @@ -1,117 +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.commons.core.edm; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmBindingTarget; -import org.apache.olingo.commons.api.edm.EdmEntitySet; -import org.apache.olingo.commons.api.edm.EdmException; -import org.apache.olingo.commons.api.edm.EdmOperation; -import org.apache.olingo.commons.api.edm.EdmParameter; -import org.apache.olingo.commons.api.edm.EdmReturnType; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -public abstract class AbstractEdmOperation extends EdmTypeImpl implements EdmOperation { - - private final Map<String, EdmParameter> parameters = new LinkedHashMap<String, EdmParameter>(); - - private String entitySetPath; - - private boolean isBound; - - private EdmReturnType returnType; - - private List<String> parameterNames; - - protected AbstractEdmOperation( - final Edm edm, - final FullQualifiedName fqn, - final EdmTypeKind kind) { - - super(edm, fqn, kind); - } - - protected void setParameters(final List<EdmParameter> _parameters) { - for (EdmParameter parameter : _parameters) { - parameters.put(parameter.getName(), parameter); - } - } - - protected void setEntitySetPath(final String entitySetPath) { - this.entitySetPath = entitySetPath; - } - - protected void setIsBound(final boolean isBound) { - this.isBound = isBound; - } - - protected void setReturnType(final EdmReturnType returnType) { - this.returnType = returnType; - } - - @Override - public EdmParameter getParameter(final String name) { - return parameters.get(name); - } - - @Override - public List<String> getParameterNames() { - if (parameterNames == null) { - parameterNames = new ArrayList<String>(parameters.size()); - for (String parameterName : parameters.keySet()) { - parameterNames.add(parameterName); - } - } - return parameterNames; - } - - @Override - public EdmEntitySet getReturnedEntitySet(final EdmEntitySet bindingParameterEntitySet) { - EdmEntitySet returnedEntitySet = null; - if (bindingParameterEntitySet != null && entitySetPath != null) { - final EdmBindingTarget relatedBindingTarget = bindingParameterEntitySet.getRelatedBindingTarget(entitySetPath); - if (relatedBindingTarget == null) { - throw new EdmException("Cannot find entity set with path: " + entitySetPath); - } - if (relatedBindingTarget instanceof EdmEntitySet) { - returnedEntitySet = (EdmEntitySet) relatedBindingTarget; - } else { - throw new EdmException("BindingTarget with name: " + relatedBindingTarget.getName() - + " must be an entity set"); - } - } - return returnedEntitySet; - } - - @Override - public EdmReturnType getReturnType() { - return returnType; - } - - @Override - public boolean isBound() { - return isBound; - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperationImport.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperationImport.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperationImport.java deleted file mode 100644 index db05f8b..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmOperationImport.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.commons.core.edm; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmEntityContainer; -import org.apache.olingo.commons.api.edm.EdmEntitySet; -import org.apache.olingo.commons.api.edm.EdmException; -import org.apache.olingo.commons.api.edm.EdmOperationImport; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.Target; - -public abstract class AbstractEdmOperationImport extends EdmNamedImpl implements EdmOperationImport { - - protected final EdmEntityContainer container; - - private final Target entitySet; - - private EdmEntitySet returnedEntitySet; - - public AbstractEdmOperationImport( - final Edm edm, - final EdmEntityContainer container, - final String name, - final Target entitySet) { - - super(edm, name); - this.container = container; - this.entitySet = entitySet; - } - - @Override - public FullQualifiedName getFullQualifiedName() { - return new FullQualifiedName(container.getNamespace(), getName()); - } - - @Override - public EdmEntitySet getReturnedEntitySet() { - if (entitySet != null && returnedEntitySet == null) { - EdmEntityContainer entityContainer = edm.getEntityContainer(entitySet.getEntityContainer()); - if (entityContainer == null) { - throw new EdmException("Can´t find entity container with name: " + entitySet.getEntityContainer()); - } - returnedEntitySet = entityContainer.getEntitySet(entitySet.getTargetName()); - if (returnedEntitySet == null) { - throw new EdmException("Can´t find entity set with name: " + entitySet.getTargetName()); - } - } - return returnedEntitySet; - } - - @Override - public EdmEntityContainer getEntityContainer() { - return container; - } - - @Override - public FullQualifiedName getAnnotationsTargetFQN() { - return container.getFullQualifiedName(); - } - - @Override - public String getAnnotationsTargetPath() { - return getName(); - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java deleted file mode 100644 index 0264573..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java +++ /dev/null @@ -1,49 +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.commons.core.edm; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmException; -import org.apache.olingo.commons.api.edm.EdmParameter; -import org.apache.olingo.commons.api.edm.EdmType; -import org.apache.olingo.commons.api.edm.FullQualifiedName; - -public abstract class AbstractEdmParameter extends EdmElementImpl implements EdmParameter { - - private final EdmTypeInfo typeInfo; - - private EdmType typeImpl; - - public AbstractEdmParameter(final Edm edm, final String name, final FullQualifiedName paramType) { - super(edm, name); - typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(paramType.toString()).build(); - } - - @Override - public EdmType getType() { - if (typeImpl == null) { - typeImpl = typeInfo.getType(); - if (typeImpl == null) { - throw new EdmException("Cannot find type with name: " + typeInfo.getFullQualifiedName()); - } - } - - return typeImpl; - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmProperty.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmProperty.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmProperty.java deleted file mode 100644 index cf3440e..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmProperty.java +++ /dev/null @@ -1,68 +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.commons.core.edm; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmException; -import org.apache.olingo.commons.api.edm.EdmProperty; -import org.apache.olingo.commons.api.edm.EdmType; - -public abstract class AbstractEdmProperty extends EdmElementImpl implements EdmProperty { - - private EdmType propertyType; - - public AbstractEdmProperty(final Edm edm, final String name) { - super(edm, name); - } - - protected abstract EdmTypeInfo getTypeInfo(); - - @Override - public boolean isPrimitive() { - return getTypeInfo().isPrimitiveType(); - } - - @Override - public EdmType getType() { - if (propertyType == null) { - propertyType = getTypeInfo().getType(); - if (propertyType == null) { - throw new EdmException("Cannot find type with name: " + getTypeInfo().getFullQualifiedName()); - } - } - - return propertyType; - } - - @Override - public boolean isCollection() { - return getTypeInfo().isCollection(); - } - - @Override - public TargetType getAnnotationsTargetType() { - return TargetType.Property; - } - - @Override - public String getAnnotationsTargetPath() { - return getName(); - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReferentialConstraint.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReferentialConstraint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReferentialConstraint.java deleted file mode 100644 index 1116af3..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReferentialConstraint.java +++ /dev/null @@ -1,43 +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.commons.core.edm; - -import org.apache.olingo.commons.api.edm.EdmReferentialConstraint; - -public abstract class AbstractEdmReferentialConstraint implements EdmReferentialConstraint { - - private final String property; - - private final String referencedProperty; - - public AbstractEdmReferentialConstraint(final String property, final String referencedProperty) { - this.property = property; - this.referencedProperty = referencedProperty; - } - - @Override - public String getPropertyName() { - return property; - } - - @Override - public String getReferencedPropertyName() { - return referencedProperty; - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReturnType.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReturnType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReturnType.java deleted file mode 100644 index aed5fc1..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmReturnType.java +++ /dev/null @@ -1,49 +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.commons.core.edm; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmException; -import org.apache.olingo.commons.api.edm.EdmReturnType; -import org.apache.olingo.commons.api.edm.EdmType; -import org.apache.olingo.commons.api.edm.FullQualifiedName; - -public abstract class AbstractEdmReturnType implements EdmReturnType { - - private final EdmTypeInfo typeInfo; - - private EdmType typeImpl; - - public AbstractEdmReturnType(final Edm edm, final FullQualifiedName typeName) { - typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(typeName.toString()).build(); - } - - @Override - public EdmType getType() { - if (typeImpl == null) { - typeImpl = typeInfo.getType(); - if (typeImpl == null) { - throw new EdmException("Cannot find type with name: " + typeInfo.getFullQualifiedName()); - } - } - - return typeImpl; - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchema.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchema.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchema.java deleted file mode 100644 index ad43727..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmSchema.java +++ /dev/null @@ -1,197 +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.commons.core.edm; - -import org.apache.olingo.commons.api.edm.EdmAction; -import org.apache.olingo.commons.api.edm.EdmAnnotation; -import org.apache.olingo.commons.api.edm.EdmAnnotations; -import org.apache.olingo.commons.api.edm.EdmComplexType; -import org.apache.olingo.commons.api.edm.EdmEntityContainer; -import org.apache.olingo.commons.api.edm.EdmEntityType; -import org.apache.olingo.commons.api.edm.EdmEnumType; -import org.apache.olingo.commons.api.edm.EdmFunction; -import org.apache.olingo.commons.api.edm.EdmSchema; -import org.apache.olingo.commons.api.edm.EdmTerm; -import org.apache.olingo.commons.api.edm.EdmTypeDefinition; -import org.apache.olingo.commons.api.edm.FullQualifiedName; - -import java.util.Collections; -import java.util.List; - -public abstract class AbstractEdmSchema implements EdmSchema { - - protected final String namespace; - - private final String alias; - - private List<EdmEnumType> enumTypes; - - private List<EdmEntityType> entityTypes; - - private List<EdmComplexType> complexTypes; - - private List<EdmAction> actions; - - private List<EdmFunction> functions; - - private List<EdmTypeDefinition> typeDefinitions; - - private List<EdmTerm> terms; - - private List<EdmAnnotations> annotationGroups; - - private List<EdmAnnotation> annotations; - - private EdmEntityContainer entityContainer; - - public AbstractEdmSchema(final String namespace, final String alias) { - this.namespace = namespace; - this.alias = alias; - } - - protected abstract EdmEntityContainer createEntityContainer(); - - protected abstract List<EdmEnumType> createEnumTypes(); - - protected abstract List<EdmEntityType> createEntityTypes(); - - protected abstract List<EdmComplexType> createComplexTypes(); - - protected abstract List<EdmAction> createActions(); - - protected abstract List<EdmFunction> createFunctions(); - - protected abstract List<EdmTypeDefinition> createTypeDefinitions(); - - protected abstract List<EdmTerm> createTerms(); - - protected abstract List<EdmAnnotations> createAnnotationGroups(); - - protected abstract List<EdmAnnotation> createAnnotations(); - - @Override - public List<EdmEnumType> getEnumTypes() { - if (enumTypes == null) { - enumTypes = createEnumTypes(); - } - return enumTypes; - } - - @Override - public List<EdmEntityType> getEntityTypes() { - if (entityTypes == null) { - entityTypes = createEntityTypes(); - } - return entityTypes; - } - - @Override - public List<EdmComplexType> getComplexTypes() { - if (complexTypes == null) { - complexTypes = createComplexTypes(); - } - return complexTypes; - } - - @Override - public List<EdmAction> getActions() { - if (actions == null) { - actions = createActions(); - } - return actions; - } - - @Override - public List<EdmFunction> getFunctions() { - if (functions == null) { - functions = createFunctions(); - } - return functions; - } - - @Override - public List<EdmTypeDefinition> getTypeDefinitions() { - if (typeDefinitions == null) { - typeDefinitions = createTypeDefinitions(); - } - return typeDefinitions; - } - - @Override - public List<EdmTerm> getTerms() { - if (terms == null) { - terms = createTerms(); - } - return terms; - } - - @Override - public List<EdmAnnotations> getAnnotationGroups() { - if (annotationGroups == null) { - annotationGroups = createAnnotationGroups(); - } - return annotationGroups; - } - - @Override - public List<EdmAnnotation> getAnnotations() { - if (annotations == null) { - annotations = createAnnotations(); - } - return annotations; - } - - @Override - public EdmEntityContainer getEntityContainer() { - if (entityContainer == null) { - entityContainer = createEntityContainer(); - } - return entityContainer; - } - - @Override - public List<EdmEntityContainer> getEntityContainers() { - if (getEntityContainer() == null) { - return Collections.<EdmEntityContainer> emptyList(); - } else { - return Collections.singletonList(getEntityContainer()); - } - } - - @Override - public EdmEntityContainer getEntityContainer(final FullQualifiedName name) { - return getEntityContainer() == null - ? null - : name == null - ? getEntityContainer() - : name.equals(getEntityContainer().getFullQualifiedName()) - ? getEntityContainer() - : null; - } - - @Override - public String getNamespace() { - return namespace; - } - - @Override - public String getAlias() { - return alias; - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3a6293b6/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java deleted file mode 100644 index f6c6af1..0000000 --- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java +++ /dev/null @@ -1,152 +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.commons.core.edm; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmElement; -import org.apache.olingo.commons.api.edm.EdmException; -import org.apache.olingo.commons.api.edm.EdmNavigationProperty; -import org.apache.olingo.commons.api.edm.EdmProperty; -import org.apache.olingo.commons.api.edm.EdmStructuredType; -import org.apache.olingo.commons.api.edm.EdmType; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements EdmStructuredType { - - protected EdmStructuredType baseType; - - protected FullQualifiedName baseTypeName; - - private List<String> propertyNames; - - private List<String> navigationPropertyNames; - - public AbstractEdmStructuredType( - final Edm edm, - final FullQualifiedName typeName, - final EdmTypeKind kind, - final FullQualifiedName baseTypeName) { - - super(edm, typeName, kind); - this.baseTypeName = baseTypeName; - } - - protected abstract EdmStructuredType buildBaseType(FullQualifiedName baseTypeName); - - protected abstract Map<String, EdmProperty> getProperties(); - - protected abstract Map<String, EdmNavigationProperty> getNavigationProperties(); - - protected abstract void checkBaseType(); - - @Override - public List<String> getPropertyNames() { - if (propertyNames == null) { - propertyNames = new ArrayList<String>(); - checkBaseType(); - if (baseType != null) { - propertyNames.addAll(baseType.getPropertyNames()); - } - propertyNames.addAll(getProperties().keySet()); - } - return propertyNames; - } - - @Override - public List<String> getNavigationPropertyNames() { - if (navigationPropertyNames == null) { - navigationPropertyNames = new ArrayList<String>(); - checkBaseType(); - if (baseType != null) { - navigationPropertyNames.addAll(baseType.getNavigationPropertyNames()); - } - navigationPropertyNames.addAll(getNavigationProperties().keySet()); - } - return navigationPropertyNames; - } - - @Override - public EdmElement getProperty(final String name) { - EdmElement property = getStructuralProperty(name); - if (property == null) { - property = getNavigationProperty(name); - } - return property; - } - - @Override - public EdmProperty getStructuralProperty(final String name) { - EdmProperty property = null; - checkBaseType(); - if (baseType != null) { - property = baseType.getStructuralProperty(name); - } - if (property == null) { - property = getProperties().get(name); - } - return property; - } - - @Override - public EdmNavigationProperty getNavigationProperty(final String name) { - EdmNavigationProperty property = null; - checkBaseType(); - if (baseType != null) { - property = baseType.getNavigationProperty(name); - } - if (property == null) { - property = getNavigationProperties().get(name); - } - return property; - } - - @Override - public boolean compatibleTo(final EdmType targetType) { - EdmStructuredType sourceType = this; - if (targetType == null) { - throw new EdmException("Target type must not be null"); - } - while (!sourceType.getName().equals(targetType.getName()) - || !sourceType.getNamespace().equals(targetType.getNamespace())) { - - sourceType = sourceType.getBaseType(); - if (sourceType == null) { - return false; - } - } - - return true; - } - - @Override - public String getAnnotationsTargetPath() { - return null; - } - - @Override - public FullQualifiedName getAnnotationsTargetFQN() { - return getFullQualifiedName(); - } - -}
