DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_ASSIGNMENT_DETAILS_API

Source


1 Package Body irc_assignment_details_api as
2 /* $Header: iriadapi.pkb 120.1.12000000.2 2007/03/22 15:22:54 vboggava noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  irc_assignment_details_api.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |-----------------------< create_assignment_details >----------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_assignment_details
13   (p_validate                      in     boolean  default false
14   ,p_effective_date                in     date
15   ,p_assignment_id                 in     number
16   ,p_attempt_id                    in     number   default null
17   ,p_qualified                     in     varchar2 default null
18   ,p_considered                    in     varchar2 default null
19   ,p_assignment_details_id            out nocopy   number
20   ,p_details_version                  out nocopy   number
21   ,p_effective_start_date             out nocopy   date
22   ,p_effective_end_date               out nocopy   date
23   ,p_object_version_number            out nocopy   number
24   ) is
25   --
26   -- Declare cursors and local variables
27   --
28   l_latest_details         irc_assignment_details_f.latest_details%TYPE;
29   -- out variables
30   l_assignment_details_id  irc_assignment_details_f.assignment_details_id%TYPE;
31   l_details_version        irc_assignment_details_f.details_version%TYPE;
32   l_effective_start_date   irc_assignment_details_f.effective_start_date%TYPE;
33   l_effective_end_date     irc_assignment_details_f.effective_end_date%TYPE;
34   l_object_version_number  irc_assignment_details_f.object_version_number%TYPE;
35 
36   l_effective_date      date;
37   l_proc                varchar2(72) := g_package||'create_assignment_details';
38 begin
39   hr_utility.set_location('Entering:'|| l_proc, 10);
40   --
41   -- Issue a savepoint
42   --
43   savepoint create_assignment_details;
44   --
45   -- Truncate the time portion from all IN date parameters
46   --
47   l_effective_date := trunc(p_effective_date);
48 
49   hr_utility.set_location(l_proc, 20);
50   --
51   -- Call Before Process User Hook
52   --
53   begin
54     irc_assignment_details_bk1.create_assignment_details_b
55       (p_effective_date                => l_effective_date
56       ,p_assignment_id                 => p_assignment_id
57       ,p_attempt_id                    => p_attempt_id
58       );
59   exception
60     when hr_api.cannot_find_prog_unit then
61       hr_api.cannot_find_prog_unit_error
62         (p_module_name => 'create_assignment_details'
63         ,p_hook_type   => 'BP'
64         );
65   end;
66   hr_utility.set_location(l_proc, 30);
67   --
68   -- Validation in addition to Row Handlers
69   --
70 
71   --
72   -- Process Logic
73   --
74   irc_iad_ins.ins
75     (p_effective_date             => l_effective_date
76     ,p_assignment_id              => p_assignment_id
77     ,p_attempt_id                 => p_attempt_id
78     ,p_qualified                  => p_qualified
79     ,p_considered                 => p_considered
80     ,p_assignment_details_id      => l_assignment_details_id
81     ,p_details_version            => l_details_version
82     ,p_latest_details             => l_latest_details
83     ,p_effective_start_date       => l_effective_start_date
84     ,p_effective_end_date         => l_effective_end_date
85     ,p_object_version_number      => l_object_version_number
86     );
87   hr_utility.set_location(' Leaving:'||l_proc, 50);
88   --
89   -- Call After Process User Hook
90   --
91   begin
92     irc_assignment_details_bk1.create_assignment_details_a
93       (p_effective_date                => l_effective_date
94       ,p_assignment_id                 => p_assignment_id
95       ,p_attempt_id                    => p_attempt_id
96       ,p_qualified                     => p_qualified
97       ,p_considered                    => p_considered
98       ,p_assignment_details_id         => l_assignment_details_id
99       ,p_details_version               => l_details_version
100       ,p_latest_details                => l_latest_details
101       ,p_effective_start_date          => l_effective_start_date
102       ,p_effective_end_date            => l_effective_end_date
103       ,p_object_version_number         => l_object_version_number
104       );
105   exception
106     when hr_api.cannot_find_prog_unit then
107       hr_api.cannot_find_prog_unit_error
108         (p_module_name => 'create_assignment_details'
109         ,p_hook_type   => 'AP'
110         );
111   end;
112   --
113   -- When in validation only mode raise the Validate_Enabled exception
114   --
115   if p_validate then
116     raise hr_api.validate_enabled;
117   end if;
118   --
119   -- Set all IN OUT and OUT parameters with out values
120   --
121   p_assignment_details_id  := l_assignment_details_id;
122   p_details_version        := l_details_version;
123   p_effective_start_date   := l_effective_start_date;
124   p_effective_end_date     := l_effective_end_date;
125   p_object_version_number  := l_object_version_number;
126   --
127   hr_utility.set_location(' Leaving:'||l_proc, 70);
128 exception
129   when hr_api.validate_enabled then
130     --
131     -- As the Validate_Enabled exception has been raised
132     -- we must rollback to the savepoint
133     --
134     rollback to create_assignment_details;
135     --
136     -- Reset IN OUT parameters and set OUT parameters
137     -- (Any key or derived arguments must be set to null
138     -- when validation only mode is being used.)
139     --
140     p_assignment_details_id  := null;
141     p_details_version        := null;
142     p_effective_start_date   := null;
143     p_effective_end_date     := null;
144     p_object_version_number  := null;
145     --
146     hr_utility.set_location(' Leaving:'||l_proc, 80);
147   when others then
148     --
149     -- A validation or unexpected error has occured
150     --
151     rollback to create_assignment_details;
152     --
153     -- Reset IN OUT parameters and set all
154     -- OUT parameters, including warnings, to null
155     --
156     p_assignment_details_id  := null;
157     p_details_version        := null;
158     p_effective_start_date   := null;
159     p_effective_end_date     := null;
160     p_object_version_number  := null;
161     --
162     hr_utility.set_location(' Leaving:'||l_proc, 90);
163     raise;
164 end create_assignment_details;
165 --
166 -- ----------------------------------------------------------------------------
167 -- |-----------------------< update_assignment_details >----------------------|
168 -- ----------------------------------------------------------------------------
169 --
170 procedure update_assignment_details
171   (p_validate                      in     boolean  default false
172   ,p_effective_date                in     date
173   ,p_datetrack_update_mode         in     varchar2
174   ,p_assignment_id                 in     number   default hr_api.g_number
175   ,p_attempt_id                    in     number   default hr_api.g_number
176   ,p_qualified                     in     varchar2 default null
177   ,p_considered                    in     varchar2 default null
178   ,p_assignment_details_id         in out nocopy   number
179   ,p_object_version_number         in out nocopy   number
180   ,p_details_version                  out nocopy   number
181   ,p_effective_start_date             out nocopy   date
182   ,p_effective_end_date               out nocopy   date
183   ) is
184   --
185   -- Declare cursors and local variables
186   --
187   l_latest_details         irc_assignment_details_f.latest_details%TYPE;
188   -- out variables
189   l_assignment_details_id  irc_assignment_details_f.assignment_details_id%TYPE;
190   l_details_version        irc_assignment_details_f.details_version%TYPE;
191   l_effective_start_date   irc_assignment_details_f.effective_start_date%TYPE;
192   l_effective_end_date     irc_assignment_details_f.effective_end_date%TYPE;
193   l_object_version_number  irc_assignment_details_f.object_version_number%TYPE;
194 
195   l_effective_date      date;
196   l_proc                varchar2(72) := g_package||'update_assignment_details';
197 begin
198   hr_utility.set_location('Entering:'|| l_proc, 10);
199   --
200   -- Issue a savepoint
201   --
202   savepoint update_assignment_details;
203   --
204   -- Truncate the time portion from all IN date parameters
205   --
206   l_effective_date := trunc(p_effective_date);
207   --
208   l_assignment_details_id := p_assignment_details_id;
209   l_object_version_number := p_object_version_number;
210 
211   hr_utility.set_location(l_proc, 20);
212   --
213   -- Call Before Process User Hook
214   --
215   begin
216     irc_assignment_details_bk2.update_assignment_details_b
217       (p_effective_date                => l_effective_date
218       ,p_datetrack_update_mode         => p_datetrack_update_mode
219       ,p_assignment_id                 => p_assignment_id
220       ,p_attempt_id                    => p_attempt_id
221       ,p_assignment_details_id         => l_assignment_details_id
222       ,p_object_version_number         => l_object_version_number
223       ,p_qualified                     => p_qualified
224       ,p_considered                    => p_considered
225       );
226   exception
227     when hr_api.cannot_find_prog_unit then
228       hr_api.cannot_find_prog_unit_error
229         (p_module_name => 'update_assignment_details'
230         ,p_hook_type   => 'BP'
231         );
232   end;
233   hr_utility.set_location(l_proc, 30);
234   --
235   -- Validation in addition to Row Handlers
236   --
237 
238   --
239   -- Process Logic
240   --
241   irc_iad_upd.upd
242     (p_effective_date             => l_effective_date
243     ,p_datetrack_mode             => p_datetrack_update_mode
244     ,p_assignment_id              => p_assignment_id
245     ,p_attempt_id                 => p_attempt_id
246     ,p_qualified                  => p_qualified
247     ,p_considered                 => p_considered
248     ,p_assignment_details_id      => l_assignment_details_id
249     ,p_details_version            => l_details_version
250     ,p_latest_details             => l_latest_details
251     ,p_effective_start_date       => l_effective_start_date
252     ,p_effective_end_date         => l_effective_end_date
253     ,p_object_version_number      => l_object_version_number
254     );
255   hr_utility.set_location(' Leaving:'||l_proc, 50);
256   --
257   -- Call After Process User Hook
258   --
259   begin
260     irc_assignment_details_bk2.update_assignment_details_a
261       (p_effective_date                => l_effective_date
262       ,p_datetrack_update_mode         => p_datetrack_update_mode
263       ,p_assignment_details_id         => l_assignment_details_id
264       ,p_assignment_id                 => p_assignment_id
265       ,p_attempt_id                    => p_attempt_id
266       ,p_details_version               => l_details_version
267       ,p_latest_details                => l_latest_details
268       ,p_effective_start_date          => l_effective_start_date
269       ,p_effective_end_date            => l_effective_end_date
270       ,p_object_version_number         => l_object_version_number
271       ,p_qualified                     => p_qualified
272       ,p_considered                    => p_considered
273       );
274   exception
275     when hr_api.cannot_find_prog_unit then
276       hr_api.cannot_find_prog_unit_error
277         (p_module_name => 'update_assignment_details'
278         ,p_hook_type   => 'AP'
279         );
280   end;
281   --
282   -- When in validation only mode raise the Validate_Enabled exception
283   --
284   if p_validate then
285     raise hr_api.validate_enabled;
286   end if;
287   --
288   -- Set all IN OUT and OUT parameters with out values
289   --
290   p_assignment_details_id  := l_assignment_details_id;
291   p_object_version_number  := l_object_version_number;
292   p_details_version        := l_details_version;
293   p_effective_start_date   := l_effective_start_date;
294   p_effective_end_date     := l_effective_end_date;
295   --
296   hr_utility.set_location(' Leaving:'||l_proc, 70);
297 exception
298   when hr_api.validate_enabled then
299     --
300     -- As the Validate_Enabled exception has been raised
301     -- we must rollback to the savepoint
302     --
303     rollback to update_assignment_details;
304     --
305     -- Reset IN OUT parameters and set OUT parameters
306     -- (Any key or derived arguments must be set to null
307     -- when validation only mode is being used.)
308     --
309     p_assignment_details_id  := p_assignment_details_id;
310     p_object_version_number  := p_object_version_number;
311     p_details_version        := null;
312     p_effective_start_date   := null;
313     p_effective_end_date     := null;
314     --
315     hr_utility.set_location(' Leaving:'||l_proc, 80);
316   when others then
317     --
318     -- A validation or unexpected error has occured
319     --
320     rollback to update_assignment_details;
321     --
322     -- Reset IN OUT parameters and set all
323     -- OUT parameters, including warnings, to null
324     --
325     p_assignment_details_id  := p_assignment_details_id;
326     p_object_version_number  := p_object_version_number;
327     p_details_version        := null;
328     p_effective_start_date   := null;
329     p_effective_end_date     := null;
330     --
331     hr_utility.set_location(' Leaving:'||l_proc, 90);
332     raise;
333 end update_assignment_details;
334 --
335 end irc_assignment_details_api;