/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.client.file.options;

import alluxio.annotation.PublicApi;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.google.common.base.Objects;

import javax.annotation.concurrent.NotThreadSafe;

/**
 * Method options for deleting a file.
 */
@PublicApi
@NotThreadSafe
@JsonInclude(Include.NON_EMPTY)
public final class DeleteOptions {
  private boolean mRecursive;

  /**
   * @return the default {@link DeleteOptions}
   */
  public static DeleteOptions defaults() {
    return new DeleteOptions();
  }

  private DeleteOptions() {
    mRecursive = false;
  }

  /**
   * @return the recursive flag value; if the object to be deleted is a directory, the flag
   *         specifies whether the directory content should be recursively deleted as well
   */
  public boolean isRecursive() {
    return mRecursive;
  }

  /**
   * Sets the recursive flag.
   *
   * @param recursive the recursive flag value to use; if the object to be deleted is a directory,
   *        the flag specifies whether the directory content should be recursively deleted as well
   * @return the updated options object
   */
  public DeleteOptions setRecursive(boolean recursive) {
    mRecursive = recursive;
    return this;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof DeleteOptions)) {
      return false;
    }
    DeleteOptions that = (DeleteOptions) o;
    return Objects.equal(mRecursive, that.mRecursive);
  }

  @Override
  public int hashCode() {
    return Objects.hashCode(mRecursive);
  }

  @Override
  public String toString() {
    return Objects.toStringHelper(this)
        .add("recursive", mRecursive)
        .toString();
  }
}

@@ -581,16 +581,54 @@
 blicApi;
+%0Aimport alluxio.thrift.DeleteTOptions;
 %0A%0Aimport
@@ -995,16 +995,48 @@
 cursive;
+%0A  private boolean mAlluxioOnly;
 %0A%0A  /**%0A
@@ -1220,16 +1220,42 @@
  false;%0A
+    mAlluxioOnly = false;%0A
   %7D%0A%0A  /
@@ -1522,36 +1522,227 @@
   * 
-Sets the recursi
+@return the mAlluxioOnly flag value; the flag specifies whether the file content should%0A   *         be remo
 ve
+d
  f
-lag.%0A   
+rom Alluxio, but not from UFS.%0A   */%0A  public boolean isAlluxioOnly() %7B%0A    return mAlluxioOnly;%0A  %7D%0A%0A  /*
 *%0A  
@@ -2086,24 +2086,356 @@
  this;%0A  %7D%0A%0A
+  /**%0A   * @param alluxioOnly the alluxioOnly flag value to use; the flag specifies whether the file%0A   *        content should be removed from Alluxio, but not from UFS.%0A   * @return the updated options object%0A   */%0A  public DeleteOptions setAlluxioOnly(boolean alluxioOnly) %7B%0A    mAlluxioOnly = alluxioOnly;%0A    return this;%0A  %7D%0A%0A
   @Override%0A
@@ -2672,32 +2672,90 @@
 that.mRecursive)
+%0A        && Objects.equal(mAlluxioOnly, that.mAlluxioOnly)
 ;%0A  %7D%0A%0A  @Overri
@@ -2821,16 +2821,30 @@
 ecursive
+, mAlluxioOnly
 );%0A  %7D%0A%0A
@@ -2971,26 +2971,323 @@
        .
-toString()
+add(%22alluxioOnly%22, mAlluxioOnly)%0A        .toString();%0A  %7D%0A%0A  /**%0A   * @return Thrift representation of the options%0A   */%0A  public DeleteTOptions toThrift() %7B%0A    DeleteTOptions options = new DeleteTOptions();%0A    options.setRecursive(mRecursive);%0A    options.setAlluxioOnly(mAlluxioOnly);%0A    return options
 ;%0A  %7D%0A%7D%0A

Add mAlluxioOnly optition in DeleteOptions