DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_TCP_API

Source


1 Package Body hr_tcp_api as
2 /* $Header: hrtcpapi.pkb 115.2 2002/12/05 09:12:55 raranjan noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  hr_tcp_api.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |----------------------< create_tcp >---------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_tcp
13   (p_validate                      in     boolean  default false
14   ,p_effective_date                in     date
15   ,p_template_item_context_id      in     number
16   ,p_template_tab_page_id          in     number
17   ,p_template_item_context_page_i     out nocopy number
18   ,p_object_version_number            out nocopy number
19   ) is
20   --
21   -- Declare cursors and local variables
22   --
23 
24   l_template_tab_page_id          number ;
25   l_template_item_context_page_i number ;
26   l_object_version_number number;
27   l_temp number;
28 
29   CURSOR cur_api_val
30   IS
31   SELECT source_form_template_id
32   FROM hr_source_form_templates hsf
33     ,hr_template_windows_b htw
34     ,hr_template_canvases_b htb
35     ,hr_template_tab_pages_b htt
36   WHERE htt.template_tab_page_id = p_template_tab_page_id
37   AND htt.template_canvas_id = htb.template_canvas_id
38   AND htb.template_window_id = htw.template_window_id
39   AND htw.form_template_id = hsf.form_template_id_to;
40 
41   l_proc                varchar2(72) := g_package||'create_tcp';
42 begin
43 
44   hr_utility.set_location('Entering:'|| l_proc, 10);
45   --
46   -- Issue a savepoint
47   --
48   savepoint create_tcp;
49   --
50   -- Truncate the time portion from all IN date parameters
51   --
52     -- p_effective_date := TRUNC(p_effective_date);
53   --
54   -- Call Before Process User Hook
55   --
56   begin
57     hr_tcp_api_bk1.create_tcp_b
58       (p_effective_date                => TRUNC(p_effective_date)
59        ,p_template_item_context_id     => p_template_item_context_id
60        ,p_template_tab_page_id         => p_template_tab_page_id
61       );
62   exception
63     when hr_api.cannot_find_prog_unit then
64       hr_api.cannot_find_prog_unit_error
65         (p_module_name => 'create_tcp'
66         ,p_hook_type   => 'BP'
67         );
68   end;
69   --
70   -- Validation in addition to Row Handlers
71   --
72   hr_utility.set_location('At:'|| l_proc, 10);
73 
74      OPEN cur_api_val;
75      FETCH cur_api_val INTO l_temp;
76      IF (cur_api_val%NOTFOUND AND
77          hr_form_templates_api.g_session_mode <> 'SEED_DATA') THEN
78          CLOSE cur_api_val;
79        -- error message
80        fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
81        fnd_message.set_token('PROCEDURE', l_proc);
82        fnd_message.set_token('STEP','10');
83        fnd_message.raise_error;
84      END IF;
85      CLOSE cur_api_val;
86 
87   --
88   -- Process Logic
89   --
90 
91   hr_utility.set_location('At:'|| l_proc, 20);
92 
93   hr_tcp_ins.ins(
94      p_template_item_context_id      => p_template_item_context_id
95      ,p_template_tab_page_id          => p_template_tab_page_id
96      ,p_template_item_context_page_i => l_template_item_context_page_i
97      ,p_object_version_number         => l_object_version_number);
98 
99   --
100   -- Call After Process User Hook
101   --
102   begin
103     hr_tcp_api_bk1.create_tcp_a
104       (p_effective_date                 => TRUNC(p_effective_date)
105        ,p_template_item_context_id      => p_template_item_context_id
106        ,p_template_tab_page_id          => p_template_tab_page_id
107        ,p_template_item_context_page_i => l_template_item_context_page_i
108        ,p_object_version_number         => l_object_version_number
109       );
110   exception
111     when hr_api.cannot_find_prog_unit then
112       hr_api.cannot_find_prog_unit_error
113         (p_module_name => 'create_tcp'
114         ,p_hook_type   => 'AP'
115         );
116   end;
117   --
118   -- When in validation only mode raise the Validate_Enabled exception
119   --
120   if p_validate then
121     raise hr_api.validate_enabled;
122   end if;
123   --
124   -- Set all output arguments
125   --
126     p_template_item_context_page_i := l_template_item_context_page_i;
127     p_object_version_number         := l_object_version_number;
128   --
129   hr_utility.set_location(' Leaving:'||l_proc, 70);
130 exception
131   when hr_api.validate_enabled then
132     --
133     -- As the Validate_Enabled exception has been raised
134     -- we must rollback to the savepoint
135     --
136     rollback to create_tcp;
137     --
138     -- Only set output warning arguments
139     -- (Any key or derived arguments must be set to null
140     -- when validation only mode is being used.)
141     --
142     p_template_item_context_page_i := null;
143     p_object_version_number  := null;
144     hr_utility.set_location(' Leaving:'||l_proc, 80);
145   when others then
146     --
147     -- A validation or unexpected error has occured
148     --
149     p_template_item_context_page_i := null;
150     p_object_version_number  := null;
151 
152     rollback to create_tcp;
153     hr_utility.set_location(' Leaving:'||l_proc, 90);
154     raise;
155 end create_tcp;
156 --
157 -- ----------------------------------------------------------------------------
158 -- |----------------------< delete_tcp >---------------|
159 -- ----------------------------------------------------------------------------
160 --
161 procedure delete_tcp
162   (p_validate                      in     boolean  default false
163   ,p_template_item_context_page_i  in number
164   ,p_object_version_number            in number
165   ) is
166   --
167   -- Declare cursors and local variables
168   --
169   l_temp number;
170 
171   CURSOR cur_api_val
172   IS
173   SELECT source_form_template_id
174   FROM hr_source_form_templates hsf
175     ,hr_template_windows_b htw
176     ,hr_template_canvases_b htb
177     ,hr_template_tab_pages_b htt
178     ,hr_template_item_context_pages tcp
179   WHERE htt.template_tab_page_id = tcp.template_tab_page_id
180   AND htt.template_canvas_id = htb.template_canvas_id
181   AND htb.template_window_id = htw.template_window_id
182   AND htw.form_template_id = hsf.form_template_id_to
183   AND tcp.template_item_context_page_id = p_template_item_context_page_i;
184 
185   l_proc                varchar2(72) := g_package||'delete_tcp';
186 begin
187   hr_utility.set_location('Entering:'|| l_proc, 10);
188   --
189   -- Issue a savepoint
190   --
191   savepoint delete_tcp;
192   --
193   -- Call Before Process User Hook
194   --
195   begin
196     hr_tcp_api_bk2.delete_tcp_b
197       ( p_template_item_context_page_i => p_template_item_context_page_i
198        ,p_object_version_number        => p_object_version_number
199       );
200   exception
201     when hr_api.cannot_find_prog_unit then
202       hr_api.cannot_find_prog_unit_error
203         (p_module_name => 'delete_tcp'
204         ,p_hook_type   => 'BP'
205         );
206   end;
207   --
208   -- Validation in addition to Row Handlers
209   --
210   hr_utility.set_location('At:'|| l_proc, 15);
211 
212      OPEN cur_api_val;
213      FETCH cur_api_val INTO l_temp;
214      IF (cur_api_val%NOTFOUND AND
215          hr_form_templates_api.g_session_mode <> 'SEED_DATA') THEN
216          CLOSE cur_api_val;
217        -- error message
218        fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
219        fnd_message.set_token('PROCEDURE', l_proc);
220        fnd_message.set_token('STEP','10');
221        fnd_message.raise_error;
222      END IF;
223      CLOSE cur_api_val;
224 
225   hr_utility.set_location('At:'|| l_proc, 20);
226 
227   --
228   -- Process Logic
229   --
230   hr_tcp_del.del(
231       p_template_item_context_page_i => p_template_item_context_page_i
232      ,p_object_version_number        => p_object_version_number);
233 
234   --
235   -- Call After Process User Hook
236   --
237   begin
238     hr_tcp_api_bk2.delete_tcp_a
239       ( p_template_item_context_page_i => p_template_item_context_page_i
240        ,p_object_version_number        => p_object_version_number
241       );
242   exception
243     when hr_api.cannot_find_prog_unit then
244       hr_api.cannot_find_prog_unit_error
245         (p_module_name => 'delete_tcp'
246         ,p_hook_type   => 'AP'
247         );
248   end;
249   --
250   -- When in validation only mode raise the Validate_Enabled exception
251   --
252   if p_validate then
253     raise hr_api.validate_enabled;
254   end if;
255   --
256   hr_utility.set_location(' Leaving:'||l_proc, 70);
257 exception
258   when hr_api.validate_enabled then
259     --
260     -- As the Validate_Enabled exception has been raised
261     -- we must rollback to the savepoint
262     --
263     rollback to delete_tcp;
264     --
265     -- Only set output warning arguments
266     -- (Any key or derived arguments must be set to null
267     -- when validation only mode is being used.)
268     --
269     hr_utility.set_location(' Leaving:'||l_proc, 80);
270   when others then
271     --
272     -- A validation or unexpected error has occured
273     --
274     rollback to delete_tcp;
275     hr_utility.set_location(' Leaving:'||l_proc, 90);
276     raise;
277 end delete_tcp;
278 --
279 end hr_tcp_api;