1 Package ame_apt_shd AUTHID CURRENT_USER as
2 /* $Header: amaptrhi.pkh 120.1 2006/04/21 08:43 avarri noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Global Record Type Specification |
6 -- ----------------------------------------------------------------------------
7 --
8 Type g_rec_type Is Record
9 (approver_type_id number(15)
10 ,orig_system varchar2(48)
11 ,query_variable_1_label varchar2(50)
12 ,query_variable_2_label varchar2(50)
13 ,query_variable_3_label varchar2(50)
14 ,query_variable_4_label varchar2(50)
15 ,query_variable_5_label varchar2(50)
16 ,variable_1_lov_query varchar2(4000)
17 ,variable_2_lov_query varchar2(4000)
18 ,variable_3_lov_query varchar2(4000)
19 ,variable_4_lov_query varchar2(4000)
20 ,variable_5_lov_query varchar2(4000)
21 ,query_procedure varchar2(100)
22 ,start_date date
23 ,end_date date
24 ,object_version_number number(9)
25 );
26 --
27 -- ----------------------------------------------------------------------------
28 -- | Global Definitions - Internal Development Use Only |
29 -- ----------------------------------------------------------------------------
30 --
31 g_old_rec g_rec_type; -- Global record definition
32 -- Global table name
33 g_tab_nam constant varchar2(30) := 'AME_APPROVER_TYPES';
34 --
35 -- ----------------------------------------------------------------------------
36 -- |---------------------------< constraint_error >---------------------------|
37 -- ----------------------------------------------------------------------------
38 -- {Start Of Comments}
39 --
40 -- Description:
41 -- This procedure is called when a constraint has been violated (i.e.
42 -- The exception hr_api.check_integrity_violated,
43 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
44 -- hr_api.unique_integrity_violated has been raised).
45 -- The exceptions can only be raised as follows:
46 -- 1) A check constraint can only be violated during an INSERT or UPDATE
47 -- dml operation.
48 -- 2) A parent integrity constraint can only be violated during an
49 -- INSERT or UPDATE dml operation.
50 -- 3) A child integrity constraint can only be violated during an
51 -- DELETE dml operation.
52 -- 4) A unique integrity constraint can only be violated during INSERT or
53 -- UPDATE dml operation.
54 --
55 -- Prerequisites:
56 -- 1) Either hr_api.check_integrity_violated,
57 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
58 -- hr_api.unique_integrity_violated has been raised with the subsequent
59 -- stripping of the constraint name from the generated error message
60 -- text.
61 -- 2) Standalone validation test which corresponds with a constraint error.
62 --
63 -- In Parameter:
64 -- p_constraint_name is in upper format and is just the constraint name
65 -- (e.g. not prefixed by brackets, schema owner etc).
66 --
67 -- Post Success:
68 -- Development dependant.
69 --
70 -- Post Failure:
71 -- Developement dependant.
72 --
73 -- Developer Implementation Notes:
74 -- For each constraint being checked the hr system package failure message
75 -- has been generated as a template only. These system error messages should
76 -- be modified as required (i.e. change the system failure message to a user
77 -- friendly defined error message).
78 --
79 -- Access Status:
80 -- Internal Development Use Only.
81 --
82 -- {End Of Comments}
83 -- ----------------------------------------------------------------------------
84 Procedure constraint_error
85 (p_constraint_name in all_constraints.constraint_name%TYPE);
86 --
87 -- ----------------------------------------------------------------------------
88 -- |-----------------------------< api_updating >-----------------------------|
89 -- ----------------------------------------------------------------------------
90 -- {Start Of Comments}
91 --
92 -- Description:
93 -- This function is used to populate the g_old_rec record with the
94 -- current row from the database for the specified primary key
95 -- provided that the primary key exists and is valid and does not
96 -- already match the current g_old_rec. The function will always return
97 -- a TRUE value if the g_old_rec is populated with the current row.
98 -- A FALSE value will be returned if all of the primary key arguments
99 -- are null.
100 --
101 -- Prerequisites:
102 -- None.
103 --
104 -- In Parameters:
105 --
106 -- Post Success:
107 -- A value of TRUE will be returned indiciating that the g_old_rec
108 -- is current.
109 -- A value of FALSE will be returned if all of the primary key arguments
110 -- have a null value (this indicates that the row has not be inserted into
111 -- the Schema), and therefore could never have a corresponding row.
112 --
113 -- Post Failure:
114 -- A failure can only occur under two circumstances:
115 -- 1) The primary key is invalid (i.e. a row does not exist for the
116 -- specified primary key values).
117 -- 2) If an object_version_number exists but is NOT the same as the current
118 -- g_old_rec value.
119 --
120 -- Developer Implementation Notes:
121 -- None.
122 --
123 -- Access Status:
124 -- Internal Development Use Only.
125 --
126 -- {End Of Comments}
127 -- ----------------------------------------------------------------------------
128 Function api_updating
129 (p_effective_date in date
130 ,p_approver_type_id in number
131 ,p_object_version_number in number
132 ) Return Boolean;
133 --
134 -- ----------------------------------------------------------------------------
135 -- |-----------------------< upd_effective_end_date >-------------------------|
136 -- ----------------------------------------------------------------------------
137 -- {Start Of Comments}
138 --
139 -- Description:
140 -- This procedure will update the specified datetrack row with the
141 -- specified new effective end date. The object version number is also
142 -- set to the next object version number. DateTrack modes which call
143 -- this procedure are: UPDATE, UPDATE_CHANGE_INSERT,
144 -- UPDATE_OVERRIDE, DELETE, FUTURE_CHANGE and DELETE_NEXT_CHANGE.
145 -- This is an internal datetrack maintenance procedure which should
146 -- not be modified in anyway.
147 --
148 -- Prerequisites:
149 -- None.
150 --
151 -- In Parameters:
152 -- p_new_effective_end_date
153 -- Specifies the new effective end date which will be set for the
154 -- row as of the effective date.
155 -- p_base_key_value
156 -- Specifies the primary key value for this datetrack entity.
157 -- (E.g. For this entity the assignment of the argument would be:
158 -- p_base_key_value = :approver_type_id).
159 --
160 -- Post Success:
161 -- The specified row will be updated with the new effective end date and
162 -- object_version_number.
163 --
164 -- Post Failure:
165 -- Failure might occur if for the specified effective date and primary key
166 -- value a row doesn't exist.
167 --
168 -- Developer Implementation Notes:
169 -- This is an internal datetrack maintenance procedure which should
170 -- not be modified in anyway.
171 --
172 -- Access Status:
173 -- Internal Row Handler Use Only.
174 --
175 -- {End Of Comments}
176 -- ----------------------------------------------------------------------------
177 Procedure upd_effective_end_date
178 (p_effective_date in date
179 ,p_approver_type_id in number
180 ,p_new_effective_end_date in date
181 ,p_validation_start_date in date
182 ,p_validation_end_date in date
183 ,p_object_version_number out nocopy number
184 );
185 --
186 -- ----------------------------------------------------------------------------
187 -- |---------------------------------< lck >----------------------------------|
188 -- ----------------------------------------------------------------------------
189 -- {Start Of Comments}
190 --
191 -- Description:
192 -- The Lck process for datetrack is complicated and comprises of the
193 -- following processing
194 -- The processing steps are as follows:
195 -- 1) The row to be updated or deleted must be locked.
196 -- By locking this row, the g_old_rec record data type is populated.
197 -- 2) If a comment exists the text is selected from hr_comments.
198 -- 3) The datetrack mode is then validated to ensure the operation is
199 -- valid. If the mode is valid the validation start and end dates for
200 -- the mode will be derived and returned. Any required locking is
201 -- completed when the datetrack mode is validated.
202 --
203 -- Prerequisites:
204 -- When attempting to call the lck procedure the object version number,
205 -- primary key, effective date and datetrack mode must be specified.
206 --
207 -- In Parameters:
208 -- p_effective_date
209 -- Specifies the date of the datetrack update operation.
210 -- p_datetrack_mode
211 -- Determines the datetrack update or delete mode.
212 --
213 -- Post Success:
214 -- On successful completion of the Lck process the row to be updated or
215 -- deleted will be locked and selected into the global data structure
216 -- g_old_rec.
217 --
218 -- Post Failure:
219 -- The Lck process can fail for three reasons:
220 -- 1) When attempting to lock the row the row could already be locked by
221 -- another user. This will raise the HR_Api.Object_Locked exception.
222 -- 2) The row which is required to be locked doesn't exist in the HR Schema.
223 -- This error is trapped and reported using the message name
224 -- 'HR_7220_INVALID_PRIMARY_KEY'.
225 -- 3) The row although existing in the HR Schema has a different object
226 -- version number than the object version number specified.
227 -- This error is trapped and reported using the message name
228 -- 'HR_7155_OBJECT_INVALID'.
229 --
230 -- Developer Implementation Notes:
231 -- None.
232 --
233 -- Access Status:
234 -- Internal Development Use Only.
235 --
236 -- {End Of Comments}
237 -- ----------------------------------------------------------------------------
238 Procedure lck
239 (p_effective_date in date
240 ,p_datetrack_mode in varchar2
241 ,p_approver_type_id in number
242 ,p_orig_system in varchar2
243 ,p_object_version_number in number
244 ,p_validation_start_date out nocopy date
245 ,p_validation_end_date out nocopy date
246 );
247 --
248 -- ----------------------------------------------------------------------------
249 -- |-----------------------------< convert_args >-----------------------------|
250 -- ----------------------------------------------------------------------------
251 -- {Start Of Comments}
252 --
253 -- Description:
254 -- This function is used to turn attribute parameters into the record
255 -- structure parameter g_rec_type.
256 --
257 -- Prerequisites:
258 -- This is a private function and can only be called from the ins or upd
259 -- attribute processes.
260 --
261 -- In Parameters:
262 --
263 -- Post Success:
264 -- A returning record structure will be returned.
265 --
266 -- Post Failure:
267 -- No direct error handling is required within this function. Any possible
268 -- errors within this function will be a PL/SQL value error due to
269 -- conversion of datatypes or data lengths.
270 --
271 -- Developer Implementation Notes:
272 -- None.
273 --
274 -- Access Status:
275 -- Internal Row Handler Use Only.
276 --
277 -- {End Of Comments}
278 -- ----------------------------------------------------------------------------
279 Function convert_args
280 (p_approver_type_id in number
281 ,p_orig_system in varchar2
282 ,p_query_variable_1_label in varchar2
283 ,p_query_variable_2_label in varchar2
284 ,p_query_variable_3_label in varchar2
285 ,p_query_variable_4_label in varchar2
286 ,p_query_variable_5_label in varchar2
287 ,p_variable_1_lov_query in varchar2
288 ,p_variable_2_lov_query in varchar2
289 ,p_variable_3_lov_query in varchar2
290 ,p_variable_4_lov_query in varchar2
291 ,p_variable_5_lov_query in varchar2
292 ,p_query_procedure in varchar2
293 ,p_start_date in date
294 ,p_end_date in date
295 ,p_object_version_number in number
296 )
297 Return g_rec_type;
298 --
299 -- ----------------------------------------------------------------------------
300 -- |-----------------------------< get_object_version_number >----------------|
301 -- ----------------------------------------------------------------------------
302 -- {Start Of Comments}
303 --
304 -- Description:
305 -- This function is used to get the next object version number to be used
306 -- within datetrack for an insert or update dml operation. The returned
307 -- object version number will be determined by taking the maximum
308 -- object version number for the datetracked rows and then incrementing by 1.
309 --
310 --
311 -- Prerequisites:
312 -- This is a private function and can only be called from the ins or upd
313 -- attribute processes.
314 --
315 -- In Parameters:
316 --
317 --
318 -- Post Success:
319 --
320 --
321 -- Post Failure:
322 --
323 --
324 --
325 --
326 -- Developer Implementation Notes:
327 -- None.
328 --
329 -- Access Status:
330 -- Internal Row Handler Use Only.
331 --
332 -- {End Of Comments}
333 -- ----------------------------------------------------------------------------
334 Function get_object_version_number
335 (p_approver_type_id in number
336 )
337 Return number;
338 --
339 /*
340 -- ----------------------------------------------------------------------------
341 -- |-----------------------------< child_rows_exist >-------------------------|
342 -- ----------------------------------------------------------------------------
343 Procedure child_rows_exist
344 (p_approver_type_id in number
345 ,p_orig_system in varchar2
346 ,p_start_date in date
347 ,p_end_date in date
348 );
349 --
350 */
351 end ame_apt_shd;