protected AccessPoint findParameterDefinition(
      Interaction interaction, String parameterId, Direction direction)
      throws WebApplicationException {
    ApplicationContext definition = interaction.getDefinition();

    if ((null != definition) && !isEmpty(parameterId)) {
      for (AccessPoint ap : (List<AccessPoint>) definition.getAllAccessPoints()) {
        if ((direction == ap.getDirection()) && parameterId.equals(ap.getId())) {
          return ap;
        }
      }
    }

    return null;
  }