[Home] [Help]
PACKAGE BODY: APPS.OTA_TEA_SHD
Source
1 Package Body ota_tea_shd as
2 /* $Header: ottea01t.pkb 120.1 2005/06/09 01:16:02 jbharath noship $ */
3
4 --
5 -- ----------------------------------------------------------------------------
6 -- | Private Global Definitions |
7 -- ----------------------------------------------------------------------------
8 --
9 g_package varchar2(33) := ' ota_tea_shd.'; -- Global package name
10 --
11 -- ----------------------------------------------------------------------------
12 -- |------------------------< return_api_dml_status >-------------------------|
13 -- ----------------------------------------------------------------------------
14 Function return_api_dml_status Return Boolean Is
15 --
16 l_proc varchar2(72) := g_package||'return_api_dml_status';
17 --
18 Begin
19 hr_utility.set_location('Entering:'||l_proc, 5);
20 --
21 Return (nvl(g_api_dml, false));
22 --
23 hr_utility.set_location(' Leaving:'||l_proc, 10);
24 End return_api_dml_status;
25 --
26 -- ----------------------------------------------------------------------------
27 -- |---------------------------< constraint_error >---------------------------|
28 -- ----------------------------------------------------------------------------
29 Procedure constraint_error
30 (p_constraint_name in varchar2) Is
31 --
32 l_proc varchar2(72) := g_package||'constraint_error';
33 --
34 Begin
35 hr_utility.set_location('Entering:'||l_proc, 5);
36 --
37 If (p_constraint_name = 'OTA_EVENT_ASSOCIATIONS_PK') Then
38 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
39 hr_utility.set_message_token('PROCEDURE', l_proc);
40 hr_utility.set_message_token('STEP','5');
41 hr_utility.raise_error;
42 ElsIf (p_constraint_name = 'OTA_EVENT_ASSOCIATIONS_UK2') Then
43 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
44 hr_utility.set_message_token('PROCEDURE', l_proc);
45 hr_utility.set_message_token('STEP','10');
46 hr_utility.raise_error;
47 Elsif (p_constraint_name = 'OTA_TEA_CHECK_KEYS') then
51 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
48 fnd_message.set_name('OTA','OTA_13528_TEA_INVALID_KEY');
49 fnd_message.raise_error;
50 Else
52 hr_utility.set_message_token('PROCEDURE', l_proc);
53 hr_utility.set_message_token('STEP','15');
54 hr_utility.raise_error;
55 End If;
56 --
57 hr_utility.set_location(' Leaving:'||l_proc, 10);
58 End constraint_error;
59 --
60 -- ----------------------------------------------------------------------------
61 -- |-----------------------------< api_updating >-----------------------------|
62 -- ----------------------------------------------------------------------------
63 Function api_updating
64 (
65 p_event_association_id in number
66 ) Return Boolean Is
67 --
68 --
69 -- Cursor selects the 'current' row from the HR Schema
70 --
71 Cursor C_Sel1 is
72 select
73 event_association_id,
74 event_id,
75 customer_id,
76 organization_id,
77 job_id,
78 position_id,
79 comments,
80 tea_information_category,
81 tea_information1,
82 tea_information2,
83 tea_information3,
84 tea_information4,
85 tea_information5,
86 tea_information6,
87 tea_information7,
88 tea_information8,
89 tea_information9,
90 tea_information10,
91 tea_information11,
92 tea_information12,
93 tea_information13,
94 tea_information14,
95 tea_information15,
96 tea_information16,
97 tea_information17,
98 tea_information18,
99 tea_information19,
100 tea_information20
101 from ota_event_associations
102 where event_association_id = p_event_association_id;
103 --
104 l_proc varchar2(72) := g_package||'api_updating';
105 l_fct_ret boolean;
106 --
107 Begin
108 hr_utility.set_location('Entering:'||l_proc, 5);
109 --
110 If (
111 p_event_association_id is null
112 ) Then
113 --
114 -- One of the primary key arguments is null therefore we must
115 -- set the returning function value to false
116 --
117 l_fct_ret := false;
118 Else
119 If (
120 p_event_association_id = g_old_rec.event_association_id
121 ) Then
122 hr_utility.set_location(l_proc, 10);
123 --
124 -- The g_old_rec is current therefore we must
125 -- set the returning function to true
126 --
127 l_fct_ret := true;
128 Else
129 --
130 -- Select the current row into g_old_rec
131 --
132 Open C_Sel1;
133 Fetch C_Sel1 Into g_old_rec;
134 If C_Sel1%notfound Then
135 Close C_Sel1;
136 --
137 -- The primary key is invalid therefore we must error
138 --
139 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
140 hr_utility.raise_error;
141 End If;
142 Close C_Sel1;
143 --
144 hr_utility.set_location(l_proc, 15);
145 l_fct_ret := true;
146 End If;
147 End If;
148 hr_utility.set_location(' Leaving:'||l_proc, 20);
149 Return (l_fct_ret);
150 --
151 End api_updating;
152 --
153 -- ----------------------------------------------------------------------------
154 -- |---------------------------------< lck >----------------------------------|
155 -- ----------------------------------------------------------------------------
156 procedure lck
157 (
158 p_event_association_id in number
159 ) is
160 begin
161 lck(p_event_association_id => p_event_association_id
162 ,p_booking_id => null
163 ,p_tdb_object_version_number => null);
164 end;
165 --
166 Procedure lck
167 (
168 p_event_association_id in number
169 ,p_booking_id in number
170 ,p_tdb_object_version_number in number
171 ) is
172 --
173 -- Cursor selects the 'current' row from the HR Schema
174 --
175 Cursor C_Sel1 is
176 select event_association_id,
177 event_id,
178 customer_id,
179 organization_id,
180 job_id,
181 position_id,
182 comments,
183 tea_information_category,
184 tea_information1,
185 tea_information2,
186 tea_information3,
187 tea_information4,
188 tea_information5,
189 tea_information6,
190 tea_information7,
191 tea_information8,
192 tea_information9,
193 tea_information10,
194 tea_information11,
195 tea_information12,
196 tea_information13,
197 tea_information14,
198 tea_information15,
199 tea_information16,
200 tea_information17,
201 tea_information18,
202 tea_information19,
203 tea_information20
204 from ota_event_associations
205 where event_association_id = p_event_association_id
206 for update nowait;
207 --
208 l_proc varchar2(72) := g_package||'lck';
209 --
210 Begin
211 hr_utility.set_location('Entering:'||l_proc, 5);
212 --
213 -- Add any mandatory argument checking here:
214 -- Example:
215 -- hr_api.mandatory_arg_error
216 -- (p_api_name => l_proc,
217 -- p_argument => 'object_version_number',
218 -- p_argument_value => p_object_version_number);
219 --
220 hr_utility.trace('Event Association ID is '||to_char(p_event_association_id));
221 Open C_Sel1;
222 Fetch C_Sel1 Into g_old_rec;
223 If C_Sel1%notfound then
224 Close C_Sel1;
225 --
226 -- The primary key is invalid therefore we must error
227 --
228 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
229 hr_utility.raise_error;
230 End If;
231 Close C_Sel1;
232 --
233 if p_booking_id is not null then
234 OTA_TDB_SHD.lck (
235 p_booking_id => p_booking_id
236 ,p_object_version_number => p_tdb_object_version_number
237 );
238 end if;
239 --
240 hr_utility.set_location(' Leaving:'||l_proc, 10);
241 --
242 -- We need to trap the ORA LOCK exception
243 --
244 Exception
245 When HR_Api.Object_Locked then
246 --
247 -- The object is locked therefore we need to supply a meaningful
248 -- error message.
249 --
250 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
251 hr_utility.set_message_token('TABLE_NAME', 'ota_event_associations');
252 hr_utility.raise_error;
253 End lck;
254 --
255 -- ----------------------------------------------------------------------------
256 -- |-----------------------------< convert_args >-----------------------------|
257 -- ----------------------------------------------------------------------------
258 Function convert_args
259 (
260 p_event_association_id in number,
261 p_event_id in number,
262 p_customer_id in number,
263 p_organization_id in number,
264 p_job_id in number,
265 p_position_id in number,
266 p_comments in varchar2,
267 p_tea_information_category in varchar2,
268 p_tea_information1 in varchar2,
269 p_tea_information2 in varchar2,
270 p_tea_information3 in varchar2,
271 p_tea_information4 in varchar2,
272 p_tea_information5 in varchar2,
273 p_tea_information6 in varchar2,
274 p_tea_information7 in varchar2,
275 p_tea_information8 in varchar2,
276 p_tea_information9 in varchar2,
277 p_tea_information10 in varchar2,
278 p_tea_information11 in varchar2,
279 p_tea_information12 in varchar2,
280 p_tea_information13 in varchar2,
281 p_tea_information14 in varchar2,
282 p_tea_information15 in varchar2,
283 p_tea_information16 in varchar2,
284 p_tea_information17 in varchar2,
285 p_tea_information18 in varchar2,
286 p_tea_information19 in varchar2,
287 p_tea_information20 in varchar2
288 )
289 Return g_rec_type is
290 --
291 l_rec g_rec_type;
292 l_proc varchar2(72) := g_package||'convert_args';
293 --
294 Begin
295 --
296 hr_utility.set_location('Entering:'||l_proc, 5);
297 --
298 -- Convert arguments into local l_rec structure.
299 --
300 l_rec.event_association_id := p_event_association_id;
301 l_rec.event_id := p_event_id;
302 l_rec.customer_id := p_customer_id;
303 l_rec.organization_id := p_organization_id;
304 l_rec.job_id := p_job_id;
305 l_rec.position_id := p_position_id;
306 l_rec.comments := p_comments;
307 l_rec.tea_information_category := p_tea_information_category;
308 l_rec.tea_information1 := p_tea_information1;
309 l_rec.tea_information2 := p_tea_information2;
310 l_rec.tea_information3 := p_tea_information3;
311 l_rec.tea_information4 := p_tea_information4;
312 l_rec.tea_information5 := p_tea_information5;
313 l_rec.tea_information6 := p_tea_information6;
314 l_rec.tea_information7 := p_tea_information7;
315 l_rec.tea_information8 := p_tea_information8;
316 l_rec.tea_information9 := p_tea_information9;
317 l_rec.tea_information10 := p_tea_information10;
318 l_rec.tea_information11 := p_tea_information11;
319 l_rec.tea_information12 := p_tea_information12;
320 l_rec.tea_information13 := p_tea_information13;
321 l_rec.tea_information14 := p_tea_information14;
322 l_rec.tea_information15 := p_tea_information15;
323 l_rec.tea_information16 := p_tea_information16;
324 l_rec.tea_information17 := p_tea_information17;
325 l_rec.tea_information18 := p_tea_information18;
326 l_rec.tea_information19 := p_tea_information19;
327 l_rec.tea_information20 := p_tea_information20;
328 --
329 -- Return the plsql record structure.
330 --
331 hr_utility.set_location(' Leaving:'||l_proc, 10);
332 Return(l_rec);
333 --
334 End convert_args;
335 --
336 end ota_tea_shd;