How to migrate Function Imports

Overview

The page describes how one could migrate Function Imports defined in Olingo release 1.0.0 or 1.1.0 when upgrading to Olingo release 1.2.0. If your application is dependent on following artifacts then proceed reading this migration guide

Details

Follwoing EDM annotations related to function import were deprecated in 1.1.0 release of olingo-odata2-api-annotation-incubating.

From release 1.2.0 these annotations are completely removed and replaced with the following new set of EDM annotations

The Olingo OData JPA processor library was supporting the deprecated annotations in release 1.0.0 and 1.1.0 but the support is completely removed in 1.2.0 release onwards. The library only supports the new set of annotations. So if you have used the deprecated annotations in your application then you need to migrate to new set of annotations as shown below

   1 /* Obsolete */
   2 
   3  @FunctionImport( name = "FindAllSalesOrders", 
   4                   entitySet = "SalesOrders", 
   5                   returnType = ReturnType.ENTITY_TYPE,
   6                   multiplicity = Multiplicity.MANY )
   7   public List<SalesOrderHeader> findAllSalesOrders(
   8                                 @Parameter(name = "DeliveryStatusCode",facets = @Facets(maxLength = 2)) final String status) {
   9   
  10   }
  11 
  12 /* New */
  13 
  14  @EdmFunctionImport( name = "FindAllSalesOrders", 
  15                      entitySet = "SalesOrders", 
  16                      returnType = @ReturnType(type = Type.ENTITY, isCollection = true))
  17   public List<SalesOrderHeader> findAllSalesOrders(
  18                                 @EdmFunctionImportParameter(name = "DeliveryStatusCode", facets = @EdmFacets(maxLength = 2)) final String status) {
  19 
  20   }


   1 /* Obsolete */
   2 
   3  @FunctionImport( name = "CheckATP", 
   4                   returnType = ReturnType.SCALAR, 
   5                   multiplicity = Multiplicity.ONE,
   6                   httpMethod = @HttpMethod(name = Name.GET) )
   7  public boolean checkATP(
   8                  @Parameter(name = "SoID", facets = @Facets(nullable = false), mode = Mode.IN) final Long soID,
   9                  @Parameter(name = "LiId", facets = @Facets(nullable = false), mode = Mode.IN) final Long lineItemID ) {
  10   
  11   }
  12 
  13 /* New */
  14 
  15  @EdmFunctionImport(name = "CheckATP", returnType = @ReturnType(type = Type.SIMPLE, isCollection = false),httpMethod = HttpMethod.GET)
  16  public boolean checkATP(
  17                  @EdmFunctionImportParameter(name = "SoID", facets = @EdmFacets(nullable = false)) final Long soID,
  18                  @EdmFunctionImportParameter(name = "LiId", facets = @EdmFacets(nullable = false)) final Long lineItemID) {
  19 
  20   }


   1 /* Obsolete */
   2 
   3  @FunctionImport(returnType = ReturnType.ENTITY_TYPE, entitySet = "SalesOrders")
   4   public SalesOrderHeader calculateNetAmount(
   5       @Parameter(name = "SoID", facets = @Facets(nullable = false)) final Long soID) {
   6 
   7   }
   8 
   9 /* New */
  10 
  11  @EdmFunctionImport(returnType = @ReturnType(type = Type.ENTITY, isCollection = true), entitySet = "SalesOrders")
  12  public SalesOrderHeader calculateNetAmount(
  13       @EdmFunctionImportParameter(name = "SoID", facets = @EdmFacets(nullable = false)) final Long soID) {
  14 
  15  }


   1 /* Obsolete */
   2 
   3  @FunctionImport(returnType = ReturnType.COMPLEX_TYPE)
   4  public Address getAddress(
   5       @Parameter(name = "SoID", facets = @Facets(nullable = false)) final Long soID) {
   6 
   7  }
   8 
   9 /* New */
  10 
  11  @EdmFunctionImport(returnType = @ReturnType(type = Type.COMPLEX))
  12  public Address getAddress(
  13       @EdmFunctionImportParameter(name = "SoID", facets = @EdmFacets(nullable = false)) final Long soID) {
  14 
  15  }


For more details refer to the documentation

ojp-migration-edmfunctionimport (last edited 2014-03-18 08:51:23 by chandanva)