1 Package per_chk_shd as
2 /* $Header: pechkrhi.pkh 120.0 2005/05/31 06:41:48 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Global Record Type Specification |
6 -- ----------------------------------------------------------------------------
7 --
8 Type g_rec_type Is Record
9 (
10 checklist_item_id number(15),
11 person_id number(10),
12 item_code varchar2(30),
13 date_due date,
14 date_done date,
15 status varchar2(30),
16 notes varchar2(255), -- pseudo column
17 object_version_number number(9),
18 attribute_category varchar2(240),
19 attribute1 varchar2(150),
20 attribute2 varchar2(150),
21 attribute3 varchar2(150),
22 attribute4 varchar2(150),
23 attribute5 varchar2(150),
24 attribute6 varchar2(150),
25 attribute7 varchar2(150),
26 attribute8 varchar2(150),
27 attribute9 varchar2(150),
28 attribute10 varchar2(150),
29 attribute11 varchar2(150),
30 attribute12 varchar2(150),
31 attribute13 varchar2(150),
32 attribute14 varchar2(150),
33 attribute15 varchar2(150),
34 attribute16 varchar2(150),
35 attribute17 varchar2(150),
36 attribute18 varchar2(150),
37 attribute19 varchar2(150),
38 attribute20 varchar2(150),
39 attribute21 varchar2(150),
40 attribute22 varchar2(150),
41 attribute23 varchar2(150),
42 attribute24 varchar2(150),
43 attribute25 varchar2(150),
44 attribute26 varchar2(150),
45 attribute27 varchar2(150),
46 attribute28 varchar2(150),
47 attribute29 varchar2(150),
48 attribute30 varchar2(150)
49 );
50 --
51 -- ----------------------------------------------------------------------------
52 -- | Global Definitions - Internal Development Use Only |
53 -- ----------------------------------------------------------------------------
54 --
55 g_old_rec g_rec_type; -- Global record definition
56 g_api_dml boolean; -- Global api dml status
57 --
58 -- ----------------------------------------------------------------------------
59 -- |------------------------< return_api_dml_status >-------------------------|
60 -- ----------------------------------------------------------------------------
61 -- {Start Of Comments}
62 --
63 -- Description:
64 -- This function will return the current g_api_dml private global
65 -- boolean status.
66 -- The g_api_dml status determines if at the time of the function
67 -- being executed if a dml statement (i.e. INSERT, UPDATE or DELETE)
68 -- is being issued from within an api.
69 -- If the status is TRUE then a dml statement is being issued from
70 -- within this entity api.
71 -- This function is primarily to support database triggers which
72 -- need to maintain the object_version_number for non-supported
73 -- dml statements (i.e. dml statement issued outside of the api layer).
74 --
75 -- Prerequisites:
76 -- None.
77 --
78 -- In Parameters:
79 -- None.
80 --
81 -- Post Success:
82 -- Processing continues.
83 -- If the function returns a TRUE value then, dml is being executed from
84 -- within this api.
85 --
86 -- Post Failure:
87 -- None.
88 --
89 -- Access Status:
90 -- Internal Row Handler Use Only.
91 --
92 -- {End Of Comments}
93 -- ----------------------------------------------------------------------------
94 Function return_api_dml_status Return Boolean;
95 --
96 -- ----------------------------------------------------------------------------
97 -- |---------------------------< constraint_error >---------------------------|
98 -- ----------------------------------------------------------------------------
99 -- {Start Of Comments}
100 --
101 -- Description:
102 -- This procedure is called when a constraint has been violated (i.e.
103 -- The exception hr_api.check_integrity_violated,
104 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
105 -- hr_api.unique_integrity_violated has been raised).
106 -- The exceptions can only be raised as follows:
107 -- 1) A check constraint can only be violated during an INSERT or UPDATE
108 -- dml operation.
109 -- 2) A parent integrity constraint can only be violated during an
110 -- INSERT or UPDATE dml operation.
111 -- 3) A child integrity constraint can only be violated during an
112 -- DELETE dml operation.
113 -- 4) A unique integrity constraint can only be violated during INSERT or
114 -- UPDATE dml operation.
115 --
116 -- Prerequisites:
117 -- 1) Either hr_api.check_integrity_violated,
118 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
119 -- hr_api.unique_integrity_violated has been raised with the subsequent
120 -- stripping of the constraint name from the generated error message
121 -- text.
122 -- 2) Standalone validation test which corresponds with a constraint error.
123 --
124 -- In Parameter:
125 -- p_constraint_name is in upper format and is just the constraint name
126 -- (e.g. not prefixed by brackets, schema owner etc).
127 --
128 -- Post Success:
129 -- Development dependant.
130 --
131 -- Post Failure:
132 -- Developement dependant.
133 --
134 -- Developer Implementation Notes:
135 -- For each constraint being checked the hr system package failure message
136 -- has been generated as a template only. These system error messages should
137 -- be modified as required (i.e. change the system failure message to a user
138 -- friendly defined error message).
139 --
140 -- Access Status:
141 -- Internal Development Use Only.
142 --
143 -- {End Of Comments}
144 -- ----------------------------------------------------------------------------
145 Procedure constraint_error
146 (p_constraint_name in all_constraints.constraint_name%TYPE);
147 --
148 -- ----------------------------------------------------------------------------
149 -- |-----------------------------< api_updating >-----------------------------|
150 -- ----------------------------------------------------------------------------
151 -- {Start Of Comments}
152 --
153 -- Description:
154 -- This function is used to populate the g_old_rec record with the
155 -- current row from the database for the specified primary key
156 -- provided that the primary key exists and is valid and does not
157 -- already match the current g_old_rec. The function will always return
158 -- a TRUE value if the g_old_rec is populated with the current row.
159 -- A FALSE value will be returned if all of the primary key arguments
160 -- are null.
161 --
162 -- Prerequisites:
163 -- None.
164 --
165 -- In Parameters:
166 --
167 -- Post Success:
168 -- A value of TRUE will be returned indiciating that the g_old_rec
169 -- is current.
170 -- A value of FALSE will be returned if all of the primary key arguments
171 -- have a null value (this indicates that the row has not be inserted into
172 -- the Schema), and therefore could never have a corresponding row.
173 --
174 -- Post Failure:
175 -- A failure can only occur under two circumstances:
176 -- 1) The primary key is invalid (i.e. a row does not exist for the
177 -- specified primary key values).
178 -- 2) If an object_version_number exists but is NOT the same as the current
179 -- g_old_rec value.
180 --
181 -- Developer Implementation Notes:
182 -- None.
183 --
184 -- Access Status:
185 -- Internal Development Use Only.
186 --
187 -- {End Of Comments}
188 -- ----------------------------------------------------------------------------
189 Function api_updating
190 (
191 p_checklist_item_id in number,
192 p_object_version_number in number
193 ) Return Boolean;
194 --
195 -- ----------------------------------------------------------------------------
196 -- |---------------------------------< lck >----------------------------------|
197 -- ----------------------------------------------------------------------------
198 -- {Start Of Comments}
199 --
200 -- Description:
201 -- The Lck process has two main functions to perform. Firstly, the row to be
202 -- updated or deleted must be locked. The locking of the row will only be
203 -- successful if the row is not currently locked by another user.
204 -- Secondly, during the locking of the row, the row is selected into
205 -- the g_old_rec data structure which enables the current row values from the
206 -- server to be available to the api.
207 --
208 -- Prerequisites:
209 -- When attempting to call the lock the object version number (if defined)
210 -- is mandatory.
211 --
212 -- In Parameters:
213 -- The arguments to the Lck process are the primary key(s) which uniquely
214 -- identify the row and the object version number of row.
215 --
216 -- Post Success:
217 -- On successful completion of the Lck process the row to be updated or
218 -- deleted will be locked and selected into the global data structure
219 -- g_old_rec.
220 --
221 -- Post Failure:
222 -- The Lck process can fail for three reasons:
223 -- 1) When attempting to lock the row the row could already be locked by
224 -- another user. This will raise the HR_Api.Object_Locked exception.
225 -- 2) The row which is required to be locked doesn't exist in the HR Schema.
226 -- This error is trapped and reported using the message name
227 -- 'HR_7220_INVALID_PRIMARY_KEY'.
228 -- 3) The row although existing in the HR Schema has a different object
229 -- version number than the object version number specified.
230 -- This error is trapped and reported using the message name
231 -- 'HR_7155_OBJECT_INVALID'.
232 --
233 -- Developer Implementation Notes:
234 -- For each primary key and the object version number arguments add a
235 -- call to hr_api.mandatory_arg_error procedure to ensure that these
236 -- argument values are not null.
237 --
238 -- Access Status:
239 -- Internal Development Use Only.
240 --
241 -- {End Of Comments}
242 -- ----------------------------------------------------------------------------
243 Procedure lck
244 (
245 p_checklist_item_id in number,
246 p_object_version_number in number
247 );
248 --
249 -- ----------------------------------------------------------------------------
250 -- |-----------------------------< convert_args >-----------------------------|
251 -- ----------------------------------------------------------------------------
252 -- {Start Of Comments}
253 --
254 -- Description:
255 -- This function is used to turn attribute parameters into the record
256 -- structure parameter g_rec_type.
257 --
258 -- Prerequisites:
259 -- This is a private function and can only be called from the ins or upd
260 -- attribute processes.
261 --
262 -- In Parameters:
263 --
264 -- Post Success:
265 -- A returning record structure will be returned.
266 --
267 -- Post Failure:
268 -- No direct error handling is required within this function. Any possible
269 -- errors within this function will be a PL/SQL value error due to conversion
270 -- of datatypes or data lengths.
271 --
272 -- Developer Implementation Notes:
273 -- None.
274 --
275 -- Access Status:
276 -- Internal Row Handler Use Only.
277 --
278 -- {End Of Comments}
279 -- ----------------------------------------------------------------------------
280 Function convert_args
281 (
282 p_checklist_item_id in number,
283 p_person_id in number,
284 p_item_code in varchar2,
285 p_date_due in date,
286 p_date_done in date,
287 p_status in varchar2,
288 p_notes in varchar2,
289 p_object_version_number in number,
290 p_attribute_category in varchar2,
291 p_attribute1 in varchar2,
292 p_attribute2 in varchar2,
293 p_attribute3 in varchar2,
294 p_attribute4 in varchar2,
295 p_attribute5 in varchar2,
296 p_attribute6 in varchar2,
297 p_attribute7 in varchar2,
298 p_attribute8 in varchar2,
299 p_attribute9 in varchar2,
300 p_attribute10 in varchar2,
301 p_attribute11 in varchar2,
302 p_attribute12 in varchar2,
303 p_attribute13 in varchar2,
304 p_attribute14 in varchar2,
305 p_attribute15 in varchar2,
306 p_attribute16 in varchar2,
307 p_attribute17 in varchar2,
308 p_attribute18 in varchar2,
309 p_attribute19 in varchar2,
310 p_attribute20 in varchar2,
311 p_attribute21 in varchar2,
312 p_attribute22 in varchar2,
313 p_attribute23 in varchar2,
314 p_attribute24 in varchar2,
315 p_attribute25 in varchar2,
316 p_attribute26 in varchar2,
317 p_attribute27 in varchar2,
318 p_attribute28 in varchar2,
319 p_attribute29 in varchar2,
320 p_attribute30 in varchar2
321 )
322 Return g_rec_type;
323 --
324 end per_chk_shd;