mirror of
https://github.com/apache/olingo-odata4.git
synced 2025-02-06 18:18:55 +00:00
[OLINGO-575] Edm cleanup: Remove not necessary helper
This commit is contained in:
parent
4d059b94d6
commit
fcab8b0672
@ -19,14 +19,11 @@
|
|||||||
package org.apache.olingo.commons.core.edm.provider;
|
package org.apache.olingo.commons.core.edm.provider;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
import org.apache.olingo.commons.api.edm.EdmAnnotation;
|
||||||
import org.apache.olingo.commons.api.edm.EdmComplexType;
|
import org.apache.olingo.commons.api.edm.EdmComplexType;
|
||||||
import org.apache.olingo.commons.api.edm.EdmException;
|
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.EdmStructuredType;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTerm;
|
import org.apache.olingo.commons.api.edm.EdmTerm;
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
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 {
|
public class EdmComplexTypeImpl extends EdmStructuredTypeImpl implements EdmComplexType {
|
||||||
|
|
||||||
private final EdmStructuredTypeHelperImpl helper;
|
|
||||||
|
|
||||||
private EdmAnnotationHelperImpl annotationHelper;
|
private EdmAnnotationHelperImpl annotationHelper;
|
||||||
|
|
||||||
public static EdmComplexTypeImpl getInstance(
|
public static EdmComplexTypeImpl getInstance(
|
||||||
@ -45,31 +40,10 @@ public class EdmComplexTypeImpl extends EdmStructuredTypeImpl implements EdmComp
|
|||||||
}
|
}
|
||||||
|
|
||||||
private EdmComplexTypeImpl(final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
|
private EdmComplexTypeImpl(final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
|
||||||
super(edm, name, EdmTypeKind.COMPLEX, complexType.getBaseTypeFQN());
|
super(edm, name, EdmTypeKind.COMPLEX, complexType);
|
||||||
this.helper = new EdmStructuredTypeHelperImpl(edm, name, complexType);
|
|
||||||
this.annotationHelper = new EdmAnnotationHelperImpl(edm, 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
|
@Override
|
||||||
public EdmAnnotation getAnnotation(final EdmTerm term) {
|
public EdmAnnotation getAnnotation(final EdmTerm term) {
|
||||||
return annotationHelper == null ? null : annotationHelper.getAnnotation(term);
|
return annotationHelper == null ? null : annotationHelper.getAnnotation(term);
|
||||||
|
@ -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.EdmEntityType;
|
||||||
import org.apache.olingo.commons.api.edm.EdmException;
|
import org.apache.olingo.commons.api.edm.EdmException;
|
||||||
import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
|
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.EdmStructuredType;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTerm;
|
import org.apache.olingo.commons.api.edm.EdmTerm;
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
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 {
|
public class EdmEntityTypeImpl extends EdmStructuredTypeImpl implements EdmEntityType {
|
||||||
|
|
||||||
private final EdmStructuredTypeHelperImpl helper;
|
|
||||||
private EntityType entityType;
|
private EntityType entityType;
|
||||||
private boolean baseTypeChecked = false;
|
private boolean baseTypeChecked = false;
|
||||||
private EdmAnnotationHelperImpl annotationHelper;
|
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) {
|
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;
|
this.entityType = entityType;
|
||||||
helper = new EdmStructuredTypeHelperImpl(edm, name, entityType);
|
|
||||||
hasStream = entityType.hasStream();
|
hasStream = entityType.hasStream();
|
||||||
}
|
this.annotationHelper = new EdmAnnotationHelperImpl(edm, entityType);
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<String, EdmProperty> getProperties() {
|
|
||||||
return helper.getProperties();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Map<String, EdmNavigationProperty> getNavigationProperties() {
|
|
||||||
return helper.getNavigationProperties();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -165,16 +152,6 @@ public class EdmEntityTypeImpl extends EdmStructuredTypeImpl implements EdmEntit
|
|||||||
return TargetType.EntityType;
|
return TargetType.EntityType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpenType() {
|
|
||||||
return helper.isOpenType();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAbstract() {
|
|
||||||
return helper.isAbstract();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EdmAnnotation getAnnotation(final EdmTerm term) {
|
public EdmAnnotation getAnnotation(final EdmTerm term) {
|
||||||
return annotationHelper.getAnnotation(term);
|
return annotationHelper.getAnnotation(term);
|
||||||
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
@ -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.EdmType;
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
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.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public abstract class EdmStructuredTypeImpl extends EdmTypeImpl implements EdmStructuredType {
|
public abstract class EdmStructuredTypeImpl extends EdmTypeImpl implements EdmStructuredType {
|
||||||
|
|
||||||
protected EdmStructuredType baseType;
|
protected EdmStructuredType baseType;
|
||||||
|
|
||||||
protected FullQualifiedName baseTypeName;
|
protected FullQualifiedName baseTypeName;
|
||||||
|
|
||||||
private List<String> propertyNames;
|
private List<String> propertyNames;
|
||||||
|
|
||||||
private List<String> navigationPropertyNames;
|
private List<String> navigationPropertyNames;
|
||||||
|
private Map<String, EdmProperty> properties;
|
||||||
|
private Map<String, EdmNavigationProperty> navigationProperties;
|
||||||
|
private final StructuralType structuredType;
|
||||||
|
|
||||||
public EdmStructuredTypeImpl(
|
public EdmStructuredTypeImpl(
|
||||||
final Edm edm,
|
final Edm edm,
|
||||||
final FullQualifiedName typeName,
|
final FullQualifiedName typeName,
|
||||||
final EdmTypeKind kind,
|
final EdmTypeKind kind,
|
||||||
final FullQualifiedName baseTypeName) {
|
final StructuralType structuredType) {
|
||||||
|
|
||||||
super(edm, typeName, kind);
|
super(edm, typeName, kind);
|
||||||
this.baseTypeName = baseTypeName;
|
this.baseTypeName = structuredType.getBaseTypeFQN();
|
||||||
|
this.structuredType = structuredType;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract EdmStructuredType buildBaseType(FullQualifiedName baseTypeName);
|
protected abstract EdmStructuredType buildBaseType(FullQualifiedName baseTypeName);
|
||||||
|
|
||||||
protected abstract Map<String, EdmProperty> getProperties();
|
|
||||||
|
|
||||||
protected abstract Map<String, EdmNavigationProperty> getNavigationProperties();
|
|
||||||
|
|
||||||
protected abstract void checkBaseType();
|
protected abstract void checkBaseType();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -149,4 +151,34 @@ public abstract class EdmStructuredTypeImpl extends EdmTypeImpl implements EdmSt
|
|||||||
return getFullQualifiedName();
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user