0

How to annotate from code entityTypes like this:
http://services.odata.org/OData/OData.svc/$metadata ?
Thanx in advance.

slider
  • 421
  • 1
  • 4
  • 19
  • Welcome to Stack Overflow! You seem to be asking for someone to write some code for you. Stack Overflow is a question and answer site, not a code-writing service. Please [see here](http://stackoverflow.com/help/how-to-ask) to learn how to write effective questions. – Quotidian Jan 19 '16 at 16:05
  • Ok, thanx! Edited this one. – slider Jan 19 '16 at 16:12

2 Answers2

1

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.

slider
  • 421
  • 1
  • 4
  • 19
0
@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.

Sushant Kumar Singh
  • 323
  • 1
  • 5
  • 18