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