/** * Gets the action import by the specified name, throw an exception if no action import with the specified name * exists. * * @param entityDataModel The entity data model. * @param actionImportName The name of action import. * @return The instance of action import. */ public static ActionImport getAndCheckActionImport(EntityDataModel entityDataModel, String actionImportName) { ActionImport actionImport = entityDataModel.getEntityContainer().getActionImport(actionImportName); if (actionImport == null) { throw new ODataSystemException("Action import not found in the entity data model: " + actionImportName); } return actionImport; }
/** * Gets the action import by the specified name, throw an exception if no action import with the specified name * exists. * * @param entityDataModel The entity data model. * @param actionImportName The name of action import. * @return The instance of action import. */ public static ActionImport getAndCheckActionImport(EntityDataModel entityDataModel, String actionImportName) { ActionImport actionImport = entityDataModel.getEntityContainer().getActionImport(actionImportName); if (actionImport == null) { throw new ODataSystemException("Action import not found in the entity data model: " + actionImportName); } return actionImport; }
private Object parseActionImport(String actionImportName) throws ODataException { ActionImport actionImport = checkNotNull(entityDataModel.getEntityContainer().getActionImport(actionImportName), "Not able to get the action import {} from entity container", actionImportName); Action action = actionImport.getAction(); Object actionObject; try { actionObject = action.getJavaClass().newInstance(); } catch (ReflectiveOperationException e) { throw new ODataUnmarshallingException("Error during instantiation of action: " + action.getName()); } Set<Parameter> actionParameters = action.getParameters(); Map<String, Object> bodyParameters; try { bodyParameters = parseRequestBody(requestContext.getRequest().getBodyText(UTF_8.name())); } catch (IOException e) { throw new ODataUnmarshallingException("Error during request body parsing", e); } assignParametersToAction(bodyParameters, actionParameters, actionObject); return actionObject; } }
private Object parseActionImport(String actionImportName) throws ODataException { ActionImport actionImport = checkNotNull(entityDataModel.getEntityContainer().getActionImport(actionImportName), "Not able to get the action import {} from entity container", actionImportName); Action action = actionImport.getAction(); Object actionObject; try { actionObject = action.getJavaClass().newInstance(); } catch (ReflectiveOperationException e) { throw new ODataUnmarshallingException("Error during instantiation of action: " + action.getName()); } Set<Parameter> actionParameters = action.getParameters(); Map<String, Object> bodyParameters; try { bodyParameters = parseRequestBody(requestContext.getRequest().getBodyText(UTF_8.name())); } catch (IOException e) { throw new ODataUnmarshallingException("Error during request body parsing", e); } assignParametersToAction(bodyParameters, actionParameters, actionObject); return actionObject; } }