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.directory.api.i18n.I18n;
27
28
29
30
31
32
33
34 public class TriggerSpecification
35 {
36
37 private LdapOperation ldapOperation;
38
39 private ActionTime actionTime;
40
41 private List<SPSpec> spSpecs;
42
43
44
45
46
47
48
49
50
51 public TriggerSpecification( LdapOperation ldapOperation, ActionTime actionTime, List<SPSpec> spSpecs )
52 {
53 super();
54
55 if ( ( ldapOperation == null ) || ( actionTime == null ) || ( spSpecs == null ) )
56 {
57 throw new NullPointerException( I18n.err( I18n.ERR_11000_TRIGGER_SPECIFICATION_INIT_WITH_NULL ) );
58 }
59
60 if ( spSpecs.isEmpty() )
61 {
62 throw new IllegalArgumentException( I18n.err( I18n.ERR_11001_TRIGGER_SPECIFICATION_INIT_WITH_EPTY_SPEC_LIST ) );
63 }
64
65 this.ldapOperation = ldapOperation;
66 this.actionTime = actionTime;
67 this.spSpecs = spSpecs;
68 }
69
70
71
72
73
74
75
76 public ActionTime getActionTime()
77 {
78 return actionTime;
79 }
80
81
82
83
84
85
86
87 public LdapOperation getLdapOperation()
88 {
89 return ldapOperation;
90 }
91
92
93
94
95
96
97
98 public List<SPSpec> getSPSpecs()
99 {
100 return spSpecs;
101 }
102
103
104
105
106 public static class SPSpec
107 {
108 private String name;
109
110 private List<StoredProcedureOption> options;
111
112 private List<StoredProcedureParameter> parameters;
113
114
115
116
117
118
119
120
121
122 public SPSpec( String name, List<StoredProcedureOption> options, List<StoredProcedureParameter> parameters )
123 {
124 super();
125 this.name = name;
126 this.options = options;
127 this.parameters = parameters;
128 }
129
130
131
132
133
134
135
136 public String getName()
137 {
138 return name;
139 }
140
141
142
143
144
145
146
147 public List<StoredProcedureOption> getOptions()
148 {
149 return options;
150 }
151
152
153
154
155
156
157
158 public List<StoredProcedureParameter> getParameters()
159 {
160 return parameters;
161 }
162
163
164
165
166
167 @Override
168 public int hashCode()
169 {
170 int h = 37;
171
172 h = h * 17 + ( ( name == null ) ? 0 : name.hashCode() );
173 h = h * 17 + ( ( options == null ) ? 0 : options.hashCode() );
174 h = h * 17 + ( ( parameters == null ) ? 0 : parameters.hashCode() );
175
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
191 if ( obj == null )
192 {
193 return false;
194 }
195
196 if ( getClass() != obj.getClass() )
197 {
198 return false;
199 }
200
201 SPSpec other = ( SPSpec ) obj;
202
203 if ( name == null )
204 {
205 if ( other.name != null )
206 {
207 return false;
208 }
209 }
210 else if ( !name.equals( other.name ) )
211 {
212 return false;
213 }
214
215 if ( options == null )
216 {
217 if ( other.options != null )
218 {
219 return false;
220 }
221 }
222 else if ( !options.equals( other.options ) )
223 {
224 return false;
225 }
226
227 if ( parameters == null )
228 {
229 if ( other.parameters != null )
230 {
231 return false;
232 }
233 }
234 else if ( !parameters.equals( other.parameters ) )
235 {
236 return false;
237 }
238
239 return true;
240 }
241 }
242 }