[OLINGO-545] TecSvc EDM enhanced

This commit is contained in:
Christian Holzer 2015-03-31 18:47:57 +02:00
parent 3e8c50646e
commit 15cfa375e8
15 changed files with 265 additions and 55 deletions

View File

@ -359,7 +359,7 @@ public class BasicITCase extends AbstractBaseTestITCase {
final ODataEntity entity = entityResponse.getBody();
assertNotNull(entity);
final ODataComplexValue complex = entity.getProperty("PropertyCompCompNav").getComplexValue()
.get("PropertyComp").getComplexValue();
.get("PropertyCompNav").getComplexValue();
assertNotNull(complex);
final ODataProperty property = complex.get("PropertyInt16");
assertNotNull(property);

View File

@ -61,7 +61,6 @@ public class BindingITCase extends AbstractBaseTestITCase {
private static final String CT_NAV_FIVE_PROP = "CTNavFiveProp";
private static final String PROPERTY_INT16 = "PropertyInt16";
private static final String PROPERTY_STRING = "PropertyString";
private static final String PROPERTY_COMP = "PropertyComp";
private static final String PROPERTY_COMP_NAV = "PropertyCompNav";
private static final String PROPERTY_COMP_COMP_NAV = "PropertyCompCompNav";
private static final String PROPERTY_COMP_TWO_PRIM = "PropertyCompTwoPrim";
@ -96,7 +95,7 @@ public class BindingITCase extends AbstractBaseTestITCase {
entity.getProperties()
.add(of.newComplexProperty(PROPERTY_COMP_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
.add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))
.add(of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_NAV_FIVE_PROP)
.add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
.add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))))));
// Bind existing entities via binding synatx

View File

