[Home] [Help]
PACKAGE BODY: APPS.OTA_RUD_SHD
Source
1 PACKAGE BODY OTA_RUD_SHD as
2 /* $Header: otrudrhi.pkb 120.2 2005/09/08 06:34:32 pgupta noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ota_rud_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14 (p_constraint_name in all_constraints.constraint_name%TYPE
15 ) Is
16 --
17 l_proc varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20 --
21 hr_utility.set_location('Entering:'||l_proc, 5);
22 --
23 -- Key constraints
24 --
25 If (p_constraint_name = 'OTA_RESOURCE_USAGES_FK1') Then
26 fnd_message.set_name ('OTA', 'OTA_13202_GEN_INVALID_KEY');
27 fnd_message.set_token ('COLUMN_NAME','SUPPLIED_RESOURCE_ID');
28 fnd_message.set_token ('TABLE_NAME', 'OTA_SUPPLIABLE_RESOURCES');
29 fnd_message.raise_error;
30 ElsIf (p_constraint_name = 'OTA_RESOURCE_USAGES_FK2') Then
31 fnd_message.set_name ('OTA', 'OTA_13235_RUD_NO_ACTIVITY');
32 fnd_message.raise_error;
33 ElsIf (p_constraint_name = 'OTA_RESOURCE_USAGES_PK') Then
34 fnd_message.set_name ('OTA', 'OTA_13216_RUD_RESOURCE_UNIQUE');
35 fnd_message.raise_error;
36 --
37 -- Check constraints
38 --
39 ElsIf (p_constraint_name = 'OTA_RUD_DATES') Then
40 fnd_message.set_name ('OTA', 'OTA_13312_GEN_DATE_ORDER');
41 fnd_message.raise_error;
42 ElsIf (p_constraint_name = 'OTA_RUD_EXCLUSIVITY') Then
43 fnd_message.set_name ('OTA', 'OTA_13253_RUD_EXCLUSIVITY');
44 fnd_message.raise_error;
45 ElsIf (p_constraint_name = 'OTA_RUD_REQUIRED_FLAG_CHK') Then
46 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
47 hr_utility.set_message_token('PROCEDURE', l_proc);
48 hr_utility.set_message_token('STEP','30');
49 hr_utility.raise_error;
50 ElsIf (p_constraint_name = 'OTA_RUD_RESOURCE_ROLE') Then
51 fnd_message.set_name ('OTA', 'OTA_13254_RUD_RESOURCE_ROLE');
52 fnd_message.raise_error;
53 --
54 -- Others, see below
55 --
56 elsif (p_constraint_name = 'OTA_RUD_NON_TRANSFER') then
57 fnd_message.set_name ('OTA', 'OTA_13633_RUD_NON_TRANSFER');
58 fnd_message.raise_error;
59 elsif (p_constraint_name = 'OTA_RUD_TAV_DATES') then
60 fnd_message.set_name ('OTA', 'OTA_13256_RUD_TAV_DATES');
61 fnd_message.raise_error;
62 elsif (p_constraint_name = 'OTA_RUD_TSR_DATES') then
63 fnd_message.set_name ('OTA', 'OTA_13257_RUD_TSR_DATES');
64 fnd_message.raise_error;
65 elsif (p_constraint_name = 'OTA_RUD_BUSINESS_GROUPS') then
66 fnd_message.set_name ('OTA', 'OTA_13247_RUD_SAME_BIZ_GROUP');
67 fnd_message.raise_error;
68 elsif (p_constraint_name = 'OTA_RUD_REQUIRED') then
69 HR_UTILITY.SET_MESSAGE (801,'HR_7166_OBJECT_CHK_CONSTRAINT');
70 HR_UTILITY.SET_MESSAGE_TOKEN ('CONSTRAINT_NAME', 'OTA_RUD_REQUIRED');
71 HR_UTILITY.SET_MESSAGE_TOKEN ('TABLE_NAME', 'OTA_RESOURCE_USAGES');
72 HR_UTILITY.raise_error;
73 --
74 --
75 Else
76 fnd_message.set_name ('OTA', 'OTA_13259_GEN_UNKN_CONSTRAINT');
77 fnd_message.set_token ('PROCEDURE', l_proc);
78 fnd_message.set_token ('CONSTRAINT', p_constraint_name);
79 fnd_message.raise_error;
80 End If;
81 --
82 hr_utility.set_location(' Leaving:'||l_proc, 10);
83 --
84 End constraint_error;
85 --
86 -- ----------------------------------------------------------------------------
87 -- |-----------------------------< api_updating >-----------------------------|
88 -- ----------------------------------------------------------------------------
89 Function api_updating
90 (p_resource_usage_id in number
91 ,p_object_version_number in number
92 )
93 Return Boolean Is
94 --
95 --
96 -- Cursor selects the 'current' row from the HR Schema
97 --
98 Cursor C_Sel1 is
99 select
100 resource_usage_id
101 ,supplied_resource_id
102 ,activity_version_id
103 ,object_version_number
104 ,required_flag
105 ,start_date
106 ,comments
107 ,end_date
108 ,quantity
109 ,resource_type
110 ,role_to_play
111 ,usage_reason
112 ,rud_information_category
113 ,rud_information1
114 ,rud_information2
115 ,rud_information3
116 ,rud_information4
117 ,rud_information5
118 ,rud_information6
119 ,rud_information7
120 ,rud_information8
121 ,rud_information9
122 ,rud_information10
123 ,rud_information11
124 ,rud_information12
125 ,rud_information13
126 ,rud_information14
127 ,rud_information15
128 ,rud_information16
129 ,rud_information17
130 ,rud_information18
131 ,rud_information19
132 ,rud_information20
133 ,offering_id
134 from ota_resource_usages
135 where resource_usage_id = p_resource_usage_id;
136 --
137 l_fct_ret boolean;
138 --
139 Begin
140 --
141 If (p_resource_usage_id is null and
142 p_object_version_number is null
143 ) Then
144 --
145 -- One of the primary key arguments is null therefore we must
146 -- set the returning function value to false
147 --
148 l_fct_ret := false;
149 Else
150 If (p_resource_usage_id
151 = ota_rud_shd.g_old_rec.resource_usage_id and
152 p_object_version_number
153 = ota_rud_shd.g_old_rec.object_version_number
154 ) Then
155 --
156 -- The g_old_rec is current therefore we must
157 -- set the returning function to true
158 --
159 l_fct_ret := true;
160 Else
161 --
162 -- Select the current row into g_old_rec
163 --
164 Open C_Sel1;
165 Fetch C_Sel1 Into ota_rud_shd.g_old_rec;
166 If C_Sel1%notfound Then
167 Close C_Sel1;
168 --
169 -- The primary key is invalid therefore we must error
170 --
171 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
172 hr_utility.raise_error;
173 End If;
174 Close C_Sel1;
175 If (p_object_version_number
176 <> ota_rud_shd.g_old_rec.object_version_number) Then
177 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
178 hr_utility.raise_error;
179 End If;
180 l_fct_ret := true;
181 End If;
182 End If;
183 Return (l_fct_ret);
184 --
185 End api_updating;
186 --
187 -- ----------------------------------------------------------------------------
188 -- |---------------------------------< lck >----------------------------------|
189 -- ----------------------------------------------------------------------------
190 Procedure lck
191 (p_resource_usage_id in number
192 ,p_object_version_number in number
193 ) is
194 --
195 -- Cursor selects the 'current' row from the HR Schema
196 --
197 Cursor C_Sel1 is
198 select resource_usage_id,
199 supplied_resource_id,
200 activity_version_id,
201 object_version_number,
202 required_flag,
203 start_date,
204 comments,
205 end_date,
206 quantity,
207 resource_type,
208 role_to_play,
209 usage_reason,
210 rud_information_category,
211 rud_information1,
212 rud_information2,
213 rud_information3,
214 rud_information4,
215 rud_information5,
216 rud_information6,
217 rud_information7,
218 rud_information8,
219 rud_information9,
220 rud_information10,
221 rud_information11,
222 rud_information12,
223 rud_information13,
224 rud_information14,
225 rud_information15,
226 rud_information16,
227 rud_information17,
228 rud_information18,
229 rud_information19,
230 rud_information20,
231 offering_id
232 from ota_resource_usages
233 where resource_usage_id = p_resource_usage_id
234 for update nowait;
235 --
236 l_proc varchar2(72) := g_package||'lck';
237 --
238 Begin
239 hr_utility.set_location('Entering:'||l_proc, 5);
240 --
241 -- Add any mandatory argument checking here:
242 -- Example:
243 -- hr_api.mandatory_arg_error
244 -- (p_api_name => l_proc,
245 -- p_argument => 'object_version_number',
246 -- p_argument_value => p_object_version_number);
247 --
248 Open C_Sel1;
249 Fetch C_Sel1 Into g_old_rec;
250 If C_Sel1%notfound then
251 Close C_Sel1;
252 --
253 -- The primary key is invalid therefore we must error
254 --
255 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
256 hr_utility.raise_error;
257 End If;
258 Close C_Sel1;
259 If (p_object_version_number <> g_old_rec.object_version_number) Then
260 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
261 hr_utility.raise_error;
262 End If;
263 --
264 hr_utility.set_location(' Leaving:'||l_proc, 10);
265 --
266 -- We need to trap the ORA LOCK exception
267 --
268 Exception
269 When HR_Api.Object_Locked then
270 --
271 -- The object is locked therefore we need to supply a meaningful
272 -- error message.
273 --
274 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
275 hr_utility.set_message_token('TABLE_NAME', 'ota_resource_usages');
276 hr_utility.raise_error;
277 End lck;
278 --
279 -- ----------------------------------------------------------------------------
280 -- |-----------------------------< convert_args >-----------------------------|
281 -- ----------------------------------------------------------------------------
282 Function convert_args
283 (p_resource_usage_id in number
284 ,p_supplied_resource_id in number
285 ,p_activity_version_id in number
286 ,p_object_version_number in number
287 ,p_required_flag in varchar2
288 ,p_start_date in date
289 ,p_comments in varchar2
290 ,p_end_date in date
291 ,p_quantity in number
292 ,p_resource_type in varchar2
293 ,p_role_to_play in varchar2
294 ,p_usage_reason in varchar2
295 ,p_rud_information_category in varchar2
296 ,p_rud_information1 in varchar2
297 ,p_rud_information2 in varchar2
298 ,p_rud_information3 in varchar2
299 ,p_rud_information4 in varchar2
300 ,p_rud_information5 in varchar2
301 ,p_rud_information6 in varchar2
302 ,p_rud_information7 in varchar2
303 ,p_rud_information8 in varchar2
304 ,p_rud_information9 in varchar2
305 ,p_rud_information10 in varchar2
306 ,p_rud_information11 in varchar2
307 ,p_rud_information12 in varchar2
308 ,p_rud_information13 in varchar2
309 ,p_rud_information14 in varchar2
310 ,p_rud_information15 in varchar2
311 ,p_rud_information16 in varchar2
312 ,p_rud_information17 in varchar2
313 ,p_rud_information18 in varchar2
314 ,p_rud_information19 in varchar2
315 ,p_rud_information20 in varchar2
316 ,p_offering_id in number
317 )
318 Return g_rec_type is
319 --
320 l_rec g_rec_type;
321 --
322 Begin
323 --
324 -- Convert arguments into local l_rec structure.
325 --
326 l_rec.resource_usage_id := p_resource_usage_id;
327 l_rec.supplied_resource_id := p_supplied_resource_id;
328 l_rec.activity_version_id := p_activity_version_id;
329 l_rec.object_version_number := p_object_version_number;
330 l_rec.required_flag := p_required_flag;
331 l_rec.start_date := p_start_date;
332 l_rec.comments := p_comments;
333 l_rec.end_date := p_end_date;
334 l_rec.quantity := p_quantity;
335 l_rec.resource_type := p_resource_type;
336 l_rec.role_to_play := p_role_to_play;
337 l_rec.usage_reason := p_usage_reason;
338 l_rec.rud_information_category := p_rud_information_category;
339 l_rec.rud_information1 := p_rud_information1;
340 l_rec.rud_information2 := p_rud_information2;
341 l_rec.rud_information3 := p_rud_information3;
342 l_rec.rud_information4 := p_rud_information4;
343 l_rec.rud_information5 := p_rud_information5;
344 l_rec.rud_information6 := p_rud_information6;
345 l_rec.rud_information7 := p_rud_information7;
346 l_rec.rud_information8 := p_rud_information8;
347 l_rec.rud_information9 := p_rud_information9;
348 l_rec.rud_information10 := p_rud_information10;
349 l_rec.rud_information11 := p_rud_information11;
350 l_rec.rud_information12 := p_rud_information12;
351 l_rec.rud_information13 := p_rud_information13;
352 l_rec.rud_information14 := p_rud_information14;
353 l_rec.rud_information15 := p_rud_information15;
354 l_rec.rud_information16 := p_rud_information16;
355 l_rec.rud_information17 := p_rud_information17;
356 l_rec.rud_information18 := p_rud_information18;
357 l_rec.rud_information19 := p_rud_information19;
358 l_rec.rud_information20 := p_rud_information20;
359 l_rec.offering_id := p_offering_id;
360 --
361 -- Return the plsql record structure.
362 --
363 Return(l_rec);
364 --
365 End convert_args;
366 --
367 end ota_rud_shd;