@Test public void testProcessGetEntitySetUriInfo() { try { Assert.assertNotNull(objJPAProcessorImpl.process(getEntitySetUriInfo())); } catch (ODataJPAModelException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } catch (ODataJPARuntimeException e) { fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2); } }
@SuppressWarnings("unchecked") @Override public List<Object> process(final GetFunctionImportUriInfo uriParserResultView) throws ODataJPAModelException, ODataJPARuntimeException { JPAMethodContext jpaMethodContext = JPAMethodContext.createBuilder( JPQLContextType.FUNCTION, uriParserResultView).build(); List<Object> resultObj = null; try { JPAFunction jpaFunction = jpaMethodContext.getJPAFunctionList() .get(0); Method method = jpaFunction.getFunction(); Object[] args = jpaFunction.getArguments(); if (uriParserResultView.getFunctionImport().getReturnType() .getMultiplicity().equals(EdmMultiplicity.MANY)) { resultObj = (List<Object>) method.invoke( jpaMethodContext.getEnclosingObject(), args); } else { resultObj = new ArrayList<Object>(); Object result = method.invoke( jpaMethodContext.getEnclosingObject(), args); resultObj.add(result); } } catch (EdmException e) { throw ODataJPARuntimeException .throwException(ODataJPARuntimeException.GENERAL .addContent(e.getMessage()), e); } catch (IllegalAccessException e) { throw ODataJPARuntimeException .throwException(ODataJPARuntimeException.GENERAL .addContent(e.getMessage()), e); } catch (IllegalArgumentException e) { throw ODataJPARuntimeException .throwException(ODataJPARuntimeException.GENERAL .addContent(e.getMessage()), e); } catch (InvocationTargetException e) { throw ODataJPARuntimeException .throwException(ODataJPARuntimeException.GENERAL .addContent(e.getTargetException().getMessage()), e.getTargetException()); } return resultObj; }
JPAProcessorImpl implements JPAProcessor { @SuppressWarnings("unchecked") @Override public List<Object> process(final GetFunctionImportUriInfo uriParserResultView) throws ODataJPAModelException, ODataJPARuntimeException { JPAMethodContext jpaMethodContext = JPAMethodContext.createBuilder( JPQLContextType.FUNCTION, uriParserResultView).build(); List<Object> resultObj = null; try { JPAFunction jpaFunction = jpaMethodContext.getJPAFunctionList() .get(0); Method method = jpaFunction.getFunction(); Object[] args = jpaFunction.getArguments(); if (uriParserResultView.getFunctionImport().getReturnType() .getMultiplicity().equals(EdmMultiplicity.MANY)) { resultObj = (List<Object>) method.invoke( jpaMethodContext.getEnclosingObject(), args); } else { resultObj = new ArrayList<Object>(); Object result = method.invoke( jpaMethodContext.getEnclosingObject(), args); resultObj.add(result); } } catch (EdmException e) { throw ODataJPARuntimeException .throwException(ODataJPARuntimeException.GENERAL .addContent(e.getMessage()), e); } catch (IllegalAccessException e) { throw ODataJPARuntimeException .throwException(ODataJPARuntimeException.GENERAL .addContent(e.getMessage()), e); } catch (IllegalArgumentException e) { throw ODataJPARuntimeException .throwException(ODataJPARuntimeException.GENERAL .addContent(e.getMessage()), e); } catch (InvocationTargetException e) { throw ODataJPARuntimeException .throwException(ODataJPARuntimeException.GENERAL .addContent(e.getTargetException().getMessage()), e.getTargetException()); } return resultObj; } }
JPAProcessorImpl implements JPAProcessor { @SuppressWarnings("unchecked") @Override public List<Object> process(final GetFunctionImportUriInfo uriParserResultView) throws ODataJPAModelException, ODataJPARuntimeException { JPAMethodContext jpaMethodContext = JPAMethodContext.createBuilder( JPQLContextType.FUNCTION, uriParserResultView).build(); List<Object> resultObj = null; try { JPAFunction jpaFunction = jpaMethodContext.getJPAFunctionList() .get(0); Method method = jpaFunction.getFunction(); Object[] args = jpaFunction.getArguments(); if (uriParserResultView.getFunctionImport().getReturnType() .getMultiplicity().equals(EdmMultiplicity.MANY)) { resultObj = (List<Object>) method.invoke( jpaMethodContext.getEnclosingObject(), args); } else { resultObj = new ArrayList<Object>(); Object result = method.invoke( jpaMethodContext.getEnclosingObject(), args); resultObj.add(result); } } catch (EdmException e) { throw ODataJPARuntimeException .throwException(ODataJPARuntimeException.GENERAL .addContent(e.getMessage()), e); } catch (IllegalAccessException e) { throw ODataJPARuntimeException .throwException(ODataJPARuntimeException.GENERAL .addContent(e.getMessage()), e); } catch (IllegalArgumentException e) { throw ODataJPARuntimeException .throwException(ODataJPARuntimeException.GENERAL .addContent(e.getMessage()), e); } catch (InvocationTargetException e) { throw ODataJPARuntimeException .throwException(ODataJPARuntimeException.GENERAL .addContent(e.getTargetException().getMessage()), e.getTargetException()); } return resultObj; } JPAProcessorImpl(final ODataJPAContext oDataJPAContext); }
JPAProcessorImpl implements JPAProcessor { @SuppressWarnings("unchecked") @Override public List<Object> process(final GetFunctionImportUriInfo uriParserResultView) throws ODataJPAModelException, ODataJPARuntimeException { JPAMethodContext jpaMethodContext = JPAMethodContext.createBuilder( JPQLContextType.FUNCTION, uriParserResultView).build(); List<Object> resultObj = null; try { JPAFunction jpaFunction = jpaMethodContext.getJPAFunctionList() .get(0); Method method = jpaFunction.getFunction(); Object[] args = jpaFunction.getArguments(); if (uriParserResultView.getFunctionImport().getReturnType() .getMultiplicity().equals(EdmMultiplicity.MANY)) { resultObj = (List<Object>) method.invoke( jpaMethodContext.getEnclosingObject(), args); } else { resultObj = new ArrayList<Object>(); Object result = method.invoke( jpaMethodContext.getEnclosingObject(), args); resultObj.add(result); } } catch (EdmException e) { throw ODataJPARuntimeException .throwException(ODataJPARuntimeException.GENERAL .addContent(e.getMessage()), e); } catch (IllegalAccessException e) { throw ODataJPARuntimeException .throwException(ODataJPARuntimeException.GENERAL .addContent(e.getMessage()), e); } catch (IllegalArgumentException e) { throw ODataJPARuntimeException .throwException(ODataJPARuntimeException.GENERAL .addContent(e.getMessage()), e); } catch (InvocationTargetException e) { throw ODataJPARuntimeException .throwException(ODataJPARuntimeException.GENERAL .addContent(e.getTargetException().getMessage()), e.getTargetException()); } return resultObj; } JPAProcessorImpl(final ODataJPAContext oDataJPAContext); @SuppressWarnings("unchecked") @Override List<Object> process(final GetFunctionImportUriInfo uriParserResultView); @Override List<Object> process(final GetEntitySetUriInfo uriParserResultView); @Override Object process(GetEntityUriInfo uriParserResultView); @Override long process(final GetEntitySetCountUriInfo resultsView); @Override long process(final GetEntityCountUriInfo resultsView); @Override Object process(final PostUriInfo createView, final InputStream content,
      final String requestedContentType); @Override Object process(final PostUriInfo createView, final Map<String, Object> content); @Override Object process(final PutMergePatchUriInfo updateView,
      final InputStream content, final String requestContentType); @Override Object process(final PutMergePatchUriInfo updateView, final Map<String, Object> content); @Override Object process(DeleteUriInfo uriParserResultView, final String contentType); @Override Object process(final GetEntityLinkUriInfo uriParserResultView); @Override List<Object> process(final GetEntitySetLinksUriInfo uriParserResultView); @Override void process(final PostUriInfo uriInfo,
      final InputStream content, final String requestContentType, final String contentType); @Override void process(final PutMergePatchUriInfo putUriInfo,
      final InputStream content, final String requestContentType, final String contentType); }