@ -64,7 +64,6 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
private static final String CT_NAV_FIVE_PROP = "CTNavFiveProp";
private static final String PROPERTY_INT16 = "PropertyInt16";
private static final String PROPERTY_STRING = "PropertyString";
private static final String PROPERTY_COMP = "PropertyComp";
private static final String PROPERTY_COMP_NAV = "PropertyCompNav";
private static final String PROPERTY_COMP_COMP_NAV = "PropertyCompCompNav";
private static final String PROPERTY_COMP_TWO_PRIM = "PropertyCompTwoPrim";
@ -103,7 +102,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
entity.getProperties()
.add(of.newComplexProperty(PROPERTY_COMP_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
.add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))
.add(of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_NAV_FIVE_PROP)
.add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
.add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))))));
// Non collection navigation property
@ -114,7 +113,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
inlineEntitySingle.getProperties()
.add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("43")));
inlineEntitySingle.getProperties()
.add(of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)
.add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
.add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 431)))));
inlineEntitySingle.getProperties()
.add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
@ -130,7 +129,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
inlineEntityCol1.getProperties()
.add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("44")));
inlineEntityCol1.getProperties()
.add(of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)
.add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
.add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 441)))));
inlineEntityCol1.getProperties()
.add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
@ -143,7 +142,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
inlineEntityCol2.getProperties()
.add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("45")));
inlineEntityCol2.getProperties()
.add(of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_PRIM_COMP)
.add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
.add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 451)))));
inlineEntityCol2.getProperties()
.add(of.newComplexProperty(PROPERTY_COMP_TWO_PRIM, of.newComplexValue(CT_TWO_PRIM)
@ -184,7 +183,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
// Check nav. property NavPropertyETTwoKeyNavOne
assertNotNull(esKeyNavResponse.getBody().getProperty(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE));
assertEquals(431, esKeyNavResponse.getBody().getProperty(NAV_PROPERTY_ET_TWO_KEY_NAV_ONE).getComplexValue().get(
PROPERTY_COMP).getComplexValue().get(PROPERTY_INT16).getPrimitiveValue().toValue());
PROPERTY_COMP_NAV).getComplexValue().get(PROPERTY_INT16).getPrimitiveValue().toValue());
// Check nav. property NavPropertyETTwoKeyNavMany
assertNotNull(esKeyNavResponse.getBody().getProperty(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY));
@ -193,10 +192,10 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
Iterator<ODataValue> twoKeyNavManyIterator =
esKeyNavResponse.getBody().getProperty(NAV_PROPERTY_ET_TWO_KEY_NAV_MANY).getCollectionValue().iterator();
final ODataValue firstTwoKeyNavEnity = twoKeyNavManyIterator.next(); // First entity
assertEquals(441, firstTwoKeyNavEnity.asComplex().get(PROPERTY_COMP).getValue().asComplex().get(
assertEquals(441, firstTwoKeyNavEnity.asComplex().get(PROPERTY_COMP_NAV).getValue().asComplex().get(
PROPERTY_INT16).getPrimitiveValue().toValue());
final ODataValue secondTwoKeyNavEnity = twoKeyNavManyIterator.next(); // Second entity
assertEquals(451, secondTwoKeyNavEnity.asComplex().get(PROPERTY_COMP).getValue().asComplex().get(
assertEquals(451, secondTwoKeyNavEnity.asComplex().get(PROPERTY_COMP_NAV).getValue().asComplex().get(
PROPERTY_INT16).getPrimitiveValue().toValue());
// Fetch ESTwoKeyNav entities and check if available and the partner relation have been set up
@ -218,7 +217,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
.getEntityRequest(esTwoKeyNavEntitySingleURI);
esTwoKeyNavSingleRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
final ODataRetrieveResponse<ODataEntity> esTwoKeyNavSingleResponse = esTwoKeyNavSingleRequest.execute();
assertEquals(431, esTwoKeyNavSingleResponse.getBody().getProperty(PROPERTY_COMP).getComplexValue().get(
assertEquals(431, esTwoKeyNavSingleResponse.getBody().getProperty(PROPERTY_COMP_NAV).getComplexValue().get(
PROPERTY_INT16).getPrimitiveValue().toValue());
// Check ESTwoKeyNav(Created via NavPropertyETTwoKeyNavMany(0))
@ -236,7 +235,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
esTwoKeyNavManyOneRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
final ODataRetrieveResponse<ODataEntity> esTwoKeyNavManyOneResponse = esTwoKeyNavManyOneRequest.execute();
assertEquals(441, esTwoKeyNavManyOneResponse.getBody().getProperty(PROPERTY_COMP).getComplexValue().get(
assertEquals(441, esTwoKeyNavManyOneResponse.getBody().getProperty(PROPERTY_COMP_NAV).getComplexValue().get(
PROPERTY_INT16).getPrimitiveValue().toValue());
assertNotNull(esTwoKeyNavManyOneResponse.getBody().getProperty(NAV_PROPERTY_ET_KEY_NAV_ONE).getComplexValue());
assertEquals(propertyInt16.getPrimitiveValue().toValue(), esTwoKeyNavManyOneResponse.getBody().getProperty(
@ -257,7 +256,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
esTwoKeyNavManyTwoRequest.addCustomHeader(HttpHeader.COOKIE, cookie);
final ODataRetrieveResponse<ODataEntity> esTwoKeyNavManyTwoResponse = esTwoKeyNavManyTwoRequest.execute();
assertEquals(451, esTwoKeyNavManyTwoResponse.getBody().getProperty(PROPERTY_COMP).getComplexValue().get(
assertEquals(451, esTwoKeyNavManyTwoResponse.getBody().getProperty(PROPERTY_COMP_NAV).getComplexValue().get(
PROPERTY_INT16).getPrimitiveValue().toValue());
assertNotNull(esTwoKeyNavManyTwoResponse.getBody().getProperty(NAV_PROPERTY_ET_KEY_NAV_ONE).getComplexValue());
assertEquals(propertyInt16.getPrimitiveValue().toValue(), esTwoKeyNavManyTwoResponse.getBody().getProperty(
@ -289,7 +288,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
entity.getProperties()
.add(of.newComplexProperty(PROPERTY_COMP_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
.add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("42")))
.add(of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_NAV_FIVE_PROP)
.add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
.add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder().buildInt16((short) 42)))))));
// Prepare inline entity(EntitySet: ESKeyNav, Type: ETKeyNav)
@ -312,7 +311,7 @@ public class DeepInsertITCase extends AbstractBaseTestITCase {
.getProperties()
.add(of.newComplexProperty(PROPERTY_COMP_COMP_NAV, of.newComplexValue(CT_PRIM_COMP)
.add(of.newPrimitiveProperty(PROPERTY_STRING, of.newPrimitiveValueBuilder().buildString("431")))
.add(of.newComplexProperty(PROPERTY_COMP, of.newComplexValue(CT_NAV_FIVE_PROP)
.add(of.newComplexProperty(PROPERTY_COMP_NAV, of.newComplexValue(CT_NAV_FIVE_PROP)
.add(of.newPrimitiveProperty(PROPERTY_INT16, of.newPrimitiveValueBuilder()
.buildInt16((short) 431)))))));

View File

@ -959,11 +959,11 @@ public class FilterSystemQueryITCase extends AbstractBaseTestITCase {
// Do the filter request
ODataRetrieveResponse<ODataEntitySet> result =
sendRequest("ESKeyNav", "PropertyCompCompNav/PropertyComp/PropertyInt16 eq 1", cookie);
sendRequest("ESKeyNav", "PropertyCompCompNav/PropertyCompNav/PropertyInt16 eq 1", cookie);
assertEquals(3, result.getBody().getEntities().size());
// Try filter all entries where PropertyCompComp is null
result = sendRequest("ESKeyNav", "PropertyCompCompNav/PropertyComp/PropertyInt16 eq null", cookie);
result = sendRequest("ESKeyNav", "PropertyCompCompNav/PropertyCompNav/PropertyInt16 eq null", cookie);
assertEquals(1, result.getBody().getEntities().size());
}

View File

@ -138,7 +138,7 @@ public class DataCreator {
createKeyNavAllPrimComplexValue("PropertyComp"))))
.addProperty(createComplex("PropertyCompCompNav",
createPrimitive("PropertyString", "1"),
createComplex("PropertyComp", createPrimitive("PropertyInt16", 1))));
createComplex("PropertyCompNav", createPrimitive("PropertyInt16", 1))));
}
private EntitySet createESTwoKeyNav() {

View File

@ -37,6 +37,9 @@ public class ActionProvider {
public static final FullQualifiedName nameBAESTwoKeyNavRTESTwoKeyNav =
new FullQualifiedName(SchemaProvider.NAMESPACE, "BAESTwoKeyNavRTESTwoKeyNav");
public static final FullQualifiedName nameBAESTwoKeyNavRTESKeyNav =
new FullQualifiedName(SchemaProvider.NAMESPACE, "BAESTwoKeyNavRTESKeyNav");
public static final FullQualifiedName nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav =
new FullQualifiedName(SchemaProvider.NAMESPACE, "BAETBaseTwoKeyNavRTETBaseTwoKeyNav");
@ -46,6 +49,9 @@ public class ActionProvider {
public static final FullQualifiedName nameBAETTwoKeyNavRTETTwoKeyNav =
new FullQualifiedName(SchemaProvider.NAMESPACE, "BAETTwoKeyNavRTETTwoKeyNav");
public static final FullQualifiedName nameBAETAllPrimRT =
new FullQualifiedName(SchemaProvider.NAMESPACE, "BAESAllPrimRT");
// Unbound Actions
public static final FullQualifiedName nameUARTString = new FullQualifiedName(SchemaProvider.NAMESPACE,
"UARTString");
@ -69,7 +75,6 @@ public class ActionProvider {
public static final FullQualifiedName nameUARTTwoParam =
new FullQualifiedName(SchemaProvider.NAMESPACE, "UARTTwoParam");
public List<Action> getActions(final FullQualifiedName actionName) throws ODataException {
if (actionName.equals(nameUARTString)) {
return Arrays.asList(
@ -80,7 +85,8 @@ public class ActionProvider {
return Arrays.asList(
new Action().setName(nameUARTCollStringTwoParam.getName())
.setParameters(Arrays.asList(
new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16),
new Parameter().setName("ParameterDuration").setType(PropertyProvider.nameDuration)))
.setReturnType(new ReturnType().setType(PropertyProvider.nameString).setCollection(true))
);
@ -91,7 +97,7 @@ public class ActionProvider {
new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)
.setNullable(false)))
.setReturnType(
new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim))
new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false))
);
} else if (actionName.equals(nameUARTCollCTTwoPrimParam)) {
@ -134,7 +140,8 @@ public class ActionProvider {
return Arrays.asList(
new Action().setName(nameUARTCollETAllPrimParam.getName())
.setParameters(Arrays.asList(
new Parameter().setName("ParameterTimeOfDay").setType(PropertyProvider.nameInt16)))
new Parameter().setName("ParameterTimeOfDay")
.setType(PropertyProvider.nameTimeOfDay)))
.setReturnType(
new ReturnType().setType(EntityTypeProvider.nameETAllPrim).setCollection(true))
);
@ -200,6 +207,19 @@ public class ActionProvider {
new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true))
);
} else if(actionName.equals(nameBAESTwoKeyNavRTESKeyNav)) {
return Arrays.asList(
new Action().setName("BAESTwoKeyNavRTESKeyNav")
.setBound(true)
.setEntitySetPath("BindingParam/NavPropertyETKeyNavMany")
.setParameters(Arrays.asList(
new Parameter().setName("ParameterETTwoKeyNav")
.setType(EntityTypeProvider.nameETTwoKeyNav)
.setCollection(true)
.setNullable(false)
))
.setReturnType(new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setCollection(true))
);
} else if (actionName.equals(nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav)) {
return Arrays.asList(
new Action().setName("BAETBaseTwoKeyNavRTETBaseTwoKeyNav")
@ -222,6 +242,24 @@ public class ActionProvider {
.setReturnType(
new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav))
);
} else if(actionName.equals(nameBAETAllPrimRT)) {
return Arrays.asList(
new Action().setName("BAETAllPrimRT")
.setBound(true)
.setParameters(Arrays.asList(
new Parameter().setName("ParameterETAllPrim")
.setNullable(false)
.setType(EntityTypeProvider.nameETAllPrim)
)),
new Action().setName("BAETAllPrimRT")
.setBound(true)
.setParameters(Arrays.asList(
new Parameter().setName("ParameterETAllPrim")
.setNullable(false)
.setCollection(true)
.setType(EntityTypeProvider.nameETAllPrim)
))
);
}
return null;

View File

@ -18,6 +18,7 @@
*/
package org.apache.olingo.server.tecsvc.provider;
import java.util.ArrayList;
import java.util.Arrays;
import org.apache.olingo.commons.api.ODataException;
@ -51,6 +52,7 @@ public class ComplexTypeProvider {
public static final FullQualifiedName nameCTTwoPrim = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTTwoPrim");
public static final FullQualifiedName nameCTMixEnumDef = new FullQualifiedName(SchemaProvider.NAMESPACE,
"CTMixEnumDef");
public static final FullQualifiedName nameCTNavCont = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTNavCont");
public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException {
@ -65,12 +67,11 @@ public class ComplexTypeProvider {
.setProperties(
Arrays.asList(PropertyProvider.propertyString, PropertyProvider.propertyBinary,
PropertyProvider.propertyBoolean, PropertyProvider.propertyByte, PropertyProvider.propertyDate,
PropertyProvider.propertyDateTimeOffset, PropertyProvider.propertyDecimal,
PropertyProvider.propertyDateTimeOffset, PropertyProvider.propertyDecimal_Scale_Precision,
PropertyProvider.propertySingle, PropertyProvider.propertyDouble, PropertyProvider.propertyDuration,
PropertyProvider.propertyGuid, PropertyProvider.propertyInt16, PropertyProvider.propertyInt32,
PropertyProvider.propertyInt64, PropertyProvider.propertySByte, PropertyProvider.propertyTimeOfDay
));
} else if (complexTypeName.equals(nameCTCollAllPrim)) {
return new ComplexType()
.setName("CTCollAllPrim")
@ -96,7 +97,7 @@ public class ComplexTypeProvider {
return new ComplexType()
.setName("CTCompNav")
.setProperties(Arrays.asList(PropertyProvider.propertyString,
PropertyProvider.propertyComp_CTNavFiveProp));
PropertyProvider.propertyCompNav_CTNavFiveProp));
} else if (complexTypeName.equals(nameCTMixPrimCollComp)) {
return new ComplexType()
@ -149,6 +150,16 @@ public class ComplexTypeProvider {
.setType(EntityTypeProvider.nameETMedia).setCollection(true)
)));
} else if(complexTypeName.equals(nameCTNavCont)) {
return new ComplexType()
.setName("CTNavCont")
.setProperties(new ArrayList<Property>())
.setNavigationProperties(Arrays.asList(
PropertyProvider.collectionNavPropertyETKeyNavContMany_CT_ETKeyNav,
PropertyProvider.navPropertyETKeyNavContOne_CT_ETeyNav,
PropertyProvider.collectionNavPropertyETTwoKeyNavContMany_CT_ETKeyNav,
PropertyProvider.navPropertyETTwoKeyNavContOne_CT_ETKeyNav));
} else if (complexTypeName.equals(nameCTBasePrimCompNav)) {
return new ComplexType()
.setName("CTBasePrimCompNav")

View File

@ -288,7 +288,7 @@ public class ContainerProvider {
.setPath("NavPropertyETMediaMany")
.setTarget("ESMedia"),
new NavigationPropertyBinding()
.setPath("PropertyCompNav/NavPropertyETTwoKeyNavOn")
.setPath("PropertyCompNav/NavPropertyETTwoKeyNavOne")
.setTarget("ESTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("PropertyCompNav/NavPropertyETTwoKeyNavMany")
@ -369,15 +369,55 @@ public class ContainerProvider {
new NavigationPropertyBinding()
.setPath("NavPropertyETTwoBaseTwoKeyNavOne")
.setTarget("ESBaseTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("ETBaseTwoKeyNav/CollPropertyCompNav/NavPropertyETTwoKeyNavMany")
.setTarget("ESTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("ETBaseTwoKeyNav/NavPropertyETTwoBaseTwoKeyNavOne")
.setTarget("ESBaseTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("NavPropertySINav")
.setTarget("SINav")
));
} else if(name.equals("ESKeyNavCont")) {
return new EntitySet()
.setName("ESKeyNavCont")
.setType(EntityTypeProvider.nameETKeyNavCont)
.setNavigationPropertyBindings(Arrays.asList(
new NavigationPropertyBinding()
.setPath("NavPropertyETTwoKeyNavContOne/NavPropertyETKeyNavOne")
.setTarget("ESKeyNav"),
new NavigationPropertyBinding()
.setPath("NavPropertyETTwoKeyNavContMany/NavPropertyETKeyNavOne")
.setTarget("ESKeyNav"),
new NavigationPropertyBinding()
.setPath("PropertyCompNavCont/NavPropertyETKeyNavContMany/NavPropertyETKeyNavOne")
.setTarget("ESKeyNav"),
new NavigationPropertyBinding()
.setPath("PropertyCompNavCont/NavPropertyETKeyNavContOne/NavPropertyETKeyNavOne")
.setTarget("ESKeyNav"),
new NavigationPropertyBinding()
.setPath("PropertyCompNavCont/NavPropertyETTwoKeyNavContMany/NavPropertyETKeyNavOne")
.setTarget("ESKeyNav"),
new NavigationPropertyBinding()
.setPath("PropertyCompNavCont/NavPropertyETTwoKeyNavContOne/NavPropertyETKeyNavOne")
.setTarget("ESKeyNav")
));
} else if (name.equals("ESBaseTwoKeyNav")) {
return new EntitySet()
.setName("ESBaseTwoKeyNav")
.setType(EntityTypeProvider.nameETBaseTwoKeyNav);
.setType(EntityTypeProvider.nameETBaseTwoKeyNav)
.setNavigationPropertyBindings(Arrays.asList(
new NavigationPropertyBinding()
.setPath("NavPropertyETKeyNavMany")
.setTarget("ESKeyNav"))
);
} else if(name.equals("ESTwoBaseTwoKeyNav")) {
return new EntitySet()
.setName("ESTwoBaseTwoKeyNav")
.setType(EntityTypeProvider.nameETTwoBaseTwoKeyNav);
} else if (name.equals("ESCompMixPrimCollComp")) {
return new EntitySet()
@ -434,11 +474,13 @@ public class ContainerProvider {
} else if (name.equals(AIRTES_ALL_PRIM_PARAM)) {
return new ActionImport()
.setName(AIRTES_ALL_PRIM_PARAM)
.setEntitySet("ESAllPrim")
.setAction(ActionProvider.nameUARTETAllPrimParam);
} else if (name.equals(AIRT_COLL_ES_ALL_PRIM_PARAM)) {
return new ActionImport()
.setName(AIRT_COLL_ES_ALL_PRIM_PARAM)
.setEntitySet("ESAllPrim")
.setAction(ActionProvider.nameUARTCollETAllPrimParam);
} else if (name.equals(AIRT)) {
@ -605,7 +647,14 @@ public class ContainerProvider {
.setNavigationPropertyBindings(Arrays.asList(
new NavigationPropertyBinding()
.setPath("NavPropertyETTwoKeyNavMany")
.setTarget("ESTwoKeyNav")));
.setTarget("ESTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("NavPropertyETTwoKeyNavOne")
.setTarget("ESTwoKeyNav"),
new NavigationPropertyBinding()
.setPath("NavPropertyETKeyNavOne")
.setTarget("ESKeyNav")
));
} else if (name.equals("SIMedia")) {
return new Singleton()

View File

@ -55,6 +55,8 @@ public class EntityTypeProvider {
public static final FullQualifiedName nameETKeyNav = new FullQualifiedName(SchemaProvider.NAMESPACE, "ETKeyNav");
public static final FullQualifiedName nameETKeyPrimNav = new FullQualifiedName(SchemaProvider.NAMESPACE,
"ETKeyPrimNav");
public static final FullQualifiedName nameETKeyNavCont = new FullQualifiedName(SchemaProvider.NAMESPACE,
"ETKeyNavCont");
public static final FullQualifiedName nameETKeyTwoKeyComp = new FullQualifiedName(SchemaProvider.NAMESPACE,
"ETKeyTwoKeyComp");
public static final FullQualifiedName nameETMedia = new FullQualifiedName(SchemaProvider.NAMESPACE, "ETMedia");
@ -89,7 +91,7 @@ public class EntityTypeProvider {
PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString,
PropertyProvider.propertyBoolean, PropertyProvider.propertyByte, PropertyProvider.propertySByte,
PropertyProvider.propertyInt32, PropertyProvider.propertyInt64,
PropertyProvider.propertySingle, PropertyProvider.propertyDouble, PropertyProvider.propertyDecimal,
PropertyProvider.propertySingle, PropertyProvider.propertyDouble, PropertyProvider.propertyDecimal_Scale,
PropertyProvider.propertyBinary, PropertyProvider.propertyDate, PropertyProvider.propertyDateTimeOffset,
PropertyProvider.propertyDuration, PropertyProvider.propertyGuid, PropertyProvider.propertyTimeOfDay
))
@ -319,8 +321,7 @@ public class EntityTypeProvider {
PropertyProvider.navPropertyETKeyNavOne_ETKeyNav,
PropertyProvider.collectionNavPropertyETKeyNavMany_ETKeyNav,
PropertyProvider.navPropertyETMediaOne_ETMedia,
PropertyProvider.collectionNavPropertyETMediaMany_ETMedia
));
PropertyProvider.collectionNavPropertyETMediaMany_ETMedia));
} else if (entityTypeName.equals(nameETKeyPrimNav)) {
return new EntityType()
.setName("ETKeyPrimNav")
@ -330,6 +331,17 @@ public class EntityTypeProvider {
.setNavigationProperties(
Arrays.asList(
PropertyProvider.navPropertyETKeyPrimNavOne_ETKeyPrimNav));
} else if(entityTypeName.equals(nameETKeyNavCont)) {
return new EntityType()
.setName("ETKeyNavCont")
.setKey(Arrays.asList(new PropertyRef().setName("PropertyInt16")))
.setProperties(Arrays.asList(
PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString_NotNullable,
PropertyProvider.propertyCompNavCont))
.setNavigationProperties(Arrays.asList(
PropertyProvider.navPropertyETTwoKeyNavContOneCT_ETTwoKeyNav,
PropertyProvider.collectionNavPropertyETTwoKeyNavContMany_CT_ETTwoKeyNav
));
} else if (entityTypeName.equals(nameETTwoKeyNav)) {
return new EntityType()
@ -358,7 +370,8 @@ public class EntityTypeProvider {
.setReferencedProperty("PropertyInt16"))),
PropertyProvider.collectionNavPropertyETKeyNavMany_ETKeyNav,
PropertyProvider.navPropertyETTwoKeyNavOne_ETTwoKeyNav,
PropertyProvider.collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav));
PropertyProvider.collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
PropertyProvider.collectionNavPropertySINav));
} else if (entityTypeName.equals(nameETBaseTwoKeyNav)) {
return new EntityType()

View File

@ -119,6 +119,9 @@ public class FunctionProvider {
public static final FullQualifiedName nameBFCESTwoKeyNavRTCollCTNavFiveProp = new FullQualifiedName(
SchemaProvider.NAMESPACE, "BFCESTwoKeyNavRTCollCTNavFiveProp");
public static final FullQualifiedName nameBFCESKeyNavRTESTwoKeyNav =
new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCESKeyNavRTESTwoKeyNav");
// Unbound Functions
public static final FullQualifiedName nameUFCRTCollCTTwoPrim =
new FullQualifiedName(SchemaProvider.NAMESPACE, "UFCRTCollCTTwoPrim");
@ -164,6 +167,9 @@ public class FunctionProvider {
public static final FullQualifiedName nameUFCRTCollETMixPrimCollCompTwoParam =
new FullQualifiedName(SchemaProvider.NAMESPACE, "UFCRTCollETMixPrimCollCompTwoParam");
public static final FullQualifiedName nameUFCRTCollETKeyNavContParam =
new FullQualifiedName(SchemaProvider.NAMESPACE, "UFCRTCollETKeyNavContParam");
public static final FullQualifiedName nameUFNRTInt16 =
new FullQualifiedName(SchemaProvider.NAMESPACE, "UFNRTInt16");
@ -264,6 +270,21 @@ public class FunctionProvider {
new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false))
);
} else if(functionName.equals(nameUFCRTCollETKeyNavContParam)) {
return Arrays.asList(
new Function()
.setName("UFCRTCollETKeyNavContParam")
.setBound(true)
.setComposable(true)
.setParameters(Arrays.asList(
new Parameter().setName("ParameterInt16")
.setNullable(false)
.setType(PropertyProvider.nameInt16)))
.setReturnType(new ReturnType().setType(EntityTypeProvider.nameETKeyNavCont)
.setCollection(true)
.setNullable(false))
);
} else if (functionName.equals(nameUFCRTString)) {
return Arrays.asList(
new Function()
@ -317,7 +338,7 @@ public class FunctionProvider {
.setName("UFCRTCTTwoPrimParam")
.setParameters(Arrays.asList(
new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false),
new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(true)))
new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(false)))
.setComposable(true)
.setReturnType(
new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false))
@ -358,7 +379,9 @@ public class FunctionProvider {
return Arrays.asList(
new Function()
.setName("UFCRTETMedia")
.setParameters(new ArrayList<Parameter>())
.setParameters(Arrays.asList(
new Parameter().setName("ParameterInt16").setNullable(false).setType(PropertyProvider.nameInt16)
))
.setComposable(true)
.setReturnType(
new ReturnType().setType(EntityTypeProvider.nameETMedia).setNullable(false))
@ -730,6 +753,7 @@ public class FunctionProvider {
.setParameters(Arrays.asList(
new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav).setNullable(false)))
.setComposable(true)
.setEntitySetPath("BindingParam/NavPropertyETKeyNavOne")
.setReturnType(
new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setNullable(false))
);
@ -747,6 +771,26 @@ public class FunctionProvider {
new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false))
);
} else if(functionName.equals(nameBFCESKeyNavRTESTwoKeyNav)) {
return Arrays.asList(
new Function()
.setName("BFCESKeyNavRTESTwoKeyNav")
.setEntitySetPath("BindingParam/NavPropertyETTwoKeyNavMany")
.setBound(true)
.setComposable(true)
.setParameters(Arrays.asList(
new Parameter().setName("BindingParam")
.setNullable(false)
.setType(EntityTypeProvider.nameETKeyNav)
.setCollection(true),
new Parameter().setName("ParameterString")
.setNullable(false)
.setType(PropertyProvider.nameString)))
.setReturnType(new ReturnType()
.setNullable(false)
.setType(EntityTypeProvider.nameETTwoKeyNav)
.setCollection(true))
);
} else if (functionName.equals(nameBFCETTwoKeyNavRTETTwoKeyNav)) {
return Arrays.asList(

View File

@ -393,7 +393,13 @@ public class PropertyProvider {
.setType(nameDateTimeOffset)
.setNullable(true);
public static final Property propertyDecimal = new Property()
public static final Property propertyDecimal_Scale_Precision = new Property()
.setName("PropertyDecimal")
.setScale(10)
.setPrecision(11)
.setType(nameDecimal);
public static final Property propertyDecimal_Scale = new Property()
.setName("PropertyDecimal")
.setScale(10)
.setType(nameDecimal);
@ -598,6 +604,10 @@ public class PropertyProvider {
.setType(ComplexTypeProvider.nameCTTwoPrim)
.setNullable(false);
public static final Property propertyCompNavCont = new Property()
.setName("PropertyCompNavCont")
.setType(ComplexTypeProvider.nameCTNavCont);
public static final Property propertyCompAllPrim_CTAllPrim = new Property()
.setName("PropertyCompAllPrim")
.setType(ComplexTypeProvider.nameCTAllPrim);
@ -665,6 +675,23 @@ public class PropertyProvider {
.setType(EntityTypeProvider.nameETAllPrim)
.setCollection(true);
public static final NavigationProperty collectionNavPropertySINav = new NavigationProperty()
.setName("NavPropertySINav")
.setCollection(true)
.setType(EntityTypeProvider.nameETTwoKeyNav);
public static final NavigationProperty collectionNavPropertyETKeyNavContMany_CT_ETKeyNav = new NavigationProperty()
.setName("NavPropertyETKeyNavContMany")
.setCollection(true)
.setContainsTarget(true)
.setType(EntityTypeProvider.nameETKeyNav);
public static final NavigationProperty collectionNavPropertyETTwoKeyNavContMany_CT_ETKeyNav = new NavigationProperty()
.setName("NavPropertyETTwoKeyNavContMany")
.setCollection(true)
.setContainsTarget(true)
.setType(EntityTypeProvider.nameETKeyNav);
public static final NavigationProperty navPropertyETKeyNavOne_ETKeyNav = new NavigationProperty()
.setName("NavPropertyETKeyNavOne")
.setType(EntityTypeProvider.nameETKeyNav);
@ -695,6 +722,28 @@ public class PropertyProvider {
.setName("NavPropertyETAllPrimOne")
.setType(EntityTypeProvider.nameETAllPrim);
public static final NavigationProperty navPropertyETKeyNavContOne_CT_ETeyNav = new NavigationProperty()
.setName("NavPropertyETKeyNavContOne")
.setContainsTarget(true)
.setType(EntityTypeProvider.nameETKeyNav);
public static final NavigationProperty navPropertyETTwoKeyNavContOne_CT_ETKeyNav = new NavigationProperty()
.setName("NavPropertyETTwoKeyNavContOne")
.setContainsTarget(true)
.setType(EntityTypeProvider.nameETKeyNav);
public static final NavigationProperty navPropertyETTwoKeyNavContOneCT_ETTwoKeyNav = new NavigationProperty()
.setName("NavPropertyETKeyNavContOne")
.setContainsTarget(true)
.setType(EntityTypeProvider.nameETTwoKeyNav);
public static final NavigationProperty collectionNavPropertyETTwoKeyNavContMany_CT_ETTwoKeyNav
= new NavigationProperty()
.setName("NavPropertyETTwoKeyNavContMany")
.setContainsTarget(true)
.setCollection(true)
.setType(EntityTypeProvider.nameETTwoKeyNav);
// EnumProperties --------------------------------------------------------------------------------------------------
public static final Property propertyEnumString_ENString = new Property()
.setName("PropertyEnumString")

View File

@ -79,6 +79,7 @@ public class SchemaProvider {
entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETAbstract));
entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETAbstractBase));
entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETMixEnumDefCollComp));
entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETKeyNavCont));
// ComplexTypes
List<ComplexType> complexType = new ArrayList<ComplexType>();
@ -98,6 +99,7 @@ public class SchemaProvider {
complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTTwoBasePrimCompNav));
complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTCompNav));
complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTMixEnumDef));
complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTNavCont));
// TypeDefinitions
List<TypeDefinition> typeDefinitions = new ArrayList<TypeDefinition>();
@ -107,8 +109,10 @@ public class SchemaProvider {
// Actions
List<Action> actions = new ArrayList<Action>();
schema.setActions(actions);
actions.addAll(prov.getActions(ActionProvider.nameBAETAllPrimRT));
actions.addAll(prov.getActions(ActionProvider.nameBAETTwoKeyNavRTETTwoKeyNav));
actions.addAll(prov.getActions(ActionProvider.nameBAESAllPrimRTETAllPrim));
actions.addAll(prov.getActions(ActionProvider.nameBAESTwoKeyNavRTESKeyNav));
actions.addAll(prov.getActions(ActionProvider.nameBAESTwoKeyNavRTESTwoKeyNav));
actions.addAll(prov.getActions(ActionProvider.nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav));
actions.addAll(prov.getActions(ActionProvider.nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav));
@ -131,6 +135,7 @@ public class SchemaProvider {
functions.addAll(prov.getFunctions(FunctionProvider.nameUFNRTInt16));
functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTETKeyNav));
functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTETTwoKeyNav));
functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCollETKeyNavContParam));
functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTETTwoKeyNavParam));
functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTETTwoKeyNavParamCTTwoPrim));
functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTStringTwoParam));
@ -168,6 +173,7 @@ public class SchemaProvider {
functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCollCTPrimCompRTESAllPrim));
functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTTwoKeyNav));
functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESKeyNavRTETKeyNav));
functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESKeyNavRTESTwoKeyNav));
functions.addAll(prov.getFunctions(FunctionProvider.nameBFCETKeyNavRTETKeyNav));
functions.addAll(prov.getFunctions(FunctionProvider.nameBFESTwoKeyNavRTESTwoKeyNav));
functions.addAll(prov.getFunctions(FunctionProvider.nameBFCETTwoKeyNavRTETTwoKeyNav));

