DBA Data[Home] [Help]

PACKAGE: APPS.AME_ACU_SHD

Source


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