[Home] [Help]
PACKAGE BODY: APPS.HR_LEG_API_HOOK_CALL_INTERNAL
Source
1 Package Body hr_leg_api_hook_call_internal as
2 /* $Header: peahlbsi.pkb 115.2 2002/12/03 13:42:42 apholt ship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33) := ' hr_leg_api_hook_call_internal.';
7 --
8 -- ------------------------------------------------------------------------
9 -- |---------------------< create_leg_api_hook_call >-------------------------|
10 -- ------------------------------------------------------------------------
11 --
12 procedure create_leg_api_hook_call
13 (p_validate in boolean default false,
14 p_effective_date in date,
15 p_api_hook_id in number,
16 p_api_hook_call_type in varchar2,
17 p_sequence in number,
18 p_enabled_flag in varchar2 default 'Y',
19 p_legislation_code in varchar2 default null,
20 p_call_package in varchar2 default null,
21 p_call_procedure in varchar2 default null,
22 p_api_hook_call_id out nocopy number,
23 p_object_version_number out nocopy number) is
24 --
25 -- Declare cursors and local variables
26 --
27 l_effective_date date;
28 --
29 --
30 -- Out variables
31 --
32 l_api_hook_call_id hr_api_hook_calls.api_hook_call_id%TYPE;
33 l_object_version_number hr_api_hook_calls.object_version_number%TYPE;
34
35 -- Temp variables
36 l_encoded_error hr_api_hook_calls.encoded_error%TYPE := null;
37 l_status hr_api_hook_calls.status%TYPE := 'N';
38 l_pre_processor_date hr_api_hook_calls.pre_processor_date%TYPE := null;
39 --
40 l_proc varchar2(72) := g_package||'create_leg_api_hook_call';
41 --
42 -- Declare a cursor that will check whether the passed
43 -- in hook package and hook procedure form a unique combination
44
45 cursor csr_valid_combo is
46 select api_hook_call_id from hr_api_hook_calls
47 where api_hook_id = p_api_hook_id
48 and nvl(legislation_code,'x') = nvl(p_legislation_code,'x')
49 and nvl(call_package, 'x') = nvl(p_call_package,'x')
50 and nvl(call_procedure, 'x') = nvl(p_call_procedure, 'x')
51 and application_id IS NULL;
52
53 begin
54 hr_utility.set_location('Entering:'|| l_proc, 5);
55 --
56 -- Set l_effective_date equal to truncated version of p_effective_date for
57 -- API work. Stops dates being passed to row handlers with time portion.
58 --
59 l_effective_date := trunc(p_effective_date);
60 --
61 -- Issue a savepoint if operating in validation only mode.
62 --
63 savepoint create_leg_api_hook_call;
64 --
65 hr_utility.set_location(l_proc, 10);
66 --
67 -- Validation in addition to Table Handlers
68 --
69 if (p_legislation_code is null) then
70 --
71 hr_utility.set_message(800, 'PER_52150_AHC_LEG_CODE_NULL');
72 hr_utility.raise_error;
73 --
74 end if;
75 --
76 -- Process Logic
77 ----------------------------------------------------------------------------
78 -- Check for combination of hook call id, leg code, call pack, call proc --
79 ----------------------------------------------------------------------------
80 open csr_valid_combo;
81 fetch csr_valid_combo into l_api_hook_call_id;
82
83 -- Only call row handler code if the row doesn't already exist.
84 if csr_valid_combo%notfound then
85 --
86 -- Insert the hook row.
87 --
88 hr_ahc_ins.ins
89 (
90 p_api_hook_call_id => l_api_hook_call_id ,
91 p_effective_date => l_effective_date,
92 p_api_hook_id => p_api_hook_id,
93 p_api_hook_call_type => p_api_hook_call_type,
94 p_legislation_code => p_legislation_code,
95 p_sequence => p_sequence,
96 p_enabled_flag => p_enabled_flag,
97 p_call_package => p_call_package,
98 p_call_procedure => p_call_procedure,
99 p_pre_processor_date => l_pre_processor_date,
100 p_encoded_error => l_encoded_error,
101 p_status => l_status,
102 p_object_version_number => l_object_version_number
103 );
104 --
105 end if;
106
107 close csr_valid_combo;
108
109 hr_utility.set_location(l_proc, 20);
110 --
111 -- When in validation only mode raise the Validate_Enabled exception
112 --
113 if p_validate then
114 raise hr_api.validate_enabled;
115 end if;
116 --
117 -- Set all output arguments
118 --
119 p_api_hook_call_id := l_api_hook_call_id;
120 p_object_version_number := l_object_version_number;
121 --
122 hr_utility.set_location(' Leaving:'||l_proc, 100);
123 exception
124 when hr_api.validate_enabled then
125 --
126 -- As the Validate_Enabled exception has been raised
127 -- we must rollback to the savepoint
128 --
129 ROLLBACK TO create_leg_api_hook_call;
130 --
131 -- Only set output warning arguments
132 -- (Any key or derived arguments must be set to null
133 -- when validation only mode is being used.)
134 --
135 p_api_hook_call_id := null;
136 p_object_version_number := null;
137 when others then
138 ROLLBACK TO create_leg_api_hook_call;
139 p_api_hook_call_id := null;
140 p_object_version_number := null;
141 RAISE;
142 end create_leg_api_hook_call;
143 --
144 --
145 -- ---------------------------------------------------------------------------
146 -- |--------------------------< delete_leg_api_hook_call >-------------------|
147 -- ---------------------------------------------------------------------------
148 --
149 procedure delete_leg_api_hook_call
150 (p_validate in boolean default false,
151 p_api_hook_call_id in number,
152 p_object_version_number in number) is
153 --
154 l_proc varchar2(72) := g_package||'delete_leg_api_hook_call';
155 --
156 begin
157 hr_utility.set_location('Entering:'|| l_proc, 5);
158 --
159 -- Issue a savepoint if operating in validation only mode.
160 --
161 savepoint delete_leg_api_hook_call;
162 --
163 hr_utility.set_location(l_proc, 10);
164 --
165 -- Validation in addition to Table Handlers
166 --
167 -- None required.
168 --
169 -- Process Logic
170 --
171 hr_ahc_del.del
172 (p_api_hook_call_id => p_api_hook_call_id,
173 p_object_version_number => p_object_version_number);
174 --
175 hr_utility.set_location(l_proc, 20);
176 --
177 -- When in validation only mode raise the Validate_Enabled exception
178 --
179 if p_validate then
180 raise hr_api.validate_enabled;
181 end if;
182 --
183 hr_utility.set_location(' Leaving:'||l_proc, 100);
184 exception
185 when hr_api.validate_enabled then
186 --
187 -- As the Validate_Enabled exception has been raised
188 -- we must rollback to the savepoint
189 --
190 ROLLBACK TO delete_leg_api_hook_call;
191 when others then
192 ROLLBACK TO delete_leg_api_hook_call;
193 raise;
194 end delete_leg_api_hook_call;
195 --
196 --
197 -- ------------------------------------------------------------------------
198 -- |---------------------< update_leg_api_hook_call >-------------------------|
199 -- ------------------------------------------------------------------------
200 --
201 procedure update_leg_api_hook_call
202 (p_validate in boolean default false,
203 p_effective_date in date,
204 p_api_hook_call_id in number,
205 p_sequence in number default hr_api.g_number,
206 p_enabled_flag in varchar2 default hr_api.g_varchar2,
207 p_call_package in varchar2 default hr_api.g_varchar2,
208 p_call_procedure in varchar2 default hr_api.g_varchar2,
209 p_object_version_number in out nocopy number
210 ) is
211 --
212 -- Declare cursors and local variables
213 --
214 l_effective_date date;
215 --
216 -- Out variables
217 --
218 l_object_version_number hr_api_hook_calls.object_version_number%TYPE;
219
220 l_proc varchar2(72) := g_package||'update_leg_api_hook_call';
221 --
222 begin
223 hr_utility.set_location('Entering:'|| l_proc, 5);
224 --
225 -- Set l_effective_date equal to truncated version of p_effective_date for
226 -- API work. Stops dates being passed to row handlers with time portion.
227 --
228 l_effective_date := trunc(p_effective_date);
229 --
230 -- Capture the in value for the object version number
231 --
232 l_object_version_number := p_object_version_number;
233 --
234 -- Issue a savepoint if operating in validation only mode.
235 --
236 savepoint update_leg_api_hook_call;
237 --
238 hr_utility.set_location(l_proc, 10);
239 --
240 -- Validation in addition to Table Handlers
241 --
242 -- Update the hook call row
243 --
244 hr_ahc_upd.upd
245 (
246 p_api_hook_call_id => p_api_hook_call_id ,
247 p_effective_date => l_effective_date,
248 p_sequence => p_sequence,
249 p_enabled_flag => p_enabled_flag,
250 p_call_package => p_call_package,
251 p_call_procedure => p_call_procedure,
252 p_object_version_number => p_object_version_number
253 );
254 --
255 hr_utility.set_location(l_proc, 20);
256 --
257 -- When in validation only mode raise the Validate_Enabled exception
258 --
259 if p_validate then
260 raise hr_api.validate_enabled;
261 end if;
262 --
263 -- Set all output arguments
264 --
265 p_object_version_number := l_object_version_number;
266 --
267 hr_utility.set_location(' Leaving:'||l_proc, 100);
268 exception
269 when hr_api.validate_enabled then
270 --
271 -- Only set output warning arguments
272 -- (Any key or derived arguments must be set to null
273 -- when validation only mode is being used.)
274 --
275 p_object_version_number := l_object_version_number;
276 --
277 -- As the Validate_Enabled exception has been raised
278 -- we must rollback to the savepoint
279 --
280 ROLLBACK TO update_leg_api_hook_call;
281 --
282 when others then
283 ROLLBACK TO update_leg_api_hook_call;
284 p_object_version_number := null;
285 RAISE;
286 end update_leg_api_hook_call;
287 --
288 end hr_leg_api_hook_call_internal;