public Builder addAction(Action action) { this.actionsBuilder.put(action.getName(), action); return this; }
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 void buildActions() { AnnotationActionFactory actionFactory = new AnnotationActionFactory(); for (Class<?> actionClass : actionClasses) { Action action = actionFactory.build(actionClass); getSchemaBuilder(action.getNamespace()).addAction(action); } }
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 void buildActions() { AnnotationActionFactory actionFactory = new AnnotationActionFactory(); for (Class<?> actionClass : actionClasses) { Action action = actionFactory.build(actionClass); getSchemaBuilder(action.getNamespace()).addAction(action); } }
private Object parseAction(String fullyQualifiedName) throws ODataException { int delimiterIndex = fullyQualifiedName.lastIndexOf("."); if (delimiterIndex < 0) { throw new ODataUnmarshallingException("The action should have a fully qualified name"); } String namespace = fullyQualifiedName.substring(0, delimiterIndex); String actionSimpleName = fullyQualifiedName.substring(delimiterIndex + 1); Schema schema = checkNotNull(entityDataModel.getSchema(namespace), "There is no schema with name: {}", namespace); Action action = checkNotNull(schema.getAction(actionSimpleName), "There is no action {} within schema {}", actionSimpleName, namespace); 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 has occurred during parameter parsing", e); } assignParametersToAction(bodyParameters, actionParameters, actionObject); return actionObject; }
public Builder addAction(Action action) { this.actionsBuilder.put(action.getName(), action); return this; }
private Object parseAction(String fullyQualifiedName) throws ODataException { int delimiterIndex = fullyQualifiedName.lastIndexOf("."); if (delimiterIndex < 0) { throw new ODataUnmarshallingException("The action should have a fully qualified name"); } String namespace = fullyQualifiedName.substring(0, delimiterIndex); String actionSimpleName = fullyQualifiedName.substring(delimiterIndex + 1); Schema schema = checkNotNull(entityDataModel.getSchema(namespace), "There is no schema with name: {}", namespace); Action action = checkNotNull(schema.getAction(actionSimpleName), "There is no action {} within schema {}", actionSimpleName, namespace); 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 has occurred during parameter parsing", e); } assignParametersToAction(bodyParameters, actionParameters, actionObject); return actionObject; }