View File

@ -369,7 +369,7 @@ public class ODataHandlerTest {
dispatchMethodNotAllowed(HttpMethod.PUT, complexCountUri, complexCountProcessor);
dispatchMethodNotAllowed(HttpMethod.DELETE, complexCountUri, complexCountProcessor);
final String mediaUri = "FICRTESMedia()/$value";
final String mediaUri = "FICRTESMedia(ParameterInt16=1)/$value";
final MediaEntityProcessor mediaProcessor = mock(MediaEntityProcessor.class);
dispatch(HttpMethod.GET, mediaUri, mediaProcessor);
verify(mediaProcessor).readMediaEntity(

View File

@ -88,7 +88,7 @@ public class MetadataDocumentTest {
assertThat(metadata, containsString("<Action Name=\"UARTCTTwoPrimParam\" IsBound=\"false\">"
+ "<Parameter Name=\"ParameterInt16\" Type=\"Edm.Int16\" Nullable=\"false\"/>"
+ "<ReturnType Type=\"Namespace1_Alias.CTTwoPrim\"/></Action>"));
+ "<ReturnType Type=\"Namespace1_Alias.CTTwoPrim\" Nullable=\"false\"/></Action>"));
assertThat(metadata,
containsString("<Action Name=\"BAESAllPrimRTETAllPrim\" IsBound=\"true\">"
@ -114,6 +114,8 @@ public class MetadataDocumentTest {
assertThat(metadata,
containsString("<Singleton Name=\"SINav\" EntityType=\"Namespace1_Alias.ETTwoKeyNav\">"
+ "<NavigationPropertyBinding Path=\"NavPropertyETTwoKeyNavMany\" Target=\"ESTwoKeyNav\"/>"
+ "<NavigationPropertyBinding Path=\"NavPropertyETTwoKeyNavOne\" Target=\"ESTwoKeyNav\"/>"
+ "<NavigationPropertyBinding Path=\"NavPropertyETKeyNavOne\" Target=\"ESKeyNav\"/>"
+ "</Singleton>"));
assertThat(metadata,

View File

@ -1724,7 +1724,7 @@ public class TestFullResourcePath {
.isKeyPredicate(0, "PropertyInt16", "2")
.isKeyPredicate(1, "PropertyString", "'3'");
testUri.run("FICRTESMedia()/$value")
testUri.run("FICRTESMedia(ParameterInt16=1)/$value")
.isKind(UriInfoKind.resource).goPath()
.first()
.isFunctionImport("FICRTESMedia")