ContextMapper / context-mapper-examples

ContextMapper DSL: Examples

Home Page:https://contextmapper.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example for Resource Operation delegate

sunilk-m opened this issue · comments

It would be good to have an example of resource operation delegate to the service operation. I have defined a service and a resource and I am able to inject the service into the resource. I am not able to provide a delegation to the service operation from resource operation. My understanding is following should work but I am getting syntax error.
String createEmployee(@EmployeeDto emp) POST path="/employee" DELEGATE @EmployeeService.addEmployee;
When I use ctrl spacebar I don't get Delegate in the proposal.

Hi @sunilk-m

Sorry for the late response! (I'm quite busy right now)

Actually DELEGATE is not a keyword, but the following terminal rule:

terminal DELEGATE :
  ('=>'|('delegates to'));

For some reason delegates to does not work (don't understand why right now), but you can use the following syntax:

String createEmployee(@EmployeeDto emp) POST path="/employee" => @EmployeeService.addEmployee ;

Let me know if this solves your issue and whether we can close this one.

Best regards,
Stefan

Hi Stefan
=> worked. You can close the issue.

Regards
Sunil