1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.server.kerberos.shared.messages.value;
21
22
23 import java.util.Arrays;
24 import java.util.Collections;
25 import java.util.List;
26
27 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
28
29
30
31
32
33
34 public final class LastRequestType implements Comparable<LastRequestType>
35 {
36
37
38
39 public static final LastRequestType NONE = new LastRequestType( 0, AuthenticationLevel.NONE.toString() );
40
41
42
43
44 public static final LastRequestType TIME_OF_INITIAL_TGT = new LastRequestType( 1, "time of initial ticket" );
45
46
47
48
49 public static final LastRequestType TIME_OF_INITIAL_REQ = new LastRequestType( 2, "time of initial request" );
50
51
52
53
54 public static final LastRequestType TIME_OF_NEWEST_TGT = new LastRequestType( 3, "time of newest ticket" );
55
56
57
58
59 public static final LastRequestType TIME_OF_LAST_RENEWAL = new LastRequestType( 4, "time of last renewal" );
60
61
62
63
64 public static final LastRequestType TIME_OF_LAST_REQ = new LastRequestType( 5, "time of last request" );
65
66
67
68
69 public static final LastRequestType TIME_OF_PASSWORD_EXP = new LastRequestType( 6, "time of password expiration" );
70
71
72
73
74 private static final LastRequestType[] values =
75 { NONE, TIME_OF_INITIAL_TGT, TIME_OF_INITIAL_REQ, TIME_OF_NEWEST_TGT, TIME_OF_LAST_RENEWAL, TIME_OF_LAST_REQ,
76 TIME_OF_PASSWORD_EXP };
77
78
79
80
81 public static final List<LastRequestType> VALUES = Collections.unmodifiableList( Arrays.asList( values ) );
82
83
84
85
86 private final String name;
87
88
89
90
91 private final int ordinal;
92
93
94
95
96
97 private LastRequestType( int ordinal, String name )
98 {
99 this.ordinal = ordinal;
100 this.name = name;
101 }
102
103
104
105
106
107
108
109
110 public static LastRequestType getTypeByOrdinal( int type )
111 {
112 for ( int ii = 0; ii < values.length; ii++ )
113 {
114 if ( values[ii].ordinal == type )
115 {
116 return values[ii];
117 }
118 }
119
120 return NONE;
121 }
122
123
124
125
126
127
128
129 public int getOrdinal()
130 {
131 return ordinal;
132 }
133
134
135 public int compareTo( LastRequestType that )
136 {
137 return ordinal - that.ordinal;
138 }
139
140
141 public String toString()
142 {
143 return name + " (" + ordinal + ")";
144 }
145 }