JPAProcessorImpl implements JPAProcessor { @SuppressWarnings("unchecked") @Override public List<Object> process(final GetFunctionImportUriInfo uriParserResultView) throws ODataJPAModelException, ODataJPARuntimeException { JPAMethodContext jpaMethodContext = JPAMethodContext.createBuilder( JPQLContextType.FUNCTION, uriParserResultView).build(); List<Object> resultObj = null; try { JPAFunction jpaFunction = jpaMethodContext.getJPAFunctionList() .get(0); Method method = jpaFunction.getFunction(); Object[] args = jpaFunction.getArguments(); if (uriParserResultView.getFunctionImport().getReturnType() .getMultiplicity().equals(EdmMultiplicity.MANY)) { resultObj = (List<Object>) method.invoke( jpaMethodContext.getEnclosingObject(), args); } else { resultObj = new ArrayList<Object>(); Object result = method.invoke( jpaMethodContext.getEnclosingObject(), args); resultObj.add(result); } } catch (EdmException e) { throw ODataJPARuntimeException .throwException(ODataJPARuntimeException.GENERAL .addContent(e.getMessage()), e); } catch (IllegalAccessException e) { throw ODataJPARuntimeException .throwException(ODataJPARuntimeException.GENERAL .addContent(e.getMessage()), e); } catch (IllegalArgumentException e) { throw ODataJPARuntimeException .throwException(ODataJPARuntimeException.GENERAL .addContent(e.getMessage()), e); } catch (InvocationTargetException e) { throw ODataJPARuntimeException .throwException(ODataJPARuntimeException.GENERAL .addContent(e.getTargetException().getMessage()), e.getTargetException()); } return resultObj; } JPAProcessorImpl(final ODataJPAContext oDataJPAContext); @SuppressWarnings("unchecked") @Override List<Object> process(final GetFunctionImportUriInfo uriParserResultView); @Override List<Object> process(final GetEntitySetUriInfo uriParserResultView); @Override Object process(GetEntityUriInfo uriParserResultView); @Override long process(final GetEntitySetCountUriInfo resultsView); @Override long process(final GetEntityCountUriInfo resultsView); @Override Object process(final PostUriInfo createView, final InputStream content,
      final String requestedContentType); @Override Object process(final PostUriInfo createView, final Map<String, Object> content); @Override Object process(final PutMergePatchUriInfo updateView,
      final InputStream content, final String requestContentType); @Override Object process(final PutMergePatchUriInfo updateView, final Map<String, Object> content); @Override Object process(DeleteUriInfo uriParserResultView, final String contentType); @Override Object process(final GetEntityLinkUriInfo uriParserResultView); @Override List<Object> process(final GetEntitySetLinksUriInfo uriParserResultView); @Override void process(final PostUriInfo uriInfo,
      final InputStream content, final String requestContentType, final String contentType); @Override void process(final PutMergePatchUriInfo putUriInfo,
      final InputStream content, final String requestContentType, final String contentType);  }