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