From 6a3a4a1d7227198575822eb30bb237701583b061 Mon Sep 17 00:00:00 2001 From: Christian Amend Date: Tue, 1 Apr 2014 16:43:10 +0200 Subject: [PATCH] [OLINGO-168] More TechProvider Refactoring --- .../client/core/edm/EdmBindingTargetImpl.java | 39 +- .../core/edm/EdmEntityContainerImpl.java | 9 +- .../core/edm/EdmNavigationPropertyImpl.java | 33 +- .../client/core/edm/EdmOperationImpl.java | 2 +- .../client/core/edm/v3/EdmEntitySetProxy.java | 7 + .../commons/api/edm/EdmBindingTarget.java | 7 + .../commons/api/edm/EdmEntityContainer.java | 5 + .../api/edm/EdmNavigationProperty.java | 27 +- .../api/edm/EdmNavigationPropertyBinding.java | 28 ++ .../api/edm/EdmReferentialConstraint.java | 28 ++ .../core/edm/AbstractEdmEntityContainer.java | 11 +- .../edm/EdmNavigationPropertyBindingImpl.java | 43 ++ .../edm/EdmReferentialConstraintImpl.java | 42 ++ .../edm/provider/EdmBindingTargetImpl.java | 24 ++ .../edm/provider/EdmEntityContainerImpl.java | 5 +- .../provider/EdmNavigationPropertyImpl.java | 18 + .../serializer/ODataXmlSerializerImpl.java | 6 +- .../xml/MetadataDocumentXmlSerializer.java | 319 +++++++++----- .../serializer/xml/MetadataDocumentTest.java | 6 +- .../core/testutil/EdmTechTestProvider.java | 4 +- .../testutil/techprovider/ActionProvider.java | 62 +-- .../techprovider/ComplexTypeProvider.java | 26 +- .../techprovider/ContainerProvider.java | 2 +- .../techprovider/EdmTechProvider.java | 12 + .../techprovider/EntityTypeProvider.java | 153 ++++--- .../techprovider/EnumTypeProvider.java | 3 + .../techprovider/FunctionProvider.java | 394 ++++++++++-------- .../techprovider/PropertyProvider.java | 302 +++++++++++++- .../testutil/techprovider/SchemaProvider.java | 23 +- .../techprovider/TypeDefinitionProvider.java | 2 +- .../core/uri/antlr/TestUriParserImpl.java | 4 +- 31 files changed, 1214 insertions(+), 432 deletions(-) create mode 100644 lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationPropertyBinding.java create mode 100644 lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmReferentialConstraint.java create mode 100644 lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNavigationPropertyBindingImpl.java create mode 100644 lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmReferentialConstraintImpl.java diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmBindingTargetImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmBindingTargetImpl.java index 6f1990e01..452c880f7 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmBindingTargetImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmBindingTargetImpl.java @@ -1,23 +1,24 @@ /* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.olingo.client.core.edm; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -27,16 +28,19 @@ 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.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 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 navigationPropertyBindings; public EdmBindingTargetImpl(final Edm edm, final EdmEntityContainer container, - final String name, final FullQualifiedName type, final BindingTarget target) { + final String name, final FullQualifiedName type, final BindingTarget target) { super(edm, container, name, type); this.target = target; @@ -48,8 +52,9 @@ public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget { final List navigationPropertyBindings = target.getNavigationPropertyBindings(); boolean found = false; - for (final Iterator itor = navigationPropertyBindings.iterator(); - itor.hasNext() && !found;) { + for (final Iterator itor = navigationPropertyBindings.iterator(); itor + .hasNext() + && !found;) { final NavigationPropertyBinding binding = itor.next(); if (binding.getPath().equals(path)) { @@ -76,4 +81,18 @@ public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget { return bindingTarget; } + @Override + public List getNavigationPropertyBindings() { + if (navigationPropertyBindings == null) { + List providerBindings = target.getNavigationPropertyBindings(); + navigationPropertyBindings = new ArrayList(); + if (providerBindings != null) { + for (NavigationPropertyBinding binding : providerBindings) { + navigationPropertyBindings.add(new EdmNavigationPropertyBindingImpl(binding.getPath(), binding.getTarget())); + } + } + } + return navigationPropertyBindings; + } + } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java index 169aaf92b..6a962e39a 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java @@ -49,12 +49,19 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer { public EdmEntityContainerImpl(final Edm edm, final FullQualifiedName entityContainerName, final EntityContainer xmlEntityContainer, final XMLMetadata xmlMetadata) { - super(edm, entityContainerName); + super(edm, entityContainerName, getFullQualifiedName(xmlEntityContainer.getExtends())); this.xmlEntityContainer = xmlEntityContainer; this.xmlMetadata = xmlMetadata; } + private static FullQualifiedName getFullQualifiedName(String parent) { + if (parent != null) { + return new FullQualifiedName(parent); + } + return null; + } + @Override protected EdmSingleton createSingleton(final String singletonName) { if (!(xmlEntityContainer instanceof org.apache.olingo.client.api.edm.xml.v4.EntityContainer)) { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java index 19df6205d..953da5bae 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmNavigationPropertyImpl.java @@ -1,36 +1,40 @@ /* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.olingo.client.core.edm; +import java.util.ArrayList; import java.util.List; import org.apache.olingo.client.api.edm.xml.v4.NavigationProperty; import org.apache.olingo.client.api.edm.xml.v4.ReferentialConstraint; import org.apache.olingo.commons.api.edm.Edm; +import org.apache.olingo.commons.api.edm.EdmReferentialConstraint; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.core.edm.AbstractEdmNavigationProperty; +import org.apache.olingo.commons.core.edm.EdmReferentialConstraintImpl; public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty { private final NavigationProperty navigationProperty; private final EdmTypeInfo edmTypeInfo; + private List referentialConstraints; public EdmNavigationPropertyImpl(final Edm edm, final NavigationProperty navigationProperty) { super(edm, navigationProperty.getName()); @@ -71,4 +75,19 @@ public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty { return null; } + @Override + public List getReferentialConstraints() { + if (referentialConstraints == null) { + final List providerConstraints = navigationProperty.getReferentialConstraints(); + referentialConstraints = new ArrayList(); + if (providerConstraints != null) { + for (ReferentialConstraint constraint : providerConstraints) { + referentialConstraints.add(new EdmReferentialConstraintImpl(constraint.getProperty(), constraint + .getReferencedProperty())); + } + } + } + return referentialConstraints; + } + } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmOperationImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmOperationImpl.java index f54d6c16c..a38602a68 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmOperationImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmOperationImpl.java @@ -85,6 +85,6 @@ public abstract class EdmOperationImpl extends AbstractEdmOperation { if (bindingParam != null) { result = bindingParam.isCollection(); } - return null; + return result; } } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmEntitySetProxy.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmEntitySetProxy.java index 0cc0ff863..2624860c5 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmEntitySetProxy.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmEntitySetProxy.java @@ -33,6 +33,7 @@ import org.apache.olingo.commons.api.edm.EdmBindingTarget; 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.EdmNavigationPropertyBinding; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.core.edm.AbstractEdmBindingTarget; @@ -105,4 +106,10 @@ public class EdmEntitySetProxy extends AbstractEdmBindingTarget implements EdmEn return true; } + @Override + public List getNavigationPropertyBindings() { + //There are no navigation property bindings in V3 so we will deliver an empty list + return new ArrayList(); + } + } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmBindingTarget.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmBindingTarget.java index 87c9d34a9..1c66b80f3 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmBindingTarget.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmBindingTarget.java @@ -18,6 +18,8 @@ */ package org.apache.olingo.commons.api.edm; +import java.util.List; + /** * Entity Sets or Singletons can be bound to each other using a navigation property binding so an * {@link EdmBindingTarget} can either be an {@link EdmEntitySet} or an {@link EdmSingleton}. @@ -32,6 +34,11 @@ public interface EdmBindingTarget extends EdmNamed { */ EdmBindingTarget getRelatedBindingTarget(String path); + /** + * @return all navigation property bindings + */ + List getNavigationPropertyBindings(); + /** * Returns the entity container this target is contained in. * diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java index 00afbc877..84dfea4d5 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmEntityContainer.java @@ -89,4 +89,9 @@ public interface EdmEntityContainer extends EdmNamed { */ List getActionImports(); + /** + * @return the {@link FullQualifiedName} of the parentContainer or null if no parent is specified + */ + FullQualifiedName getParentContainerName(); + } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationProperty.java index 52c645f1e..5f54154ea 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationProperty.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationProperty.java @@ -1,23 +1,25 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.olingo.commons.api.edm; +import java.util.List; + /** * A CSDL NavigationProperty element *
@@ -35,6 +37,15 @@ public interface EdmNavigationProperty extends EdmElement { */ EdmNavigationProperty getPartner(); + /** + * @param referencedPropertyName + * @return propertyName for this referenced property + */ String getReferencingPropertyName(String referencedPropertyName); + /** + * @return all referential constraints for this navigation property. + */ + List getReferentialConstraints(); + } diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationPropertyBinding.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationPropertyBinding.java new file mode 100644 index 000000000..2ebcf2bcf --- /dev/null +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmNavigationPropertyBinding.java @@ -0,0 +1,28 @@ +/* + * 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; + +//TODO: JavaDoc +public interface EdmNavigationPropertyBinding { + + String getPath(); + + String getTarget(); + +} diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmReferentialConstraint.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmReferentialConstraint.java new file mode 100644 index 000000000..e479efbcd --- /dev/null +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmReferentialConstraint.java @@ -0,0 +1,28 @@ +/* + * 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; + +//TODO: Document +public interface EdmReferentialConstraint { + + String getPropertyName(); + + String getReferencedPropertyName(); + +} 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 index aba62ba55..853d21f3b 100644 --- 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 @@ -47,9 +47,13 @@ public abstract class AbstractEdmEntityContainer extends EdmNamedImpl implements protected final Map functionImports = new HashMap(); private boolean allFunctionImportsLoaded = false; - public AbstractEdmEntityContainer(final Edm edm, final FullQualifiedName entityContainerName) { + private final FullQualifiedName parentContainerName; + + public AbstractEdmEntityContainer(final Edm edm, final FullQualifiedName entityContainerName, + final FullQualifiedName parentContainerName) { super(edm, entityContainerName.getName()); this.entityContainerName = entityContainerName; + this.parentContainerName = parentContainerName; } @Override @@ -148,4 +152,9 @@ public abstract class AbstractEdmEntityContainer extends EdmNamedImpl implements } protected abstract void loadAllActionImports(); + + @Override + public FullQualifiedName getParentContainerName() { + return parentContainerName; + } } diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNavigationPropertyBindingImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNavigationPropertyBindingImpl.java new file mode 100644 index 000000000..233e5d255 --- /dev/null +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNavigationPropertyBindingImpl.java @@ -0,0 +1,43 @@ +/* + * 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.EdmNavigationPropertyBinding; + +public class EdmNavigationPropertyBindingImpl implements EdmNavigationPropertyBinding { + + private final String path; + private final String target; + + public EdmNavigationPropertyBindingImpl(String path, String target){ + this.path = path; + this.target = target; + } + + @Override + public String getPath() { + return path; + } + + @Override + public String getTarget() { + return target; + } + +} diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmReferentialConstraintImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmReferentialConstraintImpl.java new file mode 100644 index 000000000..93e151976 --- /dev/null +++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmReferentialConstraintImpl.java @@ -0,0 +1,42 @@ +/* + * 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 class EdmReferentialConstraintImpl implements EdmReferentialConstraint { + + private final String property; + private final String referencedProperty; + + public EdmReferentialConstraintImpl(String property, String referencedProperty) { + this.property = property; + this.referencedProperty = referencedProperty; + } + + @Override + public String getPropertyName() { + return property; + } + + @Override + public String getReferencedPropertyName() { + return referencedProperty; + } +} 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 index c1aacb1f4..78651bc86 100644 --- 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 @@ -18,6 +18,7 @@ */ package org.apache.olingo.server.core.edm.provider; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -25,14 +26,17 @@ 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.EdmException; +import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding; import org.apache.olingo.commons.api.edm.Target; import org.apache.olingo.commons.core.edm.AbstractEdmBindingTarget; +import org.apache.olingo.commons.core.edm.EdmNavigationPropertyBindingImpl; import org.apache.olingo.server.api.edm.provider.BindingTarget; import org.apache.olingo.server.api.edm.provider.NavigationPropertyBinding; public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget { private final BindingTarget target; + private List navigationPropertyBindings; public EdmBindingTargetImpl(final Edm edm, final EdmEntityContainer container, final BindingTarget target) { super(edm, container, target.getName(), target.getType()); @@ -74,4 +78,24 @@ public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget { return bindingTarget; } + + @Override + public List getNavigationPropertyBindings() { + if (navigationPropertyBindings == null) { + List providerBindings = target.getNavigationPropertyBindings(); + navigationPropertyBindings = new ArrayList(); + if (providerBindings != null) { + for (NavigationPropertyBinding binding : providerBindings) { + Target providerTarget = binding.getTarget(); + String targetString = ""; + if (providerTarget.getEntityContainer() != null) { + targetString = targetString + providerTarget.getEntityContainer().getFullQualifiedNameAsString() + "/"; + } + targetString = targetString + providerTarget.getTargetName(); + navigationPropertyBindings.add(new EdmNavigationPropertyBindingImpl(binding.getPath(), targetString)); + } + } + } + return navigationPropertyBindings; + } } 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 index 7c8198019..1a1012aef 100644 --- 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 @@ -44,14 +44,13 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer { public EdmEntityContainerImpl(final Edm edm, final EdmProvider provider, final EntityContainerInfo entityContainerInfo) { - - super(edm, entityContainerInfo.getContainerName()); + 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); + super(edm, containerFQN, entityContainer.getExtendsContainer()); this.provider = provider; container = entityContainer; } 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 index 7f570da4b..4c7e0cb23 100644 --- 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 @@ -18,17 +18,21 @@ */ 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.EdmReferentialConstraint; import org.apache.olingo.commons.api.edm.FullQualifiedName; import org.apache.olingo.commons.core.edm.AbstractEdmNavigationProperty; +import org.apache.olingo.commons.core.edm.EdmReferentialConstraintImpl; import org.apache.olingo.server.api.edm.provider.NavigationProperty; import org.apache.olingo.server.api.edm.provider.ReferentialConstraint; public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty { private final NavigationProperty navigationProperty; + private List referentialConstraints; public EdmNavigationPropertyImpl(final Edm edm, final NavigationProperty navigationProperty) { super(edm, navigationProperty.getName()); @@ -68,4 +72,18 @@ public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty { return null; } + @Override + public List getReferentialConstraints() { + if (referentialConstraints == null) { + final List providerConstraints = navigationProperty.getReferentialConstraints(); + referentialConstraints = new ArrayList(); + if (providerConstraints != null) { + for (ReferentialConstraint constraint : providerConstraints) { + referentialConstraints.add(new EdmReferentialConstraintImpl(constraint.getProperty(), constraint + .getReferencedProperty())); + } + } + } + return referentialConstraints; + } } diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ODataXmlSerializerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ODataXmlSerializerImpl.java index 479044660..49f88313a 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ODataXmlSerializerImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/ODataXmlSerializerImpl.java @@ -18,9 +18,7 @@ */ package org.apache.olingo.server.core.serializer; -import java.io.BufferedWriter; import java.io.InputStream; -import java.io.OutputStreamWriter; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; @@ -46,14 +44,12 @@ public class ODataXmlSerializerImpl implements ODataSerializer { @Override public InputStream metadataDocument(final Edm edm) { CircleStreamBuffer buffer; - BufferedWriter writer; XMLStreamWriter xmlStreamWriter = null; // TODO: move stream initialization into separate method try { buffer = new CircleStreamBuffer(); - writer = new BufferedWriter(new OutputStreamWriter(buffer.getOutputStream(), DEFAULT_CHARSET)); - xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(writer); + xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(buffer.getOutputStream(), DEFAULT_CHARSET); MetadataDocumentXmlSerializer serializer = new MetadataDocumentXmlSerializer(edm); serializer.writeMetadataDocument(xmlStreamWriter); xmlStreamWriter.close(); diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java index b7f6015c6..2313a3a0f 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java @@ -26,6 +26,7 @@ import javax.xml.stream.XMLStreamWriter; 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.EdmBindingTarget; import org.apache.olingo.commons.api.edm.EdmComplexType; import org.apache.olingo.commons.api.edm.EdmEntityContainer; import org.apache.olingo.commons.api.edm.EdmEntitySet; @@ -35,16 +36,64 @@ import org.apache.olingo.commons.api.edm.EdmFunction; import org.apache.olingo.commons.api.edm.EdmFunctionImport; import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef; import org.apache.olingo.commons.api.edm.EdmNavigationProperty; +import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding; +import org.apache.olingo.commons.api.edm.EdmOperation; import org.apache.olingo.commons.api.edm.EdmParameter; import org.apache.olingo.commons.api.edm.EdmProperty; +import org.apache.olingo.commons.api.edm.EdmReferentialConstraint; import org.apache.olingo.commons.api.edm.EdmReturnType; import org.apache.olingo.commons.api.edm.EdmSchema; 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.EdmTypeDefinition; +import org.apache.olingo.commons.api.edm.FullQualifiedName; +import org.apache.olingo.server.api.serializer.ODataSerializer; public class MetadataDocumentXmlSerializer { + private static final String XML_EXTENDS = "Extends"; + private static final String XML_TARGET = "Target"; + private static final String XML_PATH = "Path"; + private static final String XML_NAVIGATION_PROPERTY_BINDING = "NavigationPropertyBinding"; + private static final String XML_VALUE = "Value"; + private static final String XML_MEMBER = "Member"; + private static final String XML_UNDERLYING_TYPE = "UnderlyingType"; + private static final String XML_IS_FLAGS = "IsFlags"; + private static final String XML_ENUM_TYPE = "EnumType"; + private static final String XML_PROPERTY_REF = "PropertyRef"; + private static final String XML_KEY = "Key"; + private static final String XML_SCALE = "Scale"; + private static final String XML_PRECISION = "Precision"; + private static final String XML_MAX_LENGTH = "MaxLength"; + private static final String XML_DEFAULT_VALUE = "DefaultValue"; + private static final String XML_UNICODE = "Unicode"; + private static final String XML_PROPERTY = "Property"; + private static final String XML_PARTNER = "Partner"; + private static final String XML_NULLABLE = "Nullable"; + private static final String XML_NAVIGATION_PROPERTY = "NavigationProperty"; + private static final String XML_HAS_STREAM = "HasStream"; + private static final String XML_BASE_TYPE = "BaseType"; + private static final String XML_COMPLEX_TYPE = "ComplexType"; + private static final String XML_RETURN_TYPE = "ReturnType"; + private static final String XML_TYPE = "Type"; + private static final String XML_PARAMETER = "Parameter"; + private static final String XML_IS_COMPOSABLE = "IsComposable"; + private static final String XML_IS_BOUND = "IsBound"; + private static final String XML_ENTITY_TYPE = "EntityType"; + private static final String XML_SINGLETON = "Singleton"; + private static final String XML_ACTION = "Action"; + private static final String XML_ACTION_IMPORT = "ActionImport"; + private static final String XML_INCLUDE_IN_SERVICE_DOCUMENT = "IncludeInServiceDocument"; + private static final String XML_ENTITY_SET = "EntitySet"; + private static final String XML_FUNCTION = "Function"; + private static final String XML_FUNCTION_IMPORT = "FunctionImport"; + private static final String XML_NAME = "Name"; + private static final String XML_ENTITY_CONTAINER = "EntityContainer"; + private static final String XML_ALIAS = "Alias"; + private static final String XML_NAMESPACE = "Namespace"; + private static final String XML_TYPE_DEFINITION = "TypeDefinition"; + private final Edm edm; private final static String EDMX = "Edmx"; @@ -58,7 +107,7 @@ public class MetadataDocumentXmlSerializer { } public void writeMetadataDocument(final XMLStreamWriter writer) throws XMLStreamException { - writer.writeStartDocument(); + writer.writeStartDocument(ODataSerializer.DEFAULT_CHARSET, "1.0"); writer.setPrefix(PREFIX_EDMX, NS_EDMX); writer.setDefaultNamespace(NS_EDMX); writer.writeStartElement(PREFIX_EDMX, EDMX, NS_EDMX); @@ -74,7 +123,6 @@ public class MetadataDocumentXmlSerializer { private void appendDataServices(final XMLStreamWriter writer) throws XMLStreamException { writer.setDefaultNamespace(NS_EDM); -// writer.writeStartElement(PREFIX_EDM, "DataServices", NS_EDMX); writer.writeStartElement(NS_EDMX, "DataServices"); for (EdmSchema schema : edm.getSchemas()) { appendSchema(writer, schema); @@ -85,8 +133,8 @@ public class MetadataDocumentXmlSerializer { private void appendSchema(final XMLStreamWriter writer, final EdmSchema schema) throws XMLStreamException { writer.writeStartElement(NS_EDM, "Schema"); writer.writeDefaultNamespace(NS_EDM); - writer.writeAttribute("Namespace", schema.getNamespace()); - writer.writeAttribute("Alias", schema.getAlias()); + writer.writeAttribute(XML_NAMESPACE, schema.getNamespace()); + writer.writeAttribute(XML_ALIAS, schema.getAlias()); // EnumTypes appendEnumTypes(writer, schema.getEnumTypes()); @@ -98,7 +146,7 @@ public class MetadataDocumentXmlSerializer { appendComplexTypes(writer, schema.getComplexTypes()); // TypeDefinitions - // TODO: TypeDefinitions + appendTypeDefinitions(writer, schema.getTypeDefinitions()); // Actions appendActions(writer, schema.getActions()); @@ -112,13 +160,38 @@ public class MetadataDocumentXmlSerializer { writer.writeEndElement(); } + private void appendTypeDefinitions(XMLStreamWriter writer, List typeDefinitions) + throws XMLStreamException { + for (EdmTypeDefinition definition : typeDefinitions) { + writer.writeEmptyElement(XML_TYPE_DEFINITION); + writer.writeAttribute(XML_NAME, definition.getName()); + writer.writeAttribute(XML_TYPE, getFullQualifiedName(definition.getUnderlyingType(), false)); + + // Facets + if (definition.getMaxLength() != null) { + writer.writeAttribute(XML_MAX_LENGTH, "" + definition.getMaxLength()); + } + + if (definition.getPrecision() != null) { + writer.writeAttribute(XML_PRECISION, "" + definition.getPrecision()); + } + + if (definition.getScale() != null) { + writer.writeAttribute(XML_SCALE, "" + definition.getScale()); + } + } + } + private void appendEntityContainer(final XMLStreamWriter writer, final EdmEntityContainer container) throws XMLStreamException { if (container != null) { - writer.writeStartElement("EntityContainer"); + writer.writeStartElement(XML_ENTITY_CONTAINER); - writer.writeAttribute("Name", container.getName()); - // TODO: extends attribute + writer.writeAttribute(XML_NAME, container.getName()); + FullQualifiedName parentContainerName = container.getParentContainerName(); + if (parentContainerName != null) { + writer.writeAttribute(XML_EXTENDS, parentContainerName.getFullQualifiedNameAsString()); + } // EntitySets appendEntitySets(writer, container.getEntitySets()); @@ -139,14 +212,14 @@ public class MetadataDocumentXmlSerializer { private void appendFunctionImports(final XMLStreamWriter writer, final List functionImports, final String containerNamespace) throws XMLStreamException { for (EdmFunctionImport functionImport : functionImports) { - writer.writeStartElement("FunctionImport"); - writer.writeAttribute("Name", functionImport.getName()); - writer.writeAttribute("Function", functionImport.getFunctionFqn().getFullQualifiedNameAsString()); + writer.writeStartElement(XML_FUNCTION_IMPORT); + writer.writeAttribute(XML_NAME, functionImport.getName()); + writer.writeAttribute(XML_FUNCTION, functionImport.getFunctionFqn().getFullQualifiedNameAsString()); EdmEntitySet returnedEntitySet = functionImport.getReturnedEntitySet(); if (returnedEntitySet != null) { - writer.writeAttribute("EntitySet", containerNamespace + "." + returnedEntitySet.getName()); + writer.writeAttribute(XML_ENTITY_SET, containerNamespace + "." + returnedEntitySet.getName()); } - writer.writeAttribute("IncludeInServiceDocument", "" + functionImport.isIncludeInServiceDocument()); + writer.writeAttribute(XML_INCLUDE_IN_SERVICE_DOCUMENT, "" + functionImport.isIncludeInServiceDocument()); // TODO: Annotations writer.writeEndElement(); @@ -156,9 +229,9 @@ public class MetadataDocumentXmlSerializer { private void appendActionImports(final XMLStreamWriter writer, final List actionImports) throws XMLStreamException { for (EdmActionImport actionImport : actionImports) { - writer.writeStartElement("ActionImport"); - writer.writeAttribute("Name", actionImport.getName()); - writer.writeAttribute("Action", getFullQualifiedName(actionImport.getAction(), false)); + writer.writeStartElement(XML_ACTION_IMPORT); + writer.writeAttribute(XML_NAME, actionImport.getName()); + writer.writeAttribute(XML_ACTION, getFullQualifiedName(actionImport.getAction(), false)); // TODO: Annotations writer.writeEndElement(); } @@ -166,29 +239,37 @@ public class MetadataDocumentXmlSerializer { private void appendSingletons(final XMLStreamWriter writer, final List singletons) throws XMLStreamException { - // TODO: Merge with entity set method for (EdmSingleton singleton : singletons) { - writer.writeStartElement("Singleton"); - writer.writeAttribute("Name", singleton.getName()); - writer.writeAttribute("EntityType", getFullQualifiedName(singleton.getEntityType(), false)); - - // TODO: NavigationProperty Bindigs at edm api level + writer.writeStartElement(XML_SINGLETON); + writer.writeAttribute(XML_NAME, singleton.getName()); + writer.writeAttribute(XML_ENTITY_TYPE, getFullQualifiedName(singleton.getEntityType(), false)); + appendNavigationPropertyBindings(writer, singleton); // TODO: Annotations writer.writeEndElement(); } } + private void appendNavigationPropertyBindings(final XMLStreamWriter writer, EdmBindingTarget bindingTarget) + throws XMLStreamException { + if (bindingTarget.getNavigationPropertyBindings() != null) { + for (EdmNavigationPropertyBinding binding : bindingTarget.getNavigationPropertyBindings()) { + writer.writeEmptyElement(XML_NAVIGATION_PROPERTY_BINDING); + writer.writeAttribute(XML_PATH, binding.getPath()); + writer.writeAttribute(XML_TARGET, binding.getTarget()); + } + } + } + private void appendEntitySets(final XMLStreamWriter writer, final List entitySets) throws XMLStreamException { for (EdmEntitySet entitySet : entitySets) { - writer.writeStartElement("EntitySet"); - writer.writeAttribute("Name", entitySet.getName()); - writer.writeAttribute("EntityType", getFullQualifiedName(entitySet.getEntityType(), false)); - - // TODO: NavigationProperty Bindigs at edm api level + writer.writeStartElement(XML_ENTITY_SET); + writer.writeAttribute(XML_NAME, entitySet.getName()); + writer.writeAttribute(XML_ENTITY_TYPE, getFullQualifiedName(entitySet.getEntityType(), false)); + appendNavigationPropertyBindings(writer, entitySet); // TODO: Annotations writer.writeEndElement(); } @@ -197,64 +278,95 @@ public class MetadataDocumentXmlSerializer { private void appendFunctions(final XMLStreamWriter writer, final List functions) throws XMLStreamException { for (EdmFunction function : functions) { - writer.writeStartElement("Function"); - writer.writeAttribute("Name", function.getName()); - writer.writeAttribute("IsBound", "" + function.isBound()); - writer.writeAttribute("IsComposable", "" + function.isComposable()); + writer.writeStartElement(XML_FUNCTION); + writer.writeAttribute(XML_NAME, function.getName()); + // TODO: EntitySetPath + writer.writeAttribute(XML_IS_BOUND, "" + function.isBound()); + writer.writeAttribute(XML_IS_COMPOSABLE, "" + function.isComposable()); - // TODO: move to separate method like for actions - for (String parameterName : function.getParameterNames()) { - EdmParameter parameter = function.getParameter(parameterName); - writer.writeEmptyElement("Parameter"); - writer.writeAttribute("Name", parameterName); - writer.writeAttribute("Type", getFullQualifiedName(parameter.getType(), parameter.isCollection())); - // TODO: Parameter facets - } + appendOperationParameters(writer, function); - EdmReturnType returnType = function.getReturnType(); - if (returnType != null) { - writer.writeEmptyElement("ReturnType"); - writer.writeAttribute("Type", getFullQualifiedName(returnType.getType(), returnType.isCollection())); - // TODO: Return type facets - } + appendOperationReturnType(writer, function); writer.writeEndElement(); } } + private void appendOperationReturnType(final XMLStreamWriter writer, EdmOperation operation) + throws XMLStreamException { + EdmReturnType returnType = operation.getReturnType(); + if (returnType != null) { + writer.writeEmptyElement(XML_RETURN_TYPE); + writer.writeAttribute(XML_TYPE, getFullQualifiedName(returnType.getType(), returnType.isCollection())); + + appendReturnTypeFacets(writer, returnType); + } + } + + private void appendOperationParameters(final XMLStreamWriter writer, EdmOperation operation) + throws XMLStreamException { + for (String parameterName : operation.getParameterNames()) { + EdmParameter parameter = operation.getParameter(parameterName); + writer.writeEmptyElement(XML_PARAMETER); + writer.writeAttribute(XML_NAME, parameterName); + writer.writeAttribute(XML_TYPE, getFullQualifiedName(parameter.getType(), parameter.isCollection())); + + appendParameterFacets(writer, parameter); + } + } + private void appendActions(final XMLStreamWriter writer, final List actions) throws XMLStreamException { for (EdmAction action : actions) { - writer.writeStartElement("Action"); - writer.writeAttribute("Name", action.getName()); - writer.writeAttribute("IsBound", "" + action.isBound()); + writer.writeStartElement(XML_ACTION); + writer.writeAttribute(XML_NAME, action.getName()); + writer.writeAttribute(XML_IS_BOUND, "" + action.isBound()); - for (String parameterName : action.getParameterNames()) { - EdmParameter parameter = action.getParameter(parameterName); - writer.writeEmptyElement("Parameter"); - writer.writeAttribute("Name", parameterName); - writer.writeAttribute("Type", getFullQualifiedName(parameter.getType(), parameter.isCollection())); - // TODO: Parameter facets - } + appendOperationParameters(writer, action); - EdmReturnType returnType = action.getReturnType(); - if (returnType != null) { - writer.writeEmptyElement("ReturnType"); - writer.writeAttribute("Type", getFullQualifiedName(returnType.getType(), returnType.isCollection())); - // TODO: Return type facets - } + appendOperationReturnType(writer, action); writer.writeEndElement(); } } + private void appendReturnTypeFacets(XMLStreamWriter writer, EdmReturnType returnType) throws XMLStreamException { + if (returnType.isNullable() != null) { + writer.writeAttribute(XML_NULLABLE, "" + returnType.isNullable()); + } + if (returnType.getMaxLength() != null) { + writer.writeAttribute(XML_MAX_LENGTH, "" + returnType.getMaxLength()); + } + if (returnType.getPrecision() != null) { + writer.writeAttribute(XML_PRECISION, "" + returnType.getPrecision()); + } + if (returnType.getScale() != null) { + writer.writeAttribute(XML_SCALE, "" + returnType.getScale()); + } + } + + private void appendParameterFacets(XMLStreamWriter writer, EdmParameter parameter) throws XMLStreamException { + if (parameter.isNullable() != null) { + writer.writeAttribute(XML_NULLABLE, "" + parameter.isNullable()); + } + if (parameter.getMaxLength() != null) { + writer.writeAttribute(XML_MAX_LENGTH, "" + parameter.getMaxLength()); + } + if (parameter.getPrecision() != null) { + writer.writeAttribute(XML_PRECISION, "" + parameter.getPrecision()); + } + if (parameter.getScale() != null) { + writer.writeAttribute(XML_SCALE, "" + parameter.getScale()); + } + } + private void appendComplexTypes(final XMLStreamWriter writer, final List complexTypes) throws XMLStreamException { for (EdmComplexType complexType : complexTypes) { - writer.writeStartElement("ComplexType"); - writer.writeAttribute("Name", complexType.getName()); + writer.writeStartElement(XML_COMPLEX_TYPE); + writer.writeAttribute(XML_NAME, complexType.getName()); if (complexType.getBaseType() != null) { - writer.writeAttribute("BaseType", getFullQualifiedName(complexType.getBaseType(), false)); + writer.writeAttribute(XML_BASE_TYPE, getFullQualifiedName(complexType.getBaseType(), false)); } appendProperties(writer, complexType); @@ -268,15 +380,15 @@ public class MetadataDocumentXmlSerializer { private void appendEntityTypes(final XMLStreamWriter writer, final List entityTypes) throws XMLStreamException { for (EdmEntityType entityType : entityTypes) { - writer.writeStartElement("EntityType"); - writer.writeAttribute("Name", entityType.getName()); + writer.writeStartElement(XML_ENTITY_TYPE); + writer.writeAttribute(XML_NAME, entityType.getName()); if (entityType.hasStream()) { - writer.writeAttribute("HasStream", "" + entityType.hasStream()); + writer.writeAttribute(XML_HAS_STREAM, "" + entityType.hasStream()); } if (entityType.getBaseType() != null) { - writer.writeAttribute("BaseType", getFullQualifiedName(entityType.getBaseType(), false)); + writer.writeAttribute(XML_BASE_TYPE, getFullQualifiedName(entityType.getBaseType(), false)); } appendKey(writer, entityType); @@ -298,18 +410,28 @@ public class MetadataDocumentXmlSerializer { for (String navigationPropertyName : navigationPropertyNames) { EdmNavigationProperty navigationProperty = type.getNavigationProperty(navigationPropertyName); - writer.writeEmptyElement("NavigationProperty"); - writer.writeAttribute("Name", navigationPropertyName); - writer.writeAttribute("Type", getFullQualifiedName(navigationProperty.getType(), navigationProperty + writer.writeStartElement(XML_NAVIGATION_PROPERTY); + writer.writeAttribute(XML_NAME, navigationPropertyName); + writer.writeAttribute(XML_TYPE, getFullQualifiedName(navigationProperty.getType(), navigationProperty .isCollection())); if (navigationProperty.isNullable() != null) { - writer.writeAttribute("Nullable", "" + navigationProperty.isNullable()); + writer.writeAttribute(XML_NULLABLE, "" + navigationProperty.isNullable()); } if (navigationProperty.getPartner() != null) { EdmNavigationProperty partner = navigationProperty.getPartner(); - writer.writeAttribute("Partner", partner.getName()); + writer.writeAttribute(XML_PARTNER, partner.getName()); } + + if (navigationProperty.getReferentialConstraints() != null) { + for (EdmReferentialConstraint constraint : navigationProperty.getReferentialConstraints()) { + writer.writeEmptyElement("ReferentialConstraint"); + writer.writeAttribute(XML_PROPERTY, constraint.getPropertyName()); + writer.writeAttribute("ReferencedProperty", constraint.getReferencedPropertyName()); + } + } + + writer.writeEndElement(); } } @@ -320,33 +442,33 @@ public class MetadataDocumentXmlSerializer { } for (String propertyName : propertyNames) { EdmProperty property = type.getStructuralProperty(propertyName); - writer.writeEmptyElement("Property"); - writer.writeAttribute("Name", propertyName); - writer.writeAttribute("Type", getFullQualifiedName(property.getType(), property.isCollection())); + writer.writeEmptyElement(XML_PROPERTY); + writer.writeAttribute(XML_NAME, propertyName); + writer.writeAttribute(XML_TYPE, getFullQualifiedName(property.getType(), property.isCollection())); // Facets if (property.isNullable() != null) { - writer.writeAttribute("Nullable", "" + property.isNullable()); + writer.writeAttribute(XML_NULLABLE, "" + property.isNullable()); } if (property.isUnicode() != null) { - writer.writeAttribute("Unicode", "" + property.isUnicode()); + writer.writeAttribute(XML_UNICODE, "" + property.isUnicode()); } if (property.getDefaultValue() != null) { - writer.writeAttribute("DefaultValue", property.getDefaultValue()); + writer.writeAttribute(XML_DEFAULT_VALUE, property.getDefaultValue()); } if (property.getMaxLength() != null) { - writer.writeAttribute("MaxLength", "" + property.getMaxLength()); + writer.writeAttribute(XML_MAX_LENGTH, "" + property.getMaxLength()); } if (property.getPrecision() != null) { - writer.writeAttribute("Precision", "" + property.getPrecision()); + writer.writeAttribute(XML_PRECISION, "" + property.getPrecision()); } if (property.getScale() != null) { - writer.writeAttribute("Scale", "" + property.getScale()); + writer.writeAttribute(XML_SCALE, "" + property.getScale()); } } } @@ -354,19 +476,25 @@ public class MetadataDocumentXmlSerializer { private void appendKey(final XMLStreamWriter writer, final EdmEntityType entityType) throws XMLStreamException { List keyPropertyRefs = entityType.getKeyPropertyRefs(); if (keyPropertyRefs != null && !keyPropertyRefs.isEmpty()) { - writer.writeStartElement("Key"); + // Resolve Base Type key as it is shown in derived type + EdmEntityType baseType = entityType.getBaseType(); + if (baseType != null && baseType.getKeyPropertyRefs() != null && !(baseType.getKeyPropertyRefs().isEmpty())) { + return; + } + + writer.writeStartElement(XML_KEY); for (EdmKeyPropertyRef keyRef : keyPropertyRefs) { - writer.writeEmptyElement("PropertyRef"); + writer.writeEmptyElement(XML_PROPERTY_REF); String keyName = null; if (keyRef.getPath() != null) { keyName = keyRef.getPath() + "/" + keyRef.getKeyPropertyName(); } else { keyName = keyRef.getKeyPropertyName(); } - writer.writeAttribute("Name", keyName); + writer.writeAttribute(XML_NAME, keyName); if (keyRef.getAlias() != null) { - writer.writeAttribute("Alias", keyRef.getAlias()); + writer.writeAttribute(XML_ALIAS, keyRef.getAlias()); } } writer.writeEndElement(); @@ -376,15 +504,15 @@ public class MetadataDocumentXmlSerializer { private void appendEnumTypes(final XMLStreamWriter writer, final List enumTypes) throws XMLStreamException { for (EdmEnumType enumType : enumTypes) { - writer.writeStartElement("EnumType"); - writer.writeAttribute("Name", enumType.getName()); - writer.writeAttribute("isFlags", "" + enumType.isFlags()); - writer.writeAttribute("UnderlyingType", getFullQualifiedName(enumType.getUnderlyingType(), false)); + writer.writeStartElement(XML_ENUM_TYPE); + writer.writeAttribute(XML_NAME, enumType.getName()); + writer.writeAttribute(XML_IS_FLAGS, "" + enumType.isFlags()); + writer.writeAttribute(XML_UNDERLYING_TYPE, getFullQualifiedName(enumType.getUnderlyingType(), false)); for (String memberName : enumType.getMemberNames()) { - writer.writeEmptyElement("Member"); - writer.writeAttribute("Name", memberName); - writer.writeAttribute("Value", enumType.getMember(memberName).getValue()); + writer.writeEmptyElement(XML_MEMBER); + writer.writeAttribute(XML_NAME, memberName); + writer.writeAttribute(XML_VALUE, enumType.getMember(memberName).getValue()); } writer.writeEndElement(); @@ -405,10 +533,9 @@ public class MetadataDocumentXmlSerializer { writer.writeAttribute("Uri", "http://docs.oasis-open.org/odata/odata/v4.0/cs02/vocabularies/Org.OData.Core.V1.xml"); writer.writeEmptyElement(NS_EDMX, "Include"); // TODO: Where is this value comming from? - writer.writeAttribute("Namespace", "Org.OData.Core.V1"); + writer.writeAttribute(XML_NAMESPACE, "Org.OData.Core.V1"); // TODO: Where is this value comming from? - writer.writeAttribute("Alias", "Core"); + writer.writeAttribute(XML_ALIAS, "Core"); writer.writeEndElement(); } - } diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java index 40868df51..88f84ec55 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java @@ -41,7 +41,7 @@ public class MetadataDocumentTest { } @Test - public void writeMetadataWithMockedEdm() { + public void writeMetadataWithEmptyMockedEdm() { ODataSerializer serializer = ODataServer.newInstance().getSerializer(ODataFormat.XML); Edm edm = mock(Edm.class); serializer.metadataDocument(edm); @@ -52,7 +52,7 @@ public class MetadataDocumentTest { ODataSerializer serializer = ODataServer.newInstance().getSerializer(ODataFormat.XML); EdmProviderImpl edm = new EdmProviderImpl(new EdmTechProvider()); InputStream metadata = serializer.metadataDocument(edm); - System.out.println(StringUtils.inputStreamToString(metadata, true)); + String metadataString = StringUtils.inputStreamToString(metadata, false); + //System.out.println(metadataString); } - } diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java index f3cc85ca3..8e6fc1f4e 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java @@ -42,7 +42,7 @@ public class EdmTechTestProvider extends EdmTechProvider { private static final FullQualifiedName nameInt16 = EdmPrimitiveTypeKind.Int16.getFullQualifiedName(); public static final String nameSpace = "com.sap.odata.test1"; public static final FullQualifiedName nameContainer = new FullQualifiedName(nameSpace, "Container"); - + Property propertyAInt16 = new Property().setName("a").setType(nameInt16); Property propertyBInt16 = new Property().setName("b").setType(nameInt16); Property propertyCInt16 = new Property().setName("c").setType(nameInt16); @@ -70,7 +70,7 @@ public class EdmTechTestProvider extends EdmTechProvider { @Override public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String name) throws ODataException { - if (entityContainer == nameContainer) { + if (nameContainer.equals(entityContainer)) { if (name.equals("ESabc")) { return new EntitySet() .setName("ESabc") diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java index 3ddc6d956..ef3cb19b2 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java @@ -29,7 +29,7 @@ import org.apache.olingo.server.api.edm.provider.ReturnType; public class ActionProvider { - //Bound Actions + // Bound Actions public static final FullQualifiedName nameBAESAllPrimRTETAllPrim = new FullQualifiedName(SchemaProvider.nameSpace, "BAESAllPrimRTETAllPrim"); @@ -45,18 +45,22 @@ public class ActionProvider { public static final FullQualifiedName nameBAETTwoKeyNavRTETTwoKeyNav = new FullQualifiedName(SchemaProvider.nameSpace, "BAETTwoKeyNavRTETTwoKeyNav"); - - //Unbound Actions - public static final FullQualifiedName nameUARTCompCollParam = new FullQualifiedName(SchemaProvider.nameSpace, "UARTCompCollParam"); - public static final FullQualifiedName nameUARTCompParam = new FullQualifiedName(SchemaProvider.nameSpace, "UARTCompParam"); - public static final FullQualifiedName nameUARTETCollAllPrimParam = - new FullQualifiedName(SchemaProvider.nameSpace, "UARTETCollAllPrimParam"); + // Unbound Actions + public static final FullQualifiedName nameUARTCompCollParam = new FullQualifiedName(SchemaProvider.nameSpace, + "UARTCompCollParam"); + public static final FullQualifiedName nameUARTCompParam = new FullQualifiedName(SchemaProvider.nameSpace, + "UARTCompParam"); + public static final FullQualifiedName nameUARTESParam = + new FullQualifiedName(SchemaProvider.nameSpace, "UARTESParam"); - public static final FullQualifiedName nameUARTETParam = new FullQualifiedName(SchemaProvider.nameSpace, "UARTETParam"); - public static final FullQualifiedName nameUARTPrimParam = new FullQualifiedName(SchemaProvider.nameSpace, "UARTPrimParam"); - public static final FullQualifiedName nameUARTPrimCollParam = new FullQualifiedName(SchemaProvider.nameSpace, "UARTPrimCollParam"); - + public static final FullQualifiedName nameUARTETParam = + new FullQualifiedName(SchemaProvider.nameSpace, "UARTETParam"); + public static final FullQualifiedName nameUARTPrimParam = new FullQualifiedName(SchemaProvider.nameSpace, + "UARTPrimParam"); + public static final FullQualifiedName nameUARTPrimCollParam = new FullQualifiedName(SchemaProvider.nameSpace, + "UARTPrimCollParam"); + public List getActions(final FullQualifiedName actionName) throws ODataException { if (actionName.equals(nameUARTPrimParam)) { return Arrays.asList( @@ -99,35 +103,36 @@ public class ActionProvider { } else if (actionName.equals(nameUARTETParam)) { return Arrays.asList( - new Action().setName("UARTCompCollParam") + new Action().setName("UARTETParam") .setParameters(Arrays.asList( new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) .setReturnType( new ReturnType().setType(EntityTypeProvider.nameETTwoKeyTwoPrim)) ); - } else if (actionName.equals(nameUARTETCollAllPrimParam)) { + } else if (actionName.equals(nameUARTESParam)) { return Arrays.asList( - new Action().setName("UARTETCollAllPrimParam") + new Action().setName("UARTESParam") .setParameters(Arrays.asList( new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) - .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETCollAllPrim).setCollection(true)) + new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setCollection(true)) ); } else if (actionName.equals(nameBAETTwoKeyNavRTETTwoKeyNav)) { return Arrays.asList( new Action().setName("BAETTwoKeyNavRTETTwoKeyNav") .setParameters(Arrays.asList( - new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav))) + new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav) + .setNullable(false))) .setBound(true) .setReturnType( new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav)) , new Action().setName("BAETTwoKeyNavRTETTwoKeyNav") .setParameters(Arrays.asList( - new Parameter().setName("ParameterETKeyNav").setType(EntityTypeProvider.nameETKeyNav))) + new Parameter().setName("ParameterETKeyNav").setType(EntityTypeProvider.nameETKeyNav) + .setNullable(false))) .setBound(true) .setReturnType( new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav)) @@ -136,8 +141,10 @@ public class ActionProvider { } else if (actionName.equals(nameBAESAllPrimRTETAllPrim)) { return Arrays.asList( new Action().setName("BAESAllPrimRTETAllPrim") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterESAllPrim").setType(EntityTypeProvider.nameETAllPrim).setCollection(true))) + .setParameters( + Arrays.asList( + new Parameter().setName("ParameterESAllPrim").setType(EntityTypeProvider.nameETAllPrim) + .setCollection(true).setNullable(false))) .setBound(true) .setReturnType( new ReturnType().setType(EntityTypeProvider.nameETAllPrim)) @@ -146,8 +153,10 @@ public class ActionProvider { } else if (actionName.equals(nameBAESTwoKeyNavRTESTwoKeyNav)) { return Arrays.asList( new Action().setName("BAESTwoKeyNavRTESTwoKeyNav") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true))) + .setParameters( + Arrays.asList( + new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav) + .setCollection(true).setNullable(false))) .setBound(true) .setReturnType( new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)) @@ -157,7 +166,8 @@ public class ActionProvider { return Arrays.asList( new Action().setName("BAETBaseTwoKeyNavRTETBaseTwoKeyNav") .setParameters(Arrays.asList( - new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETBaseTwoKeyNav))) + new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETBaseTwoKeyNav) + .setNullable(false))) .setBound(true) .setReturnType( new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav)) @@ -166,8 +176,10 @@ public class ActionProvider { } else if (actionName.equals(nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav)) { return Arrays.asList( new Action().setName("BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav") - .setParameters(Arrays.asList( - new Parameter().setName("ParameterETTwoBaseTwoKeyNav").setType(EntityTypeProvider.nameETTwoBaseTwoKeyNav))) + .setParameters( + Arrays.asList( + new Parameter().setName("ParameterETTwoBaseTwoKeyNav").setType( + EntityTypeProvider.nameETTwoBaseTwoKeyNav).setNullable(false))) .setBound(true) .setReturnType( new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav)) diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java index 3eaf86fe2..2fcbec233 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java @@ -30,14 +30,19 @@ public class ComplexTypeProvider { public static final FullQualifiedName nameCTAllPrim = new FullQualifiedName(SchemaProvider.nameSpace, "CTAllPrim"); public static final FullQualifiedName nameCTBase = new FullQualifiedName(SchemaProvider.nameSpace, "CTBase"); - public static final FullQualifiedName nameCTBasePrimCompNav = new FullQualifiedName(SchemaProvider.nameSpace, "CTBasePrimCompNav"); - public static final FullQualifiedName nameCTCollAllPrim = new FullQualifiedName(SchemaProvider.nameSpace, "CTCollAllPrim"); - public static final FullQualifiedName nameCTCompCollComp = new FullQualifiedName(SchemaProvider.nameSpace, "CTCompCollComp"); + public static final FullQualifiedName nameCTBasePrimCompNav = new FullQualifiedName(SchemaProvider.nameSpace, + "CTBasePrimCompNav"); + public static final FullQualifiedName nameCTCollAllPrim = new FullQualifiedName(SchemaProvider.nameSpace, + "CTCollAllPrim"); + public static final FullQualifiedName nameCTCompCollComp = new FullQualifiedName(SchemaProvider.nameSpace, + "CTCompCollComp"); public static final FullQualifiedName nameCTCompComp = new FullQualifiedName(SchemaProvider.nameSpace, "CTCompComp"); public static final FullQualifiedName nameCTCompNav = new FullQualifiedName(SchemaProvider.nameSpace, "CTCompNav"); - public static final FullQualifiedName nameCTMixPrimCollComp = new FullQualifiedName(SchemaProvider.nameSpace, "CTMixPrimCollComp"); - public static final FullQualifiedName nameCTNavFiveProp = new FullQualifiedName(SchemaProvider.nameSpace, "CTNavFiveProp"); + public static final FullQualifiedName nameCTMixPrimCollComp = new FullQualifiedName(SchemaProvider.nameSpace, + "CTMixPrimCollComp"); + public static final FullQualifiedName nameCTNavFiveProp = new FullQualifiedName(SchemaProvider.nameSpace, + "CTNavFiveProp"); public static final FullQualifiedName nameCTPrim = new FullQualifiedName(SchemaProvider.nameSpace, "CTPrim"); public static final FullQualifiedName nameCTPrimComp = new FullQualifiedName(SchemaProvider.nameSpace, "CTPrimComp"); public static final FullQualifiedName nameCTPrimEnum = new FullQualifiedName(SchemaProvider.nameSpace, "CTPrimEnum"); @@ -88,7 +93,8 @@ public class ComplexTypeProvider { } else if (complexTypeName.equals(nameCTCompNav)) { return new ComplexType() .setName("CTCompNav") - .setProperties(Arrays.asList(PropertyProvider.propertyInt16, PropertyProvider.propertyComplex_CTNavFiveProp)); + .setProperties(Arrays.asList(PropertyProvider.propertyString, + PropertyProvider.propertyComplex_CTNavFiveProp)); } else if (complexTypeName.equals(nameCTMixPrimCollComp)) { return new ComplexType() @@ -112,7 +118,7 @@ public class ComplexTypeProvider { .setBaseType(nameCTBase) .setProperties(Arrays.asList( new Property() - .setName("AdditionalPropString") + .setName("AdditionalPropString2") .setType(new FullQualifiedName("Edm", "String")))); } else if (complexTypeName.equals(nameCTCompComp)) { @@ -122,7 +128,7 @@ public class ComplexTypeProvider { } else if (complexTypeName.equals(nameCTCompCollComp)) { return new ComplexType() - .setName("CTCompComp") + .setName("CTCompCollComp") .setProperties(Arrays.asList(PropertyProvider.collPropertyComplex_CTTwoPrim)); } else if (complexTypeName.equals(nameCTPrimComp)) { @@ -151,7 +157,9 @@ public class ComplexTypeProvider { .setBaseType(nameCTPrimComp) .setNavigationProperties(Arrays.asList( PropertyProvider.collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav, - PropertyProvider.collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav)); + PropertyProvider.collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav, + PropertyProvider.navPropertyETKeyNavOne_ETKeyNav, + PropertyProvider.collectionNavPropertyETKeyNavMany_ETKeyNav)); } else if (complexTypeName.equals(nameCTPrimEnum)) { return new ComplexType() diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java index 62b11e23c..5b923177a 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java @@ -211,7 +211,7 @@ public class ContainerProvider { } else if (name.equals("AIRTETCollAllPrimParam")) { return new ActionImport() .setName("AIRTETCollAllPrimParam") - .setAction(ActionProvider.nameUARTETCollAllPrimParam); + .setAction(ActionProvider.nameUARTESParam); } } diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java index 45a35c8ef..93e9c9dbf 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java @@ -71,54 +71,66 @@ public class EdmTechProvider extends EdmProvider { ); } + @Override public EnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException { return enumTypeProvider.getEnumType(enumTypeName); } + @Override public TypeDefinition getTypeDefinition(final FullQualifiedName typeDefinitionName) throws ODataException { return typeDefinitionProvider.getTypeDefinition(typeDefinitionName); } + @Override public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException { return entityTypeProvider.getEntityType(entityTypeName); } + @Override public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException { return complexTypeProvider.getComplexType(complexTypeName); } + @Override public List getActions(final FullQualifiedName actionName) throws ODataException { return actionProvider.getActions(actionName); } + @Override public List getFunctions(final FullQualifiedName functionName) throws ODataException { return functionProvider.getFunctions(functionName); } + @Override public Term getTerm(final FullQualifiedName termName) throws ODataException { return null; } + @Override public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName) throws ODataException { return containerProvider.getEntitySet(entityContainer, entitySetName); } + @Override public Singleton getSingleton(final FullQualifiedName entityContainer, final String singletonName) throws ODataException { return containerProvider.getSingleton(entityContainer, singletonName); } + @Override public ActionImport getActionImport(final FullQualifiedName entityContainer, final String actionImportName) throws ODataException { return containerProvider.getActionImport(entityContainer, actionImportName); } + @Override public FunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String functionImportName) throws ODataException { return containerProvider.getFunctionImport(entityContainer, functionImportName); } + @Override public List getSchemas() throws ODataException { return schemaProvider.getSchemas(); } diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java index fd93d5dda..291d893de 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EntityTypeProvider.java @@ -31,25 +31,35 @@ import org.apache.olingo.server.api.edm.provider.ReferentialConstraint; public class EntityTypeProvider { public static final FullQualifiedName nameETAllKey = new FullQualifiedName(SchemaProvider.nameSpace, "ETAllKey"); - public static final FullQualifiedName nameETAllNullable = new FullQualifiedName(SchemaProvider.nameSpace, "ETAllNullable"); + public static final FullQualifiedName nameETAllNullable = new FullQualifiedName(SchemaProvider.nameSpace, + "ETAllNullable"); public static final FullQualifiedName nameETAllPrim = new FullQualifiedName(SchemaProvider.nameSpace, "ETAllPrim"); public static final FullQualifiedName nameETBase = new FullQualifiedName(SchemaProvider.nameSpace, "ETBase"); - public static final FullQualifiedName nameETBaseTwoKeyNav = new FullQualifiedName(SchemaProvider.nameSpace, "ETBaseTwoKeyNav"); + public static final FullQualifiedName nameETBaseTwoKeyNav = new FullQualifiedName(SchemaProvider.nameSpace, + "ETBaseTwoKeyNav"); public static final FullQualifiedName nameETBaseTwoKeyTwoPrim = new FullQualifiedName(SchemaProvider.nameSpace, "ETBaseTwoKeyTwoPrim"); - public static final FullQualifiedName nameETCollAllPrim = new FullQualifiedName(SchemaProvider.nameSpace, "ETCollAllPrim"); - public static final FullQualifiedName nameETCompAllPrim = new FullQualifiedName(SchemaProvider.nameSpace, "ETCompAllPrim"); - public static final FullQualifiedName nameETCompCollAllPrim = new FullQualifiedName(SchemaProvider.nameSpace, "ETCompCollAllPrim"); - public static final FullQualifiedName nameETCompCollComp = new FullQualifiedName(SchemaProvider.nameSpace, "ETCompCollComp"); + public static final FullQualifiedName nameETCollAllPrim = new FullQualifiedName(SchemaProvider.nameSpace, + "ETCollAllPrim"); + public static final FullQualifiedName nameETCompAllPrim = new FullQualifiedName(SchemaProvider.nameSpace, + "ETCompAllPrim"); + public static final FullQualifiedName nameETCompCollAllPrim = new FullQualifiedName(SchemaProvider.nameSpace, + "ETCompCollAllPrim"); + public static final FullQualifiedName nameETCompCollComp = new FullQualifiedName(SchemaProvider.nameSpace, + "ETCompCollComp"); public static final FullQualifiedName nameETCompComp = new FullQualifiedName(SchemaProvider.nameSpace, "ETCompComp"); public static final FullQualifiedName nameETCompMixPrimCollComp = new FullQualifiedName(SchemaProvider.nameSpace, "ETCompMixPrimCollComp"); - public static final FullQualifiedName nameETFourKeyAlias = new FullQualifiedName(SchemaProvider.nameSpace, "ETFourKeyAlias"); + public static final FullQualifiedName nameETFourKeyAlias = new FullQualifiedName(SchemaProvider.nameSpace, + "ETFourKeyAlias"); public static final FullQualifiedName nameETKeyNav = new FullQualifiedName(SchemaProvider.nameSpace, "ETKeyNav"); - public static final FullQualifiedName nameETKeyPrimNav = new FullQualifiedName(SchemaProvider.nameSpace, "ETKeyPrimNav"); - public static final FullQualifiedName nameETKeyTwoKeyComp = new FullQualifiedName(SchemaProvider.nameSpace, "ETKeyTwoKeyComp"); + public static final FullQualifiedName nameETKeyPrimNav = new FullQualifiedName(SchemaProvider.nameSpace, + "ETKeyPrimNav"); + public static final FullQualifiedName nameETKeyTwoKeyComp = new FullQualifiedName(SchemaProvider.nameSpace, + "ETKeyTwoKeyComp"); public static final FullQualifiedName nameETMedia = new FullQualifiedName(SchemaProvider.nameSpace, "ETMedia"); - public static final FullQualifiedName nameETMixPrimCollComp = new FullQualifiedName(SchemaProvider.nameSpace, "ETMixPrimCollComp"); + public static final FullQualifiedName nameETMixPrimCollComp = new FullQualifiedName(SchemaProvider.nameSpace, + "ETMixPrimCollComp"); public static final FullQualifiedName nameETServerSidePaging = new FullQualifiedName(SchemaProvider.nameSpace, "ETServerSidePaging"); public static final FullQualifiedName nameETTwoBase = new FullQualifiedName(SchemaProvider.nameSpace, "ETTwoBase"); @@ -57,8 +67,10 @@ public class EntityTypeProvider { new FullQualifiedName(SchemaProvider.nameSpace, "ETTwoBaseTwoKeyNav"); public static final FullQualifiedName nameETTwoBaseTwoKeyTwoPrim = new FullQualifiedName(SchemaProvider.nameSpace, "ETTwoBaseTwoKeyTwoPrim"); - public static final FullQualifiedName nameETTwoKeyNav = new FullQualifiedName(SchemaProvider.nameSpace, "ETTwoKeyNav"); - public static final FullQualifiedName nameETTwoKeyTwoPrim = new FullQualifiedName(SchemaProvider.nameSpace, "ETTwoKeyTwoPrim"); + public static final FullQualifiedName nameETTwoKeyNav = + new FullQualifiedName(SchemaProvider.nameSpace, "ETTwoKeyNav"); + public static final FullQualifiedName nameETTwoKeyTwoPrim = new FullQualifiedName(SchemaProvider.nameSpace, + "ETTwoKeyTwoPrim"); public static final FullQualifiedName nameETTwoPrim = new FullQualifiedName(SchemaProvider.nameSpace, "ETTwoPrim"); public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException { @@ -74,7 +86,9 @@ public class EntityTypeProvider { PropertyProvider.propertySingle, PropertyProvider.propertyDouble, PropertyProvider.propertyDecimal, PropertyProvider.propertyBinary, PropertyProvider.propertyDate, PropertyProvider.propertyDateTimeOffset, PropertyProvider.propertyDuration, PropertyProvider.propertyGuid, PropertyProvider.propertyTimeOfDay - /* TODO add propertyStream */)); + /* TODO add propertyStream */)) + .setNavigationProperties(Arrays.asList(PropertyProvider.navPropertyETTwoPrimOne_ETTwoPrim, + PropertyProvider.collectionNavPropertyETTwoPrimMany_ETTwoPrim)); } else if (entityTypeName.equals(nameETCollAllPrim)) { return new EntityType() @@ -98,7 +112,10 @@ public class EntityTypeProvider { .setName("ETTwoPrim") .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) .setProperties(Arrays.asList( - PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString)); + PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString)) + .setNavigationProperties( + Arrays.asList(PropertyProvider.navPropertyETAllPrimOne_ETAllPrim, + PropertyProvider.collectionNavPropertyETAllPrimMany_ETAllPrim)); } else if (entityTypeName.equals(nameETMixPrimCollComp)) { return new EntityType() @@ -163,14 +180,14 @@ public class EntityTypeProvider { new PropertyRef().setPropertyName("PropertyTimeOfDay"))) .setProperties( Arrays.asList( - PropertyProvider.propertyString, PropertyProvider.propertyBoolean, - PropertyProvider.propertyByte, PropertyProvider.propertySByte, - PropertyProvider.propertyInt16, PropertyProvider.propertyInt32, PropertyProvider.propertyInt64, - PropertyProvider.propertyDecimal, PropertyProvider.propertyDate, - PropertyProvider.propertySingle, PropertyProvider.propertyDouble, - PropertyProvider.propertyDateTimeOffset, - PropertyProvider.propertyDuration, PropertyProvider.propertyGuid, - PropertyProvider.propertyTimeOfDay /* TODO add propertyStream */)); + PropertyProvider.propertyString_NotNullable, PropertyProvider.propertyBoolean_NotNullable, + PropertyProvider.propertyByte_NotNullable, PropertyProvider.propertySByte_NotNullable, + PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyInt32_NotNullable, + PropertyProvider.propertyInt64_NotNullable, + PropertyProvider.propertyDecimal_NotNullable, PropertyProvider.propertyDate_NotNullable, + PropertyProvider.propertyDateTimeOffset_NotNullable, + PropertyProvider.propertyDuration_NotNullable, PropertyProvider.propertyGuid_NotNullable, + PropertyProvider.propertyTimeOfDay_NotNullable /* TODO add propertyStream */)); } else if (entityTypeName.equals(nameETCompAllPrim)) { return new EntityType() @@ -181,11 +198,11 @@ public class EntityTypeProvider { } else if (entityTypeName.equals(nameETCompCollAllPrim)) { return new EntityType() - .setName("ETCompAllPrim") + .setName("ETCompCollAllPrim") .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) .setProperties( - Arrays.asList(PropertyProvider.propertyInt16_NotNullable, + Arrays.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComplex_CTCollAllPrim)); } else if (entityTypeName.equals(nameETCompComp)) { @@ -205,7 +222,7 @@ public class EntityTypeProvider { } else if (entityTypeName.equals(nameETMedia)) { return new EntityType() - .setName("ETCompCollComp") + .setName("ETMedia") .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) .setProperties(Arrays.asList(PropertyProvider.propertyInt16_NotNullable)) .setHasStream(true); @@ -232,9 +249,10 @@ public class EntityTypeProvider { } else if (entityTypeName.equals(nameETServerSidePaging)) { return new EntityType() - .setName("ETKeyTwoKeyComp") + .setName(nameETServerSidePaging.getName()) .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) - .setProperties(Arrays.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString)); + .setProperties(Arrays.asList(PropertyProvider.propertyInt16_NotNullable, + PropertyProvider.propertyString_NotNullable)); } else if (entityTypeName.equals(nameETAllNullable)) { return new EntityType() @@ -243,26 +261,32 @@ public class EntityTypeProvider { .setProperties( Arrays.asList( new Property() - .setName("PropertyKey").setType(PropertyProvider.nameInt16), - PropertyProvider.propertyInt16, - PropertyProvider.propertyString, PropertyProvider.propertyBoolean, - PropertyProvider.propertyByte, PropertyProvider.propertySByte, - PropertyProvider.propertyInt32, PropertyProvider.propertyInt64, - PropertyProvider.propertySingle, PropertyProvider.propertyDouble, - PropertyProvider.propertyDecimal, PropertyProvider.propertyBinary, PropertyProvider.propertyDate, - PropertyProvider.propertyDateTimeOffset, - PropertyProvider.propertyDuration, PropertyProvider.propertyGuid, - PropertyProvider.propertyTimeOfDay /* TODO add propertyStream */, - PropertyProvider.collPropertyString, PropertyProvider.collPropertyBoolean, - PropertyProvider.collPropertyByte, PropertyProvider.collPropertySByte, - PropertyProvider.collPropertyInt16, - PropertyProvider.collPropertyInt32, PropertyProvider.collPropertyInt64, - PropertyProvider.collPropertySingle, PropertyProvider.collPropertyDouble, - PropertyProvider.collPropertyDecimal, PropertyProvider.collPropertyBinary, - PropertyProvider.collPropertyDate, - PropertyProvider.collPropertyDateTimeOffset, - PropertyProvider.collPropertyDuration, PropertyProvider.collPropertyGuid, - PropertyProvider.collPropertyTimeOfDay /* TODO add propertyStream */)); + .setName("PropertyKey").setType(PropertyProvider.nameInt16).setNullable(false), + PropertyProvider.propertyInt16_ExplicitNullable, PropertyProvider.propertyString_ExplicitNullable, + PropertyProvider.propertyBoolean_ExplicitNullable, PropertyProvider.propertyByte_ExplicitNullable, + PropertyProvider.propertySByte_ExplicitNullable, PropertyProvider.propertyInt32_ExplicitNullable, + PropertyProvider.propertyInt64_ExplicitNullable, PropertyProvider.propertySingle_ExplicitNullable, + PropertyProvider.propertyDouble_ExplicitNullable, PropertyProvider.propertyDecimal_ExplicitNullable, + PropertyProvider.propertyBinary_ExplicitNullable, PropertyProvider.propertyDate_ExplicitNullable, + PropertyProvider.propertyDateTimeOffset_ExplicitNullable, + PropertyProvider.propertyDuration_ExplicitNullable, PropertyProvider.propertyGuid_ExplicitNullable, + PropertyProvider.propertyTimeOfDay_ExplicitNullable /* TODO add propertyStream */, + PropertyProvider.collPropertyString_ExplicitNullable, + PropertyProvider.collPropertyBoolean_ExplicitNullable, + PropertyProvider.collPropertyByte_ExplicitNullable, + PropertyProvider.collPropertySByte_ExplicitNullable, + PropertyProvider.collPropertyInt16_ExplicitNullable, + PropertyProvider.collPropertyInt32_ExplicitNullable, + PropertyProvider.collPropertyInt64_ExplicitNullable, + PropertyProvider.collPropertySingle_ExplicitNullable, + PropertyProvider.collPropertyDouble_ExplicitNullable, + PropertyProvider.collPropertyDecimal_ExplicitNullable, + PropertyProvider.collPropertyBinary_ExplicitNullable, + PropertyProvider.collPropertyDate_ExplicitNullable, + PropertyProvider.collPropertyDateTimeOffset_ExplicitNullable, + PropertyProvider.collPropertyDuration_ExplicitNullable, + PropertyProvider.collPropertyGuid_ExplicitNullable, + PropertyProvider.collPropertyTimeOfDay_ExplicitNullable /* TODO add propertyStream */)); } else if (entityTypeName.equals(nameETKeyNav)) { return new EntityType() @@ -280,7 +304,7 @@ public class EntityTypeProvider { )) .setNavigationProperties( Arrays.asList( - PropertyProvider.navPropertyETTwoKeyNavOne_ETTwoKeyNav, + PropertyProvider.navPropertyETTwoKeyNavOne_ETTwoKeyNav_NotNullable, PropertyProvider.collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav, PropertyProvider.navPropertyETKeyNavOne_ETKeyNav, PropertyProvider.collectionNavPropertyETKeyNavMany_ETKeyNav, @@ -289,19 +313,13 @@ public class EntityTypeProvider { )); } else if (entityTypeName.equals(nameETKeyPrimNav)) { return new EntityType() - .setName("ETKeyNav") + .setName("ETKeyPrimNav") .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) .setProperties(Arrays.asList( - PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString_NotNullable)) + PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString_ExplicitNullable)) .setNavigationProperties( Arrays.asList( - PropertyProvider.navPropertyETTwoKeyNavOne_ETTwoKeyNav, - PropertyProvider.collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav, - PropertyProvider.navPropertyETKeyNavOne_ETKeyNav, - PropertyProvider.collectionNavPropertyETKeyNavMany_ETKeyNav, - PropertyProvider.navPropertyETMediaOne_ETMedia, - PropertyProvider.collectionNavPropertyETMediaMany_ETMedia - )); + PropertyProvider.navPropertyETKeyPrimNavOne_ETKeyPrimNav)); } else if (entityTypeName.equals(nameETTwoKeyNav)) { return new EntityType() @@ -311,9 +329,10 @@ public class EntityTypeProvider { new PropertyRef().setPropertyName("PropertyString"))) .setProperties( Arrays.asList( - PropertyProvider.propertyInt16, PropertyProvider.propertyString, + PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString_NotNullable, PropertyProvider.propertyComplex_CTPrimComp_NotNullable, - new Property().setName("PropertyComplexNav").setType(ComplexTypeProvider.nameCTBasePrimCompNav), + new Property().setName("PropertyComplexNav").setType(ComplexTypeProvider.nameCTBasePrimCompNav) + .setNullable(false), PropertyProvider.propertyComplexEnum_CTPrimEnum_NotNullable, PropertyProvider.collPropertyComplex_CTPrimComp, new Property().setName("CollPropertyComplexNav").setType(ComplexTypeProvider.nameCTNavFiveProp) @@ -337,26 +356,22 @@ public class EntityTypeProvider { return new EntityType() .setName("ETBaseTwoKeyNav") .setBaseType(nameETTwoKeyNav) - .setProperties(Arrays.asList(PropertyProvider.propertyDate)) + .setProperties(Arrays.asList(PropertyProvider.propertyDate_ExplicitNullable)) .setNavigationProperties(Arrays.asList( new NavigationProperty() - .setName("NavPropertyETBaseTwoKeyNav") + .setName("NavPropertyETBaseTwoKeyNavOne") .setType(nameETBaseTwoKeyNav), new NavigationProperty() - .setName("NavPropertyETTwoBaseTwoKeyNav") - .setType(nameETTwoBaseTwoKeyNav))) - .setHasStream(true); + .setName("NavPropertyETTwoBaseTwoKeyNavOne") + .setType(nameETTwoBaseTwoKeyNav))); } else if (entityTypeName.equals(nameETTwoBaseTwoKeyNav)) { return new EntityType() .setName("ETTwoBaseTwoKeyNav") .setBaseType(nameETBaseTwoKeyNav) .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16"))) - .setProperties(Arrays.asList(PropertyProvider.propertyGuid)) + .setProperties(Arrays.asList(PropertyProvider.propertyGuid_ExplicitNullable)) .setNavigationProperties(Arrays.asList( - new NavigationProperty() - .setName("NavPropertyETBaseTwoKeyNavOne") - .setType(nameETBaseTwoKeyNav), new NavigationProperty() .setName("NavPropertyETBaseTwoKeyNavMany") .setType(nameETBaseTwoKeyNav) @@ -377,7 +392,7 @@ public class EntityTypeProvider { .setPropertyName("PropertyComplexComplex/PropertyComplex/PropertyString") .setAlias("KeyAlias3"))) .setProperties( - Arrays.asList(PropertyProvider.propertyGuid, PropertyProvider.propertyComplex_CTTwoPrim, + Arrays.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComplex_CTTwoPrim, PropertyProvider.propertyComplexComplex_CTCompComp)); } else if (entityTypeName.equals(nameETCompMixPrimCollComp)) { return new EntityType() diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java index 0640a99f4..e843955ac 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/EnumTypeProvider.java @@ -22,6 +22,7 @@ import java.util.Arrays; import org.apache.olingo.commons.api.ODataException; import org.apache.olingo.commons.api.edm.FullQualifiedName; +import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeKind; import org.apache.olingo.server.api.edm.provider.EnumMember; import org.apache.olingo.server.api.edm.provider.EnumType; @@ -33,6 +34,8 @@ public class EnumTypeProvider { if (enumTypeName.equals(nameENString)) { return new EnumType() .setName("ENString") + .setFlags(true) + .setUnderlyingType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName()) .setMembers(Arrays.asList( new EnumMember().setName("String1").setValue("1"), new EnumMember().setName("String2").setValue("2"), diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java index f9e15ecba..fe6fefbec 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/FunctionProvider.java @@ -112,21 +112,19 @@ public class FunctionProvider { public static final FullQualifiedName nameBFESTwoKeyNavRTESTwoKeyNav = new FullQualifiedName(SchemaProvider.nameSpace, "BFESTwoKeyNavRTESTwoKeyNav"); - // TODO: warum BAET? - public static final FullQualifiedName nameBAETTwoKeyNavRTETTwoKeyNav = - new FullQualifiedName(SchemaProvider.nameSpace, "BAETTwoKeyNavRTETTwoKeyNav"); - // Unbound Functions public static final FullQualifiedName nameUFCRTCollCTTwoPrim = new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTCollCTTwoPrim"); public static final FullQualifiedName nameUFCRTCollCTTwoPrimParam = new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTCollCTTwoPrimParam"); - public static final FullQualifiedName nameUFCRTCollString = new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTCollString"); + public static final FullQualifiedName nameUFCRTCollString = new FullQualifiedName(SchemaProvider.nameSpace, + "UFCRTCollString"); public static final FullQualifiedName nameUFCRTCollStringTwoParam = new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTCollStringTwoParam"); public static final FullQualifiedName nameUFCRTCTAllPrimTwoParam = new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTCTAllPrimTwoParam"); - public static final FullQualifiedName nameUFCRTCTTwoPrim = new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTCTTwoPrim"); + public static final FullQualifiedName nameUFCRTCTTwoPrim = new FullQualifiedName(SchemaProvider.nameSpace, + "UFCRTCTTwoPrim"); public static final FullQualifiedName nameUFCRTCTTwoPrimParam = new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTCTTwoPrimParam"); public static final FullQualifiedName nameUFCRTESMixPrimCollCompTwoParam = @@ -135,8 +133,10 @@ public class FunctionProvider { new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTESTwoKeyNavParam"); public static final FullQualifiedName nameUFCRTETAllPrimTwoParam = new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTETAllPrimTwoParam"); - public static final FullQualifiedName nameUFCRTETKeyNav = new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTETKeyNav"); - public static final FullQualifiedName nameUFCRTETMedia = new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTETMedia"); + public static final FullQualifiedName nameUFCRTETKeyNav = new FullQualifiedName(SchemaProvider.nameSpace, + "UFCRTETKeyNav"); + public static final FullQualifiedName nameUFCRTETMedia = new FullQualifiedName(SchemaProvider.nameSpace, + "UFCRTETMedia"); public static final FullQualifiedName nameUFCRTETTwoKeyNavParam = new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTETTwoKeyNavParam"); @@ -144,7 +144,8 @@ public class FunctionProvider { public static final FullQualifiedName nameUFCRTETTwoKeyNavParamCTTwoPrim = new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTETTwoKeyNavParamCTTwoPrim"); - public static final FullQualifiedName nameUFCRTString = new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTString"); + public static final FullQualifiedName nameUFCRTString = + new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTString"); public static final FullQualifiedName nameUFCRTStringTwoParam = new FullQualifiedName(SchemaProvider.nameSpace, "UFCRTStringTwoParam"); @@ -154,6 +155,15 @@ public class FunctionProvider { public static final FullQualifiedName nameUFNRTInt16 = new FullQualifiedName(SchemaProvider.nameSpace, "UFNRTInt16"); + public static final FullQualifiedName nameUFNRTCollCTNavFiveProp = new FullQualifiedName(SchemaProvider.nameSpace, + "UFNRTCollCTNavFiveProp"); + + public static final FullQualifiedName nameBFCESTwoKeyNavRTCTNavFiveProp = new FullQualifiedName( + SchemaProvider.nameSpace, "BFCESTwoKeyNavRTCTNavFiveProp"); + + public static final FullQualifiedName nameBFCESTwoKeyNavRTCollCTNavFiveProp = new FullQualifiedName( + SchemaProvider.nameSpace, "BFCESTwoKeyNavRTCollCTNavFiveProp"); + public List getFunctions(final FullQualifiedName functionName) throws ODataException { if (functionName.equals(nameUFNRTInt16)) { @@ -162,7 +172,7 @@ public class FunctionProvider { .setName("UFNRTInt16") .setParameters(new ArrayList()) .setReturnType( - new ReturnType().setType(PropertyProvider.nameString)) + new ReturnType().setType(PropertyProvider.nameInt16)) ); } else if (functionName.equals(nameUFCRTETKeyNav)) { @@ -172,7 +182,7 @@ public class FunctionProvider { .setParameters(new ArrayList()) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETKeyNav)) + new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setNullable(false)) ); } else if (functionName.equals(nameUFCRTETTwoKeyNavParam)) { @@ -180,10 +190,10 @@ public class FunctionProvider { new Function() .setName("UFCRTETTwoKeyNavParam") .setParameters(Arrays.asList( - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav) + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false) ) ); @@ -192,10 +202,11 @@ public class FunctionProvider { new Function() .setName("UFCRTETTwoKeyNavParamCTTwoPrim") .setParameters(Arrays.asList( - new Parameter().setName("ParameterCTTwoPrim").setType(ComplexTypeProvider.nameCTTwoPrim))) + new Parameter().setName("ParameterCTTwoPrim").setType(ComplexTypeProvider.nameCTTwoPrim) + .setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav) + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false) ) ); @@ -206,22 +217,24 @@ public class FunctionProvider { .setParameters(Arrays.asList( new Parameter() .setName("ParameterInt16") - .setType(PropertyProvider.nameInt16))) + .setType(PropertyProvider.nameInt16) + .setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(PropertyProvider.nameString)), + new ReturnType().setType(PropertyProvider.nameString).setNullable(false)), new Function() .setName("UFCRTStringTwoParam") .setParameters(Arrays.asList( new Parameter() .setName("ParameterString") - .setType(PropertyProvider.nameString), + .setType(PropertyProvider.nameString) + .setNullable(false), new Parameter() .setName("ParameterInt16") - .setType(PropertyProvider.nameInt16))) + .setType(PropertyProvider.nameInt16) + .setNullable(false))) .setComposable(true) - .setReturnType( - new ReturnType().setType(PropertyProvider.nameString)) + .setReturnType(new ReturnType().setType(PropertyProvider.nameString).setNullable(false)) ); @@ -232,10 +245,11 @@ public class FunctionProvider { .setParameters(Arrays.asList( new Parameter() .setName("ParameterInt16") - .setType(PropertyProvider.nameInt16))) + .setType(PropertyProvider.nameInt16) + .setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)) + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false)) ); } else if (functionName.equals(nameUFCRTString)) { @@ -247,7 +261,7 @@ public class FunctionProvider { .setParameters(new ArrayList()) .setComposable(true) .setReturnType( - new ReturnType().setType(PropertyProvider.nameString) + new ReturnType().setType(PropertyProvider.nameString).setNullable(false) ) ); @@ -256,11 +270,11 @@ public class FunctionProvider { new Function() .setName("UFCRTCollStringTwoParam") .setParameters(Arrays.asList( - new Parameter().setName("ParameterString").setType(PropertyProvider.nameString), - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(false), + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(PropertyProvider.nameString).setCollection(true)) + new ReturnType().setType(PropertyProvider.nameString).setCollection(true).setNullable(false)) ); } else if (functionName.equals(nameUFCRTCollString)) { @@ -270,7 +284,7 @@ public class FunctionProvider { .setParameters(new ArrayList()) .setComposable(true) .setReturnType( - new ReturnType().setType(PropertyProvider.nameString).setCollection(true)) + new ReturnType().setType(PropertyProvider.nameString).setCollection(true).setNullable(false)) ); } else if (functionName.equals(nameUFCRTCTAllPrimTwoParam)) { @@ -278,11 +292,11 @@ public class FunctionProvider { new Function() .setName("UFCRTCTAllPrimTwoParam") .setParameters(Arrays.asList( - new Parameter().setName("ParameterString").setType(PropertyProvider.nameString), - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(false), + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(ComplexTypeProvider.nameCTAllPrim)) + new ReturnType().setType(ComplexTypeProvider.nameCTAllPrim).setNullable(false)) ); } else if (functionName.equals(nameUFCRTCTTwoPrimParam)) { @@ -290,22 +304,22 @@ public class FunctionProvider { new Function() .setName("UFCRTCTTwoPrimParam") .setParameters(Arrays.asList( - new Parameter().setName("ParameterString").setType(PropertyProvider.nameString), - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false), + new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(true))) .setComposable(true) .setReturnType( - new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim)) + new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false)) ); } else if (functionName.equals(nameUFCRTCollCTTwoPrimParam)) { return Arrays.asList( new Function() .setName("UFCRTCollCTTwoPrimParam") .setParameters(Arrays.asList( - new Parameter().setName("ParameterString").setType(PropertyProvider.nameString), - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false), + new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(true))) .setComposable(true) .setReturnType( - new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true)) + new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true).setNullable(false)) ); } else if (functionName.equals(nameUFCRTCTTwoPrim)) { @@ -315,36 +329,7 @@ public class FunctionProvider { .setParameters(new ArrayList()) .setComposable(true) .setReturnType( - new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim)) - ); - - } else if (functionName.equals(nameUFCRTCollCTTwoPrim)) { - return Arrays.asList( - new Function() - .setName("UFCRTCTTwoPrim") - - .setParameters(new ArrayList()) - .setReturnType( - new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true)) - ); - - } else if (functionName.equals(nameUFCRTETMedia)) { - return Arrays.asList( - new Function() - .setName("UFCRTETMedia") - .setParameters(new ArrayList()) - .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETMedia)) - ); - - } else if (functionName.equals(nameUFCRTString)) { - return Arrays.asList( - new Function() - .setName("UFCRTString") - .setParameters(new ArrayList()) - .setReturnType(new ReturnType() - .setType(PropertyProvider.nameString) - ) + new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false)) ); } else if (functionName.equals(nameUFCRTCollCTTwoPrim)) { @@ -354,7 +339,17 @@ public class FunctionProvider { .setComposable(true) .setParameters(new ArrayList()) .setReturnType( - new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true)) + new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true).setNullable(false)) + ); + + } else if (functionName.equals(nameUFCRTETMedia)) { + return Arrays.asList( + new Function() + .setName("UFCRTETMedia") + .setParameters(new ArrayList()) + .setComposable(true) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETMedia).setNullable(false)) ); } else if (functionName.equals(nameUFNRTESMixPrimCollCompTwoParam)) { @@ -362,11 +357,12 @@ public class FunctionProvider { new Function() .setName("UFNRTESMixPrimCollCompTwoParam") .setParameters(Arrays.asList( - new Parameter().setName("ParameterString").setType(PropertyProvider.nameString), - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(false), + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false))) .setComposable(false) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETMixPrimCollComp).setCollection(true)) + new ReturnType().setType(EntityTypeProvider.nameETMixPrimCollComp).setCollection(true) + .setNullable(false)) ); } else if (functionName.equals(nameUFCRTETAllPrimTwoParam)) { @@ -374,11 +370,11 @@ public class FunctionProvider { new Function() .setName("UFCRTETAllPrimTwoParam") .setParameters(Arrays.asList( - new Parameter().setName("ParameterString").setType(PropertyProvider.nameString), - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(false), + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETAllPrim)) + new ReturnType().setType(EntityTypeProvider.nameETAllPrim).setNullable(false)) ); } else if (functionName.equals(nameUFCRTESMixPrimCollCompTwoParam)) { @@ -386,14 +382,22 @@ public class FunctionProvider { new Function() .setName("UFCRTESMixPrimCollCompTwoParam") .setParameters(Arrays.asList( - new Parameter().setName("ParameterString").setType(PropertyProvider.nameString), - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16) + new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(false), + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false) )) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETMixPrimCollComp).setCollection(true)) + new ReturnType().setType(EntityTypeProvider.nameETMixPrimCollComp).setCollection(true) + .setNullable(false)) ); + } else if (functionName.equals(nameUFNRTCollCTNavFiveProp)) { + return Arrays.asList( + new Function() + .setName("UFNRTCollCTNavFiveProp") + .setReturnType( + new ReturnType().setType(ComplexTypeProvider.nameCTNavFiveProp).setCollection(true)) + ); } else if (functionName.equals(nameBFCESTwoKeyNavRTESTwoKeyNav)) { return Arrays .asList( @@ -403,10 +407,11 @@ public class FunctionProvider { .setParameters( Arrays.asList( new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) - .setCollection(true))) + .setCollection(true).setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)), + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true) + .setNullable(false)), new Function() .setName("BFCESTwoKeyNavRTESTwoKeyNav") @@ -414,33 +419,36 @@ public class FunctionProvider { .setParameters( Arrays.asList( new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) - .setCollection(true), + .setCollection(true).setNullable(false), new Parameter().setName("ParameterString").setType(PropertyProvider.nameString) - .setCollection(false))) + .setCollection(false).setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)), + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true) + .setNullable(false)), new Function() .setName("BFCESTwoKeyNavRTESTwoKeyNav") .setBound(true) .setParameters( Arrays.asList( new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav) - .setCollection(true))) + .setCollection(true).setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)), + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true) + .setNullable(false)), new Function() .setName("BFCESTwoKeyNavRTESTwoKeyNav") .setBound(true) .setParameters( Arrays.asList(new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav) - .setCollection(true), + .setCollection(true).setNullable(false), new Parameter().setName("ParameterString").setType(PropertyProvider.nameString) - .setCollection(false))) + .setCollection(false).setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)) + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true) + .setNullable(false)) ); } else if (functionName.equals(nameBFCStringRTESTwoKeyNav)) { @@ -448,10 +456,10 @@ public class FunctionProvider { new Function().setName("BFCStringRTESTwoKeyNav") .setBound(true) .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(PropertyProvider.nameString))) + new Parameter().setName("BindingParam").setType(PropertyProvider.nameString).setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)) + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false)) ); } else if (functionName.equals(nameBFCETBaseTwoKeyNavRTETTwoKeyNav)) { @@ -460,10 +468,11 @@ public class FunctionProvider { .setName("BFCETBaseTwoKeyNavRTETTwoKeyNav") .setBound(true) .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav))) + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav) + .setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav) + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false) ) ); @@ -474,10 +483,11 @@ public class FunctionProvider { .setBound(true) .setParameters(Arrays.asList( new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav) - .setCollection(true))) + .setCollection(true).setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav).setCollection(true)) + new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav).setCollection(true) + .setNullable(false)) ); } else if (functionName.equals(nameBFCESAllPrimRTCTAllPrim)) { @@ -487,11 +497,11 @@ public class FunctionProvider { .setBound(true) .setParameters( Arrays.asList( - new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETAllPrim).setCollection( - true))) + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETAllPrim) + .setCollection(true).setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(ComplexTypeProvider.nameCTAllPrim)) + new ReturnType().setType(ComplexTypeProvider.nameCTAllPrim).setNullable(false)) ); } else if (functionName.equals(nameBFCESTwoKeyNavRTCTTwoPrim)) { @@ -502,10 +512,10 @@ public class FunctionProvider { .setParameters( Arrays.asList( new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) - .setCollection(true))) + .setCollection(true).setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim)) + new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false)) ); } else if (functionName.equals(nameBFCESTwoKeyNavRTCollCTTwoPrim)) { @@ -516,10 +526,10 @@ public class FunctionProvider { .setParameters( Arrays.asList( new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) - .setCollection(true))) + .setCollection(true).setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true)) + new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true).setNullable(false)) ); } else if (functionName.equals(nameBFCESTwoKeyNavRTString)) { @@ -530,10 +540,10 @@ public class FunctionProvider { .setParameters( Arrays.asList( new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) - .setCollection(true))) + .setCollection(true).setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(PropertyProvider.nameString)) + new ReturnType().setType(PropertyProvider.nameString).setNullable(false)) ); } else if (functionName.equals(nameBFCESTwoKeyNavRTCollString)) { @@ -544,10 +554,10 @@ public class FunctionProvider { .setParameters( Arrays.asList( new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) - .setCollection(true))) + .setCollection(true).setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(PropertyProvider.nameString).setCollection(true)) + new ReturnType().setType(PropertyProvider.nameString).setCollection(true).setNullable(false)) ); } else if (functionName.equals(nameBFCETTwoKeyNavRTESTwoKeyNav)) { @@ -556,10 +566,11 @@ public class FunctionProvider { .setName("BFCETTwoKeyNavRTESTwoKeyNav") .setBound(true) .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav))) + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) + .setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)) + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false)) ); } else if (functionName.equals(nameBFCETBaseTwoKeyNavRTESTwoKeyNav)) { @@ -567,11 +578,13 @@ public class FunctionProvider { new Function() .setName("BFCETBaseTwoKeyNavRTESTwoKeyNav") .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav))) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav) + .setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)) + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false)) ); } else if (functionName.equals(nameBFCSINavRTESTwoKeyNav)) { @@ -579,11 +592,13 @@ public class FunctionProvider { new Function() .setName("BFCSINavRTESTwoKeyNav") .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav))) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav).setNullable( + false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)) + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false)) ); } else if (functionName.equals(nameBFCETBaseTwoKeyNavRTESBaseTwoKey)) { @@ -591,11 +606,14 @@ public class FunctionProvider { new Function() .setName("BFCETBaseTwoKeyNavRTESBaseTwoKey") .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav))) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav) + .setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav).setCollection(true)) + new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav).setCollection(true).setNullable( + false)) ); } else if (functionName.equals(nameBFCCollStringRTESTwoKeyNav)) { @@ -603,10 +621,13 @@ public class FunctionProvider { new Function() .setName("BFCCollStringRTESTwoKeyNav") .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(PropertyProvider.nameString).setCollection(true))) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(PropertyProvider.nameString).setCollection(true) + .setNullable(false))) .setComposable(true) - .setReturnType(new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false)) ); } else if (functionName.equals(nameBFCCTPrimCompRTESTwoKeyNav)) { @@ -614,11 +635,13 @@ public class FunctionProvider { new Function() .setName("BFCCTPrimCompRTESTwoKeyNav") .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp))) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp).setNullable( + false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)) + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false)) ); } else if (functionName.equals(nameBFCCTPrimCompRTESBaseTwoKeyNav)) { @@ -626,11 +649,14 @@ public class FunctionProvider { new Function() .setName("BFCCTPrimCompRTESBaseTwoKeyNav") .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp))) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp).setNullable( + false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav).setCollection(true)) + new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav).setCollection(true).setNullable( + false)) ); } else if (functionName.equals(nameBFCCollCTPrimCompRTESAllPrim)) { @@ -641,10 +667,10 @@ public class FunctionProvider { .setParameters( Arrays.asList( new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp) - .setCollection(true))) + .setCollection(true).setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETAllPrim).setCollection(true)) + new ReturnType().setType(EntityTypeProvider.nameETAllPrim).setCollection(true).setNullable(false)) ); } else if (functionName.equals(nameBFCESTwoKeyNavRTTwoKeyNav)) { @@ -655,10 +681,10 @@ public class FunctionProvider { .setParameters( Arrays.asList( new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) - .setCollection(true))) + .setCollection(true).setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav)) + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false)) ); } else if (functionName.equals(nameBFCESKeyNavRTETKeyNav)) { @@ -667,11 +693,13 @@ public class FunctionProvider { new Function() .setName("BFCESKeyNavRTETKeyNav") .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav).setCollection(true))) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav).setCollection( + true).setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETKeyNav)) + new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setNullable(false)) ); } else if (functionName.equals(nameBFCETKeyNavRTETKeyNav)) { @@ -680,10 +708,10 @@ public class FunctionProvider { .setName("BFCETKeyNavRTETKeyNav") .setBound(true) .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav))) + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav).setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETKeyNav)) + new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setNullable(false)) ); } else if (functionName.equals(nameBFESTwoKeyNavRTESTwoKeyNav)) { return Arrays.asList( @@ -693,9 +721,10 @@ public class FunctionProvider { .setParameters( Arrays.asList( new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) - .setCollection(true))) + .setCollection(true).setNullable(false))) .setComposable(true) - .setReturnType(new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false)) ); @@ -704,11 +733,13 @@ public class FunctionProvider { new Function() .setName("BFCETTwoKeyNavRTETTwoKeyNav") .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav))) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav).setNullable( + false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav)) + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false)) ); } else if (functionName.equals(nameBFCETTwoKeyNavRTCTTwoPrim)) { @@ -716,11 +747,40 @@ public class FunctionProvider { new Function() .setName("BFCETTwoKeyNavRTCTTwoPrim") .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav))) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav).setNullable( + false))) .setComposable(true) .setReturnType( - new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim)) + new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false)) + ); + } else if (functionName.equals(nameBFCESTwoKeyNavRTCTNavFiveProp)) { + return Arrays.asList( + new Function() + .setName("BFCESTwoKeyNavRTCTNavFiveProp") + .setBound(true) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) + .setCollection(true).setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(ComplexTypeProvider.nameCTNavFiveProp).setNullable(false)) + ); + } else if (functionName.equals(nameBFCESTwoKeyNavRTCollCTNavFiveProp)) { + return Arrays.asList( + new Function() + .setName("BFCESTwoKeyNavRTCollCTNavFiveProp") + .setBound(true) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) + .setCollection(true).setNullable(false))) + .setComposable(true) + .setReturnType( + new ReturnType().setType(ComplexTypeProvider.nameCTNavFiveProp).setCollection(true) + .setNullable(false)) ); } else if (functionName.equals(nameBFCESTwoKeyNavRTStringParam)) { return Arrays.asList( @@ -730,11 +790,12 @@ public class FunctionProvider { .setParameters( Arrays.asList( new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav) - .setCollection(true), - new Parameter().setName("ParameterComplex").setType(ComplexTypeProvider.nameCTTwoPrim))) + .setCollection(true).setNullable(false), + new Parameter().setName("ParameterComplex").setType(ComplexTypeProvider.nameCTTwoPrim) + .setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(PropertyProvider.nameString)) + new ReturnType().setType(PropertyProvider.nameString).setNullable(false)) ); } else if (functionName.equals(nameBFCESKeyNavRTETKeyNavParam)) { @@ -742,49 +803,46 @@ public class FunctionProvider { new Function() .setName("BFCESKeyNavRTETKeyNavParam") .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav).setCollection(true), - new Parameter().setName("ParameterString").setType(PropertyProvider.nameString))) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav).setCollection( + true).setNullable(false), + new Parameter().setName("ParameterString").setType(PropertyProvider.nameString) + .setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETKeyNav)) + new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setNullable(false)) ); } else if (functionName.equals(nameBFCCTPrimCompRTETTwoKeyNavParam)) { return Arrays.asList( new Function() .setName("BFCCTPrimCompRTETTwoKeyNavParam") .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp), - new Parameter().setName("ParameterString").setType(PropertyProvider.nameString))) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp).setNullable( + false), + new Parameter().setName("ParameterString").setType(PropertyProvider.nameString) + .setNullable(false))) .setComposable(true) .setReturnType(new ReturnType() - .setType(EntityTypeProvider.nameETTwoKeyNav) + .setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false) ) ); - } else if (functionName.equals(nameBAETTwoKeyNavRTETTwoKeyNav)) { - return Arrays.asList( - new Function() - .setName("BAETTwoKeyNavRTETTwoKeyNav") - .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(PropertyProvider.nameInt16).setCollection(true), - new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(true))) - .setComposable(true) - .setReturnType( - new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true)) - ); } else if (functionName.equals(nameBFCCTPrimCompRTESTwoKeyNavParam)) { return Arrays.asList( new Function() .setName("BFCCTPrimCompRTESTwoKeyNavParam") .setBound(true) - .setParameters(Arrays.asList( - new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp), - new Parameter().setName("ParameterString").setType(PropertyProvider.nameString))) + .setParameters( + Arrays.asList( + new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp).setNullable( + false), + new Parameter().setName("ParameterString").setType(PropertyProvider.nameString) + .setNullable(false))) .setComposable(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)) + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false)) ); } diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java index a237ebdad..6dc239950 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/PropertyProvider.java @@ -54,112 +54,304 @@ public class PropertyProvider { .setName("CollPropertyBinary") .setType(nameBinary) .setCollection(true); + + public static final Property collPropertyBinary_ExplicitNullable = new Property() + .setName("CollPropertyBinary") + .setType(nameBinary) + .setNullable(true) + .setCollection(true); public static final Property collPropertyBoolean = new Property() .setName("CollPropertyBoolean") .setType(nameBoolean) .setCollection(true); + + public static final Property collPropertyBoolean_ExplicitNullable = new Property() + .setName("CollPropertyBoolean") + .setType(nameBoolean) + .setNullable(true) + .setCollection(true); public static final Property collPropertyByte = new Property() .setName("CollPropertyByte") .setType(nameByte) .setCollection(true); + public static final Property collPropertyByte_ExplicitNullable = new Property() + .setName("CollPropertyByte") + .setType(nameByte) + .setNullable(true) + .setCollection(true); + public static final Property collPropertyDate = new Property() .setName("CollPropertyDate") .setType(nameDate) .setCollection(true); + + public static final Property collPropertyDate_ExplicitNullable = new Property() + .setName("CollPropertyDate") + .setType(nameDate) + .setNullable(true) + .setCollection(true); public static final Property collPropertyDateTimeOffset = new Property() .setName("CollPropertyDateTimeOffset") .setType(nameDateTimeOffset) .setCollection(true); + + public static final Property collPropertyDateTimeOffset_ExplicitNullable = new Property() + .setName("CollPropertyDateTimeOffset") + .setType(nameDateTimeOffset) + .setNullable(true) + .setCollection(true); public static final Property collPropertyDecimal = new Property() .setName("CollPropertyDecimal") .setType(nameDecimal) .setCollection(true); + + public static final Property collPropertyDecimal_ExplicitNullable = new Property() + .setName("CollPropertyDecimal") + .setType(nameDecimal) + .setNullable(true) + .setCollection(true); public static final Property collPropertyDouble = new Property() .setName("CollPropertyDouble") .setType(nameDouble) .setCollection(true); + + public static final Property collPropertyDouble_ExplicitNullable = new Property() + .setName("CollPropertyDouble") + .setType(nameDouble) + .setNullable(true) + .setCollection(true); public static final Property collPropertyDuration = new Property() .setName("CollPropertyDuration") .setType(nameDuration) .setCollection(true); + + public static final Property collPropertyDuration_ExplicitNullable = new Property() + .setName("CollPropertyDuration") + .setType(nameDuration) + .setNullable(true) + .setCollection(true); + public static final Property collPropertyGuid = new Property() .setName("CollPropertyGuid") .setType(nameGuid) .setCollection(true); + + public static final Property collPropertyGuid_ExplicitNullable = new Property() + .setName("CollPropertyGuid") + .setType(nameGuid) + .setNullable(true) + .setCollection(true); + public static final Property collPropertyInt16 = new Property() .setName("CollPropertyInt16") .setType(nameInt16) .setCollection(true); + + public static final Property collPropertyInt16_ExplicitNullable = new Property() + .setName("CollPropertyInt16") + .setType(nameInt16) + .setNullable(true) + .setCollection(true); + public static final Property collPropertyInt32 = new Property() .setName("CollPropertyInt32") .setType(nameInt32) .setCollection(true); + + public static final Property collPropertyInt32_ExplicitNullable = new Property() + .setName("CollPropertyInt32") + .setType(nameInt32) + .setNullable(true) + .setCollection(true); + public static final Property collPropertyInt64 = new Property() .setName("CollPropertyInt64") .setType(nameInt64) .setCollection(true); + + public static final Property collPropertyInt64_ExplicitNullable = new Property() + .setName("CollPropertyInt64") + .setType(nameInt64) + .setNullable(true) + .setCollection(true); public static final Property collPropertySByte = new Property() .setName("CollPropertySByte") .setType(nameSByte) .setCollection(true); + public static final Property collPropertySByte_ExplicitNullable = new Property() + .setName("CollPropertySByte") + .setType(nameSByte) + .setNullable(true) + .setCollection(true); + public static final Property collPropertySingle = new Property() .setName("CollPropertySingle") .setType(nameSingle) .setCollection(true); + + public static final Property collPropertySingle_ExplicitNullable = new Property() + .setName("CollPropertySingle") + .setType(nameSingle) + .setNullable(true) + .setCollection(true); public static final Property collPropertyString = new Property() .setName("CollPropertyString") .setType(nameString) .setCollection(true); + + public static final Property collPropertyString_ExplicitNullable = new Property() + .setName("CollPropertyString") + .setType(nameString) + .setNullable(true) + .setCollection(true); public static final Property collPropertyTimeOfDay = new Property() - .setName("CollPropertyTimeOfDay") - .setType(nameTimeOfDay) - .setCollection(true); + .setName("CollPropertyTimeOfDay") + .setType(nameTimeOfDay) + .setCollection(true); + + public static final Property collPropertyTimeOfDay_ExplicitNullable = new Property() + .setName("CollPropertyTimeOfDay") + .setType(nameTimeOfDay) + .setNullable(true) + .setCollection(true); public static final Property propertyBinary = new Property() .setName("PropertyBinary") .setType(nameBinary); + + public static final Property propertyBinary_NotNullable = new Property() + .setName("PropertyBinary") + .setType(nameBinary) + .setNullable(false); + + public static final Property propertyBinary_ExplicitNullable = new Property() + .setName("PropertyBinary") + .setType(nameBinary) + .setNullable(true); + public static final Property propertyBoolean = new Property() .setName("PropertyBoolean") .setType(nameBoolean); + + public static final Property propertyBoolean_NotNullable = new Property() + .setName("PropertyBoolean") + .setType(nameBoolean) + .setNullable(false); + + public static final Property propertyBoolean_ExplicitNullable = new Property() + .setName("PropertyBoolean") + .setType(nameBoolean) + .setNullable(true); + public static final Property propertyByte = new Property() .setName("PropertyByte") .setType(nameByte); + public static final Property propertyByte_NotNullable = new Property() + .setName("PropertyByte") + .setType(nameByte) + .setNullable(false); + + public static final Property propertyByte_ExplicitNullable = new Property() + .setName("PropertyByte") + .setType(nameByte) + .setNullable(true); + public static final Property propertyDate = new Property() .setName("PropertyDate") .setType(nameDate); + public static final Property propertyDate_NotNullable = new Property() + .setName("PropertyDate") + .setType(nameDate) + .setNullable(false); + + public static final Property propertyDate_ExplicitNullable = new Property() + .setName("PropertyDate") + .setType(nameDate) + .setNullable(true); + public static final Property propertyDateTimeOffset = new Property() .setName("PropertyDateTimeOffset") .setType(nameDateTimeOffset); + public static final Property propertyDateTimeOffset_NotNullable = new Property() + .setName("PropertyDateTimeOffset") + .setType(nameDateTimeOffset) + .setNullable(false); + + public static final Property propertyDateTimeOffset_ExplicitNullable = new Property() + .setName("PropertyDateTimeOffset") + .setType(nameDateTimeOffset) + .setNullable(true); + public static final Property propertyDecimal = new Property() .setName("PropertyDecimal") .setType(nameDecimal); + public static final Property propertyDecimal_NotNullable = new Property() + .setName("PropertyDecimal") + .setType(nameDecimal) + .setNullable(false); + + public static final Property propertyDecimal_ExplicitNullable = new Property() + .setName("PropertyDecimal") + .setType(nameDecimal) + .setNullable(true); + public static final Property propertyDouble = new Property() .setName("PropertyDouble") .setType(nameDouble); + public static final Property propertyDouble_NotNullable = new Property() + .setName("PropertyDouble") + .setType(nameDouble) + .setNullable(false); + + public static final Property propertyDouble_ExplicitNullable = new Property() + .setName("PropertyDouble") + .setType(nameDouble) + .setNullable(true); + public static final Property propertyDuration = new Property() .setName("PropertyDuration") .setType(nameDuration); + public static final Property propertyDuration_NotNullable = new Property() + .setName("PropertyDuration") + .setType(nameDuration) + .setNullable(false); + + public static final Property propertyDuration_ExplicitNullable = new Property() + .setName("PropertyDuration") + .setType(nameDuration) + .setNullable(true); + public static final Property propertyGuid = new Property() .setName("PropertyGuid") .setType(nameGuid); + public static final Property propertyGuid_NotNullable = new Property() + .setName("PropertyGuid") + .setType(nameGuid) + .setNullable(false); + + public static final Property propertyGuid_ExplicitNullable = new Property() + .setName("PropertyGuid") + .setType(nameGuid) + .setNullable(true); + public static final Property propertyInt16 = new Property() .setName("PropertyInt16") .setType(nameInt16); @@ -168,33 +360,96 @@ public class PropertyProvider { .setName("PropertyInt16") .setType(nameInt16) .setNullable(false); + + public static final Property propertyInt16_ExplicitNullable = new Property() + .setName("PropertyInt16") + .setType(nameInt16) + .setNullable(true); + public static final Property propertyInt32 = new Property() .setName("PropertyInt32") .setType(nameInt32); + public static final Property propertyInt32_NotNullable = new Property() + .setName("PropertyInt32") + .setType(nameInt32) + .setNullable(false); + + public static final Property propertyInt32_ExplicitNullable = new Property() + .setName("PropertyInt32") + .setType(nameInt32) + .setNullable(true); + public static final Property propertyInt64 = new Property() .setName("PropertyInt64") .setType(nameInt64); + public static final Property propertyInt64_NotNullable = new Property() + .setName("PropertyInt64") + .setType(nameInt64) + .setNullable(false); + + public static final Property propertyInt64_ExplicitNullable = new Property() + .setName("PropertyInt64") + .setType(nameInt64) + .setNullable(true); + public static final Property propertySByte = new Property() .setName("PropertySByte") .setType(nameSByte); + public static final Property propertySByte_NotNullable = new Property() + .setName("PropertySByte") + .setType(nameSByte) + .setNullable(false); + + public static final Property propertySByte_ExplicitNullable = new Property() + .setName("PropertySByte") + .setType(nameSByte) + .setNullable(true); + public static final Property propertySingle = new Property() .setName("PropertySingle") .setType(nameSingle); + public static final Property propertySingle_NotNullable = new Property() + .setName("PropertySingle") + .setType(nameSingle) + .setNullable(false); + + public static final Property propertySingle_ExplicitNullable = new Property() + .setName("PropertySingle") + .setType(nameSingle) + .setNullable(true); + public static final Property propertyString = new Property() .setName("PropertyString") .setType(nameString); public static final Property propertyString_NotNullable = new Property() .setName("PropertyString") - .setType(nameString); + .setType(nameString) + .setNullable(false); - public static final Property propertyTimeOfDay = new Property().setName("PropertyTimeOfDay") + public static final Property propertyString_ExplicitNullable = new Property() + .setName("PropertyString") + .setType(nameString) + .setNullable(true); + + public static final Property propertyTimeOfDay = new Property() + .setName("PropertyTimeOfDay") .setType(nameTimeOfDay); + public static final Property propertyTimeOfDay_NotNullable = new Property() + .setName("PropertyTimeOfDay") + .setType(nameTimeOfDay) + .setNullable(false); + + public static final Property propertyTimeOfDay_ExplicitNullable = new Property() + .setName("PropertyTimeOfDay") + .setType(nameTimeOfDay) + .setNullable(true); + /* * TODO add propertyStream * Property propertyStream = new Property() @@ -235,7 +490,8 @@ public class PropertyProvider { public static final Property propertyComplex_CTPrimComp_NotNullable = new Property() .setName("PropertyComplex") - .setType(ComplexTypeProvider.nameCTPrimComp); + .setType(ComplexTypeProvider.nameCTPrimComp) + .setNullable(false); public static final Property propertyComplex_CTTwoPrim = new Property() .setName("PropertyComplex") @@ -251,7 +507,8 @@ public class PropertyProvider { public static final Property propertyComplexEnum_CTPrimEnum_NotNullable = new Property() .setName("PropertyComplexEnum") - .setType(ComplexTypeProvider.nameCTPrimEnum); + .setType(ComplexTypeProvider.nameCTPrimEnum) + .setNullable(false); public static final Property propertyComplexTwoPrim_CTTwoPrim = new Property() .setName("PropertyComplexTwoPrim") @@ -259,8 +516,7 @@ public class PropertyProvider { public static final Property propertyMixedPrimCollComp_CTMixPrimCollComp = new Property() .setName("PropertyMixedPrimCollComp") - .setType(ComplexTypeProvider.nameCTMixPrimCollComp) - .setCollection(true); + .setType(ComplexTypeProvider.nameCTMixPrimCollComp); // Navigation Properties ------------------------------------------------------------------------------------------- public static final NavigationProperty collectionNavPropertyETKeyNavMany_ETKeyNav = new NavigationProperty() @@ -283,21 +539,47 @@ public class PropertyProvider { .setName("NavPropertyETTwoKeyNavOne") .setType(EntityTypeProvider.nameETTwoKeyNav); + public static final NavigationProperty collectionNavPropertyETTwoPrimMany_ETTwoPrim = new NavigationProperty() + .setName("NavPropertyETTwoPrimMany") + .setType(EntityTypeProvider.nameETTwoPrim) + .setCollection(true) + .setNullable(false); + + public static final NavigationProperty collectionNavPropertyETAllPrimMany_ETAllPrim = new NavigationProperty() + .setName("NavPropertyETAllPrimMany") + .setType(EntityTypeProvider.nameETAllPrim) + .setCollection(true); + public static final NavigationProperty navPropertyETKeyNavOne_ETKeyNav = new NavigationProperty() .setName("NavPropertyETKeyNavOne") .setType(EntityTypeProvider.nameETKeyNav); + public static final NavigationProperty navPropertyETMediaOne_ETMedia = new NavigationProperty() .setName("NavPropertyETMediaOne") .setType(EntityTypeProvider.nameETMedia); - public static final NavigationProperty navPropertyETKeyPrimNavOne = new NavigationProperty() + public static final NavigationProperty navPropertyETKeyPrimNavOne_ETKeyPrimNav = new NavigationProperty() .setName("NavPropertyETKeyPrimNavOne") .setType(EntityTypeProvider.nameETKeyPrimNav); + public static final NavigationProperty navPropertyETTwoKeyNavOne_ETTwoKeyNav_NotNullable = new NavigationProperty() + .setName("NavPropertyETTwoKeyNavOne") + .setType(EntityTypeProvider.nameETTwoKeyNav) + .setNullable(false); + public static final NavigationProperty navPropertyETTwoKeyNavOne_ETTwoKeyNav = new NavigationProperty() .setName("NavPropertyETTwoKeyNavOne") .setType(EntityTypeProvider.nameETTwoKeyNav); + public static final NavigationProperty navPropertyETTwoPrimOne_ETTwoPrim = new NavigationProperty() + .setName("NavPropertyETTwoPrimOne") + .setType(EntityTypeProvider.nameETTwoPrim) + .setNullable(false); + + public static final NavigationProperty navPropertyETAllPrimOne_ETAllPrim = new NavigationProperty() + .setName("NavPropertyETAllPrimOne") + .setType(EntityTypeProvider.nameETAllPrim); + // EnumProperties -------------------------------------------------------------------------------------------------- public static final Property propertyEnumString_ENString = new Property() .setName("PropertyEnumString") diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java index 6a0708fbe..81f638df3 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/SchemaProvider.java @@ -40,7 +40,7 @@ public class SchemaProvider { public static final String nameSpace = "com.sap.odata.test1"; - public SchemaProvider(EdmTechProvider prov) { + public SchemaProvider(final EdmTechProvider prov) { this.prov = prov; } @@ -105,17 +105,17 @@ public class SchemaProvider { // Actions List actions = new ArrayList(); schema.setActions(actions); - actions.addAll(prov.getActions(ActionProvider.nameUARTPrimParam)); - actions.addAll(prov.getActions(ActionProvider.nameUARTPrimCollParam)); - actions.addAll(prov.getActions(ActionProvider.nameUARTCompParam)); - actions.addAll(prov.getActions(ActionProvider.nameUARTCompCollParam)); - actions.addAll(prov.getActions(ActionProvider.nameUARTETParam)); - actions.addAll(prov.getActions(ActionProvider.nameUARTETCollAllPrimParam)); actions.addAll(prov.getActions(ActionProvider.nameBAETTwoKeyNavRTETTwoKeyNav)); actions.addAll(prov.getActions(ActionProvider.nameBAESAllPrimRTETAllPrim)); actions.addAll(prov.getActions(ActionProvider.nameBAESTwoKeyNavRTESTwoKeyNav)); actions.addAll(prov.getActions(ActionProvider.nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav)); actions.addAll(prov.getActions(ActionProvider.nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav)); + actions.addAll(prov.getActions(ActionProvider.nameUARTPrimParam)); + actions.addAll(prov.getActions(ActionProvider.nameUARTPrimCollParam)); + actions.addAll(prov.getActions(ActionProvider.nameUARTCompParam)); + actions.addAll(prov.getActions(ActionProvider.nameUARTCompCollParam)); + actions.addAll(prov.getActions(ActionProvider.nameUARTETParam)); + actions.addAll(prov.getActions(ActionProvider.nameUARTESParam)); // Functions List functions = new ArrayList(); @@ -127,7 +127,6 @@ public class SchemaProvider { functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTETTwoKeyNavParamCTTwoPrim)); functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTStringTwoParam)); functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTESTwoKeyNavParam)); - // TODO: check why it exists twice functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTString)); functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCollStringTwoParam)); functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCollString)); @@ -140,6 +139,7 @@ public class SchemaProvider { functions.addAll(prov.getFunctions(FunctionProvider.nameUFNRTESMixPrimCollCompTwoParam)); functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTETAllPrimTwoParam)); functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTESMixPrimCollCompTwoParam)); + functions.addAll(prov.getFunctions(FunctionProvider.nameUFNRTCollCTNavFiveProp)); functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTESTwoKeyNav)); functions.addAll(prov.getFunctions(FunctionProvider.nameBFCStringRTESTwoKeyNav)); functions.addAll(prov.getFunctions(FunctionProvider.nameBFCETBaseTwoKeyNavRTETTwoKeyNav)); @@ -163,11 +163,14 @@ public class SchemaProvider { functions.addAll(prov.getFunctions(FunctionProvider.nameBFESTwoKeyNavRTESTwoKeyNav)); functions.addAll(prov.getFunctions(FunctionProvider.nameBFCETTwoKeyNavRTETTwoKeyNav)); functions.addAll(prov.getFunctions(FunctionProvider.nameBFCETTwoKeyNavRTCTTwoPrim)); + + functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTCTNavFiveProp)); + functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTCollCTNavFiveProp)); + functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTStringParam)); functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESKeyNavRTETKeyNavParam)); functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCTPrimCompRTETTwoKeyNavParam)); - functions.addAll(prov.getFunctions(FunctionProvider.nameBAETTwoKeyNavRTETTwoKeyNav)); - functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCTPrimCompRTESTwoKeyNavParam)); + //functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCTPrimCompRTESTwoKeyNavParam)); // EntityContainer EntityContainer container = new EntityContainer(); diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java index 879affdca..dc34b316a 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/testutil/techprovider/TypeDefinitionProvider.java @@ -23,7 +23,7 @@ import org.apache.olingo.server.api.edm.provider.TypeDefinition; public class TypeDefinitionProvider { - public TypeDefinition getTypeDefinition(FullQualifiedName typeDefinitionName) { + public TypeDefinition getTypeDefinition(final FullQualifiedName typeDefinitionName) { return null; } diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java index ab0b1d3db..50b7a5d85 100644 --- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java +++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java @@ -593,7 +593,7 @@ public class TestUriParserImpl { testRes.run("FINRTInt16()") .isFunctionImport("FINRTInt16") .isFunction("UFNRTInt16") - .isType(PropertyProvider.nameString); + .isType(PropertyProvider.nameInt16); // one input testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)") @@ -614,7 +614,7 @@ public class TestUriParserImpl { testRes.run("FINRTInt16()") .isFunctionImport("FINRTInt16") .isFunction("UFNRTInt16") - .isType(PropertyProvider.nameString, false); + .isType(PropertyProvider.nameInt16, false); // returning collection of primitive testRes.run("FICRTCollStringTwoParam(ParameterString='ABC',ParameterInt16=1)")