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 legal-notices/CDDLv1_0.txt 010 * or http://forgerock.org/license/CDDLv1.0.html. 011 * See the License for the specific language governing permissions 012 * and limitations under the License. 013 * 014 * When distributing Covered Code, include this CDDL HEADER in each 015 * file and include the License file at legal-notices/CDDLv1_0.txt. 016 * If applicable, add the following below this CDDL HEADER, with the 017 * fields enclosed by brackets "[]" replaced with your own identifying 018 * information: 019 * Portions Copyright [yyyy] [name of copyright owner] 020 * 021 * CDDL HEADER END 022 * 023 * 024 * Copyright 2008 Sun Microsystems, Inc. 025 * Portions Copyright 2011-2015 ForgeRock AS. 026 */ 027package org.opends.server.types; 028 029import static org.opends.server.util.StaticUtils.*; 030 031 032 033/** 034 * This class implements an enumeration that holds the possible set of 035 * additional properties that can be included in an account status 036 * notification. 037 */ 038@org.opends.server.types.PublicAPI( 039 stability=org.opends.server.types.StabilityLevel.VOLATILE, 040 mayInstantiate=false, 041 mayExtend=false, 042 mayInvoke=true) 043public enum AccountStatusNotificationProperty 044{ 045 /** 046 * The property whose value will be the string representation of the 047 * DN of the password policy for the target user. This will be 048 * available for all notification types. 049 */ 050 PASSWORD_POLICY_DN("password-policy-dn"), 051 052 053 054 /** 055 * The property whose value will be a generalized time 056 * representation of the time at which the user's account will be 057 * unlocked. This will be available for the 058 * {@code ACCOUNT_TEMPORARILY_LOCKED} notification type. 059 */ 060 ACCOUNT_UNLOCK_TIME("account-unlock-time"), 061 062 063 064 /** 065 * The property whose value will be the number of seconds until the 066 * user's account is unlocked. This will be available for the 067 * {@code ACCOUNT_TEMPORARILY_LOCKED} notification type. 068 */ 069 SECONDS_UNTIL_UNLOCK("seconds-until-unlock"), 070 071 072 073 /** 074 * The property whose value will be a localized, human-readable 075 * representation of the length of time until the user's account is 076 * unlocked. This will be available for the 077 * {@code ACCOUNT_TEMPORARILY_LOCKED} notification type. 078 */ 079 TIME_UNTIL_UNLOCK("time-until-unlock"), 080 081 082 083 /** 084 * The property whose value will be the generalized time 085 * representation of the time that the user's password will expire. 086 * This will be available for the {@code PASSWORD_EXPIRING} 087 * notification type. 088 */ 089 PASSWORD_EXPIRATION_TIME("password-expiration-time"), 090 091 092 093 /** 094 * The property whose value will be the number of seconds until the 095 * user's password expires. This will be available for the 096 * {@code PASSWORD_EXPIRING} notification type. 097 */ 098 SECONDS_UNTIL_EXPIRATION("seconds-until-expiration"), 099 100 101 102 /** 103 * The property whose value will be a localized, human-readable 104 * representation of the length of time until the user's password 105 * expires. This will be available for the 106 * {@code PASSWORD_EXPIRING} notification type. 107 */ 108 TIME_UNTIL_EXPIRATION("time-until-expiration"), 109 110 111 112 /** 113 * The property whose value will be a clear-text representation of 114 * the user's old password. This may be available for the 115 * {@code PASSWORD_RESET} and {@code PASSWORD_CHANGED} notification 116 * types. 117 */ 118 OLD_PASSWORD("old-password"), 119 120 121 122 /** 123 * The property whose value will be a clear-text representation of 124 * the user's new password. This may be available for the 125 * {@code PASSWORD_RESET} and {@code PASSWORD_CHANGED} notification 126 * types. 127 */ 128 NEW_PASSWORD("new-password"); 129 130 131 132 /** The notification type name. */ 133 private String name; 134 135 136 137 /** 138 * Creates a new account status notification property with the 139 * provided name. 140 * 141 * @param name The name for this account status notification 142 * property. 143 */ 144 private AccountStatusNotificationProperty(String name) 145 { 146 this.name = name; 147 } 148 149 150 151 /** 152 * Retrieves the account status notification type with the specified 153 * name. 154 * 155 * @param name The name for the account status notification type 156 * to retrieve. 157 * 158 * @return The requested account status notification type, or 159 * <CODE>null</CODE> if there is no type with the given 160 * name. 161 */ 162 public static AccountStatusNotificationProperty forName(String name) 163 { 164 String lowerName = toLowerCase(name); 165 if (lowerName.equals("password-policy-dn")) 166 { 167 return PASSWORD_POLICY_DN; 168 } 169 else if (lowerName.equals("account-unlock-time")) 170 { 171 return ACCOUNT_UNLOCK_TIME; 172 } 173 else if (lowerName.equals("seconds-until-unlock")) 174 { 175 return SECONDS_UNTIL_UNLOCK; 176 } 177 else if (lowerName.equals("time-until-unlock")) 178 { 179 return TIME_UNTIL_UNLOCK; 180 } 181 else if (lowerName.equals("password-expiration-time")) 182 { 183 return PASSWORD_EXPIRATION_TIME; 184 } 185 else if (lowerName.equals("seconds-until-expiration")) 186 { 187 return SECONDS_UNTIL_EXPIRATION; 188 } 189 else if (lowerName.equals("time-until-expiration")) 190 { 191 return TIME_UNTIL_EXPIRATION; 192 } 193 else if (lowerName.equals("old-password")) 194 { 195 return OLD_PASSWORD; 196 } 197 else if (lowerName.equals("new-password")) 198 { 199 return NEW_PASSWORD; 200 } 201 else 202 { 203 return null; 204 } 205 } 206 207 208 209 /** 210 * Retrieves the name for this account status notification property. 211 * 212 * @return The name for this account status notification property. 213 */ 214 public String getName() 215 { 216 return name; 217 } 218 219 220 221 /** 222 * Retrieves a string representation of this account status 223 * notification property. 224 * 225 * @return A string representation of this account status 226 * notification property. 227 */ 228 public String toString() 229 { 230 return name; 231 } 232} 233