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