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 2008 Sun Microsystems, Inc. 015 * Portions Copyright 2011-2016 ForgeRock AS. 016 */ 017package org.opends.server.types; 018 019import static org.opends.server.util.StaticUtils.*; 020 021/** 022 * This class implements an enumeration that holds the possible set of 023 * additional properties that can be included in an account status 024 * notification. 025 */ 026@org.opends.server.types.PublicAPI( 027 stability=org.opends.server.types.StabilityLevel.VOLATILE, 028 mayInstantiate=false, 029 mayExtend=false, 030 mayInvoke=true) 031public enum AccountStatusNotificationProperty 032{ 033 /** 034 * The property whose value will be the string representation of the 035 * DN of the password policy for the target user. This will be 036 * available for all notification types. 037 */ 038 PASSWORD_POLICY_DN("password-policy-dn"), 039 /** 040 * The property whose value will be a generalized time 041 * representation of the time at which the user's account will be 042 * unlocked. This will be available for the 043 * {@code ACCOUNT_TEMPORARILY_LOCKED} notification type. 044 */ 045 ACCOUNT_UNLOCK_TIME("account-unlock-time"), 046 /** 047 * The property whose value will be the number of seconds until the 048 * user's account is unlocked. This will be available for the 049 * {@code ACCOUNT_TEMPORARILY_LOCKED} notification type. 050 */ 051 SECONDS_UNTIL_UNLOCK("seconds-until-unlock"), 052 /** 053 * The property whose value will be a localized, human-readable 054 * representation of the length of time until the user's account is 055 * unlocked. This will be available for the 056 * {@code ACCOUNT_TEMPORARILY_LOCKED} notification type. 057 */ 058 TIME_UNTIL_UNLOCK("time-until-unlock"), 059 /** 060 * The property whose value will be the generalized time 061 * representation of the time that the user's password will expire. 062 * This will be available for the {@code PASSWORD_EXPIRING} 063 * notification type. 064 */ 065 PASSWORD_EXPIRATION_TIME("password-expiration-time"), 066 /** 067 * The property whose value will be the number of seconds until the 068 * user's password expires. This will be available for the 069 * {@code PASSWORD_EXPIRING} notification type. 070 */ 071 SECONDS_UNTIL_EXPIRATION("seconds-until-expiration"), 072 /** 073 * The property whose value will be a localized, human-readable 074 * representation of the length of time until the user's password 075 * expires. This will be available for the 076 * {@code PASSWORD_EXPIRING} notification type. 077 */ 078 TIME_UNTIL_EXPIRATION("time-until-expiration"), 079 /** 080 * The property whose value will be a clear-text representation of 081 * the user's old password. This may be available for the 082 * {@code PASSWORD_RESET} and {@code PASSWORD_CHANGED} notification 083 * types. 084 */ 085 OLD_PASSWORD("old-password"), 086 /** 087 * The property whose value will be a clear-text representation of 088 * the user's new password. This may be available for the 089 * {@code PASSWORD_RESET} and {@code PASSWORD_CHANGED} notification 090 * types. 091 */ 092 NEW_PASSWORD("new-password"); 093 094 /** The notification type name. */ 095 private String name; 096 097 /** 098 * Creates a new account status notification property with the 099 * provided name. 100 * 101 * @param name The name for this account status notification 102 * property. 103 */ 104 private AccountStatusNotificationProperty(String name) 105 { 106 this.name = name; 107 } 108 109 /** 110 * Retrieves the account status notification type with the specified 111 * name. 112 * 113 * @param name The name for the account status notification type 114 * to retrieve. 115 * 116 * @return The requested account status notification type, or 117 * <CODE>null</CODE> if there is no type with the given 118 * name. 119 */ 120 public static AccountStatusNotificationProperty forName(String name) 121 { 122 switch (toLowerCase(name)) 123 { 124 case "password-policy-dn": 125 return PASSWORD_POLICY_DN; 126 case "account-unlock-time": 127 return ACCOUNT_UNLOCK_TIME; 128 case "seconds-until-unlock": 129 return SECONDS_UNTIL_UNLOCK; 130 case "time-until-unlock": 131 return TIME_UNTIL_UNLOCK; 132 case "password-expiration-time": 133 return PASSWORD_EXPIRATION_TIME; 134 case "seconds-until-expiration": 135 return SECONDS_UNTIL_EXPIRATION; 136 case "time-until-expiration": 137 return TIME_UNTIL_EXPIRATION; 138 case "old-password": 139 return OLD_PASSWORD; 140 case "new-password": 141 return NEW_PASSWORD; 142 default: 143 return null; 144 } 145 } 146 147 /** 148 * Retrieves the name for this account status notification property. 149 * 150 * @return The name for this account status notification property. 151 */ 152 public String getName() 153 { 154 return name; 155 } 156 157 @Override 158 public String toString() 159 { 160 return name; 161 } 162}