private void generateAction(Action action, Document descriptor, Element actionListElement) {

    Element actionElement = appendNewElement(descriptor, actionListElement, ELEMENT.action);

    appendNewElementIfNotNull(descriptor, actionElement, ELEMENT.name, action.getName());

    if (action.hasArguments()) {
      Element argumentListElement =
          appendNewElement(descriptor, actionElement, ELEMENT.argumentList);
      for (ActionArgument actionArgument : action.getArguments()) {
        generateActionArgument(actionArgument, descriptor, argumentListElement);
      }
    }
  }
Ejemplo n.º 2
0
  @SuppressWarnings({"rawtypes", "unchecked"})
  private ActionArgumentValue[] getArguments(final Action<RemoteService> action) {
    final ActionArgument[] actionArguments = action.getArguments();
    final Map<String, Object> argumentValues = getArgumentValues();
    final List<ActionArgumentValue<RemoteService>> actionArgumentValues =
        new ArrayList<>(actionArguments.length);

    for (final ActionArgument<RemoteService> actionArgument : actionArguments) {
      if (actionArgument.getDirection() == Direction.IN) {
        final Object value = argumentValues.get(actionArgument.getName());
        logger.trace(
            "Action {}: add arg value for {}: {} (expected datatype: {})",
            action.getName(),
            actionArgument,
            value,
            actionArgument.getDatatype().getDisplayString());
        actionArgumentValues.add(new ActionArgumentValue<>(actionArgument, value));
      }
    }
    return actionArgumentValues.toArray(new ActionArgumentValue[actionArgumentValues.size()]);
  }