DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_RHT_INS

Source


1 Package Body pqh_rht_ins as
2 /* $Header: pqrhtrhi.pkb 115.7 2002/12/06 18:08:02 rpasapul noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pqh_rht_ins.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< insert_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the actual dml insert logic. The processing of
17 --   this procedure are as follows:
18 --   1) Initialise the object_version_number to 1 if the object_version_number
19 --      is defined as an attribute for this entity.
20 --   3) To insert the row into the schema.
21 --   4) To trap any constraint violations that may have occurred.
22 --   5) To raise any other errors.
23 --
24 -- Prerequisites:
25 --   This is an internal private procedure which must be called from the ins
26 --   procedure and must have all mandatory attributes set (except the
27 --   object_version_number which is initialised within this procedure).
28 --
29 -- In Parameters:
30 --   A Pl/Sql record structre.
31 --
32 -- Post Success:
33 --   The specified row will be inserted into the schema.
34 --
35 -- Post Failure:
36 --   If a check, unique or parent integrity constraint violation is raised the
37 --   constraint_error procedure will be called.
38 --
39 -- Developer Implementation Notes:
40 --   None.
41 --
42 -- Access Status:
43 --   Internal Row Handler Use Only.
44 --
45 -- {End Of Comments}
46 -- ----------------------------------------------------------------------------
47 Procedure insert_dml(p_rec in out nocopy pqh_rht_shd.g_rec_type) is
48 --
49   l_proc  varchar2(72) := g_package||'insert_dml';
50 --
51 Begin
52   hr_utility.set_location('Entering:'||l_proc, 5);
53   p_rec.object_version_number := 1;  -- Initialise the object version
54   --
55   --
56   -- Insert the row into: pqh_routing_history
57   --
58   insert into pqh_routing_history
59   (	routing_history_id,
60 	approval_cd,
61 	comments,
62 	forwarded_by_assignment_id,
63 	forwarded_by_member_id,
64 	forwarded_by_position_id,
65 	forwarded_by_user_id,
66 	forwarded_by_role_id,
67 	forwarded_to_assignment_id,
68 	forwarded_to_member_id,
69 	forwarded_to_position_id,
70 	forwarded_to_user_id,
71 	forwarded_to_role_id,
72 	notification_date,
73 	pos_structure_version_id,
74 	routing_category_id,
75 	transaction_category_id,
76 	transaction_id,
77 	user_action_cd,
78         from_range_name,
79         to_range_name,
80         list_range_name,
81 	object_version_number
82   )
83   Values
84   (	p_rec.routing_history_id,
85 	p_rec.approval_cd,
86 	p_rec.comments,
87 	p_rec.forwarded_by_assignment_id,
88 	p_rec.forwarded_by_member_id,
89 	p_rec.forwarded_by_position_id,
90 	p_rec.forwarded_by_user_id,
91 	p_rec.forwarded_by_role_id,
92 	p_rec.forwarded_to_assignment_id,
93 	p_rec.forwarded_to_member_id,
94 	p_rec.forwarded_to_position_id,
95 	p_rec.forwarded_to_user_id,
96 	p_rec.forwarded_to_role_id,
97 	p_rec.notification_date,
98 	p_rec.pos_structure_version_id,
99 	p_rec.routing_category_id,
100 	p_rec.transaction_category_id,
101 	p_rec.transaction_id,
102 	p_rec.user_action_cd,
103         p_rec.from_range_name,
104         p_rec.to_range_name,
105         p_rec.list_range_name,
106 	p_rec.object_version_number
107   );
108   --
109   --
110   hr_utility.set_location(' Leaving:'||l_proc, 10);
111 Exception
112   When hr_api.check_integrity_violated Then
113     -- A check constraint has been violated
114     pqh_rht_shd.constraint_error
115       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
116   When hr_api.parent_integrity_violated Then
117     -- Parent integrity has been violated
118     pqh_rht_shd.constraint_error
119       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
120   When hr_api.unique_integrity_violated Then
121     -- Unique integrity has been violated
122     pqh_rht_shd.constraint_error
123       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
124   When Others Then
125     Raise;
126 End insert_dml;
127 --
128 -- ----------------------------------------------------------------------------
129 -- |------------------------------< pre_insert >------------------------------|
130 -- ----------------------------------------------------------------------------
131 -- {Start Of Comments}
132 --
133 -- Description:
134 --   This private procedure contains any processing which is required before
135 --   the insert dml. Presently, if the entity has a corresponding primary
136 --   key which is maintained by an associating sequence, the primary key for
137 --   the entity will be populated with the next sequence value in
138 --   preparation for the insert dml.
139 --
140 -- Prerequisites:
141 --   This is an internal procedure which is called from the ins procedure.
142 --
143 -- In Parameters:
144 --   A Pl/Sql record structre.
145 --
146 -- Post Success:
147 --   Processing continues.
148 --
149 -- Post Failure:
150 --   If an error has occurred, an error message and exception will be raised
151 --   but not handled.
152 --
153 -- Developer Implementation Notes:
154 --   Any pre-processing required before the insert dml is issued should be
155 --   coded within this procedure. As stated above, a good example is the
156 --   generation of a primary key number via a corresponding sequence.
157 --   It is important to note that any 3rd party maintenance should be reviewed
158 --   before placing in this procedure.
159 --
160 -- Access Status:
161 --   Internal Row Handler Use Only.
162 --
163 -- {End Of Comments}
164 -- ----------------------------------------------------------------------------
165 Procedure pre_insert(p_rec  in out nocopy pqh_rht_shd.g_rec_type) is
166 --
167   l_proc  varchar2(72) := g_package||'pre_insert';
168 --
169   Cursor C_Sel1 is select pqh_routing_history_s.nextval from sys.dual;
170 --
171 Begin
172   hr_utility.set_location('Entering:'||l_proc, 5);
173   --
174   --
175   -- Select the next sequence number
176   --
177   Open C_Sel1;
178   Fetch C_Sel1 Into p_rec.routing_history_id;
179   Close C_Sel1;
180   --
181   hr_utility.set_location(' Leaving:'||l_proc, 10);
182 End pre_insert;
183 --
184 -- ----------------------------------------------------------------------------
185 -- |-----------------------------< post_insert >------------------------------|
186 -- ----------------------------------------------------------------------------
187 -- {Start Of Comments}
188 --
189 -- Description:
190 --   This private procedure contains any processing which is required after the
191 --   insert dml.
192 --
193 -- Prerequisites:
194 --   This is an internal procedure which is called from the ins procedure.
195 --
196 -- In Parameters:
197 --   A Pl/Sql record structre.
198 --
199 -- Post Success:
200 --   Processing continues.
201 --
202 -- Post Failure:
203 --   If an error has occurred, an error message and exception will be raised
204 --   but not handled.
205 --
206 -- Developer Implementation Notes:
207 --   Any post-processing required after the insert dml is issued should be
208 --   coded within this procedure. It is important to note that any 3rd party
209 --   maintenance should be reviewed before placing in this procedure.
210 --
211 -- Access Status:
212 --   Internal Row Handler Use Only.
213 --
214 -- {End Of Comments}
215 -- ----------------------------------------------------------------------------
216 Procedure post_insert(
217 p_effective_date in date,p_rec in pqh_rht_shd.g_rec_type) is
218 --
219   l_proc  varchar2(72) := g_package||'post_insert';
220 --
221 --
222 --
223 
224 Begin
225   hr_utility.set_location('Entering:'||l_proc, 5);
226 --
227   --
228   -- Start of API User Hook for post_insert.
229   --
230   begin
231     --
232     pqh_rht_rki.after_insert
233       (
234   p_routing_history_id            =>p_rec.routing_history_id
235  ,p_approval_cd                   =>p_rec.approval_cd
236  ,p_comments                      =>p_rec.comments
237  ,p_forwarded_by_assignment_id    =>p_rec.forwarded_by_assignment_id
238  ,p_forwarded_by_member_id        =>p_rec.forwarded_by_member_id
239  ,p_forwarded_by_position_id      =>p_rec.forwarded_by_position_id
240  ,p_forwarded_by_user_id          =>p_rec.forwarded_by_user_id
241  ,p_forwarded_by_role_id          =>p_rec.forwarded_by_role_id
242  ,p_forwarded_to_assignment_id    =>p_rec.forwarded_to_assignment_id
243  ,p_forwarded_to_member_id        =>p_rec.forwarded_to_member_id
244  ,p_forwarded_to_position_id      =>p_rec.forwarded_to_position_id
245  ,p_forwarded_to_user_id          =>p_rec.forwarded_to_user_id
246  ,p_forwarded_to_role_id          =>p_rec.forwarded_to_role_id
247  ,p_notification_date             =>p_rec.notification_date
248  ,p_pos_structure_version_id      =>p_rec.pos_structure_version_id
249  ,p_routing_category_id           =>p_rec.routing_category_id
250  ,p_transaction_category_id       =>p_rec.transaction_category_id
251  ,p_transaction_id                =>p_rec.transaction_id
252  ,p_user_action_cd                =>p_rec.user_action_cd
253  ,p_from_range_name               =>p_rec.from_range_name
254  ,p_to_range_name                 =>p_rec.to_range_name
255  ,p_list_range_name               =>p_rec.list_range_name
256  ,p_object_version_number         =>p_rec.object_version_number
257  ,p_effective_date                =>p_effective_date
258       );
259     --
260    --
261   exception
262     --
263     when hr_api.cannot_find_prog_unit then
264       --
265       hr_api.cannot_find_prog_unit_error
266         (p_module_name => 'pqh_routing_history'
267         ,p_hook_type   => 'AI');
268       --
269   end;
270   --
271   -- End of API User Hook for post_insert.
272   --
273   --
274   hr_utility.set_location(' Leaving:'||l_proc, 10);
275 End post_insert;
276 --
277 -- ----------------------------------------------------------------------------
278 -- |---------------------------------< ins >----------------------------------|
279 -- ----------------------------------------------------------------------------
280 Procedure ins
281   (
282   p_effective_date in date,
283   p_rec        in out nocopy pqh_rht_shd.g_rec_type
284   ) is
285 --
286   l_proc  varchar2(72) := g_package||'ins';
287 --
288 Begin
289   hr_utility.set_location('Entering:'||l_proc, 5);
290   --
291   -- Call the supporting insert validate operations
292   --
293   pqh_rht_bus.insert_validate(p_rec
294   ,p_effective_date);
295   --
296   -- Call the supporting pre-insert operation
297   --
298   pre_insert(p_rec);
299   --
300   -- Insert the row
301   --
302   insert_dml(p_rec);
303   --
304   -- Call the supporting post-insert operation
305   --
306   post_insert(
307        p_effective_date,
308        p_rec
309        );
310 end ins;
311 --
312 -- ----------------------------------------------------------------------------
313 -- |---------------------------------< ins >----------------------------------|
314 -- ----------------------------------------------------------------------------
315 Procedure ins
316   (
317   p_effective_date in date,
318   p_routing_history_id           out nocopy number,
319   p_approval_cd                  in varchar2         default null,
320   p_comments                     in varchar2         default null,
321   p_forwarded_by_assignment_id   in number           default null,
322   p_forwarded_by_member_id       in number           default null,
323   p_forwarded_by_position_id     in number           default null,
324   p_forwarded_by_user_id         in number           default null,
325   p_forwarded_by_role_id         in number           default null,
326   p_forwarded_to_assignment_id   in number           default null,
327   p_forwarded_to_member_id       in number           default null,
328   p_forwarded_to_position_id     in number           default null,
329   p_forwarded_to_user_id         in number           default null,
330   p_forwarded_to_role_id         in number           default null,
331   p_notification_date            in date,
332   p_pos_structure_version_id     in number           default null,
333   p_routing_category_id          in number,
334   p_transaction_category_id      in number,
335   p_transaction_id               in number,
336   p_user_action_cd               in varchar2,
337   p_from_range_name               in varchar2,
338   p_to_range_name                 in varchar2,
339   p_list_range_name               in varchar2,
340   p_object_version_number        out nocopy number
341   ) is
342 --
343   l_rec	  pqh_rht_shd.g_rec_type;
344   l_proc  varchar2(72) := g_package||'ins';
345 --
346 Begin
347   hr_utility.set_location('Entering:'||l_proc, 5);
348   --
349   -- Call conversion function to turn arguments into the
350   -- p_rec structure.
351   --
352   l_rec :=
353   pqh_rht_shd.convert_args
354   (
355   null,
356   p_approval_cd,
357   p_comments,
358   p_forwarded_by_assignment_id,
359   p_forwarded_by_member_id,
360   p_forwarded_by_position_id,
361   p_forwarded_by_user_id,
362   p_forwarded_by_role_id,
363   p_forwarded_to_assignment_id,
364   p_forwarded_to_member_id,
365   p_forwarded_to_position_id,
366   p_forwarded_to_user_id,
367   p_forwarded_to_role_id,
368   p_notification_date,
369   p_pos_structure_version_id,
370   p_routing_category_id,
371   p_transaction_category_id,
372   p_transaction_id,
373   p_user_action_cd,
374   p_from_range_name,
375   p_to_range_name,
376   p_list_range_name,
377   null
378   );
379   --
380   -- Having converted the arguments into the pqh_rht_rec
381   -- plsql record structure we call the corresponding record business process.
382   --
383   ins(
384     p_effective_date,
385     l_rec
386     );
387   --
388   -- As the primary key argument(s)
389   -- are specified as an OUT's we must set these values.
390   --
391   p_routing_history_id := l_rec.routing_history_id;
392   p_object_version_number := l_rec.object_version_number;
393   --
394   hr_utility.set_location(' Leaving:'||l_proc, 10);
395 End ins;
396 --
397 end pqh_rht_ins;