DBA Data[Home] [Help]

PACKAGE: APPS.AME_RUL_SHD

Source


1 Package ame_rul_shd as
2 /* $Header: amrulrhi.pkh 120.0 2005/09/02 04:03 mbocutt noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                    Global Record Type Specification                      |
6 -- ----------------------------------------------------------------------------
7 --
8 Type g_rec_type Is Record
9   (rule_id                         number
10   ,rule_type                       number
11   ,action_id                       number
12   ,start_date                      date
13   ,end_date                        date
14   ,description                     varchar2(100)
15   ,security_group_id               number(15)
16   ,rule_key                        varchar2(100)
17   ,item_class_id                   number(15)
18   ,object_version_number           number(9)
19   );
20 --
21 -- ----------------------------------------------------------------------------
22 -- |           Global Definitions - Internal Development Use Only             |
23 -- ----------------------------------------------------------------------------
24 --
25 g_old_rec  g_rec_type;                            -- Global record definition
26 -- Global table name
27 g_tab_nam  constant varchar2(30) := 'AME_RULES';
28 --
29 -- ----------------------------------------------------------------------------
30 -- |---------------------------< constraint_error >---------------------------|
31 -- ----------------------------------------------------------------------------
32 -- {Start Of Comments}
33 --
34 -- Description:
35 --   This procedure is called when a constraint has been violated (i.e.
36 --   The exception hr_api.check_integrity_violated,
37 --   hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
38 --   hr_api.unique_integrity_violated has been raised).
39 --   The exceptions can only be raised as follows:
40 --   1) A check constraint can only be violated during an INSERT or UPDATE
41 --      dml operation.
42 --   2) A parent integrity constraint can only be violated during an
43 --      INSERT or UPDATE dml operation.
44 --   3) A child integrity constraint can only be violated during an
45 --      DELETE dml operation.
46 --   4) A unique integrity constraint can only be violated during INSERT or
47 --      UPDATE dml operation.
48 --
49 -- Prerequisites:
50 --   1) Either hr_api.check_integrity_violated,
51 --      hr_api.parent_integrity_violated, hr_api.child_integrity_violated or
52 --      hr_api.unique_integrity_violated has been raised with the subsequent
53 --      stripping of the constraint name from the generated error message
54 --      text.
55 --   2) Standalone validation test which corresponds with a constraint error.
56 --
57 -- In Parameter:
58 --   p_constraint_name is in upper format and is just the constraint name
59 --   (e.g. not prefixed by brackets, schema owner etc).
60 --
61 -- Post Success:
62 --   Development dependant.
63 --
64 -- Post Failure:
65 --   Developement dependant.
66 --
67 -- Developer Implementation Notes:
68 --   For each constraint being checked the hr system package failure message
69 --   has been generated as a template only. These system error messages should
70 --   be modified as required (i.e. change the system failure message to a user
71 --   friendly defined error message).
72 --
73 -- Access Status:
74 --   Internal Development Use Only.
75 --
76 -- {End Of Comments}
77 -- ----------------------------------------------------------------------------
78 Procedure constraint_error
79   (p_constraint_name in all_constraints.constraint_name%TYPE);
80 --
81 -- ----------------------------------------------------------------------------
82 -- |-----------------------------< api_updating >-----------------------------|
83 -- ----------------------------------------------------------------------------
84 --  {Start Of Comments}
85 --
86 -- Description:
87 --   This function is used to populate the g_old_rec record with the
88 --   current row from the database for the specified primary key
89 --   provided that the primary key exists and is valid and does not
90 --   already match the current g_old_rec. The function will always return
91 --   a TRUE value if the g_old_rec is populated with the current row.
92 --   A FALSE value will be returned if all of the primary key arguments
93 --   are null.
94 --
95 -- Prerequisites:
96 --   None.
97 --
98 -- In Parameters:
99 --
100 -- Post Success:
101 --   A value of TRUE will be returned indiciating that the g_old_rec
102 --   is current.
103 --   A value of FALSE will be returned if all of the primary key arguments
104 --   have a null value (this indicates that the row has not be inserted into
105 --   the Schema), and therefore could never have a corresponding row.
106 --
107 -- Post Failure:
108 --   A failure can only occur under two circumstances:
109 --   1) The primary key is invalid (i.e. a row does not exist for the
110 --      specified primary key values).
111 --   2) If an object_version_number exists but is NOT the same as the current
112 --      g_old_rec value.
113 --
114 -- Developer Implementation Notes:
115 --   None.
116 --
117 -- Access Status:
118 --   Internal Development Use Only.
119 --
120 -- {End Of Comments}
121 -- ----------------------------------------------------------------------------
122 Function api_updating
123   (p_effective_date                   in date
124   ,p_rule_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_effective_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:
155 --   The specified row will be updated with the new effective end date and
152 --           p_base_key_value = :rule_id).
153 --
154 -- Post Success:
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_rule_id                          in number
174   ,p_new_end_date           in date
175   ,p_object_version_number            out nocopy number
176   );
177 --
178 -- ----------------------------------------------------------------------------
179 -- |---------------------------------< lck >----------------------------------|
180 -- ----------------------------------------------------------------------------
181 -- {Start Of Comments}
182 --
183 -- Description:
184 --   The Lck process for datetrack is complicated and comprises of the
185 --   following processing
186 --   The processing steps are as follows:
187 --   1) The row to be updated or deleted must be locked.
188 --      By locking this row, the g_old_rec record data type is populated.
189 --   2) If a comment exists the text is selected from hr_comments.
190 --   3) The datetrack mode is then validated to ensure the operation is
191 --      valid. If the mode is valid the validation start and end dates for
192 --      the mode will be derived and returned. Any required locking is
193 --      completed when the datetrack mode is validated.
194 --
195 -- Prerequisites:
196 --   When attempting to call the lck procedure the object version number,
197 --   primary key, effective date and datetrack mode must be specified.
198 --
199 -- In Parameters:
200 --   p_effective_date
201 --     Specifies the date of the datetrack update operation.
202 --   p_datetrack_mode
203 --     Determines the datetrack update or delete mode.
204 --
205 -- Post Success:
206 --   On successful completion of the Lck process the row to be updated or
207 --   deleted will be locked and selected into the global data structure
208 --   g_old_rec.
209 --
210 -- Post Failure:
211 --   The Lck process can fail for three reasons:
212 --   1) When attempting to lock the row the row could already be locked by
213 --      another user. This will raise the HR_Api.Object_Locked exception.
214 --   2) The row which is required to be locked doesn't exist in the HR Schema.
215 --      This error is trapped and reported using the message name
216 --      'HR_7220_INVALID_PRIMARY_KEY'.
217 --   3) The row although existing in the HR Schema has a different object
218 --      version number than the object version number specified.
219 --      This error is trapped and reported using the message name
220 --      'HR_7155_OBJECT_INVALID'.
221 --
222 -- Developer Implementation Notes:
223 --   None.
224 --
225 -- Access Status:
226 --   Internal Development Use Only.
227 --
228 -- {End Of Comments}
229 -- ----------------------------------------------------------------------------
230 Procedure lck
231   (p_effective_date                   in date
232   ,p_datetrack_mode                   in varchar2
233   ,p_rule_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_rule_id                        in number
272   ,p_rule_type                      in number
273   ,p_action_id                      in number
274   ,p_start_date                     in date
275   ,p_end_date                       in date
276   ,p_description                    in varchar2
277   ,p_security_group_id              in number
278   ,p_rule_key                       in varchar2
279   ,p_item_class_id                  in number
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_rule_id  in  number
321   )
322   Return number;
323 --
324 -- ----------------------------------------------------------------------------
325 -- |-----------------------------< child_rows_exist >-------------------------|
326 -- ----------------------------------------------------------------------------
327 Procedure child_rows_exist
328   (p_rule_id  in  number
329     ,p_start_date       in date
330     ,p_end_date         in date
331   );
332 --
333 end ame_rul_shd;