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