http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeDefinitionImpl.java ---------------------------------------------------------------------- diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeDefinitionImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeDefinitionImpl.java new file mode 100644 index 0000000..1e81179 --- /dev/null +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmTypeDefinitionImpl.java @@ -0,0 +1,107 @@ +/* + * 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.provider; + +import java.util.List; + +import org.apache.olingo.commons.api.edm.Edm; +import org.apache.olingo.commons.api.edm.EdmAnnotation; +import org.apache.olingo.commons.api.edm.EdmException; +import org.apache.olingo.commons.api.edm.EdmPrimitiveType; +import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; +import org.apache.olingo.commons.api.edm.EdmTerm; +import org.apache.olingo.commons.api.edm.FullQualifiedName; +import org.apache.olingo.commons.api.edm.geo.SRID; +import org.apache.olingo.commons.api.edm.provider.TypeDefinition; +import org.apache.olingo.commons.core.edm.AbstractEdmTypeDefinition; +import org.apache.olingo.commons.core.edm.EdmAnnotationHelper; +import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory; + +public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition { + + private TypeDefinition typeDefinition; + private EdmPrimitiveType edmPrimitiveTypeInstance; + private final EdmAnnotationHelper helper; + + public EdmTypeDefinitionImpl(final Edm edm, final FullQualifiedName typeDefinitionName, + final TypeDefinition typeDefinition) { + super(edm, typeDefinitionName); + this.typeDefinition = typeDefinition; + try { + if (typeDefinition.getUnderlyingType() == null) { + throw new EdmException("Underlying Type for type definition: " + + typeDefinitionName.getFullQualifiedNameAsString() + " must not be null."); + } + this.edmPrimitiveTypeInstance = EdmPrimitiveTypeFactory.getInstance( + EdmPrimitiveTypeKind.valueOfFQN(typeDefinition.getUnderlyingType())); + } catch (IllegalArgumentException e) { + throw new EdmException("Invalid underlying type: " + typeDefinition.getUnderlyingType(), e); + } + this.helper = new EdmAnnotationHelperImpl(edm, typeDefinition); + } + + @Override + public EdmPrimitiveType getUnderlyingType() { + if (edmPrimitiveTypeInstance == null) { + try { + edmPrimitiveTypeInstance = EdmPrimitiveTypeFactory.getInstance( + EdmPrimitiveTypeKind.valueOfFQN(typeDefinition.getUnderlyingType())); + } catch (IllegalArgumentException e) { + throw new EdmException("Invalid underlying type: " + typeDefinition.getUnderlyingType(), e); + } + } + return edmPrimitiveTypeInstance; + } + + @Override + public Integer getMaxLength() { + return typeDefinition.getMaxLength(); + } + + @Override + public Integer getPrecision() { + return typeDefinition.getPrecision(); + } + + @Override + public Integer getScale() { + return typeDefinition.getScale(); + } + + @Override + public SRID getSrid() { + return typeDefinition.getSrid(); + } + + @Override + public Boolean isUnicode() { + return typeDefinition.isUnicode(); + } + + @Override + public EdmAnnotation getAnnotation(final EdmTerm term) { + return helper.getAnnotation(term); + } + + @Override + public List<EdmAnnotation> getAnnotations() { + return helper.getAnnotations(); + } + +}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/ServiceMetadataImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ServiceMetadataImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ServiceMetadataImpl.java index 0dfc813..c659a8a 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ServiceMetadataImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/ServiceMetadataImpl.java @@ -21,9 +21,9 @@ package org.apache.olingo.server.core; import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion; import org.apache.olingo.commons.api.edm.provider.EdmProvider; +import org.apache.olingo.commons.core.edm.provider.EdmProviderImpl; import org.apache.olingo.server.api.edmx.EdmxReference; import org.apache.olingo.server.api.ServiceMetadata; -import org.apache.olingo.server.core.edm.provider.EdmProviderImpl; import java.util.ArrayList; import java.util.Collections; http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImpl.java deleted file mode 100644 index 95e4abb..0000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImpl.java +++ /dev/null @@ -1,36 +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.core.edm.provider; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmAction; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; -import org.apache.olingo.commons.api.edm.provider.Action; - -public class EdmActionImpl extends EdmOperationImpl implements EdmAction { - - public static EdmActionImpl getInstance(final Edm edm, final FullQualifiedName name, final Action action) { - return EdmOperationImpl.getInstance(new EdmActionImpl(edm, name, action)); - } - - private EdmActionImpl(final Edm edm, final FullQualifiedName name, final Action action) { - super(edm, name, action, EdmTypeKind.ACTION); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImpl.java deleted file mode 100644 index c0af4ff..0000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImpl.java +++ /dev/null @@ -1,47 +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.core.edm.provider; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmAction; -import org.apache.olingo.commons.api.edm.EdmActionImport; -import org.apache.olingo.commons.api.edm.EdmEntityContainer; -import org.apache.olingo.commons.api.edm.provider.ActionImport; - -public class EdmActionImportImpl extends EdmOperationImportImpl implements EdmActionImport { - - private final ActionImport actionImport; - - public EdmActionImportImpl(final Edm edm, final EdmEntityContainer container, final ActionImport actionImport) { - - super(edm, container, actionImport); - this.actionImport = actionImport; - } - - @Override - public EdmAction getUnboundAction() { - return edm.getUnboundAction(actionImport.getActionFQN()); - } - - @Override - public TargetType getAnnotationsTargetType() { - return TargetType.ActionImport; - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java deleted file mode 100644 index 8bda193..0000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java +++ /dev/null @@ -1,55 +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.core.edm.provider; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmEntityContainer; -import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding; -import org.apache.olingo.commons.api.edm.provider.BindingTarget; -import org.apache.olingo.commons.api.edm.provider.NavigationPropertyBinding; -import org.apache.olingo.commons.core.edm.AbstractEdmBindingTarget; -import org.apache.olingo.commons.core.edm.EdmNavigationPropertyBindingImpl; - -public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget { - - private final BindingTarget target; - private List<EdmNavigationPropertyBinding> navigationPropertyBindings; - - public EdmBindingTargetImpl(final Edm edm, final EdmEntityContainer container, final BindingTarget target) { - super(edm, container, target.getName(), target.getTypeFQN()); - this.target = target; - } - - @Override - public List<EdmNavigationPropertyBinding> getNavigationPropertyBindings() { - if (navigationPropertyBindings == null) { - List<NavigationPropertyBinding> providerBindings = target.getNavigationPropertyBindings(); - navigationPropertyBindings = new ArrayList<EdmNavigationPropertyBinding>(); - if (providerBindings != null) { - for (NavigationPropertyBinding binding : providerBindings) { - navigationPropertyBindings.add(new EdmNavigationPropertyBindingImpl(binding.getPath(), binding.getTarget())); - } - } - } - return navigationPropertyBindings; - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java deleted file mode 100644 index 87b2be8..0000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java +++ /dev/null @@ -1,78 +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.core.edm.provider; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmAnnotation; -import org.apache.olingo.commons.api.edm.EdmNavigationProperty; -import org.apache.olingo.commons.api.edm.EdmProperty; -import org.apache.olingo.commons.api.edm.EdmTerm; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.provider.ComplexType; -import org.apache.olingo.commons.core.edm.AbstractEdmComplexType; -import org.apache.olingo.commons.core.edm.EdmStructuredTypeHelper; - -import java.util.List; -import java.util.Map; - -public class EdmComplexTypeImpl extends AbstractEdmComplexType { - - private final EdmStructuredTypeHelper helper; - - public static EdmComplexTypeImpl getInstance( - final Edm edm, final FullQualifiedName name, final ComplexType complexType) { - - return new EdmComplexTypeImpl(edm, name, complexType); - } - - private EdmComplexTypeImpl(final Edm edm, final FullQualifiedName name, final ComplexType complexType) { - super(edm, name, complexType.getBaseTypeFQN()); - helper = new EdmStructuredTypeHelperImpl(edm, name, complexType); - } - - @Override - protected Map<String, EdmProperty> getProperties() { - return helper.getProperties(); - } - - @Override - protected Map<String, EdmNavigationProperty> getNavigationProperties() { - return helper.getNavigationProperties(); - } - - @Override - public boolean isOpenType() { - return helper.isOpenType(); - } - - @Override - public boolean isAbstract() { - return helper.isAbstract(); - } - - @Override - public EdmAnnotation getAnnotation(final EdmTerm term) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public List<EdmAnnotation> getAnnotations() { - throw new UnsupportedOperationException("Not supported yet."); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImpl.java deleted file mode 100644 index 8ecc844..0000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImpl.java +++ /dev/null @@ -1,208 +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.core.edm.provider; - -import org.apache.olingo.commons.api.ODataException; -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmActionImport; -import org.apache.olingo.commons.api.edm.EdmAnnotation; -import org.apache.olingo.commons.api.edm.EdmEntitySet; -import org.apache.olingo.commons.api.edm.EdmException; -import org.apache.olingo.commons.api.edm.EdmFunctionImport; -import org.apache.olingo.commons.api.edm.EdmSingleton; -import org.apache.olingo.commons.api.edm.EdmTerm; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.provider.ActionImport; -import org.apache.olingo.commons.api.edm.provider.EdmProvider; -import org.apache.olingo.commons.api.edm.provider.EntityContainer; -import org.apache.olingo.commons.api.edm.provider.EntityContainerInfo; -import org.apache.olingo.commons.api.edm.provider.EntitySet; -import org.apache.olingo.commons.api.edm.provider.FunctionImport; -import org.apache.olingo.commons.api.edm.provider.Singleton; -import org.apache.olingo.commons.core.edm.AbstractEdmEntityContainer; - -import java.util.List; - -public class EdmEntityContainerImpl extends AbstractEdmEntityContainer { - - private final EdmProvider provider; - - private EntityContainer container; - - public EdmEntityContainerImpl(final Edm edm, final EdmProvider provider, - final EntityContainerInfo entityContainerInfo) { - super(edm, entityContainerInfo.getContainerName(), entityContainerInfo.getExtendsContainer()); - this.provider = provider; - } - - public EdmEntityContainerImpl(final Edm edm, final EdmProvider provider, final FullQualifiedName containerFQN, - final EntityContainer entityContainer) { - super(edm, containerFQN, entityContainer.getExtendsContainerFQN()); - this.provider = provider; - container = entityContainer; - } - - @Override - protected EdmSingleton createSingleton(final String singletonName) { - EdmSingleton singleton = null; - - try { - final Singleton providerSingleton = provider.getSingleton(entityContainerName, singletonName); - if (providerSingleton != null) { - singleton = new EdmSingletonImpl(edm, this, providerSingleton); - } - } catch (ODataException e) { - throw new EdmException(e); - } - - return singleton; - } - - @Override - protected EdmEntitySet createEntitySet(final String entitySetName) { - EdmEntitySet entitySet = null; - - try { - final EntitySet providerEntitySet = provider.getEntitySet(entityContainerName, entitySetName); - if (providerEntitySet != null) { - entitySet = new EdmEntitySetImpl(edm, this, providerEntitySet); - } - } catch (ODataException e) { - throw new EdmException(e); - } - - return entitySet; - } - - @Override - protected EdmActionImport createActionImport(final String actionImportName) { - EdmActionImport actionImport = null; - - try { - final ActionImport providerImport = provider.getActionImport(entityContainerName, actionImportName); - if (providerImport != null) { - actionImport = new EdmActionImportImpl(edm, this, providerImport); - } - } catch (ODataException e) { - throw new EdmException(e); - } - - return actionImport; - } - - @Override - protected EdmFunctionImport createFunctionImport(final String functionImportName) { - EdmFunctionImport functionImport = null; - - try { - final FunctionImport providerImport = provider.getFunctionImport(entityContainerName, functionImportName); - if (providerImport != null) { - functionImport = new EdmFunctionImportImpl(edm, this, providerImport); - } - } catch (ODataException e) { - throw new EdmException(e); - } - - return functionImport; - } - - @Override - protected void loadAllEntitySets() { - loadContainer(); - List<EntitySet> providerEntitySets = container.getEntitySets(); - if (providerEntitySets != null) { - for (EntitySet entitySet : providerEntitySets) { - if (!entitySets.containsKey(entitySet.getName())) { - EdmEntitySetImpl impl = new EdmEntitySetImpl(edm, this, entitySet); - entitySets.put(impl.getName(), impl); - } - } - } - } - - @Override - protected void loadAllFunctionImports() { - loadContainer(); - List<FunctionImport> providerFunctionImports = container.getFunctionImports(); - if (providerFunctionImports != null) { - for (FunctionImport functionImport : providerFunctionImports) { - String functionName = functionImport.getName(); - if (!functionImports.containsKey(functionName)) { - functionImports.put(functionName, - new EdmFunctionImportImpl(edm, this, functionImport)); - } - } - } - - } - - @Override - protected void loadAllSingletons() { - loadContainer(); - List<Singleton> providerSingletons = container.getSingletons(); - if (providerSingletons != null) { - for (Singleton singleton : providerSingletons) { - if (!singletons.containsKey(singleton.getName())) { - EdmSingletonImpl impl = new EdmSingletonImpl(edm, this, singleton); - singletons.put(singleton.getName(), impl); - } - } - } - - } - - @Override - protected void loadAllActionImports() { - loadContainer(); - List<ActionImport> providerActionImports = container.getActionImports(); - if (providerActionImports != null) { - for (ActionImport actionImport : providerActionImports) { - if (!actionImports.containsKey(actionImport.getName())) { - EdmActionImportImpl impl = new EdmActionImportImpl(edm, this, actionImport); - actionImports.put(actionImport.getName(), impl); - } - } - } - - } - - private void loadContainer() { - if (container == null) { - try { - container = provider.getEntityContainer(); - if (container == null) { - // TODO: Should we throw an exception here? - container = new EntityContainer().setName(getName()); - } - } catch (ODataException e) { - throw new EdmException(e); - } - } - } - - @Override - public EdmAnnotation getAnnotation(final EdmTerm term) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public List<EdmAnnotation> getAnnotations() { - throw new UnsupportedOperationException("Not supported yet."); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImpl.java deleted file mode 100644 index 4ab66fd..0000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImpl.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.server.core.edm.provider; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmAnnotation; -import org.apache.olingo.commons.api.edm.EdmEntityContainer; -import org.apache.olingo.commons.api.edm.EdmEntitySet; -import org.apache.olingo.commons.api.edm.EdmTerm; -import org.apache.olingo.commons.api.edm.provider.EntitySet; - -import java.util.List; - -public class EdmEntitySetImpl extends EdmBindingTargetImpl implements EdmEntitySet { - - private EntitySet entitySet; - - public EdmEntitySetImpl(final Edm edm, final EdmEntityContainer container, final EntitySet entitySet) { - super(edm, container, entitySet); - this.entitySet = entitySet; - } - - @Override - public boolean isIncludeInServiceDocument() { - return entitySet.isIncludeInServiceDocument(); - } - - @Override - public TargetType getAnnotationsTargetType() { - return TargetType.EntitySet; - } - - @Override - public EdmAnnotation getAnnotation(final EdmTerm term) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public List<EdmAnnotation> getAnnotations() { - throw new UnsupportedOperationException("Not supported yet."); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java deleted file mode 100644 index 7be3760..0000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.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.server.core.edm.provider; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmAnnotation; -import org.apache.olingo.commons.api.edm.EdmEntityType; -import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef; -import org.apache.olingo.commons.api.edm.EdmNavigationProperty; -import org.apache.olingo.commons.api.edm.EdmProperty; -import org.apache.olingo.commons.api.edm.EdmTerm; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.provider.EntityType; -import org.apache.olingo.commons.api.edm.provider.PropertyRef; -import org.apache.olingo.commons.core.edm.AbstractEdmEntityType; -import org.apache.olingo.commons.core.edm.EdmStructuredTypeHelper; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class EdmEntityTypeImpl extends AbstractEdmEntityType { - - private final EdmStructuredTypeHelper helper; - - private EntityType entityType; - - private boolean baseTypeChecked = false; - - public static EdmEntityTypeImpl getInstance(final Edm edm, final FullQualifiedName name, - final EntityType entityType) { - - return new EdmEntityTypeImpl(edm, name, entityType); - } - - private EdmEntityTypeImpl(final Edm edm, final FullQualifiedName name, final EntityType entityType) { - super(edm, name, entityType.getBaseTypeFQN(), entityType.hasStream()); - this.entityType = entityType; - helper = new EdmStructuredTypeHelperImpl(edm, name, entityType); - } - - @Override - protected Map<String, EdmProperty> getProperties() { - return helper.getProperties(); - } - - @Override - protected Map<String, EdmNavigationProperty> getNavigationProperties() { - return helper.getNavigationProperties(); - } - - @Override - protected void checkBaseType() { - if (!baseTypeChecked) { - if (baseTypeName != null) { - baseType = buildBaseType(baseTypeName); - entityBaseType = (EdmEntityType) baseType; - } - if (baseType == null - || (baseType.isAbstract() && ((AbstractEdmEntityType) baseType).getKeyPropertyRefs().size() == 0)) { - final List<PropertyRef> key = entityType.getKey(); - if (key != null) { - final List<EdmKeyPropertyRef> edmKey = new ArrayList<EdmKeyPropertyRef>(); - for (PropertyRef ref : key) { - edmKey.add(new EdmKeyPropertyRefImpl(this, ref)); - } - setEdmKeyPropertyRef(edmKey); - } - } - baseTypeChecked = true; - } - } - - @Override - public boolean isOpenType() { - return helper.isOpenType(); - } - - @Override - public boolean isAbstract() { - return helper.isAbstract(); - } - - @Override - public EdmAnnotation getAnnotation(final EdmTerm term) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public List<EdmAnnotation> getAnnotations() { - throw new UnsupportedOperationException("Not supported yet."); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java deleted file mode 100644 index 86fb92a..0000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java +++ /dev/null @@ -1,71 +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.core.edm.provider; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmMember; -import org.apache.olingo.commons.api.edm.EdmPrimitiveType; -import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.provider.EnumMember; -import org.apache.olingo.commons.api.edm.provider.EnumType; -import org.apache.olingo.commons.core.edm.AbstractEdmEnumType; -import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory; - -public class EdmEnumTypeImpl extends AbstractEdmEnumType { - - private final EdmPrimitiveType underlyingType; - - private final EnumType enumType; - - private List<EdmMember> members; - - public EdmEnumTypeImpl(final Edm edm, final FullQualifiedName enumName, final EnumType enumType) { - super(edm, enumName, enumType.isFlags()); - - if (enumType.getUnderlyingType() == null) { - underlyingType = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32); - } else { - underlyingType = EdmPrimitiveTypeFactory.getInstance( - EdmPrimitiveTypeKind.valueOfFQN(enumType.getUnderlyingType())); - } - - this.enumType = enumType; - } - - @Override - public EdmPrimitiveType getUnderlyingType() { - return underlyingType; - } - - @Override - protected List<? extends EdmMember> getMembers() { - if (members == null) { - members = new ArrayList<EdmMember>(enumType.getMembers().size()); - for (EnumMember member : enumType.getMembers()) { - members.add(new EdmMemberImpl(edm, getFullQualifiedName(), member.getName(), member.getValue())); - } - } - return members; - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImpl.java deleted file mode 100644 index d45f5c8..0000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImpl.java +++ /dev/null @@ -1,56 +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.core.edm.provider; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmException; -import org.apache.olingo.commons.api.edm.EdmFunction; -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 org.apache.olingo.commons.api.edm.provider.Function; - -public class EdmFunctionImpl extends EdmOperationImpl implements EdmFunction { - - private final Function function; - - public static EdmFunctionImpl getInstance(final Edm edm, final FullQualifiedName name, final Function function) { - return EdmOperationImpl.getInstance(new EdmFunctionImpl(edm, name, function)); - } - - private EdmFunctionImpl(final Edm edm, final FullQualifiedName name, final Function function) { - super(edm, name, function, EdmTypeKind.FUNCTION); - this.function = function; - } - - @Override - public boolean isComposable() { - return function.isComposable(); - } - - @Override - public EdmReturnType getReturnType() { - final EdmReturnType returnType = super.getReturnType(); - if (returnType == null) { - throw new EdmException("ReturnType for a function must not be null"); - } - return returnType; - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImpl.java deleted file mode 100644 index b676ff6..0000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImpl.java +++ /dev/null @@ -1,70 +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.core.edm.provider; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmAnnotation; -import org.apache.olingo.commons.api.edm.EdmEntityContainer; -import org.apache.olingo.commons.api.edm.EdmFunction; -import org.apache.olingo.commons.api.edm.EdmFunctionImport; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.provider.FunctionImport; - -import java.util.List; - -public class EdmFunctionImportImpl extends EdmOperationImportImpl implements EdmFunctionImport { - - private final FunctionImport functionImport; - - public EdmFunctionImportImpl(final Edm edm, final EdmEntityContainer container, final FunctionImport functionImport) { - - super(edm, container, functionImport); - this.functionImport = functionImport; - } - - @Override - public FullQualifiedName getFunctionFqn() { - return functionImport.getFunctionFQN(); - } - - @Override - public EdmFunction getUnboundFunction(final List<String> parameterNames) { - return edm.getUnboundFunction(getFunctionFqn(), parameterNames); - } - - @Override - public List<EdmFunction> getUnboundFunctions() { - return edm.getUnboundFunctions(getFunctionFqn()); - } - - @Override - public boolean isIncludeInServiceDocument() { - return functionImport.isIncludeInServiceDocument(); - } - - @Override - public TargetType getAnnotationsTargetType() { - return TargetType.FunctionImport; - } - - @Override - public List<EdmAnnotation> getAnnotations() { - throw new UnsupportedOperationException("Not supported yet."); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImpl.java deleted file mode 100644 index 2e5a342..0000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImpl.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.server.core.edm.provider; - -import org.apache.olingo.commons.api.edm.EdmEntityType; -import org.apache.olingo.commons.api.edm.provider.PropertyRef; -import org.apache.olingo.commons.core.edm.AbstractEdmKeyPropertyRef; - -public class EdmKeyPropertyRefImpl extends AbstractEdmKeyPropertyRef { - - private final PropertyRef ref; - - public EdmKeyPropertyRefImpl(final EdmEntityType edmEntityType, final PropertyRef ref) { - super(edmEntityType); - this.ref = ref; - } - - @Override - public String getName() { - return ref.getName(); - } - - @Override - public String getAlias() { - return ref.getAlias(); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmMemberImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmMemberImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmMemberImpl.java deleted file mode 100644 index c6bdd47..0000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmMemberImpl.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.server.core.edm.provider; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmAnnotation; -import org.apache.olingo.commons.api.edm.EdmTerm; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.core.edm.AbstractEdmMember; - -import java.util.List; - -public class EdmMemberImpl extends AbstractEdmMember { - - public EdmMemberImpl(final Edm edm, final FullQualifiedName enumFQN, final String name, final String value) { - super(edm, enumFQN, name, value); - } - - @Override - public EdmAnnotation getAnnotation(final EdmTerm term) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public List<EdmAnnotation> getAnnotations() { - throw new UnsupportedOperationException("Not supported yet."); - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.java deleted file mode 100644 index f643914..0000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.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.server.core.edm.provider; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmAnnotation; -import org.apache.olingo.commons.api.edm.EdmReferentialConstraint; -import org.apache.olingo.commons.api.edm.EdmTerm; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.provider.NavigationProperty; -import org.apache.olingo.commons.api.edm.provider.ReferentialConstraint; -import org.apache.olingo.commons.core.edm.AbstractEdmNavigationProperty; - -import java.util.ArrayList; -import java.util.List; - -public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty { - - private final FullQualifiedName structuredTypeName; - - private final NavigationProperty navigationProperty; - - private List<EdmReferentialConstraint> referentialConstraints; - - public EdmNavigationPropertyImpl( - final Edm edm, final FullQualifiedName structuredTypeName, final NavigationProperty navigationProperty) { - - super(edm, navigationProperty.getName()); - - this.structuredTypeName = structuredTypeName; - this.navigationProperty = navigationProperty; - } - - @Override - protected FullQualifiedName getTypeFQN() { - return navigationProperty.getTypeFQN(); - } - - @Override - public boolean isCollection() { - return navigationProperty.isCollection(); - } - - @Override - public boolean isNullable() { - return navigationProperty.isNullable(); - } - - @Override - public Boolean containsTarget() { - return navigationProperty.isContainsTarget(); - } - - @Override - protected String internatGetPartner() { - return navigationProperty.getPartner(); - } - - @Override - public String getReferencingPropertyName(final String referencedPropertyName) { - final List<ReferentialConstraint> referentialConstraints = navigationProperty.getReferentialConstraints(); - if (referentialConstraints != null) { - for (ReferentialConstraint constraint : referentialConstraints) { - if (constraint.getReferencedProperty().equals(referencedPropertyName)) { - return constraint.getProperty(); - } - } - } - return null; - } - - @Override - public List<EdmReferentialConstraint> getReferentialConstraints() { - if (referentialConstraints == null) { - final List<ReferentialConstraint> providerConstraints = navigationProperty.getReferentialConstraints(); - referentialConstraints = new ArrayList<EdmReferentialConstraint>(); - if (providerConstraints != null) { - for (ReferentialConstraint constraint : providerConstraints) { - referentialConstraints.add( - new EdmReferentialConstraintImpl(constraint.getProperty(), constraint.getReferencedProperty())); - } - } - } - return referentialConstraints; - } - - @Override - public FullQualifiedName getAnnotationsTargetFQN() { - return structuredTypeName; - } - - @Override - public EdmAnnotation getAnnotation(final EdmTerm term) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public List<EdmAnnotation> getAnnotations() { - throw new UnsupportedOperationException("Not supported yet."); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImpl.java deleted file mode 100644 index 3958d7d..0000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImpl.java +++ /dev/null @@ -1,97 +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.core.edm.provider; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmAnnotation; -import org.apache.olingo.commons.api.edm.EdmParameter; -import org.apache.olingo.commons.api.edm.EdmTerm; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.constants.EdmTypeKind; -import org.apache.olingo.commons.api.edm.provider.Operation; -import org.apache.olingo.commons.api.edm.provider.Parameter; -import org.apache.olingo.commons.core.edm.AbstractEdmOperation; - -public abstract class EdmOperationImpl extends AbstractEdmOperation { - - protected final Operation operation; - - protected static <T extends EdmOperationImpl> T getInstance(final T instance) { - final List<Parameter> providerParameters = instance.operation.getParameters(); - if (providerParameters != null) { - final List<EdmParameter> _parameters = new ArrayList<EdmParameter>(providerParameters.size()); - for (Parameter parameter : providerParameters) { - _parameters.add(new EdmParameterImpl(instance.edm, parameter)); - } - instance.setParameters(_parameters); - } - - final String entitySetPath = instance.operation.getEntitySetPath(); - if (entitySetPath != null) { - instance.setEntitySetPath(entitySetPath); - } - - instance.setIsBound(instance.operation.isBound()); - - if (instance.operation.getReturnType() != null) { - instance.setReturnType(new EdmReturnTypeImpl(instance.edm, instance.operation.getReturnType())); - } - - return instance; - } - - protected EdmOperationImpl(final Edm edm, final FullQualifiedName name, final Operation operation, - final EdmTypeKind kind) { - - super(edm, name, kind); - this.operation = operation; - } - - @Override - public FullQualifiedName getBindingParameterTypeFqn() { - if (isBound()) { - Parameter bindingParameter = operation.getParameters().get(0); - return bindingParameter.getTypeFQN(); - } - return null; - } - - @Override - public Boolean isBindingParameterTypeCollection() { - if (isBound()) { - Parameter bindingParameter = operation.getParameters().get(0); - return bindingParameter.isCollection(); - } - return null; - } - - @Override - public EdmAnnotation getAnnotation(final EdmTerm term) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public List<EdmAnnotation> getAnnotations() { - throw new UnsupportedOperationException("Not supported yet."); - } - -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImportImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImportImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImportImpl.java deleted file mode 100644 index 07da565..0000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImportImpl.java +++ /dev/null @@ -1,48 +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.core.edm.provider; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmAnnotation; -import org.apache.olingo.commons.api.edm.EdmEntityContainer; -import org.apache.olingo.commons.api.edm.EdmTerm; -import org.apache.olingo.commons.api.edm.Target; -import org.apache.olingo.commons.api.edm.provider.OperationImport; -import org.apache.olingo.commons.core.edm.AbstractEdmOperationImport; - -import java.util.List; - -public abstract class EdmOperationImportImpl extends AbstractEdmOperationImport { - - public EdmOperationImportImpl(final Edm edm, final EdmEntityContainer container, - final OperationImport operationImport) { - super(edm, container, operationImport.getName(), new Target.Builder(operationImport.getEntitySet(), container - ).build()); - } - - @Override - public EdmAnnotation getAnnotation(final EdmTerm term) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public List<EdmAnnotation> getAnnotations() { - throw new UnsupportedOperationException("Not supported yet."); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmParameterImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmParameterImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmParameterImpl.java deleted file mode 100644 index 397dc64..0000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmParameterImpl.java +++ /dev/null @@ -1,84 +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.core.edm.provider; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmAnnotation; -import org.apache.olingo.commons.api.edm.EdmMapping; -import org.apache.olingo.commons.api.edm.EdmTerm; -import org.apache.olingo.commons.api.edm.geo.SRID; -import org.apache.olingo.commons.api.edm.provider.Parameter; -import org.apache.olingo.commons.core.edm.AbstractEdmParameter; - -import java.util.List; - -public class EdmParameterImpl extends AbstractEdmParameter { - - private final Parameter parameter; - - public EdmParameterImpl(final Edm edm, final Parameter parameter) { - super(edm, parameter.getName(), parameter.getTypeFQN()); - this.parameter = parameter; - } - - @Override - public boolean isCollection() { - return parameter.isCollection(); - } - - @Override - public EdmMapping getMapping() { - return parameter.getMapping(); - } - - @Override - public boolean isNullable() { - return parameter.isNullable(); - } - - @Override - public Integer getMaxLength() { - return parameter.getMaxLength(); - } - - @Override - public Integer getPrecision() { - return parameter.getPrecision(); - } - - @Override - public Integer getScale() { - return parameter.getScale(); - } - - @Override - public SRID getSrid() { - return parameter.getSrid(); - } - - @Override - public EdmAnnotation getAnnotation(final EdmTerm term) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public List<EdmAnnotation> getAnnotations() { - throw new UnsupportedOperationException("Not supported yet."); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImpl.java deleted file mode 100644 index 1c8d5eb..0000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImpl.java +++ /dev/null @@ -1,118 +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.core.edm.provider; - -import java.util.List; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.EdmAnnotation; -import org.apache.olingo.commons.api.edm.EdmMapping; -import org.apache.olingo.commons.api.edm.EdmTerm; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.geo.SRID; -import org.apache.olingo.commons.api.edm.provider.Property; -import org.apache.olingo.commons.core.edm.AbstractEdmProperty; -import org.apache.olingo.commons.core.edm.EdmTypeInfo; - -public class EdmPropertyImpl extends AbstractEdmProperty { - - private final FullQualifiedName structuredTypeName; - - private final Property property; - - private final EdmTypeInfo typeInfo; - - public EdmPropertyImpl(final Edm edm, final FullQualifiedName structuredTypeName, final Property property) { - super(edm, property.getName()); - - this.structuredTypeName = structuredTypeName; - this.property = property; - typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(property.getType().toString()).build(); - } - - @Override - public EdmTypeInfo getTypeInfo() { - return typeInfo; - } - - @Override - public boolean isCollection() { - return property.isCollection(); - } - - @Override - public EdmMapping getMapping() { - return property.getMapping(); - } - - @Override - public String getMimeType() { - return property.getMimeType(); - } - - @Override - public boolean isNullable() { - return property.isNullable(); - } - - @Override - public Integer getMaxLength() { - return property.getMaxLength(); - } - - @Override - public Integer getPrecision() { - return property.getPrecision(); - } - - @Override - public Integer getScale() { - return property.getScale(); - } - - @Override - public SRID getSrid() { - return property.getSrid(); - } - - @Override - public boolean isUnicode() { - return property.isUnicode(); - } - - @Override - public String getDefaultValue() { - return property.getDefaultValue(); - } - - @Override - public FullQualifiedName getAnnotationsTargetFQN() { - return structuredTypeName; - } - - @Override - public EdmAnnotation getAnnotation(final EdmTerm term) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public List<EdmAnnotation> getAnnotations() { - throw new UnsupportedOperationException("Not supported yet."); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmProviderImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmProviderImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmProviderImpl.java deleted file mode 100644 index 649401b..0000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmProviderImpl.java +++ /dev/null @@ -1,343 +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.core.edm.provider; - -import org.apache.olingo.commons.api.ODataException; -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.EdmException; -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 org.apache.olingo.commons.api.edm.provider.Action; -import org.apache.olingo.commons.api.edm.provider.AliasInfo; -import org.apache.olingo.commons.api.edm.provider.ComplexType; -import org.apache.olingo.commons.api.edm.provider.EdmProvider; -import org.apache.olingo.commons.api.edm.provider.EntityContainerInfo; -import org.apache.olingo.commons.api.edm.provider.EntityType; -import org.apache.olingo.commons.api.edm.provider.EnumType; -import org.apache.olingo.commons.api.edm.provider.Function; -import org.apache.olingo.commons.api.edm.provider.Parameter; -import org.apache.olingo.commons.api.edm.provider.Schema; -import org.apache.olingo.commons.api.edm.provider.TypeDefinition; -import org.apache.olingo.commons.core.edm.AbstractEdm; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -public class EdmProviderImpl extends AbstractEdm { - - private final EdmProvider provider; - - private final Map<FullQualifiedName, List<Action>> actionsMap = new HashMap<FullQualifiedName, List<Action>>(); - - private final Map<FullQualifiedName, List<Function>> functionsMap = new HashMap<FullQualifiedName, List<Function>>(); - - public EdmProviderImpl(final EdmProvider provider) { - this.provider = provider; - - } - - @Override - public EdmEntityContainer createEntityContainer(final FullQualifiedName containerName) { - try { - EntityContainerInfo entityContainerInfo = provider.getEntityContainerInfo(containerName); - if (entityContainerInfo != null) { - return new EdmEntityContainerImpl(this, provider, entityContainerInfo); - } - return null; - } catch (ODataException e) { - throw new EdmException(e); - } - } - - @Override - public EdmEnumType createEnumType(final FullQualifiedName enumName) { - try { - EnumType enumType = provider.getEnumType(enumName); - if (enumType != null) { - return new EdmEnumTypeImpl(this, enumName, enumType); - } - return null; - } catch (ODataException e) { - throw new EdmException(e); - } - } - - @Override - public EdmTypeDefinition createTypeDefinition(final FullQualifiedName typeDefinitionName) { - try { - TypeDefinition typeDefinition = provider.getTypeDefinition(typeDefinitionName); - if (typeDefinition != null) { - return new EdmTypeDefinitionImpl(this, typeDefinitionName, typeDefinition); - } - return null; - } catch (ODataException e) { - throw new EdmException(e); - } - } - - @Override - public EdmEntityType createEntityType(final FullQualifiedName entityTypeName) { - try { - EntityType entityType = provider.getEntityType(entityTypeName); - if (entityType != null) { - return EdmEntityTypeImpl.getInstance(this, entityTypeName, entityType); - } - return null; - } catch (ODataException e) { - throw new EdmException(e); - } - } - - @Override - public EdmComplexType createComplexType(final FullQualifiedName complexTypeName) { - try { - final ComplexType complexType = provider.getComplexType(complexTypeName); - if (complexType != null) { - return EdmComplexTypeImpl.getInstance(this, complexTypeName, complexType); - } - return null; - } catch (ODataException e) { - throw new EdmException(e); - } - } - - @Override - public EdmAction createBoundAction(final FullQualifiedName actionName, - final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection) { - - try { - List<Action> actions = actionsMap.get(actionName); - if (actions == null) { - actions = provider.getActions(actionName); - if (actions == null) { - return null; - } else { - actionsMap.put(actionName, actions); - } - } - // Search for bound action where binding parameter matches - for (Action action : actions) { - if (action.isBound()) { - final List<Parameter> parameters = action.getParameters(); - final Parameter parameter = parameters.get(0); - if (bindingParameterTypeName.equals(parameter.getTypeFQN()) - && isBindingParameterCollection.booleanValue() == parameter.isCollection()) { - - return EdmActionImpl.getInstance(this, actionName, action); - } - - } - } - return null; - } catch (ODataException e) { - throw new EdmException(e); - } - } - - @Override - public EdmFunction createBoundFunction(final FullQualifiedName functionName, - final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection, - final List<String> parameterNames) { - - try { - List<Function> functions = functionsMap.get(functionName); - if (functions == null) { - functions = provider.getFunctions(functionName); - if (functions == null) { - return null; - } else { - functionsMap.put(functionName, functions); - } - } - final List<String> parameterNamesCopy = - parameterNames == null ? Collections.<String> emptyList() : parameterNames; - for (Function function : functions) { - if (function.isBound()) { - List<Parameter> providerParameters = function.getParameters(); - if (providerParameters == null || providerParameters.size() == 0) { - throw new EdmException("No parameter specified for bound function: " + functionName); - } - final Parameter bindingParameter = providerParameters.get(0); - if (bindingParameterTypeName.equals(bindingParameter.getTypeFQN()) - && isBindingParameterCollection.booleanValue() == bindingParameter.isCollection()) { - - if (parameterNamesCopy.size() == providerParameters.size() - 1) { - final List<String> providerParameterNames = new ArrayList<String>(); - for (int i = 1; i < providerParameters.size(); i++) { - providerParameterNames.add(providerParameters.get(i).getName()); - } - if (parameterNamesCopy.containsAll(providerParameterNames)) { - return EdmFunctionImpl.getInstance(this, functionName, function); - } - } - } - } - } - return null; - } catch (ODataException e) { - throw new EdmException(e); - } - } - - @Override - protected Map<String, String> createAliasToNamespaceInfo() { - final Map<String, String> aliasToNamespaceInfos = new HashMap<String, String>(); - try { - final List<AliasInfo> aliasInfos = provider.getAliasInfos(); - if (aliasInfos != null) { - for (AliasInfo info : aliasInfos) { - aliasToNamespaceInfos.put(info.getAlias(), info.getNamespace()); - } - } - } catch (ODataException e) { - throw new EdmException(e); - } - return aliasToNamespaceInfos; - } - - @Override - protected EdmAction createUnboundAction(final FullQualifiedName actionName) { - try { - List<Action> actions = actionsMap.get(actionName); - if (actions == null) { - actions = provider.getActions(actionName); - if (actions == null) { - return null; - } else { - actionsMap.put(actionName, actions); - } - } - // Search for first unbound action - for (Action action : actions) { - if (!action.isBound()) { - return EdmActionImpl.getInstance(this, actionName, action); - } - } - return null; - } catch (ODataException e) { - throw new EdmException(e); - } - } - - @Override - protected List<EdmFunction> createUnboundFunctions(final FullQualifiedName functionName) { - List<EdmFunction> result = new ArrayList<EdmFunction>(); - - try { - List<Function> functions = functionsMap.get(functionName); - if (functions == null) { - functions = provider.getFunctions(functionName); - if (functions != null) { - functionsMap.put(functionName, functions); - } - } - if (functions != null) { - for (Function function : functions) { - if (!function.isBound()) { - result.add(EdmFunctionImpl.getInstance(this, functionName, function)); - } - } - } - } catch (ODataException e) { - throw new EdmException(e); - } - - return result; - } - - @Override - protected EdmFunction createUnboundFunction(final FullQualifiedName functionName, final List<String> parameterNames) { - try { - List<Function> functions = functionsMap.get(functionName); - if (functions == null) { - functions = provider.getFunctions(functionName); - if (functions == null) { - return null; - } else { - functionsMap.put(functionName, functions); - } - } - - final List<String> parameterNamesCopy = - parameterNames == null ? Collections.<String> emptyList() : parameterNames; - for (Function function : functions) { - if (!function.isBound()) { - List<Parameter> providerParameters = function.getParameters(); - if (providerParameters == null) { - providerParameters = Collections.emptyList(); - } - if (parameterNamesCopy.size() == providerParameters.size()) { - final List<String> functionParameterNames = new ArrayList<String>(); - for (Parameter parameter : providerParameters) { - functionParameterNames.add(parameter.getName()); - } - - if (parameterNamesCopy.containsAll(functionParameterNames)) { - return EdmFunctionImpl.getInstance(this, functionName, function); - } - } - } - } - return null; - } catch (ODataException e) { - throw new EdmException(e); - } - } - - @Override - protected Map<String, EdmSchema> createSchemas() { - try { - final Map<String, EdmSchema> _schemas = new LinkedHashMap<String, EdmSchema>(); - for (Schema schema : provider.getSchemas()) { - _schemas.put(schema.getNamespace(), new EdmSchemaImpl(this, provider, schema)); - } - return _schemas; - } catch (ODataException e) { - throw new EdmException(e); - } - } - - @Override - protected EdmTerm createTerm(final FullQualifiedName termName) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - protected EdmAnnotations createAnnotationGroup(final FullQualifiedName targetName) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - protected List<EdmAnnotation> createAnnotations(final FullQualifiedName annotatedName) { - throw new UnsupportedOperationException("Not supported yet."); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReferentialConstraintImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReferentialConstraintImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReferentialConstraintImpl.java deleted file mode 100644 index f22d514..0000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReferentialConstraintImpl.java +++ /dev/null @@ -1,42 +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.core.edm.provider; - -import org.apache.olingo.commons.api.edm.EdmAnnotation; -import org.apache.olingo.commons.api.edm.EdmTerm; -import org.apache.olingo.commons.core.edm.AbstractEdmReferentialConstraint; - -import java.util.List; - -public class EdmReferentialConstraintImpl extends AbstractEdmReferentialConstraint { - - public EdmReferentialConstraintImpl(final String property, final String referencedProperty) { - super(property, referencedProperty); - } - - @Override - public EdmAnnotation getAnnotation(final EdmTerm term) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public List<EdmAnnotation> getAnnotations() { - throw new UnsupportedOperationException("Not supported yet."); - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImpl.java deleted file mode 100644 index 0cdf8bf..0000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImpl.java +++ /dev/null @@ -1,64 +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.core.edm.provider; - -import org.apache.olingo.commons.api.edm.Edm; -import org.apache.olingo.commons.api.edm.geo.SRID; -import org.apache.olingo.commons.api.edm.provider.ReturnType; -import org.apache.olingo.commons.core.edm.AbstractEdmReturnType; - -public class EdmReturnTypeImpl extends AbstractEdmReturnType { - - private final ReturnType returnType; - - public EdmReturnTypeImpl(final Edm edm, final ReturnType returnType) { - super(edm, returnType.getTypeFQN()); - this.returnType = returnType; - } - - @Override - public boolean isCollection() { - return returnType.isCollection(); - } - - @Override - public boolean isNullable() { - return returnType.isNullable(); - } - - @Override - public Integer getMaxLength() { - return returnType.getMaxLength(); - } - - @Override - public Integer getPrecision() { - return returnType.getPrecision(); - } - - @Override - public Integer getScale() { - return returnType.getScale(); - } - - @Override - public SRID getSrid() { - return null; // TODO: provide implementation - } -} http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5cef4fae/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java deleted file mode 100644 index 86c1842..0000000 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java +++ /dev/null @@ -1,168 +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.core.edm.provider; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.olingo.commons.api.edm.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.EdmTerm; -import org.apache.olingo.commons.api.edm.EdmTypeDefinition; -import org.apache.olingo.commons.api.edm.FullQualifiedName; -import org.apache.olingo.commons.api.edm.provider.Action; -import org.apache.olingo.commons.api.edm.provider.ComplexType; -import org.apache.olingo.commons.api.edm.provider.EdmProvider; -import org.apache.olingo.commons.api.edm.provider.EntityType; -import org.apache.olingo.commons.api.edm.provider.EnumType; -import org.apache.olingo.commons.api.edm.provider.Function; -import org.apache.olingo.commons.api.edm.provider.Schema; -import org.apache.olingo.commons.api.edm.provider.TypeDefinition; -import org.apache.olingo.commons.core.edm.AbstractEdmSchema; - -public class EdmSchemaImpl extends AbstractEdmSchema { - - private final Schema schema; - - private final Edm edm; - - private final EdmProvider provider; - - public EdmSchemaImpl(final Edm edm, final EdmProvider provider, final Schema schema) { - super(schema.getNamespace(), schema.getAlias()); - this.edm = edm; - this.provider = provider; - this.schema = schema; - } - - @Override - protected EdmEntityContainer createEntityContainer() { - if (schema.getEntityContainer() != null) { - FullQualifiedName containerFQN = new FullQualifiedName(namespace, schema.getEntityContainer().getName()); - return new EdmEntityContainerImpl(edm, provider, containerFQN, schema.getEntityContainer()); - } - return null; - } - - @Override - protected List<EdmTypeDefinition> createTypeDefinitions() { - final List<EdmTypeDefinition> typeDefinitions = new ArrayList<EdmTypeDefinition>(); - final List<TypeDefinition> providerTypeDefinitions = schema.getTypeDefinitions(); - if (providerTypeDefinitions != null) { - for (TypeDefinition def : providerTypeDefinitions) { - typeDefinitions.add(new EdmTypeDefinitionImpl(edm, new FullQualifiedName(namespace, def.getName()), def)); - } - } - return typeDefinitions; - } - - @Override - protected List<EdmEnumType> createEnumTypes() { - final List<EdmEnumType> enumTypes = new ArrayList<EdmEnumType>(); - final List<EnumType> providerEnumTypes = schema.getEnumTypes(); - if (providerEnumTypes != null) { - for (EnumType enumType : providerEnumTypes) { - enumTypes.add(new EdmEnumTypeImpl(edm, new FullQualifiedName(namespace, enumType.getName()), enumType)); - } - } - return enumTypes; - } - - @Override - protected List<EdmEntityType> createEntityTypes() { - final List<EdmEntityType> entityTypes = new ArrayList<EdmEntityType>(); - final List<EntityType> providerEntityTypes = schema.getEntityTypes(); - if (providerEntityTypes != null) { - for (EntityType entityType : providerEntityTypes) { - entityTypes.add(EdmEntityTypeImpl.getInstance(edm, new FullQualifiedName(namespace, entityType.getName()), - entityType)); - } - } - return entityTypes; - } - - @Override - protected List<EdmComplexType> createComplexTypes() { - final List<EdmComplexType> complexTypes = new ArrayList<EdmComplexType>(); - final List<ComplexType> providerComplexTypes = schema.getComplexTypes(); - if (providerComplexTypes != null) { - for (ComplexType complexType : providerComplexTypes) { - complexTypes.add(EdmComplexTypeImpl.getInstance(edm, new FullQualifiedName(namespace, complexType.getName()), - complexType)); - } - } - return complexTypes; - } - - @Override - protected List<EdmAction> createActions() { - final List<EdmAction> actions = new ArrayList<EdmAction>(); - final List<Action> providerActions = schema.getActions(); - if (providerActions != null) { - for (Action action : providerActions) { - actions.add(EdmActionImpl.getInstance(edm, new FullQualifiedName(namespace, action.getName()), action)); - } - } - return actions; - } - - @Override - protected List<EdmFunction> createFunctions() { - final List<EdmFunction> functions = new ArrayList<EdmFunction>(); - final List<Function> providerFunctions = schema.getFunctions(); - if (providerFunctions != null) { - for (Function function : providerFunctions) { - functions.add(EdmFunctionImpl.getInstance(edm, new FullQualifiedName(namespace, function.getName()), function)); - } - } - return functions; - } - - @Override - protected List<EdmTerm> createTerms() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - protected List<EdmAnnotations> createAnnotationGroups() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - protected List<EdmAnnotation> createAnnotations() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public EdmAnnotation getAnnotation(final EdmTerm term) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public List<EdmAnnotation> getAnnotations() { - throw new UnsupportedOperationException("Not supported yet."); - } -}
