001 /*
002 * CDDL HEADER START
003 *
004 * The contents of this file are subject to the terms of the
005 * Common Development and Distribution License, Version 1.0 only
006 * (the "License"). You may not use this file except in compliance
007 * with the License.
008 *
009 * You can obtain a copy of the license at
010 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
011 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
012 * See the License for the specific language governing permissions
013 * and limitations under the License.
014 *
015 * When distributing Covered Code, include this CDDL HEADER in each
016 * file and include the License file at
017 * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
018 * add the following below this CDDL HEADER, with the fields enclosed
019 * by brackets "[]" replaced with your own identifying information:
020 * Portions Copyright [yyyy] [name of copyright owner]
021 *
022 * CDDL HEADER END
023 *
024 *
025 * Copyright 2006-2008 Sun Microsystems, Inc.
026 */
027 package org.opends.server.util;
028
029
030
031 /**
032 * This enumeration defines the days of the week.
033 */
034 @org.opends.server.types.PublicAPI(
035 stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
036 mayInstantiate=false,
037 mayExtend=false,
038 mayInvoke=true)
039 public enum ChangeOperationType
040 {
041 /**
042 * The change type for add operations.
043 */
044 ADD("ADD", "add"),
045
046
047
048 /**
049 * The change type for delete operations.
050 */
051 DELETE("DELETE", "delete"),
052
053
054
055 /**
056 * The change type for modify operations.
057 */
058 MODIFY("MODIFY", "modify"),
059
060
061
062 /**
063 * The change type for modify DN operations.
064 */
065 MODIFY_DN("MODIFY_DN", "moddn");
066
067
068
069 // The name of this change type as it should appear in the "changetype" field
070 // in LDIF records.
071 private String ldifChangeType;
072
073 // The user-friendly name given to this change type.
074 private String type;
075
076
077
078 /**
079 * Creates a change type with the given string value.
080 *
081 * @param type The string value for this change type.
082 * @param ldifChangeType The change type as it should appear in the
083 * "changetype" field in LDIF records.
084 */
085 private ChangeOperationType(String type, String ldifChangeType)
086 {
087 this.type = type;
088 this.ldifChangeType = ldifChangeType;
089 }
090
091
092 /**
093 * Retrieves the human-readable name this change type.
094 *
095 * @return The human-readable name for this change type.
096 */
097 public String getType()
098 {
099 return type;
100 }
101
102
103 /**
104 * Retrieves the name of the change type as it should appear in LDIF
105 * "changetype" records.
106 *
107 * @return The name of the change type as it should appear in LDIF
108 * "changetype" records.
109 */
110 public String getLDIFChangeType()
111 {
112 return ldifChangeType;
113 }
114
115
116 /**
117 * Retrieves a string representation of this type.
118 *
119 * @return A string representation of this type.
120 */
121 public String toString()
122 {
123 return type;
124 }
125 }
126