[Home] [Help]
PACKAGE BODY: APPS.PER_JOB_GROUP_API
Source
1 Package Body PER_JOB_GROUP_API as
2 /* $Header: pejgrapi.pkb 115.3 2002/12/11 11:30:28 pkakar noship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33) := 'PER_JOB_GROUP_API';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |--------------------------< CREATE_JOB_GROUP >----------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure CREATE_JOB_GROUP
13 (p_validate in boolean default false
14 ,p_effective_date in date
15 ,p_business_group_id in number default null
16 ,p_legislation_code in varchar2 default null
17 ,p_internal_name in varchar2
18 ,p_displayed_name in varchar2
19 ,p_id_flex_num in number
20 ,p_master_flag in varchar2 default 'N'
21 ,p_job_group_id out nocopy number
22 ,p_object_version_number out nocopy number
23 ) is
24 --
25 -- Declare cursors and local variables
26 --
27 l_proc varchar2(72) := g_package||'CREATE_JOB_GROUP';
28 l_effective_date date;
29 l_job_group_id PER_JOB_GROUPS.JOB_GROUP_ID%TYPE;
30 l_object_version_number PER_JOB_GROUPS.OBJECT_VERSION_NUMBER%TYPE;
31 --
32 begin
33 hr_utility.set_location('Entering:'|| l_proc, 10);
34 --
35 savepoint CREATE_JOB_GROUP;
36 --
37 -- Truncate the time portion from all IN date parameters
38 --
39 l_effective_date := trunc(p_effective_date);
40 --
41 -- Call Before Process User Hook
42 --
43 begin
44 PER_JOB_GROUP_BK1.CREATE_JOB_GROUP_b
45 (p_effective_date => l_effective_date
46 ,p_business_group_id => p_business_group_id
47 ,p_legislation_code => p_legislation_code
48 ,p_internal_name => p_internal_name
49 ,p_displayed_name => p_displayed_name
50 ,p_id_flex_num => p_id_flex_num
51 ,p_master_flag => p_master_flag
52 );
53 exception
54 when hr_api.cannot_find_prog_unit then
55 hr_api.cannot_find_prog_unit_error
56 (p_module_name => 'CREATE_JOB_GROUP_b'
57 ,p_hook_type => 'BP'
58 );
59 end;
60 --
61 --
62 per_jgr_ins.ins(
63 p_effective_date => p_effective_date
64 ,p_business_group_id => p_business_group_id
65 ,p_internal_name => p_internal_name
66 ,p_displayed_name => p_displayed_name
67 ,p_id_flex_num => p_id_flex_num
68 ,p_master_flag => p_master_flag
69 ,p_legislation_code => p_legislation_code
70 ,p_job_group_id => l_job_group_id
71 ,p_object_version_number => l_object_version_number
72 );
73 --
74 -- Call After Process User Hook
75 --
76 begin
77 PER_JOB_GROUP_BK1.CREATE_JOB_GROUP_a
78 (p_effective_date => l_effective_date
79 ,p_business_group_id => p_business_group_id
80 ,p_legislation_code => p_legislation_code
81 ,p_internal_name => p_internal_name
82 ,p_displayed_name => p_displayed_name
83 ,p_id_flex_num => p_id_flex_num
84 ,p_master_flag => p_master_flag
85 ,p_job_group_id => l_job_group_id
86 ,p_object_version_number => l_object_version_number
87 );
88 exception
89 when hr_api.cannot_find_prog_unit then
90 hr_api.cannot_find_prog_unit_error
91 (p_module_name => 'CREATE_JOB_GROUP_a'
92 ,p_hook_type => 'AP'
93 );
94 end;
95 --
96 -- When in validation only mode raise the Validate_Enabled exception
97 --
98 if p_validate then
99 raise hr_api.validate_enabled;
100 end if;
101 --
102 -- Set all output arguments
103 --
104 p_job_group_id := l_job_group_id;
105 p_object_version_number := l_object_version_number;
106 --
107 hr_utility.set_location(' Leaving:'||l_proc, 70);
108 exception
109 when hr_api.validate_enabled then
110 --
111 -- As the Validate_Enabled exception has been raised
112 -- we must rollback to the savepoint
113 --
114 rollback to CREATE_JOB_GROUP;
115 --
116 -- Only set output warning arguments
117 -- (Any key or derived arguments must be set to null
118 -- when validation only mode is being used.)
119 --
120 p_job_group_id := null;
121 p_object_version_number := null;
122 --
123 hr_utility.set_location(' Leaving:'||l_proc, 80);
124 when others then
125 --
126 -- A validation or unexpected error has occured
127 --
128 rollback to CREATE_JOB_GROUP;
129 --
130 -- set in out parameters and set out parameters
131 --
132 p_job_group_id := null;
133 p_object_version_number := null;
134 --
135 hr_utility.set_location(' Leaving:'||l_proc, 90);
136 raise;
137 end CREATE_JOB_GROUP;
138 --
139 -- ----------------------------------------------------------------------------
140 -- |--------------------------< UPDATE_JOB_GROUP >----------------------------|
141 -- ----------------------------------------------------------------------------
142 --
143 procedure UPDATE_JOB_GROUP
144 (p_validate in boolean default false
145 ,p_effective_date in date
146 ,p_job_group_id in number
147 ,p_business_group_id in number default hr_api.g_number
148 ,p_legislation_code in varchar2 default hr_api.g_varchar2
149 ,p_internal_name in varchar2
150 ,p_displayed_name in varchar2
151 ,p_id_flex_num in number
152 ,p_master_flag in varchar2 default hr_api.g_varchar2
153 ,p_object_version_number in out nocopy number
154 ) is
155 --
156 -- Declare cursors and local variables
157 --
158 l_proc varchar2(72) := g_package||'UPDATE_JOB_GROUP';
159 l_effective_date date;
160 l_job_group_id PER_JOB_GROUPS.JOB_GROUP_ID%TYPE;
161 l_object_version_number PER_JOB_GROUPS.OBJECT_VERSION_NUMBER%TYPE;
162 l_ovn PER_JOB_GROUPS.OBJECT_VERSION_NUMBER%TYPE := p_object_version_number;
163 --
164 begin
165 hr_utility.set_location('Entering:'|| l_proc, 10);
166 --
167 savepoint UPDATE_JOB_GROUP;
168 --
169 -- Store initial value for OVN in out parameter.
170 --
171 l_object_version_number := p_object_version_number;
172 --
173 -- Truncate the time portion from all IN date parameters
174 --
175 l_effective_date := trunc(p_effective_date);
176 --
177 -- Call Before Process User Hook
178 --
179 begin
180 PER_JOB_GROUP_BK2.UPDATE_JOB_GROUP_b
181 (p_effective_date => l_effective_date
182 ,p_job_group_id => p_job_group_id
183 ,p_object_version_number => p_object_version_number
184 ,p_business_group_id => p_business_group_id
185 ,p_legislation_code => p_legislation_code
186 ,p_internal_name => p_internal_name
187 ,p_displayed_name => p_displayed_name
188 ,p_id_flex_num => p_id_flex_num
189 ,p_master_flag => p_master_flag
190 );
191 exception
192 when hr_api.cannot_find_prog_unit then
193 hr_api.cannot_find_prog_unit_error
194 (p_module_name => 'UPDATE_JOB_GROUP_b'
195 ,p_hook_type => 'BP'
196 );
197 end;
198 --
199 --
200 per_jgr_upd.upd(
201 p_effective_date => l_effective_date
202 ,p_job_group_id => p_job_group_id
203 ,p_object_version_number => l_object_version_number
204 ,p_business_group_id => p_business_group_id
205 ,p_internal_name => p_internal_name
206 ,p_displayed_name => p_displayed_name
207 ,p_id_flex_num => p_id_flex_num
208 ,p_master_flag => p_master_flag
209 ,p_legislation_code => p_legislation_code
210 );
211 --
212 -- Call After Process User Hook
213 --
214 begin
215 PER_JOB_GROUP_BK2.UPDATE_JOB_GROUP_a
216 (p_effective_date => p_effective_date
217 ,p_job_group_id => p_job_group_id
218 ,p_object_version_number => l_object_version_number
219 ,p_business_group_id => p_business_group_id
220 ,p_legislation_code => p_legislation_code
221 ,p_internal_name => p_internal_name
222 ,p_displayed_name => p_displayed_name
223 ,p_id_flex_num => p_id_flex_num
224 ,p_master_flag => p_master_flag
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_JOB_GROUP_a'
230 ,p_hook_type => 'AP'
231 );
232 end;
233 --
234 -- When in validation only mode raise the Validate_Enabled exception
235 --
236 if p_validate then
237 raise hr_api.validate_enabled;
238 end if;
239 --
240 -- Set all output arguments
241 --
242 p_object_version_number := l_object_version_number;
243 --
244 hr_utility.set_location(' Leaving:'||l_proc, 70);
245 exception
246 when hr_api.validate_enabled then
247 --
248 -- As the Validate_Enabled exception has been raised
249 -- we must rollback to the savepoint
250 --
251 rollback to UPDATE_JOB_GROUP;
252 --
253 -- Only set output warning arguments
254 -- (Any key or derived arguments must be set to null
255 -- when validation only mode is being used.)
256 --
257 hr_utility.set_location(' Leaving:'||l_proc, 80);
258 when others then
259 --
260 -- A validation or unexpected error has occured
261 --
262 rollback to UPDATE_JOB_GROUP;
263 --
264 -- set in out parameters and set out parameters
265 --
266 p_object_version_number := l_ovn;
267 --
268 hr_utility.set_location(' Leaving:'||l_proc, 90);
269 raise;
270 end UPDATE_JOB_GROUP;
271 --
272 -- ----------------------------------------------------------------------------
273 -- |--------------------------< DELETE_JOB_GROUP >----------------------------|
274 -- ----------------------------------------------------------------------------
275 --
276 procedure DELETE_JOB_GROUP
277 (p_validate in boolean default false
278 ,p_job_group_id in number
279 ,p_object_version_number in number
280 ) is
281 --
282 -- Declare cursors and local variables
283 --
284 l_proc varchar2(72) := g_package||'DELETE_JOB_GROUP';
285 --
286 begin
287 hr_utility.set_location('Entering:'|| l_proc, 10);
288 --
289 savepoint DELETE_JOB_GROUP;
290 --
291 -- Call Before Process User Hook
292 --
293 begin
294 PER_JOB_GROUP_BK3.DELETE_JOB_GROUP_b
295 (p_job_group_id => p_job_group_id
296 ,p_object_version_number => p_object_version_number
297 );
298 exception
299 when hr_api.cannot_find_prog_unit then
300 hr_api.cannot_find_prog_unit_error
301 (p_module_name => 'DELETE_JOB_GROUP_b'
302 ,p_hook_type => 'BP'
303 );
304 end;
305 --
306 per_jgr_del.del
307 (p_job_group_id => p_job_group_id
308 ,p_object_version_number => p_object_version_number
309 );
310 --
311 begin
312 PER_JOB_GROUP_BK3.DELETE_JOB_GROUP_a
313 (p_job_group_id => p_job_group_id
314 ,p_object_version_number => p_object_version_number
315 );
316 exception
317 when hr_api.cannot_find_prog_unit then
318 hr_api.cannot_find_prog_unit_error
319 (p_module_name => 'UPDATE_JOB_GROUP_a'
320 ,p_hook_type => 'AP'
321 );
322 end;
323 --
324 -- When in validation only mode raise the Validate_Enabled exception
325 --
326 if p_validate then
327 raise hr_api.validate_enabled;
328 end if;
329 --
330 hr_utility.set_location(' Leaving:'||l_proc, 70);
331 exception
332 when hr_api.validate_enabled then
333 --
334 -- As the Validate_Enabled exception has been raised
335 -- we must rollback to the savepoint
336 --
337 rollback to DELETE_JOB_GROUP;
338 --
339 hr_utility.set_location(' Leaving:'||l_proc, 80);
340 when others then
341 --
342 rollback to DELETE_JOB_GROUP;
343 --
344 hr_utility.set_location(' Leaving:'||l_proc, 90);
345 --
346 raise;
347 --
348 end DELETE_JOB_GROUP;
349 --
350 end PER_JOB_GROUP_API;