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