[OLINGO-209] open type is both for complex and entity types
This commit is contained in:
parent
a6817f32f8
commit
251742312a
|
@ -57,9 +57,9 @@ import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
|
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
||||||
import org.apache.olingo.commons.core.edm.AbstractEdmImpl;
|
import org.apache.olingo.commons.core.edm.AbstractEdm;
|
||||||
|
|
||||||
public class EdmClientImpl extends AbstractEdmImpl {
|
public class EdmClientImpl extends AbstractEdm {
|
||||||
|
|
||||||
private final ODataServiceVersion version;
|
private final ODataServiceVersion version;
|
||||||
|
|
||||||
|
|
|
@ -64,4 +64,9 @@ public class EdmComplexTypeImpl extends AbstractEdmComplexType {
|
||||||
return helper.getNavigationProperties();
|
return helper.getNavigationProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOpenType() {
|
||||||
|
return helper.isOpenType();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,14 +61,11 @@ public class EdmEntityTypeImpl extends AbstractEdmEntityType {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final EntityType entityType;
|
|
||||||
|
|
||||||
private EdmEntityTypeImpl(final Edm edm, final FullQualifiedName fqn, final FullQualifiedName baseTypeName,
|
private EdmEntityTypeImpl(final Edm edm, final FullQualifiedName fqn, final FullQualifiedName baseTypeName,
|
||||||
final EntityType entityType) {
|
final EntityType entityType) {
|
||||||
|
|
||||||
super(edm, fqn, baseTypeName, entityType.isHasStream());
|
super(edm, fqn, baseTypeName, entityType.isHasStream());
|
||||||
this.helper = new EdmStructuredTypeHelperImpl(edm, entityType);
|
this.helper = new EdmStructuredTypeHelperImpl(edm, entityType);
|
||||||
this.entityType = entityType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -83,7 +80,7 @@ public class EdmEntityTypeImpl extends AbstractEdmEntityType {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpenType() {
|
public boolean isOpenType() {
|
||||||
return entityType.isOpenType();
|
return helper.isOpenType();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,9 +43,9 @@ import org.apache.olingo.commons.api.edm.EdmFunction;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
|
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
||||||
import org.apache.olingo.commons.core.edm.AbstractEdmSchemaImpl;
|
import org.apache.olingo.commons.core.edm.AbstractEdmSchema;
|
||||||
|
|
||||||
public class EdmSchemaImpl extends AbstractEdmSchemaImpl {
|
public class EdmSchemaImpl extends AbstractEdmSchema {
|
||||||
|
|
||||||
private final ODataServiceVersion version;
|
private final ODataServiceVersion version;
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.Map;
|
||||||
import org.apache.olingo.client.api.edm.xml.CommonNavigationProperty;
|
import org.apache.olingo.client.api.edm.xml.CommonNavigationProperty;
|
||||||
import org.apache.olingo.client.api.edm.xml.CommonProperty;
|
import org.apache.olingo.client.api.edm.xml.CommonProperty;
|
||||||
import org.apache.olingo.client.api.edm.xml.ComplexType;
|
import org.apache.olingo.client.api.edm.xml.ComplexType;
|
||||||
|
import org.apache.olingo.client.api.edm.xml.EntityType;
|
||||||
import org.apache.olingo.client.api.edm.xml.v4.NavigationProperty;
|
import org.apache.olingo.client.api.edm.xml.v4.NavigationProperty;
|
||||||
import org.apache.olingo.commons.api.edm.Edm;
|
import org.apache.olingo.commons.api.edm.Edm;
|
||||||
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
|
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
|
||||||
|
@ -69,4 +70,14 @@ public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
|
||||||
}
|
}
|
||||||
return navigationProperties;
|
return navigationProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOpenType() {
|
||||||
|
return complexType instanceof org.apache.olingo.client.api.edm.xml.v4.ComplexType
|
||||||
|
? ((org.apache.olingo.client.api.edm.xml.v4.ComplexType) complexType).isOpenType()
|
||||||
|
: complexType instanceof EntityType
|
||||||
|
? ((EntityType) complexType).isOpenType()
|
||||||
|
: false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,13 +54,6 @@ public interface EdmEntityType extends EdmStructuredType {
|
||||||
*/
|
*/
|
||||||
boolean hasStream();
|
boolean hasStream();
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates if the entity type is an open type.
|
|
||||||
*
|
|
||||||
* @return <code>true</code> if the entity type is open
|
|
||||||
*/
|
|
||||||
boolean isOpenType();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
|
|
@ -79,4 +79,11 @@ public interface EdmStructuredType extends EdmType {
|
||||||
* @return true if this type is compatible to the testType ( i.e. this type is a subtype of targetType )
|
* @return true if this type is compatible to the testType ( i.e. this type is a subtype of targetType )
|
||||||
*/
|
*/
|
||||||
boolean compatibleTo(EdmType targetType);
|
boolean compatibleTo(EdmType targetType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the entity type is an open type.
|
||||||
|
*
|
||||||
|
* @return <code>true</code> if the entity type is open
|
||||||
|
*/
|
||||||
|
boolean isOpenType();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
|
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
|
|
||||||
public abstract class AbstractEdmImpl implements Edm {
|
public abstract class AbstractEdm implements Edm {
|
||||||
|
|
||||||
private final Map<FullQualifiedName, EdmEntityContainer> entityContainers =
|
private final Map<FullQualifiedName, EdmEntityContainer> entityContainers =
|
||||||
new HashMap<FullQualifiedName, EdmEntityContainer>();
|
new HashMap<FullQualifiedName, EdmEntityContainer>();
|
|
@ -31,7 +31,7 @@ import org.apache.olingo.commons.api.edm.EdmSchema;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
|
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
|
|
||||||
public abstract class AbstractEdmSchemaImpl implements EdmSchema {
|
public abstract class AbstractEdmSchema implements EdmSchema {
|
||||||
|
|
||||||
protected final String namespace;
|
protected final String namespace;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public abstract class AbstractEdmSchemaImpl implements EdmSchema {
|
||||||
|
|
||||||
private EdmEntityContainer entityContainer;
|
private EdmEntityContainer entityContainer;
|
||||||
|
|
||||||
public AbstractEdmSchemaImpl(String namespace, String alias) {
|
public AbstractEdmSchema(String namespace, String alias) {
|
||||||
this.namespace = namespace;
|
this.namespace = namespace;
|
||||||
this.alias = alias;
|
this.alias = alias;
|
||||||
}
|
}
|
|
@ -35,8 +35,11 @@ import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
|
||||||
public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements EdmStructuredType {
|
public abstract class AbstractEdmStructuredType 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;
|
||||||
|
|
||||||
public AbstractEdmStructuredType(
|
public AbstractEdmStructuredType(
|
||||||
|
@ -135,4 +138,5 @@ public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements E
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,4 +28,7 @@ public interface EdmStructuredTypeHelper {
|
||||||
Map<String, EdmProperty> getProperties();
|
Map<String, EdmProperty> getProperties();
|
||||||
|
|
||||||
Map<String, EdmNavigationProperty> getNavigationProperties();
|
Map<String, EdmNavigationProperty> getNavigationProperties();
|
||||||
|
|
||||||
|
boolean isOpenType();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ import org.apache.olingo.commons.api.edm.EdmSchema;
|
||||||
import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
|
import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
|
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.core.edm.AbstractEdmImpl;
|
import org.apache.olingo.commons.core.edm.AbstractEdm;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ public class EdmImplCachingTest {
|
||||||
edm = new LocalEdm();
|
edm = new LocalEdm();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class LocalEdm extends AbstractEdmImpl {
|
private class LocalEdm extends AbstractEdm {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EdmEntityContainer createEntityContainer(final FullQualifiedName fqn) {
|
public EdmEntityContainer createEntityContainer(final FullQualifiedName fqn) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ import org.apache.olingo.commons.api.edm.EdmSchema;
|
||||||
import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
|
import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
|
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.core.edm.AbstractEdmImpl;
|
import org.apache.olingo.commons.core.edm.AbstractEdm;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ public class EdmImplCallCreateTest {
|
||||||
edm = new LocalEdm();
|
edm = new LocalEdm();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class LocalEdm extends AbstractEdmImpl {
|
private class LocalEdm extends AbstractEdm {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EdmEntityContainer createEntityContainer(final FullQualifiedName fqn) {
|
public EdmEntityContainer createEntityContainer(final FullQualifiedName fqn) {
|
||||||
|
|
|
@ -54,4 +54,9 @@ public class EdmComplexTypeImpl extends AbstractEdmComplexType {
|
||||||
return helper.getNavigationProperties();
|
return helper.getNavigationProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOpenType() {
|
||||||
|
return helper.isOpenType();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class EdmEntityTypeImpl extends AbstractEdmEntityType {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpenType() {
|
public boolean isOpenType() {
|
||||||
return entityType.isOpenType();
|
return helper.isOpenType();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.apache.olingo.commons.api.edm.EdmSchema;
|
||||||
import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
|
import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
|
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.core.edm.AbstractEdmImpl;
|
import org.apache.olingo.commons.core.edm.AbstractEdm;
|
||||||
import org.apache.olingo.server.api.edm.provider.Action;
|
import org.apache.olingo.server.api.edm.provider.Action;
|
||||||
import org.apache.olingo.server.api.edm.provider.AliasInfo;
|
import org.apache.olingo.server.api.edm.provider.AliasInfo;
|
||||||
import org.apache.olingo.server.api.edm.provider.ComplexType;
|
import org.apache.olingo.server.api.edm.provider.ComplexType;
|
||||||
|
@ -49,7 +49,7 @@ import org.apache.olingo.server.api.edm.provider.Parameter;
|
||||||
import org.apache.olingo.server.api.edm.provider.Schema;
|
import org.apache.olingo.server.api.edm.provider.Schema;
|
||||||
import org.apache.olingo.server.api.edm.provider.TypeDefinition;
|
import org.apache.olingo.server.api.edm.provider.TypeDefinition;
|
||||||
|
|
||||||
public class EdmProviderImpl extends AbstractEdmImpl {
|
public class EdmProviderImpl extends AbstractEdm {
|
||||||
|
|
||||||
private final EdmProvider provider;
|
private final EdmProvider provider;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.apache.olingo.commons.api.edm.EdmEnumType;
|
||||||
import org.apache.olingo.commons.api.edm.EdmFunction;
|
import org.apache.olingo.commons.api.edm.EdmFunction;
|
||||||
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
|
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
|
||||||
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
import org.apache.olingo.commons.api.edm.FullQualifiedName;
|
||||||
import org.apache.olingo.commons.core.edm.AbstractEdmSchemaImpl;
|
import org.apache.olingo.commons.core.edm.AbstractEdmSchema;
|
||||||
import org.apache.olingo.server.api.edm.provider.Action;
|
import org.apache.olingo.server.api.edm.provider.Action;
|
||||||
import org.apache.olingo.server.api.edm.provider.ComplexType;
|
import org.apache.olingo.server.api.edm.provider.ComplexType;
|
||||||
import org.apache.olingo.server.api.edm.provider.EdmProvider;
|
import org.apache.olingo.server.api.edm.provider.EdmProvider;
|
||||||
|
@ -40,7 +40,7 @@ import org.apache.olingo.server.api.edm.provider.Function;
|
||||||
import org.apache.olingo.server.api.edm.provider.Schema;
|
import org.apache.olingo.server.api.edm.provider.Schema;
|
||||||
import org.apache.olingo.server.api.edm.provider.TypeDefinition;
|
import org.apache.olingo.server.api.edm.provider.TypeDefinition;
|
||||||
|
|
||||||
public class EdmSchemaImpl extends AbstractEdmSchemaImpl {
|
public class EdmSchemaImpl extends AbstractEdmSchema {
|
||||||
|
|
||||||
private final Schema schema;
|
private final Schema schema;
|
||||||
private final Edm edm;
|
private final Edm edm;
|
||||||
|
|
|
@ -70,4 +70,10 @@ public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
|
||||||
}
|
}
|
||||||
return navigationProperties;
|
return navigationProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOpenType() {
|
||||||
|
return structuredType.isOpenType();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue