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