Olingo V4 注释未反映在 $metadata 中
Olingo V4 Annotations not getting reflected in $metadata
我已经使用 Olingo 实现了 Odata V4 服务。我正在尝试包括
Aggregation.ApplySupported 对我的服务的注释。但是,注释项值在我的 $metadata 文档中是空白的。下面是我的代码片段
List<CsdlAnnotation> list = new ArrayList<CsdlAnnotation>();
CsdlAnnotation annotationAttribute = new CsdlAnnotation();
annotationAttribute.setTerm("Aggregation.ApplySupported");
annotationAttribute.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String, "true"));
list.add(annotationAttribute);
entityContainer.setAnnotations(list);
$元数据
<EntityContainer Name="myContainer">
<!-- .....sets -->
<Annotation> <!-- term is blank -->
<String>true</String>
</Annotation>
</EntityContainer>
不知道我遗漏了什么。
提前致谢。
您应该覆盖提供程序中的 getTerm 方法。
@Override
public CsdlTerm getTerm(final FullQualifiedName termName) throws ODataException {
return new CsdlTerm().setAppliesTo(Arrays.asList("EntityContainer"))
.setName("ApplySupported");
}
我已经使用 Olingo 实现了 Odata V4 服务。我正在尝试包括
Aggregation.ApplySupported 对我的服务的注释。但是,注释项值在我的 $metadata 文档中是空白的。下面是我的代码片段
List<CsdlAnnotation> list = new ArrayList<CsdlAnnotation>();
CsdlAnnotation annotationAttribute = new CsdlAnnotation();
annotationAttribute.setTerm("Aggregation.ApplySupported");
annotationAttribute.setExpression(new CsdlConstantExpression(CsdlConstantExpression.ConstantExpressionType.String, "true"));
list.add(annotationAttribute);
entityContainer.setAnnotations(list);
$元数据
<EntityContainer Name="myContainer">
<!-- .....sets -->
<Annotation> <!-- term is blank -->
<String>true</String>
</Annotation>
</EntityContainer>
不知道我遗漏了什么。 提前致谢。
您应该覆盖提供程序中的 getTerm 方法。
@Override
public CsdlTerm getTerm(final FullQualifiedName termName) throws ODataException {
return new CsdlTerm().setAppliesTo(Arrays.asList("EntityContainer"))
.setName("ApplySupported");
}