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