mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

matthew_swift
03.26.2009 e10a19e91d09aa4bf4dd1fabf048b46299899e35
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
package org.opends.sdk.controls;
 
 
 
import static com.sun.opends.sdk.util.Messages.ERR_SUBTREE_DELETE_INVALID_CONTROL_VALUE;
 
import com.sun.opends.sdk.util.Message;
import org.opends.sdk.DecodeException;
import org.opends.sdk.schema.Schema;
import org.opends.sdk.util.ByteString;
 
 
 
/**
 * This class implements the subtree delete control defined in
 * draft-armijo-ldap-treedelete. It makes it possible for clients to
 * delete subtrees of entries.
 */
public class SubtreeDeleteControl extends Control
{
  /**
   * The OID for the subtree delete control.
   */
  public static final String OID_SUBTREE_DELETE_CONTROL = "1.2.840.113556.1.4.805";
 
 
 
  /**
   * ControlDecoder implementation to decode this control from a
   * ByteString.
   */
  private final static class Decoder implements
      ControlDecoder<SubtreeDeleteControl>
  {
    /**
     * {@inheritDoc}
     */
    public SubtreeDeleteControl decode(boolean isCritical,
        ByteString value, Schema schema) throws DecodeException
    {
      if (value != null)
      {
        Message message = ERR_SUBTREE_DELETE_INVALID_CONTROL_VALUE
            .get();
        throw DecodeException.error(message);
      }
 
      return new SubtreeDeleteControl(isCritical);
    }
 
 
 
    public String getOID()
    {
      return OID_SUBTREE_DELETE_CONTROL;
    }
 
  }
 
 
 
  /**
   * The Control Decoder that can be used to decode this control.
   */
  public static final ControlDecoder<SubtreeDeleteControl> DECODER = new Decoder();
 
 
 
  /**
   * Creates a new subtree delete control.
   * 
   * @param isCritical
   *          Indicates whether the control should be considered
   *          critical for the operation processing.
   */
  public SubtreeDeleteControl(boolean isCritical)
  {
    super(OID_SUBTREE_DELETE_CONTROL, isCritical);
  }
 
 
 
  @Override
  public ByteString getValue()
  {
    return null;
  }
 
 
 
  @Override
  public boolean hasValue()
  {
    return false;
  }
 
 
 
  /**
   * {@inheritDoc}
   */
  @Override
  public void toString(StringBuilder buffer)
  {
    buffer.append("SubtreeDeleteControl(oid=");
    buffer.append(getOID());
    buffer.append(", criticality=");
    buffer.append(isCritical());
    buffer.append(")");
  }
 
}