Package org.apache.olingo.odata2.api.edm.provider

Examples of org.apache.olingo.odata2.api.edm.provider.FunctionImport


  public FunctionImport buildFunctionImport(final Method method,
      final org.apache.olingo.odata2.api.annotation.edm.FunctionImport annotation) throws ODataJPAModelException {

    if (method != null && annotation != null && annotation.returnType() != ReturnType.NONE) {
      FunctionImport functionImport = new FunctionImport();

      if (annotation.name().equals("")) {
        functionImport.setName(method.getName());
      } else {
        functionImport.setName(annotation.name());
      }

      JPAEdmMapping mapping = new JPAEdmMappingImpl();
      ((Mapping) mapping).setInternalName(method.getName());
      mapping.setJPAType(method.getDeclaringClass());
      functionImport.setMapping((Mapping) mapping);

      functionImport.setHttpMethod(annotation.httpMethod().name().toString());

      buildReturnType(functionImport, method, annotation);
      buildParameter(functionImport, method);
      return functionImport;
    }
View Full Code Here


                }
              } else {
                method = methods[i];
              }

              FunctionImport functionImport = buildFunctionImport(method);
              if (functionImport != null) {
                consistentFunctionImportList.add(functionImport);
              }

            } catch (SecurityException e) {
View Full Code Here

      org.apache.olingo.odata2.api.annotation.edm.FunctionImport annotation =
          method.getAnnotation(org.apache.olingo.odata2.api.annotation.edm.FunctionImport.class);

      if (annotation != null) {
        FunctionImport functionImport = builderDeprecated.buildFunctionImport(method, annotation);

        return functionImport;
      }
      return null;
    }
View Full Code Here

    private FunctionImport buildEdmFunctionImport(final Method method,
        final EdmFunctionImport edmAnnotationFunctionImport)
        throws ODataJPAModelException {
      if (edmAnnotationFunctionImport != null && edmAnnotationFunctionImport.returnType() != null) {
        FunctionImport functionImport = new FunctionImport();

        if (edmAnnotationFunctionImport.name().equals("")) {
          functionImport.setName(method.getName());
        } else {
          functionImport.setName(edmAnnotationFunctionImport.name());
        }

        JPAEdmMapping mapping = new JPAEdmMappingImpl();
        ((Mapping) mapping).setInternalName(method.getName());
        mapping.setJPAType(method.getDeclaringClass());
        functionImport.setMapping((Mapping) mapping);

        functionImport.setHttpMethod(edmAnnotationFunctionImport.httpMethod().name().toString());

        buildEdmReturnType(functionImport, method, edmAnnotationFunctionImport);
        buildEdmParameter(functionImport, method);

        return functionImport;
View Full Code Here

    List<FunctionImport> functionImportList = jpaEdmfunctionImport.getConsistentFunctionImportList();

    assertEquals(functionImportList.size(), 1);

    FunctionImport functionImport = functionImportList.get(0);
    assertEquals(functionImport.getName(), "method3");
    assertNotNull(functionImport.getMapping());

    ReturnType returnType = functionImport.getReturnType();
    assertNotNull(returnType);
    assertEquals(EdmMultiplicity.ONE, returnType.getMultiplicity());
    assertEquals(returnType.getTypeName().toString(), EdmSimpleTypeKind.Int32.getFullQualifiedName().toString());
  }
View Full Code Here

    List<FunctionImport> functionImportList = jpaEdmfunctionImport.getConsistentFunctionImportList();

    assertEquals(functionImportList.size(), 1);

    FunctionImport functionImport = functionImportList.get(0);
    assertEquals(functionImport.getName(), "method7");
    assertNotNull(functionImport.getMapping());
    JPAEdmMapping mapping = (JPAEdmMapping) functionImport.getMapping();
    assertEquals(_JPACustomProcessorMock.class, mapping.getJPAType());

    ReturnType returnType = functionImport.getReturnType();
    assertNotNull(returnType);
    assertEquals(EdmMultiplicity.ONE, returnType.getMultiplicity());
    assertEquals(returnType.getTypeName().toString(), ODataJPAContextMock.PERSISTENCE_UNIT_NAME + "."
        + _JPACustomProcessorMock.edmName);
  }
View Full Code Here

    List<FunctionImport> functionImportList = jpaEdmfunctionImport.getConsistentFunctionImportList();

    assertEquals(functionImportList.size(), 1);

    FunctionImport functionImport = functionImportList.get(0);
    assertEquals(functionImport.getName(), "method9");
    assertNotNull(functionImport.getMapping());

    ReturnType returnType = functionImport.getReturnType();
    assertNotNull(returnType);
    assertEquals(EdmMultiplicity.ONE, returnType.getMultiplicity());
    assertEquals(returnType.getTypeName().toString(), ODataJPAContextMock.PERSISTENCE_UNIT_NAME + "."
        + _JPACustomProcessorMock.edmName);
View Full Code Here

    List<FunctionImport> functionImportList = jpaEdmfunctionImport.getConsistentFunctionImportList();

    assertEquals(functionImportList.size(), 1);

    FunctionImport functionImport = functionImportList.get(0);
    assertEquals(functionImport.getName(), "method10");
    assertNotNull(functionImport.getMapping());

    ReturnType returnType = functionImport.getReturnType();
    assertNotNull(returnType);
    assertEquals(EdmMultiplicity.MANY, returnType.getMultiplicity());
    assertEquals(returnType.getTypeName().toString(), ODataJPAContextMock.PERSISTENCE_UNIT_NAME + "."
        + _JPACustomProcessorMock.edmName);
View Full Code Here

    List<FunctionImport> functionImportList = jpaEdmfunctionImport.getConsistentFunctionImportList();

    assertEquals(functionImportList.size(), 1);

    FunctionImport functionImport = functionImportList.get(0);
    assertEquals(functionImport.getName(), "method3");
    assertNotNull(functionImport.getMapping());

    ReturnType returnType = functionImport.getReturnType();
    assertNotNull(returnType);
    assertEquals(EdmMultiplicity.ONE, returnType.getMultiplicity());
    assertEquals(returnType.getTypeName().toString(), EdmSimpleTypeKind.Int32.getFullQualifiedName().toString());
  }
View Full Code Here

    List<FunctionImport> functionImportList = jpaEdmfunctionImport.getConsistentFunctionImportList();

    assertEquals(functionImportList.size(), 1);

    FunctionImport functionImport = functionImportList.get(0);
    assertEquals(functionImport.getName(), "method7");
    assertNotNull(functionImport.getMapping());
    JPAEdmMapping mapping = (JPAEdmMapping) functionImport.getMapping();
    assertEquals(JPACustomProcessorMock.class, mapping.getJPAType());

    ReturnType returnType = functionImport.getReturnType();
    assertNotNull(returnType);
    assertEquals(EdmMultiplicity.ONE, returnType.getMultiplicity());
    assertEquals(returnType.getTypeName().toString(), ODataJPAContextMock.PERSISTENCE_UNIT_NAME + "."
        + JPACustomProcessorMock.edmName);
  }
View Full Code Here

TOP

Related Classes of org.apache.olingo.odata2.api.edm.provider.FunctionImport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.