Reputation: 431
How to annotate from code entityTypes like this:
http://services.odata.org/OData/OData.svc/$metadata ?
Thanx in advance.
Upvotes: 0
Views: 1703
Reputation: 431
Received the answer. Here it:
1. Annotations sets in EdmProvider, at an EntitySets:
public CsdlEntitySet getEntitySet(...) throws ... {
...
return new CsdlEntitySet()
.setName(...)
.setType(...)
.setAnnotations(Arrays.asList(new CsdlAnnotation()
.setTerm("termName").setExpression(
new CsdlConstantExpression(CsdlConstantExpression
.ConstantExpressionType.String, "someInfo"))));
...
}
2. Terms can be defined in the separated TermProvider.
Upvotes: 1
Reputation: 323
@EdmEntityType(name = "Team")
@EdmEntitySet(name = "Teams")
public class Team extends RefBase {
@EdmProperty(type = EdmType.BOOLEAN)
private Boolean isScrumTeam;
@EdmNavigationProperty(name = "nt_Employees", association = "TeamEmployees")
private List<Employee> employees = new ArrayList<Employee>();
Just check here the documentation for full details.
Upvotes: 0