1 Package irc_irf_shd AUTHID CURRENT_USER as
2 /* $Header: irirfrhi.pkh 120.1 2008/04/16 07:34:00 vmummidi noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Global Record Type Specification |
6 -- ----------------------------------------------------------------------------
7 --
8 Type g_rec_type Is Record
9 ( referral_info_id number(15)
10 ,object_id number(15)
11 ,object_type varchar2(30)
12 ,start_date date
13 ,end_date date
14 ,source_type varchar2(30)
15 ,source_name varchar2(240)
16 ,source_criteria1 varchar2(30)
17 ,source_value1 varchar2(320)
18 ,source_criteria2 varchar2(30)
19 ,source_value2 varchar2(320)
20 ,source_criteria3 varchar2(30)
21 ,source_value3 varchar2(320)
22 ,source_criteria4 varchar2(30)
23 ,source_value4 varchar2(320)
24 ,source_criteria5 varchar2(30)
25 ,source_value5 varchar2(320)
26 ,source_person_id number(15)
27 ,candidate_comment varchar2(4000)
28 ,employee_comment varchar2(4000)
29 ,irf_attribute_category varchar2(30)
30 ,irf_attribute1 varchar2(150)
31 ,irf_attribute2 varchar2(150)
32 ,irf_attribute3 varchar2(150)
33 ,irf_attribute4 varchar2(150)
34 ,irf_attribute5 varchar2(150)
35 ,irf_attribute6 varchar2(150)
36 ,irf_attribute7 varchar2(150)
37 ,irf_attribute8 varchar2(150)
38 ,irf_attribute9 varchar2(150)
39 ,irf_attribute10 varchar2(150)
40 ,irf_information_category varchar2(30)
41 ,irf_information1 varchar2(150)
42 ,irf_information2 varchar2(150)
43 ,irf_information3 varchar2(150)
44 ,irf_information4 varchar2(150)
45 ,irf_information5 varchar2(150)
46 ,irf_information6 varchar2(150)
47 ,irf_information7 varchar2(150)
48 ,irf_information8 varchar2(150)
49 ,irf_information9 varchar2(150)
50 ,irf_information10 varchar2(150)
51 ,object_created_by varchar2(30)
52 ,created_by number(15)
53 ,object_version_number number(9)
54 );
55 --
56 -- ----------------------------------------------------------------------------
57 -- | Global Definitions - Internal Development Use Only |
58 -- ----------------------------------------------------------------------------
59 --
60 g_old_rec g_rec_type; -- Global record definition
61 -- Global table name
62 g_tab_name constant varchar2(30) := 'IRC_REFERRAL_INFO';
63 --
64 -- ----------------------------------------------------------------------------
65 -- |---------------------------< constraint_error >---------------------------|
66 -- ----------------------------------------------------------------------------
67 -- {Start Of Comments}
68 --
69 -- Description:
70 -- This procedure is called when a constraint has been violated (i.e.
71 -- The exception hr_api.check_integrity_violated,
72 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
73 -- hr_api.unique_integrity_violated has been raised).
74 -- The exceptions can only be raised as follows:
75 -- 1) A check constraint can only be violated during an INSERT or UPDATE
76 -- dml operation.
77 -- 2) A parent integrity constraint can only be violated during an
78 -- INSERT or UPDATE dml operation.
79 -- 3) A child integrity constraint can only be violated during an
80 -- DELETE dml operation.
81 -- 4) A unique integrity constraint can only be violated during INSERT or
82 -- UPDATE dml operation.
83 --
84 -- Prerequisites:
85 -- 1) Either hr_api.check_integrity_violated,
86 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
87 -- hr_api.unique_integrity_violated has been raised with the subsequent
88 -- stripping of the constraint name from the generated error message
89 -- text.
90 -- 2) Standalone validation test which corresponds with a constraint error.
91 --
92 -- In Parameter:
93 -- p_constraint_name is in upper format and is just the constraint name
94 -- (e.g. not prefixed by brackets, schema owner etc).
95 --
96 -- Post Success:
97 -- Development dependant.
98 --
99 -- Post Failure:
100 -- Developement dependant.
101 --
102 -- Developer Implementation Notes:
103 -- For each constraint being checked the hr system package failure message
104 -- has been generated as a template only. These system error messages should
105 -- be modified as required (i.e. change the system failure message to a user
106 -- friendly defined error message).
107 --
108 -- Access Status:
109 -- Internal Development Use Only.
110 --
111 -- {End Of Comments}
112 -- ----------------------------------------------------------------------------
113 Procedure constraint_error
114 (p_constraint_name in all_constraints.constraint_name%TYPE);
115 --
116 -- ----------------------------------------------------------------------------
117 -- |-----------------------------< api_updating >-----------------------------|
118 -- ----------------------------------------------------------------------------
119 -- {Start Of Comments}
120 --
121 -- Description:
122 -- This function is used to populate the g_old_rec record with the
123 -- current row from the database for the specified primary key
124 -- provided that the primary key exists and is valid and does not
125 -- already match the current g_old_rec. The function will always return
126 -- a TRUE value if the g_old_rec is populated with the current row.
127 -- A FALSE value will be returned if all of the primary key arguments
128 -- are null.
129 --
130 -- Prerequisites:
131 -- None.
132 --
133 -- In Parameters:
134 --
135 -- Post Success:
136 -- A value of TRUE will be returned indiciating that the g_old_rec
137 -- is current.
138 -- A value of FALSE will be returned if all of the primary key arguments
139 -- have a null value (this indicates that the row has not be inserted into
140 -- the Schema), and therefore could never have a corresponding row.
141 --
142 -- Post Failure:
143 -- A failure can only occur under two circumstances:
144 -- 1) The primary key is invalid (i.e. a row does not exist for the
145 -- specified primary key values).
146 -- 2) If an object_version_number exists but is NOT the same as the current
147 -- g_old_rec value.
148 --
149 -- Developer Implementation Notes:
150 -- None.
151 --
152 -- Access Status:
153 -- Internal Development Use Only.
154 --
155 -- {End Of Comments}
156 -- ----------------------------------------------------------------------------
157 Function api_updating
158 (p_effective_date in date
159 ,p_referral_info_id in number
160 ,p_object_version_number in number
161 ) Return Boolean;
162 --
163 -- ----------------------------------------------------------------------------
164 -- |----------------------------< upd_end_date >------------------------------|
165 -- ----------------------------------------------------------------------------
166 -- {Start Of Comments}
167 --
168 -- Description:
169 -- This procedure will update the specified datetrack row with the
170 -- specified new effective end date. The object version number is also
171 -- set to the next object version number. DateTrack modes which call
172 -- this procedure are: UPDATE, UPDATE_CHANGE_INSERT,
173 -- UPDATE_OVERRIDE, DELETE, FUTURE_CHANGE and DELETE_NEXT_CHANGE.
174 -- This is an internal datetrack maintenance procedure which should
175 -- not be modified in anyway.
176 --
177 -- Prerequisites:
178 -- None.
179 --
180 -- In Parameters:
181 -- p_new_effective_end_date
182 -- Specifies the new effective end date which will be set for the
183 -- row as of the effective date.
184 -- p_base_key_value
185 -- Specifies the primary key value for this datetrack entity.
186 -- (E.g. For this entity the assignment of the argument would be:
187 -- p_base_key_value = :attribute_id).
188 --
189 -- Post Success:
190 -- The specified row will be updated with the new effective end date and
191 -- object_version_number.
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 is an internal datetrack maintenance procedure which should
199 -- not be modified in anyway.
200 --
201 -- Access Status:
202 -- Internal Row Handler Use Only.
203 --
204 -- {End Of Comments}
205 -- ----------------------------------------------------------------------------
206 Procedure upd_end_date
207 (p_effective_date in date
208 ,p_referral_info_id in number
209 ,p_new_end_date in date
210 ,p_object_version_number out nocopy number
211 );
212 --
213 -- ----------------------------------------------------------------------------
214 -- |---------------------------------< lck >----------------------------------|
215 -- ----------------------------------------------------------------------------
216 -- {Start Of Comments}
217 --
218 -- Description:
219 -- The Lck process for datetrack is complicated and comprises of the
220 -- following processing
221 -- The processing steps are as follows:
222 -- 1) The row to be updated or deleted must be locked.
223 -- By locking this row, the g_old_rec record data type is populated.
224 -- 2) If a comment exists the text is selected from hr_comments.
225 -- 3) The datetrack mode is then validated to ensure the operation is
226 -- valid. If the mode is valid the validation start and end dates for
227 -- the mode will be derived and returned. Any required locking is
228 -- completed when the datetrack mode is validated.
229 --
230 -- Prerequisites:
231 -- When attempting to call the lck procedure the object version number,
232 -- primary key, effective date and datetrack mode must be specified.
233 --
234 -- In Parameters:
235 -- p_effective_date
236 -- Specifies the date of the datetrack update operation.
237 -- p_datetrack_mode
238 -- Determines the datetrack update or delete mode.
239 --
240 -- Post Success:
241 -- On successful completion of the Lck process the row to be updated or
242 -- deleted will be locked and selected into the global data structure
243 -- g_old_rec.
244 --
245 -- Post Failure:
246 -- The Lck process can fail for three reasons:
247 -- 1) When attempting to lock the row the row could already be locked by
248 -- another user. This will raise the HR_Api.Object_Locked exception.
249 -- 2) The row which is required to be locked doesn't exist in the HR Schema.
250 -- This error is trapped and reported using the message name
251 -- 'HR_7220_INVALID_PRIMARY_KEY'.
252 -- 3) The row although existing in the HR Schema has a different object
253 -- version number than the object version number specified.
254 -- This error is trapped and reported using the message name
255 -- 'HR_7155_OBJECT_INVALID'.
256 --
257 -- Developer Implementation Notes:
258 -- None.
259 --
260 -- Access Status:
261 -- Internal Development Use Only.
262 --
263 -- {End Of Comments}
264 -- ----------------------------------------------------------------------------
265 Procedure lck
266 (p_effective_date in date
267 ,p_datetrack_mode in varchar2
268 ,p_referral_info_id in number
269 ,p_object_version_number in number
270 ,p_validation_start_date out nocopy date
271 ,p_validation_end_date out nocopy date
272 );
273 --
274 -- ----------------------------------------------------------------------------
275 -- |-----------------------------< convert_args >-----------------------------|
276 -- ----------------------------------------------------------------------------
277 -- {Start Of Comments}
278 --
279 -- Description:
280 -- This function is used to turn attribute parameters into the record
281 -- structure parameter g_rec_type.
282 --
283 -- Prerequisites:
284 -- This is a private function and can only be called from the ins or upd
285 -- attribute processes.
286 --
287 -- In Parameters:
288 --
289 -- Post Success:
290 -- A returning record structure will be returned.
291 --
292 -- Post Failure:
293 -- No direct error handling is required within this function. Any possible
294 -- errors within this function will be a PL/SQL value error due to
295 -- conversion of datatypes or data lengths.
296 --
297 -- Developer Implementation Notes:
298 -- None.
299 --
300 -- Access Status:
301 -- Internal Row Handler Use Only.
302 --
303 -- {End Of Comments}
304 -- ----------------------------------------------------------------------------
305 Function convert_args
306 (p_referral_info_id in number
307 ,p_object_id in number
308 ,p_object_type in varchar2
309 ,p_start_date in date
310 ,p_end_date in date
311 ,p_source_type in varchar2
312 ,p_source_name in varchar2
313 ,p_source_criteria1 in varchar2
314 ,p_source_value1 in varchar2
315 ,p_source_criteria2 in varchar2
316 ,p_source_value2 in varchar2
317 ,p_source_criteria3 in varchar2
318 ,p_source_value3 in varchar2
319 ,p_source_criteria4 in varchar2
320 ,p_source_value4 in varchar2
321 ,p_source_criteria5 in varchar2
322 ,p_source_value5 in varchar2
323 ,p_source_person_id in number
324 ,p_candidate_comment in varchar2
325 ,p_employee_comment in varchar2
326 ,p_irf_attribute_category in varchar2
327 ,p_irf_attribute1 in varchar2
328 ,p_irf_attribute2 in varchar2
329 ,p_irf_attribute3 in varchar2
330 ,p_irf_attribute4 in varchar2
331 ,p_irf_attribute5 in varchar2
332 ,p_irf_attribute6 in varchar2
333 ,p_irf_attribute7 in varchar2
334 ,p_irf_attribute8 in varchar2
335 ,p_irf_attribute9 in varchar2
336 ,p_irf_attribute10 in varchar2
337 ,p_irf_information_category in varchar2
338 ,p_irf_information1 in varchar2
339 ,p_irf_information2 in varchar2
340 ,p_irf_information3 in varchar2
341 ,p_irf_information4 in varchar2
342 ,p_irf_information5 in varchar2
343 ,p_irf_information6 in varchar2
344 ,p_irf_information7 in varchar2
345 ,p_irf_information8 in varchar2
346 ,p_irf_information9 in varchar2
347 ,p_irf_information10 in varchar2
348 ,p_object_created_by in varchar2
349 ,p_object_version_number in number
350 )
351 Return g_rec_type;
352 --
353 -- ----------------------------------------------------------------------------
354 -- |-----------------------------< get_object_version_number >----------------|
355 -- ----------------------------------------------------------------------------
356 -- {Start Of Comments}
357 --
358 -- Description:
359 -- This function is used to get the next object version number to be used
360 -- within datetrack for an insert or update dml operation. The returned
361 -- object version number will be determined by taking the maximum
362 -- object version number for the datetracked rows and then incrementing by 1.
363 --
364 --
365 -- Prerequisites:
366 -- This is a private function and can only be called from the ins or upd
367 -- attribute processes.
368 --
369 -- In Parameters:
370 --
371 --
372 -- Post Success:
373 --
374 --
375 -- Post Failure:
376 --
377 --
378 --
379 --
380 -- Developer Implementation Notes:
381 -- None.
382 --
383 -- Access Status:
384 -- Internal Row Handler Use Only.
385 --
386 -- {End Of Comments}
387 -- ----------------------------------------------------------------------------
388 Function get_object_version_number
389 (p_referral_info_id in number
390 )
391 Return number;
392 --
393 end irc_irf_shd;