1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.directory.api.ldap.trigger;
22
23
24 import java.util.List;
25
26 import org.apache.commons.lang.NullArgumentException;
27 import org.apache.directory.api.i18n.I18n;
28
29
30
31
32
33
34
35 public class TriggerSpecification
36 {
37
38 private LdapOperation ldapOperation;
39
40 private ActionTime actionTime;
41
42 private List<SPSpec> spSpecs;
43
44
45
46
47
48
49
50
51
52 public TriggerSpecification( LdapOperation ldapOperation, ActionTime actionTime, List<SPSpec> spSpecs )
53 {
54 super();
55
56 if ( ( ldapOperation == null ) || ( actionTime == null ) || ( spSpecs == null ) )
57 {
58 throw new NullArgumentException( I18n.err( I18n.ERR_04331 ) );
59 }
60
61 if ( spSpecs.isEmpty() )
62 {
63 throw new IllegalArgumentException( I18n.err( I18n.ERR_04332 ) );
64 }
65
66 this.ldapOperation = ldapOperation;
67 this.actionTime = actionTime;
68 this.spSpecs = spSpecs;
69 }
70
71
72
73
74
75
76
77 public ActionTime getActionTime()
78 {
79 return actionTime;
80 }
81
82
83
84
85
86
87
88 public LdapOperation getLdapOperation()
89 {
90 return ldapOperation;
91 }
92
93
94
95
96
97
98
99 public List<SPSpec> getSPSpecs()
100 {
101 return spSpecs;
102 }
103
104
105
106
107 public static class SPSpec
108 {
109 private String name;
110
111 private List<StoredProcedureOption> options;
112
113 private List<StoredProcedureParameter> parameters;
114
115
116
117
118
119
120
121
122
123 public SPSpec( String name, List<StoredProcedureOption> options, List<StoredProcedureParameter> parameters )
124 {
125 super();
126 this.name = name;
127 this.options = options;
128 this.parameters = parameters;
129 }
130
131
132
133
134
135
136
137 public String getName()
138 {
139 return name;
140 }
141
142
143
144
145
146
147
148 public List<StoredProcedureOption> getOptions()
149 {
150 return options;
151 }
152
153
154
155
156
157
158
159 public List<StoredProcedureParameter> getParameters()
160 {
161 return parameters;
162 }
163
164
165
166
167
168 @Override
169 public int hashCode()
170 {
171 int h = 37;
172
173 h = h * 17 + ( ( name == null ) ? 0 : name.hashCode() );
174 h = h * 17 + ( ( options == null ) ? 0 : options.hashCode() );
175 h = h * 17 + ( ( parameters == null ) ? 0 : parameters.hashCode() );
176 return h;
177 }
178
179
180
181
182
183 @Override
184 public boolean equals( Object obj )
185 {
186 if ( this == obj )
187 {
188 return true;
189 }
190 if ( obj == null )
191 {
192 return false;
193 }
194 if ( getClass() != obj.getClass() )
195 {
196 return false;
197 }
198 final SPSpec other = ( SPSpec ) obj;
199 if ( name == null )
200 {
201 if ( other.name != null )
202 {
203 return false;
204 }
205 }
206 else if ( !name.equals( other.name ) )
207 {
208 return false;
209 }
210 if ( options == null )
211 {
212 if ( other.options != null )
213 {
214 return false;
215 }
216 }
217 else if ( !options.equals( other.options ) )
218 {
219 return false;
220 }
221 if ( parameters == null )
222 {
223 if ( other.parameters != null )
224 {
225 return false;
226 }
227 }
228 else if ( !parameters.equals( other.parameters ) )
229 {
230 return false;
231 }
232 return true;
233 }
234
235 }
236
237 }