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