1 Package pay_bth_shd as
2 /* $Header: pybthrhi.pkh 120.0 2005/05/29 03:23:29 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Global Record Type Specification |
6 -- ----------------------------------------------------------------------------
7 --
8 Type g_rec_type Is Record
9 (batch_id number(15)
10 ,business_group_id number(15)
11 ,batch_name varchar2(30)
12 ,batch_status varchar2(30)
13 ,action_if_exists varchar2(30)
14 ,batch_reference varchar2(30)
15 ,batch_source varchar2(150)
16 ,batch_type varchar2(30)
17 ,comments varchar2(2000) -- pseudo column
18 ,date_effective_changes varchar2(30)
19 ,purge_after_transfer varchar2(30)
20 ,reject_if_future_changes varchar2(30)
21 ,reject_if_results_exists varchar2(30)
22 ,purge_after_rollback varchar2(30)
23 ,REJECT_ENTRY_NOT_REMOVED varchar2(30)
24 ,ROLLBACK_ENTRY_UPDATES varchar2(30)
25 ,object_version_number number(9)
26 );
27 --
28 -- ----------------------------------------------------------------------------
29 -- | Global Definitions - Internal Development Use Only |
30 -- ----------------------------------------------------------------------------
31 --
32 g_old_rec g_rec_type; -- Global record definition
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_batch_id in number
168 ,p_object_version_number in number
169 ) Return Boolean;
170 --
171 -- ----------------------------------------------------------------------------
172 -- |---------------------------------< lck >----------------------------------|
173 -- ----------------------------------------------------------------------------
174 -- {Start of comments}
175 --
176 -- Description:
177 -- The Lck process has two main functions to perform. Firstly, the row to be
178 -- updated or deleted must be locked. The locking of the row will only be
179 -- successful if the row is not currently locked by another user.
180 -- Secondly, during the locking of the row, the row is selected into
181 -- the g_old_rec data structure which enables the current row values from the
182 -- server to be available to the api.
183 --
184 -- Prerequisites:
185 -- When attempting to call the lock the object version number (if defined)
186 -- is mandatory.
187 --
188 -- In Parameters:
189 -- The arguments to the Lck process are the primary key(s) which uniquely
190 -- identify the row and the object version number of row.
191 --
192 -- Post Success:
193 -- On successful completion of the Lck process the row to be updated or
194 -- deleted will be locked and selected into the global data structure
195 -- g_old_rec.
196 --
197 -- Post Failure:
198 -- The Lck process can fail for three reasons:
199 -- 1) When attempting to lock the row the row could already be locked by
200 -- another user. This will raise the HR_Api.Object_Locked exception.
201 -- 2) The row which is required to be locked doesn't exist in the HR Schema.
202 -- This error is trapped and reported using the message name
203 -- 'HR_7220_INVALID_PRIMARY_KEY'.
204 -- 3) The row although existing in the HR Schema has a different object
205 -- version number than the object version number specified.
206 -- This error is trapped and reported using the message name
207 -- 'HR_7155_OBJECT_INVALID'.
208 --
209 -- Developer Implementation Notes:
210 -- For each primary key and the object version number arguments add a
211 -- call to hr_api.mandatory_arg_error procedure to ensure that these
212 -- argument values are not null.
213 --
214 -- Access Status:
215 -- Internal Development Use Only.
216 --
217 -- {End of comments}
218 -- ----------------------------------------------------------------------------
219 Procedure lck
220 (p_batch_id in number
221 ,p_object_version_number in number
222 );
223 --
224 -- ----------------------------------------------------------------------------
225 -- |-----------------------------< convert_args >-----------------------------|
226 -- ----------------------------------------------------------------------------
227 -- {Start Of Comments}
228 --
229 -- Description:
230 -- This function is used to turn attribute parameters into the record
231 -- structure parameter g_rec_type.
232 --
233 -- Prerequisites:
234 -- This is a private function and can only be called from the ins or upd
235 -- attribute processes.
236 --
237 -- In Parameters:
238 --
239 -- Post Success:
240 -- A returning record structure will be returned.
241 --
242 -- Post Failure:
243 -- No direct error handling is required within this function. Any possible
244 -- errors within this function will be a PL/SQL value error due to conversion
245 -- of datatypes or data lengths.
246 --
247 -- Developer Implementation Notes:
248 -- None.
249 --
250 -- Access Status:
251 -- Internal Row Handler Use Only.
252 --
253 -- {End Of Comments}
254 -- ----------------------------------------------------------------------------
255 Function convert_args
256 (p_batch_id in number
257 ,p_business_group_id in number
258 ,p_batch_name in varchar2
259 ,p_batch_status in varchar2
260 ,p_action_if_exists in varchar2
261 ,p_batch_reference in varchar2
262 ,p_batch_source in varchar2
263 ,p_batch_type in varchar2
264 ,p_comments in varchar2
265 ,p_date_effective_changes in varchar2
266 ,p_purge_after_transfer in varchar2
267 ,p_reject_if_future_changes in varchar2
268 ,p_reject_if_results_exists in varchar2
269 ,p_purge_after_rollback in varchar2
270 ,p_REJECT_ENTRY_NOT_REMOVED in varchar2
271 ,p_ROLLBACK_ENTRY_UPDATES in varchar2
272 ,p_object_version_number in number
273 )
274 Return g_rec_type;
275 --
276 end pay_bth_shd;