You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2015/03/26 07:44:55 UTC
olingo-odata4 git commit: [OLINGO-575] Edm cleanup: Remove not
necessary helper
Repository: olingo-odata4
Updated Branches:
refs/heads/master 4d059b94d -> fcab8b067
[OLINGO-575] Edm cleanup: Remove not necessary helper
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/fcab8b06
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/fcab8b06
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/fcab8b06
Branch: refs/heads/master
Commit: fcab8b06728303a80abedb28919cb442e4269c19
Parents: 4d059b9
Author: Michael Bolz <mi...@sap.com>
Authored: Thu Mar 26 07:33:23 2015 +0100
Committer: Michael Bolz <mi...@sap.com>
Committed: Thu Mar 26 07:33:23 2015 +0100
----------------------------------------------------------------------
.../core/edm/provider/EdmComplexTypeImpl.java | 28 +------
.../core/edm/provider/EdmEntityTypeImpl.java | 27 +------
.../provider/EdmStructuredTypeHelperImpl.java | 79 --------------------
.../edm/provider/EdmStructuredTypeImpl.java | 48 ++++++++++--
4 files changed, 43 insertions(+), 139 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fcab8b06/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmComplexTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmComplexTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmComplexTypeImpl.java
index 7fdc0b8..16ba237 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmComplexTypeImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmComplexTypeImpl.java
@@ -19,14 +19,11 @@
package org.apache.olingo.commons.core.edm.provider;
import java.util.List;
-import java.util.Map;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmAnnotation;
import org.apache.olingo.commons.api.edm.EdmComplexType;
import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmStructuredType;
import org.apache.olingo.commons.api.edm.EdmTerm;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
@@ -35,8 +32,6 @@ import org.apache.olingo.commons.api.edm.provider.ComplexType;
public class EdmComplexTypeImpl extends EdmStructuredTypeImpl implements EdmComplexType {
- private final EdmStructuredTypeHelperImpl helper;
-
private EdmAnnotationHelperImpl annotationHelper;
public static EdmComplexTypeImpl getInstance(
@@ -45,32 +40,11 @@ public class EdmComplexTypeImpl extends EdmStructuredTypeImpl implements EdmComp
}
private EdmComplexTypeImpl(final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
- super(edm, name, EdmTypeKind.COMPLEX, complexType.getBaseTypeFQN());
- this.helper = new EdmStructuredTypeHelperImpl(edm, name, complexType);
+ super(edm, name, EdmTypeKind.COMPLEX, complexType);
this.annotationHelper = new EdmAnnotationHelperImpl(edm, complexType);
}
@Override
- protected Map<String, EdmProperty> getProperties() {
- return helper.getProperties();
- }
-
- @Override
- protected Map<String, EdmNavigationProperty> getNavigationProperties() {
- return helper.getNavigationProperties();
- }
-
- @Override
- public boolean isOpenType() {
- return helper.isOpenType();
- }
-
- @Override
- public boolean isAbstract() {
- return helper.isAbstract();
- }
-
- @Override
public EdmAnnotation getAnnotation(final EdmTerm term) {
return annotationHelper == null ? null : annotationHelper.getAnnotation(term);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fcab8b06/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntityTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntityTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntityTypeImpl.java
index b561151..84445aa 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntityTypeImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmEntityTypeImpl.java
@@ -28,8 +28,6 @@ import org.apache.olingo.commons.api.edm.EdmAnnotation;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmException;
import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
-import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmStructuredType;
import org.apache.olingo.commons.api.edm.EdmTerm;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
@@ -39,7 +37,6 @@ import org.apache.olingo.commons.api.edm.provider.PropertyRef;
public class EdmEntityTypeImpl extends EdmStructuredTypeImpl implements EdmEntityType {
- private final EdmStructuredTypeHelperImpl helper;
private EntityType entityType;
private boolean baseTypeChecked = false;
private EdmAnnotationHelperImpl annotationHelper;
@@ -56,20 +53,10 @@ public class EdmEntityTypeImpl extends EdmStructuredTypeImpl implements EdmEntit
}
private EdmEntityTypeImpl(final Edm edm, final FullQualifiedName name, final EntityType entityType) {
- super(edm, name, EdmTypeKind.ENTITY, entityType.getBaseTypeFQN());
+ super(edm, name, EdmTypeKind.ENTITY, entityType);
this.entityType = entityType;
- helper = new EdmStructuredTypeHelperImpl(edm, name, entityType);
hasStream = entityType.hasStream();
- }
-
- @Override
- protected Map<String, EdmProperty> getProperties() {
- return helper.getProperties();
- }
-
- @Override
- protected Map<String, EdmNavigationProperty> getNavigationProperties() {
- return helper.getNavigationProperties();
+ this.annotationHelper = new EdmAnnotationHelperImpl(edm, entityType);
}
@Override
@@ -166,16 +153,6 @@ public class EdmEntityTypeImpl extends EdmStructuredTypeImpl implements EdmEntit
}
@Override
- public boolean isOpenType() {
- return helper.isOpenType();
- }
-
- @Override
- public boolean isAbstract() {
- return helper.isAbstract();
- }
-
- @Override
public EdmAnnotation getAnnotation(final EdmTerm term) {
return annotationHelper.getAnnotation(term);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fcab8b06/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmStructuredTypeHelperImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmStructuredTypeHelperImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmStructuredTypeHelperImpl.java
deleted file mode 100644
index 9a78bcd..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmStructuredTypeHelperImpl.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.commons.core.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.NavigationProperty;
-import org.apache.olingo.commons.api.edm.provider.Property;
-import org.apache.olingo.commons.api.edm.provider.StructuralType;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-public class EdmStructuredTypeHelperImpl {
-
- private final Edm edm;
- private final FullQualifiedName structuredTypeName;
- private final StructuralType structuredType;
- private Map<String, EdmProperty> properties;
- private Map<String, EdmNavigationProperty> navigationProperties;
-
- public EdmStructuredTypeHelperImpl(
- final Edm edm, final FullQualifiedName structuredTypeName, final StructuralType structuredType) {
- this.edm = edm;
- this.structuredTypeName = structuredTypeName;
- this.structuredType = structuredType;
- }
-
- public Map<String, EdmProperty> getProperties() {
- if (properties == null) {
- properties = new LinkedHashMap<String, EdmProperty>();
- if (structuredType.getProperties() != null) {
- for (Property property : structuredType.getProperties()) {
- properties.put(property.getName(), new EdmPropertyImpl(edm, structuredTypeName, property));
- }
- }
- }
- return properties;
- }
-
- public Map<String, EdmNavigationProperty> getNavigationProperties() {
- if (navigationProperties == null) {
- navigationProperties = new LinkedHashMap<String, EdmNavigationProperty>();
- if (structuredType.getNavigationProperties() != null) {
- for (NavigationProperty navigationProperty : structuredType.getNavigationProperties()) {
- navigationProperties.put(navigationProperty.getName(),
- new EdmNavigationPropertyImpl(edm, structuredTypeName, navigationProperty));
- }
- }
- }
- return navigationProperties;
- }
-
- public boolean isOpenType() {
- return structuredType.isOpenType();
- }
-
- public boolean isAbstract() {
- return structuredType.isAbstract();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fcab8b06/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmStructuredTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmStructuredTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmStructuredTypeImpl.java
index 893f3dc..014184d 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmStructuredTypeImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/provider/EdmStructuredTypeImpl.java
@@ -27,37 +27,39 @@ import org.apache.olingo.commons.api.edm.EdmStructuredType;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.commons.api.edm.provider.NavigationProperty;
+import org.apache.olingo.commons.api.edm.provider.Property;
+import org.apache.olingo.commons.api.edm.provider.StructuralType;
import java.util.ArrayList;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public abstract class EdmStructuredTypeImpl extends EdmTypeImpl implements EdmStructuredType {
protected EdmStructuredType baseType;
-
protected FullQualifiedName baseTypeName;
private List<String> propertyNames;
-
private List<String> navigationPropertyNames;
+ private Map<String, EdmProperty> properties;
+ private Map<String, EdmNavigationProperty> navigationProperties;
+ private final StructuralType structuredType;
public EdmStructuredTypeImpl(
final Edm edm,
final FullQualifiedName typeName,
final EdmTypeKind kind,
- final FullQualifiedName baseTypeName) {
+ final StructuralType structuredType) {
super(edm, typeName, kind);
- this.baseTypeName = baseTypeName;
+ this.baseTypeName = structuredType.getBaseTypeFQN();
+ this.structuredType = structuredType;
}
protected abstract EdmStructuredType buildBaseType(FullQualifiedName baseTypeName);
- protected abstract Map<String, EdmProperty> getProperties();
-
- protected abstract Map<String, EdmNavigationProperty> getNavigationProperties();
-
protected abstract void checkBaseType();
@Override
@@ -149,4 +151,34 @@ public abstract class EdmStructuredTypeImpl extends EdmTypeImpl implements EdmSt
return getFullQualifiedName();
}
+ public Map<String, EdmProperty> getProperties() {
+ if (properties == null) {
+ properties = new LinkedHashMap<String, EdmProperty>();
+ for (Property property : structuredType.getProperties()) {
+ properties.put(property.getName(), new EdmPropertyImpl(edm, typeName, property));
+ }
+ }
+ return properties;
+ }
+
+ public Map<String, EdmNavigationProperty> getNavigationProperties() {
+ if (navigationProperties == null) {
+ navigationProperties = new LinkedHashMap<String, EdmNavigationProperty>();
+ if (structuredType.getNavigationProperties() != null) {
+ for (NavigationProperty navigationProperty : structuredType.getNavigationProperties()) {
+ navigationProperties.put(navigationProperty.getName(),
+ new EdmNavigationPropertyImpl(edm, typeName, navigationProperty));
+ }
+ }
+ }
+ return navigationProperties;
+ }
+
+ public boolean isOpenType() {
+ return structuredType.isOpenType();
+ }
+
+ public boolean isAbstract() {
+ return structuredType.isAbstract();
+ }
}