1 Package per_ctc_shd as
2 /* $Header: pectcrhi.pkh 120.0 2005/05/31 07:20:26 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Global Record Type Specification |
6 -- ----------------------------------------------------------------------------
7 --
8 Type g_rec_type Is Record
9 (
10 contract_id number(9),
11 effective_start_date date,
12 effective_end_date date,
13 business_group_id number(15),
14 object_version_number number(9),
15 person_id number(9),
16 reference varchar2(80),
17 type varchar2(30),
18 status varchar2(30),
19 status_reason varchar2(240),
20 doc_status varchar2(240),
21 doc_status_change_date date,
22 description varchar2(2000),
23 duration number(22,2),
24 duration_units varchar2(30),
25 contractual_job_title varchar2(80),
26 parties varchar2(80),
27 start_reason varchar2(30),
28 end_reason varchar2(30),
29 number_of_extensions number(9),
30 extension_reason varchar2(80),
31 extension_period number(22,2),
32 extension_period_units varchar2(30),
33 ctr_information_category varchar2(30),
34 ctr_information1 varchar2(150),
35 ctr_information2 varchar2(150),
36 ctr_information3 varchar2(150),
37 ctr_information4 varchar2(150),
38 ctr_information5 varchar2(150),
39 ctr_information6 varchar2(150),
40 ctr_information7 varchar2(150),
41 ctr_information8 varchar2(150),
42 ctr_information9 varchar2(150),
43 ctr_information10 varchar2(150),
44 ctr_information11 varchar2(150),
45 ctr_information12 varchar2(150),
46 ctr_information13 varchar2(150),
47 ctr_information14 varchar2(150),
48 ctr_information15 varchar2(150),
49 ctr_information16 varchar2(150),
50 ctr_information17 varchar2(150),
51 ctr_information18 varchar2(150),
52 ctr_information19 varchar2(150),
53 ctr_information20 varchar2(150),
54 attribute_category varchar2(30),
55 attribute1 varchar2(150),
56 attribute2 varchar2(150),
57 attribute3 varchar2(150),
58 attribute4 varchar2(150),
59 attribute5 varchar2(150),
60 attribute6 varchar2(150),
61 attribute7 varchar2(150),
62 attribute8 varchar2(150),
63 attribute9 varchar2(150),
64 attribute10 varchar2(150),
65 attribute11 varchar2(150),
66 attribute12 varchar2(150),
67 attribute13 varchar2(150),
68 attribute14 varchar2(150),
69 attribute15 varchar2(150),
70 attribute16 varchar2(150),
71 attribute17 varchar2(150),
72 attribute18 varchar2(150),
73 attribute19 varchar2(150),
74 attribute20 varchar2(150)
75 );
76 --
77 -- ----------------------------------------------------------------------------
78 -- | Global Definitions - Internal Development Use Only |
79 -- ----------------------------------------------------------------------------
80 --
81 g_old_rec g_rec_type; -- Global record definition
82 g_api_dml boolean; -- Global api dml status
83 --
84 -- ----------------------------------------------------------------------------
85 -- |---------------------------< constraint_error >---------------------------|
86 -- ----------------------------------------------------------------------------
87 -- {Start Of Comments}
88 --
89 -- Description:
90 -- This procedure is called when a constraint has been violated (i.e.
91 -- The exception hr_api.check_integrity_violated,
92 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
93 -- hr_api.unique_integrity_violated has been raised).
94 -- The exceptions can only be raised as follows:
95 -- 1) A check constraint can only be violated during an INSERT or UPDATE
96 -- dml operation.
97 -- 2) A parent integrity constraint can only be violated during an
98 -- INSERT or UPDATE dml operation.
99 -- 3) A child integrity constraint can only be violated during an
100 -- DELETE dml operation.
101 -- 4) A unique integrity constraint can only be violated during INSERT or
102 -- UPDATE dml operation.
103 --
104 -- Prerequisites:
105 -- 1) Either hr_api.check_integrity_violated,
106 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
107 -- hr_api.unique_integrity_violated has been raised with the subsequent
108 -- stripping of the constraint name from the generated error message
109 -- text.
110 -- 2) Standalone validation test which corresponds with a constraint error.
111 --
112 -- In Parameter:
113 -- p_constraint_name is in upper format and is just the constraint name
114 -- (e.g. not prefixed by brackets, schema owner etc).
115 --
116 -- Post Success:
117 -- Development dependant.
118 --
119 -- Post Failure:
120 -- Developement dependant.
121 --
122 -- Developer Implementation Notes:
123 -- For each constraint being checked the hr system package failure message
124 -- has been generated as a template only. These system error messages should
125 -- be modified as required (i.e. change the system failure message to a user
126 -- friendly defined error message).
127 --
128 -- Access Status:
129 -- Internal Development Use Only.
130 --
131 -- {End Of Comments}
132 -- ----------------------------------------------------------------------------
133 Procedure constraint_error
134 (p_constraint_name in all_constraints.constraint_name%TYPE);
135 --
136 -- ----------------------------------------------------------------------------
137 -- |-----------------------------< api_updating >-----------------------------|
138 -- ----------------------------------------------------------------------------
139 -- {Start Of Comments}
140 --
141 -- Description:
142 -- This function is used to populate the g_old_rec record with the current
143 -- row from the database for the specified primary key provided that the
144 -- primary key exists, and is valid, and does not already match the current
145 -- g_old_rec.
146 -- The function will always return a TRUE value if the g_old_rec is
147 -- populated with the current row. A FALSE value will be returned if all of
148 -- the primary key arguments are null.
149 --
150 -- Prerequisites:
151 -- None.
152 --
153 -- In Parameters:
154 --
155 -- Post Success:
156 -- A value of TRUE will be returned indiciating that the g_old_rec is
157 -- current.
158 -- A value of FALSE will be returned if all of the primary key arguments
159 -- have a null value (this indicates that the row has not be inserted into
160 -- the Schema), and therefore could never have a corresponding row.
161 --
162 -- Post Failure:
163 -- A failure can only occur under two circumstances:
164 -- 1) The primary key is invalid (i.e. a row does not exist for the
165 -- specified primary key values).
166 -- 2) If an object_version_number exists but is NOT the same as the current
167 -- g_old_rec value.
168 --
169 -- Developer Implementation Notes:
170 -- None.
171 --
172 -- Access Status:
173 -- Internal Development Use Only.
174 --
175 -- {End Of Comments}
176 -- ----------------------------------------------------------------------------
177 Function api_updating
178 (p_effective_date in date,
179 p_contract_id in number,
180 p_object_version_number in number
181 ) Return Boolean;
182 --
183 -- ----------------------------------------------------------------------------
184 -- |--------------------------< find_dt_del_modes >---------------------------|
185 -- ----------------------------------------------------------------------------
186 -- {Start Of Comments}
187 --
188 -- Description:
189 -- This procedure is used to determine what datetrack delete modes are
190 -- allowed as of the effective date for this entity. The procedure will
191 -- return a corresponding Boolean value for each of the delete modes
192 -- available where TRUE indicates that the corresponding delete mode is
193 -- available.
194 --
195 -- Prerequisites:
196 -- None.
197 --
198 -- In Parameters:
199 -- p_effective_date
200 -- Specifies the date at which the datetrack modes will be operated on.
201 -- p_base_key_value
202 -- Specifies the primary key value for this datetrack entity.
203 -- (E.g. For this entity the assignment of the argument would be:
204 -- p_base_key_value = :contract_id).
205 --
206 -- Post Success:
207 -- Processing continues.
208 --
209 -- Post Failure:
210 -- Failure might occur if for the specified effective date and primary key
211 -- value a row doesn't exist.
212 --
213 -- Developer Implementation Notes:
214 -- This procedure could require changes if this entity has any sepcific
215 -- delete restrictions.
216 -- For example, this entity might disallow the datetrack delete mode of
217 -- ZAP. To implement this you would have to set and return a Boolean value
218 -- of FALSE after the call to the dt_api.find_dt_del_modes procedure.
219 --
220 -- Access Status:
221 -- Internal Development Use Only.
222 --
223 -- {End Of Comments}
224 -- ----------------------------------------------------------------------------
225 Procedure find_dt_del_modes
226 (p_effective_date in date,
227 p_base_key_value in number,
228 p_zap out nocopy boolean,
229 p_delete out nocopy boolean,
230 p_future_change out nocopy boolean,
231 p_delete_next_change out nocopy boolean);
232 --
233 -- ----------------------------------------------------------------------------
234 -- |--------------------------< find_dt_upd_modes >---------------------------|
235 -- ----------------------------------------------------------------------------
236 -- {Start Of Comments}
237 --
238 -- Description:
239 -- This procedure is used to determine what datetrack update modes are
240 -- allowed as of the effective date for this entity. The procedure will
241 -- return a corresponding Boolean value for each of the update modes
242 -- available where TRUE indicates that the corresponding update mode
243 -- is available.
244 --
245 -- Prerequisites:
246 -- None.
247 --
248 -- In Parameters:
249 -- p_effective_date
250 -- Specifies the date at which the datetrack modes will be operated on.
251 -- p_base_key_value
252 -- Specifies the primary key value for this datetrack entity.
253 -- (E.g. For this entity the assignment of the argument would be:
254 -- p_base_key_value = :contract_id).
255 --
256 -- Post Success:
257 -- Processing continues.
258 --
259 -- Post Failure:
260 -- Failure might occur if for the specified effective date and primary key
261 -- value a row doesn't exist.
262 --
263 -- Developer Implementation Notes:
264 -- This procedure could require changes if this entity has any sepcific
265 -- delete restrictions.
266 -- For example, this entity might disallow the datetrack update mode of
267 -- UPDATE. To implement this you would have to set and return a Boolean
268 -- value of FALSE after the call to the dt_api.find_dt_upd_modes procedure.
269 --
270 -- Access Status:
271 -- Internal Development Use Only.
272 --
273 -- {End Of Comments}
274 -- ----------------------------------------------------------------------------
275 Procedure find_dt_upd_modes
276 (p_effective_date in date,
277 p_base_key_value in number,
278 p_correction out nocopy boolean,
279 p_update out nocopy boolean,
280 p_update_override out nocopy boolean,
281 p_update_change_insert out nocopy boolean);
282 --
283 -- ----------------------------------------------------------------------------
284 -- |------------------------< upd_effective_end_date >------------------------|
285 -- ----------------------------------------------------------------------------
286 -- {Start Of Comments}
287 --
288 -- Description:
289 -- This procedure will update the specified datetrack row with the
290 -- specified new effective end date. The object version number is also
291 -- set to the next object version number. DateTrack modes which call
292 -- this procedure are: UPDATE, UPDATE_CHANGE_INSERT,
293 -- UPDATE_OVERRIDE, DELETE, FUTURE_CHANGE and DELETE_NEXT_CHANGE.
294 -- This is an internal datetrack maintenance procedure which should
295 -- not be modified in anyway.
296 --
297 -- Prerequisites:
298 -- None.
299 --
300 -- In Parameters:
301 -- p_new_effective_end_date
302 -- Specifies the new effective end date which will be set for the
303 -- row as of the effective date.
304 -- p_base_key_value
305 -- Specifies the primary key value for this datetrack entity.
306 -- (E.g. For this entity the assignment of the argument would be:
307 -- p_base_key_value = :contract_id).
308 --
309 -- Post Success:
310 -- The specified row will be updated with the new effective end date and
311 -- object_version_number.
312 --
313 -- Post Failure:
314 -- Failure might occur if for the specified effective date and primary key
315 -- value a row doesn't exist.
316 --
317 -- Developer Implementation Notes:
318 -- This is an internal datetrack maintenance procedure which should
319 -- not be modified in anyway.
320 --
321 -- Access Status:
322 -- Internal Row Handler Use Only.
323 --
324 -- {End Of Comments}
325 -- ----------------------------------------------------------------------------
326 Procedure upd_effective_end_date
327 (p_effective_date in date,
328 p_base_key_value in number,
329 p_new_effective_end_date in date,
330 p_validation_start_date in date,
331 p_validation_end_date in date,
332 p_object_version_number out nocopy number);
333 --
334 -- ----------------------------------------------------------------------------
335 -- |---------------------------------< lck >----------------------------------|
336 -- ----------------------------------------------------------------------------
337 -- {Start Of Comments}
338 --
339 -- Description:
340 -- The Lck process for datetrack is complicated and comprises of the
341 -- following processing
342 -- The processing steps are as follows:
343 -- 1) The row to be updated or deleted must be locked.
344 -- By locking this row, the g_old_rec record data type is populated.
345 -- 2) If a comment exists the text is selected from hr_comments.
346 -- 3) The datetrack mode is then validated to ensure the operation is
347 -- valid. If the mode is valid the validation start and end dates for
348 -- the mode will be derived and returned. Any required locking is
349 -- completed when the datetrack mode is validated.
350 --
351 -- Prerequisites:
352 -- When attempting to call the lck procedure the object version number,
353 -- primary key, effective date and datetrack mode must be specified.
354 --
355 -- In Parameters:
356 -- p_effective_date
357 -- Specifies the date of the datetrack update operation.
358 -- p_datetrack_mode
359 -- Determines the datetrack update or delete mode.
360 --
361 -- Post Success:
365 --
362 -- On successful completion of the Lck process the row to be updated or
363 -- deleted will be locked and selected into the global data structure
364 -- g_old_rec.
366 -- Post Failure:
367 -- The Lck process can fail for three reasons:
368 -- 1) When attempting to lock the row the row could already be locked by
369 -- another user. This will raise the HR_Api.Object_Locked exception.
370 -- 2) The row which is required to be locked doesn't exist in the HR Schema.
371 -- This error is trapped and reported using the message name
372 -- 'HR_7220_INVALID_PRIMARY_KEY'.
373 -- 3) The row although existing in the HR Schema has a different object
374 -- version number than the object version number specified.
375 -- This error is trapped and reported using the message name
376 -- 'HR_7155_OBJECT_INVALID'.
377 --
378 -- Developer Implementation Notes:
379 -- None.
380 --
381 -- Access Status:
382 -- Internal Development Use Only.
383 --
384 -- {End Of Comments}
385 -- ----------------------------------------------------------------------------
386 Procedure lck
387 (p_effective_date in date,
388 p_datetrack_mode in varchar2,
389 p_contract_id in number,
390 p_object_version_number in number,
391 p_validation_start_date out nocopy date,
392 p_validation_end_date out nocopy date);
393 --
394 -- ----------------------------------------------------------------------------
395 -- |-----------------------------< convert_args >-----------------------------|
396 -- ----------------------------------------------------------------------------
397 -- {Start Of Comments}
398 --
399 -- Description:
400 -- This function is used to turn attribute parameters into the record
401 -- structure parameter g_rec_type.
402 --
403 -- Prerequisites:
404 -- This is a private function and can only be called from the ins or upd
405 -- attribute processes.
406 --
407 -- In Parameters:
408 --
409 -- Post Success:
410 -- A returning record structure will be returned.
411 --
412 -- Post Failure:
413 -- No direct error handling is required within this function. Any possible
414 -- errors within this function will be a PL/SQL value error due to conversion
415 -- of datatypes or data lengths.
416 --
417 -- Developer Implementation Notes:
418 -- None.
419 --
420 -- Access Status:
421 -- Internal Row Handler Use Only.
422 --
423 -- {End Of Comments}
424 -- ----------------------------------------------------------------------------
425 Function convert_args
426 (
427 p_contract_id in number,
428 p_effective_start_date in date,
429 p_effective_end_date in date,
430 p_business_group_id in number,
431 p_object_version_number in number,
432 p_person_id in number,
433 p_reference in varchar2,
434 p_type in varchar2,
435 p_status in varchar2,
436 p_status_reason in varchar2,
437 p_doc_status in varchar2,
438 p_doc_status_change_date in date,
439 p_description in varchar2,
440 p_duration in number,
441 p_duration_units in varchar2,
442 p_contractual_job_title in varchar2,
443 p_parties in varchar2,
444 p_start_reason in varchar2,
445 p_end_reason in varchar2,
446 p_number_of_extensions in number,
447 p_extension_reason in varchar2,
448 p_extension_period in number,
449 p_extension_period_units in varchar2,
450 p_ctr_information_category in varchar2,
451 p_ctr_information1 in varchar2,
452 p_ctr_information2 in varchar2,
453 p_ctr_information3 in varchar2,
454 p_ctr_information4 in varchar2,
455 p_ctr_information5 in varchar2,
456 p_ctr_information6 in varchar2,
457 p_ctr_information7 in varchar2,
458 p_ctr_information8 in varchar2,
459 p_ctr_information9 in varchar2,
460 p_ctr_information10 in varchar2,
461 p_ctr_information11 in varchar2,
462 p_ctr_information12 in varchar2,
463 p_ctr_information13 in varchar2,
464 p_ctr_information14 in varchar2,
465 p_ctr_information15 in varchar2,
466 p_ctr_information16 in varchar2,
467 p_ctr_information17 in varchar2,
468 p_ctr_information18 in varchar2,
469 p_ctr_information19 in varchar2,
470 p_ctr_information20 in varchar2,
471 p_attribute_category in varchar2,
472 p_attribute1 in varchar2,
473 p_attribute2 in varchar2,
474 p_attribute3 in varchar2,
475 p_attribute4 in varchar2,
476 p_attribute5 in varchar2,
477 p_attribute6 in varchar2,
478 p_attribute7 in varchar2,
479 p_attribute8 in varchar2,
480 p_attribute9 in varchar2,
481 p_attribute10 in varchar2,
482 p_attribute11 in varchar2,
483 p_attribute12 in varchar2,
484 p_attribute13 in varchar2,
485 p_attribute14 in varchar2,
486 p_attribute15 in varchar2,
487 p_attribute16 in varchar2,
488 p_attribute17 in varchar2,
489 p_attribute18 in varchar2,
490 p_attribute19 in varchar2,
491 p_attribute20 in varchar2
492 )
493 Return g_rec_type;
494 --
495 Procedure lock_record
496 (
497 p_contract_id in per_contracts_f.contract_id%TYPE,
498 p_effective_date in date,
499 p_object_version_number in per_contracts_f.object_version_number%TYPE
500 );
501 --
502 end per_ctc_shd;