1 Package ame_con_shd AUTHID CURRENT_USER as
2 /* $Header: amconrhi.pkh 120.0 2005/09/02 03:56 mbocutt noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Global Record Type Specification |
6 -- ----------------------------------------------------------------------------
7 --
8 Type g_rec_type Is Record
9 (condition_id number
10 ,condition_type varchar2(9) -- Increased length
11 ,attribute_id number
12 ,parameter_one varchar2(50)
13 ,parameter_two varchar2(320)
14 ,parameter_three varchar2(50)
15 ,include_lower_limit varchar2(9) -- Increased length
16 ,include_upper_limit varchar2(9) -- Increased length
17 ,start_date date
18 ,end_date date
19 ,security_group_id number(15)
20 ,condition_key varchar2(100)
21 ,object_version_number number(9)
22 );
23 --
24 -- ----------------------------------------------------------------------------
25 -- | Global Definitions - Internal Development Use Only |
26 -- ----------------------------------------------------------------------------
27 --
28 g_old_rec g_rec_type; -- Global record definition
29 -- Global table name
30 g_tab_nam constant varchar2(30) := 'AME_CONDITIONS';
31 --
32 -- ----------------------------------------------------------------------------
33 -- |---------------------------< constraint_error >---------------------------|
34 -- ----------------------------------------------------------------------------
35 -- {Start Of Comments}
36 --
37 -- Description:
38 -- This procedure is called when a constraint has been violated (i.e.
39 -- The exception hr_api.check_integrity_violated,
40 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
41 -- hr_api.unique_integrity_violated has been raised).
42 -- The exceptions can only be raised as follows:
43 -- 1) A check constraint can only be violated during an INSERT or UPDATE
44 -- dml operation.
45 -- 2) A parent integrity constraint can only be violated during an
46 -- INSERT or UPDATE dml operation.
47 -- 3) A child integrity constraint can only be violated during an
48 -- DELETE dml operation.
49 -- 4) A unique integrity constraint can only be violated during INSERT or
50 -- UPDATE dml operation.
51 --
52 -- Prerequisites:
53 -- 1) Either hr_api.check_integrity_violated,
54 -- hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
55 -- hr_api.unique_integrity_violated has been raised with the subsequent
56 -- stripping of the constraint name from the generated error message
57 -- text.
58 -- 2) Standalone validation test which corresponds with a constraint error.
59 --
60 -- In Parameter:
61 -- p_constraint_name is in upper format and is just the constraint name
62 -- (e.g. not prefixed by brackets, schema owner etc).
63 --
64 -- Post Success:
65 -- Development dependant.
66 --
67 -- Post Failure:
68 -- Developement dependant.
69 --
70 -- Developer Implementation Notes:
71 -- For each constraint being checked the hr system package failure message
72 -- has been generated as a template only. These system error messages should
73 -- be modified as required (i.e. change the system failure message to a user
74 -- friendly defined error message).
75 --
76 -- Access Status:
77 -- Internal Development Use Only.
78 --
79 -- {End Of Comments}
80 -- ----------------------------------------------------------------------------
81 Procedure constraint_error
82 (p_constraint_name in all_constraints.constraint_name%TYPE);
83 --
84 -- ----------------------------------------------------------------------------
85 -- |-----------------------------< api_updating >-----------------------------|
86 -- ----------------------------------------------------------------------------
87 -- {Start Of Comments}
88 --
89 -- Description:
90 -- This function is used to populate the g_old_rec record with the
91 -- current row from the database for the specified primary key
92 -- provided that the primary key exists and is valid and does not
93 -- already match the current g_old_rec. The function will always return
94 -- a TRUE value if the g_old_rec is populated with the current row.
95 -- A FALSE value will be returned if all of the primary key arguments
96 -- are null.
97 --
98 -- Prerequisites:
99 -- None.
100 --
101 -- In Parameters:
102 --
103 -- Post Success:
104 -- A value of TRUE will be returned indiciating that the g_old_rec
105 -- is current.
106 -- A value of FALSE will be returned if all of the primary key arguments
107 -- have a null value (this indicates that the row has not be inserted into
108 -- the Schema), and therefore could never have a corresponding row.
109 --
110 -- Post Failure:
111 -- A failure can only occur under two circumstances:
112 -- 1) The primary key is invalid (i.e. a row does not exist for the
113 -- specified primary key values).
114 -- 2) If an object_version_number exists but is NOT the same as the current
115 -- g_old_rec value.
116 --
117 -- Developer Implementation Notes:
118 -- None.
119 --
120 -- Access Status:
121 -- Internal Development Use Only.
122 --
123 -- {End Of Comments}
124 -- ----------------------------------------------------------------------------
125 Function api_updating
126 (p_effective_date in date
127 ,p_condition_id in number
128 ,p_object_version_number in number
129 ) Return Boolean;
130 --
131 -- ----------------------------------------------------------------------------
132 -- |----------------------------< upd_end_date >------------------------------|
133 -- ----------------------------------------------------------------------------
134 -- {Start Of Comments}
135 --
136 -- Description:
137 -- This procedure will update the specified datetrack row with the
138 -- specified new effective end date. The object version number is also
139 -- set to the next object version number. DateTrack modes which call
140 -- this procedure are: UPDATE, UPDATE_CHANGE_INSERT,
141 -- UPDATE_OVERRIDE, DELETE, FUTURE_CHANGE and DELETE_NEXT_CHANGE.
142 -- This is an internal datetrack maintenance procedure which should
143 -- not be modified in anyway.
144 --
145 -- Prerequisites:
146 -- None.
147 --
148 -- In Parameters:
149 -- p_new_effective_end_date
150 -- Specifies the new effective end date which will be set for the
151 -- row as of the effective date.
152 -- p_base_key_value
153 -- Specifies the primary key value for this datetrack entity.
154 -- (E.g. For this entity the assignment of the argument would be:
155 -- p_base_key_value = :condition_id).
156 --
157 -- Post Success:
158 -- The specified row will be updated with the new effective end date and
159 -- object_version_number.
160 --
161 -- Post Failure:
162 -- Failure might occur if for the specified effective date and primary key
163 -- value a row doesn't exist.
164 --
165 -- Developer Implementation Notes:
166 -- This is an internal datetrack maintenance procedure which should
167 -- not be modified in anyway.
168 --
169 -- Access Status:
170 -- Internal Row Handler Use Only.
171 --
172 -- {End Of Comments}
173 -- ----------------------------------------------------------------------------
174 Procedure upd_end_date
175 (p_effective_date in date
176 ,p_condition_id in number
177 ,p_new_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.
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'.
220 -- 3) The row although existing in the HR Schema has a different object
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_condition_id in number
237 ,p_object_version_number in number
238 ,p_validation_start_date out nocopy date
239 ,p_validation_end_date out nocopy date
240 );
241 --
242 -- ----------------------------------------------------------------------------
243 -- |-----------------------------< convert_args >-----------------------------|
244 -- ----------------------------------------------------------------------------
245 -- {Start Of Comments}
246 --
247 -- Description:
248 -- This function is used to turn attribute parameters into the record
249 -- structure parameter g_rec_type.
250 --
251 -- Prerequisites:
252 -- This is a private function and can only be called from the ins or upd
253 -- attribute processes.
254 --
255 -- In Parameters:
256 --
257 -- Post Success:
258 -- A returning record structure will be returned.
259 --
260 -- Post Failure:
261 -- No direct error handling is required within this function. Any possible
262 -- errors within this function will be a PL/SQL value error due to
263 -- conversion of datatypes or data lengths.
264 --
265 -- Developer Implementation Notes:
266 -- None.
267 --
268 -- Access Status:
269 -- Internal Row Handler Use Only.
270 --
271 -- {End Of Comments}
272 -- ----------------------------------------------------------------------------
273 Function convert_args
274 (p_condition_id in number
275 ,p_condition_type in varchar2
276 ,p_attribute_id in number
277 ,p_parameter_one in varchar2
278 ,p_parameter_two in varchar2
279 ,p_parameter_three in varchar2
280 ,p_include_lower_limit in varchar2
281 ,p_include_upper_limit in varchar2
282 ,p_start_date in date
283 ,p_end_date in date
284 ,p_security_group_id in number
285 ,p_condition_key in varchar2
286 ,p_object_version_number in number
287 )
288 Return g_rec_type;
289 --
290 -- ----------------------------------------------------------------------------
291 -- |-----------------------------< get_object_version_number >----------------|
292 -- ----------------------------------------------------------------------------
293 -- {Start Of Comments}
294 --
295 -- Description:
296 -- This function is used to get the next object version number to be used
297 -- within datetrack for an insert or update dml operation. The returned
298 -- object version number will be determined by taking the maximum
299 -- object version number for the datetracked rows and then incrementing by 1.
300 --
301 --
302 -- Prerequisites:
303 -- This is a private function and can only be called from the ins or upd
304 -- attribute processes.
305 --
306 -- In Parameters:
307 --
308 --
309 -- Post Success:
310 --
311 --
312 -- Post Failure:
313 --
314 --
315 --
316 --
317 -- Developer Implementation Notes:
318 -- None.
319 --
320 -- Access Status:
321 -- Internal Row Handler Use Only.
322 --
323 -- {End Of Comments}
324 -- ----------------------------------------------------------------------------
325 Function get_object_version_number
326 (p_condition_id in number
327 )
328 Return number;
329 --
330 --
331 end ame_con_shd;