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/07 10:09:30 UTC
[41/57] [abbrv] [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-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmEnumType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmEnumType.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmEnumType.java
new file mode 100644
index 0000000..dd89349
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmEnumType.java
@@ -0,0 +1,205 @@
+/*
+ * 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.commons.core.edm;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+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.EdmPrimitiveTypeException;
+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.primitivetype.EdmInt64;
+
+public abstract class AbstractEdmEnumType extends EdmTypeImpl implements EdmEnumType {
+
+ private final boolean isFlags;
+
+ private final String uriPrefix;
+
+ private final String uriSuffix;
+
+ private List<String> memberNames;
+
+ private Map<String, EdmMember> members;
+
+ public AbstractEdmEnumType(final Edm edm, final FullQualifiedName fqn, final boolean isFlags) {
+ super(edm, fqn, EdmTypeKind.ENUM);
+
+ this.isFlags = isFlags;
+ this.uriPrefix = fqn.getFullQualifiedNameAsString() + '\'';
+ this.uriSuffix = "'";
+ }
+
+ protected abstract Collection<? extends EdmMember> getMembers();
+
+ @Override
+ public EdmMember getMember(final String name) {
+ if (members == null) {
+ members = new LinkedHashMap<String, EdmMember>();
+ for (final EdmMember member : getMembers()) {
+ members.put(member.getName(), member);
+ }
+ }
+ return members.get(name);
+ }
+
+ @Override
+ public List<String> getMemberNames() {
+ if (memberNames == null) {
+ memberNames = new ArrayList<String>();
+ for (final EdmMember member : getMembers()) {
+ memberNames.add(member.getName());
+ }
+ }
+ return memberNames;
+ }
+
+ @Override
+ public abstract EdmPrimitiveType getUnderlyingType();
+
+ @Override
+ public boolean isCompatible(final EdmPrimitiveType primitiveType) {
+ return equals(primitiveType);
+ }
+
+ @Override
+ public Class<?> getDefaultType() {
+ return getUnderlyingType().getDefaultType();
+ }
+
+ @Override
+ public boolean validate(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) {
+
+ try {
+ valueOfString(value, isNullable, maxLength, precision, scale, isUnicode, getDefaultType());
+ return true;
+ } catch (final EdmPrimitiveTypeException e) {
+ return false;
+ }
+ }
+
+ private Long parseEnumValue(final String value) throws EdmPrimitiveTypeException {
+ Long result = null;
+ for (final String memberValue : value.split(",", isFlags ? -1 : 1)) {
+ Long memberValueLong = null;
+ for (final EdmMember member : getMembers()) {
+ if (member.getName().equals(memberValue) || member.getValue().equals(memberValue)) {
+ memberValueLong = Long.decode(member.getValue());
+ }
+ }
+ if (memberValueLong == null) {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)");
+ }
+ result = result == null ? memberValueLong : result | memberValueLong;
+ }
+ return result;
+ }
+
+ @Override
+ public <T> T valueOfString(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode, final Class<T> returnType)
+ throws EdmPrimitiveTypeException {
+
+ if (value == null) {
+ if (isNullable != null && !isNullable) {
+ throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_NULL_NOT_ALLOWED");
+ }
+ return null;
+ }
+
+ try {
+ return EdmInt64.convertNumber(parseEnumValue(value), returnType);
+ } catch (final IllegalArgumentException e) {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.LITERAL_UNCONVERTIBLE_TO_VALUE_TYPE.addContent(value, returnType), e");
+ } catch (final ClassCastException e) {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType), e");
+ }
+ }
+
+ protected String constructEnumValue(final long value) throws EdmPrimitiveTypeException {
+ long remaining = value;
+ StringBuilder result = new StringBuilder();
+
+ for (final EdmMember member : getMembers()) {
+ final long memberValue = Long.parseLong(member.getValue());
+ if ((memberValue & remaining) == memberValue) {
+ if (result.length() > 0) {
+ result.append(',');
+ }
+ result.append(member.getName());
+ remaining ^= memberValue;
+ }
+ }
+
+ if (remaining != 0) {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_ILLEGAL_CONTENT.addContent(value)");
+ }
+ return result.toString();
+ }
+
+ @Override
+ public String valueToString(final Object value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (value == null) {
+ if (isNullable != null && !isNullable) {
+ throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.VALUE_NULL_NOT_ALLOWED");
+ }
+ return null;
+ }
+ if (value instanceof Byte || value instanceof Short || value instanceof Integer || value instanceof Long) {
+ return constructEnumValue(((Number) value).longValue());
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
+ }
+
+ @Override
+ public String toUriLiteral(final String literal) {
+ return literal == null ? null
+ : uriPrefix.isEmpty() && uriSuffix.isEmpty() ? literal : uriPrefix + literal + uriSuffix;
+ }
+
+ @Override
+ public String fromUriLiteral(final String literal) throws EdmPrimitiveTypeException {
+ if (literal == null) {
+ return null;
+ } else if (uriPrefix.isEmpty() && uriSuffix.isEmpty()) {
+ return literal;
+ } else if (literal.length() >= uriPrefix.length() + uriSuffix.length()
+ && literal.startsWith(uriPrefix) && literal.endsWith(uriSuffix)) {
+ return literal.substring(uriPrefix.length(), literal.length() - uriSuffix.length());
+ } else {
+ throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(literal)");
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmImpl.java
index 29d9b04..34eba4b 100644
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmImpl.java
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmImpl.java
@@ -65,7 +65,7 @@ public abstract class AbstractEdmImpl implements Edm {
private EdmServiceMetadata serviceMetadata;
private Map<String, String> aliasToNamespaceInfo;
-
+
@Override
public EdmEntityContainer getEntityContainer(final FullQualifiedName namespaceOrAliasFQN) {
final FullQualifiedName fqn = resolvePossibleAlias(namespaceOrAliasFQN);
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmKeyPropertyRef.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmKeyPropertyRef.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmKeyPropertyRef.java
new file mode 100644
index 0000000..157dd73
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmKeyPropertyRef.java
@@ -0,0 +1,80 @@
+/*
+ * 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.commons.core.edm;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.commons.api.edm.EdmException;
+import org.apache.olingo.odata4.commons.api.edm.EdmKeyPropertyRef;
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmStructuredType;
+
+public abstract class AbstractEdmKeyPropertyRef implements EdmKeyPropertyRef {
+
+ private final EdmEntityType edmEntityType;
+
+ private EdmProperty property;
+
+ public AbstractEdmKeyPropertyRef(final EdmEntityType edmEntityType) {
+ this.edmEntityType = edmEntityType;
+ }
+
+ @Override
+ public abstract String getKeyPropertyName();
+
+ @Override
+ public abstract String getAlias();
+
+ @Override
+ public abstract String getPath();
+
+ @Override
+ public EdmProperty getProperty() {
+ if (property == null) {
+ if (getAlias() == null) {
+ property = edmEntityType.getStructuralProperty(getKeyPropertyName());
+ if (property == null) {
+ throw new EdmException("Invalid key property ref specified. Can´t find property with name: "
+ + getKeyPropertyName());
+ }
+ } else {
+ if (getPath() == null || getPath().isEmpty()) {
+ throw new EdmException("Alias but no path specified for propertyRef");
+ }
+ final String[] splitPath = getPath().split("/");
+ EdmStructuredType structType = edmEntityType;
+ for (int i = 0; i < splitPath.length - 1; i++) {
+ final EdmProperty _property = structType.getStructuralProperty(splitPath[i]);
+ if (_property == null) {
+ throw new EdmException("Invalid property ref specified. Can´t find property with name: " + splitPath[i]
+ + " at type: " + structType.getNamespace() + "." + structType.getName());
+ }
+ structType = (EdmStructuredType) _property.getType();
+ }
+ property = structType.getStructuralProperty(splitPath[splitPath.length - 1]);
+ if (property == null) {
+ throw new EdmException("Invalid property ref specified. Can´t find property with name: "
+ + splitPath[splitPath.length - 1] + " at type: " + structType.getNamespace() + "."
+ + structType.getName());
+ }
+ }
+ }
+
+ return property;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmNavigationProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmNavigationProperty.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmNavigationProperty.java
new file mode 100644
index 0000000..3140ef7
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmNavigationProperty.java
@@ -0,0 +1,76 @@
+/*
+ * 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.commons.core.edm;
+
+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.EdmException;
+import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmStructuredType;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+
+public abstract class AbstractEdmNavigationProperty extends EdmElementImpl implements EdmNavigationProperty {
+
+ private EdmEntityType typeImpl;
+
+ private EdmNavigationProperty partnerNavigationProperty;
+
+ public AbstractEdmNavigationProperty(final Edm edm, final String name) {
+ super(edm, name);
+ }
+
+ protected abstract FullQualifiedName getTypeFQN();
+
+ @Override
+ public EdmType getType() {
+ if (typeImpl == null) {
+ typeImpl = edm.getEntityType(getTypeFQN());
+ if (typeImpl == null) {
+ throw new EdmException("Cannot find type with name: " + getTypeFQN());
+ }
+ }
+ return typeImpl;
+ }
+
+ protected abstract String internatGetPartner();
+
+ @Override
+ public EdmNavigationProperty getPartner() {
+ if (partnerNavigationProperty == null) {
+ String partner = internatGetPartner();
+ if (partner != null) {
+ EdmStructuredType type = (EdmStructuredType) getType();
+ EdmNavigationProperty property = null;
+ final String[] split = partner.split("/");
+ for (String element : split) {
+ property = type.getNavigationProperty(element);
+ if (property == null) {
+ throw new EdmException("Cannot find property with name: " + element + " at type " + type.getName());
+ }
+ type = (EdmStructuredType) property.getType();
+ }
+ partnerNavigationProperty = property;
+ }
+ }
+ return partnerNavigationProperty;
+ }
+
+ public abstract String getReferencingPropertyName(String referencedPropertyName);
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmOperation.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmOperation.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmOperation.java
new file mode 100644
index 0000000..933714f
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmOperation.java
@@ -0,0 +1,113 @@
+/*
+ * 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.commons.core.edm;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmBindingTarget;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.odata4.commons.api.edm.EdmException;
+import org.apache.olingo.odata4.commons.api.edm.EdmOperation;
+import org.apache.olingo.odata4.commons.api.edm.EdmParameter;
+import org.apache.olingo.odata4.commons.api.edm.EdmReturnType;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
+
+public abstract class AbstractEdmOperation extends EdmTypeImpl implements EdmOperation {
+
+ private final Map<String, EdmParameter> parameters = new LinkedHashMap<String, EdmParameter>();
+
+ private String entitySetPath;
+
+ private boolean isBound;
+
+ private EdmReturnType returnType;
+
+ private List<String> parameterNames;
+
+ protected AbstractEdmOperation(final Edm edm, final FullQualifiedName fqn, final EdmTypeKind kind) {
+ super(edm, fqn, kind);
+ }
+
+ protected void setParameters(final List<EdmParameter> _parameters) {
+ for (EdmParameter parameter : _parameters) {
+ parameters.put(parameter.getName(), parameter);
+ }
+ }
+
+ protected void setEntitySetPath(final String entitySetPath) {
+ this.entitySetPath = entitySetPath;
+ }
+
+ protected void setIsBound(final boolean isBound) {
+ this.isBound = isBound;
+ }
+
+ protected void setReturnType(final EdmReturnType returnType) {
+ this.returnType = returnType;
+ }
+
+ @Override
+ public EdmParameter getParameter(final String name) {
+ return parameters.get(name);
+ }
+
+ @Override
+ public List<String> getParameterNames() {
+ if (parameterNames == null) {
+ parameterNames = new ArrayList<String>(parameters.size());
+ for (String parameterName : parameters.keySet()) {
+ parameterNames.add(parameterName);
+ }
+ }
+ return parameterNames;
+ }
+
+ @Override
+ public EdmEntitySet getReturnedEntitySet(final EdmEntitySet bindingParameterEntitySet) {
+ EdmEntitySet returnedEntitySet = null;
+ if (bindingParameterEntitySet != null && entitySetPath != null) {
+ final EdmBindingTarget relatedBindingTarget = bindingParameterEntitySet.
+ getRelatedBindingTarget(entitySetPath);
+ if (relatedBindingTarget == null) {
+ throw new EdmException("Cannot find entity set with path: " + entitySetPath);
+ }
+ if (relatedBindingTarget instanceof EdmEntitySet) {
+ returnedEntitySet = (EdmEntitySet) relatedBindingTarget;
+ } else {
+ throw new EdmException("BindingTarget with name: " + relatedBindingTarget.getName() + " must be an entity set");
+ }
+ }
+ return returnedEntitySet;
+ }
+
+ @Override
+ public EdmReturnType getReturnType() {
+ return returnType;
+ }
+
+ @Override
+ public boolean isBound() {
+ return isBound;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmOperationImport.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmOperationImport.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmOperationImport.java
new file mode 100644
index 0000000..07bfb7c
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmOperationImport.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.commons.core.edm;
+
+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.EdmEntitySet;
+import org.apache.olingo.odata4.commons.api.edm.EdmException;
+import org.apache.olingo.odata4.commons.api.edm.EdmOperationImport;
+import org.apache.olingo.odata4.commons.api.edm.Target;
+
+public abstract class AbstractEdmOperationImport extends EdmNamedImpl implements EdmOperationImport {
+
+ protected final EdmEntityContainer container;
+
+ private final Target entitySet;
+
+ private EdmEntitySet returnedEntitySet;
+
+ public AbstractEdmOperationImport(final Edm edm, final EdmEntityContainer container, final String name,
+ final Target entitySet) {
+
+ super(edm, name);
+ this.container = container;
+ this.entitySet = entitySet;
+ }
+
+ @Override
+ public EdmEntitySet getReturnedEntitySet() {
+ if (entitySet != null && returnedEntitySet == null) {
+ EdmEntityContainer entityContainer = edm.getEntityContainer(entitySet.getEntityContainer());
+ if (entityContainer == null) {
+ throw new EdmException("Can´t find entity container with name: " + entitySet.getEntityContainer());
+ }
+ returnedEntitySet = entityContainer.getEntitySet(entitySet.getTargetName());
+ if (returnedEntitySet == null) {
+ throw new EdmException("Can´t find entity set with name: " + entitySet.getTargetName());
+ }
+ }
+ return returnedEntitySet;
+ }
+
+ @Override
+ public EdmEntityContainer getEntityContainer() {
+ return container;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmParameter.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmParameter.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmParameter.java
new file mode 100644
index 0000000..e4adb41
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmParameter.java
@@ -0,0 +1,87 @@
+/*
+ * 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.commons.core.edm;
+
+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.EdmMapping;
+import org.apache.olingo.odata4.commons.api.edm.EdmParameter;
+import org.apache.olingo.odata4.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+
+public abstract class AbstractEdmParameter extends EdmElementImpl implements EdmParameter {
+
+ private final FullQualifiedName paramType;
+
+ private EdmType typeImpl;
+
+ public AbstractEdmParameter(final Edm edm, final String name, final FullQualifiedName paramType) {
+ super(edm, name);
+ this.paramType = paramType;
+ }
+
+ @Override
+ public EdmType getType() {
+ if (typeImpl == null) {
+ if (EdmPrimitiveType.EDM_NAMESPACE.equals(paramType.getNamespace())) {
+ try {
+ typeImpl = EdmPrimitiveTypeKind.valueOf(paramType.getName()).getEdmPrimitiveTypeInstance();
+ } catch (IllegalArgumentException e) {
+ throw new EdmException("Cannot find type with name: " + paramType, e);
+ }
+ } else {
+ typeImpl = edm.getComplexType(paramType);
+ if (typeImpl == null) {
+ typeImpl = edm.getEntityType(paramType);
+ if (typeImpl == null) {
+ typeImpl = edm.getEnumType(paramType);
+ if (typeImpl == null) {
+ typeImpl = edm.getTypeDefinition(paramType);
+ if (typeImpl == null) {
+ throw new EdmException("Cannot find type with name: " + paramType);
+ }
+ }
+ }
+ }
+ }
+ }
+ return typeImpl;
+ }
+
+ @Override
+ public abstract boolean isCollection();
+
+ @Override
+ public abstract EdmMapping getMapping();
+
+ @Override
+ public abstract Boolean isNullable();
+
+ @Override
+ public abstract Integer getMaxLength();
+
+ @Override
+ public abstract Integer getPrecision();
+
+ @Override
+ public abstract Integer getScale();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmProperty.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmProperty.java
new file mode 100644
index 0000000..ba28f6c
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmProperty.java
@@ -0,0 +1,70 @@
+/*
+ * 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.commons.core.edm;
+
+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.EdmProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+
+public abstract class AbstractEdmProperty extends EdmElementImpl implements EdmProperty {
+
+ private EdmType propertyType;
+
+ public AbstractEdmProperty(final Edm edm, final String name) {
+ super(edm, name);
+ }
+
+ protected abstract FullQualifiedName getTypeFQN();
+
+ @Override
+ public boolean isPrimitive() {
+ return EdmPrimitiveType.EDM_NAMESPACE.equals(getTypeFQN().getNamespace());
+ }
+
+ @Override
+ public EdmType getType() {
+ if (propertyType == null) {
+ final FullQualifiedName typeName = getTypeFQN();
+ if (isPrimitive()) {
+ try {
+ propertyType = EdmPrimitiveTypeKind.valueOf(typeName.getName()).getEdmPrimitiveTypeInstance();
+ } catch (IllegalArgumentException e) {
+ throw new EdmException("Cannot find type with name: " + typeName, e);
+ }
+ } else {
+ propertyType = edm.getComplexType(typeName);
+ if (propertyType == null) {
+ propertyType = edm.getEnumType(typeName);
+ if (propertyType == null) {
+ propertyType = edm.getTypeDefinition(typeName);
+ if (propertyType == null) {
+ throw new EdmException("Cannot find type with name: " + typeName);
+ }
+ }
+ }
+ }
+ }
+
+ return propertyType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmReturnType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmReturnType.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmReturnType.java
new file mode 100644
index 0000000..7f2fb39
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmReturnType.java
@@ -0,0 +1,85 @@
+/*
+ * 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.commons.core.edm;
+
+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.EdmReturnType;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+
+public abstract class AbstractEdmReturnType implements EdmReturnType {
+
+ private final Edm edm;
+
+ private final FullQualifiedName typeName;
+
+ private EdmType typeImpl;
+
+ public AbstractEdmReturnType(final Edm edm, final FullQualifiedName typeName) {
+ this.edm = edm;
+ this.typeName = typeName;
+ }
+
+ @Override
+ public EdmType getType() {
+ if (typeImpl == null) {
+ if (EdmPrimitiveType.EDM_NAMESPACE.equals(typeName.getNamespace())) {
+ try {
+ typeImpl = EdmPrimitiveTypeKind.valueOf(typeName.getName()).getEdmPrimitiveTypeInstance();
+ } catch (IllegalArgumentException e) {
+ throw new EdmException("Cannot find type with name: " + typeName, e);
+ }
+ } else {
+ typeImpl = edm.getComplexType(typeName);
+ if (typeImpl == null) {
+ typeImpl = edm.getEntityType(typeName);
+ if (typeImpl == null) {
+ typeImpl = edm.getEnumType(typeName);
+ if (typeImpl == null) {
+ typeImpl = edm.getTypeDefinition(typeName);
+ if (typeImpl == null) {
+ throw new EdmException("Cant find type with name: " + typeName);
+ }
+ }
+ }
+ }
+ }
+ }
+ return typeImpl;
+ }
+
+ @Override
+ public abstract Boolean isNullable();
+
+ @Override
+ public abstract Integer getMaxLength();
+
+ @Override
+ public abstract Integer getPrecision();
+
+ @Override
+ public abstract Integer getScale();
+
+ @Override
+ public abstract boolean isCollection();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmStructuredType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmStructuredType.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmStructuredType.java
new file mode 100644
index 0000000..2a3df7c
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmStructuredType.java
@@ -0,0 +1,128 @@
+/*
+ * 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.commons.core.edm;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmElement;
+import org.apache.olingo.odata4.commons.api.edm.EdmException;
+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.EdmStructuredType;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
+
+public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements EdmStructuredType {
+
+ protected EdmStructuredType baseType;
+
+ private List<String> propertyNames;
+
+ private List<String> navigationPropertyNames;
+
+ public AbstractEdmStructuredType(final Edm edm, final FullQualifiedName fqn, final EdmTypeKind kind,
+ final FullQualifiedName baseTypeName) {
+
+ super(edm, fqn, kind);
+ }
+
+ protected abstract EdmStructuredType buildBaseType(FullQualifiedName baseTypeName);
+
+ protected abstract Map<String, EdmProperty> getProperties();
+
+ protected abstract Map<String, EdmNavigationProperty> getNavigationProperties();
+
+ @Override
+ public List<String> getPropertyNames() {
+ if (propertyNames == null) {
+ propertyNames = new ArrayList<String>();
+ if (baseType != null) {
+ propertyNames.addAll(baseType.getPropertyNames());
+ }
+ propertyNames.addAll(getProperties().keySet());
+ }
+ return propertyNames;
+ }
+
+ @Override
+ public List<String> getNavigationPropertyNames() {
+ if (navigationPropertyNames == null) {
+ navigationPropertyNames = new ArrayList<String>();
+ if (baseType != null) {
+ navigationPropertyNames.addAll(baseType.getNavigationPropertyNames());
+ }
+ navigationPropertyNames.addAll(getNavigationProperties().keySet());
+ }
+ return navigationPropertyNames;
+ }
+
+ @Override
+ public EdmElement getProperty(final String name) {
+ EdmElement property = getStructuralProperty(name);
+ if (property == null) {
+ property = getNavigationProperty(name);
+ }
+ return property;
+ }
+
+ @Override
+ public EdmProperty getStructuralProperty(final String name) {
+ EdmProperty property = null;
+ if (baseType != null) {
+ property = baseType.getStructuralProperty(name);
+ }
+ if (property == null) {
+ property = getProperties().get(name);
+ }
+ return property;
+ }
+
+ @Override
+ public EdmNavigationProperty getNavigationProperty(final String name) {
+ EdmNavigationProperty property = null;
+ if (baseType != null) {
+ property = baseType.getNavigationProperty(name);
+ }
+ if (property == null) {
+ property = getNavigationProperties().get(name);
+ }
+ return property;
+ }
+
+ @Override
+ public boolean compatibleTo(final EdmType targetType) {
+ EdmStructuredType sourceType = this;
+ if (targetType == null) {
+ throw new EdmException("Target type must not be null");
+ }
+ while (!sourceType.getName().equals(targetType.getName())
+ || !sourceType.getNamespace().equals(targetType.getNamespace())) {
+
+ sourceType = sourceType.getBaseType();
+ if (sourceType == null) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmTypeDefinition.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmTypeDefinition.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmTypeDefinition.java
new file mode 100644
index 0000000..6a4c03a
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/AbstractEdmTypeDefinition.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.commons.core.edm;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.odata4.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.odata4.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
+
+public abstract class AbstractEdmTypeDefinition extends EdmNamedImpl implements EdmTypeDefinition {
+
+ private final String namespace;
+
+ public AbstractEdmTypeDefinition(final Edm edm, final FullQualifiedName typeDefinitionName) {
+ super(edm, typeDefinitionName.getName());
+ this.namespace = typeDefinitionName.getNamespace();
+ }
+
+ @Override
+ public abstract EdmPrimitiveType getUnderlyingType();
+
+ @Override
+ public boolean isCompatible(final EdmPrimitiveType primitiveType) {
+ return getUnderlyingType().isCompatible(primitiveType);
+ }
+
+ @Override
+ public Class<?> getDefaultType() {
+ return getUnderlyingType().getDefaultType();
+ }
+
+ @Override
+ public boolean validate(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale,
+ final Boolean isUnicode) {
+
+ return getUnderlyingType().validate(value, isNullable, maxLength, precision, scale, isUnicode);
+ }
+
+ @Override
+ public <T> T valueOfString(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale,
+ final Boolean isUnicode, final Class<T> returnType) throws EdmPrimitiveTypeException {
+
+ return getUnderlyingType().
+ valueOfString(value, isNullable, maxLength, precision, scale, isUnicode, returnType);
+ }
+
+ @Override
+ public String valueToString(final Object value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale,
+ final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ return getUnderlyingType().valueToString(value, isNullable, maxLength, precision, scale, isUnicode);
+ }
+
+ @Override
+ public String toUriLiteral(final String literal) {
+ return getUnderlyingType().toUriLiteral(literal);
+ }
+
+ @Override
+ public String fromUriLiteral(final String literal) throws EdmPrimitiveTypeException {
+ return getUnderlyingType().fromUriLiteral(literal);
+ }
+
+ @Override
+ public String getNamespace() {
+ return namespace;
+ }
+
+ @Override
+ public EdmTypeKind getKind() {
+ return EdmTypeKind.DEFINITION;
+ }
+
+ @Override
+ public abstract Integer getMaxLength();
+
+ @Override
+ public abstract Integer getPrecision();
+
+ @Override
+ public abstract Integer getScale();
+
+ @Override
+ public abstract Boolean isUnicode();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmActionImportInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmActionImportInfoImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmActionImportInfoImpl.java
new file mode 100644
index 0000000..4e60a7f
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmActionImportInfoImpl.java
@@ -0,0 +1,45 @@
+/*
+ * 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.commons.core.edm;
+
+import java.net.URI;
+import org.apache.olingo.odata4.commons.api.edm.EdmActionImportInfo;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmException;
+
+public class EdmActionImportInfoImpl extends EdmOperationImportInfoImpl implements EdmActionImportInfo {
+
+ private String actionImportName;
+
+ public EdmActionImportInfoImpl(final String entityContainerName, final String actionImportName) {
+ super(entityContainerName);
+ this.actionImportName = actionImportName;
+ }
+
+ @Override
+ public String getActionImportName() {
+ return actionImportName;
+ }
+
+ @Override
+ public URI getActionImportUri() {
+ throw new EdmException("Not yet implemented");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmElementImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmElementImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmElementImpl.java
new file mode 100644
index 0000000..d931853
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmElementImpl.java
@@ -0,0 +1,29 @@
+/*
+ * 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.commons.core.edm;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmElement;
+
+public abstract class EdmElementImpl extends EdmNamedImpl implements EdmElement {
+
+ public EdmElementImpl(final Edm edm, final String name) {
+ super(edm, name);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmEntitySetInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmEntitySetInfoImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmEntitySetInfoImpl.java
new file mode 100644
index 0000000..768960a
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmEntitySetInfoImpl.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.commons.core.edm;
+
+import java.net.URI;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmEntitySetInfo;
+import org.apache.olingo.odata4.commons.api.edm.EdmException;
+
+public class EdmEntitySetInfoImpl implements EdmEntitySetInfo {
+
+ private final String entityContainerName;
+
+ private final String entitySetName;
+
+ public EdmEntitySetInfoImpl(final String entityContainerName, final String entitySetName) {
+ this.entityContainerName = entityContainerName;
+ this.entitySetName = entitySetName;
+ }
+
+ @Override
+ public String getEntityContainerName() {
+ return entityContainerName;
+ }
+
+ @Override
+ public String getEntitySetName() {
+ return entitySetName;
+ }
+
+ @Override
+ public URI getEntitySetUri() {
+ throw new EdmException("Not yet implemented");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmFunctionImportInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmFunctionImportInfoImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmFunctionImportInfoImpl.java
new file mode 100644
index 0000000..7facfe1
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmFunctionImportInfoImpl.java
@@ -0,0 +1,45 @@
+/*
+ * 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.commons.core.edm;
+
+import java.net.URI;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmException;
+import org.apache.olingo.odata4.commons.api.edm.EdmFunctionImportInfo;
+
+public class EdmFunctionImportInfoImpl extends EdmOperationImportInfoImpl implements EdmFunctionImportInfo {
+
+ private String functionImportName;
+
+ public EdmFunctionImportInfoImpl(final String entityContainerName, final String functionImportName) {
+ super(entityContainerName);
+ this.functionImportName = functionImportName;
+ }
+
+ @Override
+ public String getFunctionImportName() {
+ return functionImportName;
+ }
+
+ @Override
+ public URI getFunctionImportUri() {
+ throw new EdmException("Not yet implemented");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmMemberImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmMemberImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmMemberImpl.java
new file mode 100644
index 0000000..7e6c998
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmMemberImpl.java
@@ -0,0 +1,38 @@
+/*
+ * 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.commons.core.edm;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmMember;
+
+public class EdmMemberImpl extends EdmNamedImpl implements EdmMember {
+
+ private final String value;
+
+ public EdmMemberImpl(final Edm edm, final String name, final String value) {
+ super(edm, name);
+ this.value = value;
+ }
+
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmNamedImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmNamedImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmNamedImpl.java
new file mode 100644
index 0000000..5f0ac2c
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmNamedImpl.java
@@ -0,0 +1,40 @@
+/*
+ * 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.commons.core.edm;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmNamed;
+
+public abstract class EdmNamedImpl implements EdmNamed {
+
+ protected final Edm edm;
+
+ private final String name;
+
+ public EdmNamedImpl(final Edm edm, final String name) {
+ this.edm = edm;
+ this.name = name;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmOperationImportInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmOperationImportInfoImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmOperationImportInfoImpl.java
new file mode 100644
index 0000000..334669b
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmOperationImportInfoImpl.java
@@ -0,0 +1,36 @@
+/*
+ * 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.commons.core.edm;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmOperationImportInfo;
+
+public abstract class EdmOperationImportInfoImpl implements EdmOperationImportInfo {
+
+ protected String entityContainerName;
+
+ public EdmOperationImportInfoImpl(final String entityContainerName) {
+ this.entityContainerName = entityContainerName;
+ }
+
+ @Override
+ public String getEntityContainerName() {
+ return this.entityContainerName;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmSingletonInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmSingletonInfoImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmSingletonInfoImpl.java
new file mode 100644
index 0000000..6cb8a26
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmSingletonInfoImpl.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.commons.core.edm;
+
+import java.net.URI;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmException;
+import org.apache.olingo.odata4.commons.api.edm.EdmSingletonInfo;
+
+public class EdmSingletonInfoImpl implements EdmSingletonInfo {
+
+ private final String entityContainerName;
+
+ private final String singletonName;
+
+ public EdmSingletonInfoImpl(final String entityContainerName, final String singletonName) {
+ this.entityContainerName = entityContainerName;
+ this.singletonName = singletonName;
+ }
+
+ @Override
+ public String getEntityContainerName() {
+ return entityContainerName;
+ }
+
+ @Override
+ public String getSingletonName() {
+ return singletonName;
+ }
+
+ @Override
+ public URI getEntitySetUri() {
+ throw new EdmException("Not yet implemented");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmStructuredTypeHelper.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmStructuredTypeHelper.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmStructuredTypeHelper.java
new file mode 100644
index 0000000..8b732aa
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmStructuredTypeHelper.java
@@ -0,0 +1,30 @@
+/*
+ * 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.commons.core.edm;
+
+import java.util.Map;
+import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+
+public interface EdmStructuredTypeHelper {
+
+ Map<String, EdmProperty> getProperties();
+
+ Map<String, EdmNavigationProperty> getNavigationProperties();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmTypeImpl.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmTypeImpl.java
new file mode 100644
index 0000000..c2f635a
--- /dev/null
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/EdmTypeImpl.java
@@ -0,0 +1,48 @@
+/*
+ * 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.commons.core.edm;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
+
+public class EdmTypeImpl extends EdmNamedImpl implements EdmType {
+
+ protected final FullQualifiedName fqn;
+
+ protected final EdmTypeKind kind;
+
+ public EdmTypeImpl(final Edm edm, final FullQualifiedName fqn, final EdmTypeKind kind) {
+ super(edm, fqn.getName());
+ this.fqn = fqn;
+ this.kind = kind;
+ }
+
+ @Override
+ public String getNamespace() {
+ return fqn.getNamespace();
+ }
+
+ @Override
+ public EdmTypeKind getKind() {
+ return kind;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/primitivetype/EdmPrimitiveTypeKind.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/primitivetype/EdmPrimitiveTypeKind.java b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/primitivetype/EdmPrimitiveTypeKind.java
index 88f4379..2b0b08f 100644
--- a/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/primitivetype/EdmPrimitiveTypeKind.java
+++ b/odata4-lib/odata4-commons-core/src/main/java/org/apache/olingo/odata4/commons/core/edm/primitivetype/EdmPrimitiveTypeKind.java
@@ -79,4 +79,20 @@ public enum EdmPrimitiveTypeKind {
throw new RuntimeException("Wrong type:" + this);
}
}
+
+ /**
+ * Gets <tt>EdmPrimitiveTypeKind</tt> from a full string (e.g. 'Edm.Int32').
+ *
+ * @param value string value type.
+ * @return <tt>EdmPrimitiveTypeKind</tt> object.
+ */
+ public static EdmPrimitiveTypeKind fromString(final String value) {
+ final String noNsValue = value.substring(4);
+ for (EdmPrimitiveTypeKind edmSimpleType : EdmPrimitiveTypeKind.values()) {
+ if (edmSimpleType.name().equals(noNsValue)) {
+ return edmSimpleType;
+ }
+ }
+ throw new IllegalArgumentException(value);
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/ActionImport.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/ActionImport.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/ActionImport.java
index c9dd8c1..9311094 100644
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/ActionImport.java
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/ActionImport.java
@@ -19,6 +19,7 @@
package org.apache.olingo.odata4.server.api.edm.provider;
import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.edm.Target;
public class ActionImport extends OperationImport {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/ComplexType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/ComplexType.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/ComplexType.java
index 6e37a87..4857b37 100644
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/ComplexType.java
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/ComplexType.java
@@ -22,7 +22,7 @@ import java.util.List;
import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
-public class ComplexType extends StructuralType {
+public class ComplexType extends StructuredType {
@Override
public ComplexType setName(final String name) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/EntityType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/EntityType.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/EntityType.java
index 2265cff..dec7584 100644
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/EntityType.java
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/EntityType.java
@@ -22,7 +22,7 @@ import java.util.List;
import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
-public class EntityType extends StructuralType {
+public class EntityType extends StructuredType {
private List<PropertyRef> key;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/FunctionImport.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/FunctionImport.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/FunctionImport.java
index b403bd1..6b82bbe 100644
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/FunctionImport.java
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/FunctionImport.java
@@ -19,6 +19,7 @@
package org.apache.olingo.odata4.server.api.edm.provider;
import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.edm.Target;
public class FunctionImport extends OperationImport {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/NavigationPropertyBinding.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/NavigationPropertyBinding.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/NavigationPropertyBinding.java
index 2980a20..0e82a3c 100644
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/NavigationPropertyBinding.java
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/NavigationPropertyBinding.java
@@ -18,6 +18,8 @@
*/
package org.apache.olingo.odata4.server.api.edm.provider;
+import org.apache.olingo.odata4.commons.api.edm.Target;
+
public class NavigationPropertyBinding {
private String path;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/OperationImport.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/OperationImport.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/OperationImport.java
index e8850df..bd845bd 100644
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/OperationImport.java
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/OperationImport.java
@@ -18,9 +18,12 @@
*/
package org.apache.olingo.odata4.server.api.edm.provider;
+import org.apache.olingo.odata4.commons.api.edm.Target;
+
public abstract class OperationImport {
protected String name;
+
protected Target entitySet;
// Annotations?
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/StructuralType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/StructuralType.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/StructuralType.java
deleted file mode 100644
index 1d48b3b..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/StructuralType.java
+++ /dev/null
@@ -1,93 +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.server.api.edm.provider;
-
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
-
-public abstract class StructuralType {
-
- protected String name;
-
- protected boolean isOpenType;
-
- protected FullQualifiedName baseType;
-
- protected boolean isAbstract;
-
- protected List<Property> properties;
-
- protected List<NavigationProperty> navigationProperties;
-
- // What about mapping and annotations?
- public String getName() {
- return name;
- }
-
- public StructuralType setName(final String name) {
- this.name = name;
- return this;
- }
-
- public boolean isOpenType() {
- return isOpenType;
- }
-
- public StructuralType setOpenType(final boolean isOpenType) {
- this.isOpenType = isOpenType;
- return this;
- }
-
- public FullQualifiedName getBaseType() {
- return baseType;
- }
-
- public StructuralType setBaseType(final FullQualifiedName baseType) {
- this.baseType = baseType;
- return this;
- }
-
- public boolean isAbstract() {
- return isAbstract;
- }
-
- public StructuralType setAbstract(final boolean isAbstract) {
- this.isAbstract = isAbstract;
- return this;
- }
-
- public List<Property> getProperties() {
- return properties;
- }
-
- public StructuralType setProperties(final List<Property> properties) {
- this.properties = properties;
- return this;
- }
-
- public List<NavigationProperty> getNavigationProperties() {
- return navigationProperties;
- }
-
- public StructuralType setNavigationProperties(final List<NavigationProperty> navigationProperties) {
- this.navigationProperties = navigationProperties;
- return this;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/StructuredType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/StructuredType.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/StructuredType.java
new file mode 100644
index 0000000..f91e55e
--- /dev/null
+++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/StructuredType.java
@@ -0,0 +1,93 @@
+/*
+ * 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.server.api.edm.provider;
+
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+
+public abstract class StructuredType {
+
+ protected String name;
+
+ protected boolean isOpenType;
+
+ protected FullQualifiedName baseType;
+
+ protected boolean isAbstract;
+
+ protected List<Property> properties;
+
+ protected List<NavigationProperty> navigationProperties;
+
+ // What about mapping and annotations?
+ public String getName() {
+ return name;
+ }
+
+ public StructuredType setName(final String name) {
+ this.name = name;
+ return this;
+ }
+
+ public boolean isOpenType() {
+ return isOpenType;
+ }
+
+ public StructuredType setOpenType(final boolean isOpenType) {
+ this.isOpenType = isOpenType;
+ return this;
+ }
+
+ public FullQualifiedName getBaseType() {
+ return baseType;
+ }
+
+ public StructuredType setBaseType(final FullQualifiedName baseType) {
+ this.baseType = baseType;
+ return this;
+ }
+
+ public boolean isAbstract() {
+ return isAbstract;
+ }
+
+ public StructuredType setAbstract(final boolean isAbstract) {
+ this.isAbstract = isAbstract;
+ return this;
+ }
+
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ public StructuredType setProperties(final List<Property> properties) {
+ this.properties = properties;
+ return this;
+ }
+
+ public List<NavigationProperty> getNavigationProperties() {
+ return navigationProperties;
+ }
+
+ public StructuredType setNavigationProperties(final List<NavigationProperty> navigationProperties) {
+ this.navigationProperties = navigationProperties;
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/Target.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/Target.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/Target.java
deleted file mode 100644
index 57c400d..0000000
--- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/edm/provider/Target.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.odata4.server.api.edm.provider;
-
-import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
-
-public class Target {
-
- private String targetName;
-
- private FullQualifiedName entityContainer;
-
- public String getTargetName() {
- return targetName;
- }
-
- public Target setTargetName(final String targetPathName) {
- targetName = targetPathName;
- return this;
- }
-
- public FullQualifiedName getEntityContainer() {
- return entityContainer;
- }
-
- public Target setEntityContainer(final FullQualifiedName entityContainer) {
- this.entityContainer = entityContainer;
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/edm/provider/EdmActionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/edm/provider/EdmActionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/edm/provider/EdmActionImpl.java
index e669350..6f5d6fd 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/edm/provider/EdmActionImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/edm/provider/EdmActionImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.odata4.server.core.edm.provider;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
import org.apache.olingo.odata4.commons.api.edm.EdmAction;
import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
@@ -25,7 +26,11 @@ import org.apache.olingo.odata4.server.api.edm.provider.Action;
public class EdmActionImpl extends EdmOperationImpl implements EdmAction {
- public EdmActionImpl(final EdmProviderImpl edm, final FullQualifiedName name, final Action action) {
+ public static EdmActionImpl getInstance(final Edm edm, final FullQualifiedName name, final Action action) {
+ return EdmOperationImpl.getInstance(new EdmActionImpl(edm, name, action));
+ }
+
+ private EdmActionImpl(final Edm edm, final FullQualifiedName name, final Action action) {
super(edm, name, action, EdmTypeKind.ACTION);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/bae3d847/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/edm/provider/EdmActionImportImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/edm/provider/EdmActionImportImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/edm/provider/EdmActionImportImpl.java
index 34aca6d..691842d 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/edm/provider/EdmActionImportImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/edm/provider/EdmActionImportImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.odata4.server.core.edm.provider;
+import org.apache.olingo.odata4.commons.api.edm.Edm;
import org.apache.olingo.odata4.commons.api.edm.EdmAction;
import org.apache.olingo.odata4.commons.api.edm.EdmActionImport;
import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
@@ -27,9 +28,10 @@ public class EdmActionImportImpl extends EdmOperationImportImpl implements EdmAc
private final ActionImport actionImport;
- public EdmActionImportImpl(final EdmProviderImpl edm, final String name, final EdmEntityContainer container,
- final ActionImport actionImport) {
- super(edm, name, container, actionImport);
+ public EdmActionImportImpl(final Edm edm, final EdmEntityContainer container, final String name,
+ final ActionImport actionImport) {
+
+ super(edm, container, name, actionImport);
this.actionImport = actionImport;
}