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