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