[OLINGO-826] Added Annotations to all EntitySets
This commit is contained in:
parent
a11cb6d659
commit
be3b10a245
|
@ -33,6 +33,7 @@ import org.apache.olingo.commons.api.edm.provider.CsdlFunctionImport;
|
||||||
import org.apache.olingo.commons.api.edm.provider.CsdlNavigationPropertyBinding;
|
import org.apache.olingo.commons.api.edm.provider.CsdlNavigationPropertyBinding;
|
||||||
import org.apache.olingo.commons.api.edm.provider.CsdlSingleton;
|
import org.apache.olingo.commons.api.edm.provider.CsdlSingleton;
|
||||||
import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression;
|
import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression;
|
||||||
|
import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpression.ConstantExpressionType;
|
||||||
import org.apache.olingo.commons.api.ex.ODataException;
|
import org.apache.olingo.commons.api.ex.ODataException;
|
||||||
|
|
||||||
public class ContainerProvider {
|
public class ContainerProvider {
|
||||||
|
@ -152,6 +153,13 @@ public class ContainerProvider {
|
||||||
functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollESKeyNavContParam"));
|
functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollESKeyNavContParam"));
|
||||||
functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FINRTByteNineParam"));
|
functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FINRTByteNineParam"));
|
||||||
|
|
||||||
|
List<CsdlAnnotation> annotations = new ArrayList<CsdlAnnotation>();
|
||||||
|
annotations.add(new CsdlAnnotation().setTerm(TermProvider.TERM_DESCRIPTION.getFullQualifiedNameAsString())
|
||||||
|
.setExpression(
|
||||||
|
new CsdlConstantExpression(ConstantExpressionType.String,
|
||||||
|
"If an entity set contains data all operations are supported.")));
|
||||||
|
container.setAnnotations(annotations);
|
||||||
|
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,44 +176,21 @@ public class ContainerProvider {
|
||||||
.setAnnotations(Arrays.asList(new CsdlAnnotation().setTerm("Core.Description").setExpression(
|
.setAnnotations(Arrays.asList(new CsdlAnnotation().setTerm("Core.Description").setExpression(
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String,
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String,
|
||||||
"Contains entities with all primitive types")),
|
"Contains entities with all primitive types")),
|
||||||
new CsdlAnnotation().setTerm("Core.LongDescription").setQualifier("EnabledForEntitySet").setExpression(
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String,
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true"))
|
||||||
"System Query Options: $filter, $count, $orderby, $skip, $top, $expand, $select, $format; "
|
));
|
||||||
+ "Operations: Create, Create with Deep Insert, Create with Bind Operation, Read")),
|
|
||||||
new CsdlAnnotation().setTerm("Core.LongDescription").setQualifier("EnabledForEntity").setExpression(
|
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String,
|
|
||||||
"System Query Options: $expand, $select, $format; Operations: "
|
|
||||||
+ "Read, Update, Update with Bind Operation, Delete")),
|
|
||||||
new CsdlAnnotation().setTerm("Core.LongDescription").setQualifier("EnabledNavigationProperties")
|
|
||||||
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String,
|
|
||||||
"NavPropertyETTwoPrimOne, NavPropertyETTwoPrimMany"))));
|
|
||||||
|
|
||||||
} else if (name.equals("ESCollAllPrim")) {
|
} else if (name.equals("ESCollAllPrim")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
.setName("ESCollAllPrim")
|
.setName("ESCollAllPrim")
|
||||||
.setType(EntityTypeProvider.nameETCollAllPrim)
|
.setType(EntityTypeProvider.nameETCollAllPrim)
|
||||||
.setAnnotations(
|
.setAnnotations(
|
||||||
Arrays
|
Arrays.asList(
|
||||||
.asList(
|
new CsdlAnnotation().setTerm("Org.OData.Core.V1.Description")
|
||||||
new CsdlAnnotation()
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
.setTerm("Org.OData.Core.V1.Description")
|
|
||||||
.setExpression(
|
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
|
||||||
.setValue("Contains entities with collection of each primitive type")),
|
.setValue("Contains entities with collection of each primitive type")),
|
||||||
new CsdlAnnotation()
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
.setTerm("Org.OData.Core.V1.LongDescription")
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true"))));
|
||||||
.setQualifier("EnabledForEntitySet")
|
|
||||||
.setExpression(
|
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
|
||||||
.setValue("System Query Options: $filter, $count, $orderby, "
|
|
||||||
+ "$skip, $top, $expand, $select, $format; Operations: Create, Read")),
|
|
||||||
new CsdlAnnotation()
|
|
||||||
.setTerm("Org.OData.Core.V1.LongDescription")
|
|
||||||
.setQualifier("EnabledForEntity")
|
|
||||||
.setExpression(
|
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
|
||||||
.setValue("System Query Options: $expand, $select, "
|
|
||||||
+ "$format; Operations: Read, Update, Delete"))));
|
|
||||||
|
|
||||||
} else if (name.equals("ESTwoPrim")) {
|
} else if (name.equals("ESTwoPrim")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
|
@ -219,194 +204,189 @@ public class ContainerProvider {
|
||||||
.setPath("NavPropertyETAllPrimMany")
|
.setPath("NavPropertyETAllPrimMany")
|
||||||
.setTarget("ESAllPrim")))
|
.setTarget("ESAllPrim")))
|
||||||
.setAnnotations(Arrays.asList(
|
.setAnnotations(Arrays.asList(
|
||||||
new CsdlAnnotation()
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
.setTerm("Core.Description")
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
.setExpression(
|
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
|
||||||
.setValue("Contains entities with two primitve types")),
|
.setValue("Contains entities with two primitve types")),
|
||||||
new CsdlAnnotation()
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
.setTerm("Core.LongDescription")
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true"))));
|
||||||
.setQualifier("EnabledForEntitySet")
|
|
||||||
.setExpression(
|
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
|
||||||
.setValue("System Query Options: $filter, $count, $orderby, $skip, $top, $expand, "
|
|
||||||
+ "$select, $format; Operations: Create, Create with Deep Insert, "
|
|
||||||
+ "Create with Bind Operation, Read")),
|
|
||||||
new CsdlAnnotation()
|
|
||||||
.setTerm("Core.LongDescription")
|
|
||||||
.setQualifier("EnabledForEntity")
|
|
||||||
.setExpression(
|
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
|
||||||
.setValue("System Query Options: $expand, $select, $format; Operations: Read, Update, "
|
|
||||||
+ "Update with Bind Operation, Delete")),
|
|
||||||
new CsdlAnnotation()
|
|
||||||
.setTerm("Core.LongDescription")
|
|
||||||
.setQualifier("EnabledNavigationProperties")
|
|
||||||
.setExpression(
|
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
|
||||||
.setValue("NavPropertyETAllPrimOne, NavPropertyETAllPrimMany"))));
|
|
||||||
} else if (name.equals("ESMixPrimCollComp")) {
|
} else if (name.equals("ESMixPrimCollComp")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
.setName("ESMixPrimCollComp")
|
.setName("ESMixPrimCollComp")
|
||||||
.setType(EntityTypeProvider.nameETMixPrimCollComp)
|
.setType(EntityTypeProvider.nameETMixPrimCollComp)
|
||||||
.setAnnotations(Arrays.asList(
|
.setAnnotations(Arrays.asList(
|
||||||
new CsdlAnnotation()
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
.setTerm("Core.Description")
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
.setExpression(
|
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
|
||||||
.setValue("Contains entities with various properties of type primitive, collection "
|
.setValue("Contains entities with various properties of type primitive, collection "
|
||||||
+ "of primitve, complex and collection of complex")),
|
+ "of primitve, complex and collection of complex")),
|
||||||
new CsdlAnnotation()
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
.setTerm("Core.LongDescription")
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true"))));
|
||||||
.setQualifier("EnabledForEntitySet")
|
|
||||||
.setExpression(
|
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
|
||||||
.setValue("System Query Options: $filter, $count, $orderby, $skip, $top, $expand, "
|
|
||||||
+ "$select, $format; Operations: Create, Read")),
|
|
||||||
new CsdlAnnotation()
|
|
||||||
.setTerm("Core.LongDescription")
|
|
||||||
.setQualifier("EnabledForEntity")
|
|
||||||
.setExpression(
|
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
|
||||||
.setValue("System Query Options: $expand, $select, $format; Operations: Read, "
|
|
||||||
+ "Update, Delete"))));
|
|
||||||
|
|
||||||
} else if (name.equals("ESBase")) {
|
} else if (name.equals("ESBase")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
.setName("ESBase")
|
.setName("ESBase")
|
||||||
.setType(EntityTypeProvider.nameETBase)
|
.setType(EntityTypeProvider.nameETBase)
|
||||||
.setAnnotations(Arrays.asList(
|
.setAnnotations(Arrays.asList(
|
||||||
new CsdlAnnotation()
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
.setTerm("Core.Description")
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
.setExpression(
|
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
|
||||||
.setValue("Contains entities with single inheritance")),
|
.setValue("Contains entities with single inheritance")),
|
||||||
new CsdlAnnotation()
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
.setTerm("Core.LongDescription")
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true"))));
|
||||||
.setQualifier("EnabledForEntitySet")
|
|
||||||
.setExpression(
|
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
|
||||||
.setValue("System Query Options: $filter, $count, $orderby, $skip, $top, $expand, "
|
|
||||||
+ "$select, $format; Operations: Create, Read")),
|
|
||||||
new CsdlAnnotation()
|
|
||||||
.setTerm("Core.LongDescription")
|
|
||||||
.setQualifier("EnabledForEntity")
|
|
||||||
.setExpression(
|
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
|
||||||
.setValue("System Query Options: $expand, $select, $format; Operations: Read, "
|
|
||||||
+ "Update, Delete"))));
|
|
||||||
|
|
||||||
} else if (name.equals("ESTwoBase")) {
|
} else if (name.equals("ESTwoBase")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
.setName("ESTwoBase")
|
.setName("ESTwoBase")
|
||||||
.setType(EntityTypeProvider.nameETTwoBase)
|
.setType(EntityTypeProvider.nameETTwoBase)
|
||||||
.setAnnotations(Arrays.asList(
|
.setAnnotations(Arrays.asList(
|
||||||
new CsdlAnnotation()
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
.setTerm("Core.Description")
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
.setExpression(
|
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
|
||||||
.setValue("Contains entities with double inheritance")),
|
.setValue("Contains entities with double inheritance")),
|
||||||
new CsdlAnnotation()
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
.setTerm("Core.LongDescription")
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true"))));
|
||||||
.setQualifier("EnabledForEntitySet")
|
|
||||||
.setExpression(
|
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
|
||||||
.setValue("System Query Options: $filter, $count, $orderby, $skip, $top, $expand, "
|
|
||||||
+ "$select, $format; Operations: Create, Read")),
|
|
||||||
new CsdlAnnotation()
|
|
||||||
.setTerm("Core.LongDescription")
|
|
||||||
.setQualifier("EnabledForEntity")
|
|
||||||
.setExpression(
|
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
|
||||||
.setValue("System Query Options: $expand, $select, $format; Operations: Read, "
|
|
||||||
+ "Update, Delete"))));
|
|
||||||
|
|
||||||
} else if (name.equals("ESTwoKeyTwoPrim")) {
|
} else if (name.equals("ESTwoKeyTwoPrim")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
.setName("ESTwoKeyTwoPrim")
|
.setName("ESTwoKeyTwoPrim")
|
||||||
.setType(EntityTypeProvider.nameETTwoKeyTwoPrim)
|
.setType(EntityTypeProvider.nameETTwoKeyTwoPrim)
|
||||||
.setAnnotations(Arrays.asList(
|
.setAnnotations(Arrays.asList(
|
||||||
new CsdlAnnotation()
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
.setTerm("Core.Description")
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
.setExpression(
|
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
|
||||||
.setValue("Contains entities with two primitive types with two keys")),
|
.setValue("Contains entities with two primitive types with two keys")),
|
||||||
new CsdlAnnotation()
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
.setTerm("Core.LongDescription")
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "false"))));
|
||||||
.setQualifier("EnabledForEntitySet")
|
|
||||||
.setExpression(
|
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
|
||||||
.setValue("System Query Options: $filter, $count, $orderby, $skip, $top, $expand, $select,"
|
|
||||||
+ " $format; Operations: Create, Read")),
|
|
||||||
new CsdlAnnotation()
|
|
||||||
.setTerm("Core.LongDescription")
|
|
||||||
.setQualifier("EnabledForEntity")
|
|
||||||
.setExpression(
|
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
|
||||||
.setValue("System Query Options: $expand, $select, $format; Operations: Read, Update, "
|
|
||||||
+ "Delete"))));
|
|
||||||
|
|
||||||
} else if (name.equals("ESBaseTwoKeyTwoPrim")) {
|
} else if (name.equals("ESBaseTwoKeyTwoPrim")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
.setName("ESBaseTwoKeyTwoPrim")
|
.setName("ESBaseTwoKeyTwoPrim")
|
||||||
.setType(EntityTypeProvider.nameETBaseTwoKeyTwoPrim);
|
.setType(EntityTypeProvider.nameETBaseTwoKeyTwoPrim)
|
||||||
|
.setAnnotations(Arrays.asList(
|
||||||
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
|
.setValue("Contains entities with two primitive types with two keys")),
|
||||||
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "false"))));
|
||||||
|
|
||||||
} else if (name.equals("ESTwoBaseTwoKeyTwoPrim")) {
|
} else if (name.equals("ESTwoBaseTwoKeyTwoPrim")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
.setName("ESTwoBaseTwoKeyTwoPrim")
|
.setName("ESTwoBaseTwoKeyTwoPrim")
|
||||||
.setType(EntityTypeProvider.nameETTwoBaseTwoKeyTwoPrim);
|
.setType(EntityTypeProvider.nameETTwoBaseTwoKeyTwoPrim)
|
||||||
|
.setAnnotations(Arrays.asList(
|
||||||
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
|
.setValue("Contains entities with two primitive types with two keys")),
|
||||||
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "false"))));
|
||||||
|
|
||||||
} else if (name.equals("ESAllKey")) {
|
} else if (name.equals("ESAllKey")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
.setName("ESAllKey")
|
.setName("ESAllKey")
|
||||||
.setType(EntityTypeProvider.nameETAllKey);
|
.setType(EntityTypeProvider.nameETAllKey)
|
||||||
|
.setAnnotations(Arrays.asList(
|
||||||
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
|
.setValue("Contains entities all primitive keys")),
|
||||||
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true"))));
|
||||||
|
|
||||||
} else if (name.equals("ESCompAllPrim")) {
|
} else if (name.equals("ESCompAllPrim")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
.setName("ESCompAllPrim")
|
.setName("ESCompAllPrim")
|
||||||
.setType(EntityTypeProvider.nameETCompAllPrim);
|
.setType(EntityTypeProvider.nameETCompAllPrim)
|
||||||
|
.setAnnotations(Arrays.asList(
|
||||||
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
|
.setValue("Contains entities with a complext type containing all primitive types")),
|
||||||
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true"))));
|
||||||
|
|
||||||
} else if (name.equals("ESCompCollAllPrim")) {
|
} else if (name.equals("ESCompCollAllPrim")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
.setName("ESCompCollAllPrim")
|
.setName("ESCompCollAllPrim")
|
||||||
.setType(EntityTypeProvider.nameETCompCollAllPrim);
|
.setType(EntityTypeProvider.nameETCompCollAllPrim)
|
||||||
|
.setAnnotations(Arrays.asList(
|
||||||
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
|
.setValue("Contains entities with a complext type containing all collection primitive types")),
|
||||||
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true"))));
|
||||||
|
|
||||||
} else if (name.equals("ESCompComp")) {
|
} else if (name.equals("ESCompComp")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
.setName("ESCompComp")
|
.setName("ESCompComp")
|
||||||
.setType(EntityTypeProvider.nameETCompComp);
|
.setType(EntityTypeProvider.nameETCompComp)
|
||||||
|
.setAnnotations(Arrays.asList(
|
||||||
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
|
.setValue("Contains entities with complex type nested in complex type")),
|
||||||
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true"))));
|
||||||
|
|
||||||
} else if (name.equals("ESCompCollComp")) {
|
} else if (name.equals("ESCompCollComp")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
.setName("ESCompCollComp")
|
.setName("ESCompCollComp")
|
||||||
.setType(EntityTypeProvider.nameETCompCollComp);
|
.setType(EntityTypeProvider.nameETCompCollComp)
|
||||||
|
.setAnnotations(Arrays.asList(
|
||||||
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
|
.setValue("Contains entities with collection of complex type nested in complex type")),
|
||||||
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true"))));
|
||||||
|
|
||||||
} else if (name.equals("ESMedia")) {
|
} else if (name.equals("ESMedia")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
.setName("ESMedia")
|
.setName("ESMedia")
|
||||||
.setType(EntityTypeProvider.nameETMedia)
|
.setType(EntityTypeProvider.nameETMedia)
|
||||||
.setIncludeInServiceDocument(true);
|
.setIncludeInServiceDocument(true)
|
||||||
|
.setAnnotations(Arrays.asList(
|
||||||
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
|
.setValue("Contains media entities")),
|
||||||
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true"))));
|
||||||
|
|
||||||
} else if (name.equals("ESKeyTwoKeyComp")) {
|
} else if (name.equals("ESKeyTwoKeyComp")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
.setName("ESKeyTwoKeyComp")
|
.setName("ESKeyTwoKeyComp")
|
||||||
.setType(EntityTypeProvider.nameETKeyTwoKeyComp);
|
.setType(EntityTypeProvider.nameETKeyTwoKeyComp)
|
||||||
|
.setAnnotations(Arrays.asList(
|
||||||
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
|
.setValue("Contains Keys with alias")),
|
||||||
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "false"))));
|
||||||
|
|
||||||
} else if (name.equals("ESInvisible")) {
|
} else if (name.equals("ESInvisible")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
.setName("ESInvisible")
|
.setName("ESInvisible")
|
||||||
.setIncludeInServiceDocument(false)
|
.setIncludeInServiceDocument(false)
|
||||||
.setType(EntityTypeProvider.nameETAllPrim);
|
.setType(EntityTypeProvider.nameETAllPrim)
|
||||||
|
.setAnnotations(Arrays.asList(
|
||||||
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
|
.setValue("To test the invisibility within the service document")),
|
||||||
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "false"))));
|
||||||
|
|
||||||
} else if (name.equals("ESServerSidePaging")) {
|
} else if (name.equals("ESServerSidePaging")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
.setName("ESServerSidePaging")
|
.setName("ESServerSidePaging")
|
||||||
.setType(EntityTypeProvider.nameETServerSidePaging);
|
.setType(EntityTypeProvider.nameETServerSidePaging)
|
||||||
|
.setAnnotations(Arrays.asList(
|
||||||
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
|
.setValue("Divides the response to several pages using $skiptoken and providing a nextLink")),
|
||||||
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true"))));
|
||||||
|
|
||||||
} else if (name.equals("ESAllNullable")) {
|
} else if (name.equals("ESAllNullable")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
.setName("ESAllNullable")
|
.setName("ESAllNullable")
|
||||||
.setType(EntityTypeProvider.nameETAllNullable);
|
.setType(EntityTypeProvider.nameETAllNullable)
|
||||||
|
.setAnnotations(Arrays.asList(
|
||||||
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
|
.setValue("Contains entities with initial values")),
|
||||||
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true"))));
|
||||||
|
|
||||||
} else if (name.equals("ESKeyNav")) {
|
} else if (name.equals("ESKeyNav")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
|
@ -463,7 +443,16 @@ public class ContainerProvider {
|
||||||
.setTarget("ESTwoKeyNav"),
|
.setTarget("ESTwoKeyNav"),
|
||||||
new CsdlNavigationPropertyBinding()
|
new CsdlNavigationPropertyBinding()
|
||||||
.setPath("PropertyCompNav/com.corp.odata.test1.CTNavFiveProp/NavPropertyETTwoKeyNavMany")
|
.setPath("PropertyCompNav/com.corp.odata.test1.CTNavFiveProp/NavPropertyETTwoKeyNavMany")
|
||||||
.setTarget("ESTwoKeyNav")));
|
.setTarget("ESTwoKeyNav")))
|
||||||
|
.setAnnotations(
|
||||||
|
Arrays.asList(
|
||||||
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
|
.setValue("Contains entities with various navigation "
|
||||||
|
+ "properties including cyclic navigations")),
|
||||||
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString())
|
||||||
|
.setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true"))));
|
||||||
|
|
||||||
} else if (name.equals("ESTwoKeyNav")) {
|
} else if (name.equals("ESTwoKeyNav")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
|
@ -517,7 +506,14 @@ public class ContainerProvider {
|
||||||
.setTarget("ESBaseTwoKeyNav"),
|
.setTarget("ESBaseTwoKeyNav"),
|
||||||
new CsdlNavigationPropertyBinding()
|
new CsdlNavigationPropertyBinding()
|
||||||
.setPath("NavPropertySINav")
|
.setPath("NavPropertySINav")
|
||||||
.setTarget("SINav")));
|
.setTarget("SINav")))
|
||||||
|
.setAnnotations(Arrays.asList(
|
||||||
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
|
.setValue("Contains entities with various navigation properties "
|
||||||
|
+ "including cyclic and nested navigations")),
|
||||||
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true"))));
|
||||||
|
|
||||||
} else if (name.equals("ESKeyNavCont")) {
|
} else if (name.equals("ESKeyNavCont")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
|
@ -547,7 +543,13 @@ public class ContainerProvider {
|
||||||
.setTarget("ESKeyNav"),
|
.setTarget("ESKeyNav"),
|
||||||
new CsdlNavigationPropertyBinding()
|
new CsdlNavigationPropertyBinding()
|
||||||
.setPath("PropertyCompNavCont/NavPropertyETTwoKeyNavMany/NavPropertyETKeyNavOne")
|
.setPath("PropertyCompNavCont/NavPropertyETTwoKeyNavMany/NavPropertyETKeyNavOne")
|
||||||
.setTarget("ESKeyNav")));
|
.setTarget("ESKeyNav")))
|
||||||
|
.setAnnotations(Arrays.asList(
|
||||||
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
|
.setValue("Contains entities with containment navigation properties")),
|
||||||
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "false"))));
|
||||||
|
|
||||||
} else if (name.equals("ESTwoKeyNavCont")) {
|
} else if (name.equals("ESTwoKeyNavCont")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
|
@ -565,7 +567,13 @@ public class ContainerProvider {
|
||||||
.setTarget("ESKeyNav"),
|
.setTarget("ESKeyNav"),
|
||||||
new CsdlNavigationPropertyBinding()
|
new CsdlNavigationPropertyBinding()
|
||||||
.setPath("NavPropertyETKeyNavContMany/NavPropertyETTwoKeyNavMany/NavPropertyETKeyNavOne")
|
.setPath("NavPropertyETKeyNavContMany/NavPropertyETTwoKeyNavMany/NavPropertyETKeyNavOne")
|
||||||
.setTarget("ESKeyNav")));
|
.setTarget("ESKeyNav")))
|
||||||
|
.setAnnotations(Arrays.asList(
|
||||||
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
|
.setValue("Contains entities with containment navigation properties")),
|
||||||
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "false"))));
|
||||||
|
|
||||||
} else if (name.equals("ESBaseTwoKeyNav")) {
|
} else if (name.equals("ESBaseTwoKeyNav")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
|
@ -574,26 +582,58 @@ public class ContainerProvider {
|
||||||
.setNavigationPropertyBindings(Arrays.asList(
|
.setNavigationPropertyBindings(Arrays.asList(
|
||||||
new CsdlNavigationPropertyBinding()
|
new CsdlNavigationPropertyBinding()
|
||||||
.setPath("NavPropertyETKeyNavMany")
|
.setPath("NavPropertyETKeyNavMany")
|
||||||
.setTarget("ESKeyNav")));
|
.setTarget("ESKeyNav")))
|
||||||
|
.setAnnotations(Arrays.asList(
|
||||||
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
|
.setValue("Contains entities with single inheritance and navigation properties")),
|
||||||
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true"))));
|
||||||
|
|
||||||
} else if (name.equals("ESTwoBaseTwoKeyNav")) {
|
} else if (name.equals("ESTwoBaseTwoKeyNav")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
.setName("ESTwoBaseTwoKeyNav")
|
.setName("ESTwoBaseTwoKeyNav")
|
||||||
.setType(EntityTypeProvider.nameETTwoBaseTwoKeyNav);
|
.setType(EntityTypeProvider.nameETTwoBaseTwoKeyNav)
|
||||||
|
.setAnnotations(Arrays.asList(
|
||||||
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
|
.setValue("Contains entities with double inheritance and navigation properties")),
|
||||||
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "false"))));
|
||||||
|
|
||||||
} else if (name.equals("ESCompMixPrimCollComp")) {
|
} else if (name.equals("ESCompMixPrimCollComp")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
.setName("ESCompMixPrimCollComp")
|
.setName("ESCompMixPrimCollComp")
|
||||||
.setType(EntityTypeProvider.nameETCompMixPrimCollComp);
|
.setType(EntityTypeProvider.nameETCompMixPrimCollComp)
|
||||||
|
.setAnnotations(Arrays.asList(
|
||||||
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
|
.setValue("Contains entities with a complex type, "
|
||||||
|
+ "various nested primitve types and collections")),
|
||||||
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true"))));
|
||||||
|
|
||||||
} else if (name.equals("ESFourKeyAlias")) {
|
} else if (name.equals("ESFourKeyAlias")) {
|
||||||
return new CsdlEntitySet()
|
return new CsdlEntitySet()
|
||||||
.setName("ESFourKeyAlias")
|
.setName("ESFourKeyAlias")
|
||||||
.setType(EntityTypeProvider.nameETFourKeyAlias);
|
.setType(EntityTypeProvider.nameETFourKeyAlias)
|
||||||
|
.setAnnotations(Arrays.asList(
|
||||||
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
|
.setValue("Contains entities with compound key (four properties with key aliases")),
|
||||||
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true"))));
|
||||||
|
|
||||||
} else if (name.equals("ESMixEnumDefCollComp")) {
|
} else if (name.equals("ESMixEnumDefCollComp")) {
|
||||||
return new CsdlEntitySet().setName("ESMixEnumDefCollComp")
|
return new CsdlEntitySet().setName("ESMixEnumDefCollComp")
|
||||||
.setType(EntityTypeProvider.nameETMixEnumDefCollComp);
|
.setType(EntityTypeProvider.nameETMixEnumDefCollComp)
|
||||||
|
.setAnnotations(Arrays.asList(
|
||||||
|
new CsdlAnnotation().setTerm("Core.Description")
|
||||||
|
.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String)
|
||||||
|
.setValue("Contains entities with properties of enum type, collection of enum type, type "
|
||||||
|
+ "definition, collection of type definition, complex and collection of complex")),
|
||||||
|
new CsdlAnnotation().setTerm(TermProvider.TERM_DATA.getFullQualifiedNameAsString()).setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.Bool, "true"))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,19 +29,10 @@ import org.apache.olingo.commons.api.edm.provider.annotation.CsdlConstantExpress
|
||||||
*/
|
*/
|
||||||
public class TermProvider {
|
public class TermProvider {
|
||||||
|
|
||||||
// <Term Name="Description" Type="Edm.String">
|
public static FullQualifiedName TERM_DESCRIPTION = new FullQualifiedName("Org.OData.Core.V1", "Description");
|
||||||
// <Annotation Term="Core.Description" String="A brief description of a model element" />
|
public static FullQualifiedName TERM_LONG_DESCRIPTION =
|
||||||
// <Annotation Term="Core.IsLanguageDependent" />
|
|
||||||
// </Term>
|
|
||||||
//
|
|
||||||
// <Term Name="LongDescription" Type="Edm.String">
|
|
||||||
// <Annotation Term="Core.Description" String="A lengthy description of a model element" />
|
|
||||||
// <Annotation Term="Core.IsLanguageDependent" />
|
|
||||||
// </Term>
|
|
||||||
|
|
||||||
private static FullQualifiedName TERM_DESCRIPTION = new FullQualifiedName("Org.OData.Core.V1", "Description");
|
|
||||||
private static FullQualifiedName TERM_LONG_DESCRIPTION =
|
|
||||||
new FullQualifiedName("Org.OData.Core.V1", "LongDescription");
|
new FullQualifiedName("Org.OData.Core.V1", "LongDescription");
|
||||||
|
public static FullQualifiedName TERM_DATA = new FullQualifiedName(SchemaProvider.NAMESPACE, "Data");
|
||||||
|
|
||||||
public CsdlTerm getTerm(FullQualifiedName termName) {
|
public CsdlTerm getTerm(FullQualifiedName termName) {
|
||||||
if (TERM_DESCRIPTION.equals(termName)) {
|
if (TERM_DESCRIPTION.equals(termName)) {
|
||||||
|
@ -56,6 +47,11 @@ public class TermProvider {
|
||||||
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String,
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String,
|
||||||
"A lengthy description of a model element")),
|
"A lengthy description of a model element")),
|
||||||
new CsdlAnnotation().setTerm("Core.IsLanguageDependent")));
|
new CsdlAnnotation().setTerm("Core.IsLanguageDependent")));
|
||||||
|
} else if (TERM_DATA.equals(termName)) {
|
||||||
|
return new CsdlTerm().setName("Data").setType("Edm.Boolean")
|
||||||
|
.setAnnotations(Arrays.asList(new CsdlAnnotation().setTerm("Core.Description").setExpression(
|
||||||
|
new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String,
|
||||||
|
"Indicates if data in the TechSvc is available for the given object"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -131,7 +131,7 @@ public class MetadataDocumentTest {
|
||||||
assertThat(
|
assertThat(
|
||||||
metadata,
|
metadata,
|
||||||
containsString("<EntitySet Name=\"ESInvisible\" EntityType=\"Namespace1_Alias.ETAllPrim\" "
|
containsString("<EntitySet Name=\"ESInvisible\" EntityType=\"Namespace1_Alias.ETAllPrim\" "
|
||||||
+ "IncludeInServiceDocument=\"false\"/>"));
|
+ "IncludeInServiceDocument=\"false\">"));
|
||||||
|
|
||||||
assertThat(metadata, containsString("</EntityContainer></Schema></edmx:DataServices></edmx:Edmx>"));
|
assertThat(metadata, containsString("</EntityContainer></Schema></edmx:DataServices></edmx:Edmx>"));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue