[Home] [Help]
PACKAGE BODY: APPS.HR_NAME_FORMAT_API
Source
1 Package Body hr_name_format_api as
2 /* $Header: hrnmfapi.pkb 120.0 2005/05/31 01:34:09 appldev noship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33) := ' hr_name_format_api.';
7 g_debug boolean := hr_utility.debug_enabled;
8 --
9 -- ----------------------------------------------------------------------------
10 -- |--------------------------< create_name_format >--------------------------|
11 -- ----------------------------------------------------------------------------
12 --
13 procedure create_name_format
14 (p_validate in boolean default false
15 ,p_effective_date in date
16 ,p_format_name in varchar2
17 ,p_user_format_choice in varchar2
18 ,p_format_mask in varchar2
19 ,p_legislation_code in varchar2
20 ,p_name_format_id out nocopy number
21 ,p_object_version_number out nocopy number
22 ) is
23 --
24 -- Declare cursors and local variables
25 --
26 l_name_format_id hr_name_formats.name_format_id%TYPE;
27 l_object_version_number hr_name_formats.object_version_number%TYPE;
28 l_effective_date date;
29 l_proc varchar2(72) := g_package||'create_name_format';
30 begin
31 hr_utility.set_location('Entering:'|| l_proc, 10);
32 --
33 -- Issue a savepoint
34 --
35 savepoint create_name_format;
36 --
37 -- Truncate the time portion from all IN date parameters
38 --
39 l_effective_date := trunc(p_effective_date);
40
41 --
42 -- Call Before Process User Hook
43 --
44 begin
45 hr_name_format_bk1.create_name_format_b
46 (p_effective_date => l_effective_date
47 ,p_format_name => p_format_name
48 ,p_legislation_code => p_legislation_code
49 ,p_user_format_choice => p_user_format_choice
50 ,p_format_mask => p_format_mask
51 );
52 exception
53 when hr_api.cannot_find_prog_unit then
54 hr_api.cannot_find_prog_unit_error
55 (p_module_name => 'create_name_format'
56 ,p_hook_type => 'BP'
57 );
58 end;
59 --
60 -- Process Logic
61 --
62 hr_nmf_ins.ins
63 (p_effective_date => l_effective_date
64 ,p_format_name => p_format_name
65 ,p_user_format_choice => p_user_format_choice
66 ,p_format_mask => p_format_mask
67 ,p_legislation_code => p_legislation_code
68 ,p_name_format_id => l_name_format_id
69 ,p_object_version_number => l_object_version_number
70 );
71 --
72 -- Call After Process User Hook
73 --
74 begin
75 hr_name_format_bk1.create_name_format_a
76 (p_effective_date => l_effective_date
77 ,p_format_name => p_format_name
78 ,p_legislation_code => p_legislation_code
79 ,p_user_format_choice => p_user_format_choice
80 ,p_format_mask => p_format_mask
81 ,p_name_format_id => l_name_format_id
82 ,p_object_version_number => l_object_version_number
83 );
84 exception
85 when hr_api.cannot_find_prog_unit then
86 hr_api.cannot_find_prog_unit_error
87 (p_module_name => 'create_name_format'
88 ,p_hook_type => 'AP'
89 );
90 end;
91 --
92 -- When in validation only mode raise the Validate_Enabled exception
93 --
94 if p_validate then
95 raise hr_api.validate_enabled;
96 end if;
97 --
98 -- Set all OUT parameters with out values
99 --
100 p_name_format_id := l_name_format_id;
101 p_object_version_number := l_object_version_number;
102 --
103 hr_utility.set_location(' Leaving:'||l_proc, 70);
104 exception
105 when hr_api.validate_enabled then
106 --
107 -- As the Validate_Enabled exception has been raised
108 -- we must rollback to the savepoint
109 --
110 rollback to create_name_format;
111 --
112 -- Reset IN OUT parameters and set OUT parameters
113 -- (Any key or derived arguments must be set to null
114 -- when validation only mode is being used.)
115 --
116 p_name_format_id := null;
117 p_object_version_number := null;
118
119 hr_utility.set_location(' Leaving:'||l_proc, 80);
120 when others then
121 --
122 -- A validation or unexpected error has occured
123 --
124 rollback to create_name_format;
125 --
126 -- Reset OUT parameters to null
127 --
128 p_name_format_id := null;
129 p_object_version_number := null;
130 --
131 hr_utility.set_location(' Leaving:'||l_proc, 90);
132 raise;
133 end create_name_format;
134 --
135 -- ----------------------------------------------------------------------------
136 -- |--------------------------< update_name_format >--------------------------|
137 -- ----------------------------------------------------------------------------
138 --
139 procedure update_name_format
140 (p_validate in boolean default false
141 ,p_effective_date in date
142 ,p_name_format_id in number
143 ,p_format_mask in varchar2
144 ,p_object_version_number in out nocopy number
145 ) is
146 --
147 -- Declare cursors and local variables
148 --
149 l_object_version_number hr_name_formats.object_version_number%TYPE;
150 l_effective_date date;
151 l_proc varchar2(72) := g_package||'update_name_format';
152 begin
153 hr_utility.set_location('Entering:'|| l_proc, 10);
154 --
155 -- Issue a savepoint
156 --
157 savepoint update_name_format;
158 --
159 -- Truncate the time portion from all IN date parameters
160 --
161 l_effective_date := trunc(p_effective_date);
162 --
163 l_object_version_number := p_object_version_number;
164 --
165 -- Call Before Process User Hook
166 --
167 begin
168 hr_name_format_bk2.update_name_format_b
169 (p_effective_date => l_effective_date
170 ,p_name_format_id => p_name_format_id
171 ,p_format_mask => p_format_mask
172 ,p_object_version_number => p_object_version_number
173 );
174 exception
175 when hr_api.cannot_find_prog_unit then
176 hr_api.cannot_find_prog_unit_error
177 (p_module_name => 'update_name_format'
178 ,p_hook_type => 'BP'
179 );
180 end;
181 --
182 -- Process Logic
183 --
184 hr_nmf_upd.upd
185 (p_effective_date => l_effective_date
186 ,p_name_format_id => p_name_format_id
187 ,p_format_mask => p_format_mask
188 ,p_object_version_number => l_object_version_number
189 );
190 --
191 -- Call After Process User Hook
192 --
193 begin
194 hr_name_format_bk2.update_name_format_a
195 (p_effective_date => l_effective_date
196 ,p_name_format_id => p_name_format_id
197 ,p_format_mask => p_format_mask
198 ,p_object_version_number => l_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 => 'update_name_format'
204 ,p_hook_type => 'AP'
205 );
206 end;
207 --
208 -- When in validation only mode raise the Validate_Enabled exception
209 --
210 if p_validate then
211 raise hr_api.validate_enabled;
212 end if;
213 --
214 -- Set all OUT parameters with out values
215 --
216 p_object_version_number := l_object_version_number;
217 --
218 hr_utility.set_location(' Leaving:'||l_proc, 70);
219 exception
220 when hr_api.validate_enabled then
221 --
222 -- As the Validate_Enabled exception has been raised
223 -- we must rollback to the savepoint
224 --
225 rollback to update_name_format;
226
227 hr_utility.set_location(' Leaving:'||l_proc, 80);
228
229 end update_name_format;
230 --
231 -- ----------------------------------------------------------------------------
232 -- |--------------------------< delete_name_format >--------------------------|
233 -- ----------------------------------------------------------------------------
234 --
235 procedure delete_name_format
236 (p_validate in boolean default false
237 ,p_name_format_id in number
238 ,p_object_version_number in out nocopy number
239 ) is
240 --
241 -- Declare cursors and local variables
242 --
243 l_object_version_number hr_name_formats.object_version_number%TYPE;
244 l_effective_date date;
245 l_proc varchar2(72) := g_package||'delete_name_format';
246 begin
247 hr_utility.set_location('Entering:'|| l_proc, 10);
248 --
249 -- Issue a savepoint
250 --
251 savepoint delete_name_format;
252 --
253 l_object_version_number := p_object_version_number;
254 --
255 -- Call Before Process User Hook
256 --
257 begin
258 hr_name_format_bk3.delete_name_format_b
259 (p_name_format_id => p_name_format_id
260 ,p_object_version_number => p_object_version_number
261 );
262 exception
263 when hr_api.cannot_find_prog_unit then
264 hr_api.cannot_find_prog_unit_error
265 (p_module_name => 'delete_name_format'
266 ,p_hook_type => 'BP'
267 );
268 end;
269 --
270 -- Process Logic
271 --
272 hr_nmf_del.del
273 (p_name_format_id => p_name_format_id
274 ,p_object_version_number => l_object_version_number
275 );
276 --
277 -- Call After Process User Hook
278 --
279 begin
280 hr_name_format_bk3.delete_name_format_a
281 (p_name_format_id => p_name_format_id
282 ,p_object_version_number => l_object_version_number
283 );
284 exception
285 when hr_api.cannot_find_prog_unit then
286 hr_api.cannot_find_prog_unit_error
287 (p_module_name => 'delete_name_format'
288 ,p_hook_type => 'AP'
289 );
290 end;
291 --
292 -- When in validation only mode raise the Validate_Enabled exception
293 --
294 if p_validate then
295 raise hr_api.validate_enabled;
296 end if;
297 --
298 -- Set all OUT parameters with out values
299 --
300 p_object_version_number := l_object_version_number;
301 --
302 hr_utility.set_location(' Leaving:'||l_proc, 70);
303 exception
304 when hr_api.validate_enabled then
305 --
306 -- As the Validate_Enabled exception has been raised
307 -- we must rollback to the savepoint
308 --
309 rollback to delete_name_format;
310
311 hr_utility.set_location(' Leaving:'||l_proc, 80);
312
313 end delete_name_format;
314 --
315 --
316 end hr_name_format_api;