1 Package ame_gcf_shd as
2 /* $Header: amgcfrhi.pkh 120.0 2005/09/02 03:59 mbocutt noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Global Record Type Specification |
6 -- ----------------------------------------------------------------------------
7 --
8 Type g_rec_type Is Record
9 (application_id number
10 ,approval_group_id number
11 ,voting_regime varchar2(9) -- Increased length
12 ,order_number number(15)
13 ,start_date date
14 ,end_date date
15 ,object_version_number number(9)
16 );
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_APPROVAL_GROUP_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_approval_group_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 = :approval_group_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_approval_group_id in number
173 ,p_new_end_date in date
174 ,p_object_version_number out nocopy number
175 );
176 --
177 -- ----------------------------------------------------------------------------
178 -- |---------------------------------< lck >----------------------------------|
179 -- ----------------------------------------------------------------------------
180 -- {Start Of Comments}
181 --
182 -- Description:
183 -- The Lck process for datetrack is complicated and comprises of the
184 -- following processing
185 -- The processing steps are as follows:
186 -- 1) The row to be updated or deleted must be locked.
187 -- By locking this row, the g_old_rec record data type is populated.
188 -- 2) If a comment exists the text is selected from hr_comments.
189 -- 3) The datetrack mode is then validated to ensure the operation is
190 -- valid. If the mode is valid the validation start and end dates for
191 -- the mode will be derived and returned. Any required locking is
192 -- completed when the datetrack mode is validated.
193 --
194 -- Prerequisites:
195 -- When attempting to call the lck procedure the object version number,
196 -- primary key, effective date and datetrack mode must be specified.
197 --
198 -- In Parameters:
199 -- p_effective_date
200 -- Specifies the date of the datetrack update operation.
201 -- p_datetrack_mode
202 -- Determines the datetrack update or delete mode.
203 --
204 -- Post Success:
205 -- On successful completion of the Lck process the row to be updated or
206 -- deleted will be locked and selected into the global data structure
207 -- g_old_rec.
208 --
209 -- Post Failure:
210 -- The Lck process can fail for three reasons:
211 -- 1) When attempting to lock the row the row could already be locked by
212 -- another user. This will raise the HR_Api.Object_Locked exception.
213 -- 2) The row which is required to be locked doesn't exist in the HR Schema.
214 -- This error is trapped and reported using the message name
215 -- 'HR_7220_INVALID_PRIMARY_KEY'.
216 -- 3) The row although existing in the HR Schema has a different object
217 -- version number than the object version number specified.
218 -- This error is trapped and reported using the message name
219 -- 'HR_7155_OBJECT_INVALID'.
220 --
221 -- Developer Implementation Notes:
222 -- None.
223 --
224 -- Access Status:
225 -- Internal Development Use Only.
226 --
227 -- {End Of Comments}
228 -- ----------------------------------------------------------------------------
229 Procedure lck
230 (p_effective_date in date
231 ,p_datetrack_mode in varchar2
232 ,p_application_id in number
233 ,p_approval_group_id in number
234 ,p_object_version_number in number
235 ,p_validation_start_date out nocopy date
236 ,p_validation_end_date out nocopy date
237 );
238 --
239 -- ----------------------------------------------------------------------------
240 -- |-----------------------------< convert_args >-----------------------------|
241 -- ----------------------------------------------------------------------------
242 -- {Start Of Comments}
243 --
244 -- Description:
245 -- This function is used to turn attribute parameters into the record
246 -- structure parameter g_rec_type.
247 --
248 -- Prerequisites:
249 -- This is a private function and can only be called from the ins or upd
250 -- attribute processes.
251 --
252 -- In Parameters:
253 --
254 -- Post Success:
255 -- A returning record structure will be returned.
256 --
257 -- Post Failure:
258 -- No direct error handling is required within this function. Any possible
259 -- errors within this function will be a PL/SQL value error due to
260 -- conversion of datatypes or data lengths.
261 --
262 -- Developer Implementation Notes:
263 -- None.
264 --
265 -- Access Status:
266 -- Internal Row Handler Use Only.
267 --
268 -- {End Of Comments}
269 -- ----------------------------------------------------------------------------
270 Function convert_args
271 (p_application_id in number
272 ,p_approval_group_id in number
273 ,p_voting_regime in varchar2
274 ,p_order_number in number
275 ,p_start_date in date
276 ,p_end_date in date
277 ,p_object_version_number in number
278 )
279 Return g_rec_type;
280 --
281 -- ----------------------------------------------------------------------------
282 -- |-----------------------------< get_object_version_number >----------------|
283 -- ----------------------------------------------------------------------------
284 -- {Start Of Comments}
285 --
286 -- Description:
287 -- This function is used to get the next object version number to be used
288 -- within datetrack for an insert or update dml operation. The returned
289 -- object version number will be determined by taking the maximum
290 -- object version number for the datetracked rows and then incrementing by 1.
291 --
292 --
293 -- Prerequisites:
294 -- This is a private function and can only be called from the ins or upd
295 -- attribute processes.
296 --
297 -- In Parameters:
298 --
299 --
300 -- Post Success:
301 --
302 --
303 -- Post Failure:
304 --
305 --
306 --
307 --
308 -- Developer Implementation Notes:
309 -- None.
310 --
311 -- Access Status:
312 -- Internal Row Handler Use Only.
313 --
314 -- {End Of Comments}
315 -- ----------------------------------------------------------------------------
316 Function get_object_version_number
317 (p_application_id in number
318 ,p_approval_group_id in number
319 )
320 Return number;
321 --
322 --
323 end ame_gcf_shd;