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