1 Package Body ff_con_ins as
2 /* $Header: ffconrhi.pkb 115.1 2002/12/23 13:59:57 arashid ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ff_con_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 -- 2) To set and unset the g_api_dml status as required (as we are about to
21 -- perform dml).
22 -- 3) To insert the row into the schema.
23 -- 4) To trap any constraint violations that may have occurred.
24 -- 5) To raise any other errors.
25 --
26 -- Prerequisites:
27 -- This is an internal private procedure which must be called from the ins
28 -- procedure and must have all mandatory attributes set (except the
29 -- object_version_number which is initialised within this procedure).
30 --
31 -- In Parameters:
32 -- A Pl/Sql record structre.
33 --
34 -- Post Success:
35 -- The specified row will be inserted into the schema.
36 --
37 -- Post Failure:
38 -- On the insert dml failure it is important to note that we always reset the
39 -- g_api_dml status to false.
40 -- If a check, unique or parent integrity constraint violation is raised the
41 -- constraint_error procedure will be called.
42 -- If any other error is reported, the error will be raised after the
43 -- g_api_dml status is reset.
44 --
45 -- Developer Implementation Notes:
46 -- None.
47 --
48 -- Access Status:
49 -- Internal Row Handler Use Only.
50 --
51 -- {End Of Comments}
52 -- ----------------------------------------------------------------------------
53 Procedure insert_dml(p_rec in out nocopy ff_con_shd.g_rec_type) is
54 --
55 l_proc varchar2(72) := g_package||'insert_dml';
56 --
57 Begin
58 hr_utility.set_location('Entering:'||l_proc, 5);
59 --
60 --
61 ff_con_shd.g_api_dml := true; -- Set the api dml status
62 --
63 -- Insert the row into: ff_archive_item_contexts
64 --
65 insert into ff_archive_item_contexts
66 ( archive_item_id,
67 sequence_no,
68 context,
69 context_id
70 )
71 Values
72 ( p_rec.archive_item_id,
73 p_rec.sequence_no,
74 p_rec.context,
75 p_rec.context_id
76 );
77 --
78 ff_con_shd.g_api_dml := false; -- Unset the api dml status
79 --
80 hr_utility.set_location(' Leaving:'||l_proc, 10);
81 Exception
82 When hr_api.check_integrity_violated Then
83 -- A check constraint has been violated
84 ff_con_shd.g_api_dml := false; -- Unset the api dml status
85 ff_con_shd.constraint_error
86 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
87 When hr_api.parent_integrity_violated Then
88 -- Parent integrity has been violated
89 ff_con_shd.g_api_dml := false; -- Unset the api dml status
90 ff_con_shd.constraint_error
91 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
92 When hr_api.unique_integrity_violated Then
93 -- Unique integrity has been violated
94 ff_con_shd.g_api_dml := false; -- Unset the api dml status
95 ff_con_shd.constraint_error
96 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
97 When Others Then
98 ff_con_shd.g_api_dml := false; -- Unset the api dml status
99 Raise;
100 End insert_dml;
101 --
102 -- ----------------------------------------------------------------------------
103 -- |------------------------------< pre_insert >------------------------------|
104 -- ----------------------------------------------------------------------------
105 -- {Start Of Comments}
106 --
107 -- Description:
108 -- This private procedure contains any processing which is required before
109 -- the insert dml. Presently, if the entity has a corresponding primary
110 -- key which is maintained by an associating sequence, the primary key for
111 -- the entity will be populated with the next sequence value in
112 -- preparation for the insert dml.
113 --
114 -- Prerequisites:
115 -- This is an internal procedure which is called from the ins procedure.
116 --
117 -- In Parameters:
118 -- A Pl/Sql record structre.
119 --
120 -- Post Success:
121 -- Processing continues.
122 --
123 -- Post Failure:
124 -- If an error has occurred, an error message and exception will be raised
125 -- but not handled.
126 --
127 -- Developer Implementation Notes:
128 -- Any pre-processing required before the insert dml is issued should be
129 -- coded within this procedure. As stated above, a good example is the
130 -- generation of a primary key number via a corresponding sequence.
131 -- It is important to note that any 3rd party maintenance should be reviewed
132 -- before placing in this procedure.
133 --
134 -- Access Status:
135 -- Internal Row Handler Use Only.
136 --
137 -- {End Of Comments}
138 -- ----------------------------------------------------------------------------
139 Procedure pre_insert(p_rec in out nocopy ff_con_shd.g_rec_type) is
140 --
141 l_proc varchar2(72) := g_package||'pre_insert';
142 --
143 --
144 --
145 Begin
146 hr_utility.set_location('Entering:'||l_proc, 5);
147 --
148 --
149 --
150 hr_utility.set_location(' Leaving:'||l_proc, 10);
151 End pre_insert;
152 --
153 -- ----------------------------------------------------------------------------
154 -- |-----------------------------< post_insert >------------------------------|
155 -- ----------------------------------------------------------------------------
156 -- {Start Of Comments}
157 --
158 -- Description:
159 -- This private procedure contains any processing which is required after the
160 -- insert dml.
161 --
162 -- Prerequisites:
163 -- This is an internal procedure which is called from the ins procedure.
164 --
165 -- In Parameters:
166 -- A Pl/Sql record structre.
167 --
168 -- Post Success:
169 -- Processing continues.
170 --
171 -- Post Failure:
172 -- If an error has occurred, an error message and exception will be raised
173 -- but not handled.
174 --
175 -- Developer Implementation Notes:
176 -- Any post-processing required after the insert dml is issued should be
177 -- coded within this procedure. It is important to note that any 3rd party
178 -- maintenance should be reviewed before placing in this procedure.
179 --
180 -- Access Status:
181 -- Internal Row Handler Use Only.
182 --
183 -- {End Of Comments}
184 -- ----------------------------------------------------------------------------
185 Procedure post_insert(p_rec in ff_con_shd.g_rec_type) is
186 --
187 l_proc varchar2(72) := g_package||'post_insert';
188 --
189 Begin
190 hr_utility.set_location('Entering:'||l_proc, 5);
191 --
192 hr_utility.set_location(' Leaving:'||l_proc, 10);
193 End post_insert;
194 --
195 -- ----------------------------------------------------------------------------
196 -- |---------------------------------< ins >----------------------------------|
197 -- ----------------------------------------------------------------------------
198 Procedure ins
199 (
200 p_rec in out nocopy ff_con_shd.g_rec_type
201 ) is
202 --
203 l_proc varchar2(72) := g_package||'ins';
204 --
205 Begin
206 hr_utility.set_location('Entering:'||l_proc, 5);
207 --
208 -- Call the supporting insert validate operations
209 --
210 ff_con_bus.insert_validate(p_rec);
211 --
212 -- Call the supporting pre-insert operation
213 --
214 pre_insert(p_rec);
215 --
216 -- Insert the row
217 --
218 insert_dml(p_rec);
219 --
220 -- Call the supporting post-insert operation
221 --
222 post_insert(p_rec);
223 end ins;
224 --
225 -- ----------------------------------------------------------------------------
226 -- |---------------------------------< ins >----------------------------------|
227 -- ----------------------------------------------------------------------------
228 Procedure ins
229 (
230 p_archive_item_id in number,
231 p_sequence_no in number,
232 p_context in varchar2,
233 p_context_id in number
234 ) is
235 --
236 l_rec ff_con_shd.g_rec_type;
237 l_proc varchar2(72) := g_package||'ins';
238 --
239 Begin
240 hr_utility.set_location('Entering:'||l_proc, 5);
241 --
242 -- Call conversion function to turn arguments into the
243 -- p_rec structure.
244 --
245 l_rec :=
246 ff_con_shd.convert_args
247 (
248 p_archive_item_id,
249 p_sequence_no,
250 p_context,
251 p_context_id
252 );
253 --
254 -- Having converted the arguments into the ff_con_rec
255 -- plsql record structure we call the corresponding record business process.
256 --
257 ins(l_rec);
258 --
259 -- The primary key argument(s)
260 -- are specified as IN parameters as they are also FK's as this
261 -- is a child table of FF_ARCHIVE_ITEMS.
262 -- p_archive_item_id is a foreign key to FF_ARCHIVE_ITEMS and
263 -- p_context_id is a foreign key to FF_CONTEXTS.
264 -- Hence they should be supplied in this insert.
265 --
266 hr_utility.set_location(' Leaving:'||l_proc, 10);
267 End ins;
268 --
269 end ff_con_ins;