[OLINGO-566] Refactor EdmKeyPropertyRef class

This commit is contained in:
Christian Amend 2015-02-06 16:54:55 +01:00
parent 6c4b3ea408
commit 9cf9490310
18 changed files with 90 additions and 131 deletions

View File

@ -364,7 +364,7 @@ public abstract class AbstractUtility {
final Map<String, String> res = new LinkedHashMap<String, String>();
for (EdmKeyPropertyRef pref : baseType.getKeyPropertyRefs()) {
res.put(pref.getKeyPropertyName(),
res.put(pref.getName(),
getJavaType(pref.getProperty().getType().getFullQualifiedName().toString()));
}

View File

@ -32,7 +32,7 @@ public class EdmKeyPropertyRefImpl extends AbstractEdmKeyPropertyRef {
}
@Override
public String getKeyPropertyName() {
public String getName() {
return propertyRef.getName();
}
@ -40,10 +40,4 @@ public class EdmKeyPropertyRefImpl extends AbstractEdmKeyPropertyRef {
public String getAlias() {
return propertyRef.getAlias();
}
@Override
public String getPath() {
throw new UnsupportedOperationException("Not supported in client code.");
}
}

View File

@ -251,7 +251,7 @@ public class MetadataTest extends AbstractTest {
entity.getProperty("ProductId").getType());
assertFalse(entity.getKeyPropertyRefs().isEmpty());
assertNotNull("ProductId", entity.getKeyPropertyRef("ProductId").getKeyPropertyName());
assertNotNull("ProductId", entity.getKeyPropertyRef("ProductId").getName());
}
@Test

View File

@ -24,20 +24,15 @@ package org.apache.olingo.commons.api.edm;
public interface EdmKeyPropertyRef {
/**
* @return name of the key predicate
* @return name of the key predicate. Can be a path in case the alias is set.
*/
String getKeyPropertyName();
String getName();
/**
* @return alias of this reference or null if not set
*/
String getAlias();
/**
* @return path to the property
*/
String getPath();
/**
* @return the property this property ref points to
*/

View File

@ -54,8 +54,8 @@ public abstract class AbstractEdmEntityType extends AbstractEdmStructuredType im
protected void setEdmKeyPropertyRef(final List<EdmKeyPropertyRef> edmKey) {
for (EdmKeyPropertyRef ref : edmKey) {
if (ref.getAlias() == null) {
keyPredicateNames.add(ref.getKeyPropertyName());
keyPropertyRefs.put(ref.getKeyPropertyName(), ref);
keyPredicateNames.add(ref.getName());
keyPropertyRefs.put(ref.getName(), ref);
} else {
keyPredicateNames.add(ref.getAlias());
keyPropertyRefs.put(ref.getAlias(), ref);

View File

@ -35,28 +35,25 @@ public abstract class AbstractEdmKeyPropertyRef implements EdmKeyPropertyRef {
}
@Override
public abstract String getKeyPropertyName();
public abstract String getName();
@Override
public abstract String getAlias();
@Override
public abstract String getPath();
@Override
public EdmProperty getProperty() {
if (property == null) {
if (getAlias() == null) {
property = edmEntityType.getStructuralProperty(getKeyPropertyName());
property = edmEntityType.getStructuralProperty(getName());
if (property == null) {
throw new EdmException("Invalid key property ref specified. Can´t find property with name: "
+ getKeyPropertyName());
+ getName());
}
} else {
if (getPath() == null || getPath().isEmpty()) {
if (getName() == null || getName().isEmpty()) {
throw new EdmException("Alias but no path specified for propertyRef");
}
final String[] splitPath = getPath().split("/");
final String[] splitPath = getName().split("/");
EdmStructuredType structType = edmEntityType;
for (int i = 0; i < splitPath.length - 1; i++) {
final EdmProperty _property = structType.getStructuralProperty(splitPath[i]);

View File

@ -20,27 +20,16 @@ package org.apache.olingo.server.api.edm.provider;
public class PropertyRef {
private String propertyName;
private String name;
private String alias;
private String path;
public String getPath() {
return path;
}
public PropertyRef setPath(final String path) {
this.path = path;
return this;
}
public String getPropertyName() {
return propertyName;
return name;
}
public PropertyRef setPropertyName(final String name) {
propertyName = name;
public PropertyRef setName(final String name) {
this.name = name;
return this;
}

View File

@ -32,7 +32,7 @@ public class EdmKeyPropertyRefImpl extends AbstractEdmKeyPropertyRef {
}
@Override
public String getKeyPropertyName() {
public String getName() {
return ref.getPropertyName();
}
@ -40,9 +40,4 @@ public class EdmKeyPropertyRefImpl extends AbstractEdmKeyPropertyRef {
public String getAlias() {
return ref.getAlias();
}
@Override
public String getPath() {
return ref.getPath();
}
}

View File

@ -555,13 +555,8 @@ public class MetadataDocumentXmlSerializer {
writer.writeStartElement(XML_KEY);
for (EdmKeyPropertyRef keyRef : keyPropertyRefs) {
writer.writeEmptyElement(XML_PROPERTY_REF);
final String keyName;
if (keyRef.getPath() != null) {
keyName = keyRef.getPath() + "/" + keyRef.getKeyPropertyName();
} else {
keyName = keyRef.getKeyPropertyName();
}
writer.writeAttribute(XML_NAME, keyName);
writer.writeAttribute(XML_NAME, keyRef.getName());
if (keyRef.getAlias() != null) {
writer.writeAttribute(XML_ALIAS, keyRef.getAlias());

View File

@ -621,7 +621,7 @@ public class UriValidator {
final List<String> keyPredicateNames = pathEntitySet.getEntityType().getKeyPredicateNames();
HashMap<String, EdmKeyPropertyRef> edmKeys = new HashMap<String, EdmKeyPropertyRef>();
for (EdmKeyPropertyRef key : pathEntitySet.getEntityType().getKeyPropertyRefs()) {
edmKeys.put(key.getKeyPropertyName(), key);
edmKeys.put(key.getName(), key);
final String alias = key.getAlias();
if (alias != null) {
edmKeys.put(alias, key);

View File

@ -49,7 +49,7 @@ public class EdmEntitySetImplTest {
final FullQualifiedName typeName = new FullQualifiedName("ns", "entityType");
final EntityType entityTypeProvider = new EntityType()
.setName(typeName.getName())
.setKey(Arrays.asList(new PropertyRef().setPropertyName("Id")));
.setKey(Arrays.asList(new PropertyRef().setName("Id")));
when(provider.getEntityType(typeName)).thenReturn(entityTypeProvider);
final FullQualifiedName containerName = new FullQualifiedName("ns", "container");

View File

@ -67,7 +67,7 @@ public class EdmEntityTypeImplTest {
properties.add(new Property().setName("Name").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
baseType.setProperties(properties);
List<PropertyRef> key = new ArrayList<PropertyRef>();
key.add(new PropertyRef().setPropertyName("Id"));
key.add(new PropertyRef().setName("Id"));
baseType.setKey(key);
List<NavigationProperty> navigationProperties = new ArrayList<NavigationProperty>();
navigationProperties.add(new NavigationProperty().setName("nav1"));
@ -108,9 +108,8 @@ public class EdmEntityTypeImplTest {
typeWithComplexKeyProperties.add(new Property().setName("Comp").setType(complexTypeName));
typeWithComplexKeyProvider.setProperties(typeWithComplexKeyProperties);
List<PropertyRef> keyForTypeWithComplexKey = new ArrayList<PropertyRef>();
keyForTypeWithComplexKey.add(new PropertyRef().setPropertyName("Id"));
keyForTypeWithComplexKey.add(new PropertyRef().setPropertyName("ComplexPropName").setAlias("alias").setPath(
"Comp/ComplexPropName"));
keyForTypeWithComplexKey.add(new PropertyRef().setName("Id"));
keyForTypeWithComplexKey.add(new PropertyRef().setName("Comp/ComplexPropName").setAlias("alias"));
typeWithComplexKeyProvider.setKey(keyForTypeWithComplexKey);
when(provider.getEntityType(typeWithComplexKeyName)).thenReturn(typeWithComplexKeyProvider);
@ -149,7 +148,7 @@ public class EdmEntityTypeImplTest {
typeProperties.add(new Property().setName("email").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
type.setProperties(typeProperties);
List<PropertyRef> key = new ArrayList<PropertyRef>();
key.add(new PropertyRef().setPropertyName("email"));
key.add(new PropertyRef().setName("email"));
type.setKey(key);
List<NavigationProperty> typeNavigationProperties = new ArrayList<NavigationProperty>();
typeNavigationProperties.add(new NavigationProperty().setName("nav2"));
@ -188,7 +187,7 @@ public class EdmEntityTypeImplTest {
properties.add(new Property().setName("Name").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
baseType.setProperties(properties);
List<PropertyRef> key = new ArrayList<PropertyRef>();
key.add(new PropertyRef().setPropertyName("Id"));
key.add(new PropertyRef().setName("Id"));
baseType.setKey(key);
List<NavigationProperty> navigationProperties = new ArrayList<NavigationProperty>();
navigationProperties.add(new NavigationProperty().setName("nav1"));
@ -242,7 +241,7 @@ public class EdmEntityTypeImplTest {
EdmKeyPropertyRef keyPropertyRef = typeWithComplexKey.getKeyPropertyRef("Id");
assertNotNull(keyPropertyRef);
assertEquals("Id", keyPropertyRef.getKeyPropertyName());
assertEquals("Id", keyPropertyRef.getName());
assertNull(keyPropertyRef.getAlias());
EdmProperty keyProperty = keyPropertyRef.getProperty();
assertNotNull(keyProperty);
@ -250,9 +249,8 @@ public class EdmEntityTypeImplTest {
keyPropertyRef = typeWithComplexKey.getKeyPropertyRef("alias");
assertNotNull(keyPropertyRef);
assertEquals("ComplexPropName", keyPropertyRef.getKeyPropertyName());
assertEquals("Comp/ComplexPropName", keyPropertyRef.getName());
assertEquals("alias", keyPropertyRef.getAlias());
assertEquals("Comp/ComplexPropName", keyPropertyRef.getPath());
keyProperty = keyPropertyRef.getProperty();
assertNotNull(keyProperty);
@ -270,7 +268,7 @@ public class EdmEntityTypeImplTest {
EdmKeyPropertyRef keyPropertyRef = baseType.getKeyPropertyRef("Id");
assertNotNull(keyPropertyRef);
assertEquals("Id", keyPropertyRef.getKeyPropertyName());
assertEquals("Id", keyPropertyRef.getName());
assertNull(keyPropertyRef.getAlias());
EdmProperty keyProperty = keyPropertyRef.getProperty();
@ -280,7 +278,7 @@ public class EdmEntityTypeImplTest {
List<EdmKeyPropertyRef> keyPropertyRefs = baseType.getKeyPropertyRefs();
assertNotNull(keyPropertyRefs);
assertEquals(1, keyPropertyRefs.size());
assertEquals("Id", keyPropertyRefs.get(0).getKeyPropertyName());
assertEquals("Id", keyPropertyRefs.get(0).getName());
}
@Test
@ -291,13 +289,13 @@ public class EdmEntityTypeImplTest {
EdmKeyPropertyRef keyPropertyRef = typeWithBaseType.getKeyPropertyRef("Id");
assertNotNull(keyPropertyRef);
assertEquals("Id", keyPropertyRef.getKeyPropertyName());
assertEquals("Id", keyPropertyRef.getName());
assertNull(keyPropertyRef.getAlias());
List<EdmKeyPropertyRef> keyPropertyRefs = typeWithBaseType.getKeyPropertyRefs();
assertNotNull(keyPropertyRefs);
assertEquals(1, keyPropertyRefs.size());
assertEquals("Id", keyPropertyRefs.get(0).getKeyPropertyName());
assertEquals("Id", keyPropertyRefs.get(0).getName());
assertTrue(keyPropertyRefs == typeWithBaseType.getKeyPropertyRefs());
}

View File

@ -38,14 +38,13 @@ public class EdmKeyPropertyRefImplTest {
@Test
public void noAlias() {
PropertyRef providerRef = new PropertyRef().setPropertyName("Id");
PropertyRef providerRef = new PropertyRef().setName("Id");
EdmEntityType etMock = mock(EdmEntityType.class);
EdmProperty keyPropertyMock = mock(EdmProperty.class);
when(etMock.getStructuralProperty("Id")).thenReturn(keyPropertyMock);
EdmKeyPropertyRef ref = new EdmKeyPropertyRefImpl(etMock, providerRef);
assertEquals("Id", ref.getKeyPropertyName());
assertEquals("Id", ref.getName());
assertNull(ref.getAlias());
assertNull(ref.getPath());
EdmProperty property = ref.getProperty();
assertNotNull(property);
@ -55,7 +54,7 @@ public class EdmKeyPropertyRefImplTest {
@Test
public void aliasForPropertyInComplexPropertyOneLevel() {
PropertyRef providerRef = new PropertyRef().setPropertyName("Id").setAlias("alias").setPath("comp/Id");
PropertyRef providerRef = new PropertyRef().setName("comp/Id").setAlias("alias");
EdmEntityType etMock = mock(EdmEntityType.class);
EdmProperty keyPropertyMock = mock(EdmProperty.class);
EdmProperty compMock = mock(EdmProperty.class);
@ -65,7 +64,6 @@ public class EdmKeyPropertyRefImplTest {
when(etMock.getStructuralProperty("comp")).thenReturn(compMock);
EdmKeyPropertyRef ref = new EdmKeyPropertyRefImpl(etMock, providerRef);
assertEquals("alias", ref.getAlias());
assertEquals("comp/Id", ref.getPath());
EdmProperty property = ref.getProperty();
assertNotNull(property);
@ -74,7 +72,7 @@ public class EdmKeyPropertyRefImplTest {
@Test(expected = EdmException.class)
public void aliasForPropertyInComplexPropertyButWrongPath() {
PropertyRef providerRef = new PropertyRef().setPropertyName("Id").setAlias("alias").setPath("comp/wrong");
PropertyRef providerRef = new PropertyRef().setName("comp/wrong").setAlias("alias");
EdmEntityType etMock = mock(EdmEntityType.class);
EdmProperty keyPropertyMock = mock(EdmProperty.class);
EdmElement compMock = mock(EdmProperty.class);
@ -87,7 +85,7 @@ public class EdmKeyPropertyRefImplTest {
@Test(expected = EdmException.class)
public void aliasForPropertyInComplexPropertyButWrongPath2() {
PropertyRef providerRef = new PropertyRef().setPropertyName("Id").setAlias("alias").setPath("wrong/Id");
PropertyRef providerRef = new PropertyRef().setName("wrong/Id").setAlias("alias");
EdmEntityType etMock = mock(EdmEntityType.class);
EdmProperty keyPropertyMock = mock(EdmProperty.class);
EdmElement compMock = mock(EdmProperty.class);
@ -100,7 +98,7 @@ public class EdmKeyPropertyRefImplTest {
@Test
public void aliasForPropertyInComplexPropertyTwoLevels() {
PropertyRef providerRef = new PropertyRef().setPropertyName("Id").setAlias("alias").setPath("comp/comp2/Id");
PropertyRef providerRef = new PropertyRef().setName("comp/comp2/Id").setAlias("alias");
EdmEntityType etMock = mock(EdmEntityType.class);
EdmProperty keyPropertyMock = mock(EdmProperty.class);
EdmProperty compMock = mock(EdmProperty.class);
@ -121,21 +119,21 @@ public class EdmKeyPropertyRefImplTest {
@Test(expected = EdmException.class)
public void oneKeyNoAliasButInvalidProperty() {
PropertyRef providerRef = new PropertyRef().setPropertyName("Id");
PropertyRef providerRef = new PropertyRef().setName("Id");
EdmKeyPropertyRef ref = new EdmKeyPropertyRefImpl(mock(EdmEntityType.class), providerRef);
ref.getProperty();
}
@Test(expected = EdmException.class)
public void aliasButNoPath() {
PropertyRef providerRef = new PropertyRef().setPropertyName("Id").setAlias("alias");
PropertyRef providerRef = new PropertyRef().setName("Id").setAlias("alias");
EdmKeyPropertyRef ref = new EdmKeyPropertyRefImpl(mock(EdmEntityType.class), providerRef);
ref.getProperty();
}
@Test(expected = EdmException.class)
public void aliasButEmptyPath() {
PropertyRef providerRef = new PropertyRef().setPropertyName("Id").setAlias("alias").setPath("");
PropertyRef providerRef = new PropertyRef().setName("").setAlias("alias");
EdmKeyPropertyRef ref = new EdmKeyPropertyRefImpl(mock(EdmEntityType.class), providerRef);
ref.getProperty();
}

View File

@ -50,7 +50,7 @@ public class EdmSingletonImplTest {
final FullQualifiedName typeName = new FullQualifiedName("ns", "entityType");
final EntityType entityTypeProvider = new EntityType()
.setName(typeName.getName())
.setKey(Arrays.asList(new PropertyRef().setPropertyName("Id")));
.setKey(Arrays.asList(new PropertyRef().setName("Id")));
when(provider.getEntityType(typeName)).thenReturn(entityTypeProvider);
final FullQualifiedName containerName = new FullQualifiedName("ns", "container");

View File

@ -318,7 +318,7 @@ public class MetadataDocumentXmlSerializerTest {
return new EntityType()
.setName("ETAbstractBase")
.setBaseType(nameETAbstract)
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setKey(Arrays.asList(new PropertyRef().setName("PropertyInt16")))
.setProperties(Arrays.asList(
propertyInt16_NotNullable));
}

View File

@ -84,7 +84,7 @@ public class EntityTypeProvider {
return new EntityType()
.setName("ETAllPrim")
.setKey(Arrays.asList(
new PropertyRef().setPropertyName("PropertyInt16")))
new PropertyRef().setName("PropertyInt16")))
.setProperties(Arrays.asList(
PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString,
PropertyProvider.propertyBoolean, PropertyProvider.propertyByte, PropertyProvider.propertySByte,
@ -99,7 +99,7 @@ public class EntityTypeProvider {
} else if (entityTypeName.equals(nameETCollAllPrim)) {
return new EntityType()
.setName("ETCollAllPrim")
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setKey(Arrays.asList(new PropertyRef().setName("PropertyInt16")))
.setProperties(
Arrays.asList(
@ -120,7 +120,7 @@ public class EntityTypeProvider {
} else if (entityTypeName.equals(nameETTwoPrim)) {
return new EntityType()
.setName("ETTwoPrim")
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setKey(Arrays.asList(new PropertyRef().setName("PropertyInt16")))
.setProperties(Arrays.asList(
PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString))
.setNavigationProperties(
@ -130,7 +130,7 @@ public class EntityTypeProvider {
} else if (entityTypeName.equals(nameETMixPrimCollComp)) {
return new EntityType()
.setName("ETMixPrimCollComp")
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setKey(Arrays.asList(new PropertyRef().setName("PropertyInt16")))
.setProperties(Arrays.asList(
PropertyProvider.propertyInt16_NotNullable, PropertyProvider.collPropertyString,
PropertyProvider.propertyComp_CTTwoPrim, PropertyProvider.collPropertyComp_CTTwoPrim));
@ -139,10 +139,10 @@ public class EntityTypeProvider {
return new EntityType()
.setName("ETTwoKeyTwoPrim")
.setKey(Arrays.asList(
new PropertyRef().setPropertyName("PropertyInt16"),
new PropertyRef().setPropertyName("PropertyString")))
new PropertyRef().setName("PropertyInt16"),
new PropertyRef().setName("PropertyString")))
.setProperties(Arrays.asList(
PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString));
PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString_NotNullable));
} else if (entityTypeName.equals(nameETBaseTwoKeyTwoPrim)) {
return new EntityType()
@ -175,19 +175,19 @@ public class EntityTypeProvider {
return new EntityType()
.setName("ETAllKey")
.setKey(Arrays.asList(
new PropertyRef().setPropertyName("PropertyString"),
new PropertyRef().setPropertyName("PropertyBoolean"),
new PropertyRef().setPropertyName("PropertyByte"),
new PropertyRef().setPropertyName("PropertySByte"),
new PropertyRef().setPropertyName("PropertyInt16"),
new PropertyRef().setPropertyName("PropertyInt32"),
new PropertyRef().setPropertyName("PropertyInt64"),
new PropertyRef().setPropertyName("PropertyDecimal"),
new PropertyRef().setPropertyName("PropertyDate"),
new PropertyRef().setPropertyName("PropertyDateTimeOffset"),
new PropertyRef().setPropertyName("PropertyDuration"),
new PropertyRef().setPropertyName("PropertyGuid"),
new PropertyRef().setPropertyName("PropertyTimeOfDay")))
new PropertyRef().setName("PropertyString"),
new PropertyRef().setName("PropertyBoolean"),
new PropertyRef().setName("PropertyByte"),
new PropertyRef().setName("PropertySByte"),
new PropertyRef().setName("PropertyInt16"),
new PropertyRef().setName("PropertyInt32"),
new PropertyRef().setName("PropertyInt64"),
new PropertyRef().setName("PropertyDecimal"),
new PropertyRef().setName("PropertyDate"),
new PropertyRef().setName("PropertyDateTimeOffset"),
new PropertyRef().setName("PropertyDuration"),
new PropertyRef().setName("PropertyGuid"),
new PropertyRef().setName("PropertyTimeOfDay")))
.setProperties(
Arrays.asList(
PropertyProvider.propertyString_NotNullable, PropertyProvider.propertyBoolean_NotNullable,
@ -202,14 +202,14 @@ public class EntityTypeProvider {
} else if (entityTypeName.equals(nameETCompAllPrim)) {
return new EntityType()
.setName("ETCompAllPrim")
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setKey(Arrays.asList(new PropertyRef().setName("PropertyInt16")))
.setProperties(
Arrays.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComp_CTAllPrim));
} else if (entityTypeName.equals(nameETCompCollAllPrim)) {
return new EntityType()
.setName("ETCompCollAllPrim")
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setKey(Arrays.asList(new PropertyRef().setName("PropertyInt16")))
.setProperties(
Arrays.asList(PropertyProvider.propertyInt16_NotNullable,
@ -218,14 +218,14 @@ public class EntityTypeProvider {
} else if (entityTypeName.equals(nameETCompComp)) {
return new EntityType()
.setName("ETCompComp")
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setKey(Arrays.asList(new PropertyRef().setName("PropertyInt16")))
.setProperties(
Arrays.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComp_CTCompComp));
} else if (entityTypeName.equals(nameETCompCollComp)) {
return new EntityType()
.setName("ETCompCollComp")
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setKey(Arrays.asList(new PropertyRef().setName("PropertyInt16")))
.setProperties(
Arrays
.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComp_CTCompCollComp));
@ -233,7 +233,7 @@ public class EntityTypeProvider {
} else if (entityTypeName.equals(nameETMedia)) {
return new EntityType()
.setName("ETMedia")
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setKey(Arrays.asList(new PropertyRef().setName("PropertyInt16")))
.setProperties(Arrays.asList(PropertyProvider.propertyInt16_NotNullable))
.setHasStream(true);
@ -242,15 +242,15 @@ public class EntityTypeProvider {
.setName("ETKeyTwoKeyComp")
.setKey(Arrays.asList(
new PropertyRef()
.setPropertyName("PropertyInt16"),
.setName("PropertyInt16"),
new PropertyRef()
.setPropertyName("PropertyComp/PropertyInt16")
.setName("PropertyComp/PropertyInt16")
.setAlias("KeyAlias1"),
new PropertyRef()
.setPropertyName("PropertyComp/PropertyString")
.setName("PropertyComp/PropertyString")
.setAlias("KeyAlias2"),
new PropertyRef()
.setPropertyName("PropertyCompComp/PropertyComp/PropertyString")
.setName("PropertyCompComp/PropertyComp/PropertyString")
.setAlias("KeyAlias3")))
.setProperties(
Arrays.asList(
@ -260,14 +260,14 @@ public class EntityTypeProvider {
} else if (entityTypeName.equals(nameETServerSidePaging)) {
return new EntityType()
.setName(nameETServerSidePaging.getName())
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setKey(Arrays.asList(new PropertyRef().setName("PropertyInt16")))
.setProperties(Arrays.asList(PropertyProvider.propertyInt16_NotNullable,
PropertyProvider.propertyString_NotNullable));
} else if (entityTypeName.equals(nameETAllNullable)) {
return new EntityType()
.setName("ETAllNullable")
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyKey")))
.setKey(Arrays.asList(new PropertyRef().setName("PropertyKey")))
.setProperties(
Arrays.asList(
new Property()
@ -301,7 +301,7 @@ public class EntityTypeProvider {
} else if (entityTypeName.equals(nameETKeyNav)) {
return new EntityType()
.setName("ETKeyNav")
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setKey(Arrays.asList(new PropertyRef().setName("PropertyInt16")))
.setProperties(
Arrays.asList(
PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString_NotNullable,
@ -324,7 +324,7 @@ public class EntityTypeProvider {
} else if (entityTypeName.equals(nameETKeyPrimNav)) {
return new EntityType()
.setName("ETKeyPrimNav")
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setKey(Arrays.asList(new PropertyRef().setName("PropertyInt16")))
.setProperties(Arrays.asList(
PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString_ExplicitNullable))
.setNavigationProperties(
@ -335,8 +335,8 @@ public class EntityTypeProvider {
return new EntityType()
.setName("ETTwoKeyNav")
.setKey(Arrays.asList(
new PropertyRef().setPropertyName("PropertyInt16"),
new PropertyRef().setPropertyName("PropertyString")))
new PropertyRef().setName("PropertyInt16"),
new PropertyRef().setName("PropertyString")))
.setProperties(
Arrays.asList(
PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString_NotNullable,
@ -377,7 +377,7 @@ public class EntityTypeProvider {
return new EntityType()
.setName("ETTwoBaseTwoKeyNav")
.setBaseType(nameETBaseTwoKeyNav)
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setKey(Arrays.asList(new PropertyRef().setName("PropertyInt16")))
.setProperties(Arrays.asList(PropertyProvider.propertyGuid_ExplicitNullable))
.setNavigationProperties(Arrays.asList(
new NavigationProperty()
@ -391,13 +391,11 @@ public class EntityTypeProvider {
.setName("ETFourKeyAlias")
.setKey(
Arrays.asList(
new PropertyRef().setPropertyName("PropertyInt16"),
new PropertyRef().setPath("PropertyComp/PropertyInt16").setPropertyName("PropertyInt16").setAlias(
"KeyAlias1"),
new PropertyRef().setPath("PropertyComp/PropertyString").setPropertyName("PropertyString")
.setAlias("KeyAlias2"),
new PropertyRef().setPath("PropertyCompComp/PropertyComp/PropertyString").setPropertyName(
"PropertyString").setAlias("KeyAlias3"))).setProperties(
new PropertyRef().setName("PropertyInt16"),
new PropertyRef().setName("PropertyComp/PropertyInt16").setAlias("KeyAlias1"),
new PropertyRef().setName("PropertyComp/PropertyString").setAlias("KeyAlias2"),
new PropertyRef().setName("PropertyCompComp/PropertyComp/PropertyString").setAlias("KeyAlias3")))
.setProperties(
Arrays.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComp_CTTwoPrim,
PropertyProvider.propertyCompComp_CTCompComp));
} else if (entityTypeName.equals(nameETCompMixPrimCollComp)) {
@ -405,7 +403,7 @@ public class EntityTypeProvider {
.setName("ETCompMixPrimCollComp")
.setKey(Arrays.asList(
new PropertyRef()
.setPropertyName("PropertyInt16")))
.setName("PropertyInt16")))
.setProperties(
Arrays.asList(PropertyProvider.propertyInt16_NotNullable,
PropertyProvider.propertyMixedPrimCollComp_CTMixPrimCollComp));
@ -419,13 +417,13 @@ public class EntityTypeProvider {
return new EntityType()
.setName("ETAbstractBase")
.setBaseType(nameETAbstract)
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setKey(Arrays.asList(new PropertyRef().setName("PropertyInt16")))
.setProperties(Arrays.asList(
PropertyProvider.propertyInt16_NotNullable));
} else if (entityTypeName.equals(nameETMixEnumDefCollComp)) {
return new EntityType()
.setName(nameETMixEnumDefCollComp.getName())
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setKey(Arrays.asList(new PropertyRef().setName("PropertyInt16")))
.setProperties(Arrays.asList(
PropertyProvider.propertyInt16_NotNullable,
PropertyProvider.propertyEnumString_ENString,

View File

@ -83,7 +83,7 @@ public class EdmTechTestProvider extends EdmTechProvider {
@Override
public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
List<PropertyRef> oneKeyPropertyInt16 = Arrays.asList(new PropertyRef().setPropertyName("a"));
List<PropertyRef> oneKeyPropertyInt16 = Arrays.asList(new PropertyRef().setName("a"));
if (entityTypeName.equals(nameETabc)) {
return new EntityType()

View File

@ -64,7 +64,7 @@ public class CarsEdmProvider extends EdmProvider {
return new EntityType()
.setName(ET_CAR.getName())
.setKey(Arrays.asList(
new PropertyRef().setPropertyName("Id")))
new PropertyRef().setName("Id")))
.setProperties(
Arrays.asList(
new Property().setName("Id").setType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName()),
@ -85,7 +85,7 @@ public class CarsEdmProvider extends EdmProvider {
return new EntityType()
.setName(ET_MANUFACTURER.getName())
.setKey(Arrays.asList(
new PropertyRef().setPropertyName("Id")))
new PropertyRef().setName("Id")))
.setProperties(Arrays.asList(
new Property().setName("Id").setType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName()),
new Property().setName("Name").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()),