1 Package ben_otp_shd as
2 /* $Header: beotprhi.pkh 120.0 2005/05/28 09:58:27 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Global Record Type Specification |
6 -- ----------------------------------------------------------------------------
7 --
8 Type g_rec_type Is Record
9 (optip_id number(15)
10 ,effective_start_date date
11 ,effective_end_date date
12 ,business_group_id number(15)
13 ,pgm_id number(15)
14 ,ptip_id number(15)
15 ,pl_typ_id number(15)
16 ,opt_id number(15)
17 ,cmbn_ptip_opt_id number(15)
18 ,legislation_code varchar2(30)
19 ,legislation_subgroup varchar2(30)
20 ,otp_attribute_category varchar2(30)
21 ,otp_attribute1 varchar2(150)
22 ,otp_attribute2 varchar2(150)
23 ,otp_attribute3 varchar2(150)
24 ,otp_attribute4 varchar2(150)
25 ,otp_attribute5 varchar2(150)
26 ,otp_attribute6 varchar2(150)
27 ,otp_attribute7 varchar2(150)
28 ,otp_attribute8 varchar2(150)
29 ,otp_attribute9 varchar2(150)
30 ,otp_attribute10 varchar2(150)
31 ,otp_attribute11 varchar2(150)
32 ,otp_attribute12 varchar2(150)
33 ,otp_attribute13 varchar2(150)
34 ,otp_attribute14 varchar2(150)
35 ,otp_attribute15 varchar2(150)
36 ,otp_attribute16 varchar2(150)
37 ,otp_attribute17 varchar2(150)
38 ,otp_attribute18 varchar2(150)
39 ,otp_attribute19 varchar2(150)
40 ,otp_attribute20 varchar2(150)
41 ,otp_attribute21 varchar2(150)
42 ,otp_attribute22 varchar2(150)
43 ,otp_attribute23 varchar2(150)
44 ,otp_attribute24 varchar2(150)
45 ,otp_attribute25 varchar2(150)
46 ,otp_attribute26 varchar2(150)
47 ,otp_attribute27 varchar2(150)
48 ,otp_attribute28 varchar2(150)
49 ,otp_attribute29 varchar2(150)
50 ,otp_attribute30 varchar2(150)
51 ,object_version_number number(9)
52 );
53 --
54 -- ----------------------------------------------------------------------------
55 -- | Global Definitions - Internal Development Use Only |
56 -- ----------------------------------------------------------------------------
57 --
58 g_old_rec g_rec_type; -- Global record definition
59 g_api_dml boolean; -- Global api dml status
60 --
61 -- ----------------------------------------------------------------------------
62 -- |------------------------< return_api_dml_status >-------------------------|
63 -- ----------------------------------------------------------------------------
64 -- {Start Of Comments}
65 --
66 -- Description:
67 -- This function will return the current g_api_dml private global
68 -- boolean status.
69 -- The g_api_dml status determines if at the time of the function
70 -- being executed if a dml statement (i.e. INSERT, UPDATE or DELETE)
71 -- is being issued from within an api.
72 -- If the status is TRUE then a dml statement is being issued from
73 -- within this entity api.
74 -- This function is primarily to support database triggers which
75 -- need to maintain the object_version_number for non-supported
76 -- dml statements (i.e. dml statement issued outside of the api layer).
77 --
78 -- Prerequisites:
79 -- None.
80 --
81 -- In Parameters:
82 -- None.
83 --
84 -- Post Success:
85 -- Processing continues.
86 -- If the function returns a TRUE value then, dml is being executed from
87 -- within this api.
88 --
89 -- Post Failure:
90 -- None.
91 --
92 -- Access Status:
93 -- Internal Row Handler Use Only.
94 --
95 -- {End Of Comments}
96 -- ----------------------------------------------------------------------------
97 Function return_api_dml_status Return Boolean;
98 --
99 -- ----------------------------------------------------------------------------
100 -- |---------------------------< constraint_error >---------------------------|
101 -- ----------------------------------------------------------------------------
102 -- {Start Of Comments}
103 --
104 -- Description:
105 -- This procedure is called when a constraint has been violated (i.e.
106 -- The exception hr_api.check_integrity_violated,
107 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
108 -- hr_api.unique_integrity_violated has been raised).
109 -- The exceptions can only be raised as follows:
110 -- 1) A check constraint can only be violated during an INSERT or UPDATE
111 -- dml operation.
112 -- 2) A parent integrity constraint can only be violated during an
113 -- INSERT or UPDATE dml operation.
114 -- 3) A child integrity constraint can only be violated during an
115 -- DELETE dml operation.
116 -- 4) A unique integrity constraint can only be violated during INSERT or
117 -- UPDATE dml operation.
118 --
119 -- Prerequisites:
120 -- 1) Either hr_api.check_integrity_violated,
121 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
122 -- hr_api.unique_integrity_violated has been raised with the subsequent
123 -- stripping of the constraint name from the generated error message
124 -- text.
125 -- 2) Standalone validation test which corresponds with a constraint error.
126 --
127 -- In Parameter:
128 -- p_constraint_name is in upper format and is just the constraint name
129 -- (e.g. not prefixed by brackets, schema owner etc).
130 --
131 -- Post Success:
132 -- Development dependant.
133 --
134 -- Post Failure:
135 -- Developement dependant.
136 --
137 -- Developer Implementation Notes:
138 -- For each constraint being checked the hr system package failure message
139 -- has been generated as a template only. These system error messages should
140 -- be modified as required (i.e. change the system failure message to a user
141 -- friendly defined error message).
142 --
143 -- Access Status:
144 -- Internal Development Use Only.
145 --
146 -- {End Of Comments}
147 -- ----------------------------------------------------------------------------
148 Procedure constraint_error
149 (p_constraint_name in all_constraints.constraint_name%TYPE);
150 --
151 -- ----------------------------------------------------------------------------
152 -- |-----------------------------< api_updating >-----------------------------|
153 -- ----------------------------------------------------------------------------
154 -- {Start Of Comments}
155 --
156 -- Description:
157 -- This function is used to populate the g_old_rec record with the
158 -- current row from the database for the specified primary key
159 -- provided that the primary key exists and is valid and does not
160 -- already match the current g_old_rec. The function will always return
161 -- a TRUE value if the g_old_rec is populated with the current row.
162 -- A FALSE value will be returned if all of the primary key arguments
163 -- are null.
164 --
165 -- Prerequisites:
166 -- None.
167 --
168 -- In Parameters:
169 --
170 -- Post Success:
171 -- A value of TRUE will be returned indiciating that the g_old_rec
172 -- is current.
173 -- A value of FALSE will be returned if all of the primary key arguments
174 -- have a null value (this indicates that the row has not be inserted into
175 -- the Schema), and therefore could never have a corresponding row.
176 --
177 -- Post Failure:
178 -- A failure can only occur under two circumstances:
179 -- 1) The primary key is invalid (i.e. a row does not exist for the
180 -- specified primary key values).
181 -- 2) If an object_version_number exists but is NOT the same as the current
182 -- g_old_rec value.
183 --
184 -- Developer Implementation Notes:
185 -- None.
186 --
187 -- Access Status:
188 -- Internal Development Use Only.
189 --
190 -- {End Of Comments}
191 -- ----------------------------------------------------------------------------
192 Function api_updating
193 (p_effective_date in date
194 ,p_optip_id in number
195 ,p_object_version_number in number
196 ) Return Boolean;
197 --
198 -- ----------------------------------------------------------------------------
199 -- |---------------------------< find_dt_upd_modes >--------------------------|
200 -- ----------------------------------------------------------------------------
201 -- {Start Of Comments}
202 --
203 -- Description:
204 -- This procedure is used to determine what datetrack update modes are
205 -- allowed as of the effective date for this entity. The procedure will
206 -- return a corresponding Boolean value for each of the update modes
207 -- available where TRUE indicates that the corresponding update mode
208 -- is available.
209 --
210 -- Prerequisites:
211 -- None.
212 --
213 -- In Parameters:
214 -- p_effective_date
215 -- Specifies the date at which the datetrack modes will be operated on.
216 -- p_base_key_value
217 -- Specifies the primary key value for this datetrack entity.
218 -- (E.g. For this entity the assignment of the argument would be:
219 -- p_base_key_value = :optip_id).
220 --
221 -- Post Success:
222 -- Processing continues.
223 --
224 -- Post Failure:
225 -- Failure might occur if for the specified effective date and primary key
226 -- value a row doesn't exist.
227 --
228 -- Developer Implementation Notes:
229 -- This procedure could require changes if this entity has any sepcific
230 -- delete restrictions.
231 -- For example, this entity might disallow the datetrack update mode of
232 -- UPDATE. To implement this you would have to set and return a Boolean
233 -- value of FALSE after the call to the dt_api.find_dt_upd_modes procedure.
234 --
235 -- Access Status:
236 -- Internal Development Use Only.
237 --
238 -- {End Of Comments}
239 -- ----------------------------------------------------------------------------
240 Procedure find_dt_upd_modes
241 (p_effective_date in date
242 ,p_base_key_value in number
243 ,p_correction out nocopy boolean
244 ,p_update out nocopy boolean
245 ,p_update_override out nocopy boolean
246 ,p_update_change_insert out nocopy boolean
247 );
248 --
249 -- ----------------------------------------------------------------------------
250 -- |---------------------------< find_dt_del_modes >--------------------------|
251 -- ----------------------------------------------------------------------------
252 -- {Start Of Comments}
253 --
254 -- Description:
255 -- This procedure is used to determine what datetrack delete modes are
256 -- allowed as of the effective date for this entity. The procedure will
257 -- return a corresponding Boolean value for each of the delete modes
258 -- available where TRUE indicates that the corresponding delete mode is
259 -- available.
260 --
261 -- Prerequisites:
262 -- None.
263 --
264 -- In Parameters:
265 -- p_effective_date
266 -- Specifies the date at which the datetrack modes will be operated on.
267 -- p_base_key_value
268 -- Specifies the primary key value for this datetrack entity.
269 -- (E.g. For this entity the assignment of the argument would be:
270 -- p_base_key_value = :optip_id).
271 --
272 -- Post Success:
273 -- Processing continues.
274 --
275 -- Post Failure:
276 -- Failure might occur if for the specified effective date and primary key
277 -- value a row doesn't exist.
278 --
279 -- Developer Implementation Notes:
280 -- This procedure could require changes if this entity has any sepcific
281 -- delete restrictions.
282 -- For example, this entity might disallow the datetrack delete mode of
283 -- ZAP. To implement this you would have to set and return a Boolean value
284 -- of FALSE after the call to the dt_api.find_dt_del_modes procedure.
285 --
286 -- Access Status:
287 -- Internal Development Use Only.
288 --
289 -- {End Of Comments}
290 -- ----------------------------------------------------------------------------
291 Procedure find_dt_del_modes
292 (p_effective_date in date
293 ,p_base_key_value in number
294 ,p_zap out nocopy boolean
295 ,p_delete out nocopy boolean
296 ,p_future_change out nocopy boolean
297 ,p_delete_next_change out nocopy boolean
298 );
299 --
300 -- ----------------------------------------------------------------------------
301 -- |-----------------------< upd_effective_end_date >-------------------------|
302 -- ----------------------------------------------------------------------------
303 -- {Start Of Comments}
304 --
305 -- Description:
306 -- This procedure will update the specified datetrack row with the
307 -- specified new effective end date. The object version number is also
308 -- set to the next object version number. DateTrack modes which call
309 -- this procedure are: UPDATE, UPDATE_CHANGE_INSERT,
310 -- UPDATE_OVERRIDE, DELETE, FUTURE_CHANGE and DELETE_NEXT_CHANGE.
311 -- This is an internal datetrack maintenance procedure which should
312 -- not be modified in anyway.
313 --
314 -- Prerequisites:
315 -- None.
316 --
317 -- In Parameters:
318 -- p_new_effective_end_date
319 -- Specifies the new effective end date which will be set for the
320 -- row as of the effective date.
321 -- p_base_key_value
322 -- Specifies the primary key value for this datetrack entity.
323 -- (E.g. For this entity the assignment of the argument would be:
324 -- p_base_key_value = :optip_id).
325 --
326 -- Post Success:
327 -- The specified row will be updated with the new effective end date and
328 -- object_version_number.
329 --
330 -- Post Failure:
331 -- Failure might occur if for the specified effective date and primary key
332 -- value a row doesn't exist.
333 --
334 -- Developer Implementation Notes:
335 -- This is an internal datetrack maintenance procedure which should
336 -- not be modified in anyway.
337 --
338 -- Access Status:
339 -- Internal Row Handler Use Only.
340 --
341 -- {End Of Comments}
342 -- ----------------------------------------------------------------------------
343 Procedure upd_effective_end_date
344 (p_effective_date in date
345 ,p_base_key_value in number
346 ,p_new_effective_end_date in date
347 ,p_validation_start_date in date
348 ,p_validation_end_date in date
349 ,p_object_version_number out nocopy number
350 );
351 --
352 -- ----------------------------------------------------------------------------
353 -- |---------------------------------< lck >----------------------------------|
354 -- ----------------------------------------------------------------------------
355 -- {Start Of Comments}
356 --
357 -- Description:
358 -- The Lck process for datetrack is complicated and comprises of the
359 -- following processing
360 -- The processing steps are as follows:
361 -- 1) The row to be updated or deleted must be locked.
362 -- By locking this row, the g_old_rec record data type is populated.
363 -- 2) If a comment exists the text is selected from hr_comments.
364 -- 3) The datetrack mode is then validated to ensure the operation is
365 -- valid. If the mode is valid the validation start and end dates for
366 -- the mode will be derived and returned. Any required locking is
367 -- completed when the datetrack mode is validated.
368 --
369 -- Prerequisites:
373 -- In Parameters:
370 -- When attempting to call the lck procedure the object version number,
371 -- primary key, effective date and datetrack mode must be specified.
372 --
374 -- p_effective_date
375 -- Specifies the date of the datetrack update operation.
376 -- p_datetrack_mode
377 -- Determines the datetrack update or delete mode.
378 --
379 -- Post Success:
380 -- On successful completion of the Lck process the row to be updated or
381 -- deleted will be locked and selected into the global data structure
382 -- g_old_rec.
383 --
384 -- Post Failure:
385 -- The Lck process can fail for three reasons:
386 -- 1) When attempting to lock the row the row could already be locked by
387 -- another user. This will raise the HR_Api.Object_Locked exception.
388 -- 2) The row which is required to be locked doesn't exist in the HR Schema.
389 -- This error is trapped and reported using the message name
390 -- 'HR_7220_INVALID_PRIMARY_KEY'.
391 -- 3) The row although existing in the HR Schema has a different object
392 -- version number than the object version number specified.
393 -- This error is trapped and reported using the message name
394 -- 'HR_7155_OBJECT_INVALID'.
395 --
396 -- Developer Implementation Notes:
397 -- None.
398 --
399 -- Access Status:
400 -- Internal Development Use Only.
401 --
402 -- {End Of Comments}
403 -- ----------------------------------------------------------------------------
404 Procedure lck
405 (p_effective_date in date
406 ,p_datetrack_mode in varchar2
407 ,p_optip_id in number
408 ,p_object_version_number in number
409 ,p_validation_start_date out nocopy date
410 ,p_validation_end_date out nocopy date
411 );
412 --
413 -- ----------------------------------------------------------------------------
414 -- |-----------------------------< convert_args >-----------------------------|
415 -- ----------------------------------------------------------------------------
416 -- {Start Of Comments}
417 --
418 -- Description:
419 -- This function is used to turn attribute parameters into the record
420 -- structure parameter g_rec_type.
421 --
422 -- Prerequisites:
423 -- This is a private function and can only be called from the ins or upd
424 -- attribute processes.
425 --
426 -- In Parameters:
427 --
428 -- Post Success:
429 -- A returning record structure will be returned.
430 --
431 -- Post Failure:
432 -- No direct error handling is required within this function. Any possible
433 -- errors within this function will be a PL/SQL value error due to conversion
434 -- of datatypes or data lengths.
435 --
436 -- Developer Implementation Notes:
437 -- None.
438 --
439 -- Access Status:
440 -- Internal Row Handler Use Only.
441 --
442 -- {End Of Comments}
443 -- ----------------------------------------------------------------------------
444 Function convert_args
445 (p_optip_id in number
446 ,p_effective_start_date in date
447 ,p_effective_end_date in date
448 ,p_business_group_id in number
449 ,p_pgm_id in number
450 ,p_ptip_id in number
451 ,p_pl_typ_id in number
452 ,p_opt_id in number
453 ,p_cmbn_ptip_opt_id in number
454 ,p_legislation_code in varchar2
455 ,p_legislation_subgroup in varchar2
456 ,p_otp_attribute_category in varchar2
457 ,p_otp_attribute1 in varchar2
458 ,p_otp_attribute2 in varchar2
459 ,p_otp_attribute3 in varchar2
460 ,p_otp_attribute4 in varchar2
461 ,p_otp_attribute5 in varchar2
462 ,p_otp_attribute6 in varchar2
463 ,p_otp_attribute7 in varchar2
464 ,p_otp_attribute8 in varchar2
465 ,p_otp_attribute9 in varchar2
466 ,p_otp_attribute10 in varchar2
467 ,p_otp_attribute11 in varchar2
468 ,p_otp_attribute12 in varchar2
469 ,p_otp_attribute13 in varchar2
470 ,p_otp_attribute14 in varchar2
471 ,p_otp_attribute15 in varchar2
472 ,p_otp_attribute16 in varchar2
473 ,p_otp_attribute17 in varchar2
474 ,p_otp_attribute18 in varchar2
475 ,p_otp_attribute19 in varchar2
476 ,p_otp_attribute20 in varchar2
477 ,p_otp_attribute21 in varchar2
478 ,p_otp_attribute22 in varchar2
479 ,p_otp_attribute23 in varchar2
480 ,p_otp_attribute24 in varchar2
481 ,p_otp_attribute25 in varchar2
482 ,p_otp_attribute26 in varchar2
483 ,p_otp_attribute27 in varchar2
484 ,p_otp_attribute28 in varchar2
485 ,p_otp_attribute29 in varchar2
486 ,p_otp_attribute30 in varchar2
487 ,p_object_version_number in number
488 )
489 Return g_rec_type;
490 --
491 end ben_otp_shd;