You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by il...@apache.org on 2014/03/05 16:06:40 UTC
[21/22] [OLINGO-186] client-side implementation of commons Edm
interfaces completed: some refactoring on server-side performed to extract
common abstract implementation
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmEntityTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmEntityTypeImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmEntityTypeImpl.java
new file mode 100644
index 0000000..8c17a1e
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmEntityTypeImpl.java
@@ -0,0 +1,79 @@
+/*
+ * 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.odata4.client.core.edm;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import org.apache.olingo.odata4.client.api.edm.xml.PropertyRef;
+import org.apache.olingo.odata4.client.api.edm.xml.v4.EntityType;
+import org.apache.olingo.odata4.client.api.utils.EdmTypeInfo;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.commons.api.edm.EdmKeyPropertyRef;
+import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.core.edm.AbstractEdmEntityType;
+import org.apache.olingo.odata4.commons.core.edm.EdmStructuredTypeHelper;
+
+public class EdmEntityTypeImpl extends AbstractEdmEntityType {
+
+ private final EdmStructuredTypeHelper helper;
+
+ public static EdmEntityTypeImpl getInstance(final Edm edm, final FullQualifiedName fqn, final EntityType entityType) {
+ final FullQualifiedName baseTypeName = entityType.getBaseType() == null
+ ? null : new EdmTypeInfo(entityType.getBaseType()).getFullQualifiedName();
+ final EdmEntityTypeImpl instance = new EdmEntityTypeImpl(edm, fqn, baseTypeName, entityType);
+ instance.baseType = instance.buildBaseType(baseTypeName);
+
+ if (instance.baseType == null) {
+ instance.entityBaseType = null;
+
+ final List<EdmKeyPropertyRef> edmKey = new ArrayList<EdmKeyPropertyRef>(
+ entityType.getKey().getPropertyRefs().size());
+ for (PropertyRef ref : entityType.getKey().getPropertyRefs()) {
+ edmKey.add(new EdmKeyPropertyRefImpl(instance, ref));
+ }
+ instance.setEdmKeyPropertyRef(edmKey);
+ } else {
+ instance.entityBaseType = (EdmEntityType) instance.baseType;
+ }
+
+ return instance;
+ }
+
+ private EdmEntityTypeImpl(final Edm edm, final FullQualifiedName fqn, final FullQualifiedName baseTypeName,
+ final EntityType entityType) {
+
+ super(edm, fqn, baseTypeName, entityType.isHasStream());
+ this.helper = new EdmStructuredTypeHelperImpl(edm, entityType);
+ }
+
+ @Override
+ protected Map<String, EdmProperty> getProperties() {
+ return helper.getProperties();
+ }
+
+ @Override
+ protected Map<String, EdmNavigationProperty> getNavigationProperties() {
+ return helper.getNavigationProperties();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmEnumTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmEnumTypeImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmEnumTypeImpl.java
new file mode 100644
index 0000000..6d090ab
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmEnumTypeImpl.java
@@ -0,0 +1,83 @@
+/*
+ * 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.odata4.client.core.edm;
+
+import org.apache.olingo.odata4.commons.core.edm.EdmMemberImpl;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.olingo.odata4.client.api.edm.xml.EnumType;
+import org.apache.olingo.odata4.client.api.edm.xml.Member;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
+import org.apache.olingo.odata4.commons.api.edm.EdmMember;
+import org.apache.olingo.odata4.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.core.edm.AbstractEdmEnumType;
+import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+
+public class EdmEnumTypeImpl extends AbstractEdmEnumType implements EdmEnumType {
+
+ private final EdmPrimitiveType underlyingType;
+
+ private final List<String> memberNames;
+
+ private final Map<String, EdmMember> members;
+
+ public EdmEnumTypeImpl(final Edm edm, final FullQualifiedName fqn, final EnumType xmlEnumType) {
+ super(edm, fqn, xmlEnumType.isFlags());
+
+ if (xmlEnumType.getUnderlyingType() == null) {
+ this.underlyingType = EdmPrimitiveTypeKind.Int32.getEdmPrimitiveTypeInstance();
+ } else {
+ this.underlyingType = EdmPrimitiveTypeKind.fromString(
+ xmlEnumType.getUnderlyingType()).getEdmPrimitiveTypeInstance();
+ // TODO: Should we validate that the underlying type is of byte, sbyte, in16, int32 or int64?
+ }
+
+ final List<? extends Member> xmlMembers = xmlEnumType.getMembers();
+ final List<String> _memberNames = new ArrayList<String>();
+ final Map<String, EdmMember> _members = new LinkedHashMap<String, EdmMember>(xmlMembers.size());
+ for (Member xmlMember : xmlMembers) {
+ _memberNames.add(xmlMember.getName());
+ _members.put(xmlMember.getName(), new EdmMemberImpl(edm, xmlMember.getName(), xmlMember.getValue()));
+ }
+ this.memberNames = Collections.unmodifiableList(_memberNames);
+ this.members = Collections.unmodifiableMap(_members);
+ }
+
+ @Override
+ public EdmPrimitiveType getUnderlyingType() {
+ return underlyingType;
+ }
+
+ @Override
+ public List<String> getMemberNames() {
+ return memberNames;
+ }
+
+ @Override
+ protected Collection<? extends EdmMember> getMembers() {
+ return members.values();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmFunctionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmFunctionImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmFunctionImpl.java
new file mode 100644
index 0000000..aa83cb3
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmFunctionImpl.java
@@ -0,0 +1,44 @@
+/*
+ * 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.odata4.client.core.edm;
+
+import org.apache.olingo.odata4.client.api.edm.xml.v4.Function;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
+
+public class EdmFunctionImpl extends EdmOperationImpl implements EdmFunction {
+
+ private final Function function;
+
+ public static EdmFunctionImpl getInstance(final Edm edm, final FullQualifiedName name, final Function function) {
+ return EdmOperationImpl.getInstance(new EdmFunctionImpl(edm, name, function));
+ }
+
+ private EdmFunctionImpl(final Edm edm, final FullQualifiedName name, final Function function) {
+ super(edm, name, function, EdmTypeKind.FUNCTION);
+ this.function = function;
+ }
+
+ @Override
+ public boolean isComposable() {
+ return function.isComposable();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmFunctionImportImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmFunctionImportImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmFunctionImportImpl.java
new file mode 100644
index 0000000..8c65d59
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmFunctionImportImpl.java
@@ -0,0 +1,47 @@
+/*
+ * 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.odata4.client.core.edm;
+
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.xml.v4.FunctionImport;
+import org.apache.olingo.odata4.client.api.utils.EdmTypeInfo;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
+import org.apache.olingo.odata4.commons.api.edm.EdmFunctionImport;
+
+public class EdmFunctionImportImpl extends EdmOperationImportImpl implements EdmFunctionImport {
+
+ private final FunctionImport functionImport;
+
+ public EdmFunctionImportImpl(final Edm edm, final EdmEntityContainer container, final String name,
+ final FunctionImport functionImport) {
+
+ super(edm, container, name, functionImport);
+ this.functionImport = functionImport;
+ }
+
+ @Override
+ public EdmFunction getFunction(final List<String> parameterNames) {
+ return edm.getFunction(
+ new EdmTypeInfo(functionImport.getFunction(), container.getNamespace()).getFullQualifiedName(),
+ null, null, parameterNames);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmKeyPropertyRefImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmKeyPropertyRefImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmKeyPropertyRefImpl.java
new file mode 100644
index 0000000..0264c28
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmKeyPropertyRefImpl.java
@@ -0,0 +1,49 @@
+/*
+ * 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.odata4.client.core.edm;
+
+import org.apache.olingo.odata4.client.api.edm.xml.PropertyRef;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.commons.core.edm.AbstractEdmKeyPropertyRef;
+
+public class EdmKeyPropertyRefImpl extends AbstractEdmKeyPropertyRef {
+
+ private final PropertyRef propertyRef;
+
+ public EdmKeyPropertyRefImpl(final EdmEntityType edmEntityType, final PropertyRef propertyRef) {
+ super(edmEntityType);
+ this.propertyRef = propertyRef;
+ }
+
+ @Override
+ public String getKeyPropertyName() {
+ return propertyRef.getName();
+ }
+
+ @Override
+ public String getAlias() {
+ return propertyRef.getAlias();
+ }
+
+ @Override
+ public String getPath() {
+ throw new UnsupportedOperationException("Not supported in client code.");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmNavigationPropertyImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmNavigationPropertyImpl.java
new file mode 100644
index 0000000..9d79914
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmNavigationPropertyImpl.java
@@ -0,0 +1,74 @@
+/*
+ * 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.odata4.client.core.edm;
+
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.xml.v4.NavigationProperty;
+import org.apache.olingo.odata4.client.api.edm.xml.v4.ReferentialConstraint;
+import org.apache.olingo.odata4.client.api.utils.EdmTypeInfo;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.core.edm.AbstractEdmNavigationProperty;
+
+public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty {
+
+ private final NavigationProperty navigationProperty;
+
+ private final EdmTypeInfo edmTypeInfo;
+
+ public EdmNavigationPropertyImpl(final Edm edm, final NavigationProperty navigationProperty) {
+ super(edm, navigationProperty.getName());
+ this.navigationProperty = navigationProperty;
+ this.edmTypeInfo = new EdmTypeInfo(navigationProperty.getType());
+ }
+
+ @Override
+ protected FullQualifiedName getTypeFQN() {
+ return edmTypeInfo.getFullQualifiedName();
+ }
+
+ @Override
+ protected String internatGetPartner() {
+ return navigationProperty.getPartner();
+ }
+
+ @Override
+ public boolean isCollection() {
+ return edmTypeInfo.isCollection();
+ }
+
+ @Override
+ public Boolean isNullable() {
+ return navigationProperty.isNullable();
+ }
+
+ @Override
+ public String getReferencingPropertyName(final String referencedPropertyName) {
+ final List<? extends ReferentialConstraint> referentialConstraints = navigationProperty.getReferentialConstraints();
+ if (referentialConstraints != null) {
+ for (ReferentialConstraint constraint : referentialConstraints) {
+ if (constraint.getReferencedProperty().equals(referencedPropertyName)) {
+ return constraint.getProperty();
+ }
+ }
+ }
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmOperationImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmOperationImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmOperationImpl.java
new file mode 100644
index 0000000..932fe57
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmOperationImpl.java
@@ -0,0 +1,63 @@
+/*
+ * 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.odata4.client.core.edm;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.xml.CommonParameter;
+import org.apache.olingo.odata4.client.api.edm.xml.v4.Action;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmParameter;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.odata4.commons.core.edm.AbstractEdmOperation;
+
+public abstract class EdmOperationImpl extends AbstractEdmOperation {
+
+ protected final Action operation;
+
+ protected static <T extends EdmOperationImpl> T getInstance(final T instance) {
+
+ final List<? extends CommonParameter> parameters = instance.operation.getParameters();
+ if (parameters != null) {
+ final List<EdmParameter> _parameters = new ArrayList<EdmParameter>(parameters.size());
+ for (CommonParameter parameter : parameters) {
+ _parameters.add(EdmParameterImpl.getInstance(instance.edm, parameter));
+ }
+ instance.setParameters(_parameters);
+ }
+
+ instance.setEntitySetPath(instance.operation.getEntitySetPath());
+
+ instance.setIsBound(instance.operation.isBound());
+
+ if (instance.operation.getReturnType() != null) {
+ instance.setReturnType(EdmReturnTypeImpl.getInstance(instance.edm, instance.operation.getReturnType()));
+ }
+
+ return instance;
+ }
+
+ protected EdmOperationImpl(final Edm edm, final FullQualifiedName name, final Action operation,
+ final EdmTypeKind kind) {
+
+ super(edm, name, kind);
+ this.operation = operation;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmOperationImportImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmOperationImportImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmOperationImportImpl.java
new file mode 100644
index 0000000..450ebc2
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmOperationImportImpl.java
@@ -0,0 +1,35 @@
+/*
+ * 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.odata4.client.core.edm;
+
+import org.apache.olingo.odata4.client.api.edm.xml.v4.OperationImport;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata4.commons.api.edm.Target;
+import org.apache.olingo.odata4.commons.core.edm.AbstractEdmOperationImport;
+
+public abstract class EdmOperationImportImpl extends AbstractEdmOperationImport {
+
+ protected EdmOperationImportImpl(final Edm edm, final EdmEntityContainer container, final String name,
+ final OperationImport operationImport) {
+
+ super(edm, container, name, new Target.Builder(operationImport.getEntitySet(), container).build());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmParameterImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmParameterImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmParameterImpl.java
new file mode 100644
index 0000000..9b3beb4
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmParameterImpl.java
@@ -0,0 +1,74 @@
+/*
+ * 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.odata4.client.core.edm;
+
+import org.apache.olingo.odata4.client.api.edm.xml.CommonParameter;
+import org.apache.olingo.odata4.client.api.utils.EdmTypeInfo;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmMapping;
+import org.apache.olingo.odata4.commons.core.edm.AbstractEdmParameter;
+
+public class EdmParameterImpl extends AbstractEdmParameter {
+
+ private final CommonParameter parameter;
+
+ private final EdmTypeInfo parameterInfo;
+
+ public static EdmParameterImpl getInstance(final Edm edm, final CommonParameter parameter) {
+ final EdmTypeInfo paramTypeInfo = new EdmTypeInfo(parameter.getType());
+ return new EdmParameterImpl(edm, parameter, paramTypeInfo);
+ }
+
+ private EdmParameterImpl(final Edm edm, final CommonParameter parameter, final EdmTypeInfo parameterInfo) {
+ super(edm, parameter.getName(), parameterInfo.getFullQualifiedName());
+ this.parameter = parameter;
+ this.parameterInfo = parameterInfo;
+ }
+
+ @Override
+ public boolean isCollection() {
+ return parameterInfo.isCollection();
+ }
+
+ @Override
+ public EdmMapping getMapping() {
+ throw new UnsupportedOperationException("Not supported in client code.");
+ }
+
+ @Override
+ public Boolean isNullable() {
+ return parameter.isNullable();
+ }
+
+ @Override
+ public Integer getMaxLength() {
+ return parameter.getMaxLength();
+ }
+
+ @Override
+ public Integer getPrecision() {
+ return parameter.getPrecision();
+ }
+
+ @Override
+ public Integer getScale() {
+ return parameter.getScale();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmPropertyImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmPropertyImpl.java
new file mode 100644
index 0000000..20ffb2c
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmPropertyImpl.java
@@ -0,0 +1,91 @@
+/*
+ * 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.odata4.client.core.edm;
+
+import org.apache.olingo.odata4.client.api.edm.xml.CommonProperty;
+import org.apache.olingo.odata4.client.api.utils.EdmTypeInfo;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmMapping;
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.core.edm.AbstractEdmProperty;
+
+public class EdmPropertyImpl extends AbstractEdmProperty implements EdmProperty {
+
+ private final CommonProperty property;
+
+ private final EdmTypeInfo edmTypeInfo;
+
+ public EdmPropertyImpl(final Edm edm, final CommonProperty property) {
+ super(edm, property.getName());
+ this.property = property;
+ this.edmTypeInfo = new EdmTypeInfo(property.getType());
+ }
+
+ @Override
+ protected FullQualifiedName getTypeFQN() {
+ return edmTypeInfo.getFullQualifiedName();
+ }
+
+ @Override
+ public boolean isCollection() {
+ return edmTypeInfo.isCollection();
+ }
+
+ @Override
+ public EdmMapping getMapping() {
+ throw new UnsupportedOperationException("Not supported in client code.");
+ }
+
+ @Override
+ public String getMimeType() {
+ throw new UnsupportedOperationException("Not supported in client code.");
+ }
+
+ @Override
+ public Boolean isNullable() {
+ return property.isNullable();
+ }
+
+ @Override
+ public Integer getMaxLength() {
+ return property.getMaxLength();
+ }
+
+ @Override
+ public Integer getPrecision() {
+ return property.getPrecision();
+ }
+
+ @Override
+ public Integer getScale() {
+ return property.getScale();
+ }
+
+ @Override
+ public Boolean isUnicode() {
+ return property.isUnicode();
+ }
+
+ @Override
+ public String getDefaultValue() {
+ return property.getDefaultValue();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmReturnTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmReturnTypeImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmReturnTypeImpl.java
new file mode 100644
index 0000000..c17b996
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmReturnTypeImpl.java
@@ -0,0 +1,68 @@
+/*
+ * 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.odata4.client.core.edm;
+
+import org.apache.olingo.odata4.client.api.edm.xml.v4.ReturnType;
+import org.apache.olingo.odata4.client.api.utils.EdmTypeInfo;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.core.edm.AbstractEdmReturnType;
+
+public class EdmReturnTypeImpl extends AbstractEdmReturnType {
+
+ private final ReturnType returnType;
+
+ private final EdmTypeInfo returnTypeInfo;
+
+ public static EdmReturnTypeImpl getInstance(final Edm edm, final ReturnType returnType) {
+ final EdmTypeInfo returnTypeInfo = new EdmTypeInfo(returnType.getType());
+ return new EdmReturnTypeImpl(edm, returnType, returnTypeInfo);
+ }
+
+ private EdmReturnTypeImpl(final Edm edm, final ReturnType returnType, final EdmTypeInfo returnTypeInfo) {
+ super(edm, returnTypeInfo.getFullQualifiedName());
+ this.returnType = returnType;
+ this.returnTypeInfo = returnTypeInfo;
+ }
+
+ @Override
+ public Boolean isNullable() {
+ return returnType.isNullable();
+ }
+
+ @Override
+ public Integer getMaxLength() {
+ return returnType.getMaxLength();
+ }
+
+ @Override
+ public Integer getPrecision() {
+ return returnType.getPrecision();
+ }
+
+ @Override
+ public Integer getScale() {
+ return returnType.getScale();
+ }
+
+ @Override
+ public boolean isCollection() {
+ return returnTypeInfo.isCollection();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmSingletonImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmSingletonImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmSingletonImpl.java
new file mode 100644
index 0000000..6d14154
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmSingletonImpl.java
@@ -0,0 +1,35 @@
+/*
+ * 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.odata4.client.core.edm;
+
+import org.apache.olingo.odata4.client.api.edm.xml.v4.Singleton;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+
+public class EdmSingletonImpl extends EdmBindingTargetImpl implements EdmSingleton {
+
+ public EdmSingletonImpl(final Edm edm, final EdmEntityContainer container, final String name,
+ final FullQualifiedName type, final Singleton singleton) {
+
+ super(edm, container, name, type, singleton);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmStructuredTypeHelperImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmStructuredTypeHelperImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmStructuredTypeHelperImpl.java
new file mode 100644
index 0000000..c090f50
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmStructuredTypeHelperImpl.java
@@ -0,0 +1,71 @@
+/*
+ * 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.odata4.client.core.edm;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.apache.olingo.odata4.client.api.edm.xml.CommonNavigationProperty;
+import org.apache.olingo.odata4.client.api.edm.xml.CommonProperty;
+import org.apache.olingo.odata4.client.api.edm.xml.v4.ComplexType;
+import org.apache.olingo.odata4.client.api.edm.xml.v4.NavigationProperty;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+import org.apache.olingo.odata4.commons.core.edm.EdmStructuredTypeHelper;
+
+public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
+
+ private final Edm edm;
+
+ private final ComplexType complexType;
+
+ private Map<String, EdmProperty> properties;
+
+ private Map<String, EdmNavigationProperty> navigationProperties;
+
+ public EdmStructuredTypeHelperImpl(final Edm edm, final ComplexType complexType) {
+ this.edm = edm;
+ this.complexType = complexType;
+ }
+
+ @Override
+ public Map<String, EdmProperty> getProperties() {
+ if (properties == null) {
+ properties = new LinkedHashMap<String, EdmProperty>();
+ for (CommonProperty property : complexType.getProperties()) {
+ properties.put(property.getName(), new EdmPropertyImpl(edm, property));
+ }
+ }
+ return properties;
+ }
+
+ @Override
+ public Map<String, EdmNavigationProperty> getNavigationProperties() {
+ if (navigationProperties == null) {
+ navigationProperties = new LinkedHashMap<String, EdmNavigationProperty>();
+ for (CommonNavigationProperty navigationProperty : complexType.getNavigationProperties()) {
+ if (navigationProperty instanceof NavigationProperty) {
+ navigationProperties.put(navigationProperty.getName(),
+ new EdmNavigationPropertyImpl(edm, (NavigationProperty) navigationProperty));
+ }
+ }
+ }
+ return navigationProperties;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmTypeDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmTypeDefinitionImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmTypeDefinitionImpl.java
new file mode 100644
index 0000000..43a5455
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmTypeDefinitionImpl.java
@@ -0,0 +1,74 @@
+/*
+ * 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.odata4.client.core.edm;
+
+import org.apache.olingo.odata4.client.api.edm.xml.v4.TypeDefinition;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmException;
+import org.apache.olingo.odata4.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.odata4.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.core.edm.AbstractEdmTypeDefinition;
+import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+
+public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements EdmTypeDefinition {
+
+ private TypeDefinition typeDefinition;
+
+ private EdmPrimitiveType edmPrimitiveTypeInstance;
+
+ public EdmTypeDefinitionImpl(final Edm edm, final FullQualifiedName typeDefinitionName,
+ final TypeDefinition typeDefinition) {
+
+ super(edm, typeDefinitionName);
+ this.typeDefinition = typeDefinition;
+ // TODO: Should we check for edmNamespace in the underlying type name?
+ try {
+ edmPrimitiveTypeInstance = EdmPrimitiveTypeKind.fromString(
+ typeDefinition.getUnderlyingType()).getEdmPrimitiveTypeInstance();
+ } catch (IllegalArgumentException e) {
+ throw new EdmException("Invalid underlying type: " + typeDefinition.getUnderlyingType(), e);
+ }
+ }
+
+ @Override
+ public EdmPrimitiveType getUnderlyingType() {
+ return edmPrimitiveTypeInstance;
+ }
+
+ @Override
+ public Integer getMaxLength() {
+ return typeDefinition.getMaxLength();
+ }
+
+ @Override
+ public Integer getPrecision() {
+ return typeDefinition.getPrecision();
+ }
+
+ @Override
+ public Integer getScale() {
+ return typeDefinition.getScale();
+ }
+
+ @Override
+ public Boolean isUnicode() {
+ return typeDefinition.isUnicode();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmMetadataImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmMetadataImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmMetadataImpl.java
deleted file mode 100644
index f7e1993..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmMetadataImpl.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.odata4.client.core.edm.v3;
-
-import java.io.InputStream;
-import java.util.List;
-import org.apache.olingo.odata4.client.api.ODataClient;
-import org.apache.olingo.odata4.client.core.edm.AbstractEdmMetadata;
-import org.apache.olingo.odata4.client.core.edm.xml.v3.SchemaImpl;
-
-public class EdmMetadataImpl extends AbstractEdmMetadata {
-
- private static final long serialVersionUID = -7765327879691528010L;
-
- public EdmMetadataImpl(final ODataClient client, final InputStream inputStream) {
- super(client, inputStream);
- }
-
- @Override
- public SchemaImpl getSchema(final int index) {
- return (SchemaImpl) super.getSchema(index);
- }
-
- @Override
- public SchemaImpl getSchema(final String key) {
- return (SchemaImpl) super.getSchema(key);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public List<SchemaImpl> getSchemas() {
- return (List<SchemaImpl>) super.getSchemas();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmServiceMetadataImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmServiceMetadataImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmServiceMetadataImpl.java
new file mode 100644
index 0000000..1b84dcb
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmServiceMetadataImpl.java
@@ -0,0 +1,52 @@
+/*
+ * 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.odata4.client.core.edm.v3;
+
+import java.util.Collections;
+import java.util.List;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmServiceMetadataImpl;
+import org.apache.olingo.odata4.client.core.edm.xml.v3.XMLMetadataImpl;
+import org.apache.olingo.odata4.commons.api.edm.EdmActionImportInfo;
+import org.apache.olingo.odata4.commons.api.edm.EdmSingletonInfo;
+import org.apache.olingo.odata4.commons.api.edm.constants.ODataServiceVersion;
+
+public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl {
+
+ private static final ODataServiceVersion SERVICE_VERSION = ODataServiceVersion.V30;
+
+ public EdmServiceMetadataImpl(final XMLMetadataImpl xmlMetadata) {
+ super(xmlMetadata);
+ }
+
+ @Override
+ public String getDataServiceVersion() {
+ return SERVICE_VERSION.toString();
+ }
+
+ @Override
+ public List<EdmSingletonInfo> getSingletonInfos() {
+ return Collections.<EdmSingletonInfo>emptyList();
+ }
+
+ @Override
+ public List<EdmActionImportInfo> getActionImportInfos() {
+ return Collections.<EdmActionImportInfo>emptyList();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmTypeImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmTypeImpl.java
index 551c4ef..18216c6 100644
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmTypeImpl.java
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v3/EdmTypeImpl.java
@@ -18,7 +18,8 @@
*/
package org.apache.olingo.odata4.client.core.edm.v3;
-import org.apache.olingo.odata4.client.core.edm.AbstractEdmType;
+import org.apache.olingo.odata4.client.api.edm.xml.XMLMetadata;
+import org.apache.olingo.odata4.client.core.edm.xml.AbstractEdmType;
import org.apache.olingo.odata4.client.core.edm.xml.v3.ComplexTypeImpl;
import org.apache.olingo.odata4.client.core.edm.xml.v3.EntityTypeImpl;
import org.apache.olingo.odata4.client.core.edm.xml.v3.EnumTypeImpl;
@@ -29,7 +30,7 @@ public class EdmTypeImpl extends AbstractEdmType {
super(typeExpression);
}
- public EdmTypeImpl(final EdmMetadataImpl metadata, final String typeExpression) {
+ public EdmTypeImpl(final XMLMetadata metadata, final String typeExpression) {
super(metadata, typeExpression);
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmMetadataImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmMetadataImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmMetadataImpl.java
deleted file mode 100644
index e572985..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmMetadataImpl.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.odata4.client.core.edm.v4;
-
-import java.io.InputStream;
-import java.util.List;
-import org.apache.olingo.odata4.client.api.ODataClient;
-import org.apache.olingo.odata4.client.core.edm.AbstractEdmMetadata;
-import org.apache.olingo.odata4.client.core.edm.xml.v4.EdmxImpl;
-import org.apache.olingo.odata4.client.core.edm.xml.v4.ReferenceImpl;
-import org.apache.olingo.odata4.client.core.edm.xml.v4.SchemaImpl;
-
-public class EdmMetadataImpl extends AbstractEdmMetadata {
-
- private static final long serialVersionUID = -7765327879691528010L;
-
- public EdmMetadataImpl(final ODataClient client, final InputStream inputStream) {
- super(client, inputStream);
- }
-
- @Override
- public SchemaImpl getSchema(final int index) {
- return (SchemaImpl) super.getSchema(index);
- }
-
- @Override
- public SchemaImpl getSchema(final String key) {
- return (SchemaImpl) super.getSchema(key);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public List<SchemaImpl> getSchemas() {
- return (List<SchemaImpl>) super.getSchemas();
- }
-
- public List<ReferenceImpl> getReferences() {
- return ((EdmxImpl) this.edmx).getReferences();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmServiceMetadataImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmServiceMetadataImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmServiceMetadataImpl.java
new file mode 100644
index 0000000..2f797ee
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmServiceMetadataImpl.java
@@ -0,0 +1,83 @@
+/*
+ * 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.odata4.client.core.edm.v4;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.xml.Schema;
+import org.apache.olingo.odata4.client.api.edm.xml.v4.ActionImport;
+import org.apache.olingo.odata4.client.api.edm.xml.v4.EntityContainer;
+import org.apache.olingo.odata4.client.api.edm.xml.v4.Singleton;
+import org.apache.olingo.odata4.client.core.edm.AbstractEdmServiceMetadataImpl;
+import org.apache.olingo.odata4.client.core.edm.xml.v4.XMLMetadataImpl;
+import org.apache.olingo.odata4.commons.api.edm.EdmActionImportInfo;
+import org.apache.olingo.odata4.commons.api.edm.EdmSingletonInfo;
+import org.apache.olingo.odata4.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.odata4.commons.core.edm.EdmActionImportInfoImpl;
+import org.apache.olingo.odata4.commons.core.edm.EdmSingletonInfoImpl;
+
+public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl {
+
+ private static final ODataServiceVersion SERVICE_VERSION = ODataServiceVersion.V40;
+
+ private List<EdmSingletonInfo> singletonInfos;
+
+ private List<EdmActionImportInfo> actionImportInfos;
+
+ public EdmServiceMetadataImpl(final XMLMetadataImpl xmlMetadata) {
+ super(xmlMetadata);
+ }
+
+ @Override
+ public String getDataServiceVersion() {
+ return SERVICE_VERSION.toString();
+ }
+
+ @Override
+ public List<EdmSingletonInfo> getSingletonInfos() {
+ synchronized (this) {
+ if (singletonInfos == null) {
+ singletonInfos = new ArrayList<EdmSingletonInfo>();
+ for (Schema schema : xmlMetadata.getSchemas()) {
+ final EntityContainer entityContainer = (EntityContainer) schema.getDefaultEntityContainer();
+ for (Singleton singleton : entityContainer.getSingletons()) {
+ singletonInfos.add(new EdmSingletonInfoImpl(entityContainer.getName(), singleton.getName()));
+ }
+ }
+ }
+ return singletonInfos;
+ }
+ }
+
+ @Override
+ public List<EdmActionImportInfo> getActionImportInfos() {
+ synchronized (this) {
+ if (actionImportInfos == null) {
+ actionImportInfos = new ArrayList<EdmActionImportInfo>();
+ for (Schema schema : xmlMetadata.getSchemas()) {
+ final EntityContainer entityContainer = (EntityContainer) schema.getDefaultEntityContainer();
+ for (ActionImport actionImport : entityContainer.getActionImports()) {
+ actionImportInfos.add(new EdmActionImportInfoImpl(entityContainer.getName(), actionImport.getName()));
+ }
+ }
+ }
+ return actionImportInfos;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmTypeImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmTypeImpl.java
index e71efef..c693f9c 100644
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmTypeImpl.java
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/EdmTypeImpl.java
@@ -18,7 +18,8 @@
*/
package org.apache.olingo.odata4.client.core.edm.v4;
-import org.apache.olingo.odata4.client.core.edm.AbstractEdmType;
+import org.apache.olingo.odata4.client.api.edm.xml.XMLMetadata;
+import org.apache.olingo.odata4.client.core.edm.xml.AbstractEdmType;
import org.apache.olingo.odata4.client.core.edm.xml.v4.ComplexTypeImpl;
import org.apache.olingo.odata4.client.core.edm.xml.v4.EntityTypeImpl;
import org.apache.olingo.odata4.client.core.edm.xml.v4.EnumTypeImpl;
@@ -29,7 +30,7 @@ public class EdmTypeImpl extends AbstractEdmType {
super(typeExpression);
}
- public EdmTypeImpl(final EdmMetadataImpl metadata, final String typeExpression) {
+ public EdmTypeImpl(final XMLMetadata metadata, final String typeExpression) {
super(metadata, typeExpression);
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AbstractElOrAttrConstruct.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AbstractElOrAttrConstruct.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AbstractElOrAttrConstruct.java
deleted file mode 100644
index 8f3365f..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AbstractElOrAttrConstruct.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.odata4.client.core.edm.v4.annotation;
-
-/**
- * Groups dynamic expressions that may be provided using element notation or attribute notation.
- */
-abstract class AbstractElOrAttrConstruct extends DynExprConstructImpl {
-
- private static final long serialVersionUID = 5503275111425750339L;
-
- private String value;
-
- public String getValue() {
- return value;
- }
-
- public void setValue(final String value) {
- this.value = value;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AnnotatedDynExprConstruct.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AnnotatedDynExprConstruct.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AnnotatedDynExprConstruct.java
deleted file mode 100644
index b32dcae..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AnnotatedDynExprConstruct.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.odata4.client.core.edm.v4.annotation;
-
-import org.apache.olingo.odata4.client.api.edm.xml.v4.Annotation;
-import org.apache.olingo.odata4.client.api.edm.xml.v4.AnnotatedEdmItem;
-import org.apache.olingo.odata4.client.core.edm.xml.v4.AnnotationImpl;
-
-abstract class AnnotatedDynExprConstruct extends DynExprConstructImpl implements AnnotatedEdmItem {
-
- private static final long serialVersionUID = -8117155475397749038L;
-
- private AnnotationImpl annotation;
-
- @Override
- public AnnotationImpl getAnnotation() {
- return annotation;
- }
-
- @Override
- public void setAnnotation(final Annotation annotation) {
- this.annotation = (AnnotationImpl) annotation;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AnnotationPath.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AnnotationPath.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AnnotationPath.java
deleted file mode 100644
index f04778c..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/AnnotationPath.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.odata4.client.core.edm.v4.annotation;
-
-public class AnnotationPath extends AbstractElOrAttrConstruct {
-
- private static final long serialVersionUID = 6198019768659098819L;
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Apply.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Apply.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Apply.java
deleted file mode 100644
index 8d49884..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Apply.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.odata4.client.core.edm.v4.annotation;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.olingo.odata4.client.api.edm.xml.v4.annotation.ExprConstruct;
-
-@JsonDeserialize(using = ApplyDeserializer.class)
-public class Apply extends AnnotatedDynExprConstruct {
-
- private static final long serialVersionUID = 6198019768659098819L;
-
- public static final String CANONICAL_FUNCTION_CONCAT = "odata.concat";
-
- public static final String CANONICAL_FUNCTION_FILLURITEMPLATE = "odata.fillUriTemplate";
-
- public static final String CANONICAL_FUNCTION_URIENCODE = "odata.uriEncode";
-
- private String function;
-
- private final List<ExprConstruct> parameters = new ArrayList<ExprConstruct>();
-
- public String getFunction() {
- return function;
- }
-
- public void setFunction(final String function) {
- this.function = function;
- }
-
- public List<ExprConstruct> getParameters() {
- return parameters;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ApplyDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ApplyDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ApplyDeserializer.java
deleted file mode 100644
index 6468685..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ApplyDeserializer.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.odata4.client.core.edm.v4.annotation;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import java.io.IOException;
-import org.apache.olingo.odata4.client.core.op.impl.AbstractEdmDeserializer;
-import org.apache.olingo.odata4.client.core.edm.xml.v4.AnnotationImpl;
-
-public class ApplyDeserializer extends AbstractEdmDeserializer<Apply> {
-
- @Override
- protected Apply doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
-
- final Apply apply = new Apply();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Function".equals(jp.getCurrentName())) {
- apply.setFunction(jp.nextTextValue());
- } else if ("Annotation".equals(jp.getCurrentName())) {
- apply.setAnnotation(jp.readValueAs(AnnotationImpl.class));
- } else if (isAnnotationConstExprConstruct(jp)) {
- apply.getParameters().add(parseAnnotationConstExprConstruct(jp));
- } else {
- apply.getParameters().add(jp.readValueAs(DynExprConstructImpl.class));
- }
- }
- }
-
- return apply;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Cast.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Cast.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Cast.java
deleted file mode 100644
index 970d33f..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Cast.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.odata4.client.core.edm.v4.annotation;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import java.math.BigInteger;
-import org.apache.olingo.odata4.client.api.edm.xml.v4.annotation.DynExprConstruct;
-
-@JsonDeserialize(using = CastDeserializer.class)
-public class Cast extends AnnotatedDynExprConstruct {
-
- private static final long serialVersionUID = -7836626668653004926L;
-
- private String type;
-
- private String maxLength;
-
- private BigInteger precision;
-
- private BigInteger scale;
-
- private String srid;
-
- private DynExprConstruct value;
-
- public String getType() {
- return type;
- }
-
- public void setType(final String type) {
- this.type = type;
- }
-
- public String getMaxLength() {
- return maxLength;
- }
-
- public void setMaxLength(final String maxLength) {
- this.maxLength = maxLength;
- }
-
- public BigInteger getPrecision() {
- return precision;
- }
-
- public void setPrecision(final BigInteger precision) {
- this.precision = precision;
- }
-
- public BigInteger getScale() {
- return scale;
- }
-
- public void setScale(final BigInteger scale) {
- this.scale = scale;
- }
-
- public String getSrid() {
- return srid;
- }
-
- public void setSrid(final String srid) {
- this.srid = srid;
- }
-
- public DynExprConstruct getValue() {
- return value;
- }
-
- public void setValue(final DynExprConstruct value) {
- this.value = value;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CastDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CastDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CastDeserializer.java
deleted file mode 100644
index a404944..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CastDeserializer.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.odata4.client.core.edm.v4.annotation;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import java.io.IOException;
-import java.math.BigInteger;
-import org.apache.olingo.odata4.client.core.op.impl.AbstractEdmDeserializer;
-import org.apache.olingo.odata4.client.core.edm.xml.v4.AnnotationImpl;
-
-public class CastDeserializer extends AbstractEdmDeserializer<Cast> {
-
- @Override
- protected Cast doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
-
- final Cast cast = new Cast();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if ("Type".equals(jp.getCurrentName())) {
- cast.setType(jp.nextTextValue());
- } else if ("Annotation".equals(jp.getCurrentName())) {
- cast.setAnnotation(jp.readValueAs(AnnotationImpl.class));
- } else if ("MaxLength".equals(jp.getCurrentName())) {
- cast.setMaxLength(jp.nextTextValue());
- } else if ("Precision".equals(jp.getCurrentName())) {
- cast.setPrecision(BigInteger.valueOf(jp.nextLongValue(0L)));
- } else if ("Scale".equals(jp.getCurrentName())) {
- cast.setScale(BigInteger.valueOf(jp.nextLongValue(0L)));
- } else if ("SRID".equals(jp.getCurrentName())) {
- cast.setSrid(jp.nextTextValue());
- } else {
- cast.setValue(jp.readValueAs(DynExprConstructImpl.class));
- }
- }
- }
-
- return cast;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Collection.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Collection.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Collection.java
deleted file mode 100644
index 62925d1..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/Collection.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.odata4.client.core.edm.v4.annotation;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.olingo.odata4.client.api.edm.xml.v4.annotation.ExprConstruct;
-
-@JsonDeserialize(using = CollectionDeserializer.class)
-public class Collection extends DynExprConstructImpl {
-
- private static final long serialVersionUID = -4975881520695477686L;
-
- private final List<ExprConstruct> items = new ArrayList<ExprConstruct>();
-
- public List<ExprConstruct> getItems() {
- return items;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CollectionDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CollectionDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CollectionDeserializer.java
deleted file mode 100644
index a16748f..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/CollectionDeserializer.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.odata4.client.core.edm.v4.annotation;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.JsonToken;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import java.io.IOException;
-import org.apache.olingo.odata4.client.core.op.impl.AbstractEdmDeserializer;
-
-public class CollectionDeserializer extends AbstractEdmDeserializer<Collection> {
-
- @Override
- protected Collection doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
- throws IOException, JsonProcessingException {
-
- final Collection collection = new Collection();
-
- for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
- final JsonToken token = jp.getCurrentToken();
- if (token == JsonToken.FIELD_NAME) {
- if (isAnnotationConstExprConstruct(jp)) {
- collection.getItems().add(parseAnnotationConstExprConstruct(jp));
- } else {
- collection.getItems().add(jp.readValueAs( DynExprConstructImpl.class));
- }
- }
- }
-
- return collection;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ConstExprConstructImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ConstExprConstructImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ConstExprConstructImpl.java
deleted file mode 100644
index 9d27cdb..0000000
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/v4/annotation/ConstExprConstructImpl.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.odata4.client.core.edm.v4.annotation;
-
-import org.apache.olingo.odata4.client.api.edm.xml.v4.annotation.ConstExprConstruct;
-
-public class ConstExprConstructImpl extends ExprConstructImpl implements ConstExprConstruct {
-
- private static final long serialVersionUID = 2250072064504668969L;
-
- private Type type;
-
- private String value;
-
- @Override
- public Type getType() {
- return type;
- }
-
- @Override
- public void setType(final Type type) {
- this.type = type;
- }
-
- @Override
- public String getValue() {
- return value;
- }
-
- @Override
- public void setValue(final String value) {
- this.value = value;
- }
-
-}