DBA Data[Home] [Help]

PACKAGE: APPS.AME_CNU_SHD

Source


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