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