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