DBA Data[Home] [Help]

PACKAGE: APPS.AME_ATU_SHD

Source


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