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