예제 #1
0
 /**
  * Retrieves a list of arguments from the Ds3Request, including converting the required parameters
  * to arguments, and retrieving the arguments from the request header info
  */
 public static ImmutableList<Arguments> getRequiredArgs(final Ds3Request ds3Request) {
   final ImmutableList.Builder<Arguments> requiredArgs = ImmutableList.builder();
   requiredArgs.addAll(RequestConverterUtil.getRequiredArgsFromRequestHeader(ds3Request));
   requiredArgs.addAll(getArgsFromParamList(ds3Request.getRequiredQueryParams()));
   if (ds3Request.getIncludeInPath() && isResourceNotification(ds3Request.getResource())) {
     requiredArgs.add(new Arguments("Guid", "NotificationId"));
   }
   return requiredArgs.build();
 }
  /**
   * Gets all the required imports that the Request will need in order to properly generate the Java
   * request code
   *
   * @param ds3Request A Ds3Request
   * @return The list of all imports that the Request requires for generating the Java request code
   */
  @Override
  public ImmutableList<String> getAllImports(
      final Ds3Request ds3Request, final String packageName) {
    final ImmutableSet.Builder<String> builder = ImmutableSet.builder();

    builder.add(getParentImport(ds3Request));
    builder.addAll(getImportsFromParamList(ds3Request.getRequiredQueryParams()));
    builder.addAll(getImportsFromParamList(ds3Request.getOptionalQueryParams()));

    if (isResourceAnArg(ds3Request.getResource(), ds3Request.getIncludeInPath())) {
      if (RequestConverterUtil.isResourceId(ds3Request.getResource())) {
        builder.add("java.util.UUID");
      }
      builder.add("com.google.common.net.UrlEscapers");
    }

    return builder.build().asList();
  }