[Home] [Help]
PACKAGE BODY: APPS.IRC_TEMPLATE_ASSOCIATION_API
Source
1 Package Body irc_template_association_api as
2 /* $Header: iritaapi.pkb 120.0 2005/09/27 08:11:22 sayyampe noship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33) := ' irc_template_association_api.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |-------------------< create_template_association >------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_template_association
13 (p_validate in boolean default false
14 ,p_template_id in number
15 ,p_effective_date in date default null
16 ,p_default_association in varchar2 default null
17 ,p_job_id in number default null
18 ,p_position_id in number default null
19 ,p_organization_id in number default null
20 ,p_start_date in date default null
21 ,p_end_date in date default null
22 ,p_object_version_number out nocopy number
23 ,p_template_association_id out nocopy number
24 )
25 is
26 --
27 -- Declare cursors and local variables
28 --
29 l_proc varchar2(72) := g_package||'create_template_association';
30 l_object_version_number number;
31 l_effective_date date;
32 l_start_date date := trunc(p_start_date);
33 begin
34 hr_utility.set_location('Entering:'|| l_proc, 10);
35 --
36 -- Issue a savepoint
37 --
38 savepoint create_template_association;
39
40 if p_effective_date is null then
41 l_effective_date:=l_start_date;
42 else
43 l_effective_date:=trunc(p_effective_date);
44 end if;
45
46 --
47 -- Call Before Process User Hook
48 --
49 begin
50 irc_template_association_bk1.create_template_association_b
51 (p_template_id => p_template_id
52 ,p_effective_date => l_effective_date
53 ,p_default_association => p_default_association
54 ,p_job_id => p_job_id
55 ,p_position_id => p_position_id
56 ,p_organization_id => p_organization_id
57 ,p_start_date => p_start_date
58 ,p_end_date => p_end_date
59 );
60 exception
61 when hr_api.cannot_find_prog_unit then
62 hr_api.cannot_find_prog_unit_error
63 (p_module_name => 'create_template_association'
64 ,p_hook_type => 'BP'
65 );
66 end;
67
68 --
69 -- Process Logic
70 --
71
72 irc_ita_ins.ins
73 (p_effective_date => l_effective_date
74 ,p_template_id => p_template_id
75 ,p_default_association => p_default_association
76 ,p_job_id => p_job_id
77 ,p_position_id => p_position_id
78 ,p_organization_id => p_organization_id
79 ,p_start_date => p_start_date
80 ,p_end_date => p_end_date
81 ,p_template_association_id => p_template_association_id
82 ,p_object_version_number => l_object_version_number
83 );
84
85
86 --
87 -- Call After Process User Hook
88 --
89 begin
90 irc_template_association_bk1.create_template_association_a
91 (p_template_association_id => p_template_association_id
92 ,p_template_id => p_template_id
93 ,p_effective_date => l_effective_date
94 ,p_default_association => p_default_association
95 ,p_job_id => p_job_id
96 ,p_position_id => p_position_id
97 ,p_organization_id => p_organization_id
98 ,p_start_date => p_start_date
99 ,p_end_date => p_end_date
100 );
101 exception
102 when hr_api.cannot_find_prog_unit then
103 hr_api.cannot_find_prog_unit_error
104 (p_module_name => 'create_template_association'
105 ,p_hook_type => 'AP'
106 );
107 end;
108 --
109 -- When in validation only mode raise the Validate_Enabled exception
110 --
111 if p_validate then
112 raise hr_api.validate_enabled;
113 end if;
114 --
115 -- Set all output arguments
116 --
117 p_object_version_number := l_object_version_number;
118 --
119 --
120 hr_utility.set_location(' Leaving:'||l_proc, 70);
121 exception
122 when hr_api.validate_enabled then
123 --
124 -- As the Validate_Enabled exception has been raised
125 -- we must rollback to the savepoint
126 --
127 rollback to create_template_association;
128 --
129 -- Only set output warning arguments
130 -- (Any key or derived arguments must be set to null
131 -- when validation only mode is being used.)
132 --
133 p_object_version_number := null;
134 p_template_association_id := null;
135 hr_utility.set_location(' Leaving:'||l_proc, 80);
136 when others then
137 --
138 -- A validation or unexpected error has occured
139 --
140 rollback to create_template_association;
141 hr_utility.set_location(' Leaving:'||l_proc, 90);
142 raise;
143 end create_template_association;
144
145 --
146 -- ----------------------------------------------------------------------------
147 -- |--------------------< update_template_association >-----------------------|
148 -- ----------------------------------------------------------------------------
149 --
150 procedure update_template_association
151 ( p_validate in boolean default false
152 ,p_effective_date in date default null
153 ,p_template_association_id in number
154 ,p_template_id in number
155 ,p_default_association in varchar2 default null
156 ,p_job_id in number default null
157 ,p_position_id in number default null
158 ,p_organization_id in number default null
159 ,p_start_date in date default null
160 ,p_end_date in date default null
161 ,p_object_version_number in out nocopy number
162
163 ) is
164 --
165 -- Declare cursors and local variables
166 --
167
168 l_proc varchar2(72) := g_package||'update_template_association';
169 l_object_version_number number;
170 l_effective_date date;
171 l_start_date date := trunc(p_start_date);
172
173 begin
174 hr_utility.set_location('Entering:'|| l_proc||p_object_version_number, 10);
175 --
176 -- Issue a savepoint
177 --
178 savepoint update_template_association;
179 --
180 -- Truncate the time portion from all IN date parameters
181 --
182 if p_effective_date is null then
183 l_effective_date:= l_start_date;
184 else
185 l_effective_date:=trunc(p_effective_date);
186 end if;
187 --
188 -- Call Before Process User Hook
189 --
190 begin
191 irc_template_association_bk2.update_template_association_b
192 (p_template_association_id => p_template_association_id
193 ,p_template_id => p_template_id
194 ,p_effective_date => l_effective_date
195 ,p_default_association => p_default_association
196 ,p_job_id => p_job_id
197 ,p_position_id => p_position_id
198 ,p_organization_id => p_organization_id
199 ,p_start_date => p_start_date
200 ,p_end_date => p_end_date
201 );
202 exception
203 when hr_api.cannot_find_prog_unit then
204 hr_api.cannot_find_prog_unit_error
205 (p_module_name => 'update_template_association'
206 ,p_hook_type => 'BP'
207 );
208 end;
209
210 --
211 -- Process Logic
212 --
213 l_object_version_number := p_object_version_number;
214
215 irc_ita_upd.upd
216 (p_effective_date => l_effective_date
217 ,p_template_association_id => p_template_association_id
218 ,p_object_version_number => l_object_version_number
219 ,p_template_id => p_template_id
220 ,p_default_association => p_default_association
221 ,p_job_id => p_job_id
222 ,p_position_id => p_position_id
223 ,p_organization_id => p_organization_id
224 ,p_start_date => p_start_date
225 ,p_end_date => p_end_date
226 );
227
228 --
229 -- Call After Process User Hook
230 --
231 begin
232 irc_template_association_bk2.update_template_association_a
233 (p_template_association_id => p_template_association_id
234 ,p_template_id => p_template_id
235 ,p_effective_date => l_effective_date
236 ,p_default_association => p_default_association
237 ,p_job_id => p_job_id
238 ,p_position_id => p_position_id
239 ,p_organization_id => p_organization_id
240 ,p_start_date => p_start_date
241 ,p_end_date => p_end_date
242 );
243 exception
244 when hr_api.cannot_find_prog_unit then
245 hr_api.cannot_find_prog_unit_error
246 (p_module_name => 'update_template_association'
247 ,p_hook_type => 'AP'
248 );
249 end;
250 --
251 -- When in validation only mode raise the Validate_Enabled exception
252 --
253 if p_validate then
254 raise hr_api.validate_enabled;
255 end if;
256 --
257 p_object_version_number := l_object_version_number;
258 --
259 hr_utility.set_location(' Leaving:'||l_proc||p_object_version_number, 70);
260 exception
261 when hr_api.validate_enabled then
262 --
263 -- As the Validate_Enabled exception has been raised
264 -- we must rollback to the savepoint
265 --
266 rollback to update_template_association;
267 --
268 -- Only set output warning arguments
269 -- (Any key or derived arguments must be set to null
270 -- when validation only mode is being used.)
271 --
272 hr_utility.set_location(' Leaving:'||l_proc, 80);
273 when others then
274 --
275 -- A validation or unexpected error has occured
276 --
277 rollback to update_template_association;
278 hr_utility.set_location(' Leaving:'||l_proc, 90);
279 raise;
280 end update_template_association;
281 --
282 -- ----------------------------------------------------------------------------
283 -- |----------------------< delete_template_association >---------------------|
284 -- ----------------------------------------------------------------------------
285 --
286 procedure delete_template_association
287 (p_validate in boolean default false
288 ,p_template_association_id in number
289 ,p_object_version_number in number
290 ) is
291
292 --
293 -- Declare cursors and local variables
294 --
295
296 l_proc varchar2(72) := g_package||'delete_template_association';
297 l_object_version_number number;
298
299 begin
300 hr_utility.set_location('Entering:'|| l_proc, 10);
301 --
302 -- Issue a savepoint
303 --
304 savepoint delete_template_association;
305
306 --
307 -- Call Before Process User Hook
308 --
309 begin
310 irc_template_association_bk3.delete_template_association_b
311 (p_template_association_id => p_template_association_id
312 ,p_object_version_number => p_object_version_number
313 );
314 exception
315 when hr_api.cannot_find_prog_unit then
316 hr_api.cannot_find_prog_unit_error
317 (p_module_name => 'delete_template_association'
318 ,p_hook_type => 'BP'
319 );
320 end;
321
322 --
323 -- Validation in addition to Row Handlers
324 --
325
326 -- NONE
327
328 --
329 -- Process Logic
330 --
331 irc_ita_del.del
332 (p_template_association_id => p_template_association_id
333 ,p_object_version_number => p_object_version_number
334 );
335
336 --
337 -- Call After Process User Hook
338 --
339 begin
340 irc_template_association_bk3.delete_template_association_a
341 (p_template_association_id => p_template_association_id
342 ,p_object_version_number => p_object_version_number
343 );
344 exception
345 when hr_api.cannot_find_prog_unit then
346 hr_api.cannot_find_prog_unit_error
347 (p_module_name => 'delete_template_association'
348 ,p_hook_type => 'AP'
349 );
350 end;
351 --
352 -- When in validation only mode raise the Validate_Enabled exception
353 --
354 if p_validate then
355 raise hr_api.validate_enabled;
356 end if;
357 hr_utility.set_location(' Leaving:'||l_proc, 70);
358
359 exception
360 when hr_api.validate_enabled then
361 --
362 -- As the Validate_Enabled exception has been raised
363 -- we must rollback to the savepoint
364 --
365 rollback to delete_template_association;
366 --
367 -- Only set output warning arguments
368 -- (Any key or derived arguments must be set to null
369 -- when validation only mode is being used.)
370 --
371 hr_utility.set_location(' Leaving:'||l_proc, 80);
372 when others then
373 --
374 -- A validation or unexpected error has occured
375 --
376 rollback to delete_template_association;
377 hr_utility.set_location(' Leaving:'||l_proc, 90);
378 raise;
379 end delete_template_association;
380
381
382
383 --
384 end irc_template_association_api;