jpenninkhof / odata-boilerplate

OpenUI5 boilerplate based on OLingo, JPA and Spring Boot
MIT License
82 stars 41 forks source link

Enable function imports #15

Closed senenpalanca closed 3 years ago

senenpalanca commented 3 years ago

I've seen that it's unable to create function Imports. There is any way to implement that? I just think to modify jpa-processor jar library but not sure how.

senenpalanca commented 3 years ago

I just solve it:

  1. I created a Class named 'Functions.java' and added this function import:

@EdmFunctionImport(name = "HELLO_FUNCTION", returnType = @ReturnType(type = Type.SIMPLE, isCollection = false),httpMethod = HttpMethod.GET) public static String myFunction2() { return "Hello world"; }

  1. In JPAEdmExtension, in method extendWithOperation: @Override public void extendWithOperation(JPAEdmSchemaView view) { view.registerOperations(Functions.class, null); }